示例#1
0
    def addInset(self, nestedRing, halfWidth, alreadyFilledArounds):
        "Add inset to the layer."

        # Note: inner nested rings have to come first so the intersecting check below does not give a false positive
        for innerNestedRing in nestedRing.innerNestedRings:
            self.addInset(innerNestedRing, halfWidth, alreadyFilledArounds)

        boundary = [nestedRing.getXYBoundaries()]
        insetBoundaryPerimeter = intercircle.getInsetLoopsFromLoops(halfWidth, boundary)

        triangle_mesh.sortLoopsInOrderOfArea(not self.loopOrderAscendingArea, insetBoundaryPerimeter)

        for loop in insetBoundaryPerimeter:
            centerOutset = intercircle.getLargestCenterOutsetLoopFromLoopRegardless(loop, halfWidth)

            "Add the perimeter block remainder of the loop which does not overlap the alreadyFilledArounds loops."
            if self.overlapRemovalWidthOverPerimeterWidth < 0.1:
                nestedRing.perimeter.addPath(centerOutset.center + [centerOutset.center[0]])
                break
            isIntersectingSelf = isIntersectingItself(centerOutset.center, self.overlapRemovalWidth)

            if isIntersectingWithinLists(centerOutset.center, alreadyFilledArounds) or isIntersectingSelf:
                self.addGcodeFromPerimeterPaths(
                    nestedRing, isIntersectingSelf, centerOutset.center, alreadyFilledArounds, halfWidth, boundary
                )
            else:
                nestedRing.perimeter.addPath(centerOutset.center + [centerOutset.center[0]])
            addAlreadyFilledArounds(alreadyFilledArounds, centerOutset.center, self.overlapRemovalWidth)
示例#2
0
 def addWiden(self, loopLayer):
     'Add widen to the layer.'
     triangle_mesh.sortLoopsInOrderOfArea(False, loopLayer.loops)
     widdershinsLoops = []
     clockwiseInsetLoops = []
     for loopIndex in xrange(len(loopLayer.loops)):
         loop = loopLayer.loops[loopIndex]
         if euclidean.isWiddershins(loop):
             otherLoops = loopLayer.loops[:loopIndex] + loopLayer.loops[
                 loopIndex + 1:]
             leftPoint = euclidean.getLeftPoint(loop)
             if getIsPointInsideALoop(otherLoops, leftPoint):
                 self.distanceFeedRate.addGcodeFromLoop(loop, loopLayer.z)
             else:
                 widdershinsLoops.append(loop)
         else:
             #				clockwiseInsetLoop = intercircle.getLargestInsetLoopFromLoop(loop, self.widenEdgeWidth)
             #				clockwiseInsetLoop.reverse()
             #				clockwiseInsetLoops.append(clockwiseInsetLoop)
             clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop(
                 loop, self.widenEdgeWidth)
             self.distanceFeedRate.addGcodeFromLoop(loop, loopLayer.z)
     for widdershinsLoop in widdershinsLoops:
         outsetLoop = intercircle.getLargestInsetLoopFromLoop(
             widdershinsLoop, -self.widenEdgeWidth)
         for widenedLoop in getWidenedLoops(widdershinsLoop,
                                            clockwiseInsetLoops, outsetLoop,
                                            self.lessThanHalfEdgeWidth):
             self.distanceFeedRate.addGcodeFromLoop(widenedLoop,
                                                    loopLayer.z)
示例#3
0
 def addOutset(self, loopLayer):
     'Add outset to the layer.'
     extrudateLoops = intercircle.getInsetLoopsFromLoops(
         loopLayer.loops, -self.absoluteHalfPerimeterWidth)
     triangle_mesh.sortLoopsInOrderOfArea(False, extrudateLoops)
     for extrudateLoop in extrudateLoops:
         self.addGcodeFromRemainingLoop(extrudateLoop,
                                        self.absoluteHalfPerimeterWidth,
                                        loopLayer.z)
