PostProcessor or ISO a script to insert M0 for "Z" (Linuxcnc & BobCad v23)

More
9 years 4 months ago #94509 by new2linux
Many, many thanks Todd!!

Yes, that is the FILTER section of the .ini file. I need to save just the "Bash script" as a .sh file in the conf folder. The "Bash script" is just the very top part, or the whole part (like between the ## at the top and ## at the bottom)? I will look to see if there is any M111 custom m-code shown.

many thanks!

Edit: M111 is in the CAM software (my case Bobcad) and search thru to see. The samples that are shown (Todd's earlier example) one of the part that goes in the .ini file, and a 2nd part that requires the "ngc = ~/linuxcnc/configs/my_mill/z-pause.sh" plus some additional info is also in the 2nd part. Many thanks!

Please Log in to join the conversation.

More
9 years 4 months ago #94511 by Todd Zuercher
The bash script "is" the file. And if all you want it to do is find and replace the Z lines, it only needs to be
Code:
#!/bin/bash sed 's|\(.*\)Z\([-,0-9,\.]*\)|M0 \1(Z\2)|g' "$1"

If you also want it to add some lines at the beginning and end of your file, you can add some "echo" lines.

Please Log in to join the conversation.

More
9 years 4 months ago #94535 by new2linux
Many thanks, Todd!

I have the following screenshot of my current progress.

Attachment not found



The permissions were granted by rt click on "z-pause.sh".
The .ini file is below, but will cut and paste "FILTER" section here:

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
ngc = ~/linuxcnc/configs/LinuxCNC/z-pause.sh

Many thanks

Edit: add z-pause (cut&paste):

#!/bin/bash

sed 's|\(.*\)Z\([-,0-9,\.]*\)|M0 \1(Z\2)|g' "$1"

Please Log in to join the conversation.

More
9 years 4 months ago #94540 by Todd Zuercher
That is odd, the same script file works for me. Aside from some messing up the find and replace in some comments and other such things.
Not sure where your errors are coming from. But the problem is not in your ini file or the path to the script. it is being found and ran. The problem is in the script file it's self.
What did you use to create/edit the script file?
You can't use a word processor, you have to use just a plain text editor.

Please Log in to join the conversation.

More
9 years 4 months ago #94541 by new2linux
Todd, I must confess I copied (from your example) and pasted to create new file, that I renamed to the .sh extenstion. I will review and start from scratch if necessary. The script file is the one that needs attention, I will work on it.

many thanks!!

Please Log in to join the conversation.

More
9 years 4 months ago #94543 by Todd Zuercher
Copy the file I attached above, and rename it.

Please Log in to join the conversation.

More
9 years 4 months ago #94546 by new2linux
Todd, Many Thanks!!

I used your advise, to start with the file you attached, rename it, to sh, used "notepad" for new file. The screenshot is attached:

Attachment not found



I have reviewed the .ini file, looks correct; reviewed the sid after copied to conf folder. looks ok. Not shore where to review/look.

Many Thanks!

Edit: after coping, I set permissions again.

Please Log in to join the conversation.

More
9 years 4 months ago #94548 by Todd Zuercher
It works for me here.

Attachment not found

Please Log in to join the conversation.

More
9 years 4 months ago #94549 by new2linux
I did not show 62 bytes shell script, am looking in to now, and shows 1KB.

Edit: after looking to see it appears the attachment has maybe an issue, but it is probable just me. I am still working this, is it the same to cut & paste in a note pad type of software, vs. copy your original file with file management type of software and save that as the .sh file?

Please Log in to join the conversation.

More
9 years 4 months ago #94550 by new2linux
There was an extra "." at the end of the file name, I have removed that. In the following screenshot you will see a different type of notice.

Attachment not found




I viewed the permissions "look ok", just not shore where to look.

Please Log in to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum