Jump to content
Developer Wiki and Function Reference Links ×

Custom Boolean and input


RDS Casa

Recommended Posts

Hello,

 

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? 

 

Thanks

Link to comment

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
@Marionette.NodeDefinition
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'

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