Hi this is the new almost perfect patch  for xyuv foamcutting mashines
Now Highlighting is implemented
code is reduced to a minimum
maybe liveplotting data can be shorten some more OR i need a trigger for States.gcodes 171 in LivePlotter.updade
otherwise the list is gone be huge and not used
maybe i can fill this also in GlcanonDraw that woudt be best then there is the the trigger in redraw ! there will be the problem to clean it up. therefor i choos to use liveplotter with clean to be pressed on the broom of the axis frame

so its done and working

feel free to comment !
Sammel Lothar Germany
>From f605fc571f913bf24ac8ff22b9a40007b4a0b0eb Mon Sep 17 00:00:00 2001
From: SammelLothar <sammellot...@gmx.de>
Date: Tue, 24 Jan 2012 21:41:51 +0100
Subject: [PATCH] foam-xyuv-Modification-2.6-pre

---
 lib/python/hershey.py                 |   10 +-
 lib/python/rs274/glcanon.py           |  287 +++++++++++++++++++++++++++++----
 nc_files/foam-xyuv.ngc                |   25 +++
 share/axis/tcl/axis.tcl               |    5 +
 src/emc/usr_intf/axis/scripts/axis.py |   52 ++++++-
 5 files changed, 339 insertions(+), 40 deletions(-)
 create mode 100644 nc_files/foam-xyuv.ngc

diff --git a/lib/python/hershey.py b/lib/python/hershey.py
index 16bb02a..6a07a3d 100644
--- a/lib/python/hershey.py
+++ b/lib/python/hershey.py
@@ -17,7 +17,7 @@
 
 from minigl import *
 
-translate = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '-': 10, '.': 11, 'X': 12, 'Y': 13, 'Z': 14, 'G': 15}
+translate = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '-': 10, '.': 11, 'X': 12, 'Y': 13, 'Z': 14, 'G': 15,'V':16,'U':17}
 
 class Hershey:
     def __init__(self):
@@ -92,8 +92,12 @@ class Hershey:
           (160.0, 380.0), (200.0, 420.0), (260.0, 440.0), (280.0, 440.0),
           (340.0, 420.0), (380.0, 380.0), (400.0, 320.0),
           (400.0, 280.0), (270.0, 280.0)
-
-          ]]
+          ]],
+    # V
+        [[(60, 20), (200, 440)], [(340, 20), (200, 440)]], 
+    # U
+        [[(60, 20), (60, 400),(95,410),(130,420),(165,430),(200,440)],
+        [(340, 20),(340, 400),(305, 410),(270, 420),(235, 430),(200, 440)]] 
 
        ) 
 
diff --git a/lib/python/rs274/glcanon.py b/lib/python/rs274/glcanon.py
index 75322bb..d704446 100644
--- a/lib/python/rs274/glcanon.py
+++ b/lib/python/rs274/glcanon.py
@@ -78,6 +78,10 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
         self.g5x_offset_u = 0.0
         self.g5x_offset_v = 0.0
         self.g5x_offset_w = 0.0
+        self.xyuv_live_plot_data = []
+        self.grid_space = 10.0
+        self.xy_plane_z_position = 5.0
+        self.uv_plane_z_position = 30.0
 
     def comment(self, arg):
         if arg.startswith("AXIS,"):
@@ -86,7 +90,35 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
             if command == "stop": raise KeyboardInterrupt
             if command == "hide": self.suppress += 1
             if command == "show": self.suppress -= 1
-
+            if command == "XY_Z_POS": 
+                if len(parts) > 2 :
+                    try:
+                        self.xy_plane_z_position = float(parts[2])
+                        if 210 in self.state.gcodes:
+                            self.xy_plane_z_position = self.xy_plane_z_position / 25.4
+                    except:
+                        self.xy_plane_z_position = 5.0/25.4
+            if command == "UV_Z_POS": 
+                if len(parts) > 2 :
+                    try:
+                        self.uv_plane_z_position = float(parts[2])
+                        if 210 in self.state.gcodes:
+                            self.uv_plane_z_position = self.uv_plane_z_position / 25.4
+                    except:
+                        self.uv_plane_z_position = 30.0
+            if command == "GRID":
+                if len(parts) > 2 :
+                    try:
+                        self.grid_space = float(parts[2])
+                        if 210 in self.state.gcodes:
+                            self.grid_space=self.grid_space / 25.4
+                    except:
+                        self.grid_space = 5.0/25.4
+                
+    def get_grid_space(self):return self.grid_space
+    def get_xy_plane_z_position(self):return self.xy_plane_z_position
+    def get_uv_plane_z_position(self):return self.uv_plane_z_position
+ 
     def message(self, message): pass
 
     def check_abort(self): pass
