Exemple #1
0
 def parseBracketSquare(self, line):
     word = SPLITPAT.split(line[1:-1])
     #print word
     if word[0] == "PRB":
         CNC.vars["prbx"] = float(word[1])
         CNC.vars["prby"] = float(word[2])
         CNC.vars["prbz"] = float(word[3])
         #if self.running:
         self.master.gcode.probe.add(CNC.vars["prbx"] - CNC.vars["wcox"],
                                     CNC.vars["prby"] - CNC.vars["wcoy"],
                                     CNC.vars["prbz"] - CNC.vars["wcoz"])
         self.master._probeUpdate = True
         CNC.vars[word[0]] = word[1:]
     if word[0] == "G92":
         CNC.vars["G92X"] = float(word[1])
         #print( float(word[2]) )
         CNC.vars["G92Y"] = float(word[2])
         CNC.vars["G92Z"] = float(word[3])
         #if Utils.config.get("bCNC","enable6axis") == "true":
         if len(word) > 4:
             CNC.vars["G92A"] = float(word[4])
         if len(word) > 5:
             CNC.vars["G92B"] = float(word[5])
         if len(word) > 6:
             CNC.vars["G92C"] = float(word[6])
         CNC.vars[word[0]] = word[1:]
         self.master._gUpdate = True
     if word[0] == "G28":
         CNC.vars["G28X"] = float(word[1])
         CNC.vars["G28Y"] = float(word[2])
         CNC.vars["G28Z"] = float(word[3])
         CNC.vars[word[0]] = word[1:]
         self.master._gUpdate = True
     if word[0] == "G30":
         CNC.vars["G30X"] = float(word[1])
         CNC.vars["G30Y"] = float(word[2])
         CNC.vars["G30Z"] = float(word[3])
         CNC.vars[word[0]] = word[1:]
         self.master._gUpdate = True
     elif word[0] == "GC":
         CNC.vars["G"] = word[1].split()
         CNC.updateG()
         self.master._gUpdate = True
     elif word[0] == "TLO":
         CNC.vars[word[0]] = word[1]
         self.master._probeUpdate = True
         self.master._gUpdate = True
     else:
         CNC.vars[word[0]] = word[1:]
Exemple #2
0
    def parseBracketSquare(self, line):
        word = SPLITPAT.split(line[1:-1])
        # print word
        if word[0] == "PRB":
            OCV.CD["prbx"] = float(word[1])
            OCV.CD["prby"] = float(word[2])
            OCV.CD["prbz"] = float(word[3])

            self.master.gcode.probe.add(OCV.CD["prbx"] - OCV.CD["wcox"],
                                        OCV.CD["prby"] - OCV.CD["wcoy"],
                                        OCV.CD["prbz"] - OCV.CD["wcoz"])
            self.master._probeUpdate = True
            OCV.CD[word[0]] = word[1:]
        if word[0] == "G92":
            OCV.CD["G92X"] = float(word[1])
            OCV.CD["G92Y"] = float(word[2])
            OCV.CD["G92Z"] = float(word[3])
            OCV.CD[word[0]] = word[1:]
            self.master._gUpdate = True
        if word[0] == "G28":
            OCV.CD["G28X"] = float(word[1])
            OCV.CD["G28Y"] = float(word[2])
            OCV.CD["G28Z"] = float(word[3])
            OCV.CD[word[0]] = word[1:]
            self.master._gUpdate = True
        if word[0] == "G30":
            OCV.CD["G30X"] = float(word[1])
            OCV.CD["G30Y"] = float(word[2])
            OCV.CD["G30Z"] = float(word[3])
            OCV.CD[word[0]] = word[1:]
            self.master._gUpdate = True
        elif word[0] == "GC":
            OCV.CD["G"] = word[1].split()
            CNC.updateG()
            self.master._gUpdate = True
        elif word[0] == "TLO":
            OCV.CD[word[0]] = word[1]
            self.master._probeUpdate = True
            self.master._gUpdate = True
        elif word[0] == "MSG:" and word[1:] == "Pgm End":
            # Catch the program end message as sometimes it hangs in Run state.
            print("GRBL1: PE")
            OCV.c_pgm_end = True
        else:
            OCV.CD[word[0]] = word[1:]
