Jump to content
tbexon

Working with Spotlight Hanging Positions

Recommended Posts

I'm currently working on a couple of plug ins that need to interact with Spotlight Hanging Positions.

 

The first thing i'm trying to do is get the total length of a hanging position. Thanks to some excellent topics and replies from @Sam Jones and @JBenghiat I've got my head around accessing the objects within the hanging position group, and the different kinds of objects I may expect to find within, and iterating through the objects to get the total length. My question is: For HP's containing Truss PIOs is it better practice to use the TrussItem parametric record or the Truss Record for getting the length?  From what I can gather the TrussItem Length field is affected by the units of the active documents units, whereas Truss Record appears to always be in metric mm.  

 

I think using the Truss Record probably makes more sense as then I have a consistent set of units and don't need to worry about logic to work out the units of measurement. I just wanted to try and get some confirmation if my thinking was in fact true or if i've missed something.

 

Secondly for HP made up of individual symbols (so no truss record) is there a way to get either the symbols total length or the even more directly the HPs total length? 

 

 For bonus points are there any good resources floating around that deal with the inner mechanics of Spotlight? Pretty much everything I've managed to do with spotlight so far has had to be learnt through trail and error!

 

Thank you in advance

 

Share this post


Link to post
Posted (edited)

Hi tbexn,

use the Trussitem parametric record for the length, I don't know how python gives you the value, but all Dimensions fields save their value as millimeter internally,

the UI like ObjectInfoPalette then automatically converts it.

Secondly for HP made up of individual symbols (so no truss record) is there a way to get either the symbols total length or the even more directly the HPs total length?  

I would use the bounding box off the geometry in the symbol definition.

Don't use the BoundingBox off the HangingPosition because it will not be accurate if the HP or profile is rotated (inside the HP).

 

regards,

Patrick

Edited by PatW

Share this post


Link to post

I was having a look. In the case off the "Truss Record" the values are saved as strings with the unit.

 

Share this post


Link to post
On 6/30/2020 at 9:21 AM, tbexon said:

For HP's containing Truss PIOs is it better practice to use the TrussItem parametric record or the Truss Record for getting the length?  From what I can gather the TrussItem Length field is affected by the units of the active documents units, whereas Truss Record appears to always be in metric mm.  

 

I would use the parametric record. That will be guaranteed to be correspond to the Truss settings. I don't think the Truss Record updates to reflect changes — it's meant more for defaults.

 

On 6/30/2020 at 9:21 AM, tbexon said:

Secondly for HP made up of individual symbols (so no truss record) is there a way to get either the symbols total length or the even more directly the HPs total length? 

 

Do you mean symbols or an HP made of Truss objects? Either way, you have to iterate through the HP geometry, determine what kind of object it is, and then decide how you want to determine the length of each object type. If you're looking at symbols of trusses, then you have to enter each symbol definition and analyze the geometry.

 

On 6/30/2020 at 9:21 AM, tbexon said:

For bonus points are there any good resources floating around that deal with the inner mechanics of Spotlight? Pretty much everything I've managed to do with spotlight so far has had to be learnt through trail and error!

 

Sadly, no. I don't think Spotlight is really designed to allow a lot of script access, and only a fraction of the interaction is available through VS.

Share this post


Link to post
On 6/30/2020 at 4:53 PM, PatW said:

 

I would use the bounding box off the geometry in the symbol definition.

Don't use the BoundingBox off the HangingPosition because it will not be accurate if the HP or profile is rotated (inside the HP).

 

Thank for the response Patrick, in terms of specific commands, should I be looking at BotBoundN, TopBoungN, LeftBoundN and RightBoundN? I've had a bit of a play with them, but the results i get don't really line up with what I expect to get.

 

On 7/1/2020 at 7:09 PM, JBenghiat said:

Do you mean symbols or an HP made of Truss objects? Either way, you have to iterate through the HP geometry, determine what kind of object it is, and then decide how you want to determine the length of each object type. If you're looking at symbols of trusses, then you have to enter each symbol definition and analyze the geometry.

 

I'm looking at writing a (hopefully) all encompassing solution e.g my script can deal with all possible kinds of objects I may find inside.

I've worked out how to iterate through the HP position, using GetCustomObjectProfileGroup, and from there I identify what kind of object i'm dealing with. If it's a truss object with record, that's easy to deal with. The one i'm struggling with atm is symbols that are NOT truss objects and don't have any record attached to them. As Patrick suggested above i'm having a play with trying to get bounding boxes working, however failing that have you any particular commands you'd point me towards to easily get the overall length of a symbol?

Share this post


Link to post

Thanks! GetBBox worked perfectly! I had to get the bounding box of the symbol definition though to ensure that the rotation of the placed symbols didn't affect the calc.

import vs
symdef = vs.GetSymName(vs.FSActLayer())  # Gets Symbol name for selected object
symHandle = vs.GetObject(symdef) # Returns the SymDef Handle
(p1X, p1Y), (p2X, p2Y) = vs.GetBBox(symHandle)  # Gets Bounding Box Co ordinates for Selected object
tota_length = p1X -p2X # Difference between left and right X Values

 

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...