Commit cf62dc25 authored by Keegi's avatar Keegi

preview extrusion width as setting

parent 3813ea29
import wx,time
class window(wx.Frame):
def __init__(self,f,size=(600,600),bedsize=(200,200),grid=(10,50)):
def __init__(self,f,size=(600,600),bedsize=(200,200),grid=(10,50),extrusion_width=0.5):
wx.Frame.__init__(self,None,title="Layer view (Use shift+mousewheel to switch layers)",size=(size[0],size[1]))
self.p=gviz(self,size=size,bedsize=bedsize,grid=grid)
self.p=gviz(self,size=size,bedsize=bedsize,grid=grid,extrusion_width=extrusion_width)
s=time.time()
for i in f:
self.p.addgcode(i)
......@@ -53,7 +53,7 @@ class window(wx.Frame):
elif z < 0: self.p.zoom(event.GetX(),event.GetY(),1/1.2)
class gviz(wx.Panel):
def __init__(self,parent,size=(200,200),bedsize=(200,200),grid=(10,50)):
def __init__(self,parent,size=(200,200),bedsize=(200,200),grid=(10,50),extrusion_width=0.5):
wx.Panel.__init__(self,parent,-1,size=(size[0],size[1]))
self.size=size
self.bedsize=bedsize
......@@ -66,7 +66,7 @@ class gviz(wx.Panel):
self.pens={}
self.layers=[]
self.layerindex=0
self.filament_width=0.5 # set it to 0 to disable scaling lines with zoom
self.filament_width=extrusion_width # set it to 0 to disable scaling lines with zoom
self.scale=[min(float(size[0])/bedsize[0],float(size[1])/bedsize[1])]*2
penwidth = max(1.0,self.filament_width*((self.scale[0]+self.scale[1])/2.0))
self.translate=[0.0,0.0]
......
......@@ -49,6 +49,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.settings.bed_size_y = 200.
self.settings.preview_grid_step1 = 10.
self.settings.preview_grid_step2 = 50.
self.settings.preview_extrusion_width = 0.5
self.filename=filename
os.putenv("UBUNTU_MENUPROXY","0")
wx.Frame.__init__(self,None,title="Printer Interface",size=size);
......@@ -515,11 +516,13 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
lls.Add((10,0),pos=(0,11),span=(1,1))
self.gviz=gviz.gviz(self.panel,(300,300),
bedsize=(self.settings.bed_size_x,self.settings.bed_size_y),
grid=(self.settings.preview_grid_step1,self.settings.preview_grid_step2))
grid=(self.settings.preview_grid_step1,self.settings.preview_grid_step2),
extrusion_width=self.settings.preview_extrusion_width)
self.gviz.showall=1
self.gwindow=gviz.window([],
bedsize=(self.settings.bed_size_x,self.settings.bed_size_y),
grid=(self.settings.preview_grid_step1,self.settings.preview_grid_step2))
grid=(self.settings.preview_grid_step1,self.settings.preview_grid_step2),
extrusion_width=self.settings.preview_extrusion_width)
self.gviz.Bind(wx.EVT_LEFT_DOWN,self.showwin)
self.gwindow.Bind(wx.EVT_CLOSE,lambda x:self.gwindow.Hide())
cs=self.centersizer=wx.GridBagSizer()
......
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