karstenwolfGL Posted August 15, 2023 Share Posted August 15, 2023 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. Quote Link to comment
twk Posted August 16, 2023 Share Posted August 16, 2023 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 Quote Link to comment
Jesse Cogswell Posted August 16, 2023 Share Posted August 16, 2023 (edited) 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 August 16, 2023 by Jesse Cogswell Quote Link to comment
karstenwolfGL Posted August 18, 2023 Author Share Posted August 18, 2023 Thanks exactly the information I needed, this is working now. 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.