Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
RDS Casa

Custom Boolean and input

Recommended Posts



I'm trying to create a marionette object that has similar input method to the steel section tool in VW. Here you can select from a series of default sizes or options, or you can tick a custom boolean, and input the parameters yourself.  In the steel tool, the choices are greyed out without the custom boolean ticked. This would be ideal, but I think I read the the OIP can't change like that in an marionette object? If it can't do this, is there a way to override preset choices in a similar way?


am I going to need 2 objects, a standardised one, and a custom one? 



Share this post

Link to post

Well I've got somewhere by hacking together a few nodes. This node provides a pop up, where if custom is selected, it defers to the input dimension. It also outputs a string associated with the choice made. But, if custom is selected, a value entered, then a standard option selection made later, it does not change the displayed custom box. Or grey it out 


I don't know if this is possible, but its a start at least.


#fjs 19.12.17
class Params(metaclass = Marionette.OrderedClass):
    this = Marionette.Node( 'Popup custom' )    
    this.SetDescription('The values returned set out in script')
    input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['custom', '150mm', '200mm', '300mm'])
    input.SetDescription('an OIP control representing the options designated within the script editor')
    d = Marionette.PortOut()
    d.SetDescription('The resulting value in document units')
    dim = Marionette.OIPControl( 'Custom (if selected)', Marionette.WidgetType.RealCoord, 0.0)
    dim.SetDescription('A numeric OIP control that accepts unit indicators')
    string = Marionette.PortOut('string')
    string.SetDescription('an string corresponding with the option selected in the OIP')

def RunNode(self):
    units = vs.GetPrefReal(150)    
    input = self.Params.input.value
    if input == 0:
        self.Params.d.value = self.Params.dim.value/units
        self.Params.string.value = 'custom'
    if input == 1:
        self.Params.d.value = 150
        self.Params.string.value = 'standard'
    if input == 2:
        self.Params.d.value = 200
        self.Params.string.value = 'standard'
    if input == 3:
        self.Params.d.value = 300
        self.Params.string.value = 'standard'

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.