示例#4
0
	def flipDirectLayer(self, loopLayer):
		"Flip the y coordinate of the layer and direct the loops."
		for loop in loopLayer.loops:
			for pointIndex, point in enumerate(loop):
				loop[pointIndex] = complex(point.real, -point.imag)
		triangle_mesh.sortLoopsInOrderOfArea(True, loopLayer.loops)
		for loopIndex, loop in enumerate(loopLayer.loops):
			isInsideLoops = euclidean.getIsInFilledRegion(loopLayer.loops[: loopIndex], euclidean.getLeftPoint(loop))
			intercircle.directLoop((not isInsideLoops), loop)
	def flipDirectLayer(self, rotatedLoopLayer):
		"Flip the y coordinate of the layer and direct the loops."
		for loop in rotatedLoopLayer.loops:
			for pointIndex, point in enumerate(loop):
				loop[pointIndex] = complex(point.real, -point.imag)
		triangle_mesh.sortLoopsInOrderOfArea(True, rotatedLoopLayer.loops)
		for loopIndex, loop in enumerate(rotatedLoopLayer.loops):
			isInsideLoops = euclidean.getIsInFilledRegion(rotatedLoopLayer.loops[: loopIndex], euclidean.getLeftPoint(loop))
			intercircle.directLoop((not isInsideLoops), loop)
示例#6
0
	def addInset( self, rotatedLoopLayer ):
		"Add inset to the layer."
		alreadyFilledArounds = []
		halfWidth = self.halfPerimeterWidth
		if rotatedLoopLayer.rotation != None:
			halfWidth *= self.repository.bridgeWidthMultiplier.value
			self.distanceFeedRate.addTagBracketedLine('bridgeRotation', rotatedLoopLayer.rotation )
		extrudateLoops = intercircle.getInsetLoopsFromLoops( halfWidth, rotatedLoopLayer.loops )
		triangle_mesh.sortLoopsInOrderOfArea(not self.repository.loopOrderAscendingArea.value, extrudateLoops)
		for extrudateLoop in extrudateLoops:
			self.addGcodeFromRemainingLoop( extrudateLoop, alreadyFilledArounds, halfWidth, rotatedLoopLayer.z )
示例#7
0
文件: inset.py 项目: malx122/Software
	def addInset(self, rotatedLoopLayer):
		"Add inset to the layer."
		alreadyFilledArounds = []
		halfWidth = self.halfPerimeterWidth
		if rotatedLoopLayer.rotation != None:
			halfWidth *= self.repository.bridgeWidthMultiplier.value
			self.distanceFeedRate.addTagBracketedLine('bridgeRotation', rotatedLoopLayer.rotation)
		extrudateLoops = intercircle.getInsetLoopsFromLoops(halfWidth, rotatedLoopLayer.loops)
		triangle_mesh.sortLoopsInOrderOfArea(not self.repository.loopOrderAscendingArea.value, extrudateLoops)
		for extrudateLoop in extrudateLoops:
			self.addGcodeFromRemainingLoop(extrudateLoop, alreadyFilledArounds, halfWidth, rotatedLoopLayer)
示例#8
0
文件: inset.py 项目: folksjos/RepG
	def addInset(self, loopLayer):
		"Add inset to the layer."
		alreadyFilledArounds = []
		extrudateLoops = intercircle.getInsetLoopsFromLoops(loopLayer.loops, self.halfEdgeWidth)
		if self.repository.infillInDirectionOfBridge.value:
			bridgeRotation = getBridgeDirection(self.belowLoops, extrudateLoops, self.halfEdgeWidth)
			if bridgeRotation != None:
				self.distanceFeedRate.addTagBracketedLine('bridgeRotation', bridgeRotation)
		self.belowLoops = loopLayer.loops
		triangle_mesh.sortLoopsInOrderOfArea(not self.repository.loopOrderAscendingArea.value, extrudateLoops)
		for extrudateLoop in extrudateLoops:
			self.addGcodeFromRemainingLoop(extrudateLoop, loopLayer, alreadyFilledArounds, self.halfEdgeWidth)
示例#9
0
	def addInset(self, loopLayer):
		"Add inset to the layer."
		alreadyFilledArounds = []
		extrudateLoops = intercircle.getInsetLoopsFromLoops(loopLayer.loops, self.halfPerimeterWidth)
		if self.repository.infillInDirectionOfBridge.value:
			self.halfBridgeWidth = self.repository.bridgeWidthMultiplier.value * self.halfPerimeterWidth #* (self.nozzleXsection / self.extrusionXsection)
			bridgeRotation = getBridgeDirection(self.belowLoops, extrudateLoops, self.halfBridgeWidth )
			if bridgeRotation is not None:
				self.distanceFeedRate.addTagBracketedLine('bridgeRotation', bridgeRotation)
