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

More
14 Jun 2017 18:30 - 14 Jun 2017 18:58 #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!
Last edit: 14 Jun 2017 18:58 by new2linux. Reason: clearify

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

More
14 Jun 2017 19:26 #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
#!/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.
The following user(s) said Thank You: new2linux

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

More
15 Jun 2017 13:22 - 15 Jun 2017 13:35 #94535 by new2linux
Many thanks, Todd!

I have the following screenshot of my current progress.

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"
Attachments:
Last edit: 15 Jun 2017 13:35 by new2linux. Reason: file error

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

More
15 Jun 2017 14:42 #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.
Attachments:
The following user(s) said Thank You: new2linux

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

More
15 Jun 2017 15:03 #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 or Create an account to join the conversation.

More
15 Jun 2017 15:24 #94543 by Todd Zuercher
Copy the file I attached above, and rename it.
The following user(s) said Thank You: new2linux

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

More
15 Jun 2017 16:08 - 15 Jun 2017 16:10 #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:


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.
Attachments:
Last edit: 15 Jun 2017 16:10 by new2linux. Reason: clearify

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

More
15 Jun 2017 17:29 #94548 by Todd Zuercher
Attachments:
The following user(s) said Thank You: new2linux

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

More
15 Jun 2017 17:40 - 15 Jun 2017 17:54 #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?
Last edit: 15 Jun 2017 17:54 by new2linux. Reason: clearify

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

More
15 Jun 2017 18:26 #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.




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

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

Moderators: Skullworks
Time to create page: 0.198 seconds
Powered by Kunena Forum