stdin for LinuxCNC
- clayton cramer
- Offline
- Senior Member
-
Less
More
- Posts: 45
- Thank you received: 0
23 Nov 2015 04:09 #65683
by clayton cramer
stdin for LinuxCNC was created by clayton cramer
Being an ancient Unix programmer i prefer writing programs that produce gCode to stdout,. Is there a way to tell LinuxCNC to read from stdin?
Please Log in or Create an account to join the conversation.
23 Nov 2015 05:36 #65684
by cmorley
Replied by cmorley on topic stdin for LinuxCNC
not sure if this is exactly what u want:
www.linuxcnc.org/docs/2.7/html/gui/axis.html#_program_filters
www.linuxcnc.org/docs/2.7/html/gui/axis.html#_program_filters
Please Log in or Create an account to join the conversation.
23 Nov 2015 19:41 #65714
by BigJohnT
Replied by BigJohnT on topic stdin for LinuxCNC
Yes, if you open your program with Axis you can send to stdout and Axis gets it.
A python example of doing just that
wiki.linuxcnc.org/cgi-bin/wiki.pl?Simple...rators#Arc_Generator
JT
A python example of doing just that
wiki.linuxcnc.org/cgi-bin/wiki.pl?Simple...rators#Arc_Generator
JT
Please Log in or Create an account to join the conversation.
- clayton cramer
- Offline
- Senior Member
-
Less
More
- Posts: 45
- Thank you received: 0
23 Nov 2015 21:56 #65716
by clayton cramer
Replied by clayton cramer on topic stdin for LinuxCNC
It looks like this specifies what filter to run for various file extensions. I was hoping for something to accept lines from stdin and run those to the mill.
Please Log in or Create an account to join the conversation.
23 Nov 2015 23:26 #65720
by jepler
Replied by jepler on topic stdin for LinuxCNC
If you use AXIS as your user interface, the program `axis-remote` can remotely open a gcode file. However, it can't open from a pipe since interpreting gcode can involve seeking in the file.
If you want to script loading gcode into AXIS, you are stuck saving it to a temporary file, using axis-remote to open it, and then ensuring that the program still exists on disk until AXIS is done with it.
Probably it would be possible to design a way to make AXIS responsible for cleaning up this temporary file on exit. If you do care to implement such a thing, please file a pull request on github linuxcnc-mirror so that I can review it for possible inclusion in a future version of LinuxCNC.
Possibly you can piggy-back on the existing code for gcode filters to manage the temporary file's lifetime; I don't recall the specifics of how that works.
If you want to script loading gcode into AXIS, you are stuck saving it to a temporary file, using axis-remote to open it, and then ensuring that the program still exists on disk until AXIS is done with it.
Probably it would be possible to design a way to make AXIS responsible for cleaning up this temporary file on exit. If you do care to implement such a thing, please file a pull request on github linuxcnc-mirror so that I can review it for possible inclusion in a future version of LinuxCNC.
Possibly you can piggy-back on the existing code for gcode filters to manage the temporary file's lifetime; I don't recall the specifics of how that works.
Please Log in or Create an account to join the conversation.
24 Nov 2015 10:45 - 24 Nov 2015 10:50 #65732
by andypugh
Replied by andypugh on topic stdin for LinuxCNC
Is it possible that typing line-by-line in the MDI window achieves the required effect? (It is hard to say, as the reason for wanting to use stin wasn't specified)
A simple Python script could accept stdin and MDI it to the running LinuxCNC instance.
axis-remote can take commands line by line, and might do what is wanted.
axis-remote can take commands line by line, and might do what is wanted.
Last edit: 24 Nov 2015 10:50 by andypugh.
Please Log in or Create an account to join the conversation.
Time to create page: 0.118 seconds