From: Daid Date: Thu, 21 Jun 2012 13:04:42 +0000 (+0200) Subject: Add option to save the collection of STL files as a single STL file in the project... X-Git-Tag: 12.07~36^2~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=79300f3357181315188f2c376249b5d0cf7cbd93;p=cura.git Add option to save the collection of STL files as a single STL file in the project planner. --- diff --git a/Cura/gui/projectPlanner.py b/Cura/gui/projectPlanner.py index 8096129c..5ab1250c 100644 --- a/Cura/gui/projectPlanner.py +++ b/Cura/gui/projectPlanner.py @@ -25,6 +25,7 @@ from gui import printWindow from util import profile from util import util3d from util import stl +from util import mesh from util import sliceRun from util import gcodeInterpreter from util import exporer @@ -160,6 +161,7 @@ class projectPlanner(wx.Frame): toolbarUtil.NormalButton(self.toolbar, self.OnPreferences, 'preferences.png', 'Project planner preferences') self.toolbar.AddSeparator() 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() toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner') @@ -271,6 +273,18 @@ class projectPlanner(wx.Frame): self.preview.Refresh() dlg.Destroy() + 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: + 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() + def OnSaveProject(self, e): dlg=wx.FileDialog(self, "Save project file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE) dlg.SetWildcard("Project files (*.curaproject)|*.curaproject") diff --git a/Cura/images/save-combination.png b/Cura/images/save-combination.png new file mode 100644 index 00000000..a633824b Binary files /dev/null and b/Cura/images/save-combination.png differ