chiark / gitweb /
Add option to save the collection of STL files as a single STL file in the project...
authorDaid <daid303@gmail.com>
Thu, 21 Jun 2012 13:04:42 +0000 (15:04 +0200)
committerDaid <daid303@gmail.com>
Thu, 21 Jun 2012 13:04:42 +0000 (15:04 +0200)
Cura/gui/projectPlanner.py
Cura/images/save-combination.png [new file with mode: 0644]

index 8096129cb32484aef1206be54e82760f04877a48..5ab1250c495dedcc5b7972cb0bfb708cc4dbabb3 100644 (file)
@@ -25,6 +25,7 @@ from gui import printWindow
 from util import profile\r
 from util import util3d\r
 from util import stl\r
+from util import mesh\r
 from util import sliceRun\r
 from util import gcodeInterpreter\r
 from util import exporer\r
@@ -160,6 +161,7 @@ class projectPlanner(wx.Frame):
                toolbarUtil.NormalButton(self.toolbar, self.OnPreferences, 'preferences.png', 'Project planner preferences')\r
                self.toolbar.AddSeparator()\r
                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.')\r
+               toolbarUtil.NormalButton(self.toolbar, self.OnSaveCombinedSTL, 'save-combination.png', 'Save all the combined STL files into a single STL file as a plate.')\r
                self.toolbar.AddSeparator()\r
                toolbarUtil.NormalButton(self.toolbar, self.OnQuit, 'exit.png', 'Close project planner')\r
                \r
@@ -271,6 +273,18 @@ class projectPlanner(wx.Frame):
                self.preview.Refresh()\r
                dlg.Destroy()\r
        \r
+       def OnSaveCombinedSTL(self, e):\r
+               dlg=wx.FileDialog(self, "Save as STL", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)\r
+               dlg.SetWildcard("STL files (*.stl)|*.stl;*.STL")\r
+               if dlg.ShowModal() == wx.ID_OK:\r
+                       output = mesh.mesh()\r
+                       for item in self.list:\r
+                               offset = util3d.Vector3(item.centerX, item.centerY, 0)\r
+                               for f in item.faces:\r
+                                       output.addFace(f.v[0] * item.scale + offset, f.v[1] * item.scale + offset, f.v[2] * item.scale + offset)\r
+                       stl.saveAsSTL(output, dlg.GetPath())\r
+               dlg.Destroy()\r
+       \r
        def OnSaveProject(self, e):\r
                dlg=wx.FileDialog(self, "Save project file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)\r
                dlg.SetWildcard("Project files (*.curaproject)|*.curaproject")\r
diff --git a/Cura/images/save-combination.png b/Cura/images/save-combination.png
new file mode 100644 (file)
index 0000000..a633824
Binary files /dev/null and b/Cura/images/save-combination.png differ