Beispiel #1
0
	def processMatrix(self):
		self._transformedMin = numpy.array([999999999999,999999999999,999999999999], numpy.float64)
		self._transformedMax = numpy.array([-999999999999,-999999999999,-999999999999], numpy.float64)
		self._boundaryCircleSize = 0

		hull = numpy.zeros((0, 2), numpy.int)
		for m in self._meshList:
			transformedVertexes = m.getTransformedVertexes()
			hull = polygon.convexHull(numpy.concatenate((numpy.rint(transformedVertexes[:,0:2]).astype(int), hull), 0))
			transformedMin = transformedVertexes.min(0)
			transformedMax = transformedVertexes.max(0)
			for n in xrange(0, 3):
				self._transformedMin[n] = min(transformedMin[n], self._transformedMin[n])
				self._transformedMax[n] = max(transformedMax[n], self._transformedMax[n])

			#Calculate the boundary circle
			transformedSize = transformedMax - transformedMin
			center = transformedMin + transformedSize / 2.0
			boundaryCircleSize = round(math.sqrt(numpy.max(((transformedVertexes[::,0] - center[0]) * (transformedVertexes[::,0] - center[0])) + ((transformedVertexes[::,1] - center[1]) * (transformedVertexes[::,1] - center[1])) + ((transformedVertexes[::,2] - center[2]) * (transformedVertexes[::,2] - center[2])))), 3)
			self._boundaryCircleSize = max(self._boundaryCircleSize, boundaryCircleSize)
		self._transformedSize = self._transformedMax - self._transformedMin
		self._drawOffset = (self._transformedMax + self._transformedMin) / 2
		self._drawOffset[2] = self._transformedMin[2]
		self._transformedMax -= self._drawOffset
		self._transformedMin -= self._drawOffset

		self._boundaryHull = polygon.minkowskiHull((hull.astype(numpy.float32) - self._drawOffset[0:2]), numpy.array([[-1,-1],[-1,1],[1,1],[1,-1]],numpy.float32))
		self._printAreaHull = polygon.minkowskiHull(self._boundaryHull, self._printAreaExtend)
		self.setHeadArea(self._headAreaExtend, self._headMinSize)
Beispiel #2
0
	def processMatrix(self):
		self._transformedMin = numpy.array([999999999999,999999999999,999999999999], numpy.float64)
		self._transformedMax = numpy.array([-999999999999,-999999999999,-999999999999], numpy.float64)
		self._boundaryCircleSize = 0

		hull = numpy.zeros((0, 2), numpy.int)
		for m in self._meshList:
			transformedVertexes = m.getTransformedVertexes()
			hull = polygon.convexHull(numpy.concatenate((numpy.rint(transformedVertexes[:,0:2]).astype(int), hull), 0))
			transformedMin = transformedVertexes.min(0)
			transformedMax = transformedVertexes.max(0)
			for n in xrange(0, 3):
				self._transformedMin[n] = min(transformedMin[n], self._transformedMin[n])
				self._transformedMax[n] = max(transformedMax[n], self._transformedMax[n])

			#Calculate the boundary circle
			transformedSize = transformedMax - transformedMin
			center = transformedMin + transformedSize / 2.0
			boundaryCircleSize = round(math.sqrt(numpy.max(((transformedVertexes[::,0] - center[0]) * (transformedVertexes[::,0] - center[0])) + ((transformedVertexes[::,1] - center[1]) * (transformedVertexes[::,1] - center[1])) + ((transformedVertexes[::,2] - center[2]) * (transformedVertexes[::,2] - center[2])))), 3)
			self._boundaryCircleSize = max(self._boundaryCircleSize, boundaryCircleSize)
		self._transformedSize = self._transformedMax - self._transformedMin
		self._drawOffset = (self._transformedMax + self._transformedMin) / 2
		self._drawOffset[2] = self._transformedMin[2]
		self._transformedMax -= self._drawOffset
		self._transformedMin -= self._drawOffset

		self._boundaryHull = polygon.minkowskiHull((hull.astype(numpy.float32) - self._drawOffset[0:2]), numpy.array([[-1,-1],[-1,1],[1,1],[1,-1]],numpy.float32))
		self._printAreaHull = polygon.minkowskiHull(self._boundaryHull, self._printAreaExtend)
		self.setHeadArea(self._headAreaExtend, self._headMinSize)
