here is the patchit adds the availaby to put a grid in z view beond the g-code so better viewing is providet
>From 2afebf8c3e97f6996a3db0400d1684e9886eba4b Mon Sep 17 00:00:00 2001 From: SammelLothar <sammellot...@gmx.de> Date: Mon, 7 May 2012 11:16:47 +0200 Subject: [PATCH] grid_patch --- configs/sim/axis/axis_foam.ini | 1 + lib/python/rs274/glcanon.py | 55 +++++++++++++++++++++++++++++++++ share/axis/tcl/axis.tcl | 5 +++ src/emc/usr_intf/axis/scripts/axis.py | 8 ++++- 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/configs/sim/axis/axis_foam.ini b/configs/sim/axis/axis_foam.ini index 6472280..10661dc 100644 --- a/configs/sim/axis/axis_foam.ini +++ b/configs/sim/axis/axis_foam.ini @@ -39,6 +39,7 @@ MAX_FEED_OVERRIDE = 1.2 MAX_SPINDLE_OVERRIDE = 1.0 # Prefix to be used PROGRAM_PREFIX = ../../../nc_files/ +OPEN_FILE = ../../../nc_files/foam.ngc # Introductory graphic INTRO_GRAPHIC = linuxcnc.gif diff --git a/lib/python/rs274/glcanon.py b/lib/python/rs274/glcanon.py index 2400201..ce7d62a 100644 --- a/lib/python/rs274/glcanon.py +++ b/lib/python/rs274/glcanon.py @@ -82,6 +82,7 @@ class GLCanon(Translated, ArcsToSegmentsMixin): self.is_foam = is_foam self.foam_z = 0 self.foam_w = 1.5 + self.grid = 5.0 self.notify = 0 self.notify_message = "" @@ -108,6 +109,14 @@ class GLCanon(Translated, ArcsToSegmentsMixin): self.foam_w = self.foam_w / 25.4 except: self.foam_w = 30.0 + if command == "GRID": + if len(parts) > 2 : + try: + self.grid = float(parts[2]) + if 210 in self.state.gcodes: + self.grid = self.grid / 25.4 + except: + self.grid = 5.0/25.4 if command == "notify": self.notify = self.notify + 1 self.notify_message = "(AXIS,notify):" + str(self.notify) @@ -782,6 +791,10 @@ class GlCanonDraw: if self.canon: return self.canon.foam_w return 1.5 + def get_grid(self): + if self.canon: return self.canon.grid + return 5./25.4 + def redraw(self): s = self.stat s.poll() @@ -790,6 +803,48 @@ class GlCanonDraw: glDisable(GL_LIGHTING) glMatrixMode(GL_MODELVIEW) + if (self.get_view() == 2) and (self.get_show_grid()) : + grid_space=self.get_grid() + glLineWidth(1) + glColor3f(0.15,0.15,0.15) + glBegin(GL_LINES) + #x-grid + if machine_limit_min[0] < (s.g5x_offset[0]-grid_space): + grid_lines = int(((machine_limit_min[0]) - s.g5x_offset[0])/ grid_space)+1 + x = s.g5x_offset[0] + if grid_lines < 0:grid_lines=(grid_lines * (-1))+1 + for i in range(0,grid_lines): + glVertex3f(x,machine_limit_min[1],-0.05) + glVertex3f(x,machine_limit_max[1],-0.05) + x=x-grid_space + #x+grid + if machine_limit_max[0] > (s.g5x_offset[0] + grid_space): + grid_lines = int(((machine_limit_max[0]) - s.g5x_offset[0])/ grid_space)+1 + x = s.g5x_offset[0] + if grid_lines < 0:grid_lines=(grid_lines * (-1))+1 + for i in range(0,grid_lines): + glVertex3f(x,machine_limit_min[1],-0.05) + glVertex3f(x,machine_limit_max[1],-0.05) + x=x+grid_space + #y-grid + if machine_limit_min[1] < (s.g5x_offset[1] - grid_space): + grid_lines = int(((machine_limit_min[1]) - s.g5x_offset[1])/ grid_space)+1 + y = s.g5x_offset[1] + if grid_lines < 0:grid_lines=(grid_lines * (-1))+1 + for i in range(0,grid_lines): + glVertex3f(machine_limit_min[0],y,-0.05) + glVertex3f(machine_limit_max[0],y,-0.05) + y=y-grid_space + #y+grid + if machine_limit_max[1] > (s.g5x_offset[1] + grid_space): + grid_lines = int(((machine_limit_max[1]) - s.g5x_offset[1])/ grid_space)+1 + y = s.g5x_offset[1] + if grid_lines < 0:grid_lines=(grid_lines * (-1))+1 + for i in range(0,grid_lines): + glVertex3f(machine_limit_min[0],y,-0.05) + glVertex3f(machine_limit_max[0],y,-0.05) + y=y+grid_space + glEnd() # end Grid Generator if self.get_show_program(): if self.get_program_alpha(): diff --git a/share/axis/tcl/axis.tcl b/share/axis/tcl/axis.tcl index 3e16307..57c851a 100644 --- a/share/axis/tcl/axis.tcl +++ b/share/axis/tcl/axis.tcl @@ -338,6 +338,11 @@ setup_menu_accel .menu.view end [_ "Show too_l"] setup_menu_accel .menu.view end [_ "Show e_xtents"] .menu.view add checkbutton \ + -variable show_grid \ + -command toggle_show_grid +setup_menu_accel .menu.view end [_ "Show grid"] + +.menu.view add checkbutton \ -variable show_offsets \ -command toggle_show_offsets setup_menu_accel .menu.view end [_ "Show o_ffsets"] diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index 87dd5cb..bb439cc 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/python # This is a component of AXIS, a front-end for LinuxCNC # Copyright 2004, 2005, 2006, 2007, 2008, 2009 # Jeff Epler <jep...@unpythonic.net> and Chris Radek <ch...@timeguy.com> @@ -531,6 +531,7 @@ class MyOpengl(GlCanonDraw, Opengl): def get_show_program(self): return vars.show_program.get() def get_show_offsets(self): return vars.show_offsets.get() def get_show_extents(self): return vars.show_extents.get() + def get_show_grid(self): return vars.show_grid.get() def get_show_metric(self): return vars.metric.get() def get_show_live_plot(self): return vars.show_live_plot.get() def get_show_machine_speed(self): return vars.show_machine_speed.get() @@ -2210,6 +2211,10 @@ class TclCommands(nf.TclCommands): ap.putpref("show_offsets", vars.show_offsets.get()) o.tkRedraw() + def toggle_show_grid(*event): + ap.putpref("show_grid", vars.show_grid.get()) + o.tkRedraw() + def toggle_show_machine_limits(*event): ap.putpref("show_machine_limits", vars.show_machine_limits.get()) o.tkRedraw() @@ -2525,6 +2530,7 @@ vars = nf.Variables(root_window, ("show_tool", IntVar), ("show_extents", IntVar), ("show_offsets", IntVar), + ("show_grid", IntVar), ("show_machine_limits", IntVar), ("show_machine_speed", IntVar), ("show_distance_to_go", IntVar), -- 1.7.9.3
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers