Jump to content

script based on plug in object parameters changing


Recommended Posts

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 by Jayme McColgan
Solved my issue
Link to comment

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.

Link to comment

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. 

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