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

More
25 Jun 2017 12:30 #94918 by new2linux
Many thanks!

This is the sid and the FILTER part of the .ini file.

#!/bin/bash
echo "%"
sed '
s|%||g
s|^O[0-9]\+$||g
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 "%"

Todd, you were correct the 5th line down had error on the last letter. I can accept .ngc or .NC file extension w/o renaming.

[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

If I try the sample "LinuxCNC logo" g code, the machine will pause after each profile of the letter in question, so to change z. This I think works well, use the keyboard to restart. If I have simple profile created in Bobcad, use the software to generate g code, save g code to usb stick and open Linuxcnc and open file save from Bobcad it will give the "o word" error.

many thanks for any suggestions!

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

More
03 Jul 2017 19:36 #95327 by new2linux
Many, many thanks to all that make this place happen, I am very grateful for all the help!!

Attached are the logo g code that linuxcnc sample displays, and a simple profile generated in Bobcad v23 using the funucOM post processor. I will copy and past the top part of each. The logo code will allow for the pause to change z axes. The fanucOM file will not open, has the "o word" error when I try.


(this is the logo file, that works)
%
( AXIS "splash g-code" Not intended for actual milling )
(Z axis)
( depending on your setup. As if you had some material in your mill... )
(Z axis down a bit then touch off )
( Also press the Toggle Skip Lines with "/" to see that part )
( If the program is too big or small for your machine, change the scale below )
( LinuxCNC 19/1/2012 2:13:51 PM )
#<depth>=2.0
#<scale>=1.0
G21 G90 G64 G40
M0G0 (Z3.0)
( engraving )
G17
M3 S10000
G0 X[1.75781*#<scale>] Y[0.5*#<scale>]
M0G1 F100.0 (Z[-#<depth>])
G1 F400.0 X[5.95508*#<scale>] Y[20.54297*#<scale>]
G1 X[10.07031*#<scale>]
G1 X[6.58398*#<scale>] Y[3.84961*#<scale>]
G1 X[16.7832*#<scale>]
G1 X[16.08594*#<scale>] Y[0.5*#<scale>]
G1 X[1.75781*#<scale>]
M0G0 (Z3.0)
G0 X[18.72461*#<scale>]
M0G1 F100.0 (Z[-#<depth>])
G1 F400.0 X[21.75977*#<scale>] Y[15.01953*#<scale>]
G1 X[25.68359*#<scale>]
G1 X[22.64844*#<scale>] Y[0.5*#<scale>]
G1 X[18.72461*#<scale>]
M0G0 (Z3.0)
G0 X[26.55859*#<scale>]
M0G1 F100.0 (Z[-#<depth>])
G1 F400.0 X[29.59375*#<scale>] Y[15.01953*#<scale>]
G1 X[33.3125*#<scale>]
G1 X[32.92969*#<scale>] Y[13.13281*#<scale>]
G2 X[34.16342*#<scale>] Y[14.08624*#<scale>] I[8.82141*#<scale>] J[-10.13994*#<scale>]
G2 X[35.52734*#<scale>] Y[14.8418*#<scale>] I[4.53823*#<scale>] J[-6.58354*#<scale>]
G2 X[38.08398*#<scale>] Y[15.36133*#<scale>] I[2.53506*#<scale>] J[-5.9247*#<scale>]
G2 X[39.5966*#<scale>] Y[15.13543*#<scale>] I[0.06403*#<scale>] J[-4.74845*#<scale>]
G2 X[40.90039*#<scale>] Y[14.33594*#<scale>] I[-1.02874*#<scale>] J[-3.14049*#<scale>]
G2 X[41.7019*#<scale>] Y[13.08328*#<scale>] I[-2.33045*#<scale>] J[-2.37388*#<scale>]
G2 X[41.93945*#<scale>] Y[11.61523*#<scale>] I[-4.07102*#<scale>] J[-1.41199*#<scale>]
G2 X[41.76899*#<scale>] Y[10.15744*#<scale>] I[-10.17473*#<scale>] J[0.45091*#<scale>]
G2 X[41.48828*#<scale>] Y[8.7168*#<scale>] I[-39.45138*#<scale>] J[6.93932*#<scale>]
G1 X[39.7793*#<scale>] Y[0.5*#<scale>]
G1 X[35.85547*#<scale>]
G1 X[37.57813*#<scale>] Y[8.74414*#<scale>]
G3 X[37.79665*#<scale>] Y[9.84001*#<scale>] I[-62.81729*#<scale>] J[13.09579*#<scale>]
G3 X[37.96094*#<scale>] Y[10.94531*#<scale>] I[-9.6524*#<scale>] J[1.99958*#<scale>]
G3 X[37.50977*#<scale>] Y[12.12109*#<scale>] I[-1.54162*#<scale>] J[0.0829*#<scale>]
G3 X[36.2793*#<scale>] Y[12.55859*#<scale>] I[-1.13356*#<scale>] J[-1.23903*#<scale>]
G3 X[35.26888*#<scale>] Y[12.33731*#<scale>] I[0.05277*#<scale>] J[-2.65845*#<scale>]
G3 X[34.36523*#<scale>] Y[11.83398*#<scale>] I[1.956*#<scale>] J[-4.57455*#<scale>]
G3 X[32.71094*#<scale>] Y[9.91992*#<scale>] I[2.86418*#<scale>] J[-4.1474*#<scale>]
G3 X[32.13267*#<scale>] Y[8.21493*#<scale>] I[8.76492*#<scale>] J[-3.92328*#<scale>]
G3 X[31.72656*#<scale>] Y[6.46094*#<scale>] I[36.34493*#<scale>] J[-9.33906*#<scale>]
G1 X[30.48242*#<scale>] Y[0.5*#<scale>]
G1 X[26.55859*#<scale>]
M0G0 (Z3.0)
G0 X[26.09375*#<scale>] Y[16.98828*#<scale>]
M0G1 F100.0 (Z[-#<depth>])
G1 F400.0 X[22.16992*#<scale>]
G1 X[22.9082*#<scale>] Y[20.54297*#<scale>]
G1 X[26.83203*#<scale>]
G1 X[26.09375*#<scale>] Y[16.98828*#<scale>]
M0G0 (Z3.0)
G0 X[46.14777*#<scale>] Y[12.78778*#<scale>]
M0G1 F100.0 (Z[-#<depth>])
G1 F400.0 X[46.61523*#<scale>] Y[15.01953*#<scale>]
G1 X[50.53906*#<scale>]
G1 X[48.74805*#<scale>] Y[6.41992*#<scale>]
G3 X[48.55485*#<scale>] Y[5.46101*#<scale>] I[39.83359*#<scale>] J[-8.52447*#<scale>]
G3 X[48.41992*#<scale>] Y[4.49219*#<scale>] I[7.34343*#<scale>] J[-1.51652*#<scale>]
G3 X[48.88477*#<scale>] Y[3.41211*#<scale>] I[1.45252*#<scale>] J[-0.01493*#<scale>]
G3 X[50.07422*#<scale>] Y[2.96094*#<scale>] I[1.13093*#<scale>] J[1.18803*#<scale>]
G3 X[51.09961*#<scale>] Y[3.15234*#<scale>] I[-0.00663*#<scale>] J[2.87782*#<scale>]
G3 X[52.13867*#<scale>] Y[3.75391*#<scale>] I[-1.85377*#<scale>] J[4.40013*#<scale>]
G3 X[53.0957*#<scale>] Y[4.68359*#<scale>] I[-3.51724*#<scale>] J[4.57812*#<scale>]
G3 X[53.88867*#<scale>] Y[6.05078*#<scale>] I[-4.71119*#<scale>] J[3.64605*#<scale>]
G3 X[54.44922*#<scale>] Y[8.10156*#<scale>] I[-12.97687*#<scale>] J[4.64901*#<scale>]
G1 X[55.89844*#<scale>] Y[15.01953*#<scale>]
G1 X[59.82227*#<scale>]
G1 X[56.78711*#<scale>] Y[0.5*#<scale>]
G1 X[53.12305*#<scale>]
G1 X[53.5332*#<scale>] Y[2.46875*#<scale>]
G2 X[51.14513*#<scale>] Y[0.79202*#<scale>] I[-6.21919*#<scale>] J[6.3187*#<scale>]
G2 X[48.29688*#<scale>] Y[0.1582*#<scale>] I[-2.84268*#<scale>] J[6.05776*#<scale>]
G2 X[46.78426*#<scale>] Y[0.3841*#<scale>] I[-0.06403*#<scale>] J[4.74845*#<scale>]
G2 X[45.48047*#<scale>] Y[1.18359*#<scale>] I[1.02874*#<scale>] J[3.14049*#<scale>]
G2 X[44.68637*#<scale>] Y[2.45262*#<scale>] I[2.34744*#<scale>] J[2.35189*#<scale>]
G2 X[44.45508*#<scale>] Y[3.93164*#<scale>] I[4.23866*#<scale>] J[1.42044*#<scale>]
G2 X[44.63379*#<scale>] Y[5.43705*#<scale>] I[10.83187*#<scale>] J[-0.52256*#<scale>]
G2 X[44.91992*#<scale>] Y[6.92578*#<scale>] I[45.15644*#<scale>] J[-7.90718*#<scale>]
G1 X[46.14777*#<scale>] Y[12.78778*#<scale>]
M0G0 (Z3.0)
G0 X[61.99609*#<scale>] Y[15.01953*#<scale>]
M0G1 F100.0 (Z[-#<depth>])
G1 F400.0 X[66.16602*#<scale>]
G1 X[68.28516*#<scale>] Y[10.87695*#<scale>]
G1 X[71.96289*#<scale>] Y[15.01953*#<scale>]
G1 X[76.73438*#<scale>]
G1 X[69.99414*#<scale>] Y[7.48633*#<scale>]
G1 X[73.6582*#<scale>] Y[0.5*#<scale>]
G1 X[69.48828*#<scale>]
G1 X[67.39648*#<scale>] Y[4.57422*#<scale>]
G1 X[63.78711*#<scale>] Y[0.5*#<scale>]
G1 X[58.97461*#<scale>]
G1 X[65.6875*#<scale>] Y[7.9375*#<scale>]
G1 X[61.99609*#<scale>] Y[15.01953*#<scale>]
M0G0 (Z3.0)
G0 X[78.12067*#<scale>] Y[11.80439*#<scale>]
M0G1 F100.0 (Z[-#<depth>])
G2 F400.0 X[78.15861*#<scale>] Y[11.98873*#<scale>] I[14.86609*#<scale>] J[-2.96421*#<scale>]

(this is the fanucOM file)

#(BEGIN PREDATOR NC HEADER)
#(MACH_FILE=HAAS - 3XVMILL.MCH)
#(MTOOL T1 S1 D.125 H5. A0. C0. DIAM_OFFSET 1 = .0625)
#(SBOX X-1.0101 Y-.7197 Z-1. L2. W1.5 H1.)
#(END PREDATOR NC HEADER)

%
O100
(PROGRAM NUMBER)
(PROGRAM NAME - TEST0001.NC)
(POST - FANUC 0M)
(DATE - SAT. 06/24/2017)
(TIME - 03:21PM)

N01 G90 G80 G40 G20 G17

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

(JOB 1 CONTOUR)
(FEATURE PROFILE)

N04 T01 M06
N05 S1497 M03
N06 G90 G54 X-.0101 Y-.6572
N07 G43 H01 Z.1 M08
N08 G01 Z-.5 F3.5936
N09 X.9274 F5.9893
N10 Y.7178
N11 X-.9476
N12 Y-.6572
N13 X-.0101
N14 G00 Z.1

(JOB 1 CONTOUR)
(FEATURE PROFILE)

N15 S1497
N16 X-.1149 Y-.2183
N17 G01 Z-.5 F3.5936
N18 X-.0994 F5.9893
N19 Y-.1873
N20 X-.1304
N21 Y-.2183
N22 X-.1149
N23 G00 Z.1

(JOB 1 CONTOUR)
(FEATURE PROFILE)

N24 S1497
N25 X.1349 Y-.2086
N26 G01 Z-.5 F3.5936
N27 G17 G02 X.1349 Y-.2086 I-.2457 J0. F5.9893
N28 G00 Z.1

(JOB 1 CONTOUR)
(FEATURE PROFILE)

N29 S1497
N30 X.4055 Y.3089
N31 G01 Z-.5 F3.5936
N32 X.421 F5.9893
N33 Y.3399
N34 X.39
N35 Y.3089
N36 X.4055
N37 G00 Z.1

(JOB 1 CONTOUR)
(FEATURE PROFILE)

N38 S1497
N39 X.6536 Y.3183
N40 G01 Z-.5 F3.5936
N41 G02 X.6536 Y.3183 I-.246 J0. F5.9893
N42 G00 Z.1
N43 M09
N44 M05
N45 G91 G28 Z0.
N46 G91 G28 X0. Y0.
N47 T01 M06

(END OF PROGRAM)

N48 M30
%
I hope this is not too long!
many thanks, for any help, or suggested reading.
Attachments:

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

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