LinuxCNC python
- kwanlokto
- Offline
- New Member
-
Less
More
- Posts: 8
- Thank you received: 0
21 Nov 2025 17:25 #338912
by kwanlokto
LinuxCNC python was created by kwanlokto
I am looking to leverage linuxcnc.org/docs/html/config/python-interface.html to build an API which will be able to perform basic machine functions like homing the axis, measuring tool length and running gcode. Out of curiousity do you guys know of any github repos or any open source projects I can reference to start this project?
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
-
Less
More
- Posts: 7292
- Thank you received: 2130
21 Nov 2025 17:37 #338913
by cmorley
Replied by cmorley on topic LinuxCNC python
Do you mean like this ?
linuxcnc.org/docs/devel/html/gui/qtvcp-l...ml#_code_action_code
or something like this?
linuxcnc.org/docs/devel/html/man/man1/axis-remote.1.html
linuxcnc.org/docs/devel/html/gui/qtvcp-l...ml#_code_action_code
or something like this?
linuxcnc.org/docs/devel/html/man/man1/axis-remote.1.html
Please Log in or Create an account to join the conversation.
- JT
-
- Away
- Administrator
-
Less
More
- Posts: 1085
- Thank you received: 572
09 Dec 2025 12:02 #339907
by JT
Replied by JT on topic LinuxCNC python
Please Log in or Create an account to join the conversation.
- Donb9261
-
- Offline
- Elite Member
-
Less
More
- Posts: 169
- Thank you received: 103
01 Apr 2026 00:37 #345017
by Donb9261
Replied by Donb9261 on topic LinuxCNC python
Consider the following gcode lines:
197: G2 X[118.69393*#<scale>] Y[5.37699*#<scale>] I[5.36449*#<scale>] J[4.87005*#<scale>]
198: G2 X[118.27432*#<scale>] Y[8.23889*#<scale>] I[12.16539*#<scale>] J[3.2454*#<scale>]
199: G0 Z3.0
200: G55
201: M5
202: M30
LCNC reads/runs all the way down and stops at G0 Z3.0. And the program never resets. I stat.red_line, stat.motion_line, current_line, and see that motion_line is actually the line it is stuck on. In this case, it would be line 199. After 202: there is an EOF carraige return. I tried this using Axis, and all the others. I get the same result these do.
M30 should read and rewind to first line in the program which is RS-274 GCODE. But, no matter what I try, nope.
Any ideas?
Thanks,
Don
197: G2 X[118.69393*#<scale>] Y[5.37699*#<scale>] I[5.36449*#<scale>] J[4.87005*#<scale>]
198: G2 X[118.27432*#<scale>] Y[8.23889*#<scale>] I[12.16539*#<scale>] J[3.2454*#<scale>]
199: G0 Z3.0
200: G55
201: M5
202: M30
LCNC reads/runs all the way down and stops at G0 Z3.0. And the program never resets. I stat.red_line, stat.motion_line, current_line, and see that motion_line is actually the line it is stuck on. In this case, it would be line 199. After 202: there is an EOF carraige return. I tried this using Axis, and all the others. I get the same result these do.
M30 should read and rewind to first line in the program which is RS-274 GCODE. But, no matter what I try, nope.
Any ideas?
Thanks,
Don
Please Log in or Create an account to join the conversation.
- Donb9261
-
- Offline
- Elite Member
-
Less
More
- Posts: 169
- Thank you received: 103
01 Apr 2026 00:39 - 01 Apr 2026 00:41 #345018
by Donb9261
Replied by Donb9261 on topic LinuxCNC python
Attachments:
Last edit: 01 Apr 2026 00:41 by Donb9261.
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 21467
- Thank you received: 7320
02 Apr 2026 20:42 #345080
by tommylight
Replied by tommylight on topic LinuxCNC python
@Don,
Do those replies belong on this topic, or am i missing something?
Do those replies belong on this topic, or am i missing something?
Please Log in or Create an account to join the conversation.
- Donb9261
-
- Offline
- Elite Member
-
Less
More
- Posts: 169
- Thank you received: 103
04 Apr 2026 12:32 #345158
by Donb9261
Replied by Donb9261 on topic LinuxCNC python
Tommy,
The replies demo what is actually happening in hopes I may get some guidance to fix it. My question is above them.
The replies demo what is actually happening in hopes I may get some guidance to fix it. My question is above them.
Please Log in or Create an account to join the conversation.
- Donb9261
-
- Offline
- Elite Member
-
Less
More
- Posts: 169
- Thank you received: 103
04 Apr 2026 13:32 #345161
by Donb9261
Replied by Donb9261 on topic LinuxCNC python
I made this work around that seems to be robust.
if cur_task_mode_mon == 1 and cur_interp_state_mon == 1 and cur_queue_mon == 0:
cmd.abort()
M30 is actually read into the buffer and executed, but the inerp has already reset before updating the line number que. That is a bug in Linuxcnc and breaks the standard function of M30 in RS274.
I may simply modify my lcnc to fix the issue. But for now, the above works and should only activate if the yask_mode is manual, which M30 does actually set on M30 read, the task_state is idle, which it should be, and the queue is empty. Which is the planner que.
if cur_task_mode_mon == 1 and cur_interp_state_mon == 1 and cur_queue_mon == 0:
cmd.abort()
M30 is actually read into the buffer and executed, but the inerp has already reset before updating the line number que. That is a bug in Linuxcnc and breaks the standard function of M30 in RS274.
I may simply modify my lcnc to fix the issue. But for now, the above works and should only activate if the yask_mode is manual, which M30 does actually set on M30 read, the task_state is idle, which it should be, and the queue is empty. Which is the planner que.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 21467
- Thank you received: 7320
04 Apr 2026 14:56 #345163
by tommylight
Replied by tommylight on topic LinuxCNC python
OK, thank you.
Please Log in or Create an account to join the conversation.
Time to create page: 0.118 seconds