markymarc Posted July 20, 2019 Share Posted July 20, 2019 Hello helpful people in the know. I have never used VW scripting to date - however thought it might be useful for the following : - I have a file with about 150 or so objects. - They are all named - They all have the same record format attached I would like to create an animation where they all come on one by one (basically like an installation instruction). So I thought the easiest to do that would be if I had each of these objects sitting in its own class, and then use animation works to create what I'm after. From what I've read so far it sounds like it should be fairly straightforward to create a little script that: - goes through all the objects , one by one, and - reads either (a) a field from the record format (that contains an ID number) , or (b) reads the objects name from the OIP data set , as a selection criteria, and then - automatically creates a new class with (a) or (b) as class name, and then - puts the object into that new class. - then moves on to the next object. Is that easy to do ? Can anyone point me in the right direction or help me with this? Also, can you point me to a resource pointing out the differences / thought approaches between Vs , python etc ? (I used to some pascal programming about 30 years ago so thought the vector script sounds like it may be most down my alley 🙂 ? ) Would love to play wiht all this a bit more once I get some starting points going... Thanks ! Quote Link to comment
Pat Stanford Posted July 21, 2019 Share Posted July 21, 2019 Yes, everything you want to do can be readily easily done in either VectorScript of PythonScript. If you remember any of your Pascal and don't mind the Begins/Ends it requires, then Vectorscript is probably your best bet. If Begins/Ends drove you crazy, then you might want to consider Pythonscript instead, but then you get to deal with it being "white space" delimited and an extra space will put something at a different indent (and therefore subroutine group) level. Here is some pseudocode. Procedure Create-Set-Class; Procedure Make_It_So(H1:Handle); {procedure to be called by ForEachObject} Var S1:String; Begin S1:=GetRField(H1,'Your-Record-Name'.'Your-Class-Name'); NameClass(S1); {Note Class names can only be 20 characters long} SetClass(H1,S1); End; Begin ForEachObject(Make_It_So,((R IN ['Your-Record-Name']))); End; Run(Create-Set-Class); The above was typed into the forum, so please excuse any typos or other errors. You may want to change the criteria in the ForEachObject to limit it to just objects that are on a specific layer or have specific field values. You will definitely need to change the record and field names to match what you are using. Good luck and let us know if you need more help. 1 Quote Link to comment
markymarc Posted August 3, 2019 Author Share Posted August 3, 2019 Thanks Pat, that's awesome ! This one's working a beauty, and I feel it's actually not too hard 🙂 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.