},'inset': {
'Add_Custom_Code_for_Temperature_Reading': DEFSET,
'Infill_in_Direction_of_Bridge': "True",
- 'Infill_Width': getProfileSetting("nozzle_size"),
+ 'Infill_Width': storedSetting("nozzle_size"),
'Loop_Order_Choice': DEFSET,
'Overlap_Removal_Width_over_Perimeter_Width_ratio': DEFSET,
'Turn_Extruder_Heater_Off_at_Shut_Down': DEFSET,
'Line': ifSettingIs('infill_type', 'Line'),
'Infill_Perimeter_Overlap_ratio': storedPercentSetting('fill_overlap'),
'Infill_Solidity_ratio': storedPercentSetting('fill_density'),
- 'Infill_Width': getProfileSetting("nozzle_size"),
+ 'Infill_Width': storedSetting("nozzle_size"),
'Sharpest_Angle_degrees': DEFSET,
'Solid_Surface_Thickness_layers': calculateSolidLayerCount,
'Start_From_Choice': DEFSET,
def getAlterationLines(fileName):
return archive.getTextLines(getAlterationFile(fileName))
-def getAlterationFile(fileName, allowMagicPrefix = True):
- "Get the file from the fileName or the lowercase fileName in the alterations directories."
- #print ('getAlterationFile:', fileName)
- prefix = ''
- if allowMagicPrefix:
- if fileName == 'start.gcode':
- #For the start code, hack the temperature and the steps per E value into it. So the temperature is reached before the start code extrusion.
- #We also set our steps per E here, if configured.
- eSteps = float(profile.getPreference('steps_per_e'))
- if eSteps > 0:
- prefix += 'M92 E'+str(eSteps)+'\n'
- temp = float(profile.getProfileSetting('print_temperature'))
- if temp > 0:
- prefix += 'M109 S'+str(temp)+'\n'
- elif fileName == 'replace.csv':
- prefix = 'M101\nM103\n'
- alterationsDirectory = archive.getSkeinforgePath('alterations')
- fullFilename = os.path.join(alterationsDirectory, fileName)
- if os.path.isfile(fullFilename):
- return prefix + archive.getFileText( fullFilename )
- return prefix
+def getAlterationFile(fileName):
+ return profile.getAlterationFileContents(fileName)
####################################
## Configuration settings classes ##
import wx\r
import sys,math,threading,os\r
\r
-from fabmetheus_utilities import settings\r
-from fabmetheus_utilities import archive\r
+from newui import profile\r
\r
class alterationPanel(wx.Panel):\r
def __init__(self, parent):\r
wx.Panel.__init__(self, parent,-1)\r
\r
- self.alterationFileList = ['start.gcode', 'end.gcode', 'cool_start.gcode', 'cool_end.gcode']\r
+ self.alterationFileList = ['start.gcode', 'end.gcode', 'cool_start.gcode', 'cool_end.gcode', 'replace.csv']\r
self.currentFile = None\r
\r
self.textArea = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_DONTWRAP|wx.TE_PROCESS_TAB)\r
self.currentFile = self.list.GetSelection()\r
\r
def loadFile(self, filename):\r
- self.textArea.SetValue(unicode(settings.getAlterationFile(filename, False), "utf-8"))\r
+ self.textArea.SetValue(unicode(profile.getAlterationFileContents(filename, False), "utf-8"))\r
\r
def OnFocusLost(self, e):\r
if self.currentFile == self.list.GetSelection():\r
- filename = os.path.join(archive.getSkeinforgePath('alterations'), self.alterationFileList[self.list.GetSelection()])\r
+ filename = profile.getAlterationFilePath(self.alterationFileList[self.list.GetSelection()])\r
f = open(filename, "wb")\r
f.write(self.textArea.GetValue().encode("utf-8"))\r
f.close()\r
pathType = line[6:].strip()
if pathType != "CUSTOM":
startCodeDone = True
+
if ';' in line:
+ #Slic3r GCode comment parser
comment = line[line.find(';')+1:].strip()
if comment == 'fill':
pathType = 'FILL'
if pathType != "CUSTOM":
startCodeDone = True
line = line[0:line.find(';')]
+
G = self.getCodeInt(line, 'G')
if G is not None:
if G == 0 or G == 1: #Move
import traceback\r
import math\r
\r
+#########################################################\r
+## Profile and preferences functions\r
+#########################################################\r
+\r
#Single place to store the defaults, so we have a consistent set of default settings.\r
profileDefaultSettings = {\r
'nozzle_size': '0.4',\r
globalPreferenceParser.set('preference', name, str(value))\r
globalPreferenceParser.write(open(getPreferencePath(), 'w'))\r
\r
+#########################################################\r
## Utility functions to calculate common profile values\r
-\r
+#########################################################\r
def calculateEdgeWidth():\r
wallThickness = float(getProfileSetting('wall_thickness'))\r
nozzleSize = float(getProfileSetting('nozzle_size'))\r
solidThickness = float(getProfileSetting('solid_layer_thickness'))\r
return int(math.ceil(solidThickness / layerHeight - 0.0001))\r
\r
+#########################################################\r
+## Alteration file functions\r
+#########################################################\r
+def getCuraBasePath():\r
+ return os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))\r
+\r
+def getAlterationFilePath(filename):\r
+ return os.path.join(getCuraBasePath(), "alterations", filename)\r
+\r
+def getAlterationFileContents(filename, allowMagicPrefix = True):\r
+ "Get the file from the fileName or the lowercase fileName in the alterations directories."\r
+ prefix = ''\r
+ if allowMagicPrefix:\r
+ if filename == 'start.gcode':\r
+ #For the start code, hack the temperature and the steps per E value into it. So the temperature is reached before the start code extrusion.\r
+ #We also set our steps per E here, if configured.\r
+ eSteps = float(getPreference('steps_per_e'))\r
+ if eSteps > 0:\r
+ prefix += 'M92 E'+str(eSteps)+'\n'\r
+ temp = float(getProfileSetting('print_temperature'))\r
+ if temp > 0:\r
+ prefix += 'M109 S'+str(temp)+'\n'\r
+ elif filename == 'replace.csv':\r
+ prefix = 'M101\nM103\n'\r
+ fullFilename = getAlterationFilePath(filename)\r
+ if os.path.isfile(fullFilename):\r
+ file = open(fullFilename, "r")\r
+ fileText = file.read()\r
+ file.close()\r
+ return prefix + fileText\r
+ return prefix\r
+\r
'--fill-angle', '45',
'--fill-pattern', 'rectilinear',
'--solid-fill-pattern', 'rectilinear',
- '--start-gcode', '',
- '--end-gcode', '',
+ '--start-gcode', profile.getAlterationFilePath('start.gcode'),
+ '--end-gcode', profile.getAlterationFilePath('end.gcode'),
'--retract-length', profile.getProfileSetting('retraction_amount'),
'--retract-speed', str(int(float(profile.getProfileSetting('retraction_speed')))),
'--retract-restart-extra', profile.getProfileSetting('retraction_extra'),