Ejemplo n.º 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)
Ejemplo n.º 2
0
 def addCoolOrbits(self, remainingOrbitTime):
     'Add the minimum radius cool orbits.'
     if len(self.boundaryLayer.loops) < 1:
         return
     insetBoundaryLoops = intercircle.getInsetLoopsFromLoops(
         self.perimeterWidth, self.boundaryLayer.loops)
     if len(insetBoundaryLoops) < 1:
         insetBoundaryLoops = self.boundaryLayer.loops
     largestLoop = euclidean.getLargestLoop(insetBoundaryLoops)
     loopArea = euclidean.getAreaLoopAbsolute(largestLoop)
     if loopArea < self.minimumArea:
         center = 0.5 * (euclidean.getMaximumByComplexPath(largestLoop) +
                         euclidean.getMinimumByComplexPath(largestLoop))
         centerXBounded = max(center.real,
                              self.boundingRectangle.cornerMinimum.real)
         centerXBounded = min(centerXBounded,
                              self.boundingRectangle.cornerMaximum.real)
         centerYBounded = max(center.imag,
                              self.boundingRectangle.cornerMinimum.imag)
         centerYBounded = min(centerYBounded,
                              self.boundingRectangle.cornerMaximum.imag)
         center = complex(centerXBounded, centerYBounded)
         maximumCorner = center + self.halfCorner
         minimumCorner = center - self.halfCorner
         largestLoop = euclidean.getSquareLoopWiddershins(
             minimumCorner, maximumCorner)
     pointComplex = euclidean.getXYComplexFromVector3(self.oldLocation)
     if pointComplex != None:
         largestLoop = euclidean.getLoopStartingNearest(
             self.perimeterWidth, pointComplex, largestLoop)
     intercircle.addOrbitsIfLarge(self.distanceFeedRate, largestLoop,
                                  self.orbitalFeedRatePerSecond,
                                  remainingOrbitTime, self.highestZ)
Ejemplo n.º 3
0
Archivo: cool.py Proyecto: Ademan/Cura
	def addCoolOrbits(self, remainingOrbitTime):
		'Add the minimum radius cool orbits.'
		if len(self.boundaryLayer.loops) < 1:
			return
		insetBoundaryLoops = self.boundaryLayer.loops
		if abs(self.repository.orbitalOutset.value) > 0.1 * abs(self.edgeWidth):
			insetBoundaryLoops = intercircle.getInsetLoopsFromLoops(self.boundaryLayer.loops, -self.repository.orbitalOutset.value)
		if len(insetBoundaryLoops) < 1:
			insetBoundaryLoops = self.boundaryLayer.loops
		largestLoop = euclidean.getLargestLoop(insetBoundaryLoops)
		loopArea = euclidean.getAreaLoopAbsolute(largestLoop)
		if loopArea < self.minimumArea:
			center = 0.5 * (euclidean.getMaximumByComplexPath(largestLoop) + euclidean.getMinimumByComplexPath(largestLoop))
			centerXBounded = max(center.real, self.boundingRectangle.cornerMinimum.real)
			centerXBounded = min(centerXBounded, self.boundingRectangle.cornerMaximum.real)
			centerYBounded = max(center.imag, self.boundingRectangle.cornerMinimum.imag)
			centerYBounded = min(centerYBounded, self.boundingRectangle.cornerMaximum.imag)
			center = complex(centerXBounded, centerYBounded)
			maximumCorner = center + self.halfCorner
			minimumCorner = center - self.halfCorner
			largestLoop = euclidean.getSquareLoopWiddershins(minimumCorner, maximumCorner)
		pointComplex = euclidean.getXYComplexFromVector3(self.oldLocation)
		if pointComplex != None:
			largestLoop = euclidean.getLoopStartingClosest(self.edgeWidth, pointComplex, largestLoop)
		intercircle.addOrbitsIfLarge(
			self.distanceFeedRate, largestLoop, self.orbitalFeedRatePerSecond, remainingOrbitTime, self.highestZ)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
 def addOutset(self, rotatedBoundaryLayer):
     "Add outset to the layer."
     extrudateLoops = intercircle.getInsetLoopsFromLoops(
         -self.absoluteHalfPerimeterWidth, rotatedBoundaryLayer.loops)
     sortedLoops = trianglemesh.getLoopsInOrderOfArea(
         trianglemesh.compareAreaAscending, extrudateLoops)
     for sortedLoop in sortedLoops:
         self.addGcodeFromRemainingLoop(sortedLoop,
                                        self.absoluteHalfPerimeterWidth,
                                        rotatedBoundaryLayer.z)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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 )
