Gregi Posted December 24, 2020 Share Posted December 24, 2020 Hi everybody I would like to create a Symbol definition as a copy of the Objects in a PIO. I made a node which is working if testing as a network or a wrapper. But as soon as i put it in my PIO, the PIO will go away, but i have the symbol. Any ideas? and the code of my "Create Symbol"-Node: #gim 2020-12-24 #Revised 12/21/15 MFarrell #Modified by MFarrell May 2017 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( "Create Symbol" ) this.SetDescription( "Fügt ein Symbol im gewünschten Ordner ein" ) #Input Ports sym = Marionette.PortIn( '', 'sName' ) ordner = Marionette.PortIn( '', 'sOrdner') sym.SetDescription( "Name of symbol." ) obj = Marionette.PortIn(vs.Handle(0), 'hObjs') # p = Marionette.PortIn( (0,0), 'p' ) # p.SetDescription( "Coordinates of symbol insertion point." ) # angle = Marionette.PortIn( 0, 'nAngle' ) # angle.SetDescription( "Rotation angle of symbol, in degrees." ) #OIP Controls #Output Ports h = Marionette.PortOut() # h.SetDescription('Handle to Symbol object') #BEHAVIOR # this.SetLinksObjects() this.SetListAbsorb() def RunNode(self): #inputs sym = self.Params.sym.value[0] ordner = self.Params.ordner.value[0] obj = self.Params.obj.value if type(obj) != list: obj = [obj] #script vs.SetOriginAbsolute(0, 0) vs.BeginSym(sym) for x in obj: objn = vs.CreateDuplicateObject(x, None) vs.Marionette_Dispose(x) vs.EndSym() symbol = vs.LNewObj() #wenn noch nicht vorhanden, Ordner erstellen if ordner != '': if vs.GetObject(ordner) == None: vs.NameObject(ordner) vs.BeginFolder() vs.EndFolder() place = vs.GetObject(ordner) vs.InsertSymbolInFolder(place, symbol) #outputs self.Params.h.value = h Quote Link to comment
Gregi Posted December 30, 2020 Author Share Posted December 30, 2020 It works when i put my code in a "Button-Node" an run as the button script, then the PIO is still there 🙂 1 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.