示例#1
0
文件: lathe.py 项目: Ademan/Cura
def addNegativesPositives(derivation, negatives, paths, positives):
	"Add pillars output to negatives and positives."
	for path in paths:
		endMultiplier = None
		normal = euclidean.getNormalByPath(path)
		if normal.dot(derivation.normal) < 0.0:
			endMultiplier = 1.000001
		loopListsByPath = getLoopListsByPath(derivation, endMultiplier, path)
		geometryOutput = triangle_mesh.getPillarsOutput(loopListsByPath)
		if endMultiplier == None:
			positives.append(geometryOutput)
		else:
			negatives.append(geometryOutput)
示例#2
0
def addNegativesPositives(derivation, negatives, paths, positives):
    "Add pillars output to negatives and positives."
    for path in paths:
        endMultiplier = None
        normal = euclidean.getNormalByPath(path)
        if normal.dot(derivation.normal) < 0.0:
            endMultiplier = 1.000001
        loopListsByPath = getLoopListsByPath(derivation, endMultiplier, path)
        geometryOutput = triangle_mesh.getPillarsOutput(loopListsByPath)
        if endMultiplier == None:
            positives.append(geometryOutput)
        else:
            negatives.append(geometryOutput)
示例#3
0
文件: lathe.py 项目: Ademan/Cura
	def __init__(self, elementNode):
		'Set defaults.'
		self.axisEnd = evaluate.getVector3ByPrefix(None, elementNode, 'axisEnd')
		self.axisStart = evaluate.getVector3ByPrefix(None, elementNode, 'axisStart')
		self.end = evaluate.getEvaluatedFloat(360.0, elementNode, 'end')
		self.loop = evaluate.getTransformedPathByKey([], elementNode, 'loop')
		self.sides = evaluate.getEvaluatedInt(None, elementNode, 'sides')
		self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		if len(self.target) < 1:
			print('Warning, no target in derive in lathe for:')
			print(elementNode)
			return
		firstPath = self.target[0]
		if len(firstPath) < 3:
			print('Warning, firstPath length is less than three in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		if self.axisStart == None:
			if self.axisEnd == None:
				self.axisStart = firstPath[0]
				self.axisEnd = firstPath[-1]
			else:
				self.axisStart = Vector3()
		self.axis = self.axisEnd - self.axisStart
		axisLength = abs(self.axis)
		if axisLength <= 0.0:
			print('Warning, axisLength is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		self.axis /= axisLength
		firstVector3 = firstPath[1] - self.axisStart
		firstVector3Length = abs(firstVector3)
		if firstVector3Length <= 0.0:
			print('Warning, firstVector3Length is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		firstVector3 /= firstVector3Length
		self.axisProjectiveSpace = euclidean.ProjectiveSpace().getByBasisZFirst(self.axis, firstVector3)
		if self.sides == None:
			distanceToLine = euclidean.getDistanceToLineByPaths(self.axisStart, self.axisEnd, self.target)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(elementNode, distanceToLine)
		endRadian = math.radians(self.end)
		startRadian = math.radians(self.start)
		self.isEndCloseToStart = euclidean.getIsRadianClose(endRadian, startRadian)
		if len(self.loop) < 1:
			self.loop = euclidean.getComplexPolygonByStartEnd(endRadian, 1.0, self.sides, startRadian)
		self.normal = euclidean.getNormalByPath(firstPath)
示例#4
0
文件: lathe.py 项目: folksjos/RepG
	def __init__(self, elementNode):
		'Set defaults.'
		self.axisEnd = evaluate.getVector3ByPrefix(None, elementNode, 'axisEnd')
		self.axisStart = evaluate.getVector3ByPrefix(None, elementNode, 'axisStart')
		self.end = evaluate.getEvaluatedFloat(360.0, elementNode, 'end')
		self.loop = evaluate.getTransformedPathByKey([], elementNode, 'loop')
		self.sides = evaluate.getEvaluatedInt(None, elementNode, 'sides')
		self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		if len(self.target) < 1:
			print('Warning, no target in derive in lathe for:')
			print(elementNode)
			return
		firstPath = self.target[0]
		if len(firstPath) < 3:
			print('Warning, firstPath length is less than three in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		if self.axisStart == None:
			if self.axisEnd == None:
				self.axisStart = firstPath[0]
				self.axisEnd = firstPath[-1]
			else:
				self.axisStart = Vector3()
		self.axis = self.axisEnd - self.axisStart
		axisLength = abs(self.axis)
		if axisLength <= 0.0:
			print('Warning, axisLength is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		self.axis /= axisLength
		firstVector3 = firstPath[1] - self.axisStart
		firstVector3Length = abs(firstVector3)
		if firstVector3Length <= 0.0:
			print('Warning, firstVector3Length is zero in derive in lathe for:')
			print(elementNode)
			self.target = []
			return
		firstVector3 /= firstVector3Length
		self.axisProjectiveSpace = euclidean.ProjectiveSpace().getByBasisZFirst(self.axis, firstVector3)
		if self.sides == None:
			distanceToLine = euclidean.getDistanceToLineByPaths(self.axisStart, self.axisEnd, self.target)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(elementNode, distanceToLine)
		endRadian = math.radians(self.end)
		startRadian = math.radians(self.start)
		self.isEndCloseToStart = euclidean.getIsRadianClose(endRadian, startRadian)
		if len(self.loop) < 1:
			self.loop = euclidean.getComplexPolygonByStartEnd(endRadian, 1.0, self.sides, startRadian)
		self.normal = euclidean.getNormalByPath(firstPath)
示例#5
0
	def derive(self, xmlElement):
		"Derive using the xmlElement."
		if len(self.target) < 1:
			print('Warning, no target in derive in lathe for:')
			print(xmlElement)
			return
		firstPath = self.target[0]
		if len(firstPath) < 3:
			print('Warning, firstPath length is less than three in derive in lathe for:')
			print(xmlElement)
			self.target = []
			return
		if self.axisStart == None:
			if self.axisEnd == None:
				self.axisStart = firstPath[0]
				self.axisEnd = firstPath[-1]
			else:
				self.axisStart = Vector3()
		self.axis = self.axisEnd - self.axisStart
		axisLength = abs(self.axis)
		if axisLength <= 0.0:
			print('Warning, axisLength is zero in derive in lathe for:')
			print(xmlElement)
			self.target = []
			return
		self.axis /= axisLength
		firstVector3 = firstPath[1] - self.axisStart
		firstVector3Length = abs(firstVector3)
		if firstVector3Length <= 0.0:
			print('Warning, firstVector3Length is zero in derive in lathe for:')
			print(xmlElement)
			self.target = []
			return
		firstVector3 /= firstVector3Length
		self.axisProjectiveSpace = euclidean.ProjectiveSpace().getByBasisZFirst(self.axis, firstVector3)
		if self.sides == None:
			distanceToLine = euclidean.getDistanceToLineByPaths(self.axisStart, self.axisEnd, self.target)
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(distanceToLine, xmlElement)
		if len(self.loop) < 1:
			self.loop = euclidean.getComplexPolygonByStartEnd(math.radians(self.end), 1.0, self.sides, math.radians(self.start))
		self.normal = euclidean.getNormalByPath(firstPath)