Commit b9ccd433 authored by Keegi's avatar Keegi

Merge remote branch 'kliment/master'

parents 7e80870c bd640591
# Sample .pronsolerc file - copy this into your home directory # Sample .pronsolerc file - copy this into your home directory and rename it to .pronsolerc
!print "Loaded " + self.rc_filename !print "Loaded " + self.rc_filename
macro up move Z 10 macro up move Z 10
macro loud !self.p.loud = 1 macro loud !self.p.loud = 1
......
...@@ -12,10 +12,12 @@ class stlwrap: ...@@ -12,10 +12,12 @@ class stlwrap:
return self.name return self.name
class showstl(wx.Frame): class showstl(wx.Window):
def __init__(self,parent,size,pos): def __init__(self,parent,size,pos):
wx.Window.__init__(self,parent,size=size,pos=pos) wx.Window.__init__(self,parent,size=size,pos=pos)
self.l=wx.ListCtrl(self,size=(300,100),pos=(0,size[1]-100)) self.l=wx.ListCtrl(self,size=(300,100),pos=(0,size[1]-100))
self.b=wx.Button(self,label="Export",pos=(300,size[1]-100))
self.b.Bind(wx.EVT_BUTTON,self.export)
#self.SetBackgroundColour((0,0,0)) #self.SetBackgroundColour((0,0,0))
wx.FutureCall(200,self.paint) wx.FutureCall(200,self.paint)
self.i=0 self.i=0
...@@ -30,6 +32,18 @@ class showstl(wx.Frame): ...@@ -30,6 +32,18 @@ class showstl(wx.Frame):
self.initpos=None self.initpos=None
self.prevsel=-1 self.prevsel=-1
def export(self,event):
dlg=wx.FileDialog(self,"Pick file to save to",self.basedir,style=wx.FD_SAVE)
dlg.SetWildcard("STL files (;*.stl;)")
if(dlg.ShowModal() == wx.ID_OK):
name=dlg.GetPath()
facets=[]
for i in self.models.values():
facets+=i.facets
stltool.emitstl(name,facets,"plater_export")
print "wrote ",name
def right(self,event): def right(self,event):
dlg=wx.FileDialog(self,"Open file to print",self.basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST) dlg=wx.FileDialog(self,"Open file to print",self.basedir,style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard("STL files (;*.stl;)") dlg.SetWildcard("STL files (;*.stl;)")
...@@ -120,7 +134,7 @@ class showstl(wx.Frame): ...@@ -120,7 +134,7 @@ class showstl(wx.Frame):
class stlwin(wx.Frame): class stlwin(wx.Frame):
def __init__(self,size=(500,600)): def __init__(self,size=(500,600)):
wx.Frame.__init__(self,None,size=size) wx.Frame.__init__(self,None,title="Right-click to add a file",size=size)
self.s=showstl(self,(500,600),(100,100)) self.s=showstl(self,(500,600),(100,100))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -86,6 +86,8 @@ class printcore(): ...@@ -86,6 +86,8 @@ class printcore():
pass pass
if self.loud: if self.loud:
print "RECV: ",line.rstrip() print "RECV: ",line.rstrip()
if(line.startswith('DEBUG_')):
continue
if(line.startswith('start') or line.startswith('ok')): if(line.startswith('start') or line.startswith('ok')):
self.clear=True self.clear=True
if(line.startswith('start') or line.startswith('ok') or "T:" in line): if(line.startswith('start') or line.startswith('ok') or "T:" in line):
......
...@@ -24,6 +24,22 @@ m=[ ...@@ -24,6 +24,22 @@ m=[
[0,0,0,1] [0,0,0,1]
] ]
def emitstl(filename,facets=[],objname="stltool_export"):
if filename is None:
return
f=open(filename,"w")
f.write("solid "+objname+"\n")
for i in facets:
f.write(" facet normal "+" ".join(map(str,i[0]))+"\n outer loop\n")
for j in i[1]:
f.write(" vertex "+" ".join(map(str,j))+"\n")
f.write(" endloop"+"\n")
f.write(" endfacet"+"\n")
f.write("endsolid "+objname+"\n")
f.close()
class stl: class stl:
def __init__(self, filename=None): def __init__(self, filename=None):
self.facet=[[0,0,0],[[0,0,0],[0,0,0],[0,0,0]]] self.facet=[[0,0,0],[[0,0,0],[0,0,0],[0,0,0]]]
...@@ -112,7 +128,7 @@ class stl: ...@@ -112,7 +128,7 @@ class stl:
f.write(" vertex "+" ".join(map(str,j))+"\n") f.write(" vertex "+" ".join(map(str,j))+"\n")
f.write(" endloop"+"\n") f.write(" endloop"+"\n")
f.write(" endfacet"+"\n") f.write(" endfacet"+"\n")
f.write("endsolid exported"+"\n") f.write("endsolid "+self.name+"\n")
f.flush() f.flush()
def parseline(self,l): def parseline(self,l):
...@@ -156,5 +172,5 @@ if __name__=="__main__" and 0: ...@@ -156,5 +172,5 @@ if __name__=="__main__" and 0:
break break
print i,len(working) print i,len(working)
emitstl("sphereout.stl",s.facets,"emitted_object")
#stl("../prusamendel/stl/mendelplate.stl") #stl("../prusamendel/stl/mendelplate.stl")
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