def _wcsSet(self, x, y, z): # global wcsvar # p = wcsvar.get() p = WCS.index(CNC.vars["WCS"]) if p < 6: cmd = "G10L20P%d" % (p + 1) elif p == 6: cmd = "G28.1" elif p == 7: cmd = "G30.1" elif p == 8: cmd = "G92" pos = "" if x is not None and abs(float(x)) < 10000.0: pos += "X" + str(x) if y is not None and abs(float(y)) < 10000.0: pos += "Y" + str(y) if z is not None and abs(float(z)) < 10000.0: pos += "Z" + str(z) cmd += pos self.master.sendGCode(cmd) self.viewParameters() self.master.event_generate("<<Status>>", data=(_("Set workspace %s to %s") % (WCS[p], pos))) # data=(_("Set workspace %s to %s")%(WCS[p],pos))) self.master.event_generate("<<CanvasFocus>>")
def _wcsSet(self, x, y, z, a=None, b=None, c=None): # Updating WorkCoordinates.txt file parameters = self.getParameters() #global wcsvar #p = wcsvar.get() p = WCS.index(CNC.vars["WCS"]) if p < 6: cmd = "G10L20P%d" % (p + 1) elif p == 6: cmd = "G28.1" elif p == 7: cmd = "G30.1" elif p == 8: cmd = "G92" pos = "" if x is not None and abs(float(x)) < 10000.0: pos += "X" + str(x) parameters[p + 1]['X'] = str(CNC.vars['mx'] - float(x)) if y is not None and abs(float(y)) < 10000.0: pos += "Y" + str(y) parameters[p + 1]['Y'] = str(CNC.vars['my'] - float(y)) if z is not None and abs(float(z)) < 10000.0: pos += "Z" + str(z) parameters[p + 1]['Z'] = str(CNC.vars['mz'] - float(z)) if a is not None and abs(float(a)) < 10000.0: pos += "A" + str(a) parameters[p + 1]['A'] = str(CNC.vars['ma'] - float(a)) if b is not None and abs(float(b)) < 10000.0: pos += "B" + str(b) parameters[p + 1]['B'] = str(CNC.vars['mb'] - float(b)) if c is not None and abs(float(c)) < 10000.0: pos += "C" + str(c) parameters[p + 1]['C'] = str(CNC.vars['mc'] - float(c)) cmd += pos self.master.sendGCode(cmd) self.saveParameters(parameters) self.viewParameters() self.master.event_generate("<<Status>>", data=(_("Set workspace %s to %s") % (WCS[p], pos))) #data=(_("Set workspace %s to %s")%(WCS[p],pos))) self.master.event_generate("<<CanvasFocus>>")
def _wcsSet(self, x, y, z): p = WCS.index(CNC.vars["WCS"]) if p<6: cmd = "G10L20P%d"%(p+1) elif p==6: cmd = "G28.1" elif p==7: cmd = "G30.1" elif p==8: cmd = "G92" if x is not None and abs(x)<10000.0: cmd += "X"+str(x) if y is not None and abs(y)<10000.0: cmd += "Y"+str(y) if z is not None and abs(z)<10000.0: cmd += "Z"+str(z) self.sendGrbl(cmd+"\n$#\n") self.event_generate("<<Status>>", data=(_("Set workspace %s to X%s Y%s Z%s")%(WCS[p],str(x),str(y),str(z))).encode("utf-8")) self.event_generate("<<CanvasFocus>>")
def updateG(self): global wcsvar self._gUpdate = True try: focus = self.focus_get() except: focus = None wcsvar.set(WCS.index(CNC.vars["WCS"])) self.feedRate.set(str(CNC.vars["feed"])) self.feedMode.set(FEED_MODE[CNC.vars["feedmode"]]) self.spindle.set(CNC.vars["spindle"] == "M3") self.spindleSpeed.set(int(CNC.vars["rpm"])) self.toolEntry.set(CNC.vars["tool"]) self.units.set(UNITS[CNC.vars["units"]]) self.distance.set(DISTANCE_MODE[CNC.vars["distance"]]) self.plane.set(PLANE[CNC.vars["plane"]]) self._gUpdate = False
def updateG(self): global wcsvar self._gUpdate = True try: focus = self.focus_get() except: focus = None wcsvar.set(WCS.index(CNC.vars["WCS"])) self.feedRate.set(str(CNC.vars["feed"])) self.feedMode.set(FEED_MODE[CNC.vars["feedmode"]]) self.spindle.set(CNC.vars["spindle"]=="M3") self.spindleSpeed.set(int(CNC.vars["rpm"])) self.toolEntry.set(CNC.vars["tool"]) self.units.set(UNITS[CNC.vars["units"]]) self.distance.set(DISTANCE_MODE[CNC.vars["distance"]]) self.plane.set(PLANE[CNC.vars["plane"]]) self._gUpdate = False
def change(self, event=None): ProbeCommonFrame.probeUpdate() self.set() cmd = "g91 %s f%s"%(CNC.vars["prbcmd"], CNC.vars["prbfeed"]) lines = [] lines.append("g53 g0 z[toolchangez]") lines.append("g53 g0 x[toolchangex] y[toolchangey]") lines.append("%wait") lines.append("%pause Manual Tool change") lines.append("g53 g0 x[toolprobex] y[toolprobey]") lines.append("g53 g0 z[toolprobez]") lines.append("g91 [prbcmd] f[prbfeed] z[-tooldistance]") lines.append("%wait") p = WCS.index(CNC.vars["WCS"])+1 lines.append("G10L20P%d z[toolheight]"%(p)) lines.append("g53 g0 z[toolchangez]") lines.append("g53 g0 x[toolchangex] y[toolchangey]") lines.append("g90") self.app.run(lines=lines)
def _wcsSet(self, x, y, z): p = WCS.index(CNC.vars["WCS"]) if p<6: cmd = "G10L20P%d"%(p+1) elif p==6: cmd = "G28.1" elif p==7: cmd = "G30.1" elif p==8: cmd = "G92" pos = "" if x is not None and abs(x)<10000.0: pos += "X"+str(x) if y is not None and abs(y)<10000.0: pos += "Y"+str(y) if z is not None and abs(z)<10000.0: pos += "Z"+str(z) cmd += pos self.sendGCode(cmd) self.sendGCode("$#") self.event_generate("<<Status>>", data=(_("Set workspace %s to %s")%(WCS[p],pos))) #data=(_("Set workspace %s to %s")%(WCS[p],pos)).encode("utf8")) self.event_generate("<<CanvasFocus>>")
def _wcsSet(self, x, y, z): p = WCS.index(CNC.vars["WCS"]) if p < 6: cmd = "G10L20P%d" % (p + 1) elif p == 6: cmd = "G28.1" elif p == 7: cmd = "G30.1" elif p == 8: cmd = "G92" pos = "" if x is not None and abs(x) < 10000.0: pos += "X" + str(x) if y is not None and abs(y) < 10000.0: pos += "Y" + str(y) if z is not None and abs(z) < 10000.0: pos += "Z" + str(z) cmd += pos self.sendGCode(cmd) self.sendGCode("$#") self.event_generate("<<Status>>", data=(_("Set workspace %s to %s") % (WCS[p], pos))) #data=(_("Set workspace %s to %s")%(WCS[p],pos)).encode("utf8")) self.event_generate("<<CanvasFocus>>")
def _wcsSet(self, x, y, z): #global wcsvar #p = wcsvar.get() p = WCS.index(CNC.vars["WCS"]) if p<6: cmd = "G10L20P%d"%(p+1) elif p==6: cmd = "G28.1" elif p==7: cmd = "G30.1" elif p==8: cmd = "G92" pos = "" if x is not None and abs(float(x))<10000.0: pos += "X"+str(x) if y is not None and abs(float(y))<10000.0: pos += "Y"+str(y) if z is not None and abs(float(z))<10000.0: pos += "Z"+str(z) cmd += pos self.master.sendGCode(cmd) self.viewParameters() self.master.event_generate("<<Status>>", data=(_("Set workspace %s to %s")%(WCS[p],pos))) #data=(_("Set workspace %s to %s")%(WCS[p],pos)).encode("utf8")) self.master.event_generate("<<CanvasFocus>>")