DomC Posted October 31, 2015 Share Posted October 31, 2015 Hi I just work on a script, that let us jump to the next saved view in alphabetical order. (I know Vectorworks Remote could do that) First Problem: Handle the saved views by script (I tried with ID, Parent etc. and failed). Thanks to Pat Standford (My Hero) which found a solution with vs.FIn3D :-) https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=118441 Second Problem: The saved views are stored in the order they was created. Here Python scripting is showing one advantage. We can beatifully sort list with python. #Python code to create list h=vs.FIn3D(vs.GetObject('Darstellungen'))# International Version "saved views" views=[] while h != None: name=vs.GetName(h) views.append(name) h=vs.NextObj(h) views.sort() # Sorts the list alphabetically An extended Version. It maintains a Text Block inside the document which acts as a counter in the document. Because after execution the script can't remember the last saved view. Maybe there is a more smarter way by using a hidden record or something like this. I am not familiar with that. #Python code to create list, grab and change the named(Info Palette Data field) text block and call up the saved view h=vs.FIn3D(vs.GetObject('Darstellungen'))# International Version "saved views" views=[] while h != None: name=vs.GetName(h) views.append(name) h=vs.NextObj(h) views.sort() # Sorts the list alphabetically zähler=vs.GetObject('zähler') #Handle to the text block Darstellung=vs.GetText(zähler) #Read Text index=views.index(Darstellung) #Check on which index of the list (of the sorted list) this view is stored if index < len(views)-1: # -1 it's because len counts from 0 I think vs.SetText(zähler, views[index+1]) #Change the Text block to the next saved view vs.Message(index) if index+1 == len(views): vs.SetText(zähler, views[0]) #Starts from the beginning vs.ResetObject(zähler) vs.VRestore(Darstellung) #call saved View This hits on an idea to make a slide show, from save views. With an automatically delay. But this is tricky, because it seems to be a feature from scripts, that they do not regenerate views during the script execution. I tried out with a Dialog Box. That seems to work. But who want's to klick a away a Dialoge Box after every Slide. I tried to do this this way: import time h=vs.FIn3D(vs.GetObject('Darstellungen')) views=[] i=0 while h != None: name=vs.GetName(h) views.append(name) h=vs.NextObj(h) views.sort() length=len(views) def view(): for i in range(length): #vs.Message(str(views[i])) #time.sleep(0.5) #vs.SetZoom(100) #vs.SetZoom(50) #vs.ReDrawAll vs.VRestore(views[i]) #vs.Wait(1) return() view() Quote Link to comment
Dieter @ DWorks Posted November 4, 2015 Share Posted November 4, 2015 Hi, first of all, make it a menu command, that way you can store parameters like you can do with tools and objects. Each time it is run, you can store the last saved view in a parameter to get it back the next time. second, you could add the menu command to your context menu, and that could act like a next button, no? Or assign a shortcut to it. You'll have no dialog boxes, and the slideshow will just run, like a PowerPoint presentation, just not automatic, but a click or button press isn't that bad imho. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.