User M codes not working
24 Oct 2012 04:56 #25729
by Miselph
User M codes not working was created by Miselph
Hello all,
I am trying to use a custom M code (m101) to run an external program. In this case the program is a script which calls Zenity to display a pop up asking the user to check that the spindle is running as at the moment I am having to start and stop my spindle manually.
So, I created the following script:
and saved it as m101.ngc in the folder specified in the [DISPLAY] section of the ini file and set the permissions to allow execution (chmod +x m101.ngc)
The script runs fine from the terminal but when I try and call the m code from the MDI interface in Axis it give me the "unknown m code used" error.
I have also tried placing the file in the same folder I place my oCodes in and it still doesn't work.
Any ideas?
I am trying to use a custom M code (m101) to run an external program. In this case the program is a script which calls Zenity to display a pop up asking the user to check that the spindle is running as at the moment I am having to start and stop my spindle manually.
So, I created the following script:
#M101
#!/bin/bash
zenity --info --text="Please ensure that the spindle is running and up to speed."
exit 0
and saved it as m101.ngc in the folder specified in the [DISPLAY] section of the ini file and set the permissions to allow execution (chmod +x m101.ngc)
The script runs fine from the terminal but when I try and call the m code from the MDI interface in Axis it give me the "unknown m code used" error.
I have also tried placing the file in the same folder I place my oCodes in and it still doesn't work.
Any ideas?
Please Log in or Create an account to join the conversation.
24 Oct 2012 06:20 #25730
by Miselph
Replied by Miselph on topic Re:User M codes not working
Fixed it. Turns out that the file name needs to be M101 without any extension.
Please Log in or Create an account to join the conversation.
24 Oct 2012 12:10 #25742
by andypugh
Replied by andypugh on topic Re:User M codes not working
Miselph wrote:
I also think that #!/bin/bash ought to be the first line in the file.Fixed it. Turns out that the file name needs to be M101 without any extension.
Please Log in or Create an account to join the conversation.
- TarHeelTom
- Offline
- Premium Member
Less
More
- Posts: 91
- Thank you received: 1
26 Oct 2012 10:35 #25833
by TarHeelTom
If memory serves me correctly, M codes are case sensitive. On my system M101 would work, but m101 would not.
The answer is to create a duplicate file with the file name "m101".
Tom
Replied by TarHeelTom on topic Re:User M codes not working
Fixed it. Turns out that the file name needs to be M101 without any extension.
If memory serves me correctly, M codes are case sensitive. On my system M101 would work, but m101 would not.
The answer is to create a duplicate file with the file name "m101".
Tom
Please Log in or Create an account to join the conversation.
26 Oct 2012 18:36 - 27 Oct 2012 20:07 #25840
by BigJohnT
Replied by BigJohnT on topic Re:User M codes not working
M100-199 codes are not case sensitive, however after you create a new M100-199 file you must restart the GUI or you will get the "Unknown m code used" error which can lead to confusion.
Edit: the file name is case sensitive and must use a capitol M.
John
Edit: the file name is case sensitive and must use a capitol M.
John
Last edit: 27 Oct 2012 20:07 by BigJohnT.
Please Log in or Create an account to join the conversation.
27 Oct 2012 11:45 #25869
by Miselph
Replied by Miselph on topic Re:User M codes not working
I have been doing some tests regarding case sensitivity.
Whilst M codes themselves are not case sensitive the linux filesystem IS.
If the file is named M101 then it works regardless of if you use a capital letter or not in the MDI panel, but if the file is named m101 then it doesn't work at all.
Also andypugh is correct; technically the #/bin/bash bit should come first (although my files are working anyway, but I shall change them when I get a chance)
Thanks everyone.
Whilst M codes themselves are not case sensitive the linux filesystem IS.
If the file is named M101 then it works regardless of if you use a capital letter or not in the MDI panel, but if the file is named m101 then it doesn't work at all.
Also andypugh is correct; technically the #/bin/bash bit should come first (although my files are working anyway, but I shall change them when I get a chance)
Thanks everyone.
Please Log in or Create an account to join the conversation.
27 Oct 2012 20:06 #25884
by BigJohnT
Replied by BigJohnT on topic Re:User M codes not working
Thanks for catching that, I've updated the manual to explain the file naming conventions.
Thanks
John
Thanks
John
Please Log in or Create an account to join the conversation.
Time to create page: 0.074 seconds