Exemple #3
0
	def parseBracketSquare(self, line):
		word = SPLITPAT.split(line[1:-1])
		#print word
		if word[0] == "PRB":
			CNC.vars["prbx"] = float(word[1])
			CNC.vars["prby"] = float(word[2])
			CNC.vars["prbz"] = float(word[3])
			#if self.running:
			self.master.gcode.probe.add(
				 CNC.vars["prbx"]-CNC.vars["wcox"],
				 CNC.vars["prby"]-CNC.vars["wcoy"],
				 CNC.vars["prbz"]-CNC.vars["wcoz"])
			self.master._probeUpdate = True
			CNC.vars[word[0]] = word[1:]
		if word[0] == "G92":
			CNC.vars["G92X"] = float(word[1])
			CNC.vars["G92Y"] = float(word[2])
			CNC.vars["G92Z"] = float(word[3])
			CNC.vars[word[0]] = word[1:]
			self.master._gUpdate = True
		if word[0] == "G28":
			CNC.vars["G28X"] = float(word[1])
			CNC.vars["G28Y"] = float(word[2])
			CNC.vars["G28Z"] = float(word[3])
			CNC.vars[word[0]] = word[1:]
			self.master._gUpdate = True
		if word[0] == "G30":
			CNC.vars["G30X"] = float(word[1])
			CNC.vars["G30Y"] = float(word[2])
			CNC.vars["G30Z"] = float(word[3])
			CNC.vars[word[0]] = word[1:]
			self.master._gUpdate = True
		elif word[0] == "GC":
			CNC.vars["G"] = word[1].split()
			CNC.updateG()
			self.master._gUpdate = True
		elif word[0] == "TLO":
			CNC.vars[word[0]] = word[1]
			self.master._probeUpdate = True
			self.master._gUpdate = True
		else:
			CNC.vars[word[0]] = word[1:]
Exemple #4
0
 def parseBracketSquare(self, line):
     word = SPLITPAT.split(line[1:-1])
     # print word
     if word[0] == "PRB":
         CNC.vars["prbx"] = float(word[1])
         CNC.vars["prby"] = float(word[2])
         CNC.vars["prbz"] = float(word[3])
         # if self.running:
         self.master.gcode.probe.add(CNC.vars["prbx"] - CNC.vars["wcox"],
                                     CNC.vars["prby"] - CNC.vars["wcoy"],
                                     CNC.vars["prbz"] - CNC.vars["wcoz"])
         self.master._probeUpdate = True
         CNC.vars[word[0]] = word[1:]
     if word[0] == "G92":
         CNC.vars["G92X"] = float(word[1])
         CNC.vars["G92Y"] = float(word[2])
         CNC.vars["G92Z"] = float(word[3])
         CNC.vars[word[0]] = word[1:]
         self.master._gUpdate = True
     if word[0] == "G28":
         CNC.vars["G28X"] = float(word[1])
         CNC.vars["G28Y"] = float(word[2])
         CNC.vars["G28Z"] = float(word[3])
         CNC.vars[word[0]] = word[1:]
         self.master._gUpdate = True
     if word[0] == "G30":
         CNC.vars["G30X"] = float(word[1])
         CNC.vars["G30Y"] = float(word[2])
         CNC.vars["G30Z"] = float(word[3])
         CNC.vars[word[0]] = word[1:]
         self.master._gUpdate = True
     elif word[0] == "GC":
         CNC.vars["G"] = word[1].split()
         CNC.updateG()
         self.master._gUpdate = True
     elif word[0] == "TLO":
         CNC.vars[word[0]] = word[1]
         self.master._probeUpdate = True
         self.master._gUpdate = True
     else:
         CNC.vars[word[0]] = word[1:]
