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

Add blanking to projection for photopolymer printing

parent 28c05419
......@@ -37,6 +37,13 @@ class dispframe(wx.Frame):
self.p=printer
self.pic=wx.StaticBitmap(self)
self.bitmap=wx.EmptyBitmap(*res)
self.bbitmap=wx.EmptyBitmap(*res)
dc=wx.MemoryDC()
dc.SelectObject(self.bbitmap)
dc.SetBackground(wx.Brush("black"))
dc.Clear()
dc.SelectObject(wx.NullBitmap)
self.SetBackgroundColour("black")
self.pic.Hide()
self.pen=wx.Pen("white")
......@@ -61,20 +68,33 @@ class dispframe(wx.Frame):
self.pic.SetBitmap(self.bitmap)
self.pic.Show()
self.Refresh()
#self.pic.SetBitmap(self.bitmap)
except:
raise
pass
def showimgdelay(self,image):
self.drawlayer(image)
self.pic.Show()
self.Refresh()
# time.sleep(self.interval)
#self.pic.Hide()
self.Refresh()
if self.p!=None and self.p.online:
self.p.send_now("G91")
self.p.send_now("G1 Z%f F300"%(self.thickness,))
self.p.send_now("G90")
def nextimg(self,event):
#print "b"
if self.index<len(self.layers):
i=self.index
#print self.layers[i]
print i
wx.CallAfter(self.drawlayer,self.layers[i])
if self.p!=None:
self.p.send_now("G91")
self.p.send_now("G1 Z%f F300"%(self.thickness,))
self.p.send_now("G90")
wx.CallAfter(self.showimgdelay,self.layers[i])
wx.FutureCall(1000*self.interval,self.pic.Hide)
self.index+=1
else:
print "end"
......@@ -84,7 +104,7 @@ class dispframe(wx.Frame):
wx.CallAfter(self.timer.Stop)
def present(self,layers,interval=0.5,thickness=0.4,scale=20,size=(800,600)):
def present(self,layers,interval=0.5,pause=0.2,thickness=0.4,scale=20,size=(800,600)):
wx.CallAfter(self.pic.Hide)
wx.CallAfter(self.Refresh)
self.layers=layers
......@@ -92,10 +112,11 @@ class dispframe(wx.Frame):
self.thickness=thickness
self.index=0
self.size=size
self.interval=interval
self.timer=wx.Timer(self,1)
self.timer.Bind(wx.EVT_TIMER,self.nextimg)
self.Bind(wx.EVT_TIMER,self.nextimg)
self.timer.Start(1000*interval)
self.timer.Start(1000*interval+1000*pause)
#print "x"
......@@ -111,16 +132,19 @@ class setframe(wx.Frame):
wx.StaticText(self.panel,-1,"Layer:",pos=(0,30))
wx.StaticText(self.panel,-1,"mm",pos=(130,30))
self.thickness=wx.TextCtrl(self.panel,-1,"0.5",pos=(50,30))
wx.StaticText(self.panel,-1,"Interval:",pos=(0,60))
wx.StaticText(self.panel,-1,"Exposure:",pos=(0,60))
wx.StaticText(self.panel,-1,"s",pos=(130,60))
self.interval=wx.TextCtrl(self.panel,-1,"0.5",pos=(50,60))
wx.StaticText(self.panel,-1,"Scale:",pos=(0,90))
wx.StaticText(self.panel,-1,"x",pos=(130,90))
self.scale=wx.TextCtrl(self.panel,-1,"10",pos=(50,90))
wx.StaticText(self.panel,-1,"Blank:",pos=(0,90))
wx.StaticText(self.panel,-1,"s",pos=(130,90))
self.delay=wx.TextCtrl(self.panel,-1,"0.5",pos=(50,90))
wx.StaticText(self.panel,-1,"Scale:",pos=(0,120))
wx.StaticText(self.panel,-1,"x",pos=(130,120))
self.scale=wx.TextCtrl(self.panel,-1,"5",pos=(50,120))
wx.StaticText(self.panel,-1,"X:",pos=(160,30))
self.X=wx.TextCtrl(self.panel,-1,"800",pos=(180,30))
self.X=wx.TextCtrl(self.panel,-1,"1024",pos=(180,30))
wx.StaticText(self.panel,-1,"Y:",pos=(160,60))
self.Y=wx.TextCtrl(self.panel,-1,"600",pos=(180,60))
self.Y=wx.TextCtrl(self.panel,-1,"768",pos=(180,60))
self.bload=wx.Button(self.panel,-1,"Present",pos=(0,150))
self.bload.Bind(wx.EVT_BUTTON,self.startdisplay)
self.Show()
......@@ -146,7 +170,7 @@ class setframe(wx.Frame):
self.f.ShowFullScreen(1)
l=self.layers[0][:]
#l=list(reversed(l))
self.f.present(l,thickness=float(self.thickness.GetValue()),interval=float(self.interval.GetValue()),scale=float(self.scale.GetValue()), size=(float(self.X.GetValue()),float(self.Y.GetValue())))
self.f.present(l,thickness=float(self.thickness.GetValue()),interval=float(self.interval.GetValue()),scale=float(self.scale.GetValue()),pause=float(self.delay.GetValue()), size=(float(self.X.GetValue()),float(self.Y.GetValue())))
if __name__=="__main__":
a=wx.App()
......
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