Jump to content
Developer Wiki and Function Reference Links ×

adding parameters to a PIO


Recommended Posts

Hello, I wonder if it's possible to add parameters a PIO from the script. (control points for exemple).

I work on a slope control plugin, a line PIO, on wich I would like to add unlimited intermediate points (it works with one already).

Could anyone tell me ?

Link to comment

SYLVAIN,

It is possible to do that. I created one that actually worked like that. It takes a bit more coding though.

Your PIO needs to be event-enabled.

Use the following constants for the widget arguments:

kFieldCoordLocX = 10;

kFieldCoordLocY = 11;

Use the same naming convention as the Parameter Editor, i.e.

first control point pair should be "ControlPoint01X" and "ControlPoint01Y", next is "ControlPoint02X" and ControlPoint02Y", and so on.

You will have to manage the control points by instance, so plan on setting a unique name for each instance of your PIO. Create a record format specific for each instance of the PIO.

Track the control point values in the record format.

Structure your code to use the values in the record format to do your drawing.

That said, yes it possible. But Petri's suggestion to use a path object might be a better approach.

Regards,

Link to comment

Rick,

I'm not sure how you intend to enable "n" control points. Do you mean that a "normal" record format would be created for each coordinate duplet/triplet? With a PIO of 13 control points one would have formats 1...13? But how would one insert a point between two existing ones...

A format for each PIO? Insertion does not really become any easier!

The advantage of a path is that it carries the implicit sequence of vertices.

EDIT

Bah, humbug!

In a line PIO, one can establish the sequence with "x" values...

Edited by Petri
Link to comment

I am not arguing that it's a good or easy or preferred approach. It probably should be filed under "Just Because It Can Be Done Does Not Mean It Should Ever Be Done". I agree that the Path Object is the better approach, because Vectorworks manages all the internal behaviors for you. Just wanted to note that adding control point parameters dynamically is possible. Just not easy, and not the best way.

I don't know that it matters whether you have one record format for each control point, or all your control point values on one record format, or in a worksheet. The main issue is that if parameters are created dynamically, they probably have to be managed and used dynamically as well...which means a LOT more programming to the PIO.

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