def storedSetting(name):
return lambda setting: getSetting(name, setting.value)
+def ifSettingAboveZero(name):
+ return lambda setting: float(getSetting(name, '0.0')) > 0
+
def storedPercentSetting(name):
return lambda setting: float(getSetting(name, setting.value)) / 100
'Turn_Extruder_Heater_Off_at_Shut_Down': defaultSetting,
'Volume_Fraction_ratio': defaultSetting,
},'fill': {
- 'Activate_Fill': defaultSetting,
+ 'Activate_Fill': "True",
'Diaphragm_Period_layers': defaultSetting,
'Diaphragm_Thickness_layers': defaultSetting,
'Extra_Shells_on_Alternating_Solid_Layer_layers': calculateShells,
'Perimeter_Flow_Rate_Multiplier_ratio': defaultSetting,
'Travel_Feed_Rate_mm/s': storedSetting("travel_speed"),
},'temperature': {
- 'Activate_Temperature': "False",
+ 'Activate_Temperature': defaultSetting,#ifSettingAboveZero('print_temperature'),
'Cooling_Rate_Celcius/second': defaultSetting,
'Heating_Rate_Celcius/second': defaultSetting,
- 'Base_Temperature_Celcius': defaultSetting,
- 'Interface_Temperature_Celcius': defaultSetting,
- 'Object_First_Layer_Infill_Temperature_Celcius': defaultSetting,
- 'Object_First_Layer_Perimeter_Temperature_Celcius': defaultSetting,
- 'Object_Next_Layers_Temperature_Celcius': defaultSetting,
- 'Support_Layers_Temperature_Celcius': defaultSetting,
- 'Supported_Layers_Temperature_Celcius': defaultSetting,
+ 'Base_Temperature_Celcius': defaultSetting,#storedSetting("print_temperature"),
+ 'Interface_Temperature_Celcius': defaultSetting,#storedSetting("print_temperature"),
+ 'Object_First_Layer_Infill_Temperature_Celcius': defaultSetting,#storedSetting("print_temperature"),
+ 'Object_First_Layer_Perimeter_Temperature_Celcius': defaultSetting,#storedSetting("print_temperature"),
+ 'Object_Next_Layers_Temperature_Celcius': defaultSetting,#storedSetting("print_temperature"),
+ 'Support_Layers_Temperature_Celcius': defaultSetting,#storedSetting("print_temperature"),
+ 'Supported_Layers_Temperature_Celcius': defaultSetting,#storedSetting("print_temperature"),
},'raft': {
- 'Activate_Raft': "False",
+ 'Activate_Raft': "True",
'Add_Raft,_Elevate_Nozzle,_Orbit': defaultSetting,
'Base_Feed_Rate_Multiplier_ratio': defaultSetting,
'Base_Flow_Rate_Multiplier_ratio': defaultSetting,
'Base_Infill_Density_ratio': defaultSetting,
'Base_Layer_Thickness_over_Layer_Thickness': defaultSetting,
- 'Base_Layers_integer': defaultSetting,
+ 'Base_Layers_integer': '0',
'Base_Nozzle_Lift_over_Base_Layer_Thickness_ratio': defaultSetting,
'Initial_Circling': defaultSetting,
'Infill_Overhang_over_Extrusion_Width_ratio': defaultSetting,
'Interface_Flow_Rate_Multiplier_ratio': defaultSetting,
'Interface_Infill_Density_ratio': defaultSetting,
'Interface_Layer_Thickness_over_Layer_Thickness': defaultSetting,
- 'Interface_Layers_integer': defaultSetting,
+ 'Interface_Layers_integer': '0',
'Interface_Nozzle_Lift_over_Interface_Layer_Thickness_ratio': defaultSetting,
'Name_of_Support_End_File': defaultSetting,
'Name_of_Support_Start_File': defaultSetting,
'Operating_Nozzle_Lift_over_Layer_Thickness_ratio': defaultSetting,
'Raft_Additional_Margin_over_Length_%': defaultSetting,
'Raft_Margin_mm': defaultSetting,
- 'Support_Cross_Hatch': defaultSetting,
+ 'Support_Cross_Hatch': 'False',
'Support_Flow_Rate_over_Operating_Flow_Rate_ratio': defaultSetting,
'Support_Gap_over_Perimeter_Extrusion_Width_ratio': defaultSetting,
- 'Support_Material_Choice_': defaultSetting,
+ 'Support_Material_Choice_': storedSetting("support"),
'Support_Minimum_Angle_degrees': defaultSetting,
},'skirt': {
'Skirt_line_count': storedSetting("skirt_line_count"),
'gcode_small': defaultSetting,
'File_Extension': defaultSetting,
'Name_of_Replace_File': defaultSetting,
- 'Save_Penultimate_Gcode': defaultSetting,
+ 'Save_Penultimate_Gcode': "False",
}
}
from __future__ import absolute_import
import __init__
-import wx, os, platform
+import wx, os, platform, types
+import ConfigParser
from fabmetheus_utilities import settings
wx.ToolTip.SetDelay(0)
self.lastPath = ""
- self.filename = None
+ self.filename = getPreference('lastFile', None)
self.progressPanelList = []
self.settingControlList = []
validators.validInt(c, 0, 10)
c = SettingRow(left, "Start distance (mm)", 'skirt_gap', '6.0', 'The distance between the skirt and the first layer.\nThis is the minimal distance, multiple skirt lines will be put outwards from this distance.')
validators.validFloat(c, 0.0)
-
- TitleRow(right, "Cool")
- #c = SettingRow(right, "Cool type", self.plugins['cool'].preferencesDict['Cool_Type'])
- c = SettingRow(right, "Minimal layer time (sec)", 'cool_min_layer_time', '10', 'Minimum time spend in a layer, gives the layer time to cool down before the next layer is put on top. If the layer will be placed down too fast the printer will slow down to make sure it has spend atleast this amount of seconds printing this layer.')
- validators.validFloat(c, 0.0)
- TitleRow(right, "Temperature")
+ TitleRow(right, "Speed")
+ c = SettingRow(right, "Print speed (mm/s)", 'print_speed', '50')
+ validators.validFloat(c, 1.0)
+ validators.warningAbove(c, 150.0, "It is highly unlikely that your machine can achieve a printing speed above 150mm/s")
+
+ #Printing temperature is a problem right now, as our start code depends on a heated head.
+ #TitleRow(right, "Temperature")
+ #c = SettingRow(right, "Printing temperature", 'print_temperature', '0', 'Temperature used for printing. Set at 0 to pre-heat yourself')
+ #validators.validFloat(c, 0.0, 350.0)
+ #validators.warningAbove(c, 260.0, "Temperatures above 260C could damage your machine.")
+
TitleRow(right, "Support")
-
+ c = SettingRow(right, "Support type", 'support', ['None', 'Exterior only', 'Everywhere', 'Empty layers only'], 'Type of support structure build.\nNone does not do any support.\nExterior only only creates support on the outside.\nEverywhere creates support even on the insides of the model.\nOnly on empty layers is for stacked objects.')
(left, right) = self.CreateConfigTab(nb, 'Machine && Filament')
c = SettingRow(right, "Bottom layer speed", 'bottom_layer_speed', '25')
validators.validFloat(c, 0.0)
+ TitleRow(right, "Cool")
+ #c = SettingRow(right, "Cool type", self.plugins['cool'].preferencesDict['Cool_Type'])
+ c = SettingRow(right, "Minimal layer time (sec)", 'cool_min_layer_time', '10', 'Minimum time spend in a layer, gives the layer time to cool down before the next layer is put on top. If the layer will be placed down too fast the printer will slow down to make sure it has spend atleast this amount of seconds printing this layer.')
+ validators.validFloat(c, 0.0)
+
TitleRow(right, "Filament")
c = SettingRow(right, "Diameter (mm)", 'filament_diameter', '2.98', 'Diameter of your filament, as accurately as possible.\nIf you cannot measure this value you will have to callibrate it, a higher number means less extrusion, a smaller number generates more extrusion.')
validators.validFloat(c, 1.0)
self.popup.sizer.Add(self.popup.text, flag=wx.EXPAND|wx.ALL, border=1)
self.popup.SetSizer(self.popup.sizer)
-
+ if self.filename != None:
+ self.preview3d.loadModelFile(self.filename)
+ self.lastPath = os.path.split(self.filename)[0]
+
self.updateProfileToControls()
self.Fit()
dlg.SetWildcard("OBJ, STL files (*.stl;*.obj)|*.stl;*.obj")
if dlg.ShowModal() == wx.ID_OK:
self.filename=dlg.GetPath()
+ putPreference('lastFile', self.filename)
if not(os.path.exists(self.filename)):
return
self.lastPath = os.path.split(self.filename)[0]
self.configName = configName
self.label = wx.StaticText(panel, -1, label)
- self.ctrl = wx.TextCtrl(panel, -1, settings.getSetting(configName, defaultValue))
+ if isinstance(defaultValue, types.StringTypes):
+ self.ctrl = wx.TextCtrl(panel, -1, settings.getSetting(configName, defaultValue))
+ else:
+ self.ctrl = wx.ComboBox(panel, -1, settings.getSetting(configName, defaultValue[0]), choices=defaultValue, style=wx.CB_DROPDOWN|wx.CB_READONLY)
#self.helpButton = wx.Button(panel, -1, "?", style=wx.BU_EXACTFIT)
#self.helpButton.SetToolTip(wx.ToolTip(help))
return validators.SUCCESS, ''
except ValueError:
return validators.SUCCESS, ''
+
+def getPreferencePath():
+ return os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../preferences.ini"))
+
+def getPreference(name, default):
+ if not globals().has_key('globalPreferenceParser'):
+ globalPreferenceParser = ConfigParser.ConfigParser()
+ globalPreferenceParser.read(getPreferencePath())
+ if not globalPreferenceParser.has_option('preference', name):
+ if not globalPreferenceParser.has_section('preference'):
+ globalPreferenceParser.add_section('preference')
+ globalPreferenceParser.set('preference', name, str(default))
+ print name + " not found in profile, so using default"
+ return default
+ return globalPreferenceParser.get('preference', name)
+
+def putPreference(name, value):
+ #Check if we have a configuration file loaded, else load the default.
+ if not globals().has_key('globalPreferenceParser'):
+ globalPreferenceParser = ConfigParser.ConfigParser()
+ globalPreferenceParser.read(getPreferencePath())
+ if not globalPreferenceParser.has_section('preference'):
+ globalPreferenceParser.add_section('preference')
+ globalPreferenceParser.set('preference', name, str(value))
+ globalPreferenceParser.write(open(getPreferencePath(), 'w'))
def DoModelLoad(self):\r
self.modelDirty = False\r
self.triangleMesh = fabmetheus_interpret.getCarving(self.modelFilename)\r
+ self.pathList = None\r
self.moveModel()\r
self.glCanvas.Refresh()\r
\r
currentPath = {'type': 'move', 'list': [pos.copy()]}\r
scale = 1.0\r
posAbs = True\r
+ pathType = 'CUSTOM';\r
for line in f:\r
+ if line.startswith(';TYPE:'):\r
+ pathType = line[6:].strip()\r
G = self.getCodeInt(line, 'G')\r
if G is not None:\r
if G == 0 or G == 1: #Move\r
currentE = e\r
if currentPath['type'] != type:\r
pathList.append(currentPath)\r
- currentPath = {'type': type, 'list': [currentPath['list'][-1]]}\r
+ currentPath = {'type': type, 'pathType': pathType, 'list': [currentPath['list'][-1]]}\r
currentPath['list'].append(newPoint)\r
elif G == 20: #Units are inches\r
scale = 25.4\r
posOffset.z = pos.z + z\r
else:\r
print "Unknown G code:" + str(G)\r
+ self.modelDirty = False\r
self.pathList = pathList\r
self.triangleMesh = None\r
+ self.modelDirty = True\r
self.glCanvas.Refresh()\r
\r
def OnConfigClick(self, e):\r
glEnd()\r
\r
if self.parent.pathList != None:\r
- for path in self.parent.pathList:\r
- if path['type'] == 'move':\r
- glColor3f(0,0,1)\r
- if path['type'] == 'extrude':\r
- glColor3f(1,0,0)\r
- if path['type'] == 'retract':\r
- glColor3f(0,1,0)\r
- glBegin(GL_LINE_STRIP)\r
- for v in path['list']:\r
- glVertex3f(v.x, v.y, v.z)\r
- glEnd()\r
+ if self.modelDisplayList == None:\r
+ self.modelDisplayList = glGenLists(1);\r
+ if self.parent.modelDirty:\r
+ self.parent.modelDirty = False\r
+ glNewList(self.modelDisplayList, GL_COMPILE)\r
+ for path in self.parent.pathList:\r
+ if path['type'] == 'move':\r
+ glColor3f(0,0,1)\r
+ if path['type'] == 'extrude':\r
+ if path['pathType'] == 'FILL':\r
+ glColor3f(0.5,0.5,0)\r
+ elif path['pathType'] == 'WALL-INNER':\r
+ glColor3f(0,1,0)\r
+ else:\r
+ glColor3f(1,0,0)\r
+ if path['type'] == 'retract':\r
+ glColor3f(0,1,1)\r
+ glBegin(GL_LINE_STRIP)\r
+ for v in path['list']:\r
+ glVertex3f(v.x, v.y, v.z)\r
+ glEnd()\r
+ glEndList()\r
+ glCallList(self.modelDisplayList)\r
\r
if self.parent.triangleMesh != None:\r
if self.modelDisplayList == None:\r
def parseLine(self, line):
"Parse a gcode line."
+ if len(line) < 1:
+ return
+ if line[0] == '(':
+ self.parseComment(line)
+ return
splitLine = getSplitLineBeforeBracketSemicolon(line)
if len(splitLine) < 1:
return
self.lastFeedRateString = feedRateString
self.lastZString = zString
self.output.write('\n')
+
+ def parseComment(self, line):
+ if line.startswith('(<skirt>'):
+ self.output.write(';TYPE:SKIRT\n');
+ elif line.startswith('(<edge>'):
+ self.output.write(';TYPE:WALL-OUTER\n');
+ elif line.startswith('(<loop>'):
+ self.output.write(';TYPE:WALL-INNER\n');
+ elif line.startswith('(<infill>'):
+ self.output.write(';TYPE:FILL\n');
+ elif line.startswith('(<alteration>'):
+ self.output.write(';TYPE:CUSTOM\n');