Remapping code will skip a line of G code?
- chen1234
 - 
				
									Topic Author
											 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 58
 - Thank you received: 2
 
			
	
						14 Dec 2021 10:29		 -  14 Dec 2021 10:33		#229044
		by chen1234
	
	
		
			
	
	
		
	
			 		
													
	
				Remapping code will skip a line of G code? was created by chen1234			
			
				hi,I hope someone can give me some suggestions.
I define a remapping code (M702, used to set the parameters of the external device,it can be executed normally)
and use it in the remapping code (yield INTERP_EXECUTE_FINISH).
It can make my code execute in order, but when I When defining multiple remapping codes,
it is found that some remapping codes will skip the line of G code before it.
Is my usage method incorrect? How should I solve it? I use Linuxcnc 2.9
Thank you in advance for any reply.
Below is part of my code and configuration:			
					I define a remapping code (M702, used to set the parameters of the external device,it can be executed normally)
and use it in the remapping code (yield INTERP_EXECUTE_FINISH).
It can make my code execute in order, but when I When defining multiple remapping codes,
it is found that some remapping codes will skip the line of G code before it.
Is my usage method incorrect? How should I solve it? I use Linuxcnc 2.9
Thank you in advance for any reply.
Below is part of my code and configuration:
#!/usr/bin/env python3
import sys 
import os
from interpreter import *
from emccanon import MESSAGE
import re
import math
import hal
import linuxcnc
import time
import thread
def m200(self,**words):
    yield INTERP_EXECUTE_FINISH 
    if self.task:
        list = []
        for key in words:
            print("word '%s' = %f" % (key, words[key]))
            list.append(words[key])
        a= list[0]
        print('a=',a)
        self.execute("G0 Z %d"%a)
        print("MDI_Xxxxx")
def m702(self, **words):
    yield INTERP_EXECUTE_FINISH 
    if self.task:
            list = []
            for key in words:
                print("word '%s' = %f" % (key, words[key]))
                list.append(key+str(words[key]))
            res=str(list[0]+' '+list[1]+' '+list[2])
            print ('res=',res)
            i=0
            while i <= 2:
                x=list[i].find("f")
                if x != -1:
                        a = re.sub('[a-zA-Z]',"",list[i])
                y=list[i].find("p")
                if y != -1:
                        b = re.sub('[a-zA-Z]',"",list[i])
                z=list[i].find("q")
                if z != -1:
                        c = re.sub('[a-zA-Z]',"",list[i])
            
                i+=1
            par = str(a+' '+b+' '+c)
            print ('parameters=',str(a+' '+b+' '+c))
            main = "/home/.../.../aa"  #Executable 
            os.system(main +' '+ par)[i][i][i][i][i][i]  [attachment=42181]ini_2021-12-14.jpg[/attachment] [attachment=42182]ngc.jpg[/attachment] [attachment=42183]1.jpg[/attachment] [attachment=42184]2.jpg[/attachment][/i][/i][/i][/i][/i][/i]Attachments:
		Last edit: 14 Dec 2021 10:33  by chen1234.			
			Please Log in or Create an account to join the conversation.
- chen1234
 - 
				
									Topic Author
											 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 58
 - Thank you received: 2
 
			
	
						14 Dec 2021 10:34				#229045
		by chen1234
	
	
		
			
	
	
		
			
			 		
													
	
				Replied by chen1234 on topic Remapping code will skip a line of G code?			
			
					Attachments:
Please Log in or Create an account to join the conversation.
		Time to create page: 0.831 seconds