Zum Inhalt springen

Marionette Solid Boolean bei EINEM Input "spinnt"


hölzli

Frage

Geschrieben

Hallo Forum

 

Ich stehe irgendwie wie ein Esel am Berg.

In einem ObjectNode habe ich eine Vollkörpersubtraktion, wobei das zu subtrahierende Objekt mittels Haken im OIP aktiv oder passiv sein kann. Also manchmal nicht existiert.

Gemäss dem PrintDebug Node funktioniert dies aber ohne Probleme, der Output des SolidBoolean entspricht dann exakt demjenigen des hObj1.

 

Wenn ich aber dieses Objekt mit einem selbst gebauten Datenbank-Node mit einer Datenbank verbinden möchte, wird das Objekt nur verbunden, wenn es eben eine Subtraktion ist, also der Haken gesetzt ist.

 

Ich kann den Fehler nicht finden, das einzige was ich entdeckt habe ist, dass auch das Copy Node wohl irgend ein Problem damit hat. 

 

Bin für jeden Lösungsansatz dankbar!

image.thumb.png.9ee842b5b3a2b2ce9ba47ec73f39faf5.png

SolidBoolean_gim2020-12-04.vwx

Vectorworks 2024 interiorcad |  Windows10 & 11

4 Antworten auf diese Frage

Empfohlene Beiträge

Geschrieben

Es scheint mir, dass der Solid Boolean wirklich der Node ist, der Probleme macht. Denn bei mir geht mit dem Originalnode gar keines der oberen Netzwerke.

 

Wenn du allerdings den Fall abfängst, dass kein Objekt abgezogen wird, funktioniert alles wie geschmiert.

#Modified by MRoth 20201205

@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
	#Name
	this = Marionette.Node( "Solid Boolean" ) 
	this.SetDescription('This node performs a boolean operation between lists of objects. The operation will be performed for each possible combination of objects in the lists supplied.')

	#Input Ports
	in0 = Marionette.PortIn( vs.Handle(0), 'hObj1' )
	in0.SetDescription('A list of objects to be operated on (blanks)')
	in1 = Marionette.PortIn( [], 'hObj2' )
	in1.SetDescription('A list of objects to operate on "in0" with (tools)')

	#OIP Controls
	op = Marionette.OIPControl( 'operation', Marionette.WidgetType.Popup, 0, ['Add', 'Subtract', 'Intersect'])
	op.SetDescription('The operation to perform between objects\n'
						'   Add: equivalent to the "Add Solids" command in VW\n'
						'   Subtract: equivalent to the "Subtract Solids" command in VW\n'
						'   Intersect: equivalent to the "Intersect Solids" command in VW')

	#Output Ports
	out = Marionette.PortOut('hObj')
	out.SetDescription('The resulting objects')

#BEHAVIOR
	this.SetLinksObjects()
	this.SetListAbsorb()

def RunNode(self):
	#inputs
	in0 = self.Params.in0.value
	in1 = self.Params.in1.value

	#script
	if len(in1) == 0:
		output = in0
	else:
		output = []		
		if type(in0) != list:		
			in0 = [in0]

		for blank in in0:
			if blank != 0:
				if type(in1) != list:
					in1 = [in1]
				for tool in in1:				
					err = 0
					newObj = vs.Handle(0)				
					#genSolid = vs.Handle(0)
					#copy = vs.CreateDuplicateObject(tool, vs.Handle(0))
					#Add
					if self.Params.op.value == 0:	
						(err, newObj) = vs.AddSolid(blank , tool)	
						#if err == 0 and newObj != vs.Handle(0):
							#genSolid = vs.CnvrtToGenericSolid(newObj)
							#if genSolid != vs.Handle(0):
								#newObj = genSolid
					
					#Subtract		
					elif self.Params.op.value == 1:					
						(err, newObj) = vs.SubtractSolid(blank , tool)						
						#if err == 0 and newObj != vs.Handle(0):
							#genSolid = vs.CnvrtToGenericSolid(newObj)						
							#if genSolid != vs.Handle(0):
								#newObj = genSolid
							
					#Intersect
					elif self.Params.op.value == 2:
						(err, newObj) = vs.IntersectSolid(blank , tool)
						#if err == 0 and newObj != vs.Handle(0):
							#genSolid = vs.CnvrtToGenericSolid(newObj)
							#if genSolid != vs.Handle(0):
								#newObj = genSolid
							
					if newObj != 0 and newObj != None and newObj != tool and err == 0:
						#vs.Marionette_DisposeObj(copy)
						blank = newObj	
			if blank != vs.Handle(0):
				output.append(blank)
				
		for obj in output:
			obj = vs.CnvrtToGenericSolid(obj)
	
	#outputs
	self.Params.out.value = output

Ich vermute, dass vs.SubstractSolid das Objekt zerschiesst, wenn es als tool einen 0-Handle erhält. (keine Ahnung, ob es das gleiche ist wie nichts) Denn auch Löschen, oder sonstwie bearbeiten kannst du das Objekt anschliessend nicht mehr.

 

  • Like 1

Freundliche Grüsse

 

Manuel Roth

_________________________________________________
Vectorworks 2022 SP3 | Architektur | Windows 10

Geschrieben