Exemple #5
0
	def parseBracketAngle(self, line, cline):
		self.master.sio_status = False
		fields = line[1:-1].split("|")
		CNC.vars["pins"] = ""


		#Report if state has changed
		if CNC.vars["state"] != fields[0] or self.master.runningPrev != self.master.running:
			self.master.controllerStateChange(fields[0])
		self.master.runningPrev = self.master.running
		CNC.vars["state"] = fields[0]

		for field in fields[1:]:
			word = SPLITPAT.split(field)
			if word[0] == "MPos":
				try:
					CNC.vars["mx"] = float(word[1])
					CNC.vars["my"] = float(word[2])
					CNC.vars["mz"] = float(word[3])
					CNC.vars["wx"] = round(CNC.vars["mx"]-CNC.vars["wcox"], CNC.digits)
					CNC.vars["wy"] = round(CNC.vars["my"]-CNC.vars["wcoy"], CNC.digits)
					CNC.vars["wz"] = round(CNC.vars["mz"]-CNC.vars["wcoz"], CNC.digits)
					self.master._posUpdate = True
				except (ValueError,IndexError):
					CNC.vars["state"] = "Garbage receive %s: %s"%(word[0],line)
					self.master.log.put((self.master.MSG_RECEIVE, CNC.vars["state"]))
					break
			elif word[0] == "F":
				try:
					CNC.vars["curfeed"] = float(word[1])
				except (ValueError,IndexError):
					CNC.vars["state"] = "Garbage receive %s: %s"%(word[0],line)
					self.master.log.put((self.master.MSG_RECEIVE, CNC.vars["state"]))
					break
			elif word[0] == "FS":
				try:
					CNC.vars["curfeed"]    = float(word[1])
					CNC.vars["curspindle"] = float(word[2])
				except (ValueError,IndexError):
					CNC.vars["state"] = "Garbage receive %s: %s"%(word[0],line)
					self.master.log.put((self.master.MSG_RECEIVE, CNC.vars["state"]))
					break
			elif word[0] == "Bf":
				try:
					CNC.vars["planner"] = int(word[1])
					CNC.vars["rxbytes"] = int(word[2])
				except (ValueError,IndexError):
					CNC.vars["state"] = "Garbage receive %s: %s"%(word[0],line)
					self.master.log.put((self.master.MSG_RECEIVE, CNC.vars["state"]))
					break
			elif word[0] == "Ov":
				try:
					CNC.vars["OvFeed"]    = int(word[1])
					CNC.vars["OvRapid"]   = int(word[2])
					CNC.vars["OvSpindle"] = int(word[3])
				except (ValueError,IndexError):
					CNC.vars["state"] = "Garbage receive %s: %s"%(word[0],line)
					self.master.log.put((self.master.MSG_RECEIVE, CNC.vars["state"]))
					break
			elif word[0] == "WCO":
				try:
					CNC.vars["wcox"] = float(word[1])
					CNC.vars["wcoy"] = float(word[2])
					CNC.vars["wcoz"] = float(word[3])
				except (ValueError,IndexError):
					CNC.vars["state"] = "Garbage receive %s: %s"%(word[0],line)
					self.master.log.put((self.master.MSG_RECEIVE, CNC.vars["state"]))
					break
			elif word[0] == "Pn":
				try:
					CNC.vars["pins"] = word[1]
					if 'S' in word[1]:
						if CNC.vars["state"] == 'Idle' and not self.master.running:
							print("Stream requested by CYCLE START machine button")
							self.master.event_generate("<<Run>>")
						else:
							print("Ignoring machine stream request, because of state: ", CNC.vars["state"], self.master.running)
				except (ValueError,IndexError):
					break


		# Machine is Idle buffer is empty stop waiting and go on
		if self.master.sio_wait and not cline and fields[0] in ("Idle","Check"):
			#if not self.master.running: self.master.jobDone() #This is not a good idea, it purges the controller while waiting for toolchange. see #1061
			self.master.sio_wait = False
			self.master._gcount += 1
