Change the way the only jump retraction works, this allows retraction when moving to print support.

This commit is contained in:
Daid 2012-06-20 02:34:59 +02:00
parent 21a71f288e
commit dc194ea1c0
3 changed files with 18 additions and 14 deletions

View file

@ -238,7 +238,6 @@ class CombSkein:
def getAroundBetweenPath(self, begin, end): def getAroundBetweenPath(self, begin, end):
'Get the path around the loops in the way of the original line segment.' 'Get the path around the loops in the way of the original line segment.'
addedJumpLine = False
aroundBetweenPath = [] aroundBetweenPath = []
boundaries = self.getBoundaries() boundaries = self.getBoundaries()
boundarySegments = self.getBoundarySegments(begin, boundaries, end) boundarySegments = self.getBoundarySegments(begin, boundaries, end)
@ -246,9 +245,6 @@ class CombSkein:
segment = boundarySegment.segment segment = boundarySegment.segment
if boundarySegmentIndex < len(boundarySegments) - 1 and self.runningJumpSpace > 0.0: if boundarySegmentIndex < len(boundarySegments) - 1 and self.runningJumpSpace > 0.0:
segment = boundarySegment.getSegment(boundarySegmentIndex, boundarySegments, self.edgeWidth, self.runningJumpSpace) segment = boundarySegment.getSegment(boundarySegmentIndex, boundarySegments, self.edgeWidth, self.runningJumpSpace)
if not addedJumpLine:
self.distanceFeedRate.addLine("(<nextmovehasspacejump>)")
addedJumpLine = True
aroundBetweenPath += self.getAroundBetweenLineSegment(segment[0], boundaries, segment[1]) aroundBetweenPath += self.getAroundBetweenLineSegment(segment[0], boundaries, segment[1])
if boundarySegmentIndex < len(boundarySegments) - 1: if boundarySegmentIndex < len(boundarySegments) - 1:
aroundBetweenPath.append(segment[1]) aroundBetweenPath.append(segment[1])

View file

@ -192,7 +192,8 @@ class DimensionSkein:
self.totalExtrusionDistance = 0.0 self.totalExtrusionDistance = 0.0
self.travelFeedRatePerSecond = None self.travelFeedRatePerSecond = None
self.zDistanceRatio = 5.0 self.zDistanceRatio = 5.0
self.addRetraction = False self.addRetraction = True
self.reverseRetraction = False
self.onlyRetractOnJumps = True self.onlyRetractOnJumps = True
def addLinearMoveExtrusionDistanceLine(self, extrusionDistance): def addLinearMoveExtrusionDistanceLine(self, extrusionDistance):
@ -383,10 +384,15 @@ class DimensionSkein:
self.absoluteDistanceMode = True self.absoluteDistanceMode = True
elif firstWord == 'G91': elif firstWord == 'G91':
self.absoluteDistanceMode = False self.absoluteDistanceMode = False
elif firstWord == '(<nextmovehasspacejump>)' and self.onlyRetractOnJumps: elif firstWord == '(<nestedRing>)':
#Check for the space jump moves for retraction, these tags are added by the comb plugin. if self.onlyRetractOnJumps:
self.addLinearMoveExtrusionDistanceLine(-self.repository.retractionDistance.value * self.retractionRatio) self.addRetraction = False
self.addRetraction = True elif firstWord == '(</nestedRing>)':
if self.onlyRetractOnJumps:
self.addRetraction = True
self.retractionRatio = self.getRetractionRatio(lineIndex)
self.addLinearMoveExtrusionDistanceLine(-self.repository.retractionDistance.value * self.retractionRatio)
self.reverseRetraction = True
elif firstWord == '(<layer>': elif firstWord == '(<layer>':
self.layerIndex += 1 self.layerIndex += 1
settings.printProgress(self.layerIndex, 'dimension') settings.printProgress(self.layerIndex, 'dimension')
@ -395,9 +401,9 @@ class DimensionSkein:
self.distanceFeedRate.addLine('G92 E0') self.distanceFeedRate.addLine('G92 E0')
self.totalExtrusionDistance = 0.0 self.totalExtrusionDistance = 0.0
elif firstWord == 'M101': elif firstWord == 'M101':
if self.addRetraction or not self.onlyRetractOnJumps: if self.reverseRetraction:
self.addLinearMoveExtrusionDistanceLine(self.restartDistance * self.retractionRatio) self.addLinearMoveExtrusionDistanceLine(self.restartDistance * self.retractionRatio)
self.addRetraction = False self.reverseRetraction = False
if self.totalExtrusionDistance > self.repository.maximumEValueBeforeReset.value: if self.totalExtrusionDistance > self.repository.maximumEValueBeforeReset.value:
if not self.repository.relativeExtrusionDistance.value: if not self.repository.relativeExtrusionDistance.value:
self.distanceFeedRate.addLine('G92 E0') self.distanceFeedRate.addLine('G92 E0')
@ -405,8 +411,9 @@ class DimensionSkein:
self.isExtruderActive = True self.isExtruderActive = True
elif firstWord == 'M103': elif firstWord == 'M103':
self.retractionRatio = self.getRetractionRatio(lineIndex) self.retractionRatio = self.getRetractionRatio(lineIndex)
if not self.onlyRetractOnJumps: if self.addRetraction:
self.addLinearMoveExtrusionDistanceLine(-self.repository.retractionDistance.value * self.retractionRatio) self.addLinearMoveExtrusionDistanceLine(-self.repository.retractionDistance.value * self.retractionRatio)
self.reverseRetraction = True
self.isExtruderActive = False self.isExtruderActive = False
elif firstWord == 'M108': elif firstWord == 'M108':
self.flowRate = float( splitLine[1][1 :] ) self.flowRate = float( splitLine[1][1 :] )

View file

@ -228,7 +228,7 @@ def DrawGCodeLayer(layer):
fillCycle = 0 fillCycle = 0
fillColorCycle = [[0.5,0.5,0.0],[0.0,0.5,0.5],[0.5,0.0,0.5]] fillColorCycle = [[0.5,0.5,0.0],[0.0,0.5,0.5],[0.5,0.0,0.5]]
moveColor = [0,0,1] moveColor = [0,0,1]
retractColor = [0,1,1] retractColor = [1,0,0.5]
supportColor = [0,1,1] supportColor = [0,1,1]
extrudeColor = [1,0,0] extrudeColor = [1,0,0]
innerWallColor = [0,1,0] innerWallColor = [0,1,0]
@ -312,7 +312,8 @@ def DrawGCodeLayer(layer):
for v in path.list: for v in path.list:
glVertex3f(v.x, v.y, v.z) glVertex3f(v.x, v.y, v.z)
glEnd() glEnd()
prevPathWasRetract = False if not path.type == 'move':
prevPathWasRetract = False
if path.type == 'retract' and path.list[0].almostEqual(path.list[-1]): if path.type == 'retract' and path.list[0].almostEqual(path.list[-1]):
prevPathWasRetract = True prevPathWasRetract = True
glEnable(GL_CULL_FACE) glEnable(GL_CULL_FACE)