Ejemplo n.º 8
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)
Ejemplo n.º 9
0
	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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
def getBridgeDirection(belowLoops, layerLoops, radius):
	'Get span direction for the majority of the overhanging extrusion perimeter, if any.'
	if len(belowLoops) < 1:
		return None
	belowOutsetLoops = intercircle.getInsetLoopsFromLoops(belowLoops, -radius)
	bridgeRotation = complex()
	for loop in layerLoops:
		for pointIndex, point in enumerate(loop):
			previousIndex = (pointIndex + len(loop) - 1) % len(loop)
			bridgeRotation += getOverhangDirection(belowOutsetLoops, loop[previousIndex], point)
	if abs(bridgeRotation) < 0.75 * radius:
		return None
	else:
		return cmath.sqrt(bridgeRotation / abs(bridgeRotation))
Ejemplo n.º 12
0
def getBridgeDirection(belowLoops, layerLoops, radius):
	'Get span direction for the majority of the overhanging extrusion edge, if any.'
	if len(belowLoops) < 1:
		return None
	belowOutsetLoops = intercircle.getInsetLoopsFromLoops(belowLoops, -radius)
	bridgeRotation = complex()
	for loop in layerLoops:
		for pointIndex, point in enumerate(loop):
			previousIndex = (pointIndex + len(loop) - 1) % len(loop)
			bridgeRotation += getOverhangDirection(belowOutsetLoops, loop[previousIndex], point)
	if abs(bridgeRotation) < 0.75 * radius:
		return None
	else:
		return cmath.sqrt(bridgeRotation / abs(bridgeRotation))
Ejemplo n.º 13
0
 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)
Ejemplo n.º 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)
Ejemplo n.º 15
0
	def addCoolOrbits( self, remainingOrbitTime ):
		"Add the minimum radius cool orbits."
		if len( self.boundaryLayer.loops ) < 1:
			return
		insetBoundaryLoops = intercircle.getInsetLoopsFromLoops( self.perimeterWidth, self.boundaryLayer.loops )
		if len( insetBoundaryLoops ) < 1:
			insetBoundaryLoops = self.boundaryLayer.loops
		largestLoop = euclidean.getLargestLoop( insetBoundaryLoops )
		loopArea = abs( euclidean.getPolygonArea( largestLoop ) )
		if loopArea < self.minimumArea:
			center = 0.5 * ( euclidean.getMaximumFromPoints( largestLoop ) + euclidean.getMinimumFromPoints( largestLoop ) )
			centerXBounded = max( center.real, self.boundingRectangle.cornerMinimum.real )
			centerXBounded = min( centerXBounded, self.boundingRectangle.cornerMaximum.real )
			centerYBounded = max( center.imag, self.boundingRectangle.cornerMinimum.imag )
			centerYBounded = min( centerYBounded, self.boundingRectangle.cornerMaximum.imag )
			center = complex( centerXBounded, centerYBounded )
			maximumCorner = center + self.halfCorner
			minimumCorner = center - self.halfCorner
			largestLoop = euclidean.getSquareLoop( minimumCorner, maximumCorner )
		pointComplex = euclidean.getXYComplexFromVector3( self.oldLocation )
		if pointComplex != None:
			largestLoop = euclidean.getLoopStartingNearest( self.perimeterWidth, pointComplex, largestLoop )
		intercircle.addOrbitsIfLarge( self.distanceFeedRate, largestLoop, self.orbitalFeedRatePerSecond, remainingOrbitTime, self.highestZ )
Ejemplo n.º 16
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)
Ejemplo n.º 17
0
	def addOutset( self, rotatedBoundaryLayer ):
		"Add outset to the layer."
		extrudateLoops = intercircle.getInsetLoopsFromLoops( - self.absoluteHalfPerimeterWidth, rotatedBoundaryLayer.loops )
		sortedLoops = trianglemesh.getLoopsInOrderOfArea( trianglemesh.compareAreaAscending, extrudateLoops )
		for sortedLoop in sortedLoops:
			self.addGcodeFromRemainingLoop( sortedLoop, self.absoluteHalfPerimeterWidth, rotatedBoundaryLayer.z )
Ejemplo n.º 18
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)