@@ -96,7 +128,21 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
         self.lineno = self.state.sequence_number
 
     def draw_lines(self, lines, for_selection, j=0):
-        return linuxcnc.draw_lines(self.geometry, lines, for_selection)
+        if 171 in self.state.gcodes:
+            glPushMatrix()
+            c = self.colors['axis_x']
+            glColor3f(*c)
+            glTranslatef(0,0,self.get_xy_plane_z_position())
+            linuxcnc.draw_lines("XY", lines, for_selection)
+            glPopMatrix()
+            glPushMatrix()
+            ca = self.colors['axis_z']
+            glColor3f(*ca)
+            glTranslatef(0,0,self.get_uv_plane_z_position())
+            linuxcnc.draw_lines("UV", lines, for_selection)
+            glPopMatrix()
+        else:
+            return linuxcnc.draw_lines(self.geometry, lines, for_selection)
 
     def draw_dwells(self, dwells, alpha, for_selection, j0=0):
         return linuxcnc.draw_dwells(self.geometry, dwells, alpha, for_selection, self.is_lathe())
@@ -202,9 +248,15 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
             coords.append(line[2][:3])
         for line in self.feed:
             if line[0] != lineno: continue
-            linuxcnc.line9(geometry, line[1], line[2])
-            coords.append(line[1][:3])
-            coords.append(line[2][:3])
+            if 171 in self.state.gcodes:
+                glVertex3f(line[1][0],line[1][1],self.get_xy_plane_z_position())
+                glVertex3f(line[2][0],line[2][1],self.get_xy_plane_z_position())
+                glVertex3f(line[1][6],line[1][7],self.get_uv_plane_z_position())
+                glVertex3f(line[2][6],line[2][7],self.get_uv_plane_z_position())
+            else:
+                linuxcnc.line9(geometry, line[1], line[2])
+                coords.append(line[1][:3])
+                coords.append(line[2][:3])
         glEnd()
         for line in self.dwells:
             if line[0] != lineno: continue
@@ -241,7 +293,6 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
             else:
                 self.color_with_alpha('straight_feed')
             self.draw_lines(self.feed, for_selection, len(self.traverse))
-
             if for_selection:
                 self.color('arc_feed')
             else:
@@ -320,6 +371,27 @@ class GlCanonDraw:
         self.select_buffer_size = 100
         self.cached_tool = -1
         self.initialised = 0
+        self.redraw_count = 0
+        self.xyuv_live_plot_data = []
+        self.xyuv_view = False
+
+    def draw_xyuv_live_plot(self, n):
+        xy_plane_z_position= self.canon.get_xy_plane_z_position() 
+        uv_plane_z_position= self.canon.get_uv_plane_z_position() 
+        glNewList(n, GL_COMPILE)
+        s = self.stat
+        view = self.get_view()
+        glColor3f(1.0,0.0,0.0)
+        glBegin(GL_LINES)
+        if len(self.xyuv_live_plot_data) >0:
+            for line in self.xyuv_live_plot_data:
+                glVertex3f(line[0],line[1],xy_plane_z_position)
+                glVertex3f(line[2],line[3],uv_plane_z_position)
+        else:
+            glVertex3f(0.0,0.0,0.0)
+            glVertex3f(0.0,0.0,0.001)
+        glEnd()
+        glEndList()
 
     def realize(self):
         self.hershey = hershey.Hershey()
@@ -327,6 +399,9 @@ class GlCanonDraw:
         self.basic_lighting()
         self.initialised = 1
 
+    def set_xyuv_live_plot_data(self,data):
+        self.xyuv_live_plot_data = data
+
     def set_canon(self, canon):
         self.canon = canon
 
@@ -363,7 +438,9 @@ class GlCanonDraw:
             if self.get_show_rapids():
                 glCallList(self.dlist('select_rapids', gen=self.make_selection_list))
             glCallList(self.dlist('select_norapids', gen=self.make_selection_list))
