Permalink
Browse files

SF40: backport skirt.py changes from upstream drop

This makes the feed and flowrate for skirt configurable. The 'outline' plugin used the slowdown factor from 'raft', but 'skirt' didn't, making it go too fast.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
  • Loading branch information...
1 parent 0a02cf4 commit 3f5fdd03a5eafcd3390c0878b550e271538d1720 @koenkooi koenkooi committed Apr 1, 2011
@@ -168,6 +168,8 @@
<dl><dt><a name="SkirtSkein-parseLine"><strong>parseLine</strong></a>(self, line)</dt><dd><tt>Parse&nbsp;a&nbsp;gcode&nbsp;line&nbsp;and&nbsp;add&nbsp;it&nbsp;to&nbsp;the&nbsp;skirt&nbsp;skein.</tt></dd></dl>
+<dl><dt><a name="SkirtSkein-setSkirtFeedFlowTemperature"><strong>setSkirtFeedFlowTemperature</strong></a>(self)</dt><dd><tt>Set&nbsp;the&nbsp;skirt&nbsp;feed&nbsp;rate,&nbsp;flow&nbsp;rate&nbsp;and&nbsp;temperature&nbsp;to&nbsp;that&nbsp;of&nbsp;the&nbsp;next&nbsp;extrusion.</tt></dd></dl>
+
<dl><dt><a name="SkirtSkein-unifyLayer"><strong>unifyLayer</strong></a>(self, loopCrossDictionary)</dt><dd><tt>Union&nbsp;the&nbsp;loopCrossDictionary&nbsp;with&nbsp;the&nbsp;unifiedLoop.</tt></dd></dl>
</td></tr></table></td></tr></table><p>
@@ -139,15 +139,17 @@ def __init__(self):
'Initialize variables.'
self.distanceFeedRate = gcodec.DistanceFeedRate()
self.feedRateMinute = 961.0
+ self.isExtruderActive = False
+ self.isSupportLayer = False
self.layerCount = settings.LayerCount()
self.layerIndex = -1
self.lineIndex = 0
self.lines = None
self.oldFlowRateInput = None
self.oldLocation = None
self.oldTemperatureInput = None
- self.operatingFlowRate = None
- self.operatingTemperature = None
+ self.skirtFlowRate = None
+ self.skirtTemperature = None
self.travelFeedRateMinute = 957.0
self.unifiedLoop = LoopCrossDictionary()
@@ -160,11 +162,12 @@ def addFlowRateLineIfDifferent(self, flowRate):
def addSkirt(self, z):
'At skirt at z to gcode output.'
+ self.setSkirtFeedFlowTemperature()
self.distanceFeedRate.addLine('(<skirt>)')
oldFlowRate = self.oldFlowRateInput
oldTemperature = self.oldTemperatureInput
- self.addTemperatureLineIfDifferent(self.operatingTemperature)
- self.addFlowRateLineIfDifferent(self.operatingFlowRate)
+ self.addTemperatureLineIfDifferent(self.skirtTemperature)
+ self.addFlowRateLineIfDifferent(self.skirtFlowRate)
for outsetLoop in self.outsetLoops:
closedLoop = outsetLoop + [outsetLoop[0]]
self.distanceFeedRate.addGcodeFromFeedRateThreadZ(self.feedRateMinute, closedLoop, self.travelFeedRateMinute, z)
@@ -201,7 +204,8 @@ def getCraftedGcode(self, gcodeText, repository):
self.parseInitialization()
self.parseBoundaries()
self.createSkirtLoops()
- for line in self.lines[self.lineIndex :]:
+ for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
+ line = self.lines[self.lineIndex]
self.parseLine(line)
return self.distanceFeedRate.output.getvalue()
@@ -248,12 +252,12 @@ def parseInitialization(self):
return
elif firstWord == '(<objectNextLayersTemperature>':
self.oldTemperatureInput = float(splitLine[1])
- self.operatingTemperature = self.oldTemperatureInput
+ self.skirtTemperature = self.oldTemperatureInput
elif firstWord == '(<operatingFeedRatePerSecond>':
self.feedRateMinute = 60.0 * float(splitLine[1])
elif firstWord == '(<operatingFlowRate>':
self.oldFlowRateInput = float(splitLine[1])
- self.operatingFlowRate = self.oldFlowRateInput
+ self.skirtFlowRate = self.oldFlowRateInput
elif firstWord == '(<perimeterWidth>':
self.perimeterWidth = float(splitLine[1])
self.skirtOutset = (self.repository.gapOverPerimeterWidth.value + 0.5) * self.perimeterWidth
@@ -275,10 +279,44 @@ def parseLine(self, line):
self.layerIndex += 1
if self.layerIndex < self.repository.layersTo.value:
self.addSkirt(float(splitLine[1]))
+ elif firstWord == 'M101':
+ self.isExtruderActive = True
+ elif firstWord == 'M103':
+ self.isExtruderActive = False
elif firstWord == 'M104':
self.oldTemperatureInput = gcodec.getDoubleAfterFirstLetter(splitLine[1])
elif firstWord == 'M108':
self.oldFlowRateInput = gcodec.getDoubleAfterFirstLetter(splitLine[1])
+ elif firstWord == '(<supportLayer>)':
+ self.isSupportLayer = True
+ elif firstWord == '(</supportLayer>)':
+ self.isSupportLayer = False
+
+ def setSkirtFeedFlowTemperature(self):
+ 'Set the skirt feed rate, flow rate and temperature to that of the next extrusion.'
+ isExtruderActive = self.isExtruderActive
+ isSupportLayer = self.isSupportLayer
+ for lineIndex in xrange(self.lineIndex, len(self.lines)):
+ line = self.lines[lineIndex]
+ splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
+ firstWord = gcodec.getFirstWord(splitLine)
+ if firstWord == 'G1':
+ self.feedRateMinute = gcodec.getFeedRateMinute(self.feedRateMinute, splitLine)
+ if isExtruderActive:
+ if not isSupportLayer:
+ return
+ elif firstWord == 'M101':
+ isExtruderActive = True
+ elif firstWord == 'M103':
+ isExtruderActive = False
+ elif firstWord == 'M104':
+ self.skirtTemperature = gcodec.getDoubleAfterFirstLetter(splitLine[1])
+ elif firstWord == 'M108':
+ self.skirtFlowRate = gcodec.getDoubleAfterFirstLetter(splitLine[1])
+ elif firstWord == '(<supportLayer>)':
+ isSupportLayer = True
+ elif firstWord == '(</supportLayer>)':
+ isSupportLayer = False
def unifyLayer(self, loopCrossDictionary):
'Union the loopCrossDictionary with the unifiedLoop.'

0 comments on commit 3f5fdd0

Please sign in to comment.