Commit 1fa10b65 authored by Kliment Yanev's avatar Kliment Yanev

Emit .scad file with scene description on export.

parent 6ca8f265
...@@ -69,15 +69,20 @@ class showstl(wx.Window): ...@@ -69,15 +69,20 @@ class showstl(wx.Window):
dlg.SetWildcard("STL files (;*.stl;)") dlg.SetWildcard("STL files (;*.stl;)")
if(dlg.ShowModal() == wx.ID_OK): if(dlg.ShowModal() == wx.ID_OK):
name=dlg.GetPath() name=dlg.GetPath()
sf=open(name.replace(".","_")+".scad","w")
facets=[] facets=[]
for i in self.models.values(): for i in self.models.values():
r=i.rot r=i.rot
o=i.offsets o=i.offsets
sf.write('translate([%s,%s,%s]) rotate([0,0,%s]) import_stl("%s");\n'%(str(o[0]),str(o[1]),str(o[2]),-r,os.path.split(i.filename)[1]))
if r != 0: if r != 0:
i=i.rotate([0,0,-r]) i=i.rotate([0,0,-r])
if o != [0,0,0]: if o != [0,0,0]:
i=i.translate([o[0],-o[1],o[2]]) i=i.translate([o[0],-o[1],o[2]])
facets+=i.facets facets+=i.facets
sf.close()
stltool.emitstl(name,facets,"plater_export") stltool.emitstl(name,facets,"plater_export")
print "wrote ",name print "wrote ",name
...@@ -141,6 +146,7 @@ class showstl(wx.Window): ...@@ -141,6 +146,7 @@ class showstl(wx.Window):
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]
self.models[newname].rot=0 self.models[newname].rot=0
self.models[newname].filename=name
minx,miny,minz,maxx,maxy,maxz=(10000,10000,10000,0,0,0) minx,miny,minz,maxx,maxy,maxz=(10000,10000,10000,0,0,0)
for i in self.models[newname].facets: for i in self.models[newname].facets:
for j in i[1]: for j in i[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