Commit 5fc81cad authored by Guillaume Seguin's avatar Guillaume Seguin

Speedup stl plater by only loading files once when multiple copies are added

parent 999fa8cf
...@@ -30,6 +30,7 @@ import sys ...@@ -30,6 +30,7 @@ import sys
import re import re
import traceback import traceback
import subprocess import subprocess
from copy import copy
from printrun import stltool from printrun import stltool
from printrun.objectplater import Plater from printrun.objectplater import Plater
...@@ -270,6 +271,16 @@ class StlPlater(Plater): ...@@ -270,6 +271,16 @@ class StlPlater(Plater):
path = os.path.split(name)[0] path = os.path.split(name)[0]
self.basedir = path self.basedir = path
if name.lower().endswith(".stl"): if name.lower().endswith(".stl"):
for model in self.models.values():
if model.filename == name:
newmodel = copy(model)
newmodel.offsets = list(model.offsets)
newmodel.rot = model.rot
newmodel.scale = list(model.scale)
self.add_model(name, newmodel)
self.s.drawmodel(newmodel, 2)
break
else:
#Filter out the path, just show the STL filename. #Filter out the path, just show the STL filename.
self.load_stl_into_model(name, name) self.load_stl_into_model(name, name)
self.Refresh() self.Refresh()
......
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