Merge branch 'master' of github.com:daid/Cura

master
Daid 2012-05-01 18:40:18 +02:00
commit b9d4c9b5fa
6 changed files with 26 additions and 17 deletions

View File

@ -223,6 +223,8 @@ class CoolSkein:
def addCoolTemperature(self, remainingOrbitTime):
'Parse a gcode line and add it to the cool skein.'
if self.repository.minimumLayerTime.value < 0.0001:
return
layerCool = self.repository.maximumCool.value * remainingOrbitTime / self.repository.minimumLayerTime.value
if self.isBridgeLayer:
layerCool = max(self.repository.bridgeCool.value, layerCool)

View File

@ -47,7 +47,7 @@ class previewPanel(wx.Panel):
self.objectsMinV = None
self.objectsMaxV = None
self.loadThread = None
self.machineSize = util3d.Vector3(float(profile.getPreference('machine_width')), float(profile.getPreference('machine_depth')), float(profile.getPreference('machine_height')))
self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height'))
self.machineCenter = util3d.Vector3(float(profile.getProfileSetting('machine_center_x')), float(profile.getProfileSetting('machine_center_y')), 0)
self.toolbar = toolbarUtil.Toolbar(self)

View File

@ -39,15 +39,15 @@ class projectPlanner(wx.Frame):
self.list = []
self.selection = None
self.machineSize = util3d.Vector3(float(profile.getPreference('machine_width')), float(profile.getPreference('machine_depth')), float(profile.getPreference('machine_height')))
self.headSizeMin = util3d.Vector3(float(profile.getPreference('extruder_head_size_min_x')), float(profile.getPreference('extruder_head_size_min_y')),0)
self.headSizeMax = util3d.Vector3(float(profile.getPreference('extruder_head_size_max_x')), float(profile.getPreference('extruder_head_size_max_y')),0)
self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height'))
self.headSizeMin = util3d.Vector3(profile.getPreferenceFloat('extruder_head_size_min_x'), profile.getPreferenceFloat('extruder_head_size_min_y'),0)
self.headSizeMax = util3d.Vector3(profile.getPreferenceFloat('extruder_head_size_max_x'), profile.getPreferenceFloat('extruder_head_size_max_y'),0)
self.extruderOffset = [
util3d.Vector3(0,0,0),
util3d.Vector3(float(profile.getPreference('extruder_offset_x1')), float(profile.getPreference('extruder_offset_y1')), 0),
util3d.Vector3(float(profile.getPreference('extruder_offset_x2')), float(profile.getPreference('extruder_offset_y2')), 0),
util3d.Vector3(float(profile.getPreference('extruder_offset_x3')), float(profile.getPreference('extruder_offset_y3')), 0)]
util3d.Vector3(profile.getPreferenceFloat('extruder_offset_x1'), profile.getPreferenceFloat('extruder_offset_y1'), 0),
util3d.Vector3(profile.getPreferenceFloat('extruder_offset_x2'), profile.getPreferenceFloat('extruder_offset_y2'), 0),
util3d.Vector3(profile.getPreferenceFloat('extruder_offset_x3'), profile.getPreferenceFloat('extruder_offset_y3'), 0)]
self.toolbar = toolbarUtil.Toolbar(self)

View File

@ -66,8 +66,8 @@ class sliceProgessPanel(wx.Panel):
if idx > 0:
profile.putProfileSetting('fan_enabled', 'False')
profile.putProfileSetting('skirt_line_count', '0')
profile.putProfileSetting('machine_center_x', profile.getProfileSettingFloat('machine_center_x') - float(profile.getPreference('extruder_offset_x%d' % (idx))))
profile.putProfileSetting('machine_center_y', profile.getProfileSettingFloat('machine_center_y') - float(profile.getPreference('extruder_offset_y%d' % (idx))))
profile.putProfileSetting('machine_center_x', profile.getProfileSettingFloat('machine_center_x') - profile.getPreferenceFloat('extruder_offset_x%d' % (idx)))
profile.putProfileSetting('machine_center_y', profile.getProfileSettingFloat('machine_center_y') - profile.getPreferenceFloat('extruder_offset_y%d' % (idx)))
profile.putProfileSetting('alternative_center', self.filelist[0])
if len(self.filelist) > 1:
profile.putProfileSetting('add_start_end_gcode', 'False')

View File

@ -36,11 +36,11 @@ class gcode():
#Calculates the weight of the filament in kg
radius = float(profile.getProfileSetting('filament_diameter')) / 2
volumeM3 = (self.extrusionAmount * (math.pi * radius * radius)) / (1000*1000*1000)
return volumeM3 * float(profile.getPreference('filament_density'))
return volumeM3 * profile.getPreferenceFloat('filament_density')
def calculateCost(self):
cost_kg = float(profile.getPreference('filament_cost_kg'))
cost_meter = float(profile.getPreference('filament_cost_meter'))
cost_kg = profile.getPreferenceFloat('filament_cost_kg')
cost_meter = profile.getPreferenceFloat('filament_cost_meter')
if cost_kg > 0.0 and cost_meter > 0.0:
return "%.2f / %.2f" % (self.calculateWeight() * cost_kg, self.extrusionAmount / 1000 * cost_meter)
elif cost_kg > 0.0:
@ -94,12 +94,12 @@ class gcode():
T = self.getCodeInt(line, 'T')
if T is not None:
if currentExtruder > 0:
posOffset.x -= float(profile.getPreference('extruder_offset_x%d' % (currentExtruder)))
posOffset.y -= float(profile.getPreference('extruder_offset_y%d' % (currentExtruder)))
posOffset.x -= profile.getPreferenceFloat('extruder_offset_x%d' % (currentExtruder))
posOffset.y -= profile.getPreferenceFloat('extruder_offset_y%d' % (currentExtruder))
currentExtruder = T
if currentExtruder > 0:
posOffset.x += float(profile.getPreference('extruder_offset_x%d' % (currentExtruder)))
posOffset.y += float(profile.getPreference('extruder_offset_y%d' % (currentExtruder)))
posOffset.x += profile.getPreferenceFloat('extruder_offset_x%d' % (currentExtruder))
posOffset.y += profile.getPreferenceFloat('extruder_offset_y%d' % (currentExtruder))
G = self.getCodeInt(line, 'G')
if G is not None:

View File

@ -236,6 +236,13 @@ globalPreferenceParser = None
def getPreferencePath():
return os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../preferences.ini"))
def getPreferenceFloat(name):
try:
return float(eval(getPreference(name), {}, {}))
except (ValueError, SyntaxError):
return 0.0
def getPreference(name):
global globalPreferenceParser
if globalPreferenceParser == None:
@ -346,7 +353,7 @@ def getAlterationFileContents(filename):
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(getPreference('steps_per_e'))
eSteps = getPreferenceFloat('steps_per_e')
if eSteps > 0:
prefix += 'M92 E%f\n' % (eSteps)
temp = getProfileSettingFloat('print_temperature')