-
+            if self.xyuv_view:
+                glCallList(self.dlist('select_xy_plane', gen=self.make_selection_list))
+                glCallList(self.dlist('select_uv_plane', gen=self.make_selection_list))
             try:
                 buffer = list(glRenderMode(GL_RENDER))
             except OverflowError:
@@ -547,6 +624,23 @@ class GlCanonDraw:
             glVertex3f(x_pos - dashwidth, y_pos - zdashwidth, g.max_extents[z])
             glVertex3f(x_pos + dashwidth, y_pos + zdashwidth, g.max_extents[z])
 
+        # z dimension xyuv view
+        if self.xyuv_view:
+            xy_z= self.canon.get_xy_plane_z_position() 
+            uv_z= self.canon.get_uv_plane_z_position() 
+            
+            if view != z and uv_z > xy_z :
+                x_pos = g.min_extents[x] - pullback
+                y_pos = g.min_extents[y] - pullback
+                glVertex3f(x_pos, y_pos, xy_z)
+                glVertex3f(x_pos, y_pos, uv_z)
+
+                glVertex3f(x_pos - dashwidth, y_pos - zdashwidth, xy_z)
+                glVertex3f(x_pos + dashwidth, y_pos + zdashwidth, xy_z)
+
+                glVertex3f(x_pos - dashwidth, y_pos - zdashwidth, uv_z)
+                glVertex3f(x_pos + dashwidth, y_pos + zdashwidth, uv_z)
+        
         glEnd()
 
         # Labels
@@ -554,7 +648,12 @@ class GlCanonDraw:
             offset = self.to_internal_units(s.g5x_offset + s.g92_offset)
         else:
             offset = 0, 0, 0
-        if view != z and g.max_extents[z] > g.min_extents[z]:
+        z_max = g.max_extents[z] 
+        z_min = g.min_extents[z] 
+        if self.xyuv_view:  # Z label at EDN/Foam 
+            z_max = self.canon.get_uv_plane_z_position()
+            z_min = self.canon.get_xy_plane_z_position()
+        if view != z and z_max > z_min:
             if view == x:
                 x_pos = g.min_extents[x] - pullback
                 y_pos = g.min_extents[y] - 6.0*dashwidth
@@ -562,10 +661,10 @@ class GlCanonDraw:
                 x_pos = g.min_extents[x] - 6.0*dashwidth
                 y_pos = g.min_extents[y] - pullback
 
-            bbox = self.color_limit(g.min_extents[z] < machine_limit_min[z])
+            bbox = self.color_limit(z_min < machine_limit_min[z])
             glPushMatrix()
-            f = fmt % ((g.min_extents[z]-offset[z]) * dimscale)
-            glTranslatef(x_pos, y_pos, g.min_extents[z] - halfchar)
+            f = fmt % ((z_min-offset[z]) * dimscale)
+            glTranslatef(x_pos, y_pos, z_min - halfchar)
             glScalef(charsize, charsize, charsize)
             glRotatef(-90, 0, 1, 0)
             glRotatef(-90, 0, 0, 1)
@@ -574,10 +673,10 @@ class GlCanonDraw:
             self.hershey.plot_string(f, 0, bbox)
             glPopMatrix()
 
-            bbox = self.color_limit(g.max_extents[z] > machine_limit_max[z])
+            bbox = self.color_limit(z_max > machine_limit_max[z])
             glPushMatrix()
-            f = fmt % ((g.max_extents[z]-offset[z]) * dimscale)
-            glTranslatef(x_pos, y_pos, g.max_extents[z] - halfchar)
+            f = fmt % ((z_max-offset[z]) * dimscale)
+            glTranslatef(x_pos, y_pos, z_max - halfchar)
             glScalef(charsize, charsize, charsize)
             glRotatef(-90, 0, 1, 0)
             glRotatef(-90, 0, 0, 1)
@@ -588,8 +687,8 @@ class GlCanonDraw:
 
             self.color_limit(0)
             glPushMatrix()
-            f = fmt % ((g.max_extents[z] - g.min_extents[z]) * dimscale)
-            glTranslatef(x_pos, y_pos, (g.max_extents[z] + g.min_extents[z])/2)
+            f = fmt % ((z_max - z_min) * dimscale)
+            glTranslatef(x_pos, y_pos, (z_max + z_min)/2)
             glScalef(charsize, charsize, charsize)
             if view != x:
                 glRotatef(-90, 0, 0, 1)