#				print 'bridge' , self.layerCount
		self.belowLoops = loopLayer.loops
		triangle_mesh.sortLoopsInOrderOfArea(not self.repository.loopOrderAscendingArea.value, extrudateLoops)
		for extrudateLoop in extrudateLoops:
			self.addGcodeFromRemainingLoop(extrudateLoop, loopLayer, alreadyFilledArounds, self.halfPerimeterWidth)
示例#10
0
文件: inset.py 项目: zaubara/Curation
 def addInset(self, loopLayer):
     "Add inset to the layer."
     alreadyFilledArounds = []
     extrudateLoops = intercircle.getInsetLoopsFromLoops(
         loopLayer.loops, self.halfEdgeWidth)
     if self.repository.infillInDirectionOfBridge.value:
         bridgeRotation = getBridgeDirection(self.belowLoops,
                                             extrudateLoops,
                                             self.halfEdgeWidth)
         if bridgeRotation != None:
             self.distanceFeedRate.addTagBracketedLine(
                 'bridgeRotation', bridgeRotation)
     self.belowLoops = loopLayer.loops
     triangle_mesh.sortLoopsInOrderOfArea(
         not self.repository.loopOrderAscendingArea.value, extrudateLoops)
     for extrudateLoop in extrudateLoops:
         self.addGcodeFromRemainingLoop(extrudateLoop, loopLayer,
                                        alreadyFilledArounds,
                                        self.halfEdgeWidth)
示例#11
0
 def addOutset(self, rotatedLoopLayer):
     "Add outset to the layer."
     extrudateLoops = intercircle.getInsetLoopsFromLoops(
         -self.absoluteHalfPerimeterWidth, rotatedLoopLayer.loops)
     sortedLoops = triangle_mesh.sortLoopsInOrderOfArea(
         False, extrudateLoops)
     for sortedLoop in sortedLoops:
         self.addGcodeFromRemainingLoop(sortedLoop,
                                        self.absoluteHalfPerimeterWidth,
                                        rotatedLoopLayer.z)
示例#12
0
	def parseBoundaries(self):
		'Parse the boundaries and add them to the boundary layers.'
		boundaryLoop = None
		boundaryLayer = None
		for line in self.lines[self.lineIndex :]:
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
			firstWord = gcodec.getFirstWord(splitLine)
			if firstWord == '(</boundaryPerimeter>)':
				boundaryLoop = None
			elif firstWord == '(<boundaryPoint>':
				location = gcodec.getLocationFromSplitLine(None, splitLine)
				if boundaryLoop == None:
					boundaryLoop = []
					boundaryLayer.loops.append(boundaryLoop)
				boundaryLoop.append(location.dropAxis())
			elif firstWord == '(<layer>':
				boundaryLayer = euclidean.LoopLayer(float(splitLine[1]))
				self.boundaryLayers.append(boundaryLayer)
		for boundaryLayer in self.boundaryLayers:
			triangle_mesh.sortLoopsInOrderOfArea(False, boundaryLayer.loops)
示例#13
0
	def parseBoundaries(self):
		'Parse the boundaries and add them to the boundary layers.'
		boundaryLoop = None
		boundaryLayer = None
		for line in self.lines[self.lineIndex :]:
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
			firstWord = gcodec.getFirstWord(splitLine)
			if firstWord == '(</boundaryPerimeter>)':
				boundaryLoop = None
			elif firstWord == '(<boundaryPoint>':
				location = gcodec.getLocationFromSplitLine(None, splitLine)
				if boundaryLoop == None:
					boundaryLoop = []
					boundaryLayer.loops.append(boundaryLoop)
				boundaryLoop.append(location.dropAxis())
			elif firstWord == '(<layer>':
				boundaryLayer = euclidean.LoopLayer(float(splitLine[1]))
				self.boundaryLayers.append(boundaryLayer)
		for boundaryLayer in self.boundaryLayers:
			triangle_mesh.sortLoopsInOrderOfArea(False, boundaryLayer.loops)
