Jump to content

Create Symbol Definition


Recommended Posts

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
class Params(metaclass = Marionette.OrderedClass):
	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')

#	this.SetLinksObjects()
def RunNode(self):
	sym = self.Params.sym.value[0]
	ordner = self.Params.ordner.value[0]
	obj = self.Params.obj.value
	if type(obj) != list:
		obj = [obj]

	vs.SetOriginAbsolute(0, 0)
	for x in obj:
		objn = vs.CreateDuplicateObject(x, None)
	symbol = vs.LNewObj()

	#wenn noch nicht vorhanden, Ordner erstellen
	if ordner != '':
		if vs.GetObject(ordner) == None:
		place = vs.GetObject(ordner)
		vs.InsertSymbolInFolder(place, symbol)
	self.Params.h.value = h


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.

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