@@ -691,7 +790,6 @@ class GlCanonDraw:
         if unit is None:
             unit = self.stat.linear_units
         lu = (unit or 1) * 25.4
-
         lus = [lu, lu, lu, 1, 1, 1, lu, lu, lu]
         return [a/b for a, b in zip(pos, lus)]
 
@@ -707,15 +805,63 @@ class GlCanonDraw:
             self.to_internal_units([fudge(ax[i]['max_position_limit'])
                 for i in range(3)]))
 
-
     def redraw(self):
         s = self.stat
         s.poll()
-
         machine_limit_min, machine_limit_max = self.soft_limits()
-
+        if 171 in self.canon.state.gcodes: # XYUV enabled
+            self.xyuv_view = True
+        else:
+            self.xyuv_view = False
         glDisable(GL_LIGHTING)
         glMatrixMode(GL_MODELVIEW)
+        # show grid
+        if self.get_view() == 2 and self.get_show_grid():
+            grid_space_read = self.canon.get_grid_space()
+            if type(grid_space_read).__name__=='tuple':
+                grid_space = 10.0
+            else:
+                grid_space = grid_space_read
+            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():
@@ -728,10 +874,12 @@ class GlCanonDraw:
             glCallList(self.dlist('program_norapids', gen=self.make_main_list))
             glCallList(self.dlist('highlight'))
 
+            if self.xyuv_view:
+                glCallList(self.dlist('XY', gen=self.make_main_list))
+                glCallList(self.dlist('UV', gen=self.make_main_list))
             if self.get_program_alpha():
                 glDisable(GL_BLEND)
                 glEnable(GL_DEPTH_TEST)
-
             if self.get_show_extents():
                 self.show_extents()
 
@@ -798,7 +946,6 @@ class GlCanonDraw:
 
                 glTranslatef(*g92_offset)
                 glCallList(alist)
-
                 glPopMatrix()
             else:
                 glCallList(alist)
@@ -852,7 +999,7 @@ class GlCanonDraw:
             glDisable(GL_LINE_STIPPLE)
             glLineStipple(2, 0xffff)
 
-        if self.get_show_live_plot():
+        if (self.get_show_live_plot() and (not self.xyuv_view)) :
             glDepthFunc(GL_LEQUAL)
             glLineWidth(3)
             glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
@@ -873,7 +1020,7 @@ class GlCanonDraw:
             glLineWidth(1)
             glDepthFunc(GL_LESS)
 
-        if self.get_show_tool():
+        if self.get_show_tool() and (not self.xyuv_view):
             pos = self.lp.last(self.get_show_live_plot())
             if pos is None: pos = [0] * 6
             rx, ry, rz = pos[3:6]
@@ -919,6 +1066,47 @@ class GlCanonDraw:
                 glCallList(self.dlist('tool'))
             glPopMatrix()
 
+        if self.xyuv_view:
+            pos = self.to_internal_units(s.joint_actual_position)
+            pos_xy = (pos[0],pos[1],self.canon.get_xy_plane_z_position()-0.25)
+            xy_plane_z_position = self.canon.get_xy_plane_z_position() 
+            uv_plane_z_position = self.canon.get_uv_plane_z_position() 
+            # xy plane cone 
+            glPushMatrix()
+            glTranslatef(*pos_xy)
+            cone_xy = self.dlist("xy_cone", gen=self.make_xy_cone)
+            glCallList(cone_xy)
+            glPopMatrix()
+            # uv plane cone 
+            glPushMatrix()
+            pos_uv = (pos[6],pos[7],self.canon.get_uv_plane_z_position())
+            glTranslatef(*pos_uv)
+            cone_uv = self.dlist("uv_cone", gen=self.make_uv_cone)
+            glCallList(cone_uv)
+            glPopMatrix()
+            #xyuv_live_plot
+            self.xyuv_live_plot_data = self.get_live_data()
+            glPushMatrix()
+            xyuv_live_plot_list=(self.dlist(('xyuv_live', self.get_view()), gen=self.draw_xyuv_live_plot))
+            glCallList(xyuv_live_plot_list)
+            glPopMatrix()
+            glNewList(xyuv_live_plot_list, GL_COMPILE)
+            s = self.stat
+            view = self.get_view()
+            glColor3f(1.0,0.0,0.0)
+            glBegin(GL_LINES)
+            if len(self.xyuv_live_plot_data) >0:
+                for line in self.xyuv_live_plot_data:
+                    glVertex3f(line[0],line[1],xy_plane_z_position+0.001)
+                    glVertex3f(line[2],line[3],uv_plane_z_position-0.001)
+            else:
+                glVertex3f(0.0,0.0,0.0)
+                glVertex3f(0.0,0.0,0.001)
+            glEnd()
+            glEndList()
+            if self.get_show_extents():
+                self.show_extents()
+
         glMatrixMode(GL_PROJECTION)
         glPushMatrix()
         glLoadIdentity()
