Hi this is the new working patch for/From the Git
it is recomendet to load the 9Axis simulation for Testing this
ngc file in the patch
Sammel Lothar
Germany
>From 3d2d8d5fc86323416a82e682a2e4a04e324ea8b7 Mon Sep 17 00:00:00 2001
From: Sammel Lothar <sammellot...@gmx.de>
Date: Tue, 17 Jan 2012 11:16:03 +0100
Subject: [PATCH] xyuv_Foam_axis_modification_2.6-pre
---
lib/python/hershey.py | 10 +-
lib/python/rs274/glcanon.py | 308 +++++++++++++++++++++++++++++++--
nc_files/xyuv_foam_test_profile.ngc | 31 ++++
share/axis/tcl/axis.tcl | 10 +
src/emc/usr_intf/axis/scripts/axis.py | 117 ++++++++++++-
5 files changed, 452 insertions(+), 24 deletions(-)
create mode 100644 nc_files/xyuv_foam_test_profile.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 4c20266..73f0f05 100644
--- a/lib/python/rs274/glcanon.py
+++ b/lib/python/rs274/glcanon.py
@@ -78,6 +78,12 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
self.g5x_offset_u = 0.0
self.g5x_offset_v = 0.0
self.g5x_offset_w = 0.0
+ self.xy_feed = []; self.xy_feed_append = self.xy_feed.append
+ self.uv_feed = []; self.uv_feed_append = self.uv_feed.append
+ 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 +92,37 @@ 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 get_xy_feed(self):return self.xy_feed
+ def get_uv_feed(self):return self.uv_feed
+
def message(self, message): pass
def check_abort(self): pass
@@ -241,7 +277,9 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
else:
self.color_with_alpha('straight_feed')
self.draw_lines(self.feed, for_selection, len(self.traverse))
-
+ for line in self.feed:
+ self.xy_feed_append((line[1][0],line[1][1],self.get_xy_plane_z_position()))
+ self.uv_feed_append((line[1][6],line[1][7],self.get_uv_plane_z_position()))
if for_selection:
self.color('arc_feed')
else:
@@ -320,6 +358,75 @@ class GlCanonDraw:
self.select_buffer_size = 100
self.cached_tool = -1
self.initialised = 0
+ self.redraw_count = 0
+ self.xyuv_live_plot_data = []
+
+ 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 draw_xy_plane(self, n):
+ glNewList(n, GL_COMPILE)
+ s = self.stat
+ view = self.get_view()
+ glColor3f(*self.colors['axis_x'])
+ xy_feed = self.canon.get_xy_feed()
+ glBegin(GL_LINES)
+ xy_plane_z_position= self.canon.get_xy_plane_z_position()
+ first=True
+ for line in xy_feed:
+ if not first:
+ glVertex3f(start[0],start[1],xy_plane_z_position)
+ glVertex3f(line[0],line[1],xy_plane_z_position)
+ start=line
+ else:
+ start=line
+ first=False
+ glEnd()
+ glTranslatef(xy_feed[0][0]-0.15,xy_feed[0][1]-0.15,xy_plane_z_position)
+ glRotatef(0, 0, 1, 0)
+ glScalef(0.1, 0.1, 0.1)
+ self.hershey.plot_string("XY", 0.5)
+ glEndList()
+
+ def draw_uv_plane(self, n):
+ uv_plane_z_position=self.canon.get_uv_plane_z_position()
+ glNewList(n, GL_COMPILE)
+ s = self.stat
+ view = self.get_view()
+ glColor3f(*self.colors['axis_z'])
+ uv_feed = self.canon.get_uv_feed()
+ glBegin(GL_LINES)
+ first=True
+ for line in uv_feed:
+ if not first:
+ glVertex3f(start[0],start[1],uv_plane_z_position)
+ glVertex3f(line[0],line[1],uv_plane_z_position)
+ start=line
+ else:
+ start=line
+ first=False
+ glEnd()
+ glTranslatef(uv_feed[0][0]-0.15,uv_feed[0][1]-0.15,uv_plane_z_position)
+ glRotatef(0, 0, 1, 0)
+ glScalef(0.1, 0.1, 0.1)
+ self.hershey.plot_string("UV", 0.5)
+ glEndList()
def realize(self):
self.hershey = hershey.Hershey()
@@ -327,6 +434,10 @@ 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
@@ -546,6 +657,22 @@ 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.get_show_xy_uv_planes():
+ 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()
@@ -554,7 +681,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_ma = g.max_extents[z]
+ z_mi = g.min_extents[z]
+ if self.get_show_xy_uv_planes():
+ z_ma = uv_z
+ z_mi = xy_z
+ if view != z and z_ma > z_mi:
if view == x:
x_pos = g.min_extents[x] - pullback
y_pos = g.min_extents[y] - 6.0*dashwidth
@@ -562,10 +694,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_mi < 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_mi-offset[z]) * dimscale)
+ glTranslatef(x_pos, y_pos, z_mi - halfchar)
glScalef(charsize, charsize, charsize)
glRotatef(-90, 0, 1, 0)
glRotatef(-90, 0, 0, 1)
@@ -574,10 +706,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_ma > 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_ma-offset[z]) * dimscale)
+ glTranslatef(x_pos, y_pos, z_ma - halfchar)
glScalef(charsize, charsize, charsize)
glRotatef(-90, 0, 1, 0)
glRotatef(-90, 0, 0, 1)
@@ -588,8 +720,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_ma - z_mi) * dimscale)
+ glTranslatef(x_pos, y_pos, (z_ma + z_mi)/2)
glScalef(charsize, charsize, charsize)
if view != x:
glRotatef(-90, 0, 0, 1)
@@ -717,7 +849,70 @@ class GlCanonDraw:
glDisable(GL_LIGHTING)
glMatrixMode(GL_MODELVIEW)
- if self.get_show_program():
+ # 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_xy_uv_planes():
+ if self.redraw_count < 2 :
+ show_programm = True
+ else:
+ show_programm = False
+ else:
+ self.redraw_count = 0
+ if self.get_show_program():
+ show_programm = True
+ else:
+ show_programm = False
+ if show_programm:
+ if self.redraw_count < 5 :
+ self.redraw_count +=1
+
if self.get_program_alpha():
glDisable(GL_DEPTH_TEST)
glEnable(GL_BLEND)
@@ -732,8 +927,8 @@ class GlCanonDraw:
glDisable(GL_BLEND)
glEnable(GL_DEPTH_TEST)
- if self.get_show_extents():
- self.show_extents()
+ if self.get_show_extents():
+ self.show_extents()
if self.get_show_live_plot() or self.get_show_program():
@@ -873,7 +1068,7 @@ class GlCanonDraw:
glLineWidth(1)
glDepthFunc(GL_LESS)
- if self.get_show_tool():
+ if self.get_show_tool() and not self.get_show_xy_uv_planes():
pos = self.lp.last(self.get_show_live_plot())
if pos is None: pos = [0] * 6
rx, ry, rz = pos[3:6]
@@ -910,7 +1105,10 @@ class GlCanonDraw:
cone_scale = 1
if self.is_lathe():
glRotatef(90, 0, 1, 0)
- cone = self.dlist("cone", gen=self.make_cone)
+ if self.get_show_xy_uv_planes():
+ cone = self.dlist("cone", gen=self.make_xy_cone)
+ else:
+ cone = self.dlist("cone", gen=self.make_cone)
glScalef(cone_scale, cone_scale, cone_scale)
glCallList(cone)
else:
@@ -918,6 +1116,51 @@ class GlCanonDraw:
self.cache_tool(current_tool)
glCallList(self.dlist('tool'))
glPopMatrix()
+ if self.get_show_xy_uv_planes():
+ pos_aktuell = s.joint_actual_position
+ 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_aktuell[0],pos_aktuell[1],xy_plane_z_position-0.25)
+ cone_xy = self.dlist("cone", gen=self.make_xy_cone)
+ glCallList(cone_xy)
+ glPopMatrix()
+ # uv plane cone
+ glPushMatrix()
+ glTranslatef(pos_aktuell[6],pos_aktuell[7],uv_plane_z_position)
+ cone_uv = self.dlist("uvcone", gen=self.make_uv_cone)
+ glCallList(cone_uv)
+ glPopMatrix()
+ glPushMatrix()
+ xylist=self.dlist(('xy_plane', self.get_view()), gen=self.draw_xy_plane)
+ glCallList(xylist)
+ glPopMatrix()
+ #uv_plane redraw
+ glPushMatrix()
+ uvlist=(self.dlist(('uv_plane', self.get_view()), gen=self.draw_uv_plane))
+ glCallList(uvlist)
+ 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)
+ 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()
glMatrixMode(GL_PROJECTION)
glPushMatrix()
@@ -1170,9 +1413,8 @@ class GlCanonDraw:
x,y,z,p = 0,1,2,3
s = self.stat
view = self.get_view()
-
-
glColor3f(*self.colors['axis_x'])
+ glLineWidth(2.0)
glBegin(GL_LINES)
glVertex3f(1.0,0.0,0.0)
glVertex3f(0.0,0.0,0.0)
@@ -1233,7 +1475,7 @@ class GlCanonDraw:
glScalef(0.2, 0.2, 0.2)
self.hershey.plot_string("Z", 0.5)
glPopMatrix()
-
+ glLineWidth(1.0)
glEndList()
def make_cone(self, n):
@@ -1250,6 +1492,34 @@ 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()
+ #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()
+ #glDisable(GL_LIGHTING)
+ glEndList()
+ gluDeleteQuadric(q)
+
lathe_shapes = [
None, # 0
diff --git a/nc_files/xyuv_foam_test_profile.ngc b/nc_files/xyuv_foam_test_profile.ngc
new file mode 100644
index 0000000..3a82a9a
--- /dev/null
+++ b/nc_files/xyuv_foam_test_profile.ngc
@@ -0,0 +1,31 @@
+(test XY UV emc2 9 achsen )
+G17.1 G21 G90 G61 G54
+(AXIS,XY_Z_POS,5)
+(AXIS,UV_Z_POS,30)
+(AXIS,GRID,5)
+
+G0 x0 y0 b0 u0 v0
+
+(square uv 45 deg turned offset 10mm 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 b0 u0 v0
+M30
+
+
+
+
+
+
+
diff --git a/share/axis/tcl/axis.tcl b/share/axis/tcl/axis.tcl
index 769228e..f276c9b 100644
--- a/share/axis/tcl/axis.tcl
+++ b/share/axis/tcl/axis.tcl
@@ -318,6 +318,11 @@ setup_menu_accel .menu.view end [_ "S_how program"]
setup_menu_accel .menu.view end [_ "Show program r_apids"]
.menu.view add checkbutton \
+ -variable show_xy_uv_planes \
+ -command toggle_show_xy_uv_planes
+setup_menu_accel .menu.view end [_ "Show XYUV Plane"]
+
+.menu.view add checkbutton \
-variable program_alpha \
-command toggle_program_alpha
setup_menu_accel .menu.view end [_ "Alpha-_blend program"]
@@ -343,6 +348,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 7d6cfd4..9509749 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 emc
# 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,6 +536,10 @@ 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_xy_uv_planes(self): return vars.show_xy_uv_planes.get()
+ def get_xyuv_live_plot_data(self):return self.xyuv_live_plot
+
+ def get_show_grid(self): return vars.show_grid.get()
def get_view(self):
x,y,z,p = 0,1,2,3
@@ -546,6 +558,8 @@ class MyOpengl(GlCanonDraw, Opengl):
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()
+ def set_xyuv_live_plot_data(self,data):self.xyuv_live_plot=data
+
def redraw(self):
if not self.winfo_viewable():
return self.redraw_dro()
@@ -553,7 +567,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,6 +685,13 @@ class LivePlotter:
self.notifications_clear = False
self.notifications_clear_info = False
self.notifications_clear_error = False
+ self.xyuv_start = 0
+ self.xyuv_stop = 0
+ self.xyuv_run = 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
@@ -817,6 +838,16 @@ class LivePlotter:
root_window.tk.call("update_maxvel_slider")
vupdate(vars.override_limits, self.stat.axis[0]['override_limits'])
on_any_limit = 0
+ if o.canon.xyuv_plane_view_available: # xyuv live draw switch
+ if o.canon.xyuv_start == self.stat.motion_line:
+ o.canon.xyuv_live_draw = True
+ self.xyuv_run=True
+ if o.canon.xyuv_stop == self.stat.motion_line :
+ o.canon.xyuv_live_draw = False
+ self.xyuv_run = False
+ if self.xyuv_run and self.stat.motion_mode == 2:
+ aktuell_xyuv=self.stat.actual_position
+ self.xyuv_live_plot.append((aktuell_xyuv[0],aktuell_xyuv[1],aktuell_xyuv[6],aktuell_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 +891,7 @@ class LivePlotter:
def clear(self):
self.logger.clear()
+ self.xyuv_live_plot=[]
o.redraw_soon()
def running(do_poll=True):
@@ -971,6 +1003,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)
@@ -1050,6 +1086,25 @@ def cancel_open(event=None):
if o.canon is not None:
o.canon.aborted = True
+def set_grid_view(available):
+ if o.canon is not None:
+ o.canon.grid_view_available = available
+
+def set_xyuv_plane(available):
+ if o.canon is not None:
+ o.canon.xyuv_plane_view_available = available
+
+def set_xyuv_plane_liveplot_lines(canon,start,stop):
+ if canon is not None:
+ canon.xyuv_start = start
+ canon.xyuv_stop = stop
+ o.canon.xyuv_start = start
+ o.canon.xyuv_stop = stop
+
+def set_xyuv_plane_view_available(available):
+ if o.canon is not None:
+ o.canon.xyuv_plane_view_available = available
+
loaded_file = None
def open_file_guts(f, filtered=False, addrecent=True):
if addrecent:
@@ -1092,9 +1147,34 @@ def open_file_guts(f, filtered=False, addrecent=True):
t.tk.call("delete_all", t)
code = []
i = 0
+ xyuv = 0
+ search_g0_g1_change = False
+ search_g1_g0_change = False
+ grid_view_declared = False
for i, l in enumerate(lines):
+ if 'GRID' in l:grid_view_declared = True
+ if ('G17.1' in l) and (xyuv == 0) :
+ set_xyuv_plane(1)
+ xyuv = 1
+ search_g0_g1_change = True
+ else:
+ set_xyuv_plane(0)
l = l.expandtabs().replace("\r", "")
#t.insert("end", "%6d: " % (i+1), "lineno", l)
+ # XYUV searching the contour
+ linesplit=l.split()
+ if search_g1_g0_change and len(linesplit) > 0:
+ if ('G0' or 'G00') in linesplit[0] :
+ xyuv_stop_pos_line = i+1
+ search_g0_g1_change=False
+ search_g1_g0_change=False
+ #recomending G0 lines at start direct followed by G1
+ if search_g0_g1_change and len(linesplit) > 0:
+ if linesplit[0]=='G1' :
+ xyuv_start_pos_line = i
+ search_g0_g1_change=False
+ search_g1_g0_change=True
+ # XYUV contour search end
code.extend(["%6d: " % (i+1), "lineno", l, ""])
if i % 1000 == 0:
t.insert("end", *code)
@@ -1105,6 +1185,24 @@ 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:
+ set_xyuv_plane_liveplot_lines(o.canon,xyuv_start_pos_line,xyuv_stop_pos_line)
+ set_xyuv_plane_view_available(True)
+ vupdate(vars.show_xy_uv_planes,True)
+ vupdate(vars.show_live_plot,False)
+ widgets.menu_view.entryconfigure("Show XYUV Plane",state=NORMAL)
+ wiget_index = widgets.menu_view.index("Show XYUV Plane")
+ widgets.menu_view.entryconfigure(wiget_index+2,state=DISABLED)
+ else:
+ set_xyuv_plane_view_available(False)
+ vupdate(vars.show_xy_uv_planes,False)
+ widgets.menu_view.entryconfigure("Show XYUV Plane",state=DISABLED)
+ 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")
@@ -1892,6 +1990,8 @@ class TclCommands(nf.TclCommands):
elif cmd == "reload_file":
commands.reload_file()
elif cmd == "destroy":
+ vupdate(vars.show_program,True)
+ vupdate(vars.show_xy_uv_planes,False)
root_window.tk.call("destroy", ".")
return ""
@@ -2178,6 +2278,14 @@ class TclCommands(nf.TclCommands):
ap.putpref("program_alpha", vars.program_alpha.get())
o.tkRedraw()
+ def toggle_show_xy_uv_planes(*event):
+ ap.putpref("show_xy_uv_planes", vars.show_xy_uv_planes.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())
o.tkRedraw()
@@ -2538,6 +2646,9 @@ vars = nf.Variables(root_window,
("touch_off_system", StringVar),
("machine", StringVar),
("on_any_limit", BooleanVar),
+ ("show_xy_uv_planes", IntVar),
+ ("show_grid", IntVar),
+
)
vars.emctop_command.set(os.path.join(os.path.dirname(sys.argv[0]), "emctop"))
vars.highlight_line.set(-1)
@@ -2556,6 +2667,8 @@ 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_xy_uv_planes.set(ap.getpref("show_xy_uv_planes", False))
+vars.show_grid.set(ap.getpref("show_grid", True))
# placeholder function for LivePlotter.update():
def user_live_update():
--
1.7.0.4
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers