Jump to content
Developer Wiki and Function Reference Links ×

Getting references to Objects


Recommended Posts

I´m fairly new to vectorworks. I´m quiete experienced in programming. Im trying to write some, in my understanding, quite simple and small scribts. It isn`t clear to me neither from Marionette nor from the Python Function References how to get an reference to an Selected Object or to all the object or to any object in your Document. Is it nor intended to write code that works with Information already in the Project or did i just didn't look in the right place?

 

 

Link to comment

The concept is called Handles in Vectorscript. And since Python in Vectorworks is really just a wrapper to Vectorscript, the concept applies in Python as well.

 

In the Vectorscript Function Reference. Sort by Class and look in the Document List Handling section.

 

vs.FSActLayer will return a handle to the first selected object on the active layer. vs.NextObj/vs.NextSObj/vs.PrevObj/vs.PrevSObj will let you "walk" the object tree.

 

There are also calls that will return a hand the an object by Name or by Criteria about the object.

 

Take a look in the Vectorscript and Python sections of the forum for lots of example code.

 

Or post more about what you need your script to do and you will probably get lots of suggestions on how to approach it.

 

IMNSHO, Marionette is better for creating object and scripts are better for modifying objects already existing. Especially if you already have some programming experience.

Link to comment

I have not tried, but I believe you can get Hoist date in Vectorscript/Python.

 

Hoists are just Plugin Objects, so you can use the GetParametricRecord commands to get a handle to the record that contains the hoist data. GetName on that Handle will give you the name of the Record. From there you can use the GetRField and SetRField commands to access the individual fields.

 

HTH

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...