problem using [FILTER} to run a bash script

More
08 Nov 2021 12:12 - 08 Nov 2021 12:47 #225671 by d2inventory
You have 2 problems.

1. You don't need to execute your script file but execute bash with your script as first argument
2. You gotta return the changed g-code in stdout instead of modifying your .gc file

ini
PROGRAM_EXTENSION = .ngc,.gc g-code after custom Script
gc = bash /path/to/your/script/RunSED

RunSED
#!/bin/bash
sed 's/M106 S0/G68 E0 Q0/g' $1 | sed 's/M106 S/G67 E0 Q/g'

What this RunSED does is open the .gc file and replace "M106 S0" with "G68 E0 Q0" and writes it into stdout, this stdout is captured (pipe) by the next call to sed which does the second replace and again writes it to stdout.

Axis reads the stdout from your script and writes it at the bottom into the area where you can read the g-code.
Last edit: 08 Nov 2021 12:47 by d2inventory. Reason: the edit function in this forum is pretty broken ;-(

Please Log in or Create an account to join the conversation.

More
08 Nov 2021 22:50 #225727 by ericg
d2inventory, I owe you a slab of beer, it works well now, it was the -i option (edit files in place) that was causing it . Also using the bash command prefixing my script I never thought of even though I know it's part of Linux. I also tried it without the bash prefix and it still worked both with my original script (without the -i) and you're more streamlined one.
You can collect next time you are in Melbourne Australia.
Many thanks to you and the others for your support.
Eric

Please Log in or Create an account to join the conversation.

Time to create page: 0.097 seconds
Powered by Kunena Forum