Jayme McColgan Posted June 12, 2021 Share Posted June 12, 2021 (edited) hey guys, a few questions on understanding how plugin objects work... so i've made a plugin (via the plugin manager) and I'm trying to understand how to interact with it. - when i insert a plugin object from the tool set does it run the whole script? ANWSER: yes when you insert a PIO it runs the whole script based on how you have it laid out - if i have made parameters for my plugin object, does it run the whole script if i change any of the values? ANWSER: Yes, when you update a field parameters it reruns the whole script - how do i actually get the value of the parameters after changing them? i've tried vs.GetObjectVariableHandle (and the various version of that) and doesn't seem to be working. ANWSER: def collect(): ### Get PIO Info PIO_handle = vs.GetCustomObjectInfo()[2] recordHandle = vs.GetParametricRecord(PIO_handle) recname = vs.GetName(recordHandle) ### Pop Up Field product = str(vs.GetRField(PIO_handle, recname, "Drop down choices")) ### Interger Field how_wide = int(vs.GetRField(PIO_handle, recname, "Tiles Wide")) ### Dimension Scientific notation to inches stupid = vs.GetRField(PIO_handle, recname, "Length of object") dem_length = vs.ValidNumStr(stupid)[1] return(product, how_wide, dem_length, PIO_handle, recname) Edited August 10, 2021 by Jayme McColgan Solved my issue Quote Link to comment
Pat Stanford Posted June 12, 2021 Share Posted June 12, 2021 1. Yes the entire script runs (unless you have made it an event enabled PIO, and based your your questions you are not quite ready for that yet). 2. When you change a parameter (or reset) the PIO the script runs again to recreate the geometry. The original geometry is discarded. 3. The Parameters are stored in a Record.Field format called the Parameter Record. It has the name of the PIO and then whatever field name you want. Something like 'Door'.'UsrField1'. If you have a complicated PIO it is best to read the Parameter Record into other variables and edit those while the script it running and then store them back to the parameter fields (SetRField) at the end of the script. The Parameter Record data can't be changed during the running of the script. They are only reset at the end of the script. Quote Link to comment
Peter Vandewalle Posted June 13, 2021 Share Posted June 13, 2021 For Pats example ‘door’.’usrfield1’ use this line to get the value into an internal variable: var = vs.Pusrfield1 or: var = vs.GetRField(<handle to PIO instance>, “door”, “usrfield1”) 2 Quote Link to comment
Jayme McColgan Posted June 14, 2021 Author Share Posted June 14, 2021 thanks! this helped me a lot! I'm almost successfully made my first PIO with parameters! the only real issue i have right now is when i insert it from the tool set, i get a "HANDLE Variable is NIL"... I'm using vs.FSActLayer() but obviously thats not what i should be using... any advice with what i should be using to get the handle of the PIO would be great. Quote Link to comment
Jesse Cogswell Posted June 14, 2021 Share Posted June 14, 2021 To get the handle to the PIO, you will want to use vs.GetCustomObjectInfo(). 1 Quote Link to comment
Jayme McColgan Posted June 14, 2021 Author Share Posted June 14, 2021 8 minutes ago, Jesse Cogswell said: To get the handle to the PIO, you will want to use vs.GetCustomObjectInfo(). you sir win a cookie! thank you 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.