示例#1
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.elementNode = elementNode
		self.importRadius = setting.getImportRadius(elementNode)
		self.layerThickness = setting.getLayerThickness(elementNode)
		self.sheetThickness = setting.getSheetThickness(elementNode)
		self.targetElementNode = evaluate.getElementNodeByKey(elementNode, 'target')
示例#2
0
文件: _carve.py 项目: hy19910/Cura
 def __init__(self, elementNode):
     'Set defaults.'
     self.elementNode = elementNode
     self.importRadius = setting.getImportRadius(elementNode)
     self.layerHeight = setting.getLayerHeight(elementNode)
     self.targetElementNode = evaluate.getElementNodeByKey(
         elementNode, 'target')
示例#3
0
def getManipulatedGeometryOutput(elementNode, geometryOutput, prefix):
	'Get inset geometryOutput.'
	derivation = InsetDerivation(elementNode, prefix)
	if derivation.radius == 0.0:
		return geometryOutput
	copyShallow = elementNode.getCopyShallow()
	solid.processElementNodeByGeometry(copyShallow, geometryOutput)
	targetMatrix = matrix.getBranchMatrixSetElementNode(elementNode)
	matrix.setElementNodeDictionaryMatrix(copyShallow, targetMatrix)
	transformedVertexes = copyShallow.xmlObject.getTransformedVertexes()
	minimumZ = boolean_geometry.getMinimumZ(copyShallow.xmlObject)
	maximumZ = euclidean.getTopPath(transformedVertexes)
	layerThickness = setting.getLayerThickness(elementNode)
	importRadius = setting.getImportRadius(elementNode)
	zoneArrangement = triangle_mesh.ZoneArrangement(layerThickness, transformedVertexes)
	copyShallow.attributes['visible'] = True
	copyShallowObjects = [copyShallow.xmlObject]
	bottomLoopLayer = euclidean.LoopLayer(minimumZ)
	z = minimumZ + 0.1 * layerThickness
	bottomLoopLayer.loops = boolean_geometry.getEmptyZLoops(copyShallowObjects, importRadius, False, z, zoneArrangement)
	loopLayers = [bottomLoopLayer]
	z = minimumZ + layerThickness
	loopLayers += boolean_geometry.getLoopLayers(copyShallowObjects, importRadius, layerThickness, maximumZ, False, z, zoneArrangement)
	copyShallow.parentNode.xmlObject.archivableObjects.remove(copyShallow.xmlObject)
	belowLoop = []
	diagonalRadius = math.sqrt(0.5) * derivation.radius
	insetDiagonalLoops = []
	loops = []
	vertexes = []
	for loopLayer in loopLayers:
		insetDiagonalLoops.append(intercircle.getLargestInsetLoopFromLoop(loopLayer.loops[0], diagonalRadius))
	for loopLayerIndex, loopLayer in enumerate(loopLayers):
		vector3Loop = []
		insetLoop = intercircle.getLargestInsetLoopFromLoop(loopLayer.loops[0], derivation.radius)
		loopLists = [[getLoopOrEmpty(loopLayerIndex - 1, insetDiagonalLoops)], [insetLoop]]
		largestLoop = euclidean.getLargestLoop(boolean_solid.getLoopsIntersection(importRadius, loopLists))
		if evaluate.getEvaluatedBoolean(True, elementNode, prefix + 'insetTop'):
			loopLists = [[getLoopOrEmpty(loopLayerIndex + 1, insetDiagonalLoops)], [largestLoop]]
			largestLoop = euclidean.getLargestLoop(boolean_solid.getLoopsIntersection(importRadius, loopLists))
		for point in largestLoop:
			vector3Index = Vector3Index(len(vertexes), point.real, point.imag, loopLayer.z)
			vector3Loop.append(vector3Index)
			vertexes.append(vector3Index)
		if len(vector3Loop) > 0:
			loops.append(vector3Loop)
	if evaluate.getEvaluatedBoolean(False, elementNode, prefix + 'addExtraTopLayer') and len(loops) > 0:
		topLoop = loops[-1]
		vector3Loop = []
		loops.append(vector3Loop)
		z = topLoop[0].z + layerThickness
		for point in topLoop:
			vector3Index = Vector3Index(len(vertexes), point.x, point.y, z)
			vector3Loop.append(vector3Index)
			vertexes.append(vector3Index)
	geometryOutput = triangle_mesh.getMeldedPillarOutput(loops)
	return geometryOutput
