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

More
15 Jun 2017 18:43 #94552 by Todd Zuercher
What text editor are you using? If that is Mint with Mate desktop I think it should have Pluma as the default text editor, Cinnemon I think comes with Gedit. Either of them should work fine. If you made the file on a Windows machine you might have end of line problems. And any word processor will cause huge problems (MSWord, LibreOffice, OpenOffice...) because they don't save in plain text formats inserting all sorts of goofy formatting characters.
The following user(s) said Thank You: new2linux

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

More
15 Jun 2017 18:50 #94553 by new2linux
Yes, it was windows note pad. I will try a work around.

many thanks!!

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

More
15 Jun 2017 18:51 - 15 Jun 2017 18:52 #94554 by Todd Zuercher
If you click ok the file it should finish opening fine and be runnable.

If you add a % on a line by it's self at the start and end of the file that box will no longer pop up.
You can also do that with your script file and a couple of echo lines.
#!/bin/bash
echo "%"
sed 's|\(.*\)Z\([-,0-9,\.]*\)|M0 \1(Z\2)|g' "$1" 
echo "%"
Last edit: 15 Jun 2017 18:52 by Todd Zuercher.
The following user(s) said Thank You: new2linux

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

More
16 Jun 2017 12:18 #94568 by Todd Zuercher
If you want to edit files for Linux computers on a Windows machine an excellent text editing program is Notepad++ (and it is free). It can convert text line endings to/from MSWindows or Linux/Unix or Mac. (All three use different line ending control characters.)
The following user(s) said Thank You: new2linux

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

More
16 Jun 2017 17:15 #94603 by new2linux
Todd, Many Thanks!

I keyed the raw data in to linux's text editor for the "sh" file, saved it to the correct conf folder. When I read your comment I went back to the file and edited with the (echo "%") 2 places as per your sample. Then saved and set permissions again, then restarted computer.

See the screenshot:


any suggestions
many thanks!!
Attachments:

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

More
16 Jun 2017 17:37 #94606 by andypugh
It looks like the system doesn't like nested comments
(this is a comment (and this is a nested comment))
The following user(s) said Thank You: new2linux

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

More
16 Jun 2017 18:16 - 16 Jun 2017 18:21 #94614 by Todd Zuercher
That will be expected behavior with the g-code from the Linuxcnc demo file. Because there are Zs in the comment section. .

The opening screen g-code is an anomaly with lots of commented text and parameter values used for moves. "Normal" g-code should not present a problem with the old scrip.

Here is a modified version that works on the opening screen.
#!/bin/bash
echo "%"
sed '
s|\(.*\)Z\(\[.*\]\)|M0 \1(Z\2)|g
s|\(.*\)Z\([-.0-9]\+\)|M0 \1(Z\2)|g
' "$1" 
echo "%"
Last edit: 16 Jun 2017 18:21 by Todd Zuercher.
The following user(s) said Thank You: new2linux

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

More
18 Jun 2017 16:04 #94678 by new2linux
Many thanks!

Attached are the .ini and .sh that I have tried.
The sed is here:

File Attachment:

File Name: z-pause.sh.txt
File Size:0 KB


The error is about the "Bad character " * " used", from your prior example about the 'echo " % " '. What am I missing to include the * as well, so it works ok.

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

The script example suggest that additional file extensions are possible. The LinuxCNC .MILLPST is what my postprocessor is called and saves the g-code as .NC file extension. The full .ini is attached, above is what the FILTER looks like, where should I be looking? I will try "ngc,.NC =~/linuxcnc/configs/LinuxCNC/z-pause.sh" (just saw the possibility)

Many Thanks!
Attachments:

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

More
18 Jun 2017 19:52 #94680 by Todd Zuercher
I don't understand why you added the "*", to the echo lines? What were you want that to do?

I think you just need to take that part out.

Maybe you should post an example G-code file that you want to be able to load through the script file, so we can see what needs to be modified and what doesn't..
The following user(s) said Thank You: new2linux

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

More
19 Jun 2017 14:56 #94700 by new2linux
Todd, Thank You!!

This is a section of code from the Bobcad post processor for linuxcnc (emc I believe). The error is the "is about the "Bad character " * " used".
2nd question; Can I not rename so the .NC extension be acceptable? vs. the .ngc extension. Now requires to be renamed to .ngc to recognize file name.

(END PREDATOR NC HEADER)

%
O100
(PROGRAM NUMBER)
************* 2 - Starting blocks//Standard start of program **********
(PROGRAM NAME - TEST01WITHISLAND.NC)
(POST - FANUC 0M)
(DATE - SAT. 06/17/2017)
(TIME - 04:52PM)

N01 G90 G80 G40 G20 G17

N02 G00 G91 G28 Z0.
N03 G91 G28 X0. Y0.

(JOB 1 POCKET)
(FEATURE POCKET)

N04 T01 M06
N05 S2012 M03
N06 G90 G54 X-.0884 Y-.1864
N07 G43 H01 Z.1 M08
************* 40 - Operations//Start of operation **********
************* 51 - Feed moves//Feed move Z **********
N08 G01 Z-.5 F4.8301
************* 55 - Feed moves//Feed move XYZ **********
N09 X-.1414 F8.0502
************* 55 - Feed moves//Feed move XYZ **********
N10 Y-.2394
************* 55 - Feed moves//Feed move XYZ **********
N11 X-.0884
************* 55 - Feed moves//Feed move XYZ **********
N12 Y-.1864
************* 50 - Rapid moves//Rapid move Z **********
N13 G00 Z.1
************* 52 - Rapid moves//Rapid move XY **********
N14 X.3723 Y.3475
************* 51 - Feed moves//Feed move Z **********
N15 G01 Z-.5 F4.8301
************* 55 - Feed moves//Feed move XYZ **********
N16 Y.2945 F8.0502


Many Thanks!

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

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