Пример #1
0
	def maximize(self, vector3):
		'Maximize the vector3 over the loops, paths and perimeters.'
		pointComplex = vector3.dropAxis()
		pointComplex = euclidean.getMaximum(euclidean.getMaximumByComplexPaths(self.boundaryLoops), pointComplex)
		pointComplex = euclidean.getMaximum(euclidean.getMaximumByComplexPaths(self.innerPerimeters), pointComplex)
		pointComplex = euclidean.getMaximum(euclidean.getMaximumByComplexPaths(self.loops), pointComplex)
		pointComplex = euclidean.getMaximum(euclidean.getMaximumByComplexPaths(self.outerPerimeters), pointComplex)
		pointComplex = euclidean.getMaximum(euclidean.getMaximumByComplexPaths(self.paths), pointComplex)
		vector3.setToXYZ(pointComplex.real, pointComplex.imag, max(self.z, vector3.z))
Пример #2
0
	def parseCorner(self, line):
		'Parse a gcode line and use the location to update the bounding corners.'
		splitLine = getSplitLineBeforeBracketSemicolon(line)
		firstWord = getFirstWord(splitLine)
		if firstWord == '(<boundaryPoint>':
			locationComplex = getLocationFromSplitLine(None, splitLine).dropAxis()
			self.cornerMaximum = euclidean.getMaximum(self.cornerMaximum, locationComplex)
			self.cornerMinimum = euclidean.getMinimum(self.cornerMinimum, locationComplex)
		elif firstWord == 'G1':
			location = getLocationFromSplitLine(self.oldLocation, splitLine)
			locationComplex = location.dropAxis()
			self.cornerMaximum = euclidean.getMaximum(self.cornerMaximum, locationComplex + self.cornerRadius)
			self.cornerMinimum = euclidean.getMinimum(self.cornerMinimum, locationComplex - self.cornerRadius)
			self.oldLocation = location
Пример #3
0
 def setCorners(self):
     'Set maximum and minimum corners and z.'
     cornerMaximumComplex = complex(-987654321.0, -987654321.0)
     cornerMinimumComplex = -cornerMaximumComplex
     for line in self.lines[self.lineIndex:]:
         splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
         firstWord = gcodec.getFirstWord(splitLine)
         if firstWord == 'G1':
             location = gcodec.getLocationFromSplitLine(
                 self.oldLocation, splitLine)
             if self.isExtrusionActive:
                 locationComplex = location.dropAxis()
                 cornerMaximumComplex = euclidean.getMaximum(
                     locationComplex, cornerMaximumComplex)
                 cornerMinimumComplex = euclidean.getMinimum(
                     locationComplex, cornerMinimumComplex)
             self.oldLocation = location
         elif firstWord == 'M101':
             self.isExtrusionActive = True
         elif firstWord == 'M103':
             self.isExtrusionActive = False
     self.extent = cornerMaximumComplex - cornerMinimumComplex
     self.shapeCenter = 0.5 * (cornerMaximumComplex + cornerMinimumComplex)
     self.separation = self.repository.separationOverEdgeWidth.value * self.absoluteEdgeWidth
     self.extentPlusSeparation = self.extent + complex(
         self.separation, self.separation)
     columnsMinusOne = self.numberOfColumns - 1
     rowsMinusOne = self.numberOfRows - 1
     self.arrayExtent = complex(
         self.extentPlusSeparation.real * columnsMinusOne,
         self.extentPlusSeparation.imag * rowsMinusOne)
     self.arrayCenter = 0.5 * self.arrayExtent
Пример #4
0
	def setCorners(self):
		'Set maximum and minimum corners and z.'
		cornerMaximumComplex = complex(-987654321.0, -987654321.0)
		cornerMinimumComplex = -cornerMaximumComplex
		for line in self.lines[self.lineIndex :]:
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
			firstWord = gcodec.getFirstWord(splitLine)
			if firstWord == 'G1':
				location = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine)
				if self.isExtrusionActive:
					locationComplex = location.dropAxis()
					cornerMaximumComplex = euclidean.getMaximum(locationComplex,  cornerMaximumComplex)
					cornerMinimumComplex = euclidean.getMinimum(locationComplex,  cornerMinimumComplex)
				self.oldLocation = location
			elif firstWord == 'M101':
				self.isExtrusionActive = True
			elif firstWord == 'M103':
				self.isExtrusionActive = False
		self.extent = cornerMaximumComplex - cornerMinimumComplex
		self.shapeCenter = 0.5 * (cornerMaximumComplex + cornerMinimumComplex)
		self.separation = self.repository.separationOverPerimeterWidth.value * self.absolutePerimeterWidth
		self.extentPlusSeparation = self.extent + complex(self.separation, self.separation)
		columnsMinusOne = self.numberOfColumns - 1
		rowsMinusOne = self.numberOfRows - 1
		self.arrayExtent = complex(self.extentPlusSeparation.real * columnsMinusOne, self.extentPlusSeparation.imag * rowsMinusOne)
		self.arrayCenter = 0.5 * self.arrayExtent