Ejemplo n.º 1
0
	def minimize(self, vector3):
		'Minimize the vector3 over the loops, paths and perimeters.'
		pointComplex = vector3.dropAxis()
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.boundaryLoops), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.innerPerimeters), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.loops), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.outerPerimeters), pointComplex)
		pointComplex = euclidean.getMinimum(euclidean.getMinimumByComplexPaths(self.paths), pointComplex)
		vector3.setToXYZ(pointComplex.real, pointComplex.imag, min(self.z, vector3.z))
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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