Jump to content
Developer Wiki and Function Reference Links ×

record sequencing


Ben624

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?

Ben

Link to comment

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.

Charles

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