calling python file
- Abdulkareem
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 1
27 Oct 2024 14:20 #313300
by Abdulkareem
calling python file was created by Abdulkareem
how to make an m code that runs a python script
Please Log in or Create an account to join the conversation.
27 Oct 2024 15:04 #313309
by Aciera
Replied by Aciera on topic calling python file
1. add this to the [RS274NGC] section of your ini file:
2. save your python script as eg 'M123' (possible numering is 100...199) to the 'mcodes' folder in your machine config directory and mark the file as executable
3.'M123' in Gcode should now execute the script.
USER_M_PATH = ./mcodes
2. save your python script as eg 'M123' (possible numering is 100...199) to the 'mcodes' folder in your machine config directory and mark the file as executable
3.'M123' in Gcode should now execute the script.
The following user(s) said Thank You: Abdulkareem
Please Log in or Create an account to join the conversation.
- Abdulkareem
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 1
29 Oct 2024 09:15 #313418
by Abdulkareem
Replied by Abdulkareem on topic calling python file
I did as you said but i get an error of unknown m code
Please Log in or Create an account to join the conversation.
- Abdulkareem
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 1
29 Oct 2024 09:16 #313419
by Abdulkareem
Replied by Abdulkareem on topic calling python file
do i need to add REMAP = M199 python = M199(the name of the script)
Please Log in or Create an account to join the conversation.
29 Oct 2024 09:50 - 29 Oct 2024 09:50 #313420
by Aciera
- USER_M_PATH is incorrect (this is supposed to point to the directory that contains your 'M199' file not to the file itself )
- File name is incorrect (Do not add an extension eg .py)
- The file is not marked as executable
No, this is not a remap, it's a custom mcode (which lets you use any executable script)
Replied by Aciera on topic calling python file
Possible causes:I did as you said but i get an error of unknown m code
- USER_M_PATH is incorrect (this is supposed to point to the directory that contains your 'M199' file not to the file itself )
- File name is incorrect (Do not add an extension eg .py)
- The file is not marked as executable
do i need to add REMAP = M199 python = M199(the name of the script)
No, this is not a remap, it's a custom mcode (which lets you use any executable script)
Last edit: 29 Oct 2024 09:50 by Aciera.
The following user(s) said Thank You: Abdulkareem
Please Log in or Create an account to join the conversation.
- Abdulkareem
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 1
29 Oct 2024 10:02 #313421
by Abdulkareem
Replied by Abdulkareem on topic calling python file
Thank you i solve the issue by removing the .py extension and adding it to the right directory
Please Log in or Create an account to join the conversation.
Time to create page: 0.147 seconds