Jump to content
Developer Wiki and Function Reference Links ×

Create Symbol Definition


Gregi

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?

image.thumb.png.ac1e7e92e83997b9bd4ae5b66361205e.png

 

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

 

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