Jump to content
Sign in to follow this  

record sequencing

Recommended Posts

Is there a way to reference the last instance of a PIO from its own script? I'm trying to create a tool that will essentially number itself as I use it repeatedly. So when I use this tool (the 'Channel Indicator'), it will check the value of the channel parameter for the last instance that I created and increase it by one for the currently executing instance. Does that make sense?


Share this post

Link to post

How many instances of this PIO are there likely to be in a drawing?

One way would be to get a handle to the last created instance. You then use GetRField to get the value. 'Record' is the name of the PIO and 'Field' is the name of the parameter field.

Another perhaps simpler approach is to count the number of existing instances of the PIO and increment by one.

What will happen to this numbering scheme if you make changes might be something to think about. You might use IsNewCustomObject to stop a PIO from re-numbering if you make other changes and it was created in the middle of the sequence. Depending on how you use this PIO, this may not be a problem.


Share this post

Link to post

One way would be to create a number ID parameter and then use ForEachObject(,) to iterate thru each PIO to get the value of the parameter. You can then test for any gaps in the sequence or find the highest value.


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.

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.

Sign in to follow this  


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