Exemple #6
0
    def parseBracketAngle(self, line, cline):
        self.master.sio_status = False
        fields = line[1:-1].split("|")
        CNC.vars["pins"] = ""

        # Report if state has changed
        if CNC.vars["state"] != fields[
                0] or self.master.runningPrev != self.master.running:
            self.master.controllerStateChange(fields[0])
        self.master.runningPrev = self.master.running
        CNC.vars["state"] = fields[0]

        for field in fields[1:]:
            word = SPLITPAT.split(field)
            if word[0] == "MPos":
                try:
                    CNC.vars["mx"] = float(word[1])
                    CNC.vars["my"] = float(word[2])
                    CNC.vars["mz"] = float(word[3])
                    CNC.vars["wx"] = round(CNC.vars["mx"] - CNC.vars["wcox"],
                                           CNC.digits)
                    CNC.vars["wy"] = round(CNC.vars["my"] - CNC.vars["wcoy"],
                                           CNC.digits)
                    CNC.vars["wz"] = round(CNC.vars["mz"] - CNC.vars["wcoz"],
                                           CNC.digits)
                    self.master._posUpdate = True
                except (ValueError, IndexError):
                    CNC.vars["state"] = "Garbage receive %s: %s" % (word[0],
                                                                    line)
                    self.master.log.put(
                        (self.master.MSG_RECEIVE, CNC.vars["state"]))
                    break
            elif word[0] == "F":
                try:
                    CNC.vars["curfeed"] = float(word[1])
                except (ValueError, IndexError):
                    CNC.vars["state"] = "Garbage receive %s: %s" % (word[0],
                                                                    line)
                    self.master.log.put(
                        (self.master.MSG_RECEIVE, CNC.vars["state"]))
                    break
            elif word[0] == "FS":
                try:
                    CNC.vars["curfeed"] = float(word[1])
                    CNC.vars["curspindle"] = float(word[2])
                except (ValueError, IndexError):
                    CNC.vars["state"] = "Garbage receive %s: %s" % (word[0],
                                                                    line)
                    self.master.log.put(
                        (self.master.MSG_RECEIVE, CNC.vars["state"]))
                    break
            elif word[0] == "Bf":
                try:
                    CNC.vars["planner"] = int(word[1])
                    CNC.vars["rxbytes"] = int(word[2])
                except (ValueError, IndexError):
                    CNC.vars["state"] = "Garbage receive %s: %s" % (word[0],
                                                                    line)
                    self.master.log.put(
                        (self.master.MSG_RECEIVE, CNC.vars["state"]))
                    break
            elif word[0] == "Ov":
                try:
                    CNC.vars["OvFeed"] = int(word[1])
                    CNC.vars["OvRapid"] = int(word[2])
                    CNC.vars["OvSpindle"] = int(word[3])
                except (ValueError, IndexError):
                    CNC.vars["state"] = "Garbage receive %s: %s" % (word[0],
                                                                    line)
                    self.master.log.put(
                        (self.master.MSG_RECEIVE, CNC.vars["state"]))
                    break
            elif word[0] == "WCO":
                try:
                    CNC.vars["wcox"] = float(word[1])
                    CNC.vars["wcoy"] = float(word[2])
                    CNC.vars["wcoz"] = float(word[3])
                except (ValueError, IndexError):
                    CNC.vars["state"] = "Garbage receive %s: %s" % (word[0],
                                                                    line)
                    self.master.log.put(
                        (self.master.MSG_RECEIVE, CNC.vars["state"]))
                    break
            elif word[0] == "Pn":
                try:
                    CNC.vars["pins"] = word[1]
                    if 'S' in word[1]:
                        if CNC.vars[
                                "state"] == 'Idle' and not self.master.running:
                            print(
                                "Stream requested by CYCLE START machine button"
                            )
                            self.master.event_generate("<<Run>>", when='tail')
                        else:
                            print(
                                "Ignoring machine stream request, because of state: ",
                                CNC.vars["state"], self.master.running)
                except (ValueError, IndexError):
                    break

        # Machine is Idle buffer is empty stop waiting and go on
        if self.master.sio_wait and not cline and fields[0] not in ("Run",
                                                                    "Jog",
                                                                    "Hold"):
            # if not self.master.running: self.master.jobDone() #This is not a good idea, it purges the controller while waiting for toolchange. see #1061
            self.master.sio_wait = False
            self.master._gcount += 1
