mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-04 17:40:35 +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")
|
||||
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.')
|
||||
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.')
|
||||
validators.validFloat(c, 0.0001)
|
||||
|
||||
main.Fit()
|
||||
self.Fit()
|
||||
|
@ -138,6 +138,7 @@ class projectPlanner(wx.Frame):
|
||||
|
||||
self.list = []
|
||||
self.selection = None
|
||||
self.printMode = 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)
|
||||
@ -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.OnSaveCombinedSTL, 'save-combination.png', 'Save all the combined STL files into a single STL file as a plate.')
|
||||
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')
|
||||
|
||||
self.toolbar.Realize()
|
||||
@ -273,17 +278,26 @@ class projectPlanner(wx.Frame):
|
||||
self.preview.Refresh()
|
||||
dlg.Destroy()
|
||||
|
||||
def OnPrintTypeChange(self):
|
||||
self.printMode = 0
|
||||
if self.printAllAtOnce.GetValue():
|
||||
self.printMode = 1
|
||||
self.preview.Refresh()
|
||||
|
||||
def OnSaveCombinedSTL(self, e):
|
||||
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")
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
self._saveCombinedSTL(dlg.GetPath())
|
||||
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, dlg.GetPath())
|
||||
dlg.Destroy()
|
||||
stl.saveAsSTL(output, filename)
|
||||
|
||||
def OnSaveProject(self, e):
|
||||
dlg=wx.FileDialog(self, "Save project file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
|
||||
@ -486,6 +500,10 @@ class projectPlanner(wx.Frame):
|
||||
extraSizeMin = extraSizeMin + 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:
|
||||
posX = self.machineSize.x
|
||||
dirX = -1
|
||||
@ -529,14 +547,21 @@ class projectPlanner(wx.Frame):
|
||||
return (maxX - minX) + (maxY - minY)
|
||||
|
||||
def OnSlice(self, e):
|
||||
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")
|
||||
if dlg.ShowModal() != wx.ID_OK:
|
||||
dlg.Destroy()
|
||||
return
|
||||
resultFilename = dlg.GetPath()
|
||||
dlg.Destroy()
|
||||
|
||||
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')
|
||||
if self.printMode == 0:
|
||||
put('enable_raft', 'False')
|
||||
|
||||
clearZ = 0
|
||||
actionList = []
|
||||
@ -572,17 +597,31 @@ class projectPlanner(wx.Frame):
|
||||
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()
|
||||
|
||||
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")
|
||||
if dlg.ShowModal() != wx.ID_OK:
|
||||
dlg.Destroy()
|
||||
return
|
||||
resultFilename = dlg.GetPath()
|
||||
dlg.Destroy()
|
||||
|
||||
pspw = ProjectSliceProgressWindow(actionList, resultFilename)
|
||||
pspw.extruderOffset = self.extruderOffset
|
||||
pspw.Centre()
|
||||
@ -716,6 +755,13 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||
skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
|
||||
extraSizeMin = extraSizeMin + 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:
|
||||
item.validPlacement = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user