stdin for LinuxCNC

More
10 years 11 months ago #65683 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 to join the conversation.

More
10 years 11 months ago #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

Please Log in to join the conversation.

More
10 years 11 months ago #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

Please Log in to join the conversation.

More
10 years 11 months ago #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 to join the conversation.

  • jepler
  • New Member
  • New Member
More
10 years 11 months ago #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.

Please Log in to join the conversation.

More
10 years 11 months ago #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)

[strike]A simple Python script could accept stdin and MDI it to the running LinuxCNC instance.[/strike]
axis-remote can take commands line by line, and might do what is wanted.

Please Log in to join the conversation.

Time to create page: 0.308 seconds
Powered by Kunena Forum