Herzlichen Dank.

 

Ich Dödel hab zwar schon mit dem Abfangen rumprobiert, jedoch das "else" ausser Acht gelassen, wodurch ja der Rest des Scripts dennoch ausgeführt wurde.

 

An dieser Stelle kommt nun noch eine allgemeine Skript-Frage.

Was ist der Unterschied der folgenden Varianten:

len(in0) == 0:
 
in0 == vs.Handle(0):

in0 == None:

Je nach Situation habe ich schon verschiedene gesehen, kann jedoch nicht wirklich entscheiden, wann welches genommen werden soll. Gibt es überhaupt eine klare Unterscheidung?

 

Resp. was ist vs.Handle(0) überhaupt? Ich nehme mal ein Dummy, welcher ins nichts führt, oder?

Vectorworks 2024 interiorcad |  Windows10 & 11

Geschrieben

Ich habe soeben noch einen weiteren "Bug" gefixt.

Wird ein "Tool" (Input2) für mehrere Objekte verwendet, funktioniert dies nicht. Eigentlich logisch, da ja beim klassischen konstruieren das Objekt ebenfalls nicht mehr zur Verfügung steht. Dies wird mit V3 behoben.

#Modified by MRoth 20201205
#Modified by gim 2020-12-30

@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
	#Name
	this = Marionette.Node( "Solid BooleanV3" ) 
	this.SetDescription('This node performs a boolean operation between lists of objects. The operation will be performed for each possible combination of objects in the lists supplied.')

	#Input Ports
	in0 = Marionette.PortIn( vs.Handle(0), 'hObj1' )
	in0.SetDescription('A list of objects to be operated on (blanks)')
	in1 = Marionette.PortIn( [], 'hObj2' )
	in1.SetDescription('A list of objects to operate on "in0" with (tools)')

	#OIP Controls
	op = Marionette.OIPControl( 'operation', Marionette.WidgetType.Popup, 0, ['Add', 'Subtract', 'Intersect'])
	op.SetDescription('The operation to perform between objects\n'
						'   Add: equivalent to the "Add Solids" command in VW\n'
						'   Subtract: equivalent to the "Subtract Solids" command in VW\n'
						'   Intersect: equivalent to the "Intersect Solids" command in VW')

	#Output Ports
	out = Marionette.PortOut('hObj')
	out.SetDescription('The resulting objects')

#BEHAVIOR
	this.SetLinksObjects()
	this.SetListAbsorb()

def RunNode(self):
	#inputs
	in0 = self.Params.in0.value
	in1original = self.Params.in1.value
	in1 = []
	for x in in1original:
		in1.append(vs.HDuplicate(x, 0, 0))
		vs.Marionette_DisposeObj(x)

	#script
	if len(in1) == 0:
		output = in0
	else:
		output = []		
		if type(in0) != list:		
			in0 = [in0]

		for blank in in0:
			if blank != 0:
				if type(in1) != list:
					in1 = [in1]
				for tool in in1:				
					err = 0
					newObj = vs.Handle(0)				
					#genSolid = vs.Handle(0)
					#copy = vs.CreateDuplicateObject(tool, vs.Handle(0))
					#Add
					if self.Params.op.value == 0:	
						(err, newObj) = vs.AddSolid(blank , tool)	
						#if err == 0 and newObj != vs.Handle(0):
							#genSolid = vs.CnvrtToGenericSolid(newObj)
							#if genSolid != vs.Handle(0):
								#newObj = genSolid
					
					#Subtract		
					elif self.Params.op.value == 1:					
						(err, newObj) = vs.SubtractSolid(blank , tool)						
						#if err == 0 and newObj != vs.Handle(0):
							#genSolid = vs.CnvrtToGenericSolid(newObj)						
							#if genSolid != vs.Handle(0):
								#newObj = genSolid
							
					#Intersect
					elif self.Params.op.value == 2:
						(err, newObj) = vs.IntersectSolid(blank , tool)
						#if err == 0 and newObj != vs.Handle(0):
							#genSolid = vs.CnvrtToGenericSolid(newObj)
							#if genSolid != vs.Handle(0):
								#newObj = genSolid
							
					if newObj != 0 and newObj != None and newObj != tool and err == 0:
						#vs.Marionette_DisposeObj(copy)
						blank = newObj	
			if blank != vs.Handle(0):
				output.append(blank)
				
		for obj in output:
			obj = vs.CnvrtToGenericSolid(obj)
	
	#outputs
	self.Params.out.value = output

image.thumb.png.959f40ac557dd28a44b1b2c1eefa0782.png

SolidBoolean_gim2020-12-30.vwx

  • Like 1

Vectorworks 2024 interiorcad |  Windows10 & 11

Geschrieben

Am besten sendest du den Code wohl an Marissa oder Sarah aus dem englsichen Forum, damit sie die Fälle direkt in den Standardnodes anpassen können.

Freundliche Grüsse

 

Manuel Roth

_________________________________________________
Vectorworks 2022 SP3 | Architektur | Windows 10

Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde Dich hier an.

Jetzt anmelden
  • Forenstatistik

    • Themen insgesamt
      27Tsd
    • Beiträge insgesamt
      140,4Tsd
×
×
  • Neu erstellen...