Beispiel #3
0
    def updateSizeOffsets(self, force=False):
        newOffsets = numpy.array(profile.calculateObjectSizeOffsets(),
                                 numpy.float32)
        minExtruderCount = profile.minimalExtruderCount()
        if not force and numpy.array_equal(
                self._sizeOffsets,
                newOffsets) and self._minExtruderCount == minExtruderCount:
            return
        self._sizeOffsets = newOffsets
        self._minExtruderCount = minExtruderCount

        extends = [
            numpy.array([[-newOffsets[0], -newOffsets[1]],
                         [newOffsets[0], -newOffsets[1]],
                         [newOffsets[0], newOffsets[1]],
                         [-newOffsets[0], newOffsets[1]]], numpy.float32)
        ]
        for n in xrange(1, 4):
            headOffset = numpy.array(
                [[0, 0],
                 [
                     -profile.getMachineSettingFloat('extruder_offset_x%d' %
                                                     (n)),
                     -profile.getMachineSettingFloat('extruder_offset_y%d' %
                                                     (n))
                 ]], numpy.float32)
            extends.append(polygon.minkowskiHull(extends[n - 1], headOffset))
        if minExtruderCount > 1:
            extends[0] = extends[1]

        for obj in self._objectList:
            obj.setPrintAreaExtends(extends[len(obj._meshList) - 1])
Beispiel #4
0
	def setHeadArea(self, poly, minSize):
		self._headAreaExtend = poly
		self._headMinSize = minSize
		self._headAreaHull = polygon.minkowskiHull(self._printAreaHull, self._headAreaExtend)
		pMin = numpy.min(self._printAreaHull, 0) - self._headMinSize
		pMax = numpy.max(self._printAreaHull, 0) + self._headMinSize
		square = numpy.array([pMin, [pMin[0], pMax[1]], pMax, [pMax[0], pMin[1]]], numpy.float32)
		self._headAreaMinHull = polygon.clipConvex(self._headAreaHull, square)
Beispiel #5
0
	def setHeadArea(self, poly, minSize):
		self._headAreaExtend = poly
		self._headMinSize = minSize
		self._headAreaHull = polygon.minkowskiHull(self._printAreaHull, self._headAreaExtend)
		pMin = numpy.min(self._printAreaHull, 0) - self._headMinSize
		pMax = numpy.max(self._printAreaHull, 0) + self._headMinSize
		square = numpy.array([pMin, [pMin[0], pMax[1]], pMax, [pMax[0], pMin[1]]], numpy.float32)
		self._headAreaMinHull = polygon.clipConvex(self._headAreaHull, square)
Beispiel #6
0
	def updateSizeOffsets(self, force=False):
		newOffsets = numpy.array(profile.calculateObjectSizeOffsets(), numpy.float32)
		minExtruderCount = profile.minimalExtruderCount()
		if not force and numpy.array_equal(self._sizeOffsets, newOffsets) and self._minExtruderCount == minExtruderCount:
			return
		self._sizeOffsets = newOffsets
		self._minExtruderCount = minExtruderCount

		extends = [numpy.array([[-newOffsets[0],-newOffsets[1]],[ newOffsets[0],-newOffsets[1]],[ newOffsets[0], newOffsets[1]],[-newOffsets[0], newOffsets[1]]], numpy.float32)]
		for n in xrange(1, 4):
			headOffset = numpy.array([[0, 0], [-profile.getMachineSettingFloat('extruder_offset_x%d' % (n)), -profile.getMachineSettingFloat('extruder_offset_y%d' % (n))]], numpy.float32)
			extends.append(polygon.minkowskiHull(extends[n-1], headOffset))
		if minExtruderCount > 1:
			extends[0] = extends[1]

		for obj in self._objectList:
			obj.setPrintAreaExtends(extends[len(obj._meshList) - 1])
Beispiel #7
0
	def setPrintAreaExtends(self, poly):
		self._printAreaExtend = poly
		self._printAreaHull = polygon.minkowskiHull(self._boundaryHull, self._printAreaExtend)

		self.setHeadArea(self._headAreaExtend, self._headMinSize)
    def setPrintAreaExtends(self, poly):
        self._printAreaExtend = poly
        self._printAreaHull = polygon.minkowskiHull(self._boundaryHull,
                                                    self._printAreaExtend)

        self.setHeadArea(self._headAreaExtend, self._headMinSize)
Beispiel #9
0
 def setHeadArea(self, poly):
     self._headAreaExtend = poly
     self._headAreaHull = polygon.minkowskiHull(self._printAreaHull,
                                                self._headAreaExtend)
Beispiel #10
0
	def setHeadArea(self, poly):
		self._headAreaExtend = poly
		self._headAreaHull = polygon.minkowskiHull(self._printAreaHull, self._headAreaExtend)