Jump to content

Are there more association constants?


Recommended Posts

Hi all,

 

The wiki only lists two constants for vs.AddAssociation, 4 and 5. I figure there must be more, but I've scoured the SDK and found nothing. Anybody know if there are other associations, what they are or at least which SDK file I should be looking in?

 

Thanks!

Link to comment
  • 3 weeks later...

Yes, but they tend to be managed by other functions, so the constants aren't really well documented. You can use GetNumAssociations() and GetAssociation() to explore. For example, Lighting Devices are associated with Rigging Objects, and Data Tags have associations with their objects. You are better off managing the later with DT_AssociateWithObj(), though.

Link to comment

I see. Do you know if maybe there are any extended properties I need to enable to be able to add certain associations? For example, it seems that associations 38 and 39 are responsible for keeping objects attached to truss and lighting pipes, but when I try adding this association to my plugin objects and then print their associations, there are still zero associations. This is essentially the behavior I'm looking for, one object recalculating its position based on another object. Or is there some function out there that does this, that I just haven't found yet? Both objects are event enabled and the delete-on-delete association is working fine.

 

Thank you!

Link to comment

Other associations only tell objects how to find each other. You still have to manually code thing like having one object move another or reset another.

 

Depending on what you are doing, you can look at constraints. Constraints have been around a while, and their interface is not the most elegant, but this is what allows dimension lines to attach to objects. You can manually experiment with constraints in the Dims/Notes palette. https://developer.vectorworks.net/index.php/VS:Function_Reference#Parametric_Constraints

 

Otherwise, you can connect event enabled objects via responses to state changes. For example, this lets you identify when an object moves: https://developer.vectorworks.net/index.php/VS:vsoStateGetPos. In VS, you can only look at state changes for objects you code. You can't, for example, receive a notification when a Lighting Device moves.

Link to comment

Constraints are exactly what I need! Thank you. Do you know if there's any more documentation of the constants in the SDK? At least the horizontal and vertical distance constraints are swapped on the wiki. These are useful, but I'm having trouble with the other constraints, and I don't even know if I'm using the correct constants.

 

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...