Commit ca84c816 authored by kliment's avatar kliment

Merge pull request #144 from AxTheB/export

load_scad line parsing rewrite
parents 1a90feb2 7f880dc3
...@@ -7,11 +7,8 @@ try: ...@@ -7,11 +7,8 @@ try:
except: except:
glview=False glview=False
def translate(l): return l def evalme(s):
return eval(s[s.find("(")+1:s.find(")")])
def rotate(l): return l
def import_stl(s): return s
class stlwrap: class stlwrap:
def __init__(self,obj,name=None): def __init__(self,obj,name=None):
...@@ -321,14 +318,20 @@ class stlwin(wx.Frame): ...@@ -321,14 +318,20 @@ class stlwin(wx.Frame):
def load_scad(self,event,name): def load_scad(self,event,name):
lf=open(name) lf=open(name)
s=[i.replace("\n","").replace("\r","").replace(";","") for i in lf] s=[i.replace("\n","").replace("\r","").replace(";","") for i in lf if "stl" in i]
lf.close() lf.close()
for i in s: for i in s:
parts = i.split() parts = i.split()
translate_list = eval(parts[0]) for part in parts:
rotate_list = eval(parts[1]) if 'translate' in part:
stl_file = eval(parts[2]) translate_list = evalme(part)
for part in parts:
if 'rotate' in part:
rotate_list = evalme(part)
for part in parts:
if 'import' in part:
stl_file = evalme(part)
newname=os.path.split(stl_file.lower())[1] newname=os.path.split(stl_file.lower())[1]
c=1 c=1
......
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