Jump to content
Developer Wiki and Function Reference Links Read more... ×

Needed: Adding the name of Hanging Position to Truss contained within.

Recommended Posts

Hello All,

I'm looking for a script that will take the name of a hanging position and apply the name to one of the user fields of the truss record record attached to each section of truss contained within the hanging position object. I haven't explored scripting but I imagine it would look like: If Hanging Position has a name, insert same to truss record user field #1.

At the moment, I need to open each hanging position object and copy/paste the "Position Name" into the User Field. This is both time consuming and a hassle when wanting to change the HP name.

I want this to aid in making better worksheet reports. Having my lists of the truss assigned to various hanging positions aids in everything from truck packs to on site logistics.

The script would need to assign the names at anytime to allow HP name changing.


Thanks, Scott


Share this post

Link to post

I tried for a while to get something to work for this - but I'm having a hard time editing fields in Trusses that belong to a Hanging Position. I have no issue adding data to fields in Trusses that live outside of a HP, so I'm certain my script is set up correctly.

I'll do some more digging.

  • Like 1

Share this post

Link to post

Assuming the hanging positions all use embedded geometry and not symbols (which would make assigning individual position names impossible), you need to get the Hanging Positions profile group, then iterate through items in the group. The Hanging Position would then need a reset for data to show up in worksheets. 

Share this post

Link to post

Well, wouldn't the truss symbols be symbols? My truss runs have x number of sticks of truss, all selected and then converted to a single hanging position. I want all ten sections of truss to somehow know they are inside a hanging position and say as much in a worksheet.


Share this post

Link to post

I have and am now working with the structure of hanging positions along with groups to create and improve my Truss Tag tool.  So... This would need to be a command, something like "Refresh Truss Posit Names", there is a 27 character limit on VS command names.  You would need to run it periodically because the Hanging Positions would not know to refresh the truss that make them up.  It would also require a dialog somewhere requesting the user field to use.  I'm willing to put such a command in the AutoPlot quiver , but I'm busy with the truss tag at the moment.  Feel free to bother me about it periodically, while you investigate your own solutions.  You would then harvest the "Truss" Record data in a worksheet?  This could get tricky.

I have a test file with 3 sticks of truss, 2 groups and a hanging position.

One group has 10 pieces

One group has 3 pieces

The Hanging Position has 3 pieces.

If I make a custom report based on the record "Truss Record" being present only 13 pieces are listed.  Obviously it is missing the 3 in the hanging position.

If I make a custom report based on the record "Truss Record" being present only 13 pieces are listed and I check include components of plug-in objects 32 pieces are listed.

There is only one layer.  All layers and classes or on(visible).  There are no other objects in the drawing except the ones I have listed.  Something is getting counted more than once.

If I make a report on the record "Truss" and include plug-in objects then the correct number of 16 objects is listed.  Unfortunately, there is no field available in which to place the Hanging position name

So, I delete all the objects in the drawing except the one hanging position that contains 3 pieces.  When I do a custom report 6 pieces get listed, 2 versions of each piece.  When I run my truss tag command, the tag polls through the objects in the profile group and lists the 3 pieces, correctly, and no more.  It doesn't matter if the pieces are grouped or not grouped, my truss tag polls appropriately.  However,... The custom report still lists 6 pieces


Strangely the "Truss" PIO is created by placing objects with the "Truss Record" attached.  Clearly I have an incomplete understanding of what the $%#@ is going on.  Any one with a better under standing?  It would be helpful to me and my truss tags and with creating the command that Scott desires.

Share this post

Link to post
31 minutes ago, SCParker said:

Well, wouldn't the truss symbols be symbols?


When you convert objects to a hanging position, you can base the position on a single symbol or embed geometry in the hanging position.  If you have a symbol that is, for example, a 40' batten, you can base your HP on the symbol.  Otherwise, you usually want to base the HP on embedded geometry (prior to VW 2014, symbol was the only option).  The Convert to Hanging Position buttons in the OIP don't even give the option of creating a symbol.


Whether the embedded geometry uses symbols is of no consequence to the script.  As long as the HP is embedded geometry (i.e. in the profile group) this should work.


34 minutes ago, Sam Jones said:

Strangely the "Truss" PIO is created by placing objects with the "Truss Record" attached.


