Added extruder selection to project planner, fixed bug with project planner where the skirt was incorrectly added to the movement size
parent
b28b7adef5
commit
a1b4a50342
|
@ -43,6 +43,8 @@ class projectPlanner(wx.Frame):
|
||||||
self.headSizeMin = util3d.Vector3(70,18,0)
|
self.headSizeMin = util3d.Vector3(70,18,0)
|
||||||
self.headSizeMax = util3d.Vector3(18,35,0)
|
self.headSizeMax = util3d.Vector3(18,35,0)
|
||||||
|
|
||||||
|
self.extruderOffset = [util3d.Vector3(0,0,0), util3d.Vector3(-22,0,0), util3d.Vector3(0,0,0), util3d.Vector3(0,0,0)]
|
||||||
|
|
||||||
self.toolbar = toolbarUtil.Toolbar(self)
|
self.toolbar = toolbarUtil.Toolbar(self)
|
||||||
|
|
||||||
toolbarUtil.NormalButton(self.toolbar, self.OnLoadProject, 'open.png', 'Open project')
|
toolbarUtil.NormalButton(self.toolbar, self.OnLoadProject, 'open.png', 'Open project')
|
||||||
|
@ -96,6 +98,12 @@ class projectPlanner(wx.Frame):
|
||||||
sizer.Add(wx.StaticText(panel, -1, 'Rotate'), (1,0), flag=wx.ALIGN_CENTER_VERTICAL)
|
sizer.Add(wx.StaticText(panel, -1, 'Rotate'), (1,0), flag=wx.ALIGN_CENTER_VERTICAL)
|
||||||
sizer.Add(self.rotateCtrl, (1,1), flag=wx.ALIGN_BOTTOM|wx.EXPAND)
|
sizer.Add(self.rotateCtrl, (1,1), flag=wx.ALIGN_BOTTOM|wx.EXPAND)
|
||||||
|
|
||||||
|
if int(profile.getPreference('extruder_amount')) > 1:
|
||||||
|
self.extruderCtrl = wx.ComboBox(panel, -1, '1', choices=map(str, range(1, int(profile.getPreference('extruder_amount'))+1)), style=wx.CB_DROPDOWN|wx.CB_READONLY)
|
||||||
|
sizer.Add(wx.StaticText(panel, -1, 'Extruder'), (2,0), flag=wx.ALIGN_CENTER_VERTICAL)
|
||||||
|
sizer.Add(self.extruderCtrl, (2,1), flag=wx.ALIGN_BOTTOM|wx.EXPAND)
|
||||||
|
self.extruderCtrl.Bind(wx.EVT_COMBOBOX, self.OnExtruderChange)
|
||||||
|
|
||||||
self.scaleCtrl.Bind(wx.EVT_TEXT, self.OnScaleChange)
|
self.scaleCtrl.Bind(wx.EVT_TEXT, self.OnScaleChange)
|
||||||
self.rotateCtrl.Bind(wx.EVT_SPINCTRL, self.OnRotateChange)
|
self.rotateCtrl.Bind(wx.EVT_SPINCTRL, self.OnRotateChange)
|
||||||
|
|
||||||
|
@ -126,6 +134,7 @@ class projectPlanner(wx.Frame):
|
||||||
cp.set(section, 'flipZ', str(item.flipZ))
|
cp.set(section, 'flipZ', str(item.flipZ))
|
||||||
cp.set(section, 'swapXZ', str(item.swapXZ))
|
cp.set(section, 'swapXZ', str(item.swapXZ))
|
||||||
cp.set(section, 'swapYZ', str(item.swapYZ))
|
cp.set(section, 'swapYZ', str(item.swapYZ))
|
||||||
|
cp.set(section, 'extruder', str(item.extruder+1))
|
||||||
i += 1
|
i += 1
|
||||||
cp.write(open(dlg.GetPath(), "w"))
|
cp.write(open(dlg.GetPath(), "w"))
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
@ -149,11 +158,12 @@ class projectPlanner(wx.Frame):
|
||||||
item.centerY = float(cp.get(section, 'centerY'))
|
item.centerY = float(cp.get(section, 'centerY'))
|
||||||
item.scale = float(cp.get(section, 'scale'))
|
item.scale = float(cp.get(section, 'scale'))
|
||||||
item.rotate = float(cp.get(section, 'rotate'))
|
item.rotate = float(cp.get(section, 'rotate'))
|
||||||
cp.get(section, 'flipX')
|
item.flipX = cp.get(section, 'flipX') == 'True'
|
||||||
cp.get(section, 'flipY')
|
item.flipY = cp.get(section, 'flipY') == 'True'
|
||||||
cp.get(section, 'flipZ')
|
item.flipZ = cp.get(section, 'flipZ') == 'True'
|
||||||
cp.get(section, 'swapXZ')
|
item.swapXZ = cp.get(section, 'swapXZ') == 'True'
|
||||||
cp.get(section, 'swapYZ')
|
item.swapYZ = cp.get(section, 'swapYZ') == 'True'
|
||||||
|
item.extuder = int(cp.get(section, 'extruder'))-1
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
self.list.append(item)
|
self.list.append(item)
|
||||||
|
@ -184,6 +194,8 @@ class projectPlanner(wx.Frame):
|
||||||
self.selection = self.list[self.listbox.GetSelection()]
|
self.selection = self.list[self.listbox.GetSelection()]
|
||||||
self.scaleCtrl.SetValue(str(self.selection.scale))
|
self.scaleCtrl.SetValue(str(self.selection.scale))
|
||||||
self.rotateCtrl.SetValue(int(self.selection.rotate))
|
self.rotateCtrl.SetValue(int(self.selection.rotate))
|
||||||
|
if int(profile.getPreference('extruder_amount')) > 1:
|
||||||
|
self.extruderCtrl.SetValue(str(self.selection.extruder+1))
|
||||||
self.preview.Refresh()
|
self.preview.Refresh()
|
||||||
|
|
||||||
def OnAddModel(self, e):
|
def OnAddModel(self, e):
|
||||||
|
@ -233,7 +245,7 @@ class projectPlanner(wx.Frame):
|
||||||
extraSizeMax = self.headSizeMax
|
extraSizeMax = self.headSizeMax
|
||||||
if profile.getProfileSettingFloat('skirt_line_count') > 0:
|
if profile.getProfileSettingFloat('skirt_line_count') > 0:
|
||||||
skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
|
skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
|
||||||
extraSizeMin = extraSizeMin - util3d.Vector3(skirtSize, skirtSize, 0)
|
extraSizeMin = extraSizeMin + util3d.Vector3(skirtSize, skirtSize, 0)
|
||||||
extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0)
|
extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0)
|
||||||
|
|
||||||
posX = self.machineSize.x
|
posX = self.machineSize.x
|
||||||
|
@ -281,8 +293,8 @@ class projectPlanner(wx.Frame):
|
||||||
clearZ = 0
|
clearZ = 0
|
||||||
actionList = []
|
actionList = []
|
||||||
for item in self.list:
|
for item in self.list:
|
||||||
put('machine_center_x', item.centerX)
|
put('machine_center_x', item.centerX - self.extruderOffset[item.extruder].x)
|
||||||
put('machine_center_y', item.centerY)
|
put('machine_center_y', item.centerY - self.extruderOffset[item.extruder].y)
|
||||||
put('model_scale', item.scale)
|
put('model_scale', item.scale)
|
||||||
put('flip_x', item.flipX)
|
put('flip_x', item.flipX)
|
||||||
put('flip_y', item.flipY)
|
put('flip_y', item.flipY)
|
||||||
|
@ -295,6 +307,7 @@ class projectPlanner(wx.Frame):
|
||||||
action.sliceCmd = sliceRun.getSliceCommand(item.filename)
|
action.sliceCmd = sliceRun.getSliceCommand(item.filename)
|
||||||
action.centerX = item.centerX
|
action.centerX = item.centerX
|
||||||
action.centerY = item.centerY
|
action.centerY = item.centerY
|
||||||
|
action.extruder = item.extruder
|
||||||
action.filename = item.filename
|
action.filename = item.filename
|
||||||
clearZ = max(clearZ, item.getMaximum().z * item.scale)
|
clearZ = max(clearZ, item.getMaximum().z * item.scale)
|
||||||
action.clearZ = clearZ
|
action.clearZ = clearZ
|
||||||
|
@ -312,6 +325,7 @@ class projectPlanner(wx.Frame):
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
pspw = ProjectSliceProgressWindow(actionList, resultFilename)
|
pspw = ProjectSliceProgressWindow(actionList, resultFilename)
|
||||||
|
pspw.extruderOffset = self.extruderOffset
|
||||||
pspw.Centre()
|
pspw.Centre()
|
||||||
pspw.Show(True)
|
pspw.Show(True)
|
||||||
|
|
||||||
|
@ -331,6 +345,7 @@ class projectPlanner(wx.Frame):
|
||||||
item.flipZ = False
|
item.flipZ = False
|
||||||
item.swapXZ = False
|
item.swapXZ = False
|
||||||
item.swapYZ = False
|
item.swapYZ = False
|
||||||
|
item.extruder = 0
|
||||||
|
|
||||||
item.modelDisplayList = None
|
item.modelDisplayList = None
|
||||||
item.modelDirty = False
|
item.modelDirty = False
|
||||||
|
@ -355,6 +370,12 @@ class projectPlanner(wx.Frame):
|
||||||
self.selection.rotate = float(self.rotateCtrl.GetValue())
|
self.selection.rotate = float(self.rotateCtrl.GetValue())
|
||||||
self.updateModelTransform(self.selection)
|
self.updateModelTransform(self.selection)
|
||||||
|
|
||||||
|
def OnExtruderChange(self, e):
|
||||||
|
if self.selection == None:
|
||||||
|
return
|
||||||
|
self.selection.extruder = int(self.extruderCtrl.GetValue()) - 1
|
||||||
|
self.preview.Refresh()
|
||||||
|
|
||||||
def updateModelTransform(self, item):
|
def updateModelTransform(self, item):
|
||||||
rotate = item.rotate / 180.0 * math.pi
|
rotate = item.rotate / 180.0 * math.pi
|
||||||
scaleX = 1.0
|
scaleX = 1.0
|
||||||
|
@ -508,7 +529,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||||
extraSizeMax = self.parent.headSizeMax
|
extraSizeMax = self.parent.headSizeMax
|
||||||
if profile.getProfileSettingFloat('skirt_line_count') > 0:
|
if profile.getProfileSettingFloat('skirt_line_count') > 0:
|
||||||
skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
|
skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
|
||||||
extraSizeMin = extraSizeMin - util3d.Vector3(skirtSize, skirtSize, 0)
|
extraSizeMin = extraSizeMin + util3d.Vector3(skirtSize, skirtSize, 0)
|
||||||
extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0)
|
extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0)
|
||||||
|
|
||||||
for item in self.parent.list:
|
for item in self.parent.list:
|
||||||
|
@ -517,8 +538,8 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||||
|
|
||||||
for idx1 in xrange(0, len(self.parent.list)):
|
for idx1 in xrange(0, len(self.parent.list)):
|
||||||
item = self.parent.list[idx1]
|
item = self.parent.list[idx1]
|
||||||
iMin1 = item.getMinimum() * item.scale + util3d.Vector3(item.centerX, item.centerY, 0) - extraSizeMin
|
iMin1 = item.getMinimum() * item.scale + util3d.Vector3(item.centerX, item.centerY, 0) - extraSizeMin - self.parent.extruderOffset[item.extruder]
|
||||||
iMax1 = item.getMaximum() * item.scale + util3d.Vector3(item.centerX, item.centerY, 0) + extraSizeMax
|
iMax1 = item.getMaximum() * item.scale + util3d.Vector3(item.centerX, item.centerY, 0) + extraSizeMax - self.parent.extruderOffset[item.extruder]
|
||||||
for idx2 in xrange(0, idx1):
|
for idx2 in xrange(0, idx1):
|
||||||
item2 = self.parent.list[idx2]
|
item2 = self.parent.list[idx2]
|
||||||
iMin2 = item2.getMinimum() * item2.scale + util3d.Vector3(item2.centerX, item2.centerY, 0)
|
iMin2 = item2.getMinimum() * item2.scale + util3d.Vector3(item2.centerX, item2.centerY, 0)
|
||||||
|
@ -566,8 +587,8 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||||
|
|
||||||
vMin = item.getMinimum() * item.scale
|
vMin = item.getMinimum() * item.scale
|
||||||
vMax = item.getMaximum() * item.scale
|
vMax = item.getMaximum() * item.scale
|
||||||
vMinHead = vMin - extraSizeMin
|
vMinHead = vMin - extraSizeMin - self.parent.extruderOffset[item.extruder]
|
||||||
vMaxHead = vMax + extraSizeMax
|
vMaxHead = vMax + extraSizeMax - self.parent.extruderOffset[item.extruder]
|
||||||
|
|
||||||
glDisable(GL_LIGHTING)
|
glDisable(GL_LIGHTING)
|
||||||
|
|
||||||
|
@ -702,12 +723,15 @@ class ProjectSliceProgressWindow(wx.Frame):
|
||||||
self.returnCode = p.wait()
|
self.returnCode = p.wait()
|
||||||
|
|
||||||
oldProfile = profile.getGlobalProfileString()
|
oldProfile = profile.getGlobalProfileString()
|
||||||
put('machine_center_x', action.centerX)
|
put('machine_center_x', action.centerX - self.extruderOffset[action.extruder].x)
|
||||||
put('machine_center_y', action.centerY)
|
put('machine_center_y', action.centerY - self.extruderOffset[action.extruder].y)
|
||||||
put('clear_z', action.clearZ)
|
put('clear_z', action.clearZ)
|
||||||
|
put('extruder', action.extruder)
|
||||||
|
|
||||||
if action == self.actionList[0]:
|
if action == self.actionList[0]:
|
||||||
resultFile.write(';TYPE:CUSTOM\n')
|
resultFile.write(';TYPE:CUSTOM\n')
|
||||||
|
resultFile.write('T%d\n' % (action.extruder))
|
||||||
|
currentExtruder = action.extruder
|
||||||
resultFile.write(profile.getAlterationFileContents('start.gcode'))
|
resultFile.write(profile.getAlterationFileContents('start.gcode'))
|
||||||
else:
|
else:
|
||||||
#reset the extrusion length, and move to the next object center.
|
#reset the extrusion length, and move to the next object center.
|
||||||
|
|
|
@ -64,7 +64,7 @@ class sliceProgessPanel(wx.Panel):
|
||||||
if self.filelist.index(filename) > 0:
|
if self.filelist.index(filename) > 0:
|
||||||
profile.putProfileSetting('fan_enabled', 'False')
|
profile.putProfileSetting('fan_enabled', 'False')
|
||||||
profile.putProfileSetting('skirt_line_count', '0')
|
profile.putProfileSetting('skirt_line_count', '0')
|
||||||
profile.putProfileSetting('machine_center_x', profile.getProfileSettingFloat('machine_center_y') + 22)
|
profile.putProfileSetting('machine_center_x', profile.getProfileSettingFloat('machine_center_x') + 22)
|
||||||
if len(self.filelist) > 1:
|
if len(self.filelist) > 1:
|
||||||
profile.putProfileSetting('add_start_end_gcode', 'False')
|
profile.putProfileSetting('add_start_end_gcode', 'False')
|
||||||
profile.putProfileSetting('gcode_extension', 'multi_extrude_tmp')
|
profile.putProfileSetting('gcode_extension', 'multi_extrude_tmp')
|
||||||
|
|
Loading…
Reference in New Issue