示例#14
0
    def addInset(self, nestedRing, halfWidth, alreadyFilledArounds):
        "Add inset to the layer."

        # Note: inner nested rings have to come first so the intersecting check below does not give a false positive
        for innerNestedRing in nestedRing.innerNestedRings:
            self.addInset(innerNestedRing, halfWidth, alreadyFilledArounds)

        boundary = [nestedRing.getXYBoundaries()]
        insetBoundaryPerimeter = intercircle.getInsetLoopsFromLoops(
            halfWidth, boundary)

        triangle_mesh.sortLoopsInOrderOfArea(not self.loopOrderAscendingArea,
                                             insetBoundaryPerimeter)

        for loop in insetBoundaryPerimeter:
            centerOutset = intercircle.getLargestCenterOutsetLoopFromLoopRegardless(
                loop, halfWidth)

            "Add the perimeter block remainder of the loop which does not overlap the alreadyFilledArounds loops."
            if self.overlapRemovalWidthOverPerimeterWidth < 0.1:
                nestedRing.perimeter.addPath(centerOutset.center +
                                             [centerOutset.center[0]])
                break
            isIntersectingSelf = isIntersectingItself(centerOutset.center,
                                                      self.overlapRemovalWidth)

            if isIntersectingWithinLists(
                    centerOutset.center,
                    alreadyFilledArounds) or isIntersectingSelf:
                self.addGcodeFromPerimeterPaths(nestedRing, isIntersectingSelf,
                                                centerOutset.center,
                                                alreadyFilledArounds,
                                                halfWidth, boundary)
            else:
                nestedRing.perimeter.addPath(centerOutset.center +
                                             [centerOutset.center[0]])
            addAlreadyFilledArounds(alreadyFilledArounds, centerOutset.center,
                                    self.overlapRemovalWidth)
示例#15
0
文件: widen.py 项目: Spacexula/SFACT
	def addWiden(self, rotatedLoopLayer):
		'Add widen to the layer.'
		triangle_mesh.sortLoopsInOrderOfArea(False, rotatedLoopLayer.loops)
		widdershinsLoops = []
		clockwiseInsetLoops = []
		for loopIndex in xrange(len(rotatedLoopLayer.loops)):
			loop = rotatedLoopLayer.loops[loopIndex]
			if euclidean.isWiddershins(loop):
				otherLoops = rotatedLoopLayer.loops[: loopIndex] + rotatedLoopLayer.loops[loopIndex + 1 :]
				leftPoint = euclidean.getLeftPoint(loop)
				if getIsPointInsideALoop(otherLoops, leftPoint):
					self.distanceFeedRate.addGcodeFromLoop(loop, rotatedLoopLayer.z)
				else:
					widdershinsLoops.append(loop)
			else:
#				clockwiseInsetLoop = intercircle.getLargestInsetLoopFromLoop(loop, self.doublePerimeterWidth)
#				clockwiseInsetLoop.reverse()
#				clockwiseInsetLoops.append(clockwiseInsetLoop)
				clockwiseInsetLoops += intercircle.getInsetLoopsFromLoop(loop, self.doublePerimeterWidth)
				self.distanceFeedRate.addGcodeFromLoop(loop, rotatedLoopLayer.z)
		for widdershinsLoop in widdershinsLoops:
			outsetLoop = intercircle.getLargestInsetLoopFromLoop(widdershinsLoop, -self.doublePerimeterWidth)
			widenedLoop = getWidenedLoop(widdershinsLoop, clockwiseInsetLoops, outsetLoop, self.perimeterWidth)
			self.distanceFeedRate.addGcodeFromLoop(widenedLoop, rotatedLoopLayer.z)
示例#16
0
	def addOutset(self, rotatedLoopLayer):
		"Add outset to the layer."
		extrudateLoops = intercircle.getInsetLoopsFromLoops(-self.absoluteHalfPerimeterWidth, rotatedLoopLayer.loops)
		sortedLoops = triangle_mesh.sortLoopsInOrderOfArea(False, extrudateLoops)
		for sortedLoop in sortedLoops:
			self.addGcodeFromRemainingLoop(sortedLoop, self.absoluteHalfPerimeterWidth, rotatedLoopLayer.z)
示例#17
0
文件: outset.py 项目: folksjos/RepG
	def addOutset(self, loopLayer):
		'Add outset to the layer.'
		extrudateLoops = intercircle.getInsetLoopsFromLoops(loopLayer.loops, -self.absoluteHalfPerimeterWidth)
		triangle_mesh.sortLoopsInOrderOfArea(False, extrudateLoops)
		for extrudateLoop in extrudateLoops:
			self.addGcodeFromRemainingLoop(extrudateLoop, self.absoluteHalfPerimeterWidth, loopLayer.z)