Jump to content

Pass variables back into the PIO and update on changes?


Recommended Posts

I have a linear Object Plug-in which effectively draws a nurbs curve at the length. What I'm not able to figure out is that I want to be able to pass a calculated value back into the OIP as a StaticText(?) which updates when a parameter is changed or the line control points are dragged. Basically a functioning version of this:

 

vs.vsoAppendParamWidget(13, 1000, "Value: ", VARIABLE)

 

I'm at a little bit of a loss as to how to do that and I'm missing something about how the OIP works. It seems like the guide I need to copy and then the vague steps are below? Is that the right direction? I don't think I need to make the calculated variable a parameter, just updating the text should be fine since it's just as a user reference. 

 

https://developer.vectorworks.net/index.php/User:CBM-c-/Plug-in_with_widget_basic_example

 

1. Set the OIP to be customizable

2. Draw all the 'default' fields

3. Add a widget with the new calculated value.

4. The above link's code handles the 'listening for changes' part and 'redraws' the OIP on changes.

 

 

Link to comment

to pass back a value to a parameter you use

vs.SetRField(plugin_handle, plugin_name, parameter_name, str(value))

 

the parameter_name here is just the static text parameter you've created or added in the Plugin Definition, set under Plugin-Manger>Edit Definition

Link to comment

If you want to have static text as part of your OIP, you don't need to necessarily make your plug-in Event-Based.  All you need to do is have a parameter with the Type set to Static Text.  You then use a combination of vs.GetCustomObjectInfo to get a handle to the plug-in object, and vs.SetRField to update the parameter.

 

My Python is SUPER rusty, I tend to develop in Vectorscript, but attached is a super simple example of a Point Object that updates its location in the OIP via a Static Text parameter.

Simple Static Text Example.vso

Edited by Jesse Cogswell
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...