KingChaos Posted June 9, 2023 Share Posted June 9, 2023 Hi, ich want to manipulate the popup node #Modified April 2017 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'Popup' ) this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.') #Input Ports #OIP Controls input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30']) input.SetDescription('an OIP control representing the options designated within the script editor') #Output Ports output = Marionette.PortOut('i') output.SetDescription('an integer corresponding with the option selected in the OIP. Returned values range from 0 to one less than the number of options.') #BEHAVIOR def RunNode(self): #inputs input = self.Params.input.value #script #outputs self.Params.output.value = input that i get as output the string i popped up not int 0,1,2.... i think thats pretty easy but i dont know the exact syntax of the code to do it by myself. maybe someone can help me quickly with this easy stuff :() Quote Link to comment
KingChaos Posted June 9, 2023 Author Share Posted June 9, 2023 i asked the chatGPT, whether he can manipulate the node for me. Du Modified April 2017 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): APPEARANCE #Name this = Marionette.Node( 'Popup' ) this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.') #Input Ports #OIP Controls input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30']) input.SetDescription('an OIP control representing the options designated within the script editor') #Output Ports output = Marionette.PortOut('i') output.SetDescription('an integer corresponding with the option selected in the OIP. Returned values range from 0 to one less than the number of options.') BEHAVIOR def RunNode(self): #inputs input = self.Params.input.value #script #outputs self.Params.output.value = input ich moechte gerne als Output keine integerwerte, sondern den Text, der im Popupausgewaehlt wird (translated after by hand: i want as output not the int i want the string which i choosed in the popup) er meinte ChatGPT Modified April 2017 @Marionette.NodeDefinition class Params(metaclass=Marionette.OrderedClass): # APPEARANCE # Name this = Marionette.Node('Popup') this.SetDescription( 'This node demonstrates the use of a Popup OIP control. The values returned by this node will be the text of the option selected from the list.') # Input Ports # OIP Controls input = Marionette.OIPControl('Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30']) input.SetDescription('an OIP control representing the options designated within the script editor') # Output Ports output = Marionette.PortOut('s') output.SetDescription('a string corresponding with the option selected in the OIP.') # BEHAVIOR def RunNode(self): # inputs input = self.Params.input.value # script # outputs self.Params.output.value = input so he excactly understood what i wanted, he changed the param typ from int to string and adapted the output.set description but he did not any other modification in the code. Quote Link to comment
KingChaos Posted June 9, 2023 Author Share Posted June 9, 2023 But it does not work, there is no outputport on this node available. Quote Link to comment
KingChaos Posted June 9, 2023 Author Share Posted June 9, 2023 CHATgpt solved it in the 5. try #Modified April 2017 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'Popup' ) this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.') #Input Ports #OIP Controls input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30']) input.SetDescription('an OIP control representing the options designated within the script editor') #Output Ports output = Marionette.PortOut('s') output.SetDescription('a string representing the option selected in the OIP..') #BEHAVIOR def RunNode(self): #inputs input = self.Params.input.value #script options = ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30'] selection_index = int(input) # convert the string input to an integer index selection = options[selection_index] # get the corresponding option #outputs self.Params.output.value = selection Quote Link to comment
KingChaos Posted June 9, 2023 Author Share Posted June 9, 2023 i had to ask: how to manipulate this code Modified April 2017 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): APPEARANCE Name this = Marionette.Node( 'Popup' ) this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.') Input Ports OIP Controls input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30']) input.SetDescription('an OIP control representing the options designated within the script editor') Output Ports output = Marionette.PortOut('s') output.SetDescription('an integer corresponding with the option selected in the OIP. Returned values range from 0 to one less than the number of options.') BEHAVIOR def RunNode(self): #inputs input = self.Params.input.value script outputs self.Params.output.value = input to have a string as an output which is corresponding to the popup selection instead of the integer of the input? 1 Quote Link to comment
KingChaos Posted June 9, 2023 Author Share Posted June 9, 2023 popup string.vwx Quote Link to comment
DomC Posted June 9, 2023 Share Posted June 9, 2023 I think asking ChatGPT can be helpful but it is not faster than searching the forum. But for sure, it is good entertainment: lol 2 1 Quote Link to comment
KingChaos Posted June 9, 2023 Author Share Posted June 9, 2023 If you have no clue like me, it is much more faster ^^ 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.