示例#4
0
def getMinimumZ(geometryObject):
	'Get the minimum of the minimum z of the archivableObjects and the object.'
	booleanGeometry = BooleanGeometry()
	booleanGeometry.archivableObjects = geometryObject.archivableObjects
	booleanGeometry.importRadius = setting.getImportRadius(geometryObject.elementNode)
	booleanGeometry.layerHeight = setting.getLayerHeight(geometryObject.elementNode)
	archivableMinimumZ = booleanGeometry.getMinimumZ()
	geometryMinimumZ = geometryObject.getMinimumZ()
	if archivableMinimumZ == None:
		return geometryMinimumZ
	if geometryMinimumZ == None:
		return archivableMinimumZ
	return min(archivableMinimumZ, geometryMinimumZ)
示例#5
0
def getMinimumZ(geometryObject):
	'Get the minimum of the minimum z of the archivableObjects and the object.'
	booleanGeometry = BooleanGeometry()
	booleanGeometry.archivableObjects = geometryObject.archivableObjects
	booleanGeometry.importRadius = setting.getImportRadius(geometryObject.elementNode)
	booleanGeometry.layerThickness = setting.getLayerThickness(geometryObject.elementNode)
	archivableMinimumZ = booleanGeometry.getMinimumZ()
	geometryMinimumZ = geometryObject.getMinimumZ()
	if archivableMinimumZ == None:
		return geometryMinimumZ
	if geometryMinimumZ == None:
		return archivableMinimumZ
	return min(archivableMinimumZ, geometryMinimumZ)
示例#6
0
def getMinimumZ(geometryObject):
	"""Get the minimum of the minimum z of the archivableObjects and the object."""
	booleanGeometry = BooleanGeometry()
	booleanGeometry.archivableObjects = geometryObject.archivableObjects
	booleanGeometry.importRadius = setting.getImportRadius(geometryObject.xmlElement)
	booleanGeometry.extrusionHeight = setting.getLayerThickness(geometryObject.xmlElement)
	archivableMinimumZ = booleanGeometry.getMinimumZ()
	geometryMinimumZ = geometryObject.getMinimumZ()
	if archivableMinimumZ is None and geometryMinimumZ is None:
		return None
	if archivableMinimumZ is None:
		return geometryMinimumZ
	if geometryMinimumZ is None:
		return archivableMinimumZ
	return min(archivableMinimumZ, geometryMinimumZ)
示例#7
0
 def getTransformedPaths(self):
     'Get all transformed paths.'
     importRadius = setting.getImportRadius(self.elementNode)
     loopsFromObjectLoopsList = self.getLoopsFromObjectLoopsList(
         importRadius, self.getComplexTransformedPathLists())
     return euclidean.getVector3Paths(loopsFromObjectLoopsList)
示例#8
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.elementNode = elementNode
		self.importRadius = setting.getImportRadius(elementNode)
		self.layerHeight = setting.getLayerHeight(elementNode)
		self.targetElementNode = evaluate.getElementNodeByKey(elementNode, 'target')
示例#9
0
	def getTransformedPaths(self):
		'Get all transformed paths.'
		importRadius = setting.getImportRadius(self.xmlElement)
		loopsFromObjectLoopsList = self.getLoopsFromObjectLoopsList(importRadius, self.getComplexTransformedPathLists())
		return euclidean.getVector3Paths(loopsFromObjectLoopsList)
示例#10
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.importRadius = setting.getImportRadius(xmlElement)
		self.layerThickness = setting.getLayerThickness(xmlElement)
		self.sheetThickness = setting.getSheetThickness(xmlElement)
		self.targetXMLElement = evaluate.getXMLElementByKey('target', xmlElement)
