Jump to content
Sign in to follow this  
MaxStudio

How to set Parameter Visibilities in OIP

Recommended Posts

I'm trying to set parameter visibility in the object info panel.

 

In the old vector script I would retrieve the custom object information as follows:

result:= GetCustomObjectInfo(objname,oh,rh,wh);

I would then set the visibility of the parameter as follows:

SetParameterVisibility(oh,'parametername',FALSE);

 

In python I am trying to accomplish the same thing.

I've tried the following:

result = vs.GetCustomObjectInfo(objname,oh,rh,wh)

and then I attempted to set the visibility as follows:

vs.SetParameterVisibility(oh, 'parametername', FALSE)

 

when i run the script I get the following error:

NameError:  name 'objname' is not defined

 

Does anyone know how to accomplish this using best practice?

 

Thanks,

Derek

 

 

Share this post


Link to post

I have not assigned a value to objname.  I've created a plugin object and I need to reference and object handle to set the visibilities of the parameter.  how do i acquire or assign these?  

I thought using the following:

 vs.GetCustomObjectInfo(objname,oh,rh,wh) 

would have acquired and assigned these for me

Edited by MaxStudio

Share this post


Link to post

I've eliminated the vs.GetCustomObjectInfo(objname,oh,rh,wh) and just used vs.SetParameterVisibility(handle, 'parametername', FALSE)

I set the object handle to zero

vs.SetParameterVisibility(0, 'parametername', FALSE)

 

I want to use a pulldown to set the visibility to true:

 

number=vs.Pnumber

if number == "2":

    vs.SetParameterVisibility(0, 'parametername', True )

 

but I'm getting the following error:

 

Error: Invalid callback function parameter type. Parameter index= 0 name=inPlugin

     File "<string>", line 38, in <module>

     File "<string>", line 1, in <module>

 

below is the actual code:

 

import vs
import shapes

number=vs.Pnumber
shape01=vs.Pshape01
shape02=vs.Pshape02
shape03=vs.Pshape03

xstart=0

vs.SetParameterVisibility(0, 'shape01', False )
vs.SetParameterVisibility(0, 'shape02', False )
vs.SetParameterVisibility(0, 'shape03', False )

if number == "2":

    vs.SetParameterVisibility(0, 'shape01', True )
    vs.SetParameterVisibility(0, 'shape02', True )

if number == "3":

    vs.SetParameterVisibility(0, 'shape01', True )
    vs.SetParameterVisibility(0, 'shape02', True )
    vs.SetParameterVisibility(0, 'shape03', True )

 

 

 

 

Share this post


Link to post

Derek,

I should have read the documentation before I asked my question. 'objname' is returned by the function vs.GetCustomObjectInfo().

 

However, in Python, all returned variables must be to the left of the equal sign. Try this:

 

result, objname, oh, rh, wh = vs.GetCustomObjectInfo()

 

then use the handle "oh" in your vs.SetParameterVisibility() calls.

 

Raymond

 

Share this post


Link to post

Ok thanks Raymond I will try!

 

Thank you Raymond that worked!  I appreciate the response!

Edited by MaxStudio

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×