The Truss PIO uses symbols with the Truss Record attached, an then also attaches a copy of that record to itself so the user can access it.  Thus each Truss object has two objects with the record attached: the symbol inside the PIO and the PIO itself.


If you want to create a report of objects with Truss Records, Including Components of Plug-in Objects will correctly look inside the Hanging Position.  If your positions are made of Truss Objects, you have to edit the criteria to list objects whose Record Truss Record is Present and Type is Parametric object.


Alternatively, you can do a report of objects of the type Truss and display data from the Truss Record.  If you are using a mixture of Truss Objects and regular truss symbols, the report can get complicated, but you're really better off using a consistent method to place truss anyway.


In terms of a script, that's actually a little simpler, as you can just not descend into objects that have the record attached (assuming you're manually iterating over objects and not using FEO).

Share this post

Link to post

Here's a copy of a file I've been playing with to help me better understand the truss counting and which report format works best for my needs. You'll see I have six sticks of truss and three clamps. Three of the truss sticks are inside a hanging position. My three worksheets all have the same report columns, but point to objects with different records. The one on the left (there's an image so we're all on the same page) counts all the truss accurately, both inside and outside the hanging position.

The two other worksheet suffer from either double counting or missing info. All depending on whether the report is counting the internal or second copy of the record. Oy.


Share this post

Link to post

Here's where I'm sitting right now. The Set Record Field node is reporting that it was successful, but the field in the record isn't being updated on trusses in the Hanging Positions.

I tried making duplicates of the trusses and putting them back into the hanging position without success, this is not shown in my file, (though when I do make copies and they appear on the Design Layer, the fields DO update appropriately) so it's really an issue of 'why can't I get this value to push to the object in this container?'


I asked some coworkers at the office today and didn't find anyone who could help immediately, but I'll try some more next week and see if someone else has some intel.


Share this post

Link to post

@Marissa Farrell

I was curious if I could get this to work with Marionette.  The issue was that you were modifying the objects inside the Hanging Position PIO, but every time the PIO regenerates, these objects get deleted and recreated by the PIO script.  Instead, the network needs to modify the objects in the PIO's profile group.


I needed to create two custom nodes: Get Profile Group and Get Contained Objects, the latter iterating over the objets in a container and returning a list.  Also, the criteria at the start of the list needed to start with the Hanging Position and work in, rather than the contained objects, working out.





See if my explanation to Sam helps.  In your example, the worksheet that is doing what you want selects the Truss record, which is the record used to define the Truss PIO.  This selector would be identical to saying Type is Truss.  The correct report searches for all the Truss PIOs and then displays the Truss Record attached to them.


Searching for objects with Truss Record returns both the PIO and the symbols inside the PIO.


Your third worksheet searches for objects with the Truss Record that are NOT a Truss PIO, returning only the symbols inside the Truss objects

Edited by JBenghiat
  • Like 1

Share this post

Link to post

The other way to do this automatically is with a worksheet script.  Add the following as a new Python Script resource:

vs.WSScript_SetResStr( vs.GetName( vs.GetParent( vs.GetParent( vs.WSScript_GetObject() ) ) ) )

Then use this formula where you want the HP name:




where SCRIPT_NAME is whatever you called the resource.

Share this post

Link to post

@JBenghiat Hi Josh,

Sorry, I need just a touch more instruction on how to make your worksheet script work. I confess to having very little experience with running scripts other than those already flushed out and automated by you and others.


Best, Scott

Share this post

Link to post


In your Resource Manager click New Resource, and select type Script. You may also have to create a new script palette. Keep track of what you name the script resource.


In the resulting Script Editor dialog, choose Python from the pull-down menu at the top. Copy and paste in the line of code above and exit the dialog.


In your worksheet, go to your header row, and select the column where you want the truss name to appear. Paste in:


replacing SCRIPT_NAME with whatever you chose to name your script resource in the first step.

Share this post

Link to post


I'm cruising the inside passage on a smaller vessel with limited internet, but you could use the AutoPlot "Place VLM Truss Tags" command.  You can delete the tags if they are no use to you, but they will leave the HP truss with a position field attached to the Truss Record and filled out with the HP name.

Josh pointed me in the right direction, but sorting out the multiple Truss Records had some trial and error involved in order to find the correct one to consistently use.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.