示例#11
0
def getManipulatedGeometryOutput(elementNode, geometryOutput, prefix):
    'Get inset geometryOutput.'
    derivation = InsetDerivation(elementNode, prefix)
    if derivation.radius == 0.0:
        return geometryOutput
    copyShallow = elementNode.getCopyShallow()
    solid.processElementNodeByGeometry(copyShallow, geometryOutput)
    targetMatrix = matrix.getBranchMatrixSetElementNode(elementNode)
    matrix.setElementNodeDictionaryMatrix(copyShallow, targetMatrix)
    transformedVertexes = copyShallow.xmlObject.getTransformedVertexes()
    minimumZ = boolean_geometry.getMinimumZ(copyShallow.xmlObject)
    maximumZ = euclidean.getTopPath(transformedVertexes)
    layerThickness = setting.getLayerThickness(elementNode)
    importRadius = setting.getImportRadius(elementNode)
    zoneArrangement = triangle_mesh.ZoneArrangement(layerThickness,
                                                    transformedVertexes)
    copyShallow.attributes['visible'] = True
    copyShallowObjects = [copyShallow.xmlObject]
    bottomLoopLayer = euclidean.LoopLayer(minimumZ)
    z = minimumZ + 0.1 * layerThickness
    bottomLoopLayer.loops = boolean_geometry.getEmptyZLoops(
        copyShallowObjects, importRadius, False, z, zoneArrangement)
    loopLayers = [bottomLoopLayer]
    z = minimumZ + layerThickness
    loopLayers += boolean_geometry.getLoopLayers(copyShallowObjects,
                                                 importRadius, layerThickness,
                                                 maximumZ, False, z,
                                                 zoneArrangement)
    copyShallow.parentNode.xmlObject.archivableObjects.remove(
        copyShallow.xmlObject)
    belowLoop = []
    diagonalRadius = math.sqrt(0.5) * derivation.radius
    insetDiagonalLoops = []
    loops = []
    vertexes = []
    for loopLayer in loopLayers:
        insetDiagonalLoops.append(
            intercircle.getLargestInsetLoopFromLoop(loopLayer.loops[0],
                                                    diagonalRadius))
    for loopLayerIndex, loopLayer in enumerate(loopLayers):
        vector3Loop = []
        insetLoop = intercircle.getLargestInsetLoopFromLoop(
            loopLayer.loops[0], derivation.radius)
        loopLists = [[getLoopOrEmpty(loopLayerIndex - 1, insetDiagonalLoops)],
                     [insetLoop]]
        largestLoop = euclidean.getLargestLoop(
            boolean_solid.getLoopsIntersection(importRadius, loopLists))
        if evaluate.getEvaluatedBoolean(True, elementNode,
                                        prefix + 'insetTop'):
            loopLists = [[
                getLoopOrEmpty(loopLayerIndex + 1, insetDiagonalLoops)
            ], [largestLoop]]
            largestLoop = euclidean.getLargestLoop(
                boolean_solid.getLoopsIntersection(importRadius, loopLists))
        for point in largestLoop:
            vector3Index = Vector3Index(len(vertexes), point.real, point.imag,
                                        loopLayer.z)
            vector3Loop.append(vector3Index)
            vertexes.append(vector3Index)
        if len(vector3Loop) > 0:
            loops.append(vector3Loop)
    if evaluate.getEvaluatedBoolean(False, elementNode, prefix +
                                    'addExtraTopLayer') and len(loops) > 0:
        topLoop = loops[-1]
        vector3Loop = []
        loops.append(vector3Loop)
        z = topLoop[0].z + layerThickness
        for point in topLoop:
            vector3Index = Vector3Index(len(vertexes), point.x, point.y, z)
            vector3Loop.append(vector3Index)
            vertexes.append(vector3Index)
    geometryOutput = triangle_mesh.getMeldedPillarOutput(loops)
    return geometryOutput
示例#12
0
文件: disjoin.py 项目: rkoeppl/SFACT
 def __init__(self, xmlElement):
     """Set defaults."""
     self.importRadius = setting.getImportRadius(xmlElement)
     self.extrusionHeight = setting.getLayerThickness(xmlElement)
     self.sheetThickness = setting.getSheetThickness(xmlElement)
     self.targetXMLElement = evaluate.getXMLElementByKey("target", xmlElement)