mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-04 19:40:41 +08:00
Add support to slice as 1 large object with the project planner. Fixed #98
This commit is contained in:
parent
79300f3357
commit
0a151cefcf
@ -68,7 +68,9 @@ class expertConfigWindow(configBase.configWindowBase):
|
|||||||
configBase.TitleRow(right, "Dwindle")
|
configBase.TitleRow(right, "Dwindle")
|
||||||
c = configBase.SettingRow(right, "Enable dwindle", 'enable_dwindle', False, 'Dwindle is used to slow down near the end of a printed line, and reducing the amount of filament printed near the end. This to release the preasure on the printer head.')
|
c = configBase.SettingRow(right, "Enable dwindle", 'enable_dwindle', False, 'Dwindle is used to slow down near the end of a printed line, and reducing the amount of filament printed near the end. This to release the preasure on the printer head.')
|
||||||
c = configBase.SettingRow(right, "Pent up volume (mm3)", 'dwindle_pent_up_volume', '0.4', 'Amount of plastic inside the nozzle under pressure. This normally comes out as ooze after printing.')
|
c = configBase.SettingRow(right, "Pent up volume (mm3)", 'dwindle_pent_up_volume', '0.4', 'Amount of plastic inside the nozzle under pressure. This normally comes out as ooze after printing.')
|
||||||
|
validators.validFloat(c, 0.0001)
|
||||||
c = configBase.SettingRow(right, "Slow down volume (mm3)", 'dwindle_slowdown_volume', '5.0', 'Amount of printing volume that is used to slow down to release the pressure.')
|
c = configBase.SettingRow(right, "Slow down volume (mm3)", 'dwindle_slowdown_volume', '5.0', 'Amount of printing volume that is used to slow down to release the pressure.')
|
||||||
|
validators.validFloat(c, 0.0001)
|
||||||
|
|
||||||
main.Fit()
|
main.Fit()
|
||||||
self.Fit()
|
self.Fit()
|
||||||
|
@ -138,6 +138,7 @@ class projectPlanner(wx.Frame):
|
|||||||
|
|
||||||
self.list = []
|
self.list = []
|
||||||
self.selection = None
|
self.selection = None
|
||||||
|
self.printMode = 0
|
||||||
|
|
||||||
self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height'))
|
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.headSizeMin = util3d.Vector3(profile.getPreferenceFloat('extruder_head_size_min_x'), profile.getPreferenceFloat('extruder_head_size_min_y'),0)
|
||||||
@ -163,6 +164,10 @@ class projectPlanner(wx.Frame):
|
|||||||
toolbarUtil.NormalButton(self.toolbar, self.OnCutMesh, 'cut-mesh.png', 'Cut a plate STL into multiple STL files, and add those files to the project.\nNote: Splitting up plates sometimes takes a few minutes.')
|
toolbarUtil.NormalButton(self.toolbar, self.OnCutMesh, 'cut-mesh.png', 'Cut a plate STL into multiple STL files, and add those files to the project.\nNote: Splitting up plates sometimes takes a few minutes.')
|
||||||
toolbarUtil.NormalButton(self.toolbar, self.OnSaveCombinedSTL, 'save-combination.png', 'Save all the combined STL files into a single STL file as a plate.')
|
toolbarUtil.NormalButton(self.toolbar, self.OnSaveCombinedSTL, 'save-combination.png', 'Save all the combined STL files into a single STL file as a plate.')
|
||||||
self.toolbar.AddSeparator()
|
self.toolbar.AddSeparator()
|
||||||
|
group = []
|
||||||
|
self.printOneAtATime = toolbarUtil.RadioButton(self.toolbar, group, 'view-normal-on.png', 'view-normal-off.png', 'Print one object at a time', callback=self.OnPrintTypeChange)
|
||||||
|
self.printAllAtOnce = toolbarUtil.RadioButton(self.toolbar, group, 'all-at-once-on.png', 'all-at-once-off.png', 'Print all the objects at once', callback=self.OnPrintTypeChange)
|
||||||
|
self.toolbar.AddSeparator()
|
||||||
toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner')
|
toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner')
|
||||||
|
|
||||||
self.toolbar.Realize()
|
self.toolbar.Realize()
|
||||||
@ -273,18 +278,27 @@ class projectPlanner(wx.Frame):
|
|||||||
self.preview.Refresh()
|
self.preview.Refresh()
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
|
def OnPrintTypeChange(self):
|
||||||
|
self.printMode = 0
|
||||||
|
if self.printAllAtOnce.GetValue():
|
||||||
|
self.printMode = 1
|
||||||
|
self.preview.Refresh()
|
||||||
|
|
||||||
def OnSaveCombinedSTL(self, e):
|
def OnSaveCombinedSTL(self, e):
|
||||||
dlg=wx.FileDialog(self, "Save as STL", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
|
dlg=wx.FileDialog(self, "Save as STL", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
|
||||||
dlg.SetWildcard("STL files (*.stl)|*.stl;*.STL")
|
dlg.SetWildcard("STL files (*.stl)|*.stl;*.STL")
|
||||||
if dlg.ShowModal() == wx.ID_OK:
|
if dlg.ShowModal() == wx.ID_OK:
|
||||||
output = mesh.mesh()
|
self._saveCombinedSTL(dlg.GetPath())
|
||||||
for item in self.list:
|
|
||||||
offset = util3d.Vector3(item.centerX, item.centerY, 0)
|
|
||||||
for f in item.faces:
|
|
||||||
output.addFace(f.v[0] * item.scale + offset, f.v[1] * item.scale + offset, f.v[2] * item.scale + offset)
|
|
||||||
stl.saveAsSTL(output, dlg.GetPath())
|
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
|
def _saveCombinedSTL(filename):
|
||||||
|
output = mesh.mesh()
|
||||||
|
for item in self.list:
|
||||||
|
offset = util3d.Vector3(item.centerX, item.centerY, 0)
|
||||||
|
for f in item.faces:
|
||||||
|
output.addFace(f.v[0] * item.scale + offset, f.v[1] * item.scale + offset, f.v[2] * item.scale + offset)
|
||||||
|
stl.saveAsSTL(output, filename)
|
||||||
|
|
||||||
def OnSaveProject(self, e):
|
def OnSaveProject(self, e):
|
||||||
dlg=wx.FileDialog(self, "Save project file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
|
dlg=wx.FileDialog(self, "Save project file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
|
||||||
dlg.SetWildcard("Project files (*.curaproject)|*.curaproject")
|
dlg.SetWildcard("Project files (*.curaproject)|*.curaproject")
|
||||||
@ -485,6 +499,10 @@ class projectPlanner(wx.Frame):
|
|||||||
if profile.getProfileSetting('support') != 'None':
|
if profile.getProfileSetting('support') != 'None':
|
||||||
extraSizeMin = extraSizeMin + util3d.Vector3(3.0, 0, 0)
|
extraSizeMin = extraSizeMin + util3d.Vector3(3.0, 0, 0)
|
||||||
extraSizeMax = extraSizeMax + util3d.Vector3(3.0, 0, 0)
|
extraSizeMax = extraSizeMax + util3d.Vector3(3.0, 0, 0)
|
||||||
|
|
||||||
|
if self.printMode == 1:
|
||||||
|
extraSizeMin = util3d.Vector3(6.0, 6.0, 0)
|
||||||
|
extraSizeMax = util3d.Vector3(6.0, 6.0, 0)
|
||||||
|
|
||||||
if extraSizeMin.x > extraSizeMax.x:
|
if extraSizeMin.x > extraSizeMax.x:
|
||||||
posX = self.machineSize.x
|
posX = self.machineSize.x
|
||||||
@ -529,52 +547,6 @@ class projectPlanner(wx.Frame):
|
|||||||
return (maxX - minX) + (maxY - minY)
|
return (maxX - minX) + (maxY - minY)
|
||||||
|
|
||||||
def OnSlice(self, e):
|
def OnSlice(self, e):
|
||||||
put = profile.setTempOverride
|
|
||||||
oldProfile = profile.getGlobalProfileString()
|
|
||||||
|
|
||||||
put('model_multiply_x', '1')
|
|
||||||
put('model_multiply_y', '1')
|
|
||||||
put('enable_raft', 'False')
|
|
||||||
put('add_start_end_gcode', 'False')
|
|
||||||
put('gcode_extension', 'project_tmp')
|
|
||||||
|
|
||||||
clearZ = 0
|
|
||||||
actionList = []
|
|
||||||
for item in self.list:
|
|
||||||
if item.profile != None and os.path.isfile(item.profile):
|
|
||||||
profile.loadGlobalProfile(item.profile)
|
|
||||||
put('machine_center_x', item.centerX - self.extruderOffset[item.extruder].x)
|
|
||||||
put('machine_center_y', item.centerY - self.extruderOffset[item.extruder].y)
|
|
||||||
put('model_scale', item.scale)
|
|
||||||
put('flip_x', item.flipX)
|
|
||||||
put('flip_y', item.flipY)
|
|
||||||
put('flip_z', item.flipZ)
|
|
||||||
put('model_rotate_base', item.rotate)
|
|
||||||
put('swap_xz', item.swapXZ)
|
|
||||||
put('swap_yz', item.swapYZ)
|
|
||||||
|
|
||||||
action = Action()
|
|
||||||
action.sliceCmd = sliceRun.getSliceCommand(item.filename)
|
|
||||||
action.centerX = item.centerX
|
|
||||||
action.centerY = item.centerY
|
|
||||||
action.extruder = item.extruder
|
|
||||||
action.filename = item.filename
|
|
||||||
clearZ = max(clearZ, item.getMaximum().z * item.scale + 5.0)
|
|
||||||
action.clearZ = clearZ
|
|
||||||
action.leaveResultForNextSlice = False
|
|
||||||
action.usePreviousSlice = False
|
|
||||||
actionList.append(action)
|
|
||||||
|
|
||||||
if self.list.index(item) > 0 and item.isSameExceptForPosition(self.list[self.list.index(item)-1]):
|
|
||||||
actionList[-2].leaveResultForNextSlice = True
|
|
||||||
actionList[-1].usePreviousSlice = True
|
|
||||||
|
|
||||||
if item.profile != None:
|
|
||||||
profile.loadGlobalProfileFromString(oldProfile)
|
|
||||||
|
|
||||||
#Restore the old profile.
|
|
||||||
profile.resetTempOverride()
|
|
||||||
|
|
||||||
dlg=wx.FileDialog(self, "Save project gcode file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
|
dlg=wx.FileDialog(self, "Save project gcode file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
|
||||||
dlg.SetWildcard("GCode file (*.gcode)|*.gcode")
|
dlg.SetWildcard("GCode file (*.gcode)|*.gcode")
|
||||||
if dlg.ShowModal() != wx.ID_OK:
|
if dlg.ShowModal() != wx.ID_OK:
|
||||||
@ -582,6 +554,73 @@ class projectPlanner(wx.Frame):
|
|||||||
return
|
return
|
||||||
resultFilename = dlg.GetPath()
|
resultFilename = dlg.GetPath()
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
|
put = profile.setTempOverride
|
||||||
|
oldProfile = profile.getGlobalProfileString()
|
||||||
|
|
||||||
|
put('add_start_end_gcode', 'False')
|
||||||
|
put('gcode_extension', 'project_tmp')
|
||||||
|
if self.printMode == 0:
|
||||||
|
put('enable_raft', 'False')
|
||||||
|
|
||||||
|
clearZ = 0
|
||||||
|
actionList = []
|
||||||
|
for item in self.list:
|
||||||
|
if item.profile != None and os.path.isfile(item.profile):
|
||||||
|
profile.loadGlobalProfile(item.profile)
|
||||||
|
put('machine_center_x', item.centerX - self.extruderOffset[item.extruder].x)
|
||||||
|
put('machine_center_y', item.centerY - self.extruderOffset[item.extruder].y)
|
||||||
|
put('model_scale', item.scale)
|
||||||
|
put('flip_x', item.flipX)
|
||||||
|
put('flip_y', item.flipY)
|
||||||
|
put('flip_z', item.flipZ)
|
||||||
|
put('model_rotate_base', item.rotate)
|
||||||
|
put('swap_xz', item.swapXZ)
|
||||||
|
put('swap_yz', item.swapYZ)
|
||||||
|
|
||||||
|
action = Action()
|
||||||
|
action.sliceCmd = sliceRun.getSliceCommand(item.filename)
|
||||||
|
action.centerX = item.centerX
|
||||||
|
action.centerY = item.centerY
|
||||||
|
action.extruder = item.extruder
|
||||||
|
action.filename = item.filename
|
||||||
|
clearZ = max(clearZ, item.getMaximum().z * item.scale + 5.0)
|
||||||
|
action.clearZ = clearZ
|
||||||
|
action.leaveResultForNextSlice = False
|
||||||
|
action.usePreviousSlice = False
|
||||||
|
actionList.append(action)
|
||||||
|
|
||||||
|
if self.list.index(item) > 0 and item.isSameExceptForPosition(self.list[self.list.index(item)-1]):
|
||||||
|
actionList[-2].leaveResultForNextSlice = True
|
||||||
|
actionList[-1].usePreviousSlice = True
|
||||||
|
|
||||||
|
if item.profile != None:
|
||||||
|
profile.loadGlobalProfileFromString(oldProfile)
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._saveCombinedSTL(resultFilename + "_temp_.stl")
|
||||||
|
put('model_scale', 1.0)
|
||||||
|
put('flip_x', False)
|
||||||
|
put('flip_y', False)
|
||||||
|
put('flip_z', False)
|
||||||
|
put('model_rotate_base', 0)
|
||||||
|
put('swap_xz', False)
|
||||||
|
put('swap_yz', False)
|
||||||
|
actionList = []
|
||||||
|
|
||||||
|
action = Action()
|
||||||
|
action.sliceCmd = sliceRun.getSliceCommand(resultFilename + "_temp_.stl")
|
||||||
|
action.centerX = profile.getProfileSettingFloat('machine_center_x')
|
||||||
|
action.centerY = profile.getProfileSettingFloat('machine_center_y')
|
||||||
|
action.extruder = 0
|
||||||
|
action.filename = resultFilename + "_temp_.stl"
|
||||||
|
action.clearZ = 0
|
||||||
|
action.leaveResultForNextSlice = False
|
||||||
|
action.usePreviousSlice = False
|
||||||
|
actionList.append(action)
|
||||||
|
|
||||||
|
#Restore the old profile.
|
||||||
|
profile.resetTempOverride()
|
||||||
|
|
||||||
pspw = ProjectSliceProgressWindow(actionList, resultFilename)
|
pspw = ProjectSliceProgressWindow(actionList, resultFilename)
|
||||||
pspw.extruderOffset = self.extruderOffset
|
pspw.extruderOffset = self.extruderOffset
|
||||||
@ -716,6 +755,13 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
|||||||
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)
|
||||||
|
if profile.getProfileSetting('support') != 'None':
|
||||||
|
extraSizeMin = extraSizeMin + util3d.Vector3(3.0, 0, 0)
|
||||||
|
extraSizeMax = extraSizeMax + util3d.Vector3(3.0, 0, 0)
|
||||||
|
|
||||||
|
if self.parent.printMode == 1:
|
||||||
|
extraSizeMin = util3d.Vector3(6.0, 6.0, 0)
|
||||||
|
extraSizeMax = util3d.Vector3(6.0, 6.0, 0)
|
||||||
|
|
||||||
for item in self.parent.list:
|
for item in self.parent.list:
|
||||||
item.validPlacement = True
|
item.validPlacement = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user