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

More
19 Jun 2017 21:06 #94711 by Todd Zuercher
So is Bobcad sticking in all those starred lines? What is their purpose? Are they comments, but it is also sticking in ordinary comments in parenthesis?

Any way, those will have to go, or be converted to regular comments.

Linuxcnc can be set up to open any file extension, You just need to add it to the list of program extensions in the [FILTER] section of your ini file.
The following user(s) said Thank You: new2linux

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

More
19 Jun 2017 23:15 #94713 by new2linux
Thanks, Todd!

The example is of a pocking command with islands, so think self step over and not wipe out the islands, I think that is what all the starred lines are. Bobcad has several post processors to pic from I may look at others, is emc preferred?. I will review my .ini file.

Many thanks!

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

More
22 Jun 2017 18:43 #94798 by new2linux
Many thanks for all the help!

I have included the FILTER section of .ini file:

[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
NC = ~/linuxcnc/configs/LinuxCNC/z-pause.sh

This is the sed script:

#!/bin/bash
echo "%"
sed '
s|\(.*\)Z\(\[.*\]\)|M0 \1(Z\2)|g
s|\(.*\)Z\([-.0-9]\+\)|M0 \1(Z\2)|g
' "$1"
echo "%"

Bobcad has several post processors to pic from: Like, Fanuc; Fadal (these show the nested command error), emc2 has the * error. Am I seeking too much to think the code will go smoothly to the machine, do I need to just manual edit the code before trying to load in to Linuxcnc. Attached are a few profile passes using different post processors, to see what they look like.

many thanks!!
Attachments:

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

More
22 Jun 2017 20:50 #94808 by Todd Zuercher
It seems a bit tortured but this will convert your Fanuc example.
#!/bin/bash
echo "%"
sed '
s|%||g
s|^O[0-9]\+$||
s|\(;\?N[0-9]\+\)\?(\(.*\)Z|(\1Zzzzz|g
s|\(;\?N[0-9]\+\)\?\(.*\)Z\(\[.*\]\)|\1 M0\2(Z\3)|g
s|\(;\?N[0-9]\+\)\?\(.*\)Z\([-.0-9]\+\)|\1 M0\2(Z\3)|g
s|zzzz||g
' "$1" 
echo "%"
The following user(s) said Thank You: new2linux

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

More
23 Jun 2017 15:53 #94853 by new2linux
Thanks, Todd!!

I used the sed script you suggested. Attached is a screenshot of an error, the "o word" and the g code in question, a profile with 2 islands.



Will I need to tweak the code each time? What should I be looking for, is there any suggested reading?

Many, many, thanks! All comments, warmly welcomed!
Attachments:

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

More
23 Jun 2017 16:28 #94855 by Todd Zuercher
I had tested it and it should have taken care of the bad "o word".

My guess is that the filter was not actually ran on that file as it loaded.
What was the file extension on the file you were opening?
Could I see what you have in the [FILTER] section of your ini file?
The following user(s) said Thank You: new2linux

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

More
23 Jun 2017 17:10 #94857 by new2linux
Thanks, Todd!

This seems to accept the .NC extension (I go to the usb drive and pic file, and open in Linuxcnc) there is a pic of .NC or ngc at the bottom. The .NC is what the Bobcad wants to use. It also seems like a .dxf would work w/o Bobcad, in Linuxcnc, is this correct?

[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
NC = ~/linuxcnc/configs/LinuxCNC/z-pause.sh


many thanks!!

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

More
23 Jun 2017 17:42 #94859 by Todd Zuercher
So it is working for you now? (I don't see any errors in the filter section.

It can use a dxf, sort of. Generally it isn't a good substitute for using a proper CAM software.
The following user(s) said Thank You: new2linux

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

More
23 Jun 2017 17:45 #94860 by new2linux
Thanks, Todd!!

The ability to use .NC or ngc file extension seems to work. The "o word" error is still there.

Many Thanks!

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

More
23 Jun 2017 18:24 - 23 Jun 2017 18:25 #94862 by Todd Zuercher
This line in it should have deleted the o-word
s|^O[0-9]\+$||g
Make sure it is there in it's entirety and that the "O"s and "0"s are correct.

It should find any line starting with a capital O followed by a string of one or more digits to the end of the line, and replace that with nothing.
Last edit: 23 Jun 2017 18:25 by Todd Zuercher.
The following user(s) said Thank You: new2linux

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

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