Beispiel #1
0
def getGeometryOutputByLoops(derivation, loops):
	'Get geometry output by sorted, nested loops.'
	loops.sort(key=euclidean.getAreaVector3LoopAbsolute, reverse=True)
	complexLoops = euclidean.getComplexPaths(loops)
	nestedRings = []
	for loopIndex, loop in enumerate(loops):
		complexLoop = complexLoops[loopIndex]
		leftPoint = euclidean.getLeftPoint(complexLoop)
		isInFilledRegion = euclidean.getIsInFilledRegion(complexLoops[: loopIndex] + complexLoops[loopIndex + 1 :], leftPoint)
		if isInFilledRegion == euclidean.isWiddershins(complexLoop):
			loop.reverse()
		nestedRing = euclidean.NestedRing()
		nestedRing.boundary = complexLoop
		nestedRing.vector3Loop = loop
		nestedRings.append(nestedRing)
	nestedRings = euclidean.getOrderedNestedRings(nestedRings)
	nestedRings = euclidean.getFlattenedNestedRings(nestedRings)
	portionDirections = getSpacedPortionDirections(derivation.interpolationDictionary)
	if len(nestedRings) < 1:
		return {}
	if len(nestedRings) == 1:
		geometryOutput = getGeometryOutputByNestedRing(derivation, nestedRings[0], portionDirections)
		return solid.getGeometryOutputByManipulation(geometryOutput, derivation.xmlElement)
	shapes = []
	for nestedRing in nestedRings:
		shapes.append(getGeometryOutputByNestedRing(derivation, nestedRing, portionDirections))
	return solid.getGeometryOutputByManipulation({'union' : {'shapes' : shapes}}, derivation.xmlElement)
Beispiel #2
0
def getGeometryOutputByNegativesPositives(negatives, positives, xmlElement):
	'Get triangle mesh from derivation, negatives, positives and xmlElement.'
	positiveOutput = triangle_mesh.getUnifiedOutput(positives)
	if len(negatives) < 1:
		return solid.getGeometryOutputByManipulation(positiveOutput, xmlElement)
	if len(positives) < 1:
		negativeOutput = triangle_mesh.getUnifiedOutput(negatives)
		return solid.getGeometryOutputByManipulation(negativeOutput, xmlElement)
	return solid.getGeometryOutputByManipulation({'difference' : {'shapes' : [positiveOutput] + negatives}}, xmlElement)
Beispiel #3
0
def getGeometryOutputByNegativesPositives(elementNode, negatives, positives):
	'Get triangle mesh from elementNode, negatives and positives.'
	positiveOutput = triangle_mesh.getUnifiedOutput(positives)
	if len(negatives) < 1:
		return solid.getGeometryOutputByManipulation(elementNode, positiveOutput)
	if len(positives) < 1:
		negativeOutput = triangle_mesh.getUnifiedOutput(negatives)
		return solid.getGeometryOutputByManipulation(elementNode, negativeOutput)
	return solid.getGeometryOutputByManipulation(elementNode, {'difference' : {'shapes' : [positiveOutput] + negatives}})
Beispiel #4
0
def getGeometryOutputByNegativesPositives(derivation, negatives, positives, xmlElement):
	"Get triangle mesh from derivation, negatives, positives and xmlElement."
	positiveOutput = trianglemesh.getUnifiedOutput(positives)
	if len(negatives) < 1:
		return solid.getGeometryOutputByManipulation(positiveOutput, xmlElement)
	return solid.getGeometryOutputByManipulation({'difference' : {'shapes' : [positiveOutput] + negatives}}, xmlElement)##
	interpolationOffset = derivation.interpolationDictionary['offset']
	if len(negatives) < 1:
		return getGeometryOutputByOffset(positiveOutput, interpolationOffset, xmlElement)
	return getGeometryOutputByOffset({'difference' : {'shapes' : [positiveOutput] + negatives}}, interpolationOffset, xmlElement)
Beispiel #5
0
def getGeometryOutput(derivation, elementNode):
	"Get vector3 vertexes from attribute dictionary."
	if derivation is None:
		derivation = DrillDerivation(elementNode)
	negatives = []
	teardrop.addNegativesByRadius(elementNode, derivation.end, negatives, derivation.radius, derivation.start)
	return solid.getGeometryOutputByManipulation(elementNode, negatives[0])
Beispiel #6
0
def processElementNodeByDerivation(derivation, elementNode):
	'Process the xml element by derivation.'
	if derivation == None:
		derivation = CopyDerivation(elementNode)
	if derivation.target == None:
		print('Warning, copy could not get target for:')
		print(elementNode)
		return
	del elementNode.attributes['target']
	copyMatrix = matrix.getBranchMatrixSetElementNode(elementNode)
	targetMatrix = matrix.getBranchMatrixSetElementNode(derivation.target)
	targetDictionaryCopy = evaluate.removeIdentifiersFromDictionary(derivation.target.attributes.copy())
	targetDictionaryCopy.update(elementNode.attributes)
	elementNode.attributes = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(elementNode.attributes, 'visible')
	elementNode.localName = derivation.target.localName
	derivation.target.copyXMLChildNodes(elementNode.getIDSuffix(), elementNode)
	elementNode.getXMLProcessor().processElementNode(elementNode)
	if copyMatrix != None and targetMatrix != None:
		elementNode.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
	if elementNode.xmlObject == None:
		return
	if len(elementNode.xmlObject.getPaths()) > 0:
		lineation.processElementNode(elementNode)
		return
	geometryOutput = elementNode.xmlObject.getGeometryOutput()
	if geometryOutput == None:
		return
	solidMatchingPlugins = solid.getSolidMatchingPlugins(elementNode)
	if len(solidMatchingPlugins) == 0:
		return
	geometryOutput = solid.getGeometryOutputByManipulation(elementNode, geometryOutput)
	elementNode.xmlObject.transformGeometryOutput(geometryOutput)
	lineation.removeChildNodesFromElementObject(elementNode)
	elementNode.getXMLProcessor().convertElementNode(elementNode, geometryOutput)
Beispiel #7
0
def getGeometryOutputWithConnection( geometryOutput, interpolationOffset, xmlElement ):
	"Get solid output with connection attributes."
	geometryOutputValues = geometryOutput.values()
	if len( geometryOutputValues ) < 1:
		return geometryOutput
	firstValue = geometryOutputValues[0]
	firstValue['connectionfrom'] = interpolationOffset.getVector3ByPortion( PortionDirection( 0.0 ) )
	firstValue['connectionto'] = interpolationOffset.getVector3ByPortion( PortionDirection( 1.0 ) )
	return solid.getGeometryOutputByManipulation( geometryOutput, xmlElement )
Beispiel #8
0
def getGeometryOutputByConnection(connectionEnd, connectionStart, geometryOutput, xmlElement):
	"Get solid output by connection."
	firstValue = geometryOutput.values()[0]
	firstValue['connectionStart'] = connectionStart
	firstValue['connectionEnd'] = connectionEnd
	return solid.getGeometryOutputByManipulation(geometryOutput, xmlElement)
Beispiel #9
0
def getGeometryOutputByConnection(connectionEnd, connectionStart, geometryOutput, xmlElement):
	"Get solid output by connection."
	firstValue = geometryOutput.values()[0]
	firstValue['connectionStart'] = connectionStart
	firstValue['connectionEnd'] = connectionEnd
	return solid.getGeometryOutputByManipulation(geometryOutput, xmlElement)