Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
SYLVAIN

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 ?

Share this post


Link to post

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,

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

It should be possible to write a path plug-in that looks like a line: the path would not be drawn, instead just a line from point 1 to point n.

Share this post


Link to post

Thanks for all your good advices. I don't have it tested yet, but I will soon.

For my tool,

I already made event-enabled PIO's thanks to the explanations from the wonderfull VCOR site...

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

×