- Posts: 78
- Thank you received: 0
calling python file
- Abdulkareem
- Topic Author
- Offline
- Senior Member
-
Less
More
2 years 3 days ago #313300
by Abdulkareem
calling python file was created by Abdulkareem
how to make an m code that runs a python script
Please Log in to join the conversation.
2 years 3 days ago #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.
Code:
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.
Please Log in to join the conversation.
- Abdulkareem
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 78
- Thank you received: 0
2 years 2 days ago #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 to join the conversation.
- Abdulkareem
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 78
- Thank you received: 0
2 years 2 days ago #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 to join the conversation.
2 years 1 day ago #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)
Please Log in to join the conversation.
- Abdulkareem
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 78
- Thank you received: 0
2 years 1 day ago #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 to join the conversation.
Time to create page: 0.155 seconds
