SYLVAIN Posted March 1, 2007 Share Posted March 1, 2007 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 ? Quote Link to comment
Petri Posted March 1, 2007 Share Posted March 1, 2007 I don't think so. Can you make it a path object? Quote Link to comment
Rick Francken Posted March 2, 2007 Share Posted March 2, 2007 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, Quote Link to comment
Petri Posted March 2, 2007 Share Posted March 2, 2007 (edited) 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 March 2, 2007 by Petri Quote Link to comment
Rick Francken Posted March 2, 2007 Share Posted March 2, 2007 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. Quote Link to comment
Petri Posted March 3, 2007 Share Posted March 3, 2007 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. Quote Link to comment
SYLVAIN Posted March 8, 2007 Author Share Posted March 8, 2007 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... Quote Link to comment
Recommended Posts
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.