Added slice date/time and basic settings to start GCode. And made export preserve lines that only had comments.
This commit is contained in:
parent
6fbc7e4d91
commit
3192b0ac71
4 changed files with 17 additions and 5 deletions
|
@ -164,7 +164,7 @@ class AlterationSkein:
|
||||||
"A class to alteration a skein of extrusions."
|
"A class to alteration a skein of extrusions."
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
'Initialize.'
|
'Initialize.'
|
||||||
self.distanceFeedRate = gcodec.DistanceFeedRate()
|
self.distanceFeedRate = gcodec.DistanceFeedRate()
|
||||||
self.lineIndex = 0
|
self.lineIndex = 0
|
||||||
self.settingDictionary = None
|
self.settingDictionary = None
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ class AlterationSkein:
|
||||||
if self.settingDictionary == None:
|
if self.settingDictionary == None:
|
||||||
return self.distanceFeedRate.output.getvalue().replace('(<alterationDeleteThisPrefix/>)', '')
|
return self.distanceFeedRate.output.getvalue().replace('(<alterationDeleteThisPrefix/>)', '')
|
||||||
lines = archive.getTextLines(self.distanceFeedRate.output.getvalue())
|
lines = archive.getTextLines(self.distanceFeedRate.output.getvalue())
|
||||||
distanceFeedRate = gcodec.DistanceFeedRate()
|
distanceFeedRate = gcodec.DistanceFeedRate()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.startswith('(<alterationDeleteThisPrefix/>)'):
|
if line.startswith('(<alterationDeleteThisPrefix/>)'):
|
||||||
line = self.getReplacedAlterationLine(line[len('(<alterationDeleteThisPrefix/>)') :])
|
line = self.getReplacedAlterationLine(line[len('(<alterationDeleteThisPrefix/>)') :])
|
||||||
|
|
|
@ -398,6 +398,7 @@ class ExportSkein:
|
||||||
'Parse a gcode line.'
|
'Parse a gcode line.'
|
||||||
splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
|
splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
|
||||||
if len(splitLine) < 1:
|
if len(splitLine) < 1:
|
||||||
|
self.addLine(line)
|
||||||
return
|
return
|
||||||
firstWord = splitLine[0]
|
firstWord = splitLine[0]
|
||||||
if firstWord == '(</crafting>)':
|
if firstWord == '(</crafting>)':
|
||||||
|
|
|
@ -69,6 +69,7 @@ class GcodeSmallSkein:
|
||||||
self.lastZString = None
|
self.lastZString = None
|
||||||
self.output = cStringIO.StringIO()
|
self.output = cStringIO.StringIO()
|
||||||
self.layerNr = 0
|
self.layerNr = 0
|
||||||
|
self.parsingAlteration = False
|
||||||
|
|
||||||
def getCraftedGcode( self, gcodeText ):
|
def getCraftedGcode( self, gcodeText ):
|
||||||
"Parse gcode text and store the gcode."
|
"Parse gcode text and store the gcode."
|
||||||
|
@ -127,7 +128,10 @@ class GcodeSmallSkein:
|
||||||
elif line.startswith('(<infill>'):
|
elif line.startswith('(<infill>'):
|
||||||
self.output.write(';TYPE:FILL\n');
|
self.output.write(';TYPE:FILL\n');
|
||||||
elif line.startswith('(<alteration>'):
|
elif line.startswith('(<alteration>'):
|
||||||
self.output.write(';TYPE:CUSTOM\n');
|
self.output.write(';TYPE:CUSTOM X\n');
|
||||||
|
self.parsingAlteration = True
|
||||||
|
elif line.startswith('(</alteration>)'):
|
||||||
|
self.parsingAlteration = False
|
||||||
elif line.startswith('(<supportLayer>'):
|
elif line.startswith('(<supportLayer>'):
|
||||||
self.output.write(';TYPE:SUPPORT\n');
|
self.output.write(';TYPE:SUPPORT\n');
|
||||||
elif line.startswith('(<layer>'):
|
elif line.startswith('(<layer>'):
|
||||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import division
|
||||||
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
|
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
|
||||||
import __init__
|
import __init__
|
||||||
|
|
||||||
import ConfigParser, os, traceback, math, re, zlib, base64
|
import ConfigParser, os, traceback, math, re, zlib, base64, time
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
## Default settings when none are found.
|
## Default settings when none are found.
|
||||||
|
@ -76,7 +76,8 @@ profileDefaultSettings = {
|
||||||
}
|
}
|
||||||
alterationDefault = {
|
alterationDefault = {
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
'start.gcode': """;Start GCode
|
'start.gcode': """;Sliced at: {day} {date} {time}
|
||||||
|
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
|
||||||
G21 ;metric values
|
G21 ;metric values
|
||||||
G90 ;absolute positioning
|
G90 ;absolute positioning
|
||||||
M107 ;start with the fan off
|
M107 ;start with the fan off
|
||||||
|
@ -364,6 +365,12 @@ def calculateSolidLayerCount():
|
||||||
#########################################################
|
#########################################################
|
||||||
def replaceTagMatch(m):
|
def replaceTagMatch(m):
|
||||||
tag = m.group(0)[1:-1]
|
tag = m.group(0)[1:-1]
|
||||||
|
if tag == 'time':
|
||||||
|
return time.strftime('%H:%M:%S')
|
||||||
|
if tag == 'date':
|
||||||
|
return time.strftime('%d %b %Y')
|
||||||
|
if tag == 'day':
|
||||||
|
return time.strftime('%a')
|
||||||
if tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']:
|
if tag in ['print_speed', 'retraction_speed', 'travel_speed', 'max_z_speed', 'bottom_layer_speed', 'cool_min_feedrate']:
|
||||||
f = getProfileSettingFloat(tag) * 60
|
f = getProfileSettingFloat(tag) * 60
|
||||||
elif isProfileSetting(tag):
|
elif isProfileSetting(tag):
|
||||||
|
|
Loading…
Reference in a new issue