re-use old slice in project planner, if we are slicing the same object again with the same settings but on a different position. This improves slicing time a lot when making a lot of the same objects.
This commit is contained in:
parent
415ef2eaa6
commit
a6482e9aa6
1 changed files with 12 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import __init__
|
import __init__
|
||||||
|
|
||||||
import wx, os, platform, types, webbrowser, math, subprocess, threading, time
|
import wx, os, platform, types, webbrowser, math, subprocess, threading, time, re
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
from wx import glcanvas
|
from wx import glcanvas
|
||||||
|
@ -920,9 +920,16 @@ class ProjectSliceProgressWindow(wx.Frame):
|
||||||
resultFile.write(data)
|
resultFile.write(data)
|
||||||
data = f.read(4096)
|
data = f.read(4096)
|
||||||
f.close()
|
f.close()
|
||||||
|
savedCenterX = action.centerX
|
||||||
|
savedCenterY = action.centerY
|
||||||
else:
|
else:
|
||||||
f = open(action.filename[: action.filename.rfind('.')] + "_export.project_tmp", "r")
|
f = open(action.filename[: action.filename.rfind('.')] + "_export.project_tmp", "r")
|
||||||
for line in f:
|
for line in f:
|
||||||
|
if line[0] != ';':
|
||||||
|
if 'X' in line:
|
||||||
|
line = self._adjustNumberInLine(line, 'X', action.centerX - savedCenterX)
|
||||||
|
if 'Y' in line:
|
||||||
|
line = self._adjustNumberInLine(line, 'Y', action.centerY - savedCenterY)
|
||||||
resultFile.write(line)
|
resultFile.write(line)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
@ -952,6 +959,10 @@ class ProjectSliceProgressWindow(wx.Frame):
|
||||||
wx.CallAfter(self.statusText.SetLabel, status)
|
wx.CallAfter(self.statusText.SetLabel, status)
|
||||||
wx.CallAfter(self.OnSliceDone)
|
wx.CallAfter(self.OnSliceDone)
|
||||||
|
|
||||||
|
def _adjustNumberInLine(self, line, tag, f):
|
||||||
|
m = re.search('^(.*'+tag+')([0-9\.]*)(.*)$', line)
|
||||||
|
return m.group(1) + str(float(m.group(2)) + f) + m.group(3) + '\n'
|
||||||
|
|
||||||
def OnSliceDone(self):
|
def OnSliceDone(self):
|
||||||
self.abortButton.Destroy()
|
self.abortButton.Destroy()
|
||||||
self.closeButton = wx.Button(self, -1, "Close")
|
self.closeButton = wx.Button(self, -1, "Close")
|
||||||
|
|
Loading…
Reference in a new issue