def __init__(self): self.hal = hal.component("pendant-menu") self.hal.newpin("axis-select", hal.HAL_S32, hal.HAL_IN) self.hal.newpin("multiplier-select", hal.HAL_S32, hal.HAL_IN) self.hal.newpin("menu1", hal.HAL_BIT, hal.HAL_IN) self.hal.newpin("menu2", hal.HAL_BIT, hal.HAL_IN) self.hal.newpin("menu3", hal.HAL_BIT, hal.HAL_IN) self.hal.newpin("menu4", hal.HAL_BIT, hal.HAL_IN) self.hal.newpin("enable", hal.HAL_BIT, hal.HAL_IN) self.hal.newpin("spindle-speed", hal.HAL_FLOAT, hal.HAL_IN) self.hal.newpin("page", hal.HAL_U32, hal.HAL_OUT) self.hal.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN) self.hal.newpin("tool-changed",hal.HAL_BIT, hal.HAL_OUT) self.hal.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN) self.hal.newpin("jog-wheel", hal.HAL_S32, hal.HAL_IN) self.hal.ready() self.stat = emc.stat() self.cmd = emc.command() self.loadToolTable()
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import sys, os BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")) sys.path.insert(0, os.path.join(BASE, "lib", "python")) import emc if len(sys.argv) > 1: emc.nmlfile = sys.argv[1] c = emc.command() c.mode(emc.MODE_MDI) s = emc.stat() try: while 1: mdi = raw_input("MDI> ") if mdi == '': s.poll() print s.position else: c.mdi(mdi) except (SystemExit, EOFError, KeyboardInterrupt): pass # vim:sw=4:sts=4:et:
#limits = [( -1,-1 ),(1,1) ] maxValue = [0.0, 100.0, 22.0, 22.0, 150.0, 10.0, 98.0, 22.0, 2.0, 100.0] command = emc.command() status = emc.stat() class motionProgram(): def __init__(self, mp=None): #print "init motionControlProgram" if mp: print "MOTION PROGRAM: Creating copy" self.program = copy.deepcopy(mp.program) self.program[0] = self.program[0] + _(" (COPY)") else: print "MOTION PROGRAM: Creating new default" self.program = [_('Default Program'), 90, 0,
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import emc import Tkinter import sys linenumber = 1; if len(sys.argv) > 1: emc.nmlfile = sys.argv[1] if len(sys.argv) > 2: outfile = sys.argv[2] sys.stdout = open(outfile, 'w') s = emc.stat() def get_cart(): s.poll() position = " ".join(["%-8.4f"] * s.axes) return position % s.position[:s.axes] def get_joint(): s.poll() position = " ".join(["%-8.4f"] * s.axes) return position % s.joint_actual_position[:s.axes] def log(): global linenumber; if world.get(): p = get_cart()
def periodic_radiobuttons(self): self.radiobutton_mask = 1 s = emc.stat() s.poll() am = s.axis_mask if not self.resized_wheelbuttons: at = self.wTree.get_widget("axis_table") for i in range(9): b = [ "wheelx", "wheely", "wheelz", "wheela", "wheelb", "wheelc", "wheelu", "wheelv", "wheelw" ][i] w = self.wTree.get_widget(b) if not (am & (1 << i)): at.remove(w) if (am & 0700) == 0: at.resize(3, 2) if (am & 070) == 0: at.resize(3, 1) self.wTree.get_widget("wheel_hbox").set_homogeneous(1) self.resized_wheelbuttons = 1 set_active(self.wTree.get_widget("wheelx"), self.wheelxyz == 0) set_active(self.wTree.get_widget("wheely"), self.wheelxyz == 1) set_active(self.wTree.get_widget("wheelz"), self.wheelxyz == 2) set_active(self.wTree.get_widget("wheela"), self.wheelxyz == 3) set_active(self.wTree.get_widget("wheelb"), self.wheelxyz == 4) set_active(self.wTree.get_widget("wheelc"), self.wheelxyz == 5) set_active(self.wTree.get_widget("wheelu"), self.wheelxyz == 6) set_active(self.wTree.get_widget("wheelv"), self.wheelxyz == 7) set_active(self.wTree.get_widget("wheelw"), self.wheelxyz == 8) set_active(self.wTree.get_widget("wheelinc1"), self.wheelinc == 0) set_active(self.wTree.get_widget("wheelinc2"), self.wheelinc == 1) set_active(self.wTree.get_widget("wheelinc3"), self.wheelinc == 2) set_active(self.wTree.get_widget("fo"), self.wheel == "fo") set_active(self.wTree.get_widget("so"), self.wheel == "so") set_active(self.wTree.get_widget("mv"), self.wheel == "mv") set_active(self.wTree.get_widget("jogging"), self.wheel == "jogging") set_active(self.wTree.get_widget("pointer_show"), not self.invisible_cursor) set_active(self.wTree.get_widget("pointer_hide"), self.invisible_cursor) self.radiobutton_mask = 0 if self.wheel == "jogging": self.hal.jogaxis(self.wheelxyz) else: # disable all self.hal.jogaxis(-1) self.hal.jogincrement(self.wheelinc) d = self.hal.wheel() if self.wheel == "fo": self.fo_val += d if self.fo_val < 0: self.fo_val = 0 if d != 0: self.emc.feed_override(self.fo_val) if self.wheel == "so": self.so_val += d if self.so_val < 0: self.so_val = 0 if d != 0: self.emc.spindle_override(self.so_val) if self.wheel == "mv": self.mv_val += d if self.mv_val < 0: self.mv_val = 0 if d != 0: self.emc.max_velocity(self.mv_val) self.emc.continuous_jog_velocity(self.mv_val) set_label(self.wTree.get_widget("fo").child, "FO: %d%%" % self.fo_val) set_label(self.wTree.get_widget("so").child, "SO: %d%%" % self.so_val) set_label(self.wTree.get_widget("mv").child, "MV: %d" % self.mv_val) return True
def periodic_radiobuttons(self): self.radiobutton_mask = 1 s = emc.stat() s.poll() am = s.axis_mask if not self.resized_wheelbuttons: at = self.wTree.get_widget("axis_table") for i in range(9): b = ["wheelx", "wheely", "wheelz", "wheela", "wheelb", "wheelc", "wheelu", "wheelv", "wheelw"][i] w = self.wTree.get_widget(b) if not (am & (1<<i)): at.remove(w) if (am & 0700) == 0: at.resize(3, 2) if (am & 070) == 0: at.resize(3, 1) self.wTree.get_widget("wheel_hbox").set_homogeneous(1) self.resized_wheelbuttons = 1 set_active(self.wTree.get_widget("wheelx"), self.wheelxyz == 0) set_active(self.wTree.get_widget("wheely"), self.wheelxyz == 1) set_active(self.wTree.get_widget("wheelz"), self.wheelxyz == 2) set_active(self.wTree.get_widget("wheela"), self.wheelxyz == 3) set_active(self.wTree.get_widget("wheelb"), self.wheelxyz == 4) set_active(self.wTree.get_widget("wheelc"), self.wheelxyz == 5) set_active(self.wTree.get_widget("wheelu"), self.wheelxyz == 6) set_active(self.wTree.get_widget("wheelv"), self.wheelxyz == 7) set_active(self.wTree.get_widget("wheelw"), self.wheelxyz == 8) set_active(self.wTree.get_widget("wheelinc1"), self.wheelinc == 0) set_active(self.wTree.get_widget("wheelinc2"), self.wheelinc == 1) set_active(self.wTree.get_widget("wheelinc3"), self.wheelinc == 2) set_active(self.wTree.get_widget("fo"), self.wheel == "fo") set_active(self.wTree.get_widget("so"), self.wheel == "so") set_active(self.wTree.get_widget("mv"), self.wheel == "mv") set_active(self.wTree.get_widget("jogging"), self.wheel == "jogging") set_active(self.wTree.get_widget("pointer_show"), not self.invisible_cursor) set_active(self.wTree.get_widget("pointer_hide"), self.invisible_cursor) self.radiobutton_mask = 0 if self.wheel == "jogging": self.hal.jogaxis(self.wheelxyz) else: # disable all self.hal.jogaxis(-1) self.hal.jogincrement(self.wheelinc) d = self.hal.wheel() if self.wheel == "fo": self.fo_val += d if self.fo_val < 0: self.fo_val = 0 if d != 0: self.emc.feed_override(self.fo_val) if self.wheel == "so": self.so_val += d if self.so_val < 0: self.so_val = 0 if d != 0: self.emc.spindle_override(self.so_val) if self.wheel == "mv": self.mv_val += d if self.mv_val < 0: self.mv_val = 0 if d != 0: self.emc.max_velocity(self.mv_val) self.emc.continuous_jog_velocity(self.mv_val) set_label(self.wTree.get_widget("fo").child, "FO: %d%%" % self.fo_val) set_label(self.wTree.get_widget("so").child, "SO: %d%%" % self.so_val) set_label(self.wTree.get_widget("mv").child, "MV: %d" % self.mv_val) return True
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import sys, os import emc, time import rs274.options if len(sys.argv) > 1 and sys.argv[1] == '-ini': ini = emc.ini(sys.argv[2]) emc.nmlfile = ini.find("EMC", "NML_FILE") or emc.nmlfile del sys.argv[1:3] s = emc.stat(); s.poll() def show_mcodes(l): return " ".join(["M%g" % i for i in l[1:] if i != -1]) def show_gcodes(l): return " ".join(["G%g" % (i/10.) for i in l[1:] if i != -1]) def show_position(p): return " ".join(["%-8.4f" % n for i, n in enumerate(p) if s.axis_mask & (1<<i)]) joint_position = " ".join(["%-8.4f"] * s.joints) def show_joint_position(p): return joint_position % p[:s.joints] perjoint = " ".join(["%s"] * s.joints)
_('Forming Dwell'), _('Tube Stop Position X '), _('Tube Stop Position Y'), _('Vice Unclamp Timer'), _('Clearance Position X') ] isNumeric = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1] units = ['', 'mm', 'mm', 'mm', 'mm/s', 's', 'mm', 'mm', 's', 'mm'] #limits = [( -1,-1 ),(1,1) ] maxValue = [0.0, 100.0, 22.0, 22.0, 150.0, 10.0, 98.0, 22.0, 2.0, 100.0] command = emc.command() status = emc.stat() class motionProgram(): def __init__(self, mp=None): #print "init motionControlProgram" if mp: print "MOTION PROGRAM: Creating copy" self.program = copy.deepcopy(mp.program) self.program[0] = self.program[0] + _(" (COPY)") else: print "MOTION PROGRAM: Creating new default" self.program = [ _('Default Program'), 90, 0, 0, 50, 1, 25, 5, 0.5, 0 ]