From dc194ea1c04782a912477860cc4426edb45b332f Mon Sep 17 00:00:00 2001 From: Daid Date: Wed, 20 Jun 2012 02:34:59 +0200 Subject: [PATCH] Change the way the only jump retraction works, this allows retraction when moving to print support. --- .../skeinforge_plugins/craft_plugins/comb.py | 4 ---- .../craft_plugins/dimension.py | 23 ++++++++++++------- Cura/gui/opengl.py | 5 ++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/comb.py b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/comb.py index 8f98e98..665f7bf 100644 --- a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/comb.py +++ b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/comb.py @@ -238,7 +238,6 @@ class CombSkein: def getAroundBetweenPath(self, begin, end): 'Get the path around the loops in the way of the original line segment.' - addedJumpLine = False aroundBetweenPath = [] boundaries = self.getBoundaries() boundarySegments = self.getBoundarySegments(begin, boundaries, end) @@ -246,9 +245,6 @@ class CombSkein: segment = boundarySegment.segment if boundarySegmentIndex < len(boundarySegments) - 1 and self.runningJumpSpace > 0.0: segment = boundarySegment.getSegment(boundarySegmentIndex, boundarySegments, self.edgeWidth, self.runningJumpSpace) - if not addedJumpLine: - self.distanceFeedRate.addLine("()") - addedJumpLine = True aroundBetweenPath += self.getAroundBetweenLineSegment(segment[0], boundaries, segment[1]) if boundarySegmentIndex < len(boundarySegments) - 1: aroundBetweenPath.append(segment[1]) diff --git a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/dimension.py b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/dimension.py index b56d4e3..684f8e9 100644 --- a/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/dimension.py +++ b/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/dimension.py @@ -192,7 +192,8 @@ class DimensionSkein: self.totalExtrusionDistance = 0.0 self.travelFeedRatePerSecond = None self.zDistanceRatio = 5.0 - self.addRetraction = False + self.addRetraction = True + self.reverseRetraction = False self.onlyRetractOnJumps = True def addLinearMoveExtrusionDistanceLine(self, extrusionDistance): @@ -383,10 +384,15 @@ class DimensionSkein: self.absoluteDistanceMode = True elif firstWord == 'G91': self.absoluteDistanceMode = False - elif firstWord == '()' and self.onlyRetractOnJumps: - #Check for the space jump moves for retraction, these tags are added by the comb plugin. - self.addLinearMoveExtrusionDistanceLine(-self.repository.retractionDistance.value * self.retractionRatio) - self.addRetraction = True + elif firstWord == '()': + if self.onlyRetractOnJumps: + self.addRetraction = False + elif firstWord == '()': + if self.onlyRetractOnJumps: + self.addRetraction = True + self.retractionRatio = self.getRetractionRatio(lineIndex) + self.addLinearMoveExtrusionDistanceLine(-self.repository.retractionDistance.value * self.retractionRatio) + self.reverseRetraction = True elif firstWord == '(': self.layerIndex += 1 settings.printProgress(self.layerIndex, 'dimension') @@ -395,9 +401,9 @@ class DimensionSkein: self.distanceFeedRate.addLine('G92 E0') self.totalExtrusionDistance = 0.0 elif firstWord == 'M101': - if self.addRetraction or not self.onlyRetractOnJumps: + if self.reverseRetraction: self.addLinearMoveExtrusionDistanceLine(self.restartDistance * self.retractionRatio) - self.addRetraction = False + self.reverseRetraction = False if self.totalExtrusionDistance > self.repository.maximumEValueBeforeReset.value: if not self.repository.relativeExtrusionDistance.value: self.distanceFeedRate.addLine('G92 E0') @@ -405,8 +411,9 @@ class DimensionSkein: self.isExtruderActive = True elif firstWord == 'M103': self.retractionRatio = self.getRetractionRatio(lineIndex) - if not self.onlyRetractOnJumps: + if self.addRetraction: self.addLinearMoveExtrusionDistanceLine(-self.repository.retractionDistance.value * self.retractionRatio) + self.reverseRetraction = True self.isExtruderActive = False elif firstWord == 'M108': self.flowRate = float( splitLine[1][1 :] ) diff --git a/Cura/gui/opengl.py b/Cura/gui/opengl.py index 7f6fcb1..ab685d5 100644 --- a/Cura/gui/opengl.py +++ b/Cura/gui/opengl.py @@ -228,7 +228,7 @@ def DrawGCodeLayer(layer): fillCycle = 0 fillColorCycle = [[0.5,0.5,0.0],[0.0,0.5,0.5],[0.5,0.0,0.5]] moveColor = [0,0,1] - retractColor = [0,1,1] + retractColor = [1,0,0.5] supportColor = [0,1,1] extrudeColor = [1,0,0] innerWallColor = [0,1,0] @@ -312,7 +312,8 @@ def DrawGCodeLayer(layer): for v in path.list: glVertex3f(v.x, v.y, v.z) glEnd() - prevPathWasRetract = False + if not path.type == 'move': + prevPathWasRetract = False if path.type == 'retract' and path.list[0].almostEqual(path.list[-1]): prevPathWasRetract = True glEnable(GL_CULL_FACE)