Exemple #7
0
    def parseBracketAngle(self, line, cline):
        self.master.sio_status = False
        fields = line[1:-1].split("|")
        OCV.CD["pins"] = ""

        # Report if state has changed
        if OCV.c_state != fields[0] or OCV.s_runningPrev != OCV.s_running:
            self.master.controllerStateChange(fields[0])
        OCV.s_runningPrev = OCV.s_running
        OCV.c_state = fields[0]

        for field in fields[1:]:
            word = SPLITPAT.split(field)
            if word[0] == "MPos":
                try:
                    OCV.CD["mx"] = float(word[1])
                    OCV.CD["my"] = float(word[2])
                    OCV.CD["mz"] = float(word[3])
                    OCV.CD["wx"] = round(OCV.CD["mx"] - OCV.CD["wcox"],
                                         OCV.digits)
                    OCV.CD["wy"] = round(OCV.CD["my"] - OCV.CD["wcoy"],
                                         OCV.digits)
                    OCV.CD["wz"] = round(OCV.CD["mz"] - OCV.CD["wcoz"],
                                         OCV.digits)
                    self.master._posUpdate = True
                except (ValueError, IndexError):
                    OCV.c_state = W_MSG1.format(word[0], line)
                    self.master.log.put((self.master.MSG_RECEIVE, OCV.c_state))
                    break
            elif word[0] == "F":
                try:
                    OCV.CD["curfeed"] = float(word[1])
                except (ValueError, IndexError):
                    OCV.c_state = W_MSG1.format(word[0], line)
                    self.master.log.put((self.master.MSG_RECEIVE, OCV.c_state))
                    break
            elif word[0] == "FS":
                try:
                    OCV.CD["curfeed"] = float(word[1])
                    OCV.CD["curspindle"] = float(word[2])
                except (ValueError, IndexError):
                    OCV.c_state = W_MSG1.format(word[0], line)
                    self.master.log.put((self.master.MSG_RECEIVE, OCV.c_state))
                    break
            elif word[0] == "Bf":
                try:
                    OCV.CD["planner"] = int(word[1])
                    OCV.CD["rxbytes"] = int(word[2])
                except (ValueError, IndexError):
                    OCV.c_state = W_MSG1.format(word[0], line)
                    self.master.log.put((self.master.MSG_RECEIVE, OCV.c_state))
                    break
            elif word[0] == "Ov":
                try:
                    OCV.CD["OvFeed"] = int(word[1])
                    OCV.CD["OvRapid"] = int(word[2])
                    OCV.CD["OvSpindle"] = int(word[3])
                except (ValueError, IndexError):
                    OCV.c_state = W_MSG1.format(word[0], line)
                    self.master.log.put((self.master.MSG_RECEIVE, OCV.c_state))
                    break
            elif word[0] == "WCO":
                try:
                    OCV.CD["wcox"] = float(word[1])
                    OCV.CD["wcoy"] = float(word[2])
                    OCV.CD["wcoz"] = float(word[3])
                except (ValueError, IndexError):
                    OCV.c_state = W_MSG1.format(word[0], line)
                    self.master.log.put((self.master.MSG_RECEIVE, OCV.c_state))
                    break
            elif word[0] == "Pn":
                try:
                    OCV.CD["pins"] = word[1]
                    if 'S' in word[1]:
                        if OCV.c_state == 'Idle' and not OCV.s_running:
                            print(
                                "Stream requested by CYCLE START machine button"
                            )
                            self.master.event_generate("<<Run>>", when='tail')
                        else:
                            print(
                                "Ignoring machine stream request, because of state: ",
                                OCV.c_state, OCV.s_running)
                except (ValueError, IndexError):
                    break

        # Machine is Idle buffer is empty stop waiting and go on
        if self.master.sio_wait and not cline and fields[0] not in ("Run",
                                                                    "Jog",
                                                                    "Hold"):
            self.master.sio_wait = False
            self.master._gcount += 1
            print("GC+ GRBL1 buffer Idle")