From: Chris M. <gi...@gi...> - 2017-02-19 22:08:12
|
qtvcp -add linuxcnc command functions to GSTAT hmm maybe GSTAT isn't a good name now.. Signed-off-by: Chris Morley <chr...@ho...> Signed-off-by: chris morley <chr...@ho...> http://git.linuxcnc.org/?p=linuxcnc.git;a=commitdiff;h=c2bb1f3 --- lib/python/qtvcp/qt_glib.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/python/qtvcp/qt_glib.py b/lib/python/qtvcp/qt_glib.py index b9bf19f..ab0e421 100644 --- a/lib/python/qtvcp/qt_glib.py +++ b/lib/python/qtvcp/qt_glib.py @@ -153,6 +153,7 @@ class _GStat(gobject.GObject): def __init__(self, stat = None): gobject.GObject.__init__(self) self.stat = stat or linuxcnc.stat() + self.cmd = linuxcnc.command() self.old = {} try: self.stat.poll() @@ -564,6 +565,35 @@ class _GStat(gobject.GObject): print self.old['mode'] , linuxcnc.MODE_AUTO return self.old['state'] == linuxcnc.MODE_AUTO + def set_tool_touchoff(self,tool,axis,value): + premode = None + m = "G10 L10 P%d %s%f"%(tool,axis,value) + self.stat.poll() + if self.stat.task_mode != linuxcnc.MODE_MDI: + premode = self.stat.task_mode + self.cmd.mode(linuxcnc.MODE_MDI) + self.cmd.wait_complete() + self.cmd.mdi(m) + self.cmd.wait_complete() + self.cmd.mdi("g43") + self.cmd.wait_complete() + if premode: + self.cmd.mode(premode) + + def set_axis_origin(self,axis,value): + premode = None + m = "G10 L20 P0 %s%f"%(axis,value) + self.stat.poll() + if self.stat.task_mode != linuxcnc.MODE_MDI: + premode = self.stat.task_mode + self.cmd.mode(linuxcnc.MODE_MDI) + self.cmd.wait_complete() + self.cmd.mdi(m) + self.cmd.wait_complete() + if premode: + self.cmd.mode(premode) + self.emit('reload-display') + def __getitem__(self, item): return getattr(self, item) def __setitem__(self, item, value): |