@@ -1170,14 +1358,11 @@ class GlCanonDraw:
         x,y,z,p = 0,1,2,3
         s = self.stat
         view = self.get_view()
-
-
         glColor3f(*self.colors['axis_x'])
         glBegin(GL_LINES)
         glVertex3f(1.0,0.0,0.0)
         glVertex3f(0.0,0.0,0.0)
         glEnd()
-
         if view != x:
             glPushMatrix()
             if self.is_lathe():
@@ -1217,7 +1402,6 @@ class GlCanonDraw:
         glVertex3f(0.0,0.0,0.0)
         glVertex3f(0.0,0.0,1.0)
         glEnd()
-
         if view != z:
             glPushMatrix()
             glTranslatef(0, 0, 1.2)
@@ -1233,7 +1417,6 @@ class GlCanonDraw:
             glScalef(0.2, 0.2, 0.2)
             self.hershey.plot_string("Z", 0.5)
             glPopMatrix()
-
         glEndList()
 
     def make_cone(self, n):
@@ -1250,6 +1433,42 @@ class GlCanonDraw:
         glEndList()
         gluDeleteQuadric(q)
 
+    def make_xy_cone(self, n):
+        q = gluNewQuadric()
+        glNewList(n, GL_COMPILE)
+        #glEnable(GL_LIGHTING)
+        glColor3f(*self.colors['axis_x'])
+        gluCylinder(q, 0.1, 0, .25, 32, 1)
+        glPushMatrix()
+        glTranslatef(0,0,.25)
+        gluDisk(q, 0.25, .1, 32, 1)
+        glPopMatrix()
+        glTranslatef(0,-0.12,0.2)
+        glRotatef(0, 0, 1, 0)
+        glScalef(0.2, 0.2, 0.2)
+        self.hershey.plot_string("XY", 0.5)
+
+        #glDisable(GL_LIGHTING)
+        glEndList()
+        gluDeleteQuadric(q)
+
+    def make_uv_cone(self, n):
+        q = gluNewQuadric()
+        glNewList(n, GL_COMPILE)
+        #glEnable(GL_LIGHTING)
+        glColor3f(*self.colors['axis_z'])
+        gluCylinder(q, 0, 0.1, .25, 32, 1)
+        glPushMatrix()
+        glTranslatef(0,0,.25)
+        gluDisk(q, 0, .1, 32, 1)
+        glPopMatrix()
+        glTranslatef(0.0,-0.12,0.05)
+        glRotatef(0, 0, 1, 0)
+        glScalef(0.2, 0.2, 0.2)
+        self.hershey.plot_string("UV", 0.5)
+        #glDisable(GL_LIGHTING)
+        glEndList()
+        gluDeleteQuadric(q)
 
     lathe_shapes = [
         None,                           # 0
@@ -1330,12 +1549,20 @@ class GlCanonDraw:
     def make_selection_list(self, unused=None):
         select_rapids = self.dlist('select_rapids')
         select_program = self.dlist('select_norapids')
+        select_xy_plane = self.dlist('select_xy_plane')
+        select_uv_plane = self.dlist('select_uv_plane')
         glNewList(select_rapids, GL_COMPILE)
         if self.canon: self.canon.draw(1, False)
         glEndList()
         glNewList(select_program, GL_COMPILE)
         if self.canon: self.canon.draw(1, True)
         glEndList()
+        glNewList(select_xy_plane, GL_COMPILE)
+        if self.canon: self.canon.draw(1, True)
+        glEndList()
+        glNewList(select_uv_plane, GL_COMPILE)
+        if self.canon: self.canon.draw(1, True)
+        glEndList()
 
     def make_main_list(self, unused=None):
         program = self.dlist('program_norapids')
@@ -1343,7 +1570,6 @@ class GlCanonDraw:
         glNewList(program, GL_COMPILE)
         if self.canon: self.canon.draw(0, True)
         glEndList()
-
         glNewList(rapids, GL_COMPILE)
         if self.canon: self.canon.draw(0, False)
         glEndList()
@@ -1359,7 +1585,6 @@ class GlCanonDraw:
             self.stale_dlist('program_norapids')
             self.stale_dlist('select_rapids')
             self.stale_dlist('select_norapids')
-
         return result, seq
 
     def from_internal_units(self, pos, unit=None):
diff --git a/nc_files/foam-xyuv.ngc b/nc_files/foam-xyuv.ngc
new file mode 100644
index 0000000..82633a9
--- /dev/null
+++ b/nc_files/foam-xyuv.ngc
@@ -0,0 +1,25 @@
+(test this with axis_9axis sim mashine )
+G17.1 G21 G90 G61 G54
+(AXIS,XY_Z_POS,5)
+(AXIS,UV_Z_POS,30)
+(AXIS,GRID,5)
+
+G0 x0 y0 u0 v0
+
+(square uv 45 deg turned offset 10mm to zero )
+G0 x5 y5
+G0 x10 y10  u22.5 v22.5 
+G1 x10 y35 u10 v35 F200
+G1 x10 y60 u22.5 v47.5
+G1 x35 y60 u35 v60
+G1 x60 y60 u47.5 v47.5
+G1 x60 y35 u60 v35
+G1 x60 y10 u47.5 v22.5
+G1 x35 y10 u35 v10
+G1 X10 Y10 u22.5 v22.5
+G1 X5 Y5 U5 V5 
+G0 x0 u0
+
+G0 x0 y0 u0 v0
+M30
+%
diff --git a/share/axis/tcl/axis.tcl b/share/axis/tcl/axis.tcl
index a478b30..fed3622 100644
--- a/share/axis/tcl/axis.tcl
+++ b/share/axis/tcl/axis.tcl
@@ -343,6 +343,11 @@ setup_menu_accel .menu.view end [_ "Show e_xtents"]
 setup_menu_accel .menu.view end [_ "Show o_ffsets"]
 
 .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_machine_limits \
 	-command toggle_show_machine_limits
 setup_menu_accel .menu.view end [_ "Sh_ow machine limits"]
diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py
index 6e83b91..ae1baa9 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>
@@ -366,6 +366,14 @@ class MyOpengl(GlCanonDraw, Opengl):
         self.set_eyepoint(5.)
         self.get_resources()
         self.realize()
+        self.xyuv_plane_view_available = False   
+        self.xyuv_start = 0
+        self.xyuv_stop = 0
+        self.xyuv_live_draw = False
+        self.xyuv_live_plot_data = []
+
+    def get_live_data(self):
+        return live_plotter.get_xyuv_live_plot_data()
 
     def getRotateMode(self):
         return vars.rotate_mode.get()
@@ -528,7 +536,7 @@ class MyOpengl(GlCanonDraw, Opengl):
     def get_show_live_plot(self): return vars.show_live_plot.get()
     def get_show_machine_speed(self): return vars.show_machine_speed.get()
     def get_show_distance_to_go(self): return vars.show_distance_to_go.get()
-
+    def get_show_grid(self): return vars.show_grid.get()
     def get_view(self):
         x,y,z,p = 0,1,2,3
         if str(widgets.view_x['relief']) == "sunken":
@@ -542,7 +550,6 @@ class MyOpengl(GlCanonDraw, Opengl):
             view = p
         return view
 
-
     def get_show_relative(self): return vars.coord_type.get()
     def get_show_limits(self): return vars.show_machine_limits.get()
     def get_show_tool(self): return vars.show_tool.get()
@@ -553,7 +560,7 @@ class MyOpengl(GlCanonDraw, Opengl):
         if self.select_event:
             self.select(self.select_event)
             self.select_event = None
-
+        GlCanonDraw.set_xyuv_live_plot_data(self,self.xyuv_live_plot_data)
         GlCanonDraw.redraw(self)
 
     def redraw_dro(self):
@@ -671,7 +678,11 @@ class LivePlotter:
         self.notifications_clear = False
         self.notifications_clear_info = False
         self.notifications_clear_error = False
-
+        self.xyuv_live_plot=[]
+    
+    def get_xyuv_live_plot_data(self):
+        return self.xyuv_live_plot
+    
     def start(self):
         if self.running.get(): return
         if not os.path.exists(linuxcnc.nmlfile):
@@ -817,6 +828,9 @@ class LivePlotter:
             root_window.tk.call("update_maxvel_slider")
         vupdate(vars.override_limits, self.stat.axis[0]['override_limits'])
         on_any_limit = 0
+        if self.stat.motion_line > 1 :
+            actual_xyuv=self.stat.actual_position
+            self.xyuv_live_plot.append((actual_xyuv[0],actual_xyuv[1],actual_xyuv[6],actual_xyuv[7]))
         for i, l in enumerate(self.stat.limit):
             if self.stat.axis_mask & (1<<i) and l:
                 on_any_limit = True
@@ -860,6 +874,7 @@ class LivePlotter:
 
     def clear(self):
         self.logger.clear()
+        self.xyuv_live_plot=[]
         o.redraw_soon()
 
 def running(do_poll=True):
@@ -971,6 +986,10 @@ class AxisCanon(GLCanon, StatMixin):
         self.progress = progress
         self.aborted = False
         self.arcdivision = arcdivision
+        self.xyuv_live_plot_data=[]
+
+    def set_xyuv_live_plot_data(self,data):
+        self.xyuv_live_plot_data=data
 
     def change_tool(self, pocket):
         GLCanon.change_tool(self, pocket)
@@ -1049,7 +1068,7 @@ def add_recent_file(f):
 def cancel_open(event=None):
     if o.canon is not None:
         o.canon.aborted = True
-
+    
 loaded_file = None
 def open_file_guts(f, filtered=False, addrecent=True):
     if addrecent:
@@ -1092,7 +1111,11 @@ def open_file_guts(f, filtered=False, addrecent=True):
         t.tk.call("delete_all", t)
         code = []
         i = 0
+        xyuv = 0
+        grid_view_declared = False
         for i, l in enumerate(lines):
+            if 'GRID' in l:grid_view_declared = True
+            if ('G17.1' in l):xyuv = 1
             l = l.expandtabs().replace("\r", "")
             #t.insert("end", "%6d: " % (i+1), "lineno", l)
             code.extend(["%6d: " % (i+1), "lineno", l, ""])
@@ -1105,6 +1128,16 @@ def open_file_guts(f, filtered=False, addrecent=True):
         progress.nextphase(len(lines))
         f = os.path.abspath(f)
         o.canon = canon = AxisCanon(o, widgets.text, i, progress, arcdivision)
+        if xyuv == 1:
+            vupdate(vars.show_live_plot,False)
+        else:
+            vupdate(vars.show_live_plot,True)
+        if not grid_view_declared: # enable Disable grid view
+            vupdate(vars.show_grid,False)
+            widgets.menu_view.entryconfigure("Show Grid",state=DISABLED)
+        else:
+            vupdate(vars.show_grid,True)
+            widgets.menu_view.entryconfigure("Show Grid",state=NORMAL)
         root_window.bind_class(".info.progress", "<Escape>", cancel_open)
 
         parameter = inifile.find("RS274NGC", "PARAMETER_FILE")
@@ -2177,6 +2210,10 @@ class TclCommands(nf.TclCommands):
     def toggle_program_alpha(*event):
         ap.putpref("program_alpha", vars.program_alpha.get())
         o.tkRedraw()
+        
+    def toggle_show_grid(*event):
+        ap.putpref("show_grid", vars.show_grid.get())
+        o.tkRedraw()
 
     def toggle_show_live_plot(*event):
         ap.putpref("show_live_plot", vars.show_live_plot.get())
@@ -2538,6 +2575,8 @@ vars = nf.Variables(root_window,
     ("touch_off_system", StringVar),
     ("machine", StringVar),
     ("on_any_limit", BooleanVar),
+    ("show_grid", IntVar),
+
 )
 vars.linuxcnctop_command.set(os.path.join(os.path.dirname(sys.argv[0]), "linuxcnctop"))
 vars.highlight_line.set(-1)
@@ -2556,6 +2595,7 @@ vars.show_distance_to_go.set(ap.getpref("show_distance_to_go", False))
 vars.dro_large_font.set(ap.getpref("dro_large_font", False))
 vars.block_delete.set(ap.getpref("block_delete", True))
 vars.optional_stop.set(ap.getpref("optional_stop", True))
+vars.show_grid.set(ap.getpref("show_grid", True))
 
 # placeholder function for LivePlotter.update():
 def user_live_update():
-- 
1.7.0.4

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to