Replaced re with os.path.split. Fixed duplicates.
parent
ad81fb6282
commit
547b2f2457
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import wx,time,random,threading,os,math
|
import wx,time,random,threading,os,math
|
||||||
import stltool
|
import stltool
|
||||||
import re
|
|
||||||
|
|
||||||
class stlwrap:
|
class stlwrap:
|
||||||
def __init__(self,obj,name=None):
|
def __init__(self,obj,name=None):
|
||||||
|
@ -132,11 +131,12 @@ class showstl(wx.Window):
|
||||||
t=time.time()
|
t=time.time()
|
||||||
#print name
|
#print name
|
||||||
if name.lower().endswith(".stl"):
|
if name.lower().endswith(".stl"):
|
||||||
#Filter out the path, just show the STL filename.
|
#Filter out the path, just show the STL filename.
|
||||||
newname=re.match(r".*[/\\](.*?\.stl)", name.lower()).group(1)
|
#newname=re.match(r".*[/\\](.*?\.stl)", name.lower()).group(1)
|
||||||
|
newname=os.path.split(name.lower())[1]
|
||||||
c=1
|
c=1
|
||||||
while newname in self.models:
|
while newname in self.models:
|
||||||
newname=newname+"(%d)"%c
|
newname=os.path.split(name.lower()+"(%d)"%c)[1]
|
||||||
c+=1
|
c+=1
|
||||||
self.models[newname]=stltool.stl(name)
|
self.models[newname]=stltool.stl(name)
|
||||||
self.models[newname].offsets=[0,0,0]
|
self.models[newname].offsets=[0,0,0]
|
||||||
|
|
Loading…
Reference in New Issue