Commit ca5a690c authored by Guillaume Seguin's avatar Guillaume Seguin

WIP #580: fix Done button in gcodeplater

Also cleanup a minor detail in stl plater
parent db06b987
...@@ -22,6 +22,8 @@ install_locale('pronterface') ...@@ -22,6 +22,8 @@ install_locale('pronterface')
import wx import wx
import sys import sys
import os
import time
import types import types
import re import re
import math import math
...@@ -108,6 +110,15 @@ class GcodePlater(Plater): ...@@ -108,6 +110,15 @@ class GcodePlater(Plater):
self.add_model(filename, obj) self.add_model(filename, obj)
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
def done(self, event, cb):
if not os.path.exists("tempgcode"):
os.mkdir("tempgcode")
name = "tempgcode/" + str(int(time.time()) % 10000) + ".gcode"
self.export_to(name)
if cb is not None:
cb(name)
self.Destroy()
# What's hard in there ? # What's hard in there ?
# 1) [x] finding the order in which the objects are printed # 1) [x] finding the order in which the objects are printed
# 2) [x] handling layers correctly # 2) [x] handling layers correctly
......
...@@ -362,10 +362,8 @@ class StlPlater(Plater): ...@@ -362,10 +362,8 @@ class StlPlater(Plater):
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
def done(self, event, cb): def done(self, event, cb):
try: if not os.path.exists("tempstl"):
os.mkdir("tempstl") os.mkdir("tempstl")
except:
pass
name = "tempstl/" + str(int(time.time()) % 10000) + ".stl" name = "tempstl/" + str(int(time.time()) % 10000) + ".stl"
self.export_to(name) self.export_to(name)
if cb is not None: if cb is not None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment