diff --git a/.claude/settings.local.json b/.claude/settings.local.json index f2f84c4..f82b7e7 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -5,7 +5,15 @@ "Bash(where pdftotext:*)", "Bash(where python:*)", "Bash(where python3:*)", - "Bash(where py:*)" + "Bash(where py:*)", + "Bash(xargs grep:*)", + "WebFetch(domain:linuxcnc.org)", + "WebSearch", + "WebFetch(domain:www.linuxcnc.org)", + "WebFetch(domain:github.com)", + "WebFetch(domain:raw.githubusercontent.com)", + "WebFetch(domain:forum.linuxcnc.org)", + "WebFetch(domain:www.forum.linuxcnc.org)" ] } } diff --git a/configs/lagun_gmoccapy/lagun_gmoccapy.ini b/configs/lagun_gmoccapy/lagun_gmoccapy.ini index d11b7b2..26aba5e 100755 --- a/configs/lagun_gmoccapy/lagun_gmoccapy.ini +++ b/configs/lagun_gmoccapy/lagun_gmoccapy.ini @@ -59,6 +59,8 @@ PARAMETER_FILE = linuxcnc.var # Startup: G20=inch, G40=cancel cutter comp, G90=absolute, G94=feed/min, # G97=RPM mode, G64 P0.001=path blending tolerance 0.001" RS274NGC_STARTUP_CODE = G20 G40 G90 G94 G97 G64 P0.001 +# Subroutine search path (colon-separated list, searched before PROGRAM_PREFIX) +SUBROUTINE_PATH = /home/linuxcnc/linuxcnc/nc_files/subs # --- Motion controller --- [EMCMOT] diff --git a/nc_files/HECB-0001.ngc b/nc_files/HECB-0001.ngc index f0ca621..b4128a8 100755 --- a/nc_files/HECB-0001.ngc +++ b/nc_files/HECB-0001.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = 0.5 #<_rampang> = 5 -#<_td> = [3/16] ;#<_overlap> = 0 ; +1: Conventional milling @@ -22,15 +21,17 @@ F20 ; pockets ;o101 repeat [2] -; o call [0.813][-0.575] [1.438][-1.200] [#][#] [0] [.1] -; o call [1.613][-0.575] [2.238][-1.200] [#][#] [0] [.1] -; o call [2.413][-0.575] [3.038][-1.200] [#][#] [0] [.1] -; o call [2.413][-1.675] [3.038][-2.300] [#][#] [0] [.1] -; o call [1.613][-1.675] [2.238][-2.300] [#][#] [0] [.1] -; o call [0.975][-1.838] [.240] [#][#] [0] [0+4] -; o call [0.975][-2.138] [.240] [#][#] [0] [0+4] -; o call [1.275][-2.138] [.240] [#][#] [0] [0+4] -; o call [1.275][-1.838] [.240] [#][#] [0] [0+4] +; #<_z_top> = # +; #<_z_bot> = # +; o call [0] [0.813][-0.575] [1.438][-1.200] [.1] +; o call [0] [1.613][-0.575] [2.238][-1.200] [.1] +; o call [0] [2.413][-0.575] [3.038][-1.200] [.1] +; o call [0] [2.413][-1.675] [3.038][-2.300] [.1] +; o call [0] [1.613][-1.675] [2.238][-2.300] [.1] +; o call [0+4] [0.975][-1.838] [.240] [0] +; o call [0+4] [0.975][-2.138] [.240] [0] +; o call [0+4] [1.275][-2.138] [.240] [0] +; o call [0+4] [1.275][-1.838] [.240] [0] ; # = [#-0.15] ; # = [#-0.15] ;o101 endrepeat @@ -39,15 +40,17 @@ F20 # = 0.01 # = -0.16 -;o call [0.250][-0.250] [.23] [#][#] -;o call [5.462][-0.250] [.23] [#][#] -;o call [5.462][-2.625] [.23] [#][#] -;o call [0.250][-2.625] [.23] [#][#] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [0.250][-0.250] [.23] +;o call [0] [5.462][-0.250] [.23] +;o call [0] [5.462][-2.625] [.23] +;o call [0] [0.250][-2.625] [.23] -;o call [0.625][-0.538] [#][#] -;o call [0.625][-2.338] [#][#] -;o call [3.225][-2.338] [#][#] -;o call [3.225][-0.538] [#][#] +;o call [0.625][-0.538] +;o call [0.625][-2.338] +;o call [3.225][-2.338] +;o call [3.225][-0.538] o call [0.738][-0.5] [3.113][-2.375] [0.01][-0.1] diff --git a/nc_files/HEMA-TILTBRACKET.ngc b/nc_files/HEMA-TILTBRACKET.ngc index dc36a35..36ed53c 100755 --- a/nc_files/HEMA-TILTBRACKET.ngc +++ b/nc_files/HEMA-TILTBRACKET.ngc @@ -3,8 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 6 #<_rampang> = 20 -#<_td> = 6.35 - ; mode refernce ; +1: Conventional milling ; +2: Both-ways milling @@ -13,9 +11,11 @@ G54 ; absolute coordinates F150 ; inch or mm/min (300 mm/min = about 1 ft/min) -o call [-20][-10] [8.2] [1][-9] -o call [-20][-40] [8.2] [1][-9] -o call [+30][-25] [8.2] [1][-9] +#<_z_top> = 1 +#<_z_bot> = -9 +o call [0] [-20][-10] [8.2] +o call [0] [-20][-40] [8.2] +o call [0] [+30][-25] [8.2] o call [0] [+30][-25] [28] [1][-9] [0.5] diff --git a/nc_files/HEMA/HEMA-P004.ngc b/nc_files/HEMA/HEMA-P004.ngc index 0e22f26..6726b6d 100755 --- a/nc_files/HEMA/HEMA-P004.ngc +++ b/nc_files/HEMA/HEMA-P004.ngc @@ -32,18 +32,30 @@ F20 ; feedrate in mm/min or in/min #20 = 31.5 o sub - o call [#1/25.4][#2/25.4] [0.415] [+.02][-.26] [0][+4] - o call [#1/25.4][#2/25.4] [0.250] [-.20][-.53] [0][+4] + #<_z_top> = +.02 + #<_z_bot> = -.26 + o call [+4] [#1/25.4][#2/25.4] [0.415] [0] + #<_z_top> = -.20 + #<_z_bot> = -.53 + o call [+4] [#1/25.4][#2/25.4] [0.250] [0] o endsub o sub - o call [#1/25.4][#2/25.4] [0.35] [+.02][-.20] [0][+4] - o call [#1/25.4][#2/25.4] [0.20] [-.19][-.53] [0][+4] + #<_z_top> = +.02 + #<_z_bot> = -.20 + o call [+4] [#1/25.4][#2/25.4] [0.35] [0] + #<_z_top> = -.19 + #<_z_bot> = -.53 + o call [+4] [#1/25.4][#2/25.4] [0.20] [0] o endsub o sub - o call [#1/25.4][#2/25.4] [0.40] [+.02][-.30] [0][+4] - o call [#1/25.4][#2/25.4] [0.20] [-.29][-.53] [0][+4] + #<_z_top> = +.02 + #<_z_bot> = -.30 + o call [+4] [#1/25.4][#2/25.4] [0.40] [0] + #<_z_top> = -.29 + #<_z_bot> = -.53 + o call [+4] [#1/25.4][#2/25.4] [0.20] [0] o endsub o sub @@ -84,7 +96,7 @@ o10 if [# EQ 1] o11 endwhile - # = [#<_td>/2] + # = [#5410/2] # = [-605/25.4] # = [-2.9] @@ -112,9 +124,13 @@ o10 elseif [# EQ 2] o sub F20 - o call [#1/25.4][#2/25.4] [17.0/25.4] [+.02][-.086] [0.02] [+4] + #<_z_top> = +.02 + #<_z_bot> = -.086 + o call [+4] [#1/25.4][#2/25.4] [17.0/25.4] [0.02] F10 - o call [#1/25.4][#2/25.4] [10.0/25.4] [-.08][-.530] [0.005] [+4] + #<_z_top> = -.08 + #<_z_bot> = -.530 + o call [+4] [#1/25.4][#2/25.4] [10.0/25.4] [0.005] o endsub o call [#][#] diff --git a/nc_files/HEMA/HEMA-P005.cnc b/nc_files/HEMA/HEMA-P005.cnc deleted file mode 100755 index 0883909..0000000 --- a/nc_files/HEMA/HEMA-P005.cnc +++ /dev/null @@ -1,22 +0,0 @@ -#<_z_clearance> = 0.4 -#<_rampang> = 5 - -; mode reference -; +1: Conventional milling -; +2: Both-ways milling -; +4: Plunge entry -; +8: Outside - - -G21 ; mm -G10 L1 P1 Z0.0 R5.0 ; set tool -T1 ; set tool to T1 -M06 ; manual toolchange -G54 ; absolute coordinates -F3000 ; mm/min (300 mm/min = about 1 ft/min) - -o call [20][-10] [1][-8] [3] -o call [20][-40] [1][-8] [3] - - -M2 ; end program diff --git a/nc_files/HEMA/HEMA-P008.ngc b/nc_files/HEMA/HEMA-P008.ngc index 63e27f5..6e5e2bb 100755 --- a/nc_files/HEMA/HEMA-P008.ngc +++ b/nc_files/HEMA/HEMA-P008.ngc @@ -15,22 +15,42 @@ M06 ; manual toolchange G54 ; absolute coordinates ;F10 ; mm/min (300 mm/min = about 1 ft/min) -;o call [0][0] [2.05] [.1][-.5] [.01] [0+4] -;o call [0][0] [2.055] [.1][-.5] [0] [0] +;#<_z_top> = .1 +;#<_z_bot> = -.5 +;o call [0+4] [0][0] [2.05] [.01] +;#<_z_top> = .1 +;#<_z_bot> = -.5 +;o call [0] [0][0] [2.055] [0] F3 -;o call [+0.394][-.394] [5.2/25.4] [0.1][-0.25] [0][+4] -;o call [+1.181][-.394] [5.2/25.4] [0.1][-0.25] [0][+4] -;o call [-0.394][-.394] [5.2/25.4] [0.1][-0.25] [0][+4] -;o call [-1.181][-.394] [5.2/25.4] [0.1][-0.25] [0][+4] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.25 +;o call [+4] [+0.394][-.394] [5.2/25.4] [0] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.25 +;o call [+4] [+1.181][-.394] [5.2/25.4] [0] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.25 +;o call [+4] [-0.394][-.394] [5.2/25.4] [0] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.25 +;o call [+4] [-1.181][-.394] [5.2/25.4] [0] F8 -;o call [-.787][-1.181] [.551] [0.1][-0.25] -;o call [+.787][-1.181] [.551] [0.1][-0.25] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.25 +;o call [0] [-.787][-1.181] [.551] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.25 +;o call [0] [+.787][-1.181] [.551] -o call [-.787][-1.181] [.553] [0.1][-0.25] -o call [+.787][-1.181] [.553] [0.1][-0.25] +#<_z_top> = 0.1 +#<_z_bot> = -0.25 +o call [0] [-.787][-1.181] [.553] +#<_z_top> = 0.1 +#<_z_bot> = -0.25 +o call [0] [+.787][-1.181] [.553] M30 diff --git a/nc_files/HEMA/HEMA-P048.ngc b/nc_files/HEMA/HEMA-P048.ngc index 058845e..842347b 100755 --- a/nc_files/HEMA/HEMA-P048.ngc +++ b/nc_files/HEMA/HEMA-P048.ngc @@ -19,8 +19,12 @@ G54 ; absolute coordinates F20 ; inch or mm/min (300 mm/min = about 1 ft/min) o10 sub -o call [#1][#2] [.39] [0.05][-0.197] -o call [#1][#2] [-.15][-0.5] +#<_z_top> = 0.05 +#<_z_bot> = -0.197 +o call [0] [#1][#2] [.39] +#<_z_top> = -.15 +#<_z_bot> = -0.5 +o call [#1][#2] o10 endsub o10 call [-22/25.4][-0.394] diff --git a/nc_files/HEMA/HEMA-P049.cnc b/nc_files/HEMA/HEMA-P049.cnc deleted file mode 100755 index edf24b6..0000000 --- a/nc_files/HEMA/HEMA-P049.cnc +++ /dev/null @@ -1,40 +0,0 @@ -#<_z_clearance> = 0.5 -#<_rampang> = 10 -;#<_stepover> = 0.1 - -;#<_overlap> = 0 - -; mode refernce -; +1: Conventional milling -; +2: Both-ways milling -; +4: Plunge entry -; +8: Outside - - -G20 ; G21 mm / G20 inch -G10 L1 P1 Z0.0 R[1/4/2] ; set tool -T1 ; set tool to T1 -M06 ; manual toolchange -G54 ; absolute coordinates -F15 ; inch or mm/min (300 mm/min = about 1 ft/min) - - - -; 12 mm holes -o call [.591] [-.433] [12/25.4] [0.1][-.3] [0][4] -o call [.591] [-.984] [12/25.4] [0.1][-.3] [0][4] -o call [3.937] [-.433] [12/25.4] [0.1][-.3] [0][4] -o call [3.937] [-.984] [12/25.4] [0.1][-.3] [0][4] - -; m5 holes - -;o call [1.634] [-.315] -;o call [1.634] [-.709] -;o call [1.634] [-1.102] - -;o call [2.894] [-.315] -;o call [2.894] [-.709] -;o call [2.894] [-1.102] - - -M2 ; end program diff --git a/nc_files/HEMA/HEMA-P049.ngc b/nc_files/HEMA/HEMA-P049.ngc index 70b05ee..78d9730 100755 --- a/nc_files/HEMA/HEMA-P049.ngc +++ b/nc_files/HEMA/HEMA-P049.ngc @@ -23,35 +23,75 @@ F6 ; inch or mm/min (300 mm/min = about 1 ft/min) o1 if [#1 EQ 1] ; 12 mm holes -o call [.591] [-.433] [12/25.4] [0.1][-.1] [0][4] -o call [.591] [-.433] [12/25.4] [0.1][-.2] [0][4] -o call [.591] [-.433] [12/25.4] [0.1][-.3] [0][4] -o call [.591] [-.433] [12/25.4] [0.1][-.41] [0][4] +#<_z_top> = 0.1 +#<_z_bot> = -.1 +o call [4] [.591] [-.433] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.2 +o call [4] [.591] [-.433] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.3 +o call [4] [.591] [-.433] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [.591] [-.433] [12/25.4] [0] -o call [.591] [-.984] [12/25.4] [0.1][-.1] [0][4] -o call [.591] [-.984] [12/25.4] [0.1][-.2] [0][4] -o call [.591] [-.984] [12/25.4] [0.1][-.3] [0][4] -o call [.591] [-.984] [12/25.4] [0.1][-.41] [0][4] +#<_z_top> = 0.1 +#<_z_bot> = -.1 +o call [4] [.591] [-.984] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.2 +o call [4] [.591] [-.984] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.3 +o call [4] [.591] [-.984] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [.591] [-.984] [12/25.4] [0] -o call [3.937] [-.433] [12/25.4] [0.1][-.1] [0][4] -o call [3.937] [-.433] [12/25.4] [0.1][-.2] [0][4] -o call [3.937] [-.433] [12/25.4] [0.1][-.3] [0][4] -o call [3.937] [-.433] [12/25.4] [0.1][-.41] [0][4] +#<_z_top> = 0.1 +#<_z_bot> = -.1 +o call [4] [3.937] [-.433] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.2 +o call [4] [3.937] [-.433] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.3 +o call [4] [3.937] [-.433] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [3.937] [-.433] [12/25.4] [0] -o call [3.937] [-.984] [12/25.4] [0.1][-.1] [0][4] -o call [3.937] [-.984] [12/25.4] [0.1][-.2] [0][4] -o call [3.937] [-.984] [12/25.4] [0.1][-.3] [0][4] -o call [3.937] [-.984] [12/25.4] [0.1][-.41] [0][4] +#<_z_top> = 0.1 +#<_z_bot> = -.1 +o call [4] [3.937] [-.984] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.2 +o call [4] [3.937] [-.984] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.3 +o call [4] [3.937] [-.984] [12/25.4] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [3.937] [-.984] [12/25.4] [0] o1 elseif [#1 EQ 2] #2 = [12/25.4] -o call [.591] [-.433] [#2] [0.1][-.41] [0][4] -o call [.591] [-.984] [#2] [0.1][-.41] [0][4] -o call [3.937] [-.433] [#2] [0.1][-.41] [0][4] -o call [3.937] [-.984] [#2] [0.1][-.41] [0][4] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [.591] [-.433] [#2] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [.591] [-.984] [#2] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [3.937] [-.433] [#2] [0] +#<_z_top> = 0.1 +#<_z_bot> = -.41 +o call [4] [3.937] [-.984] [#2] [0] o1 elseif [#1 EQ 3] diff --git a/nc_files/HEMS/HEMS-0002.ngc b/nc_files/HEMS/HEMS-0002.ngc index f8802ee..72b3f92 100755 --- a/nc_files/HEMS/HEMS-0002.ngc +++ b/nc_files/HEMS/HEMS-0002.ngc @@ -43,15 +43,25 @@ o10 elseif [# EQ 2] o call [#/2][-#/2] [.937] [-.19][-.45] [0.01] [+4] ; cleanup the corners - o call [#/2+.38][-#/2+.38] [0.02][-0.45] - o call [#/2-.38][-#/2+.38] [0.02][-0.45] - o call [#/2-.38][-#/2-.38] [0.02][-0.45] - o call [#/2+.38][-#/2-.38] [0.02][-0.45] + #<_z_top> = 0.02 + #<_z_bot> = -0.45 + o call [#/2+.38][-#/2+.38] + #<_z_top> = 0.02 + #<_z_bot> = -0.45 + o call [#/2-.38][-#/2+.38] + #<_z_top> = 0.02 + #<_z_bot> = -0.45 + o call [#/2-.38][-#/2-.38] + #<_z_top> = 0.02 + #<_z_bot> = -0.45 + o call [#/2+.38][-#/2-.38] o10 elseif [# EQ 3] F10 # = .96 - o call [#/2+#/2][-#/2+#/2] [#/2-#/2][-#/2-#/2] [0.02][-.45] + #<_z_top> = 0.02 + #<_z_bot> = -.45 + o call [0] [#/2+#/2][-#/2+#/2] [#/2-#/2][-#/2-#/2] o10 endif diff --git a/nc_files/HEMS/HEMS-0003.cnc b/nc_files/HEMS/HEMS-0003.cnc deleted file mode 100755 index f8802ee..0000000 --- a/nc_files/HEMS/HEMS-0003.cnc +++ /dev/null @@ -1,59 +0,0 @@ -#<_z_clearance> = 0.5 -#<_rampang> = 5 -;#<_stepover> = 0.08 - -;#<_overlap> = 0 - -; +1: Conventional milling -; +2: Both-ways milling -; +4: Plunge entry -; +8: Outside - - -G20 ; G21 mm / G20 inch -G10 L1 P1 Z0.0 R.125 ; set tool -T1 ; set tool to T1 -M06 ; manual toolchange -G54 ; absolute coordinates -;F5 ; inch or mm/min (300 mm/min = about 1 ft/min) - -# = 3 - -# = 3.0 -# = [40/25.4] - - -o10 if [# EQ 1] - F3 - o call [#/2][-#/2] [0.1][-0.5] - - o call [#/2+#/SQRT[2]][-#/2+#/SQRT[2]] [0.1][-0.5] - o call [#/2+#/SQRT[2]][-#/2-#/SQRT[2]] [0.1][-0.5] - o call [#/2-#/SQRT[2]][-#/2-#/SQRT[2]] [0.1][-0.5] - o call [#/2-#/SQRT[2]][-#/2+#/SQRT[2]] [0.1][-0.5] - - -o10 elseif [# EQ 2] - F8 - ; exterior - o call [#/2][-#/2] [#][40/25.4] [0.02] [-0.125] [0.01] - - ; center pocket - o call [#/2][-#/2] [.937] [0.02][-.19] [0.01] [0] - o call [#/2][-#/2] [.937] [-.19][-.45] [0.01] [+4] - - ; cleanup the corners - o call [#/2+.38][-#/2+.38] [0.02][-0.45] - o call [#/2-.38][-#/2+.38] [0.02][-0.45] - o call [#/2-.38][-#/2-.38] [0.02][-0.45] - o call [#/2+.38][-#/2-.38] [0.02][-0.45] - -o10 elseif [# EQ 3] - F10 - # = .96 - o call [#/2+#/2][-#/2+#/2] [#/2-#/2][-#/2-#/2] [0.02][-.45] - -o10 endif - - -M2 ; end program diff --git a/nc_files/HEMS/HEMS-0003.ngc b/nc_files/HEMS/HEMS-0003.ngc index f04abfa..eeea496 100755 --- a/nc_files/HEMS/HEMS-0003.ngc +++ b/nc_files/HEMS/HEMS-0003.ngc @@ -37,34 +37,56 @@ o10 if [# EQ 1] o10 elseif [# EQ 2] F12 ; exterior - o call [#/2][-#/2] [3.0] [0.02][-0.002] + #<_z_top> = 0.02 + #<_z_bot> = -0.002 + o call [0] [#/2][-#/2] [3.0] F8 o call [#/2][-#/2] [#][2.8125] [0.02] [-0.125] [0.01] ; ream the holes - o call [#/2+#/SQRT[2]][-#/2+#/SQRT[2]] [.45] [0.1][-0.6] [0][+4] - o call [#/2+#/SQRT[2]][-#/2-#/SQRT[2]] [.45] [0.1][-0.6] [0][+4] - o call [#/2-#/SQRT[2]][-#/2-#/SQRT[2]] [.45] [0.1][-0.6] [0][+4] - o call [#/2-#/SQRT[2]][-#/2+#/SQRT[2]] [.45] [0.1][-0.6] [0][+4] - + #<_z_top> = 0.1 + #<_z_bot> = -0.6 + o call [+4] [#/2+#/SQRT[2]][-#/2+#/SQRT[2]] [.45] [0] + #<_z_top> = 0.1 + #<_z_bot> = -0.6 + o call [+4] [#/2+#/SQRT[2]][-#/2-#/SQRT[2]] [.45] [0] + #<_z_top> = 0.1 + #<_z_bot> = -0.6 + o call [+4] [#/2-#/SQRT[2]][-#/2-#/SQRT[2]] [.45] [0] + #<_z_top> = 0.1 + #<_z_bot> = -0.6 + o call [+4] [#/2-#/SQRT[2]][-#/2+#/SQRT[2]] [.45] [0] + ; center pocket o call [#/2][-#/2] [.95] [0.02][-.18] [0] o call [#/2][-#/2] [.95] [-.18][-.36] [0] o call [#/2][-#/2] [.95] [-.36][-.55] [0] - + ; cleanup the corners - o call [#/2+.38][-#/2+.38] [0.02][-0.6] - o call [#/2-.38][-#/2+.38] [0.02][-0.6] - o call [#/2-.38][-#/2-.38] [0.02][-0.6] - o call [#/2+.38][-#/2-.38] [0.02][-0.6] + #<_z_top> = 0.02 + #<_z_bot> = -0.6 + o call [#/2+.38][-#/2+.38] + #<_z_top> = 0.02 + #<_z_bot> = -0.6 + o call [#/2-.38][-#/2+.38] + #<_z_top> = 0.02 + #<_z_bot> = -0.6 + o call [#/2-.38][-#/2-.38] + #<_z_top> = 0.02 + #<_z_bot> = -0.6 + o call [#/2+.38][-#/2-.38] - o call [#/2+#/2][-#/2+#/2] [#/2-#/2][-#/2-#/2] [0.02][-.55] + #<_z_top> = 0.02 + #<_z_bot> = -.55 + o call [0] [#/2+#/2][-#/2+#/2] [#/2-#/2][-#/2-#/2] o10 elseif [# EQ 3] F8 - o call [#/2+#/2][-#/2+#/2] [#/2-#/2][-#/2-#/2] [0.02][-.55] + #<_z_top> = 0.02 + #<_z_bot> = -.55 + o call [0] [#/2+#/2][-#/2+#/2] [#/2-#/2][-#/2-#/2] o10 endif diff --git a/nc_files/HEMS/HEMS-0030.ngc b/nc_files/HEMS/HEMS-0030.ngc index 3265652..d86ed77 100755 --- a/nc_files/HEMS/HEMS-0030.ngc +++ b/nc_files/HEMS/HEMS-0030.ngc @@ -15,8 +15,12 @@ M06 ; manual toolchange G54 ; absolute coordinates F13 ; mm/min (300 mm/min = about 1 ft/min) -;o call [0][0] [2.05] [.1][-.5] [.01] [0+4] -o call [0][0] [2.055] [.1][-.5] [0] [0] +;#<_z_top> = .1 +;#<_z_bot> = -.5 +;o call [0+4] [0][0] [2.05] [.01] +#<_z_top> = .1 +#<_z_bot> = -.5 +o call [0] [0][0] [2.055] [0] diff --git a/nc_files/HEMS/HEMS-0033.ngc b/nc_files/HEMS/HEMS-0033.ngc index 4dcb76f..a39fbd2 100755 --- a/nc_files/HEMS/HEMS-0033.ngc +++ b/nc_files/HEMS/HEMS-0033.ngc @@ -15,10 +15,18 @@ M06 ; manual toolchange G54 ; absolute coordinates F4 ; mm/min (300 mm/min = about 1 ft/min) -o call [5-3][-1] [.1][-.7] [.2] -o call [8-3][-1] [.1][-.7] [.2] -o call [5-3][-3] [.1][-.7] [.2] -o call [8-3][-3] [.1][-.7] [.2] +#<_z_top> = .1 +#<_z_bot> = -.7 +o call [5-3][-1] [.2] +#<_z_top> = .1 +#<_z_bot> = -.7 +o call [8-3][-1] [.2] +#<_z_top> = .1 +#<_z_bot> = -.7 +o call [5-3][-3] [.2] +#<_z_top> = .1 +#<_z_bot> = -.7 +o call [8-3][-3] [.2] M30 M2 ; end program diff --git a/nc_files/HEMS/HEMS-RELAYPANEL.ngc b/nc_files/HEMS/HEMS-RELAYPANEL.ngc index 6d0e136..cdb64d8 100755 --- a/nc_files/HEMS/HEMS-RELAYPANEL.ngc +++ b/nc_files/HEMS/HEMS-RELAYPANEL.ngc @@ -18,18 +18,38 @@ F10 ; 10 ft/min #1 = 1 o10 if [#1 EQ 1] - o call [ .325][-.25] [0.1][-0.3] - o call [ .325][-3.0] [0.1][-0.3] - o call [7.675][-3.0] [0.1][-0.3] - o call [7.675][-.25] [0.1][-0.3] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [ .325][-.25] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [ .325][-3.0] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [7.675][-3.0] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [7.675][-.25] o10 else if [#1 EQ 2] - o call [1.4][-.75] [0.1][-0.3] - o call [4.0][-.75] [0.1][-0.3] - o call [4.0][-2.5] [0.1][-0.3] - o call [1.4][-2.5] [0.1][-0.3] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [1.4][-.75] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [4.0][-.75] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [4.0][-2.5] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [1.4][-2.5] - o call [5.4][-.525] [0.1][-0.3] - o call [6.4][-2.725] [0.1][-0.3] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [5.4][-.525] + #<_z_top> = 0.1 + #<_z_bot> = -0.3 + o call [6.4][-2.725] o10 endif diff --git a/nc_files/HEMS/HEMS-TENSIONER.cnc b/nc_files/HEMS/HEMS-TENSIONER.cnc deleted file mode 100755 index 1c3e4be..0000000 --- a/nc_files/HEMS/HEMS-TENSIONER.cnc +++ /dev/null @@ -1,34 +0,0 @@ -#<_z_clearance> = 0.4 -#<_rampang> = 5 - -;#<_overlap> = 0 - -; +1: Conventional milling -; +2: Both-ways milling -; +4: Plunge entry -; +8: Outside - - -G10 L1 P1 Z0.0 R[8/25.4 /2] ; set tool -T1 ; set tool to T1 -M06 ; manual toolchange -G54 ; absolute coordinates -F10 ; 10 ft/min - -#1 = 1 - -o10 if [#1 EQ 1] - o call [ 0.75][-.75] [0.1][-0.45] - o call [ 2.35][-.75] [0.1][-0.45] - ;o call [ 3.35][-.75] [0.1][-0.45] - o call [ 4.35][-.75] [0.1][-0.45] - ;o call [ 5.35][-.75] [0.1][-0.45] - -o10 else if [#1 EQ 2] - o call [2.35][-.75] [3.35][-.75] [.35] [0.1][-0.45] [0.01] [+4] - o call [3.35][-.75] [4.35][-.75] [.35] [0.1][-0.45] [0.01] [+4] - -o10 endif - - -M2 ; end program diff --git a/nc_files/HEMS/HEMS-TENSIONER.ngc b/nc_files/HEMS/HEMS-TENSIONER.ngc index f4c4804..3a76ad2 100755 --- a/nc_files/HEMS/HEMS-TENSIONER.ngc +++ b/nc_files/HEMS/HEMS-TENSIONER.ngc @@ -27,7 +27,9 @@ o10 if [#1 EQ 1] o10 else if [#1 EQ 2] F10.0 - o call [0.75][0] [12/25.4] [0.1][-0.45] [0.0] [4] + #<_z_top> = 0.1 + #<_z_bot> = -0.45 + o call [4] [0.75][0] [12/25.4] [0.0] F5.0 o call [3.35][0] [2.35][0] [.33] [0.1][-0.45] [0.0] [4] o call [5.35][0] [4.35][0] [.33] [0.1][-0.45] [0.0] [4] diff --git a/nc_files/HEPHAESTUS-ENCBRACKET.ngc b/nc_files/HEPHAESTUS-ENCBRACKET.ngc index 22c2b4a..32ca70f 100644 --- a/nc_files/HEPHAESTUS-ENCBRACKET.ngc +++ b/nc_files/HEPHAESTUS-ENCBRACKET.ngc @@ -1,21 +1,21 @@ #<_z_clearance> = 0.4 # = 10 -#<_td> = 0.125 - M03 G4 P2 F5 -o call [ 7/25.4] [-15/25.4] [[4-.7]/25.4] [0.05][-0.3] -o call [75/25.4] [-15/25.4] [[4-.7]/25.4] [0.05][-0.3] +#<_z_top> = 0.05 +#<_z_bot> = -0.3 +o call [0] [ 7/25.4] [-15/25.4] [[4-.7]/25.4] +o call [0] [75/25.4] [-15/25.4] [[4-.7]/25.4] o call [ 7/25.4][-30/25.4] [ 7/25.4][-44/25.4] [6.1/25.4] [.05][-.3] o call [75/25.4][-30/25.4] [75/25.4][-44/25.4] [6.1/25.4] [.05][-.3] G0 Z0.5 -G0 X[82/25.4+#<_td>/2] Y0.1 +G0 X[82/25.4+#5410/2] Y0.1 G0 Z-0.3 G1 Y-2.1 M05 diff --git a/nc_files/HEQJ/HEQJ-P001.ngc b/nc_files/HEQJ/HEQJ-P001.ngc index 60e4791..756028b 100755 --- a/nc_files/HEQJ/HEQJ-P001.ngc +++ b/nc_files/HEQJ/HEQJ-P001.ngc @@ -1239,7 +1239,9 @@ M06 ; manual toolchange G54 ; absolute coordinates F10 ; 10 ft/min -o call [2.5][-1.0] [1.381] [0.01][-0.3] +#<_z_top> = 0.01 +#<_z_bot> = -0.3 +o call [0] [2.5][-1.0] [1.381] N6080 M30 diff --git a/nc_files/HEQJ/HEQJ-P001_FIN.ngc b/nc_files/HEQJ/HEQJ-P001_FIN.ngc index bff0660..727a751 100755 --- a/nc_files/HEQJ/HEQJ-P001_FIN.ngc +++ b/nc_files/HEQJ/HEQJ-P001_FIN.ngc @@ -15,6 +15,8 @@ M06 ; manual toolchange G54 ; absolute coordinates F10 ; 10 ft/min -o call [2.5][-1.0] [1.381] [0.01][-0.3] +#<_z_top> = 0.01 +#<_z_bot> = -0.3 +o call [0] [2.5][-1.0] [1.381] M2 ; end program diff --git a/nc_files/HEQJ/HEQJ-P022.ngc b/nc_files/HEQJ/HEQJ-P022.ngc index d484bd3..1297bac 100755 --- a/nc_files/HEQJ/HEQJ-P022.ngc +++ b/nc_files/HEQJ/HEQJ-P022.ngc @@ -15,23 +15,43 @@ M06 ; manual toolchange G54 ; absolute coordinates F2 ; feedrate -;o call [0.317][-0.508] [.165] [0.05][-0.18] [.00] [4] -;o call [1.183][-0.508] [.165] [0.05][-0.18] [.00] [4] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [0.317][-0.508] [.165] [.00] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [1.183][-0.508] [.165] [.00] -;o call [0.750][-0.508] [.130] [0.05][-0.18] [.00] [4] -;o call [0.750][-1.689] [.130] [0.05][-0.18] [.00] [4] -;o call [0.258][-1.492] [.130] [0.05][-0.18] [.00] [4] -;o call [1.242][-1.492] [.130] [0.05][-0.18] [.00] [4] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [0.750][-0.508] [.130] [.00] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [0.750][-1.689] [.130] [.00] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [0.258][-1.492] [.130] [.00] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [1.242][-1.492] [.130] [.00] -;o call [2.625][-1.000] [.200] [0.05][-0.18] [.00] [4] -;o call [4.000][-1.000] [.200] [0.05][-0.18] [.00] [4] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [2.625][-1.000] [.200] [.00] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.18 +;o call [4] [4.000][-1.000] [.200] [.00] F5 #1 = -.010 ; finish cut -o call [4.748+#1][-.265-#1] [5.578-#1][-1.735+#1] [0.05][-0.2] +#<_z_top> = 0.05 +#<_z_bot> = -0.2 +o call [0] [4.748+#1][-.265-#1] [5.578-#1][-1.735+#1] ;F5 -;o call [4.748][-.265] [5.578][-1.735] [0.05][-0.2] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.2 +;o call [0] [4.748][-.265] [5.578][-1.735] diff --git a/nc_files/MMH-WINDOW-DRILL.ngc b/nc_files/MMH-WINDOW-DRILL.ngc index 7b79c13..db0b044 100644 --- a/nc_files/MMH-WINDOW-DRILL.ngc +++ b/nc_files/MMH-WINDOW-DRILL.ngc @@ -4,8 +4,10 @@ M03 ; Start spindle F10 ; Feed -o call [3.25][-0.5] [0.05][-0.35] [0.2] -o call [11.875][-0.5] [0.05][-0.35] [0.2] +#<_z_top> = 0.05 +#<_z_bot> = -0.35 +o call [3.25][-0.5] [0.2] +o call [11.875][-0.5] [0.2] M05 ; Stop Spindle M30 ; End Program diff --git a/nc_files/MMHR-PALMREST.ngc b/nc_files/MMHR-PALMREST.ngc index 542b29b..77ba82f 100755 --- a/nc_files/MMHR-PALMREST.ngc +++ b/nc_files/MMHR-PALMREST.ngc @@ -19,22 +19,20 @@ G54 ; absolute coordinates o200 sub ;[Y][Z] G0 Z[#<_z_clearance>] - G0 X[#<_x_start>-#<_td>] Y[#1] + G0 X[#<_x_start>-#5410] Y[#1] G0 Z[#2] - G1 X[#<_x_end>+#<_td>] + G1 X[#<_x_end>+#5410] G0 Y[-#1] - G1 X[#<_x_start>-#<_td>] + G1 X[#<_x_start>-#5410] o200 endsub -#<_td> = 0.75 -#<_r_adj> = [#<_r> - #<_td>/2] -# = ACOS[[#<_z_ctr>-#<_td>/2]/#<_r_adj>] +#<_r_adj> = [#<_r> - #5410/2] +# = ACOS[[#<_z_ctr>-#5410/2]/#<_r_adj>] ;# = [#<_z_ctr> - #<_r_adj>] # = [#<_r_adj>*SIN[#]] o10 if [# EQ 1] - #<_td> = 0.5 F5 o200 call [0][-.35] @@ -50,7 +48,7 @@ o10 elseif [# EQ 2] # = # ; o105 while [# LT #] - o200 call [SIN[#]*#<_r_adj>][#<_z_ctr>-COS[#]*#<_r_adj>-#<_td>/2] + o200 call [SIN[#]*#<_r_adj>][#<_z_ctr>-COS[#]*#<_r_adj>-#5410/2] # = [# + 2] ; o105 endwhile @@ -75,34 +73,35 @@ o10 elseif [# EQ 3] o101 if [# MOD 2] G1 X# Y+# Z0 - G2 X# Y-# Z0 J0 K[#<_z_ctr>-#<_td>/2] + G2 X# Y-# Z0 J0 K[#<_z_ctr>-#5410/2] o101 else G1 X# Y-# Z0 - G3 X# Y+# Z0 J0 K[#<_z_ctr>-#<_td>/2] + G3 X# Y+# Z0 J0 K[#<_z_ctr>-#5410/2] o101 endif o100 endwhile o10 elseif [# EQ 11] - #<_td> = [3/16] F4 + #<_z_top> = 0.0 + #<_z_bot> = -0.4 ;o call [1.476][-.232] [1.476][+.232] [5.5/25.4] [0.0][-0.4] - o call [2.264][-.232] [2.264][+.232] [7.0/25.4] [0.0][-0.4] - o call [2.264][-.232] [2.264][+.232] [8.5/25.4] [0.0][-0.4] - o call [2.264][-.232] [2.264][+.232] [10.0/25.4] [0.0][-0.4] + o call [0] [2.264][-.232] [2.264][+.232] [7.0/25.4] + o call [0] [2.264][-.232] [2.264][+.232] [8.5/25.4] + o call [0] [2.264][-.232] [2.264][+.232] [10.0/25.4] ;o call [3.051][-.232] [3.051][+.232] [5.5/25.4] [0.0][-0.4] o10 elseif [# EQ 12] - #<_td> = [5/25.4] F4 - o call [1.476][-.232] [1.476][+.232] [9.5/25.4] [0.0][-3.2/25.4] - o call [2.264][-.232] [2.264][+.232] [14/25.4] [0.0][-3.2/25.4] - o call [3.051][-.232] [3.051][+.232] [9.5/25.4] [0.0][-3.2/25.4] + #<_z_top> = 0.0 + #<_z_bot> = -3.2/25.4 + o call [0] [1.476][-.232] [1.476][+.232] [9.5/25.4] + o call [0] [2.264][-.232] [2.264][+.232] [14/25.4] + o call [0] [3.051][-.232] [3.051][+.232] [9.5/25.4] o10 elseif [# EQ 21] - #<_td> = [7/16] #<_rc> = 0.3 #<_yr> = 1.005 @@ -111,8 +110,8 @@ o10 elseif [# EQ 21] # = 0 o300 while [# LT 90] - # = [#<_yr>-#<_rc>+[#<_rc>+#<_td>/2]*COS[#]] - # = [-#<_rc>+[#<_rc>+#<_td>/2]*SIN[#]-#<_td>/2] + # = [#<_yr>-#<_rc>+[#<_rc>+#5410/2]*COS[#]] + # = [-#<_rc>+[#<_rc>+#5410/2]*SIN[#]-#5410/2] o200 call [#][#] diff --git a/nc_files/OFFSETS.md b/nc_files/OFFSETS.md new file mode 100644 index 0000000..34198e0 --- /dev/null +++ b/nc_files/OFFSETS.md @@ -0,0 +1,137 @@ +# Offsets Quick Reference + +## Coordinate Stack + +``` +What you see = machine position + work offset (G54...) + G52/G92 + tool length offset (G43) +``` + +`G53` bypasses everything and moves in machine coords. + +## Work Offsets (G54–G59.3) + +9 available coordinate systems. G54 is default. Persist across power cycles (stored in `linuxcnc.var`). + +### Touching off work zero + +**In GMOCCAPY**: Jog to desired zero, click the axis letter (X/Y/Z) in the DRO, enter `0`. Done. +Internally: `G10 L20 P0 0` + +**Pendant**: Macro 5/6/7 = zero X/Y/Z. Macro 1/2 = halve X/Y (center-finding: zero one edge, jog to other edge, halve). + +**In G-code**: +```gcode +G10 L20 P1 X0 Y0 Z0 ; set G54 origin to current position +G10 L20 P0 X0 ; set current system's X to 0 +``` + +### Switching systems + +```gcode +G55 ; all coords now relative to work offset 2 +``` + +In GMOCCAPY: Offset page > click row > "Set Active". + +### Editing numerically + +In GMOCCAPY: Offset page > double-click a cell > type value. This uses `G10 L2` (absolute set), not touch-off. + +### Temporary offsets + +```gcode +G52 X1 Y1 ; shift on top of active G5x (good for pattern repeats) +G52 X0 Y0 ; cancel +``` + +Avoid `G92` — it persists across program runs and causes confusion. Use `G92.1` to clear if needed. + +## Tool Length + +### Setting up a tool (first time) + +1. In GMOCCAPY Tool page: set diameter (D column) and any known Z offset. Click "Apply Changes". +2. Or in G-code: `G10 L1 P1 Z-2.5 R0.125` (R = **radius**, stored as D = diameter = 2R) + +### Loading a tool + +```gcode +T1 M6 ; select + change (pops up dialog, operator confirms) +G43 ; activate its Z offset — REQUIRED or Z is wrong +``` + +### Touching off tool length + +Jog tool tip down to top of workpiece, then in MDI: + +```gcode +G10 L10 P1 Z0 ; "tip is at Z=0, calculate and store the offset" +G43 ; activate it +``` + +Or: GMOCCAPY DRO > click Z letter > enter `0` (but this sets the **work offset**, not the tool offset — different thing). + +### Canceling + +```gcode +G49 ; cancel tool length offset +``` + +Standard practice: `G49` before each tool change, `G43` after. + +## Cutter Radius Compensation (G41/G42) + +Offsets the toolpath left or right of the programmed line by the tool's radius. Program the actual part edge; the machine handles the rest. + +```gcode +G41 ; offset LEFT of path (climb milling outside profiles) +G42 ; offset RIGHT +G40 ; cancel +``` + +The D word in G41/G42 is a **tool number** (not a diameter): `G41 D1` looks up tool 1's diameter from the table. Omit D to use the current tool. + +Rules: +- Lead-in move after G41/G42 must be >= tool radius +- Lead-out move with G40 must be >= tool radius +- Must be in G17 (XY plane) + +```gcode +G41 ; comp on +G1 X0 Y0 F10 ; lead-in (this IS the first compensated move) +G1 X2 Y0 ; cut along part edge — tool rides 1 radius to the left +G1 X2 Y2 +G40 ; comp off (next linear move is lead-out) +G0 X-1 Y-1 +``` + +Dynamic variant: `G41.1 D0.250` — D is a literal diameter value, not a tool number. + +**Our macros** handle radius compensation internally via `#<_td>`. Don't use G41/G42 with macro calls. + +## Tool Table Columns (mill) + +| Column | Meaning | +|--------|---------| +| T | Tool number | +| P | Pocket (we use P = T) | +| Z | Length offset | +| D | Diameter (not radius) | + +## DRO Modes (click axis value to cycle) + +| Mode | Color | Shows | +|------|-------|-------| +| Relative | Black | Work coords (what G-code sees) | +| Absolute | Blue | Machine coords (G53) | +| DTG | Yellow | Distance to go | + +Green digits = homed. Red = unhomed. + +## Named Parameters + +| Parameter | Value | +|-----------|-------| +| `#<_current_tool>` / `#5400` | Tool in spindle | +| `#5410` | Current tool diameter | +| `#<_td>` | Our macros' tool diameter (user-set, not built-in) | diff --git a/nc_files/PIGPEN-BOTTOM.ngc b/nc_files/PIGPEN-BOTTOM.ngc index 21cda47..8ce6050 100644 --- a/nc_files/PIGPEN-BOTTOM.ngc +++ b/nc_files/PIGPEN-BOTTOM.ngc @@ -1,17 +1,18 @@ #<_z_clearance> = 0.2 # = 10 -#<_td> = 0.125 +#<_z_top> = 0.1 +#<_z_bot> = -0.3 M03 G4 P2 F5 -;o call [0.75][+2] [0.1][-0.3] -o call [0.75][-2] [0.1][-0.3] -o call [2.25+1.5+.75][+0] [0.1][-0.3] -o call [2.25+3.0+.75][+0] [0.1][-0.3] -;o call [2.25+4.5][+0] [0.1][-0.3] +;o call [0.75][+2] +o call [0.75][-2] +o call [2.25+1.5+.75][+0] +o call [2.25+3.0+.75][+0] +;o call [2.25+4.5][+0] M05 M30 \ No newline at end of file diff --git a/nc_files/PIGPEN-CLAMP.ngc b/nc_files/PIGPEN-CLAMP.ngc index 39ef26b..312ef25 100644 --- a/nc_files/PIGPEN-CLAMP.ngc +++ b/nc_files/PIGPEN-CLAMP.ngc @@ -1,7 +1,5 @@ #<_z_clearance> = 0.2 # = 10 -#<_td> = 0.1875 - M03 G4 P2 @@ -11,7 +9,9 @@ F5 #1 = 0.75 o10 while [#1 LT 12] -o call [#1-.2][-.34/2] [#1+.2][+.34/2] [0.1][-0.3] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [0] [#1-.2][-.34/2] [#1+.2][+.34/2] #1 = [#1+0.75] o10 endwhile diff --git a/nc_files/SC-0027.ngc b/nc_files/SC-0027.ngc index 4a98d47..2cdf177 100755 --- a/nc_files/SC-0027.ngc +++ b/nc_files/SC-0027.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = 0.5 #<_rampang> = 10 -#<_td> = [9/16] ;#<_stepover> = 0.2 ;#<_overlap> = 0 @@ -19,7 +18,9 @@ M03 F30 ;o call [-1.5][-1.5] [.75][-1.5] [1.70] [0.1][-1.1] [0][4] -o call [.75][-1.5] [-1.5][-1.5] [1.77] [.1][-1.1] [0][4] +#<_z_top> = .1 +#<_z_bot> = -1.1 +o call [4] [.75][-1.5] [-1.5][-1.5] [1.77] [0] M05 diff --git a/nc_files/SC-0030-V1.ngc b/nc_files/SC-0030-V1.ngc index 7da02cf..b8ea648 100644 --- a/nc_files/SC-0030-V1.ngc +++ b/nc_files/SC-0030-V1.ngc @@ -3,7 +3,6 @@ ;M03 ; start spindle F12 ; feedrate -#<_td> = 0.5 M6 T1 ; tool 1: 1/2" endmill G43 M03 @@ -11,27 +10,27 @@ G4 P1 ; wait 2 sec (spindle start) ; drive end ;G0 Z#<_z_clearance> -;G0 X[#<_td>/2] Y[#<_td>/4] +;G0 X[#5410/2] Y[#5410/4] ;G0 Z-0.65 -;G1 Y[-0.5-#<_td>/4] +;G1 Y[-0.5-#5410/4] ; drive flat G0 Z#<_z_clearance> -G0 X[-.4375+#<_td>/2] Y0.15 +G0 X[-.4375+#5410/2] Y0.15 G0 Z-.115 G1 Y-.6 ; dead flat G0 Z#<_z_clearance> -G0 X[-5.625-#<_td>/2] Y0.15 +G0 X[-5.625-#5410/2] Y0.15 G0 Z-.08 G1 Y-.6 ; drive end ;G0 Z#<_z_clearance> -;G0 X[-5.875-#<_td>/2] Y[-0.5-#<_td>/4] +;G0 X[-5.875-#5410/2] Y[-0.5-#5410/4] ;G0 Z-0.65 -;G1 Y[#<_td>/4] +;G1 Y[#5410/4] M05 G0 X-8 diff --git a/nc_files/SC-0065-V1-DRILL.ngc b/nc_files/SC-0065-V1-DRILL.ngc index 4631dda..c01c97d 100644 --- a/nc_files/SC-0065-V1-DRILL.ngc +++ b/nc_files/SC-0065-V1-DRILL.ngc @@ -3,16 +3,17 @@ ;M03 ; start spindle F7 ; feedrate -;#<_td> = 0.5 ;M6 T1 ; tool 1: 1/2" endmill ;G43 M03 G4 P1 ; wait 2 sec (spindle start) -o call [0.30] [0] [0.05] [ -1.15] [0.18] -o call [1.00] [0] [0.05] [ -1.15] [0.18] -o call [13.75] [0] [0.05] [ -1.15] [0.18] -o call [14.45] [0] [0.05] [ -1.15] [0.18] +#<_z_top> = 0.05 +#<_z_bot> = -1.15 +o call [0.30] [0] [0.18] +o call [1.00] [0] [0.18] +o call [13.75] [0] [0.18] +o call [14.45] [0] [0.18] M05 ; stop spindle G0 X0.3 diff --git a/nc_files/SC-0065-V1-KEY.ngc b/nc_files/SC-0065-V1-KEY.ngc index 00529db..d10d32f 100644 --- a/nc_files/SC-0065-V1-KEY.ngc +++ b/nc_files/SC-0065-V1-KEY.ngc @@ -3,7 +3,6 @@ ;M03 ; start spindle F12 ; feedrate -;#<_td> = 0.5 ;M6 T1 ; tool 1: 1/2" endmill ;G43 M03 diff --git a/nc_files/SC-0065-V1.ngc b/nc_files/SC-0065-V1.ngc index f661b85..028d4ef 100755 --- a/nc_files/SC-0065-V1.ngc +++ b/nc_files/SC-0065-V1.ngc @@ -3,7 +3,6 @@ ;M03 ; start spindle F12 ; feedrate -;#<_td> = 0.5 ;M6 T1 ; tool 1: 1/2" endmill ;G43 M03 diff --git a/nc_files/SC-0065.cnc b/nc_files/SC-0065.cnc deleted file mode 100755 index 7192ca9..0000000 --- a/nc_files/SC-0065.cnc +++ /dev/null @@ -1,63 +0,0 @@ -#<_z_clearance> = +0.200 ; clearance height - -;M03 ; start spindle -F12 ; feedrate - -#<_td> = 0.5 -M6 T1 ; tool 1: 1/2" endmill -G43 -M03 -G4 P1 ; wait 2 sec (spindle start) - -; drive end -;G0 Z#<_z_clearance> -;G0 X[#<_td>/2] Y[#<_td>/4] -;G0 Z-0.65 -;G1 Y[-0.5-#<_td>/4] - -; drive flat -G0 Z#<_z_clearance> -G0 X[-.4375+#<_td>/2] Y0.15 -G0 Z-.115 -G1 Y-.6 - -; dead flat -G0 Z#<_z_clearance> -G0 X[-5.625-#<_td>/2] Y0.15 -G0 Z-.08 -G1 Y-.6 - -; drive end -;G0 Z#<_z_clearance> -;G0 X[-5.875-#<_td>/2] Y[-0.5-#<_td>/4] -;G0 Z-0.65 -;G1 Y[#<_td>/4] - -M05 -G0 X-8 -M6 T2 ; tool 2: 5/32" drillbit -M03 -G43 -G4 P0.5 - -G0 Z#<_z_clearance> -G0 X-.170 Y-.25 -G0 Z-.1 -G1 Z-.6 F5 - - -G0 Z#<_z_clearance> -G0 X-5.705 Y-.25 -G0 Z-.08 -G1 Z-.15 F1 -G1 Z-.6 F4 - -G0 Z#<_z_clearance> - - - -M05 ; stop spindle -G0 X-8 -M30 ; end program -M2 ; also end program -% \ No newline at end of file diff --git a/nc_files/SC-0065.ngc b/nc_files/SC-0065.ngc index 99f43b2..9250d93 100755 --- a/nc_files/SC-0065.ngc +++ b/nc_files/SC-0065.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = 0.5 #<_rampang> = 10 -#<_td> = [1/4] ;#<_stepover> = 0.1 ;#<_overlap> = 0 diff --git a/nc_files/SC-0151-V2.ngc b/nc_files/SC-0151-V2.ngc index 9b20495..0ed9004 100644 --- a/nc_files/SC-0151-V2.ngc +++ b/nc_files/SC-0151-V2.ngc @@ -1,5 +1,3 @@ -#<_td> = [3/16] -G10 L1 P1 R[#<_td>/2] ; Set tool 1 diameter #<_z_clearance> = 0.5 # = 12 #<_zd> = -0.6 @@ -62,19 +60,33 @@ G90.0 o sub # = 0.2 - o call [#1][#2] [0.1] [-0.6] [0.2] - o call [#1] [#2] [#] [0.1] [-0.6] [0] [+4] + #<_z_top> = 0.1 + #<_z_bot> = -0.6 + o call [#1][#2] [0.2] + o call [+4] [#1] [#2] [#] [0] o endsub F20 # = 0.315 # = 0.35 -o call [0.550][-0.446] [#] [0.02][#<_zd>] [0][4] -o call [0.550][-0.446] [#] [0.02][-0.08] [0][4] -o call [0.550][-3.304] [#] [0.02][#<_zd>] [0][4] -o call [0.550][-3.304] [#] [0.02][-0.08] [0][4] -o call [3.025][-1.875] [#] [0.02][#<_zd>] [0][4] -o call [3.025][-1.875] [#] [0.02][-0.08] [0][4] +#<_z_top> = 0.02 +#<_z_bot> = #<_zd> +o call [4] [0.550][-0.446] [#] [0] +#<_z_top> = 0.02 +#<_z_bot> = -0.08 +o call [4] [0.550][-0.446] [#] [0] +#<_z_top> = 0.02 +#<_z_bot> = #<_zd> +o call [4] [0.550][-3.304] [#] [0] +#<_z_top> = 0.02 +#<_z_bot> = -0.08 +o call [4] [0.550][-3.304] [#] [0] +#<_z_top> = 0.02 +#<_z_bot> = #<_zd> +o call [4] [3.025][-1.875] [#] [0] +#<_z_top> = 0.02 +#<_z_bot> = -0.08 +o call [4] [3.025][-1.875] [#] [0] F20 # =0.3 o call [5.625][-0.375] diff --git a/nc_files/SC-0151.ngc b/nc_files/SC-0151.ngc index 90cbf5a..471d8dc 100755 --- a/nc_files/SC-0151.ngc +++ b/nc_files/SC-0151.ngc @@ -1,4 +1,3 @@ -#<_td> = [3/16] #<_z_clearance> = 0.2 # = 4 #<_zd> = 0.6 @@ -51,17 +50,21 @@ o endsub o call [1.375][-1.875] # = 0.315 -o call [0.550][-0.446] [#] [0.02][#<_zd>] -o call [0.550][-3.304] [#] [0.02][#<_zd>] -o call [3.025][-1.875] [#] [0.02][#<_zd>] +#<_z_top> = 0.02 +#<_z_bot> = #<_zd> +o call [0] [0.550][-0.446] [#] +o call [0] [0.550][-3.304] [#] +o call [0] [3.025][-1.875] [#] # = 0.20 -o call [5.625][-0.375] [#] [0.1][-0.6] -o call [5.125][-1.125] [#] [0.1][-0.6] -o call [5.625][-1.875] [#] [0.1][-0.6] -o call [5.125][-2.625] [#] [0.1][-0.6] -o call [5.625][-3.375] [#] [0.1][-0.6] +#<_z_top> = 0.1 +#<_z_bot> = -0.6 +o call [0] [5.625][-0.375] [#] +o call [0] [5.125][-1.125] [#] +o call [0] [5.625][-1.875] [#] +o call [0] [5.125][-2.625] [#] +o call [0] [5.625][-3.375] [#] M05 G0 Z#<_z_clearance> diff --git a/nc_files/SC-0155-V1-B.ngc b/nc_files/SC-0155-V1-B.ngc index 514aa87..b293c3b 100755 --- a/nc_files/SC-0155-V1-B.ngc +++ b/nc_files/SC-0155-V1-B.ngc @@ -12,10 +12,11 @@ M03 F5.0 # = -0.14 -#<_td> = [3/32] #<_z_clearance> = 0.02 -;o call [0][0] [0.62] [#<_z_clearance>][#] [0] [0+4] +;#<_z_top> = #<_z_clearance> +;#<_z_bot> = # +;o call [0+4] [0][0] [0.62] [0] G91.1 ; incremental IJK diff --git a/nc_files/SC-0155-V1-SLOTS.ngc b/nc_files/SC-0155-V1-SLOTS.ngc index 47d1502..08b69dc 100755 --- a/nc_files/SC-0155-V1-SLOTS.ngc +++ b/nc_files/SC-0155-V1-SLOTS.ngc @@ -1,4 +1,3 @@ -#<_td> = 0.1875 #<_z_clearance> = 0.2 M03 diff --git a/nc_files/SC-0155-V1.ngc b/nc_files/SC-0155-V1.ngc index 580cc42..31b3ecb 100755 --- a/nc_files/SC-0155-V1.ngc +++ b/nc_files/SC-0155-V1.ngc @@ -12,10 +12,11 @@ M03 F5.0 # = -0.14 -#<_td> = [3/32] #<_z_clearance> = 0.02 -o call [0][0] [0.62] [#<_z_clearance>][#] [0] [0+4] +#<_z_top> = #<_z_clearance> +#<_z_bot> = # +o call [0+4] [0][0] [0.62] [0] G91.1 ; incremental IJK diff --git a/nc_files/SC-0156.ngc b/nc_files/SC-0156.ngc index 4fd0c77..63eef94 100644 --- a/nc_files/SC-0156.ngc +++ b/nc_files/SC-0156.ngc @@ -1,7 +1,5 @@ #<_z_clearance> = 0.4 # = 10 -#<_td> = 0.125 - M03 G4 P0.5 diff --git a/nc_files/SC-0160-V2.ngc b/nc_files/SC-0160-V2.ngc index 0436968..9587e42 100644 --- a/nc_files/SC-0160-V2.ngc +++ b/nc_files/SC-0160-V2.ngc @@ -1,17 +1,20 @@ -#<_td> = [3/16] #<_z_clearance> = 0.5 # = 30 M03 F20 -o call [1.375][-1.875] [1.375] [+0.10][-0.6] [0] [+4] +#<_z_top> = +0.10 +#<_z_bot> = -0.6 +o call [+4] [1.375][-1.875] [1.375] [0] F14 o sub # = 0.2 - o call [#1][#2] [0.1] [-0.6] [0.2] - o call [#1] [#2] [#] [0.1] [-0.6] [0] [+4] + #<_z_top> = 0.1 + #<_z_bot> = -0.6 + o call [#1][#2] [0.2] + o call [+4] [#1] [#2] [#] [0] o endsub # =0.2 o call [5.625][-0.375] diff --git a/nc_files/SC-0160.ngc b/nc_files/SC-0160.ngc index 0edb3ea..38313da 100755 --- a/nc_files/SC-0160.ngc +++ b/nc_files/SC-0160.ngc @@ -1,18 +1,21 @@ -#<_td> = [3/16] #<_z_clearance> = 0.2 # = 10 M03 F20 -o call [1.375][-1.875] [1.375] [+0.10][-0.6] +#<_z_top> = +0.10 +#<_z_bot> = -0.6 +o call [0] [1.375][-1.875] [1.375] F14 -o call [5.625][-0.375] [0.20] [0.1][-0.6] -o call [5.125][-1.125] [0.20] [0.1][-0.6] -o call [5.625][-1.875] [0.20] [0.1][-0.6] -o call [5.125][-2.625] [0.20] [0.1][-0.6] -o call [5.625][-3.375] [0.20] [0.1][-0.6] +#<_z_top> = 0.1 +#<_z_bot> = -0.6 +o call [0] [5.625][-0.375] [0.20] +o call [0] [5.125][-1.125] [0.20] +o call [0] [5.625][-1.875] [0.20] +o call [0] [5.125][-2.625] [0.20] +o call [0] [5.625][-3.375] [0.20] M05 M30 \ No newline at end of file diff --git a/nc_files/SC-0172.ngc b/nc_files/SC-0172.ngc index 1cf01f7..ad26032 100755 --- a/nc_files/SC-0172.ngc +++ b/nc_files/SC-0172.ngc @@ -8,27 +8,29 @@ G4 P3 ; OP 1: Holes in side ; Origin: back middle o10 if [# EQ 1] - #<_td> = 0.125 F16 - o call [-.5][-.540] [0.500] [0.05][-0.2] [0.01] [+4] + #<_z_top> = 0.05 + #<_z_bot> = -0.2 + o call [+4] [-.5][-.540] [0.500] [0.01] - o call [-1.5][-.480] [0.05][-0.2] - o call [-1.5][-.680] [0.05][-0.2] - o call [-1.5][-.880] [0.05][-0.2] + o call [-1.5][-.480] + o call [-1.5][-.680] + o call [-1.5][-.880] ; OP 2: PG holes in bottom ; Origin: back middle o10 elseif [# EQ 2] - #<_td> = 0.125 F16 - o call [0.00][-3.150+1.920] [.84] [+0.10][-0.25] [0.01] [+4] - o call [-1.6][-3.150+2.230] [.84] [+0.10][-0.25] [0.01] [+4] - o call [+1.6][-3.150+2.230] [.84] [+0.10][-0.25] [0.01] [+4] + #<_z_top> = +0.10 + #<_z_bot> = -0.25 + o call [+4] [0.00][-3.150+1.920] [.84] [0.01] + o call [+4] [-1.6][-3.150+2.230] [.84] [0.01] + o call [+4] [+1.6][-3.150+2.230] [.84] [0.01] - o call [0.00][-3.150+1.920] [.89] [+0.10][-0.25] [0.01] [+4] - o call [-1.6][-3.150+2.230] [.89] [+0.10][-0.25] [0.01] [+4] - o call [+1.6][-3.150+2.230] [.89] [+0.10][-0.25] [0.01] [+4] + o call [+4] [0.00][-3.150+1.920] [.89] [0.01] + o call [+4] [-1.6][-3.150+2.230] [.89] [0.01] + o call [+4] [+1.6][-3.150+2.230] [.89] [0.01] G0 Z1.5 o10 endif diff --git a/nc_files/SC-0203.ngc b/nc_files/SC-0203.ngc index 1992b82..d86ce0b 100755 --- a/nc_files/SC-0203.ngc +++ b/nc_files/SC-0203.ngc @@ -8,20 +8,20 @@ M03 ; OP 1: Holes ; Origin: center o10 if [# EQ 1] - #<_td> = 0.25 F5 - o call [+2.913][+2.913] [0.05][-0.15] - o call [-2.913][+2.913] [0.05][-0.15] - o call [-2.913][-2.913] [0.05][-0.15] - o call [+2.913][-2.913] [0.05][-0.15] + #<_z_top> = 0.05 + #<_z_bot> = -0.15 + o call [+2.913][+2.913] + o call [-2.913][+2.913] + o call [-2.913][-2.913] + o call [+2.913][-2.913] ; OP 2: Outline ; Origin: center o10 elseif [# EQ 2] - #<_td> = 0.2 - #<_tr> = [#<_td>/2] + #<_tr> = [#5410/2] F5 @@ -29,8 +29,10 @@ o10 elseif [# EQ 2] G90.1 - o call [0][+2.375] [0][+1.625] [0.252] [0.05][-0.15] - o call [0][-2.375] [0][-1.625] [0.252] [0.05][-0.15] + #<_z_top> = 0.05 + #<_z_bot> = -0.15 + o call [0] [0][+2.375] [0][+1.625] [0.252] + o call [0] [0][-2.375] [0][-1.625] [0.252] G0 Z0.2 diff --git a/nc_files/SC-0252.ngc b/nc_files/SC-0252.ngc index d15f24d..bca054c 100644 --- a/nc_files/SC-0252.ngc +++ b/nc_files/SC-0252.ngc @@ -2,7 +2,6 @@ #<_z_clearance> = 0.2 -#<_td> = [3/16] #<_rampang> = 8 # = 1.05 @@ -30,7 +29,7 @@ G0 Z#<_z_clearance> ; outline F12 -G10 L1 P1 R[#<_td>/2] ; Set tool 1 diameter +G10 L1 P1 R[#5410/2] ; Set tool 1 diameter G0 X1.25 Y0.25 G41 D1 diff --git a/nc_files/SC-0279-V1.ngc b/nc_files/SC-0279-V1.ngc index 3ba6e28..190d755 100755 --- a/nc_files/SC-0279-V1.ngc +++ b/nc_files/SC-0279-V1.ngc @@ -1,4 +1,3 @@ -#<_td> = 0.25 #<_z_clearance> = 0.2 # = 6 @@ -10,7 +9,9 @@ F9 G90.1 ; absolute arc centers -o call [0][0] [.540] [+.05][-.2] +#<_z_top> = +.05 +#<_z_bot> = -.2 +o call [0] [0][0] [.540] G0 Z1.0 @@ -28,7 +29,9 @@ G2 I[#-#] J0 X[#-.84356-#] Y[+.61679] G1 Y[+1.0] G0 Z1.0 -;o call [0][0] [.540] [+0.10][-0.25] +;#<_z_top> = +0.10 +;#<_z_bot> = -0.25 +;o call [0] [0][0] [.540] M05 diff --git a/nc_files/SC-EGISPLATE.ngc b/nc_files/SC-EGISPLATE.ngc index 50aa534..07f425c 100644 --- a/nc_files/SC-EGISPLATE.ngc +++ b/nc_files/SC-EGISPLATE.ngc @@ -1,9 +1,5 @@ #<_z_clearance> = 0.5 #<_rampang> = 5 -#<_td> = [1/4] - - - M03 # = 2 @@ -13,11 +9,19 @@ M03 ;o10 if [# EQ 1] F10 -;o call [-1][0] [1.5] [0.05][-0.15] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.15 +;o call [0] [-1][0] [1.5] -o call [0.25][-0.375] [0.353*2] [.05][-0.4] -o call [0.25][-0.375] [0.353*2] [.05][-0.8] -o call [0.25][-0.375] [0.353*2] [.05][-1.25] +#<_z_top> = .05 +#<_z_bot> = -0.4 +o call [0] [0.25][-0.375] [0.353*2] +#<_z_top> = .05 +#<_z_bot> = -0.8 +o call [0] [0.25][-0.375] [0.353*2] +#<_z_top> = .05 +#<_z_bot> = -1.25 +o call [0] [0.25][-0.375] [0.353*2] ;o call [-1][+1] ;o call [-1][-1] diff --git a/nc_files/SC-IRBKT.ngc b/nc_files/SC-IRBKT.ngc index 630cdb3..12b358a 100644 --- a/nc_files/SC-IRBKT.ngc +++ b/nc_files/SC-IRBKT.ngc @@ -5,9 +5,9 @@ M03 F7 -#<_td> = [7/16] - -o call [-0.5] [0] [18/25.4] [0.03][-0.3] +#<_z_top> = 0.03 +#<_z_bot> = -0.3 +o call [0] [-0.5] [0] [18/25.4] M05 M30 \ No newline at end of file diff --git a/nc_files/SC-TF001-1.ngc b/nc_files/SC-TF001-1.ngc index cf5ff54..12b89d2 100644 --- a/nc_files/SC-TF001-1.ngc +++ b/nc_files/SC-TF001-1.ngc @@ -5,11 +5,13 @@ M03 F4 -#<_td> = [1/2] +;#<_z_top> = +0.10 +;#<_z_bot> = -0.25 +;o call [+4] [0.00][-3.150+1.920] [.84] [0.01] -;o call [0.00][-3.150+1.920] [.84] [+0.10][-0.25] [0.01] [+4] - -o call [-1][0] [1.262] [0.01][-0.450] +#<_z_top> = 0.01 +#<_z_bot> = -0.450 +o call [0] [-1][0] [1.262] M05 diff --git a/nc_files/SC-TF001-3.ngc b/nc_files/SC-TF001-3.ngc index 787f0d5..09b88dd 100644 --- a/nc_files/SC-TF001-3.ngc +++ b/nc_files/SC-TF001-3.ngc @@ -5,7 +5,6 @@ M03 F10 -#<_td> = [5/16] ;o call [-5.45][-0.446] ;o call [-2.975][-1.875] ;o call [-5.45][-3.304] @@ -16,7 +15,9 @@ F10 ;o call [-16.25][0] ;o call [-16.75][0] ;o call [-17.25][0] -o call [-4.625][-1.875][1.720][0.05][-0.6] +#<_z_top> = 0.05 +#<_z_bot> = -0.6 +o call [0] [-4.625][-1.875][1.720] M05 M30 \ No newline at end of file diff --git a/nc_files/SD-SLEEVE.ngc b/nc_files/SD-SLEEVE.ngc index c9b2ffa..676d509 100644 --- a/nc_files/SD-SLEEVE.ngc +++ b/nc_files/SD-SLEEVE.ngc @@ -1,5 +1,3 @@ -#<_td> = [1/2] -G10 L1 P1 R[#<_td>/2] ; Set tool 1 diameter #<_z_clearance> = 0.5 # = 12 @@ -8,8 +6,12 @@ G4 P2 F10 -;o call [0][0] [1.750] [.01][0] [0][4] -o call [0][0] [1.382] [.01][-0.6] [0][4] +;#<_z_top> = .01 +;#<_z_bot> = 0 +;o call [4] [0][0] [1.750] [0] +#<_z_top> = .01 +#<_z_bot> = -0.6 +o call [4] [0][0] [1.382] [0] M05 G0 Z#<_z_clearance> diff --git a/nc_files/THF-BOX011.ngc b/nc_files/THF-BOX011.ngc index a4581d6..f102be3 100644 --- a/nc_files/THF-BOX011.ngc +++ b/nc_files/THF-BOX011.ngc @@ -1,24 +1,31 @@ -#<_td> = [3/16] #<_z_clearance> = 0.5 # = 30 M03 F20 -;o call [1.375][-1.875] [1.375] [+0.10][-0.6] [0] [+4] +;#<_z_top> = +0.10 +;#<_z_bot> = -0.6 +;o call [+4] [1.375][-1.875] [1.375] [0] -;o call [0.9] [-1.576] [0.277] [0.05][-0.2] [0][4] -;o call [5.4] [-1.576] [0.277] [0.05][-0.2] [0][4] -;o call [1.93][-0.789] [4.370][-2.363] [0.05][-0.2] +;#<_z_top> = 0.05 +;#<_z_bot> = -0.2 +;o call [4] [0.9] [-1.576] [0.277] [0] +;o call [4] [5.4] [-1.576] [0.277] [0] +;o call [0] [1.93][-0.789] [4.370][-2.363] -;o call [2.399][-0.575] [.2] [.05][-0.2] [0][4] -;o call [3.899][-0.575] [.2] [.05][-0.2] [0][4] -;o call [4.921][-0.778] [.2] [.05][-0.2] [0][4] -;o call [4.921][-1.575] [1.063] [.05][-0.2] [0][4] -;o call [4.921][-2.372] [.2] [.05][-0.2] [0][4] -;o call [3.899][-2.575] [.2] [.05][-0.2] [0][4] -;o call [2.399][-2.575] [.2] [.05][-0.2] [0][4] -;o call [1.024][-1.575-.75] [.27] [.05][-0.2] [0][4] -o call [1.274][-1.575+.50] [.80] [.05][-0.2] [0][4] +;#<_z_top> = .05 +;#<_z_bot> = -0.2 +;o call [4] [2.399][-0.575] [.2] [0] +;o call [4] [3.899][-0.575] [.2] [0] +;o call [4] [4.921][-0.778] [.2] [0] +;o call [4] [4.921][-1.575] [1.063] [0] +;o call [4] [4.921][-2.372] [.2] [0] +;o call [4] [3.899][-2.575] [.2] [0] +;o call [4] [2.399][-2.575] [.2] [0] +;o call [4] [1.024][-1.575-.75] [.27] [0] +#<_z_top> = .05 +#<_z_bot> = -0.2 +o call [4] [1.274][-1.575+.50] [.80] [0] M05 G0 Z#<_z_clearance> diff --git a/nc_files/TOOLS.md b/nc_files/TOOLS.md new file mode 100644 index 0000000..fc4c39f --- /dev/null +++ b/nc_files/TOOLS.md @@ -0,0 +1,398 @@ +# Tool Changes, Offsets & Work Coordinates in LinuxCNC + +Reference for the Lagun mill config (non-random manual toolchanger, GMOCCAPY GUI, inch mode). + +--- + +## Tool Table (`tool.tbl`) + +Each line defines a tool: + +``` +T3 P3 D+0.187500 ;3/16in flat +T1 P1 D+0.187500 I+7.000000 ;0.201in DrillBit +T5 P5 D+0.250000 ;1/4 +``` + +| Column | Meaning | +|--------|---------| +| **T** | Tool number (what programs reference with `T1`, `T5`, etc.) | +| **P** | Pocket number (our setup just uses P = T) | +| **Z** | Tool length offset (distance from spindle reference to tool tip) | +| **D** | Tool **diameter** (full width, not radius) | +| **;** | Comment | + +**Important**: The D column stores **diameter**, but `G10 L1` sets it using **radius** (R word). This is a common source of confusion. + +--- + +## Tool Change Sequence + +```gcode +T1 ; select tool 1 (prepares it, does NOT load it) +M6 ; execute the change — pops up the manual tool change dialog +G43 ; activate that tool's length offset +``` + +- `T` alone only **selects** (prepares) a tool. Nothing physical happens. +- `M6` performs the actual change. On our machine this pops up a dialog prompting the operator to insert the tool and click OK. +- `G43` applies the tool's Z offset from the tool table. **Without this line, the machine has no idea how long the tool is.** +- `T1 M6` on one line is fine (and common). + +After `M6`, the built-in parameter `#<_current_tool>` holds the loaded tool number, and `#5410` holds its diameter. + +--- + +## Tool Length Offset (G43 / G49) + +### Activating + +| Command | Effect | +|---------|--------| +| `G43` | Apply TLO of the **currently loaded** tool (from last M6) | +| `G43 H1` | Apply TLO of tool **1** from the table (doesn't have to match spindle tool) | +| `G43.1 Z0.5` | Dynamic TLO: set Z offset to 0.5 directly (doesn't write to table) | +| `G43.2 H1` | Cumulative: **add** tool 1's offset on top of the current offset | + +`G43` shifts all subsequent Z moves by the tool's Z offset. No motion occurs on the G43 line itself — the offset applies on the next move. + +### Canceling + +```gcode +G49 ; cancel tool length offset +``` + +### Typical multi-tool workflow + +```gcode +T1 M6 ; load tool 1 +G43 ; activate its TLO +; ... do work ... +G49 ; cancel TLO before next change +T2 M6 ; load tool 2 +G43 ; activate tool 2's TLO +``` + +--- + +## Setting Tool Offsets with G10 + +### G10 L1 — Write directly to the tool table + +```gcode +G10 L1 P Z R +``` + +- **P**: tool number to update +- **Z**: tool length offset (direct value) +- **R**: tool **radius** (half the diameter). LinuxCNC stores this as `D = 2 * R` in the tool table. + +Examples: + +```gcode +G10 L1 P1 Z-2.500 R0.125 ; tool 1: length=-2.5", radius=0.125" (1/4" endmill, D=0.250) +G10 L1 P1 R[3/16/2] ; just update radius: 3/16" tool -> R=0.09375 -> D=0.1875 +``` + +After `G10 L1`, re-issue `G43` to pick up the new offset if that tool is already loaded. + +### G10 L10 — Set offset by touching off (work coords as reference) + +```gcode +G10 L10 P Z +``` + +Calculates what Z offset the tool table needs so that, with the current work coordinate system active and the machine at its current position, the Z display would read the specified value. + +Touch-off workflow: +1. Load tool, jog Z down until it touches the workpiece surface +2. `G10 L10 P1 Z0` — "the tip is at Z=0, calculate the offset" + +### G10 L11 — Touch off using G59.3 as reference + +Same as L10 but uses G59.3 (with no G52/G92) as the reference frame. Useful if you have a fixed tool-length probe at a known machine position stored in G59.3. + +--- + +## Cutter Radius Compensation (G41 / G42 / G40) + +Cutter comp shifts the toolpath left or right of the programmed path by the tool's radius. This lets you program to the part geometry (the actual edge you want) and let LinuxCNC offset the toolpath by the tool radius automatically. + +### Basics + +```gcode +G41 ; compensate LEFT of the programmed path (climb milling on outside profiles) +G42 ; compensate RIGHT of the programmed path (conventional milling on outside profiles) +G40 ; cancel compensation — return to programming on centerline +``` + +"Left" and "right" are from the perspective of looking down the tool axis in the direction of travel. + +### The D word + +```gcode +G41 D1 ; use tool 1's diameter from the table for the offset amount +G42 ; no D = use the currently loaded tool's diameter +``` + +**The D word in G41/G42 is a tool number**, not a diameter value. LinuxCNC looks up that tool's D column (diameter), halves it, and uses that as the offset distance. + +### Rules and gotchas + +- The **lead-in move** (first move after G41/G42) must be **at least as long as the tool radius**. A rapid (G0) is fine. +- The **lead-out move** (move on the same line as G40) must also be linear and at least as long as the tool radius. +- **Inside corners**: the path is shortened to prevent gouging. +- **Outside corners**: the path is extended (the tool wraps around the corner). +- **U-turns and tight inside corners** where the tool can't physically fit will cause an error. +- Cutter comp only works in **G17** (XY plane). For G18/G19 it compensates in the respective plane. +- You **cannot** start cutter comp while already in cutter comp — must G40 first. + +### Example: cutting an outside profile + +```gcode +G10 L1 P1 R[1/4/2] ; tool 1 = 1/4" endmill (R=0.125, D=0.250) +T1 M6 +G43 + +G0 X-1 Y-1 ; position away from the part +G41 ; turn on left comp (uses current tool's D) +G1 X0 Y0 F10 ; lead-in move to first corner (must be >= tool radius) +G1 X0 Y2 ; cut along left edge +G1 X3 Y2 ; cut along top edge +G1 X3 Y0 ; cut along right edge +G1 X0 Y0 ; cut along bottom edge, back to start +G40 ; cancel comp +G0 X-1 Y-1 ; lead-out / retract +``` + +The programmed path (X0 Y0 to X3 Y2) is the actual part edge. The tool centerline runs 0.125" outside of it. + +### Dynamic variant + +```gcode +G41.1 D0.250 ; compensate left by 0.250" diameter (= 0.125" offset) directly +G42.1 D0.250 ; compensate right +``` + +Here the D word **IS** a diameter value (not a tool number). Useful when you want to specify the offset directly without looking it up from the table. + +### Cutter comp vs. our macros + +Our macros (`pocket_circ`, `frame_rect`, etc.) do their own tool-diameter compensation internally using `#<_td>`. They do **not** use G41/G42. So: + +- Use **G41/G42** when you're writing raw G-code profiles (manually programmed contours). +- Use **`#<_td>`** when calling our subroutines — they handle the offset math themselves. +- Don't use both at the same time on the same toolpath. + +--- + +## Work Offsets (G54–G59.3) + +Work offsets define where "zero" is on your workpiece relative to the machine's home position. + +### Available coordinate systems + +| G-code | Name | P number (for G10) | +|--------|------|--------------------| +| G54 | Work offset 1 (default) | P1 | +| G55 | Work offset 2 | P2 | +| G56 | Work offset 3 | P3 | +| G57 | Work offset 4 | P4 | +| G58 | Work offset 5 | P5 | +| G59 | Work offset 6 | P6 | +| G59.1 | Work offset 7 | P7 | +| G59.2 | Work offset 8 | P8 | +| G59.3 | Work offset 9 | P9 | + +These **persist across power cycles** — they're stored in `linuxcnc.var`. + +### Setting work offsets + +**Touch-off method** (most common): jog to where you want zero, then: + +```gcode +G10 L20 P1 X0 Y0 ; "right here is G54 X0 Y0" +G10 L20 P0 Z0 ; "right here is Z0 in the currently active system" +``` + +- `P0` = whichever G5x is currently active +- You only need to specify the axes you want to set + +**Direct method**: if you know the machine-coordinate position of your fixture: + +```gcode +G10 L2 P1 X-12.500 Y-6.000 Z0.000 ; G54 origin is at machine X-12.5 Y-6.0 Z0.0 +``` + +**Switching** between coordinate systems: + +```gcode +G55 ; now all coords are relative to work offset 2 +``` + +### Practical use + +- **One fixture, one part**: Just use G54. Touch off XYZ zero on your stock. +- **Multiple fixtures / vises**: G54 for vise 1, G55 for vise 2. Touch off each. +- **Multiple setups on one part**: Flip the part, touch off new Z in G54. + +### G52 and G92 (temporary offsets) + +`G52 X1 Y1` adds a temporary offset on top of the active G5x. Useful for pattern repeats. + +`G92 X0 Y0` says "my current position IS X0 Y0" (like G10 L20 but temporary). **Caution**: G92 offsets persist across program runs until cleared with `G92.1`. This is a common gotcha. Prefer G52 over G92. + +### Your pendant buttons + +| Button | MDI Command | What it does | +|--------|------------|--------------| +| Macro 5 | `G10 L20 P0 X0` | Zero X in current work offset | +| Macro 6 | `G10 L20 P0 Y0` | Zero Y in current work offset | +| Macro 7 | `G10 L20 P0 Z0` | Zero Z in current work offset | +| Macro 1 | `G10 L20 P0 X[#<_x>/2.0]` | Halve X (center-finding) | +| Macro 2 | `G10 L20 P0 Y[#<_y>/2.0]` | Halve Y (center-finding) | + +The halve trick: touch one edge of the stock and zero it, jog to the other edge, press the halve button — now you're at the center. + +--- + +## Coordinate System Hierarchy + +``` +Displayed position = Machine position + + G5x work offset (G54, G55, ... set by G10 L2/L20) + + G52/G92 offset + + G43 tool length offset +``` + +`G53` bypasses all offsets and moves in raw machine coordinates (useful for "go to tool change position" moves). + +--- + +## GMOCCAPY Interface + +### DRO (Digital Readout) + +The DRO has three display modes, toggled by **clicking any axis value**: + +| Mode | Background | Shows | +|------|------------|-------| +| **Relative** | Black | Position in current work coordinate system (G5x + tool offset + G92). This is what your G-code program sees. | +| **Absolute** | Blue | Machine coordinates (G53). Position relative to machine home. | +| **DTG** | Yellow | Distance To Go — remaining distance to the programmed endpoint during motion. | + +DRO digit colors indicate homing status: +- **Green** = homed (reference established) +- **Red** = unhomed (position is not trustworthy) + +### Touch-Off via the DRO + +**Click the axis letter** (the "X", "Y", or "Z" label, not the number) to open a popup dialog. Enter the coordinate value you want the current position to represent (usually `0`). This issues `G10 L20 P0 ` internally. + +### Offset Page + +The Offset page (accessible from the notebook tabs) shows a table of all work coordinate systems (G54–G59.3) plus G92 and tool offsets. The currently active system is highlighted. + +- **Double-click a cell** to edit a value directly. This issues `G10 L2 P ` (sets the offset to the value you typed, NOT touch-off style). +- **"Zero G92" button**: sends `G92.1` to cancel G92 offsets. +- **"Set Active" button**: switches the active coordinate system (e.g., click the G55 row, then "Set Active" to switch to G55). + +**Key distinction**: Editing the offset page sets offsets with `G10 L2` (absolute). Touching off via the DRO uses `G10 L20` (calculated from current position). These are different operations. + +### Tool Page + +Shows the tool table with columns for tool number, pocket, diameter, and Z offset. + +- **Click a cell** to edit. Changes are NOT live until you click **"Apply Changes"**. +- After applying, you must **re-issue `G43`** (in MDI) if the active tool's offset changed. GMOCCAPY does not do this automatically. +- The top of the page shows the currently loaded tool's active offsets (fed by the `gmoccapy.tooloffset-x` and `gmoccapy.tooloffset-z` HAL pins). + +### Tool Change Dialog + +When a program executes `M6`, GMOCCAPY pops up a dialog showing the tool number and its description from the tool table comment. The operator physically changes the tool and clicks OK (or presses a physical confirm button wired to `gmoccapy.toolchange-confirm`). + +Our config currently uses `hal_manualtoolchange` instead of GMOCCAPY's built-in dialog (wired in `lagun.hal`). The behavior is similar — a popup appears, operator confirms. + +### Auto Tool Measurement (not currently configured) + +GMOCCAPY supports automatic tool length measurement using a fixed probe on the machine table. This requires: + +1. A `[TOOLSENSOR]` INI section with the probe's machine coordinates +2. A `[CHANGE_POSITION]` INI section for safe tool-change position +3. Remapping M6 to a `change.ngc` script that probes after each tool swap +4. The probe input wired to `motion.probe-input` + +When enabled, every M6 automatically: moves to the change position, swaps the tool, drives to the probe, measures the tool, stores the offset with `G10 L1`, and activates it with `G43`. This eliminates manual tool touch-off. + +We don't have this set up yet, but it's a natural next step if a tool setter is installed on the machine. + +--- + +## Named Parameters for Tool Info + +| Parameter | Value | +|-----------|-------| +| `#<_current_tool>` | Tool number in the spindle | +| `#<_selected_tool>` | Tool number from last `T` word (before M6) | +| `#5400` | Same as `#<_current_tool>` | +| `#5401`–`#5409` | Active TLO values (X through W) | +| `#5410` | **Tool diameter** of current tool (D column value) | + +### About `#<_td>` in our macros + +`#<_td>` is **not** a built-in LinuxCNC parameter. It is a user-defined global that our macros read for tool diameter. Programs must set it manually: + +```gcode +#<_td> = [3/16] ; 3/16" endmill +``` + +A future improvement would be to replace `#<_td>` with `#5410` (the built-in diameter parameter), but this requires proper tool table setup with correct D values and a `T M6 G43` sequence before cutting. + +--- + +## Quick Reference + +### Full setup with tool change and cutter comp +```gcode +G10 L1 P1 Z-2.5 R[1/4/2] ; tool 1: Z offset and 1/4" endmill radius +T1 M6 ; load tool 1 +G43 ; activate TLO +G41 ; cutter comp left (uses tool 1's D from table) +F10 +G1 X0 Y0 ; lead-in (>= tool radius long) +G1 X2 Y0 ; cut along edge +G40 ; cancel comp (with lead-out move) +G0 X-1 Y-1 +``` + +### Touch off tool length +```gcode +T1 M6 ; load tool +; jog Z down until tool touches top of workpiece +G10 L10 P1 Z0 ; store: "this position = Z0" +G43 ; activate the new offset +``` + +### Touch off work zero +```gcode +; jog to front-left corner of stock +G10 L20 P1 X0 Y0 ; set G54 origin here +; jog Z to top of stock +G10 L20 P1 Z0 ; set G54 Z origin here +``` + +### Our current macro workflow +```gcode +#<_td> = [1/4] ; tell macros the tool is 1/4" +#<_z_top> = 0.05 +#<_z_bot> = -0.25 +#<_z_clearance> = 0.2 + +G10 L1 P1 Z0.0 R[1/4/2] ; also set it in the table for cutter comp +T1 M6 +G43 +M03 +F5 + +o call [0][0] [1.0] [0] [0] +``` diff --git a/nc_files/bore.ngc b/nc_files/bore.ngc deleted file mode 100755 index e8d2aba..0000000 --- a/nc_files/bore.ngc +++ /dev/null @@ -1,36 +0,0 @@ -; Helical bore subroutine - cuts a circular hole by helical interpolation -; Params: #1=x, #2=y, #3=diameter, #4=zstart, #5=zend, #6=stepdown -; Uses #<_td> (tool diameter) to compute offset radius -o sub - ; x, y, d, stepdown, zstart, zend - G90 - G91.1 - - G0 X#1 Y#2 - G0 Z#4 - G1 X[#1+#3/2-#<_td>/2] Y[#2] ; move to bore edge, compensated for tool radius - G17 - - # = [#3/2-#<_td>/2] ; effective bore radius (bore radius minus tool radius) - - # = [#4-#6] - o101 while [# GT #5] ; helical passes, one full circle per stepdown - G3 X[#1+#] Y[#2] I[-#] Z[#] P1 - # = [# - #6] - o101 endwhile - - o102 if [#4 GT #5] ; partial final pass to reach exact zend - - # = [[#-#5]/#6*360] ; angle where remaining depth is consumed - G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[-#] Z[#5] - G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[-COS[#]*#] J[-SIN[#]*#] Z[#5] ; cleanup pass at final depth - - ;G3 X#1 Y[#2+#3/2-#<_td>/2] J[-#3/2+#<_td>/2] - o102 endif - - G0 X#1 Y#2 - G0 Z0 - -o endsub - -M2 \ No newline at end of file diff --git a/nc_files/drill.ngc b/nc_files/drill.ngc deleted file mode 100755 index fb117dc..0000000 --- a/nc_files/drill.ngc +++ /dev/null @@ -1,37 +0,0 @@ -; Peck drill subroutine - drills with retract cycles to clear chips -; Params: #1=x, #2=y, #3=zstart, #4=zend, #5=peck_depth -o sub - ; x1, y1, zstart, zend, peckdp - ; #1 #2 #3 #4 #5 - - G90 ; absolute x,y,z - M101 ; enable Z-axis (M102 disables) - - o1 if [EXISTS[#<_z_clearance>]] - # = #<_z_clearance> - o1 else - # = #3 - o1 endif - - ;;;;;;;;;; PROGRAM ;;;;;;;;; - - G0 Z# - G0 X#1 Y#2 - G0 Z#3 - - o104 if [#5 NE 0] ; peck drilling - # = #3 - o101 while [# GT #4] - G1 Z# ; drill to current peck depth - G0 Z#3 ; retract to clear chips - G0 Z[#+.02] ; rapid back down, stopping just above previous depth - # = [#-#5] - o101 endwhile - o104 endif - - G1 Z#4 - G0 Z# - -o endsub - -M2 \ No newline at end of file diff --git a/nc_files/drill_man.ngc b/nc_files/drill_man.ngc deleted file mode 100755 index 185ff5f..0000000 --- a/nc_files/drill_man.ngc +++ /dev/null @@ -1,18 +0,0 @@ -; Manual drill positioning - moves to X/Y, disables Z for manual quill, then pauses -; Params: #1=x, #2=y -o sub - ; x1, y1 - ; #1 #2 - - G90 ; absolute x,y,z - M102 ; disable Z-axis (M101 enables) - - ;;;;;;;;;; PROGRAM ;;;;;;;;; - - G0 X#1 Y#2 - - M0 ; pause - -o endsub - -M2 \ No newline at end of file diff --git a/nc_files/drill_retr.ngc b/nc_files/drill_retr.ngc deleted file mode 100755 index db115c4..0000000 --- a/nc_files/drill_retr.ngc +++ /dev/null @@ -1,28 +0,0 @@ -; Semi-manual drill with Z retract - positions X/Y, retracts Z, pauses for manual drill -; Params: #1=x, #2=y, #3=z_clearance -; BUG: endsub name (drill_man_retract) doesn't match sub name (drill_retr) -o sub - ; x1, y1, z_clr - ; #1 #2, #3 - - G90 ; absolute x,y,z - - o1 if [EXISTS[#<_z_clearance>]] - # = #<_z_clearance> - o1 else - # = #3 - o1 endif - - ;;;;;;;;;; PROGRAM ;;;;;;;;; - - M101 ; enable Z for CNC retract - G0 Z# - G0 X#1 Y#2 - M102 ; disable Z-axis (M101 enables) - M0 ; pause for manual drilling - M101 ; re-enable Z for retract - G0 Z# - -o endsub - -M2 diff --git a/nc_files/end_angle.ngc b/nc_files/end_angle.ngc index cc1e566..0990cd7 100755 --- a/nc_files/end_angle.ngc +++ b/nc_files/end_angle.ngc @@ -23,7 +23,7 @@ o sub # = [FIX[#9/8] MOD 2 EQ 0] - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/end_bull.ngc b/nc_files/end_bull.ngc index 10503fc..c252763 100755 --- a/nc_files/end_bull.ngc +++ b/nc_files/end_bull.ngc @@ -32,7 +32,7 @@ o sub # = [FIX[#/8] MOD 2 EQ 0] - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/end_cope.ngc b/nc_files/end_cope.ngc index 24bc101..4bd5bad 100755 --- a/nc_files/end_cope.ngc +++ b/nc_files/end_cope.ngc @@ -23,7 +23,7 @@ o sub # = [FIX[#8/8] MOD 2 EQ 0] - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/end_round.ngc b/nc_files/end_round.ngc index 0d0f392..d824918 100755 --- a/nc_files/end_round.ngc +++ b/nc_files/end_round.ngc @@ -23,7 +23,7 @@ o sub # = [FIX[#8/8] MOD 2 EQ 0] - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/face.ngc b/nc_files/face.ngc index ae1746a..d6dbf76 100755 --- a/nc_files/face.ngc +++ b/nc_files/face.ngc @@ -6,7 +6,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/frame_circ.ngc b/nc_files/frame_circ.ngc deleted file mode 100755 index d5b3c77..0000000 --- a/nc_files/frame_circ.ngc +++ /dev/null @@ -1,82 +0,0 @@ -; Circle perimeter cut - cuts inside or outside a circular profile -; Params: #1=x, #2=y, #3=diameter, #4=ztop, #5=zbot, #6=fincut, #7=mode -; Mode bitmask: bit0=conventional, bit1=bothways, bit2=plunge(vs helix), bit3=outside -; Uses arc lead-in/lead-out for smooth entry and exit -o sub - ; o call [x][y] [diameter] [ztop][zbot] [fincut] [mode] - - # = [FIX[#7/1] MOD 2 EQ 1] - # = [FIX[#7/2] MOD 2 EQ 1] - # = [FIX[#7/4] MOD 2 EQ 1] - # = [FIX[#7/8] MOD 2 EQ 1] - # = [FIX[#7/1] MOD 2 EQ 0] - # = [FIX[#7/2] MOD 2 EQ 0] - # = [FIX[#7/4] MOD 2 EQ 0] - # = [FIX[#7/8] MOD 2 EQ 0] - - ;G10 L0 ; re-read tool data - G90 ; absolute x,y,z - G90.1 ; absolute i,j,k - M101 ; enable Z-axis (M102 disables) - G17 ; select XY plane for arcs - - # = #<_td> - # = [#/2] - o1 if [EXISTS[#<_z_clearance>]] - # = #<_z_clearance> - o1 else - # = #4 - o1 endif - - - # = # ; lead-in arc radius, capped at 15% of diameter - o10 if [# GT #3*0.15] - # = [#3*0.15] - o10 endif - - G0 Z# - - o20 if [# AND #] - ; conventional, inner - G0 X[#1-#] Y[#2 + #3/2 - # - #] - G0 Z#4 - G1 Z#5 - G2 X#1 Y[#2 + #3/2 - #] I#1 J[#2 + #3/2 - # - #] - G2 X#1 Y[#2 + #3/2 - #] I#1 J#2 - G2 X[#1+#] Y[#2 + #3/2 - # - #] I#1 J[#2 + #3/2 - # - #] - - - o20 elseif [# AND #] - ; climb, inner - G0 X[#1+#] Y[#2 + #3/2 - # - #] - G0 Z#4 - G1 Z#5 - G3 X#1 Y[#2 + #3/2 - #] I#1 J[#2 + #3/2 - # - #] - G3 X#1 Y[#2 + #3/2 - #] I#1 J#2 - G3 X[#1-#] Y[#2 + #3/2 - # - #] I#1 J[#2 + #3/2 - # - #] - - o20 elseif [# AND #] - ; conventional, outer - G0 X[#1+#] Y[#2 + #3/2 + # + #] - G0 Z#4 - G1 Z#5 - G2 X#1 Y[#2 + #3/2 + #] I#1 J[#2 + #3/2 + # + #] - G3 X#1 Y[#2 + #3/2 + #] I#1 J#2 - G2 X[#1-#] Y[#2 + #3/2 + #+ #] I#1 J[#2 + #3/2 + # + #] - - o20 elseif [# AND #] - ; climb, outer - G0 X[#1-#] Y[#2 + #3/2 + # + #] - G0 Z#4 - G1 Z#5 - G3 X#1 Y[#2 + #3/2 + #] I#1 J[#2 + #3/2 + # + #] - G2 X#1 Y[#2 + #3/2 + #] I#1 J#2 - G3 X[#1+#] Y[#2 + #3/2 + #+ #] I#1 J[#2 + #3/2 + # + #] - o20 endif - - G0 Z# - - -o endsub - -M2 \ No newline at end of file diff --git a/nc_files/frame_rect.ngc b/nc_files/frame_rect.ngc deleted file mode 100755 index 12a36e8..0000000 --- a/nc_files/frame_rect.ngc +++ /dev/null @@ -1,162 +0,0 @@ -; Rectangle perimeter cut - cuts inside or outside a rectangular frame -; Params: #1=x1, #2=y1, #3=x2, #4=y2, #5=ztop, #6=zbot, #7=mode, #8=corner_radius -; Mode bitmask: bit0=conventional, bit1=bothways, bit2=plunge(vs helix), bit3=outside -o sub - ; o call [x1][y1] [x2][y2] [ztop][zbot] [mode] [radius] - - # = [FIX[#7/1] MOD 2 EQ 1] - # = [FIX[#7/2] MOD 2 EQ 1] - # = [FIX[#7/4] MOD 2 EQ 1] - # = [FIX[#7/8] MOD 2 EQ 1] - # = [FIX[#7/1] MOD 2 EQ 0] - # = [FIX[#7/2] MOD 2 EQ 0] - # = [FIX[#7/4] MOD 2 EQ 0] - # = [FIX[#7/8] MOD 2 EQ 0] - - ;G10 L0 ; re-read tool data - G90 ; absolute x,y,z - G91.1 ; incremental i,j,k - M101 ; enable Z-axis (M102 disables) - G17 ; select XY plane for arcs - - # = #<_td> - # = [#/2] - o1 if [EXISTS[#<_z_clearance>]] - # = #<_z_clearance> - o1 else - # = #4 - o1 endif - - - # = #1 - # = #3 - o3 if [#3 LT #1] - # = #3 - # = #1 - o3 endif - - # = #2 - # = #4 - o4 if [#4 LT #2] - # = #4 - # = #2 - o4 endif - - G0 Z# - - - o10 if [# AND #] - ; CW inside: plunge in center, traverse to wall, trace perimeter - G0 X[[#1+#3]/2] Y[[#2+#4]/2] - G0 Z#5 - G1 Z#6 - - G1 X[#-#] - - o102 if [#8 GT #] - G1 Y[#+#8] - G2 X[#-#8] Y[#+#] J0 I[-#8+#] - G1 X[#+#8] - G2 Y[#+#8] X[#+#] I0 J[+#8-#] - G1 Y[#-#8] - G2 X[#+#8] Y[#-#] J0 I[+#8-#] - G1 X[#-#8] - G2 Y[#-#8] X[#-#] I0 J[-#8+#] - - o102 else - G1 Y[#+#] - G1 X[#-#] - G1 Y[#-#] - G1 X[#-#] - G1 Y[#+#] - o102 endif - G1 Y[[#2+#4]/2] - - ; go to center and pull out - G0 X[[#1+#3]/2] Y[[#2+#4]/2] - G0 Z#5 - - o10 elseif [# AND #] - ; CCW inside: plunge in center, trace perimeter counterclockwise - G0 X[[#1+#3]/2] Y[[#2+#4]/2] - G0 Z#5 - G1 Z#6 - - G1 X[#-#] - - o101 if [#8 GT #] - G1 Y[#-#8] - G3 X[#-#8] Y[#-#] J0 I[-#8+#] - G1 X[#+#8] - G3 Y[#-#8] X[#+#] I0 J[-#8+#] - G1 Y[#+#8] - G3 X[#+#8] Y[#+#] J0 I[+#8-#] - G1 X[#-#8] - G3 Y[#+#8] X[#-#] I0 J[+#8-#] - o101 else - G1 Y[#-#] - G1 X[#+#] - G1 Y[#+#] - G1 X[#-#] - G1 Y[#-#] - o101 endif - G1 Y[[#2+#4]/2] - - ; go to center and pull out - G0 X[[#1+#3]/2] Y[[#2+#4]/2] - G0 Z#5 - - o10 elseif [# AND #] - ; CW outside: plunge at corner, trace perimeter offset outward - G0 X[#-#] Y[#+#] - G0 Z#5 - G1 Z#6 - - o104 if [#8 GT 0] - G1 Y[#+#8] - G3 X[#+#8] Y[#-#] J0 I[+#8+#] - G1 X[#-#8] - G3 Y[#+#8] X[#+#] I0 J[+#8+#] - G1 Y[#-#8] - G3 X[#-#8] Y[#+#] J0 I[-#8-#] - G1 X[#+#8] - G3 Y[#-#8] X[#-#] I0 J[-#8-#] - - o104 else - G1 Y[#-#] - G1 X[#+#] - G1 Y[#+#] - G1 X[#-#] - o104 endif - - G0 Z#5 - - o10 elseif [# AND #] - ; CCW outside: plunge at corner, trace perimeter offset outward - G0 X[#-#] Y[#-#] - G0 Z#5 - G1 Z#6 - - o103 if [#8 GT 0] - G1 Y[#-#8] - G2 X[#+#8] Y[#+#] J0 I[+#8+#] - G1 X[#-#8] - G2 Y[#-#8] X[#+#] I0 J[-#8-#] - G1 Y[#+#8] - G2 X[#-#8] Y[#-#] J0 I[-#8-#] - G1 X[#+#8] - G2 Y[#+#8] X[#-#] I0 J[+#8+#] - - o103 else - G1 Y[#+#] - G1 X[#+#] - G1 Y[#-#] - G1 X[#-#] - o103 endif - - G0 Z#5 - o10 endif - -o endsub - -M2 \ No newline at end of file diff --git a/nc_files/frame_rect_overcut.ngc b/nc_files/frame_rect_overcut.ngc index b0bbd65..41ee6cb 100755 --- a/nc_files/frame_rect_overcut.ngc +++ b/nc_files/frame_rect_overcut.ngc @@ -16,7 +16,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/helical_plunge.ngc b/nc_files/helical_plunge.ngc index 891ff7d..88609a1 100755 --- a/nc_files/helical_plunge.ngc +++ b/nc_files/helical_plunge.ngc @@ -16,7 +16,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> o1 else diff --git a/nc_files/hymnhanger.ngc b/nc_files/hymnhanger.ngc index 9aacbdf..9a0b89d 100644 --- a/nc_files/hymnhanger.ngc +++ b/nc_files/hymnhanger.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = 0.5 #<_rampang> = 10 -#<_td> = [5/8] ;#<_stepover> = 0.1 ;#<_overlap> = 0 @@ -17,13 +16,15 @@ G54 ; absolute coordinates F5 -o call [5][-0.625] [0.1][-0.3] -o call [3][-0.625] [0.1][-0.3] -o call [1][-0.625] [0.1][-0.3] -o call [-1][-0.625] [0.1][-0.3] -o call [-3][-0.625] [0.1][-0.3] -o call [-5][-0.625] [0.1][-0.3] -o call [-7][-0.625] [0.1][-0.3] -o call [-9][-0.625] [0.1][-0.3] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [5][-0.625] +o call [3][-0.625] +o call [1][-0.625] +o call [-1][-0.625] +o call [-3][-0.625] +o call [-5][-0.625] +o call [-7][-0.625] +o call [-9][-0.625] M2 ; end program diff --git a/nc_files/macros.md b/nc_files/macros.md index 224c016..5fe3439 100755 --- a/nc_files/macros.md +++ b/nc_files/macros.md @@ -2,9 +2,11 @@ Custom M-codes and G-code subroutines for the Lagun mill LinuxCNC configuration. +All macro `.ngc` files live in `nc_files/subs/` and are loaded automatically via the `SUBROUTINE_PATH` setting in the INI. + ## Mode Flags (Bitmask) -Several macros (`pocket_circ`, `pocket_rect`, `frame_rect`, `frame_circ`, `slot`) accept a `mode` parameter as a bitmask: +All material-removal macros (except drill/bore) take `mode` as the **first argument**: | Bit | Value | Set (1) | Clear (0) | |-----|-------|---------|-----------| @@ -17,16 +19,17 @@ Default mode (0) = climb, one-way, helix entry, inside. ## Global Named Parameters -These optional globals configure macro behavior when set before calling: +| Parameter | Description | Required? | +|-----------|-------------|-----------| +| `#<_z_top>` | Top of material / start Z height | **Required** | +| `#<_z_bot>` | Final cut depth | **Required** | +| `#<_z_clearance>` | Safe Z retract height | Optional, falls back to `#<_z_top>` | +| `#<_rampang>` | Helix entry angle in degrees | Optional, defaults to 5.0 | +| `#<_stepover>` | Stepover distance | Optional, defaults to 40% of tool diameter | -| Parameter | Description | Default | -|-----------|-------------|---------| -| `#<_td>` | Tool diameter (from tool table) | **Required** - used by all material-removal macros | -| `#<_z_clearance>` | Safe Z retract height | Falls back to ztop param | -| `#<_rampang>` | Ramp/helix entry angle in degrees | 5.0 | -| `#<_stepover>` | Stepover distance for spiral pocketing | 40% of tool diameter | +Tool diameter is read automatically from `#5410` (the built-in LinuxCNC parameter for the current tool's diameter from the tool table). A tool must be loaded (`T M6 G43`) before calling any material-removal macro. -A negative `fincut` value causes macros to rough only, leaving material for a separate finishing pass. +A negative `fincut` value causes macros to rough only, leaving that amount of material for a separate finishing pass. ## M-Codes (Shell Scripts) @@ -36,192 +39,117 @@ Sets HAL signal `z-override` to True, enabling CNC control of Z. ### M102 - Disable Z-Axis Sets HAL signal `z-override` to False, allowing manual quill control. +## Utility Subroutines + +### z_home - Rapid to Machine Z0 +Rapids the quill to machine Z=0 (fully up) using G53 to bypass all offsets. + +``` +o call +``` + ## Drilling Subroutines -### drill.ngc - Peck Drill -Fully automatic drilling with optional peck cycle. +### drill - Peck Drill ``` -o call [x][y] [ztop][zbot] [peck] +o call [x][y] [peck] ``` -| # | Name | Description | -|---|------|-------------| -| #1 | X | Hole X position | -| #2 | Y | Hole Y position | -| #3 | Z Start | Top of material / start Z | -| #4 | Z End | Final drill depth | -| #5 | Peck | Depth per peck (0 = no peck) | +Calls M101 to enable Z. Retracts to Z Top between pecks with 0.020" rapid-approach gap. -Calls M101 to enable Z-axis. Retracts to Z Start between pecks with 0.020" rapid-approach gap. - -### drill_man.ngc - Manual Drill -Positions XY then pauses for operator to manually plunge. +### drill_man - Manual Drill ``` o call [x][y] ``` -Calls M102 to disable Z-axis, then M0 pause. +Calls M102 to disable Z, then M0 pause. No Z globals needed. -### drill_retr.ngc - Semi-Manual Drill with Retract -Positions XY, retracts Z to clearance, disables Z for manual plunge, then re-enables and retracts on resume. +### drill_retr - Semi-Manual Drill with Retract ``` -o call [x][y] [z_clearance] +o call [x][y] ``` ## Material Removal Subroutines -### pocket_circ.ngc - Circular Pocket -Cuts a circular pocket using an outward spiral from center. +### pocket_circ - Circular Pocket ``` -o call [x][y] [diameter] [ztop][zbot] [fincut] [mode] +o call [mode] [x][y] [diameter] [fincut] ``` -| # | Name | Description | -|---|------|-------------| -| #1 | X | Center X | -| #2 | Y | Center Y | -| #3 | Diameter | Pocket diameter | -| #4 | Z Top | Start Z | -| #5 | Z Bottom | Final depth | -| #6 | Finish Cut | Finish allowance (negative = rough only) | -| #7 | Mode | Bitmask (see above) | - -Supports helix or plunge entry. Spirals outward with stepover, then does a pre-finish circle and optional finish circle at full diameter. - -### pocket_rect.ngc - Rectangular Pocket -Cuts a rectangular pocket. Uses helical or straight plunge, then an outward spiral that transitions to linear passes when the spiral hits the rectangle boundary. +### pocket_rect - Rectangular Pocket (Zigzag) ``` -o call [x1][y1] [x2][y2] [zstart][zend] [fincut] [mode] +o call [mode] [x1][y1] [x2][y2] [fincut] ``` -| # | Name | Description | -|---|------|-------------| -| #1,#2 | X1, Y1 | First corner | -| #3,#4 | X2, Y2 | Opposite corner | -| #5 | Z Start | Start Z | -| #6 | Z End | Final depth | -| #7 | Finish Cut | Finish allowance | -| #8 | Mode | 0=CCW/helix, 1=CW/helix, 2=CCW/plunge, 3=CW/plunge | +Zigzag along the long axis, stepping by `#<_stepover>`. Perimeter cleanup pass at the end. -Contains internal sub `o` for filling corners after the spiral exceeds the rectangle bounds. - -### frame_rect.ngc - Rectangular Frame -Cuts along the perimeter of a rectangle (inside or outside). +### frame_rect - Rectangular Frame ``` -o call [x1][y1] [x2][y2] [ztop][zbot] [mode] [radius] +o call [mode] [x1][y1] [x2][y2] [radius] ``` -| # | Name | Description | -|---|------|-------------| -| #1,#2 | X1, Y1 | First corner | -| #3,#4 | X2, Y2 | Opposite corner | -| #5 | Z Top | Start Z | -| #6 | Z Bottom | Final depth | -| #7 | Mode | Bitmask | -| #8 | Radius | Corner radius (0 = sharp corners) | - -Supports all four combinations of inside/outside and climb/conventional. Plunges at center (inside) or corner (outside), then traces the rectangle with optional corner radii. - -### frame_circ.ngc - Circular Frame -Cuts along the perimeter of a circle (inside or outside). +### frame_circ - Circular Frame ``` -o call [x][y] [diameter] [ztop][zbot] [fincut] [mode] +o call [mode] [x][y] [diameter] [fincut] ``` -| # | Name | Description | -|---|------|-------------| -| #1 | X | Center X | -| #2 | Y | Center Y | -| #3 | Diameter | Circle diameter | -| #4 | Z Top | Start Z | -| #5 | Z Bottom | Final depth | -| #6 | Finish Cut | Finish allowance | -| #7 | Mode | Bitmask | - -Uses a small arc entry/exit move (capped at 15% of diameter) for smooth engagement. - -### slot.ngc - Slot -Cuts a slot (obround/stadium shape) between two points. +### slot - Slot / Obround ``` -o call [x1][y1] [x2][y2] [width] [ztop][zbot] [fincut] [mode] +o call [mode] [x1][y1] [x2][y2] [width] [fincut] ``` -| # | Name | Description | -|---|------|-------------| -| #1,#2 | X1, Y1 | Slot start center | -| #3,#4 | X2, Y2 | Slot end center | -| #5 | Width | Slot width | -| #6 | Z Top | Start Z | -| #7 | Z Bottom | Final depth | -| #8 | Finish Cut | Finish allowance | -| #9 | Mode | Bitmask | - -Plunges at start, cuts to end, then traces the obround profile. Supports optional pre-finish pass when fincut > 0. - -### bore.ngc - Helical Bore -Helical-interpolation boring subroutine. +### bore - Helical Bore ``` -o call [x][y] [d] [zstart][zend] [stepdown] +o call [x][y] [d] [stepdown] ``` -| # | Name | Description | -|---|------|-------------| -| #1 | X | Center X | -| #2 | Y | Center Y | -| #3 | D | Bore diameter | -| #4 | Z Start | Start Z | -| #5 | Z End | Final depth | -| #6 | Stepdown | Depth per helical pass | +No mode arg. Uses `#<_z_top>`, `#<_z_bot>`, and `#5410`. -Spirals down in full-circle passes, then does a partial-arc cleanup and spring pass at final depth. Returns to center and Z0. +### poly_frame - Polygon Perimeter + +``` +o call [mode] [x][y] [n_sides] [apothem] [rotation] [fincut] +``` + +Apothem = flat-to-flat / 2. Rotation in degrees (0 = first vertex on +X, CCW positive). + +### poly_pocket - Polygon Pocket + +``` +o call [mode] [x][y] [n_sides] [apothem] [rotation] [fincut] +``` ## Typical Program Header -``` -#<_z_clearance> = 0.0 + +```gcode +#<_z_clearance> = 0.2 #<_rampang> = 5.0 +#<_z_top> = 0.05 +#<_z_bot> = -0.25 -G10 L1 P1 Z0.0 R0.25 ; set tool P1 offset and radius -T1 ; select tool -M06 ; manual toolchange +G10 L1 P1 Z0.0 R0.125 ; set tool 1 offset and 1/4" radius +T1 M6 ; load tool (sets #5410 = 0.250) +G43 ; activate TLO -M101 ; enable z-axis -G90 ; absolute coordinates -G54 ; fixture #1 +M101 ; enable z-axis +G90 ; absolute coordinates +G54 ; fixture #1 +F5.0 ; feedrate -F5.0 ; feedrate +o call [0] [0][0] [1.0] [0] ``` -## Known Bugs +## Known Bugs & Limitations -1. **drill_retr.ngc: Sub name mismatch.** Opened as `o` (line 1) but closed as `o` (line 23). This will cause a runtime error - LinuxCNC requires matching sub/endsub names. +1. **Some combinations of values cause hangs.** LinuxCNC has no stall/timeout detection; a macro stuck in an infinite loop hangs the whole machine. Iteration limits have been added to pocket_circ's spiral loop as a safety measure. -2. **bore.ngc: Parameter comment is wrong.** The inline comment says `; x, y, d, stepdown, zstart, zend` but the actual parameter order used by the code is `x, y, d, zstart, zend, stepdown`. Anyone calling based on the comment would get wrong results. - -3. **bore.ngc: Undocumented `#<_td>` dependency.** Uses global `#<_td>` for tool-diameter compensation but never validates it. If unset (defaults to 0), the bore toolpath radius becomes `D/2` instead of `(D - tool_dia)/2`, cutting an oversized bore. - -4. **drill.ngc: First peck cycle is a no-op.** The loop initializes `# = #3` (Z Start) then immediately does `G1 Z#` - moving to where the tool already is. First real cut happens on the second iteration. Wastes one retract cycle. - -5. **pocket_circ.ngc: Suspicious angle calculation.** Line 66 has a `TODO` comment from the author: `; TODO: what the heck is the denominator here doing?` The finish-plunge angle divides by `[#4-#5]` (ztop - zbot). If ztop is 0 this produces a division by a potentially small number, which may cause unexpected arc endpoints. - -6. **pocket_rect.ngc: Incomplete rectangular clearing.** The spiral-to-rectangle transition has commented-out code (lines 141-151) and a note saying "subroutines might be the best way to do this". The `o` helper sub attempts to fill the remaining area but uses a different algorithm. Corners may not be fully cleared depending on geometry. - -7. **slot.ngc: Test code after endsub.** Lines 79-83 contain hardcoded test calls that execute whenever the file is loaded. These should be removed or moved to a separate test file. The test calls also only provide 7 of 9 parameters (fincut and mode default to 0). - -8. **frame_circ.ngc: lead-in arcs can be larger than actual pocket size.** this causes overcutting. not good. - -9. **some combination of values will cause hangs.** This is in several macros. linuxcnc does not have stall/timeout detection; if a macro gets stuck in an infinite loop, it hangs linuxcnc. - -## Other Todos - -1. Change macros to use UPPERCASE_WITH_UNDERSCORES naming (both the filenames, and the usage of them in all .ngc files) -2. Purge all .cnc programs -3. Maybe: Use tool diameter instead of the td global. (we will use tool change stuff) \ No newline at end of file +2. **Slot arc directions may be wrong under some combinations** — inverted arc ends seen under certain mode/geometry combinations. diff --git a/nc_files/pocket_circ.ngc b/nc_files/pocket_circ.ngc deleted file mode 100755 index 8f8b7d0..0000000 --- a/nc_files/pocket_circ.ngc +++ /dev/null @@ -1,134 +0,0 @@ -; Circular pocket - clears a round pocket using spiral toolpath -; Params: #1=x, #2=y, #3=diameter, #4=ztop, #5=zbot, #6=finishcut, #7=mode -; Mode bitmask: bit0=conventional, bit1=bothways, bit2=plunge(vs helix), bit3=outside -o sub - ; o call [x][y] [diameter] [ztop][zbot] [finishcut] [mode] - - # = [FIX[#7/1] MOD 2 EQ 1] - # = [FIX[#7/2] MOD 2 EQ 1] - # = [FIX[#7/4] MOD 2 EQ 1] - # = [FIX[#7/8] MOD 2 EQ 1] - # = [FIX[#7/1] MOD 2 EQ 0] - # = [FIX[#7/2] MOD 2 EQ 0] - # = [FIX[#7/4] MOD 2 EQ 0] - # = [FIX[#7/8] MOD 2 EQ 0] - - G90 ; absolute x,y,z - G90.1 ; absolute i,j,k - M101 ; enable Z-axis (M102 disables) - G17 ; select XY plane for arcs - - # = [#<_td>] - # = [#/2] - o1 if [EXISTS[#<_z_clearance>]] - # = #<_z_clearance> - o1 else - # = #4 - o1 endif - o2 if [EXISTS[#<_rampang>]] - # = #<_rampang> - o2 else - # = 5 ; degrees - o2 endif - o3 if [EXISTS[#<_stepover>]] - # = #<_stepover> - o3 else - # = [#*0.4] - o3 endif - - o4 if [# GT #3] ; tool bigger than pocket, bail out - o5 return - o4 endif - - # = 0 - # = 0 - o100 if [#] ; helical plunge - # = [#*0.3] ; helix radius = 30% of tool diameter - o115 if [[[#3-#]/2-ABS[#6]] LE #] ; shrink if helix would exceed pocket wall - # = [[[#3-#]/2-ABS[#6]]*0.8] - o115 endif - - # = [#*2*3.14*TAN[#]] - - G0 Z# - G0 X[#1+#] Y[#2] - G0 Z#4 - - ; helical plunge - # = [#4-#] - o101 while [# GT #5] - o102 if [#] - G3 X[#1+#] Y[#2] I[#1] J[#2] Z[#] P1 - o102 else - G2 X[#1+#] Y[#2] I[#1] J[#2] Z[#] P1 - o102 endif - # = [# - #] - o101 endwhile - - ; finish the helical plunge - # = [[#-#5]/[#4-#5]*360] ; TODO: what the heck is the denominator here doing? - o103 if [#] - G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[#1] J[#2] Z[#5] - G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[#1] J[#2] Z[#5] - o103 else - G2 X[#1+COS[#]*#] Y[#2-SIN[#]*#] I[#1] J[#2] Z[#5] - G2 X[#1+COS[#]*#] Y[#2-SIN[#]*#] I[#1] J[#2] Z[#5] - o103 endif - - o100 elseif [#] ; straight plunge - - - G0 Z# - G0 X[#1] Y[#2] - G0 Z[#4] - G1 Z[#5] - - o100 endif - - ; spiral outward from center to clear pocket, stopping short by finishcut amount - # = # - # = # - o105 while [# LT [[#3-#]/2-ABS[#6]]] - - o106 if [#] - G1 X[#1+COS[#]*#] Y[#2+SIN[#]*#] - o106 else - G1 X[#1+COS[#]*#] Y[#2-SIN[#]*#] - o106 endif - # = [#+1] ; advance 1 degree per step - - # = [#+[#-#]/360*#] ; radius grows by stepover each revolution - o105 endwhile - - ; pre-finish cut: full circle at pocket wall minus finishcut allowance - # = [[#3-#]/2-ABS[#6]] - o107 if [#] - G1 X[#1+COS[#]*#] Y[#2+SIN[#]*#] - G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[#1] J[#2] - o107 else - G1 X[#1+COS[#]*#] Y[#2-SIN[#]*#] - G2 X[#1+COS[#]*#] Y[#2-SIN[#]*#] I[#1] J[#2] - o107 endif - - ; finish cut: full circle at final pocket wall radius - o104 if [ABS[#6] GT 0.0] - # = [[#3-#]/2] - o108 if [#] - G1 X[#1+COS[#]*#] Y[#2+SIN[#]*#] - G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[#1] J[#2] - # = [[#3-#]/2*0.9] ; retract slightly inward before rapid out - G1 X[#1+COS[#]*#] Y[#2+SIN[#]*#] - o108 else - G1 X[#1+COS[#]*#] Y[#2-SIN[#]*#] - G2 X[#1+COS[#]*#] Y[#2-SIN[#]*#] I[#1] J[#2] - # = [[#3-#]/2*0.9] ; retract slightly inward before rapid out - G1 X[#1+COS[#]*#] Y[#2-SIN[#]*#] - o108 endif - o104 endif - - G0 Z# - - -o endsub - -M2 \ No newline at end of file diff --git a/nc_files/pocket_rect.ngc b/nc_files/pocket_rect.ngc deleted file mode 100755 index 7721ff8..0000000 --- a/nc_files/pocket_rect.ngc +++ /dev/null @@ -1,228 +0,0 @@ -; Rectangular pocket - clears using spiral then corner-clearing helper sub -; Params: #1=x1, #2=y1, #3=x2, #4=y2, #5=zstart, #6=zend, #7=fincut, #8=mode -; Mode: 0=CCW/ramp, 1=CW/ramp, 2=CCW/plunge, 3=CW/plunge - -; pre-declare named params used across sub/helper scope -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 -# = 0 - -o sub - ; x1, y1, x2, y2, zstart, zend, fincut, mode - ; #1 #2 #3 #4 #5 #6 #7 #8 - ; modes: - ; 0: CCW, ramped plunge - ; 1: CW, ramped plunge - ; 2: CCW, straight plunge - ; 3: CW, straight plunge - - G90 ; absolute x,y,z - G90.1 ; absolute i,j,k - M101 ; enable Z-axis (M102 disables) - G17 ; select XY plane for arcs - - # = #<_td> - o1 if [EXISTS[#<_z_clearance>]] - # = #<_z_clearance> - o1 else - # = #5 - o1 endif - o2 if [EXISTS[#<_rampang>]] - # = #<_rampang> - o2 else - # = 5 ; degrees - o2 endif - o3 if [EXISTS[#<_stepover>]] - # = #<_stepover> - o3 else - # = [#*0.4] - o3 endif - - # = #6 - # = [#6+#*0.1] ; slight lift for repositioning moves - - # = #1 - # = #3 - o11 if [#3 LT #1] - # = #3 - # = #1 - o11 endif - - # = #2 - # = #4 - o12 if [#4 LT #2] - # = #4 - # = #2 - o12 endif - - # = [[#+#]/2] ; pocket center X - # = [[#+#]/2] ; pocket center Y - # = [[[#-#]-#]/2] ; half-width minus tool radius - # = [[[#-#]-#]/2] ; half-height minus tool radius - - G0 X# Y# - G1 X[#+#] Y[#-#] - G1 X[#-#] Y[#-#] - G1 X[#-#] Y[#+#] - G1 X[#+#] Y[#+#] - - o100 if [[#8 EQ 0] OR [#8 EQ 1]] ; helical plunge - # = [#*0.3] - # = [#*2*3.14*TAN[#]] - - G0 Z# - G0 X[#+#] Y[#] - G0 Z#5 - - ; helical plunge - # = [#5-#] - o101 while [# GT #6] - o102 if [#8 EQ 0] - G3 X[#+#] Y[#] I[#] J[#] Z[#] P1 - o102 else - G2 X[#+#] Y[#] I[#] J[#] Z[#] P1 - o102 endif - # = [# - #] - o101 endwhile - - ; finish the helical plunge - # = [[#-#6]/#5*360] - o103 if [#8 EQ 0] - G3 X[#+COS[#]*#] Y[#+SIN[#]*#] I[#] J[#] Z[#6] - G3 X[#+COS[#]*#] Y[#+SIN[#]*#] I[#] J[#] Z[#6] - o103 else - G2 X[#+COS[#]*#] Y[#-SIN[#]*#] I[#] J[#] Z[#6] - G2 X[#+COS[#]*#] Y[#-SIN[#]*#] I[#] J[#] Z[#6] - o103 endif - - o100 elseif [[#8 EQ 2] OR [#8 EQ 3]] ; straight plunge - # = 0 - - G0 Z#5 - G0 X[#] Y[#] - G1 Z[#6] - - o100 endif - - ; spiral outward from center until hitting pocket boundary - # = # - # = # - o105 while [1] - - o106 if [[#8 MOD 2] EQ 0] - G1 X[#+COS[#]*#] Y[#+SIN[#]*#] - o106 else - G1 X[#+COS[#]*#] Y[#-SIN[#]*#] - o106 endif - - # = [#+1] ; next angle - # = [#+[#-#]/360*#] ; compute the radius accordingly - - - o110 if [ABS[COS[#]*#] GE [#-#7]] - ; hit the x limit, y is still 'unbounded' - o105 BREAK - o110 elseif [ABS[SIN[#]*#] GE [#-#7]] - ; hit the y limit, x is still 'unbounded' - o105 BREAK - o110 endif - o105 endwhile - - ; okay, let's run until we hit a limit - ; then based on which limit was hit, run in the perp. direction - ; then go into the negative of that direction - ; subroutines might be the best way to do this?? - -; o200 while [# LE 3] -; # = [#+1] ; next angle -; -; -; o201 if [[[COS[#]*# GE -#] AND [COS[#]*# LE #]] AND [[SIN[#]*# GE -#] AND [SIN[#]*# LE #]]] -; G1 X[#+COS[#]*#] Y[#+SIN[#]*#] -; o201 endif -; -; # = [#+0.5] ; next angle -; # = [#+[#-#]/360*#] ; compute the radius accordingly -; o200 endwhile - - - - o call ; clear corners that the spiral couldn't reach - - - - G0 Z# - - -o endsub - -; if you can come up with a closed-form solution for x*sin(x) = c, you could drastically streamline this code. Until then... Lots of g1s. -; idea: bias the main spiral. then you're left with a section to hog out -; idea 2: make angle arbitrary (blowing up the code so it's not x-y specific). That'll be fun. - -; Helper sub: clears rectangular corner material left by circular spiral -; Walks along the X-axis edge, tracing arcs that match the spiral boundary -o sub - # = 0 - # = 0 - # = 1 - o202 while [#] - G0 Z# - G0 X# Y[# - #] - G1 Z# - - # = FUP[sqrt[[#]**2 + [#]**2]/#] ; spiral revolution number at this corner point - # = ATAN[-#]/[#] - # = [#*# + #+[#-#]/360*#] - # = [#] - o200 while [# LT #] - G1 X[#+#] Y[#-#] - # = [# + 0.01] - # = ATAN[-#]/[#] - # = sqrt[[#]**2 + [#]**2] - # = [#*# + #+[#-#]/360*#] - ;# = [FUP[sqrt[[#]**2 + [#]**2]/#]*#] - - o204 if [# GT #] - # = 0 - o200 BREAK - o204 endif - o200 endwhile - - # = [COS[#]*#] - - o201 while [SIN[#]*# LT #] - # = [COS[#]*#] - o205 if [# GT #] - # = [#] - o205 endif - G1 X[#+#] Y[#+SIN[#]*#] - - # = [# + 1] - # = [#*# + #+[#-#]/360*#] - - - o201 endwhile - - - G1 X[#+#] Y[#+#] - - G0 Z# - G0 X[#+#] Y[#-#] - - # = # - # = [COS[#]*#] - o202 endwhile - o endsub - -M2 \ No newline at end of file diff --git a/nc_files/pocket_rect_lin.ngc b/nc_files/pocket_rect_lin.ngc index 2b7c1a4..6543bca 100755 --- a/nc_files/pocket_rect_lin.ngc +++ b/nc_files/pocket_rect_lin.ngc @@ -15,7 +15,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/programs/HECB-BRACKET.ngc b/nc_files/programs/HECB-BRACKET.ngc index d9153e1..3497448 100755 --- a/nc_files/programs/HECB-BRACKET.ngc +++ b/nc_files/programs/HECB-BRACKET.ngc @@ -17,9 +17,17 @@ F15 ; inch or mm/min (300 mm/min = about 1 ft/min) # = +0.05 # = -0.3 -o call [0.375][-0.375] [#][#] -o call [0.375+132/25.4][-0.375] [#][#] -o call [0.375+132/25.4+28/25.4][-0.375] [0.28] [#][#] -o call [0.375+132/25.4+28/25.4+2.75][-0.375] [0.28] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0.375][-0.375] +#<_z_top> = # +#<_z_bot> = # +o call [0.375+132/25.4][-0.375] +#<_z_top> = # +#<_z_bot> = # +o call [0] [0.375+132/25.4+28/25.4][-0.375] [0.28] +#<_z_top> = # +#<_z_bot> = # +o call [0] [0.375+132/25.4+28/25.4+2.75][-0.375] [0.28] M2 ; end program diff --git a/nc_files/programs/HECB-ENCLOSURE-BOTTOM.ngc b/nc_files/programs/HECB-ENCLOSURE-BOTTOM.ngc index b462423..6495384 100755 --- a/nc_files/programs/HECB-ENCLOSURE-BOTTOM.ngc +++ b/nc_files/programs/HECB-ENCLOSURE-BOTTOM.ngc @@ -19,17 +19,37 @@ F15 ; inch or mm/min (300 mm/min = about 1 ft/min) # = .250 -o call [-2.250][+.984] [#] [#][#] -o call [-2.742+.02][+.205] [#] [#][#] -o call [-1.758-.02][-.205] [#] [#][#] -o call [-2.250][-.984] [#] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-2.250][+.984] [#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-2.742+.02][+.205] [#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-1.758-.02][-.205] [#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-2.250][-.984] [#] -o call [0.571][-0.151] [.15] [#][#] [0][4] -o call [2.511][-0.151] [.15] [#][#] [0][4] -o call [1.225][-1.997] [.15] [#][#] [0][4] -o call [2.520][-1.997] [.15] [#][#] [0][4] +#<_z_top> = # +#<_z_bot> = # +o call [4] [0.571][-0.151] [.15] [0] +#<_z_top> = # +#<_z_bot> = # +o call [4] [2.511][-0.151] [.15] [0] +#<_z_top> = # +#<_z_bot> = # +o call [4] [1.225][-1.997] [.15] [0] +#<_z_top> = # +#<_z_bot> = # +o call [4] [2.520][-1.997] [.15] [0] -o call [.723][.307] [2.360][-.609] [#][#] [0] [.250] -o call [1.377][-1.567] [2.368][-2.426] [#][#] [0] [.250] +#<_z_top> = # +#<_z_bot> = # +o call [0] [.723][.307] [2.360][-.609] [.250] +#<_z_top> = # +#<_z_bot> = # +o call [0] [1.377][-1.567] [2.368][-2.426] [.250] M2 ; end program diff --git a/nc_files/programs/HECB-ENCLOSURE-TOP.cnc b/nc_files/programs/HECB-ENCLOSURE-TOP.cnc deleted file mode 100755 index cba106c..0000000 --- a/nc_files/programs/HECB-ENCLOSURE-TOP.cnc +++ /dev/null @@ -1,35 +0,0 @@ -#<_z_clearance> = 0.3 -#<_rampang> = 20 - -; mode refernce -; +1: Conventional milling -; +2: Both-ways milling -; +4: Plunge entry -; +8: Outside - -G20 ; G21 mm / G20 inch -G10 L1 P1 Z0.0 R[5/32/2] ; set tool -T1 ; set tool to T1 -M06 ; manual toolchange -G54 ; absolute coordinates -F15 ; inch or mm/min (300 mm/min = about 1 ft/min) - -# = +0.1 -# = -0.2 - -# = .250 - -o call [-2.250][+.984] [#] [#][#] -o call [-2.742][+.197] [#] [#][#] -o call [-1.758][-.197] [#] [#][#] -o call [-2.250][-.984] [#] [#][#] - -o call [0.571][-0.151] [#][#] -o call [2.511][-0.151] [#][#] -o call [1.225][-1.997] [#][#] -o call [2.520][-2.426] [#][#] - -o call [.723][.307] [2.360][-.609] [#][#] [0] [.250] -o call [1.377][-1.567] [2.368][-2.426] [#][#] [0] [.250] - -M2 ; end program diff --git a/nc_files/programs/HECB-ENCLOSURE-TOP.ngc b/nc_files/programs/HECB-ENCLOSURE-TOP.ngc index 481e094..987e559 100755 --- a/nc_files/programs/HECB-ENCLOSURE-TOP.ngc +++ b/nc_files/programs/HECB-ENCLOSURE-TOP.ngc @@ -19,16 +19,34 @@ F12 ; inch or mm/min (300 mm/min = about 1 ft/min) # = [12/25.4] -o call [-0.394][+.787] [#] [#][#] [0][4] -o call [-1.181][+.787] [#] [#][#] [0][4] -o call [-1.181][-.787] [#] [#][#] [0][4] -o call [-0.394][-.787] [#] [#][#] [0][4] +#<_z_top> = # +#<_z_bot> = # +o call [4] [-0.394][+.787] [#] [0] +#<_z_top> = # +#<_z_bot> = # +o call [4] [-1.181][+.787] [#] [0] +#<_z_top> = # +#<_z_bot> = # +o call [4] [-1.181][-.787] [#] [0] +#<_z_top> = # +#<_z_bot> = # +o call [4] [-0.394][-.787] [#] [0] -o call [-2.990][+1.480] [#][#] -o call [-1.769][+1.480] [#][#] -o call [-1.769][-1.480] [#][#] -o call [-2.990][-1.480] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [-2.990][+1.480] +#<_z_top> = # +#<_z_bot> = # +o call [-1.769][+1.480] +#<_z_top> = # +#<_z_bot> = # +o call [-1.769][-1.480] +#<_z_top> = # +#<_z_bot> = # +o call [-2.990][-1.480] -o call [-2.854][+1.417] [-1.870][-1.417] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-2.854][+1.417] [-1.870][-1.417] M2 ; end program diff --git a/nc_files/programs/HEMA-EBOXPANEL.ngc b/nc_files/programs/HEMA-EBOXPANEL.ngc index 961ce12..8be3e48 100755 --- a/nc_files/programs/HEMA-EBOXPANEL.ngc +++ b/nc_files/programs/HEMA-EBOXPANEL.ngc @@ -1,6 +1,6 @@ #<_z_clearance> = 12 #<_rampang> = 10 -#<_td> = 8 + ;#<_stepover> = 0.1 @@ -19,17 +19,35 @@ G21 ; G21 mm / G20 inch G54 ; absolute coordinates F170 ; inch or mm/min (300 mm/min = about 1 ft/min) -;o call [15][35] [21] [1][-8] -;o call [40][15] [21] [1][-8] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [15][35] [21] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [40][15] [21] -;o call [ 70][13] [16] [1][-8] -;o call [ 95][13] [16] [1][-8] -;o call [120][13] [16] [1][-8] -;o call [115][37] [16] [1][-8] -;o call [ 90][37] [16] [1][-8] -;o call [ 65][37] [16] [1][-8] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [ 70][13] [16] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [ 95][13] [16] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [120][13] [16] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [115][37] [16] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [ 90][37] [16] +;#<_z_top> = 1 +;#<_z_bot> = -8 +;o call [0] [ 65][37] [16] -o call [150][29] [29] [1][-8] +#<_z_top> = 1 +#<_z_bot> = -8 +o call [0] [150][29] [29] M2 ; end program diff --git a/nc_files/programs/HEMA-OUTFEED.ngc b/nc_files/programs/HEMA-OUTFEED.ngc index eb2a690..4cf4a4c 100755 --- a/nc_files/programs/HEMA-OUTFEED.ngc +++ b/nc_files/programs/HEMA-OUTFEED.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = .5 #<_rampang> = 10 -#<_td> = 0.25 ; mode refernce ; +1: Conventional milling @@ -18,14 +17,26 @@ F10 ;o call [180] [-5.513][-.50] [0.52] [#][#] -o call [-5.513][-.50] [0.51] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-5.513][-.50] [0.51] -o call [-2.028][-.315] [.323] [#][#] -o call [-0.494][-.669] [.323] [#][#] -o call [+0.494][-.669] [.323] [#][#] -o call [+2.028][-.315] [.323] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-2.028][-.315] [.323] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-0.494][-.669] [.323] +#<_z_top> = # +#<_z_bot> = # +o call [0] [+0.494][-.669] [.323] +#<_z_top> = # +#<_z_bot> = # +o call [0] [+2.028][-.315] [.323] -o call [+5.513][-.50] [0.51] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [+5.513][-.50] [0.51] o call [0] [+5.513][-.50] [0.52] [#][#] diff --git a/nc_files/programs/HEMA-P049.ngc b/nc_files/programs/HEMA-P049.ngc index f654f18..098d512 100755 --- a/nc_files/programs/HEMA-P049.ngc +++ b/nc_files/programs/HEMA-P049.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 10 #<_rampang> = 20 -#<_td> = [3/16*25.4] ; mode refernce ; +1: Conventional milling @@ -29,14 +28,30 @@ F150 ; inch or mm/min (300 mm/min = about 1 ft/min) ;# = 12.1 -;o call [68][-11] [#] [1][-5] [.1] -;o call [68][-11] [#] [-4][-10] [.1] -;o call [68][-25] [#] [1][-5] [.1] -;o call [68][-25] [#] [-4][-10] [.1] -;o call [68][-75+11] [#] [1][-5] [.1] -;o call [68][-75+11] [#] [-4][-10] [.1] -;o call [68][-75+25] [#] [1][-5] [.1] -;o call [68][-75+25] [#] [-4][-10] [.1] +;#<_z_top> = 1 +;#<_z_bot> = -5 +;o call [0] [68][-11] [#] [.1] +;#<_z_top> = -4 +;#<_z_bot> = -10 +;o call [0] [68][-11] [#] [.1] +;#<_z_top> = 1 +;#<_z_bot> = -5 +;o call [0] [68][-25] [#] [.1] +;#<_z_top> = -4 +;#<_z_bot> = -10 +;o call [0] [68][-25] [#] [.1] +;#<_z_top> = 1 +;#<_z_bot> = -5 +;o call [0] [68][-75+11] [#] [.1] +;#<_z_top> = -4 +;#<_z_bot> = -10 +;o call [0] [68][-75+11] [#] [.1] +;#<_z_top> = 1 +;#<_z_bot> = -5 +;o call [0] [68][-75+25] [#] [.1] +;#<_z_top> = -4 +;#<_z_bot> = -10 +;o call [0] [68][-75+25] [#] [.1] o call [5][-5] o call [5][-15] diff --git a/nc_files/programs/HEMA-P056.ngc b/nc_files/programs/HEMA-P056.ngc index 5909221..f2f4973 100755 --- a/nc_files/programs/HEMA-P056.ngc +++ b/nc_files/programs/HEMA-P056.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 10 #<_rampang> = 20 -#<_td> = [3/16*25.4] ; mode refernce ; +1: Conventional milling @@ -52,13 +51,17 @@ o10 elseif [# EQ 2] o call [+#+41][-50] [#+41][-58] [5.1] [#][#] o call [+#+105][-10] [#+105][-18] [5.1] [#][#] o call [+#+105][-50] [#+105][-58] [5.1] [#][#] - o call [+#+138][-8.0] [6.2] [#][#] + #<_z_top> = # + #<_z_bot> = # + o call [0] [+#+138][-8.0] [6.2] o call [-#-41][-10] [-#-41][-18] [5.1] [#][#] o call [-#-41][-50] [-#-41][-58] [5.1] [#][#] o call [-#-105][-10] [-#-105][-18] [5.1] [#][#] o call [-#-105][-50] [-#-105][-58] [5.1] [#][#] - o call [-#-138][-8.0] [6.2] [#][#] + #<_z_top> = # + #<_z_bot> = # + o call [0] [-#-138][-8.0] [6.2] o10 endif M2 ; end program diff --git a/nc_files/programs/HEMA-P057.ngc b/nc_files/programs/HEMA-P057.ngc index bdc5aeb..1fa09d8 100755 --- a/nc_files/programs/HEMA-P057.ngc +++ b/nc_files/programs/HEMA-P057.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 6 #<_rampang> = 20 -#<_td> = [9/16*25.4] ; mode refernce ; +1: Conventional milling @@ -19,20 +18,34 @@ F250 ; inch or mm/min (300 mm/min = about 1 ft/min) # = -12.5 # = 14.0 -;o call [0][0] [13.0] [+1][-5] [0] [+4+8] -;o call [0][0] [13.0] [-4][-10] [0] [+4+8] -o call [0][0] [15.0] [+1][-14] [0] [+4+8] -o call [0][0] [11.5] [+1][-14] [0] [+4+8] -o call [0][0] [7.95] [+1][-14] [0] [+4+8] +;#<_z_top> = +1 +;#<_z_bot> = -5 +;o call [+4+8] [0][0] [13.0] [0] +;#<_z_top> = -4 +;#<_z_bot> = -10 +;o call [+4+8] [0][0] [13.0] [0] +#<_z_top> = +1 +#<_z_bot> = -14 +o call [+4+8] [0][0] [15.0] [0] +#<_z_top> = +1 +#<_z_bot> = -14 +o call [+4+8] [0][0] [11.5] [0] +#<_z_top> = +1 +#<_z_bot> = -14 +o call [+4+8] [0][0] [7.95] [0] -;o call [0][0] [17] [-13][-18] [3] [+4+8] -o call [0][0] [17] [-13][-23] [3] [+4+8] +;#<_z_top> = -13 +;#<_z_bot> = -18 +;o call [+4+8] [0][0] [17] [3] +#<_z_top> = -13 +#<_z_bot> = -23 +o call [+4+8] [0][0] [17] [3] ;M02 # = 13 # = 6 -# = [[#+#<_td>]/2/COS[360/2/#]] +# = [[#+#5410]/2/COS[360/2/#]] G0 Z#<_z_clearance> G0 X# Y0 diff --git a/nc_files/programs/HEMA-P059.ngc b/nc_files/programs/HEMA-P059.ngc index f4f9506..3a633e8 100755 --- a/nc_files/programs/HEMA-P059.ngc +++ b/nc_files/programs/HEMA-P059.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 10 #<_rampang> = 7 -#<_td> = 6.35 ; mode refernce ; +1: Conventional milling @@ -23,10 +22,16 @@ F250 ; inch or mm/min (300 mm/min = about 1 ft/min) ;o call [5+45][0] ;o call [5+68][0] -o call [-5-68][0] [12] [1][-6] -o call [-5-68][0] [12] [-4][-12] +#<_z_top> = 1 +#<_z_bot> = -6 +o call [0] [-5-68][0] [12] +#<_z_top> = -4 +#<_z_bot> = -12 +o call [0] [-5-68][0] [12] F100 -o call [-5-68][0] [12.1] [-10][-11.9] [0] [+4] +#<_z_top> = -10 +#<_z_bot> = -11.9 +o call [+4] [-5-68][0] [12.1] [0] ;G0 X-50 diff --git a/nc_files/programs/HEMA-P060.ngc b/nc_files/programs/HEMA-P060.ngc index 4d28a7f..96330e1 100755 --- a/nc_files/programs/HEMA-P060.ngc +++ b/nc_files/programs/HEMA-P060.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 10 #<_rampang> = 20 -#<_td> = [3/16*25.4] ; mode refernce ; +1: Conventional milling @@ -25,7 +24,9 @@ F150 ; inch or mm/min (300 mm/min = about 1 ft/min) o call [#-7][#] [#-17][#] [5.1] [#][#] o call [#-47][#] [#-57][#] [5.1] [#][#] -o call [#-75][#] [#] [#][#] [0.1] +#<_z_top> = # +#<_z_bot> = # +o call [0] [#-75][#] [#] [0.1] #<_stepover> = 1.5 o call [180] [#-75][#] [13] [#][#] diff --git a/nc_files/programs/HEMA-RAILSIDEMNT.ngc b/nc_files/programs/HEMA-RAILSIDEMNT.ngc index 46d39fd..29a5084 100755 --- a/nc_files/programs/HEMA-RAILSIDEMNT.ngc +++ b/nc_files/programs/HEMA-RAILSIDEMNT.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = .5 #<_rampang> = 10 -#<_td> = [1/4] ; mode refernce ; +1: Conventional milling @@ -16,7 +15,9 @@ G54 ; absolute coordinates F10 -o call [-.5-.394-1][-.5] [.33] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-.5-.394-1][-.5] [.33] o call [180] [-.5-.394-1][-.5] [.52] [#][#] diff --git a/nc_files/programs/HEMA-RAILUPRIGHT.ngc b/nc_files/programs/HEMA-RAILUPRIGHT.ngc index b541d82..d6ff05c 100755 --- a/nc_files/programs/HEMA-RAILUPRIGHT.ngc +++ b/nc_files/programs/HEMA-RAILUPRIGHT.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = .5 #<_rampang> = 10 -#<_td> = [1/4] ; mode refernce ; +1: Conventional milling @@ -16,11 +15,21 @@ G54 ; absolute coordinates F10 -;o call [-0.375][-.5] [.240] [#][#] -;o call [-2.375][-.5] [.323] [#][#] -o call [-3.375][-.5] [.715] [#][#] -o call [-3.875][-.5] [.715] [#][#] -o call [-4.375][-.5] [.715] [#][#] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [-0.375][-.5] [.240] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [-2.375][-.5] [.323] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-3.375][-.5] [.715] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-3.875][-.5] [.715] +#<_z_top> = # +#<_z_bot> = # +o call [0] [-4.375][-.5] [.715] o call [180] [-4.375][-.5] [.52] [#][#] diff --git a/nc_files/programs/HEMA-SENSORMNT.ngc b/nc_files/programs/HEMA-SENSORMNT.ngc index 2cc186c..b9c3f49 100755 --- a/nc_files/programs/HEMA-SENSORMNT.ngc +++ b/nc_files/programs/HEMA-SENSORMNT.ngc @@ -1,6 +1,5 @@ #<_z_clearance> = 5 #<_rampang> = 10 -#<_td> = [3/16*25.4] ; mode refernce ; +1: Conventional milling @@ -15,15 +14,29 @@ F150 # = 0.2 # = -4 -o call [0][-17] [18.7] [#][#] +#<_z_top> = # +#<_z_bot> = # +o call [0] [0][-17] [18.7] -;o call [10][ -7] [5.2] [#][#] -;o call [10][-27] [5.2] [#][#] -;o call [35][-17] [18.7] [#][#] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [10][ -7] [5.2] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [10][-27] [5.2] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [35][-17] [18.7] -;o call [54+10][ -7] [5.2] [#][#] -;o call [54+10][-27] [5.2] [#][#] -;o call [54+35][-17] [18.7] [#][#] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [54+10][ -7] [5.2] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [54+10][-27] [5.2] +;#<_z_top> = # +;#<_z_bot> = # +;o call [0] [54+35][-17] [18.7] M2 ; end program diff --git a/nc_files/programs/HEMA-TILTBRACKET.ngc b/nc_files/programs/HEMA-TILTBRACKET.ngc index c55516b..2fececc 100755 --- a/nc_files/programs/HEMA-TILTBRACKET.ngc +++ b/nc_files/programs/HEMA-TILTBRACKET.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 6 #<_rampang> = 20 -#<_td> = 6.35 ; mode refernce ; +1: Conventional milling @@ -13,9 +12,15 @@ G54 ; absolute coordinates F150 ; inch or mm/min (300 mm/min = about 1 ft/min) -o call [-20][-10.0] [8.2] [2][-9] -o call [-20][-40.6] [8.2] [2][-9] -o call [+30][-25.3] [8.2] [2][-9] +#<_z_top> = 2 +#<_z_bot> = -9 +o call [0] [-20][-10.0] [8.2] +#<_z_top> = 2 +#<_z_bot> = -9 +o call [0] [-20][-40.6] [8.2] +#<_z_top> = 2 +#<_z_bot> = -9 +o call [0] [+30][-25.3] [8.2] o call [0][+30][-25.3] [26] [2][-9] [0.5] diff --git a/nc_files/programs/SCN-MOTORMOUNT.ngc b/nc_files/programs/SCN-MOTORMOUNT.ngc index c79e530..1179d7f 100755 --- a/nc_files/programs/SCN-MOTORMOUNT.ngc +++ b/nc_files/programs/SCN-MOTORMOUNT.ngc @@ -16,19 +16,33 @@ G54 ; absolute coordinates # = 2 o10 if [# EQ 1] - #<_td> = .26 F5 - o call [0.500][-.50] [#][#] - o call [0.500][-3.0] [#][#] - o call [5.125][-3.0] [#][#] - o call [5.125][-.50] [#][#] + #<_z_top> = # + #<_z_bot> = # + o call [0.500][-.50] + #<_z_top> = # + #<_z_bot> = # + o call [0.500][-3.0] + #<_z_top> = # + #<_z_bot> = # + o call [5.125][-3.0] + #<_z_top> = # + #<_z_bot> = # + o call [5.125][-.50] - o call [7.375][-0.500] [#][#] - o call [9.625][-0.500] [#][#] - o call [9.625][-2.156] [#][#] - o call [7.375][-2.156] [#][#] + #<_z_top> = # + #<_z_bot> = # + o call [7.375][-0.500] + #<_z_top> = # + #<_z_bot> = # + o call [9.625][-0.500] + #<_z_top> = # + #<_z_bot> = # + o call [9.625][-2.156] + #<_z_top> = # + #<_z_bot> = # + o call [7.375][-2.156] o10 elseif [# EQ 2] - #<_td> = .375 F8 o call [2] [10] [0][-3.5] [0] [#][#] diff --git a/nc_files/programs/backplate.ngc b/nc_files/programs/backplate.ngc index b6518fb..317f68f 100755 --- a/nc_files/programs/backplate.ngc +++ b/nc_files/programs/backplate.ngc @@ -12,14 +12,24 @@ F8.0 ; feedrate # = 5.75 # = 7.875 -o call [-#/2] [-#/2] [#/2] [#/2] [0.05] [-0.28] [3] [0.1] +#<_z_top> = 0.05 +#<_z_bot> = -0.28 +o call [3] [-#/2] [-#/2] [#/2] [#/2] [0.1] -;o call [0] [+0.75] [12.1/25.4] [0.1] [0.3] [-0.15] [.005] [0] -;o call [0] [-0.75] [12.1/25.4] [0.1] [0.05] [-0.15] [.005] [0] -;o call [-0.75] [0] [12.1/25.4] [0.1] [0.05] [-0.15] [.005] [0] -;o call [+0.75] [0] [12.1/25.4] [0.1] [0.05] [-0.15] [.005] [0] +;#<_z_top> = 0.1 +;#<_z_bot> = 0.3 +;o call [0] [0] [+0.75] [12.1/25.4] [-0.15] [.005] +;#<_z_top> = 0.1 +;#<_z_bot> = 0.05 +;o call [0] [0] [-0.75] [12.1/25.4] [-0.15] [.005] +;#<_z_top> = 0.1 +;#<_z_bot> = 0.05 +;o call [0] [-0.75] [0] [12.1/25.4] [-0.15] [.005] +;#<_z_top> = 0.1 +;#<_z_bot> = 0.05 +;o call [0] [+0.75] [0] [12.1/25.4] [-0.15] [.005] diff --git a/nc_files/programs/bore_call.ngc b/nc_files/programs/bore_call.ngc index a0f7d9c..2033a5b 100755 --- a/nc_files/programs/bore_call.ngc +++ b/nc_files/programs/bore_call.ngc @@ -5,8 +5,12 @@ M06 M101 G54 -o call [0.00] [0.00] [10.5/25.4] [-0.6] [-0.65] [0.5] -o call [0.00] [0.00] [12.0/25.4] [-0.6] [-0.65] [0.5] +#<_z_top> = -0.6 +#<_z_bot> = -0.65 +o call [0.00] [0.00] [10.5/25.4] [0.5] +#<_z_top> = -0.6 +#<_z_bot> = -0.65 +o call [0.00] [0.00] [12.0/25.4] [0.5] diff --git a/nc_files/programs/disconn_sw.ngc b/nc_files/programs/disconn_sw.ngc index 25ced21..4bcfc99 100755 --- a/nc_files/programs/disconn_sw.ngc +++ b/nc_files/programs/disconn_sw.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 6 #<_rampang> = 20 -#<_td> = 6.35 ; mode refernce ; +1: Conventional milling diff --git a/nc_files/programs/fluffer_mount.ngc b/nc_files/programs/fluffer_mount.ngc index 386616b..2913a84 100755 --- a/nc_files/programs/fluffer_mount.ngc +++ b/nc_files/programs/fluffer_mount.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 0.5 #<_rampang> = 20 -#<_td> = [1/4] ; mode refernce ; +1: Conventional milling diff --git a/nc_files/programs/jackplate.ngc b/nc_files/programs/jackplate.ngc index 827374e..ec29f78 100755 --- a/nc_files/programs/jackplate.ngc +++ b/nc_files/programs/jackplate.ngc @@ -24,10 +24,18 @@ o104 call [240 + 6.5] o104 call [300 - 6.5] -;o call [0.00] [0.00] [1.] [-0.65] [-0.65] [0.5] -;o call [0.00] [0.00] [1.50] [-0.65] [-0.65] [0.5] -;o call [0.00] [0.00] [1.75] [-0.65] [-0.65] [0.5] -;o call [0.00] [0.00] [2.02] [-0.65] [-0.65] [0.5] +;#<_z_top> = -0.65 +;#<_z_bot> = -0.65 +;o call [0.00] [0.00] [1.] [0.5] +;#<_z_top> = -0.65 +;#<_z_bot> = -0.65 +;o call [0.00] [0.00] [1.50] [0.5] +;#<_z_top> = -0.65 +;#<_z_bot> = -0.65 +;o call [0.00] [0.00] [1.75] [0.5] +;#<_z_top> = -0.65 +;#<_z_bot> = -0.65 +;o call [0.00] [0.00] [2.02] [0.5] diff --git a/nc_files/programs/jackplate_bore.ngc b/nc_files/programs/jackplate_bore.ngc index 60b3e62..8b27df4 100755 --- a/nc_files/programs/jackplate_bore.ngc +++ b/nc_files/programs/jackplate_bore.ngc @@ -5,10 +5,18 @@ M06 M101 G54 -;o call [0.00] [0.00] [1.50] [-0.74] [-0.75] [0.5] -;o call [0.00] [0.00] [1.75] [-0.74] [-0.75] [0.5] -;o call [0.00] [0.00] [2.00] [-0.74] [-0.75] [0.5] -o call [0.00] [0.00] [2.28] [-0.74] [-0.75] [0.5] +;#<_z_top> = -0.74 +;#<_z_bot> = -0.75 +;o call [0.00] [0.00] [1.50] [0.5] +;#<_z_top> = -0.74 +;#<_z_bot> = -0.75 +;o call [0.00] [0.00] [1.75] [0.5] +;#<_z_top> = -0.74 +;#<_z_bot> = -0.75 +;o call [0.00] [0.00] [2.00] [0.5] +#<_z_top> = -0.74 +#<_z_bot> = -0.75 +o call [0.00] [0.00] [2.28] [0.5] diff --git a/nc_files/programs/m6cb.ngc b/nc_files/programs/m6cb.ngc index 0dc6359..1b3a323 100755 --- a/nc_files/programs/m6cb.ngc +++ b/nc_files/programs/m6cb.ngc @@ -3,7 +3,6 @@ G54 ; absolute coordinates #<_z_clearance> = 6 #<_rampang> = 20 -#<_td> = 6.35 ; mode refernce ; +1: Conventional milling @@ -14,10 +13,18 @@ G54 ; absolute coordinates F250 ; inch or mm/min (300 mm/min = about 1 ft/min) o10 sub - o call [#1][-00] [10] [1][-6] [0.5] [+4] - o call [#1][-0] [-5][-16] - o call [#1][-20] [10] [1][-6] [0.5] [+4] - o call [#1][-20] [-5][-16] + #<_z_top> = 1 + #<_z_bot> = -6 + o call [+4] [#1][-00] [10] [0.5] + #<_z_top> = -5 + #<_z_bot> = -16 + o call [#1][-0] + #<_z_top> = 1 + #<_z_bot> = -6 + o call [+4] [#1][-20] [10] [0.5] + #<_z_top> = -5 + #<_z_bot> = -16 + o call [#1][-20] o10 endsub o10 call [-15] @@ -25,7 +32,11 @@ o10 call [-20] o10 call [-25] o10 call [-30] - o call [-100][-0] [-5][-16] - o call [-100][-20] [-5][-16] + #<_z_top> = -5 + #<_z_bot> = -16 + o call [-100][-0] + #<_z_top> = -5 + #<_z_bot> = -16 + o call [-100][-20] M2 ; end program diff --git a/nc_files/programs/playground.ngc b/nc_files/programs/playground.ngc index 4e462ac..bfcc9f7 100755 --- a/nc_files/programs/playground.ngc +++ b/nc_files/programs/playground.ngc @@ -12,7 +12,9 @@ M101 ;G82 X2 Y2 Z-1.5 R-0.5 P0.5 ;G83 X3 Y1 Z-1.5 R-0.5 Q0.1 -o call [0.03] [0.03] [1.05] [0.05] [-0.85] [0.1] +#<_z_top> = 0.05 +#<_z_bot> = -0.85 +o call [0.03] [0.03] [1.05] [0.1] diff --git a/nc_files/programs/rogator_bores.ngc b/nc_files/programs/rogator_bores.ngc index f4c6d4a..ba13de9 100755 --- a/nc_files/programs/rogator_bores.ngc +++ b/nc_files/programs/rogator_bores.ngc @@ -16,8 +16,12 @@ o call [-#1/2][0] o call [0.000][0] o call [+#1/2][0] -o call [-#1/2][0] [0.76] [0.02][-0.4] [0.02] -o call [+#1/2][0] [0.76] [0.02][-0.4] [0.02] +#<_z_top> = 0.02 +#<_z_bot> = -0.4 +o call [0] [-#1/2][0] [0.76] [0.02] +#<_z_top> = 0.02 +#<_z_bot> = -0.4 +o call [0] [+#1/2][0] [0.76] [0.02] M2 ; end program diff --git a/nc_files/programs/scratch.ngc b/nc_files/programs/scratch.ngc index b544107..435a238 100755 --- a/nc_files/programs/scratch.ngc +++ b/nc_files/programs/scratch.ngc @@ -16,8 +16,12 @@ G54 ; absolute coordinates M03 F20 -o call [+1][0] [-1][-2] -o call [-1][0] [-1][-2] +#<_z_top> = -1 +#<_z_bot> = -2 +o call [+1][0] +#<_z_top> = -1 +#<_z_bot> = -2 +o call [-1][0] M05 diff --git a/nc_files/programs/spacers.ngc b/nc_files/programs/spacers.ngc index 4cf54f3..f0b72b1 100755 --- a/nc_files/programs/spacers.ngc +++ b/nc_files/programs/spacers.ngc @@ -3,7 +3,6 @@ #<_pocketd> = 1.0 #<_pocketz> = 0.45 #<_id> = .63 -#<_td> = .1875 #<_tab_height> = .09 #<_z_clearance> = 1.0 #<_z_thru> = -0.03 @@ -12,8 +11,8 @@ #<_xy_feed> = 30.0 #<_angle_offset> = 13.0 -#<_xspacing> = [COS[30] * [#<_td>+#<_od>+#<_clearance>]] -#<_yspacing> = [SIN[30] * [#<_td>+#<_od>+#<_clearance>] * 2] +#<_xspacing> = [COS[30] * [#5410+#<_od>+#<_clearance>]] +#<_yspacing> = [SIN[30] * [#5410+#<_od>+#<_clearance>] * 2] #<_xstart> = 1.25 #<_ystart> = 1.2 @@ -23,24 +22,24 @@ o100 sub G90.1 ; absolute arc distance (inner bore) - G0 X#1 Y[#2+#<_id>/2 - #<_td>/2] Z[#<_z_clearance>] ; goto inner + G0 X#1 Y[#2+#<_id>/2 - #5410/2] Z[#<_z_clearance>] ; goto inner G0 Z[#<_z_start>] - G3 F[#<_xy_feed>] I#1 J#2 X#1 Y[#2+#<_id>/2 - #<_td>/2] P4 Z#<_z_thru> ; helix inner - G3 F[#<_xy_feed>] I#1 J#2 X#1 Y[#2+#<_id>/2 - #<_td>/2] + G3 F[#<_xy_feed>] I#1 J#2 X#1 Y[#2+#<_id>/2 - #5410/2] P4 Z#<_z_thru> ; helix inner + G3 F[#<_xy_feed>] I#1 J#2 X#1 Y[#2+#<_id>/2 - #5410/2] G0 Z[#<_z_clearance>] ; retract inner (inner pocket) - G0 X#1 Y[#2+#<_pocketd>/2 - #<_td>/2] Z[#<_z_start>] + G0 X#1 Y[#2+#<_pocketd>/2 - #5410/2] Z[#<_z_start>] G1 F[#<_z_feed>] Z[#<_pocketz>] - G3 F[#<_xy_feed>] I#1 J#2 X#1 Y[#2+#<_pocketd>/2 - #<_td>/2] + G3 F[#<_xy_feed>] I#1 J#2 X#1 Y[#2+#<_pocketd>/2 - #5410/2] G0 Z[#<_z_clearance>] (outer cut, with tabs) - G0 Z#<_z_clearance> X#1 Y[#2+#<_od>/2 + #<_td>/2] ; goto outer + G0 Z#<_z_clearance> X#1 Y[#2+#<_od>/2 + #5410/2] ; goto outer G0 Z[#<_z_start>] - # = [#<_od>/2 + #<_td>/2] + # = [#<_od>/2 + #5410/2] # = 90 G3 F[#<_xy_feed>] I#1 J#2 X[#1+#*COS[#-#<_angle_offset>]] Y[#2+#*SIN[#-#<_angle_offset>]] P3 Z[#<_tab_height>] ; helix inner @@ -66,7 +65,7 @@ o105 sub G54 G90.1 ; absolute arc distance - # = [#<_od>/2 + #<_td>/2] + # = [#<_od>/2 + #5410/2] # = 90 G0 X[#1+#*COS[#-#<_angle_offset>]] Y[#2+#*SIN[#-#<_angle_offset>]] Z[#<_z_start>] ; goto outer diff --git a/nc_files/programs/spr_hub_mill.ngc b/nc_files/programs/spr_hub_mill.ngc index 29fb9ea..d4959b3 100755 --- a/nc_files/programs/spr_hub_mill.ngc +++ b/nc_files/programs/spr_hub_mill.ngc @@ -11,22 +11,46 @@ G54 ; fixture #1 F5.0 ; feedrate -o call [0][0] [0.755] [0.12][-0.3] [0.02] [0] +#<_z_top> = 0.12 +#<_z_bot> = -0.3 +o call [0] [0][0] [0.755] [0.02] F5.0 o call [0][0] [3][1.575] [0.12][0.0] [0.02] -;o call [-1.4][-1.4] [1.4][1.4] [0.02][-0.1] [3] -;o call [-1.3][-1.3] [1.3][1.3] [0.02][-0.1] [3] -;o call [-1.2][-1.2] [1.2][1.2] [0.02][-0.1] [3] -;o call [-1.1][-1.1] [1.1][1.1] [0.02][-0.1] [3] -;o call [-1.0][-1.0] [1.0][1.0] [0.02][-0.1] [3] -;o call [-0.9][-0.9] [0.9][0.9] [0.02][-0.1] [3] -;o call [-0.8][-0.8] [0.8][0.8] [0.02][-0.1] [3] -;o call [0][0] [2.175] [0.02][-0.1] [2] -;o call [0][0] [1.975] [0.02][-0.1] [2] -;o call [0][0] [1.775] [0.02][-0.1] [2] -;o call [0][0] [1.575] [0.02][-0.1] [2] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [3] [-1.4][-1.4] [1.4][1.4] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [3] [-1.3][-1.3] [1.3][1.3] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [3] [-1.2][-1.2] [1.2][1.2] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [3] [-1.1][-1.1] [1.1][1.1] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [3] [-1.0][-1.0] [1.0][1.0] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [3] [-0.9][-0.9] [0.9][0.9] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [3] [-0.8][-0.8] [0.8][0.8] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [0] [0][0] [2.175] [2] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [0] [0][0] [1.975] [2] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [0] [0][0] [1.775] [2] +;#<_z_top> = 0.02 +;#<_z_bot> = -0.1 +;o call [0] [0][0] [1.575] [2] M2 ; end program diff --git a/nc_files/programs/switchplate.ngc b/nc_files/programs/switchplate.ngc index 0e008f0..e986e78 100755 --- a/nc_files/programs/switchplate.ngc +++ b/nc_files/programs/switchplate.ngc @@ -12,18 +12,30 @@ F8.0 ; feedrate # = 2.80 # = 4.55 -o call [-#/2] [-#/2] [#/2] [#/2] [0.05] [-0.1] [3] [0.1] +#<_z_top> = 0.05 +#<_z_bot> = -0.1 +o call [3] [-#/2] [-#/2] [#/2] [#/2] [0.1] # = 2.75 # = 4.50 -o call [-#/2] [-#/2] [#/2] [#/2] [0.05] [-0.1] [3] [0.1] +#<_z_top> = 0.05 +#<_z_bot> = -0.1 +o call [3] [-#/2] [-#/2] [#/2] [#/2] [0.1] -o call [0] [+0.75] [12.1/25.4] [0.1] [0.3] [-0.15] [.005] [0] -o call [0] [-0.75] [12.1/25.4] [0.1] [0.05] [-0.15] [.005] [0] -o call [-0.75] [0] [12.1/25.4] [0.1] [0.05] [-0.15] [.005] [0] -o call [+0.75] [0] [12.1/25.4] [0.1] [0.05] [-0.15] [.005] [0] +#<_z_top> = 0.1 +#<_z_bot> = 0.3 +o call [0] [0] [+0.75] [12.1/25.4] [-0.15] [.005] +#<_z_top> = 0.1 +#<_z_bot> = 0.05 +o call [0] [0] [-0.75] [12.1/25.4] [-0.15] [.005] +#<_z_top> = 0.1 +#<_z_bot> = 0.05 +o call [0] [-0.75] [0] [12.1/25.4] [-0.15] [.005] +#<_z_top> = 0.1 +#<_z_bot> = 0.05 +o call [0] [+0.75] [0] [12.1/25.4] [-0.15] [.005] diff --git a/nc_files/programs/switchplate_drill.ngc b/nc_files/programs/switchplate_drill.ngc index d58fb05..1fd100c 100755 --- a/nc_files/programs/switchplate_drill.ngc +++ b/nc_files/programs/switchplate_drill.ngc @@ -8,17 +8,18 @@ G54 ; fixture #1 F5.0 ; feedrate +#<_z_top> = 0.1 +#<_z_bot> = -0.2 +o call [-2/2] [-3.875/2] +o call [+2/2] [-3.875/2] +o call [+2/2] [+3.875/2] +o call [-2/2] [+3.875/2] -o call [-2/2] [-3.875/2] [0.1] [-0.2] -o call [+2/2] [-3.875/2] [0.1] [-0.2] -o call [+2/2] [+3.875/2] [0.1] [-0.2] -o call [-2/2] [+3.875/2] [0.1] [-0.2] - -o call [+0.75] [0] [0.1] [-0.2] -o call [-0.75] [0] [0.1] [-0.2] -o call [0] [-0.75] [0.1] [-0.2] -o call [0] [+0.75] [0.1] [-0.2] +o call [+0.75] [0] +o call [-0.75] [0] +o call [0] [-0.75] +o call [0] [+0.75] diff --git a/nc_files/programs/trailer_sens_bracket.ngc b/nc_files/programs/trailer_sens_bracket.ngc index de1f04b..9a0d327 100755 --- a/nc_files/programs/trailer_sens_bracket.ngc +++ b/nc_files/programs/trailer_sens_bracket.ngc @@ -16,26 +16,51 @@ G54 ; absolute coordinates # = 2 -#<_td> = 0.5 F12 - o call [-3.5][-.5] [2] [0.1][-0.4] [0.0] - o call [-1.875][-.5] [0.52] [0.1][-0.4] [0.0] - o call [-5.125][-.5] [0.52] [0.1][-0.4] [0.0] + #<_z_top> = 0.1 + #<_z_bot> = -0.4 + o call [0] [-3.5][-.5] [2] [0.0] + #<_z_top> = 0.1 + #<_z_bot> = -0.4 + o call [0] [-1.875][-.5] [0.52] [0.0] + #<_z_top> = 0.1 + #<_z_bot> = -0.4 + o call [0] [-5.125][-.5] [0.52] [0.0] F8 ;o10 if [# EQ 1] -o call [-.5][-.5] [0.1][-0.3] -;o call [-1.875][-.5] [0.1][-0.3] -;o call [-3.500][-.5] [0.1][-0.3] -;o call [-5.125][-.5] [0.1][-0.3] -o call [-7.750][-.5] [0.1][-0.3] -o call [-8.500][-.5] [0.1][-0.3] -o call [-9.250][-.5] [0.1][-0.3] -o call [-10.00][-.5] [0.1][-0.3] -o call [-10.75][-.5] [0.1][-0.3] -o call [-11.50][-.5] [0.1][-0.3] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [-.5][-.5] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.3 +;o call [-1.875][-.5] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.3 +;o call [-3.500][-.5] +;#<_z_top> = 0.1 +;#<_z_bot> = -0.3 +;o call [-5.125][-.5] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [-7.750][-.5] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [-8.500][-.5] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [-9.250][-.5] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [-10.00][-.5] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [-10.75][-.5] +#<_z_top> = 0.1 +#<_z_bot> = -0.3 +o call [-11.50][-.5] ;o10 elseif [# EQ 2] ;o10 endif diff --git a/nc_files/slot.ngc b/nc_files/slot.ngc deleted file mode 100755 index e513884..0000000 --- a/nc_files/slot.ngc +++ /dev/null @@ -1,92 +0,0 @@ -; Slot/obround cut - cuts a slot (stadium shape) between two endpoints -; Params: #1=x1, #2=y1, #3=x2, #4=y2, #5=width, #6=ztop, #7=zbot, #8=fincut, #9=mode -; Mode bitmask: bit0=conventional, bit1=bothways, bit2=plunge(vs helix), bit3=outside -o sub - ; o call [x1][y1] [x2][y2] [width] [ztop][zbot] [fincut] [mode] - - # = [FIX[#9/1] MOD 2 EQ 1] - # = [FIX[#9/2] MOD 2 EQ 1] - # = [FIX[#9/4] MOD 2 EQ 1] - # = [FIX[#9/8] MOD 2 EQ 1] - # = [FIX[#9/1] MOD 2 EQ 0] - # = [FIX[#9/2] MOD 2 EQ 0] - # = [FIX[#9/4] MOD 2 EQ 0] - # = [FIX[#9/8] MOD 2 EQ 0] - - ;G10 L0 ; re-read tool data - G90 ; absolute x,y,z - G90.1 ; absolute i,j,k - M101 ; enable Z-axis (M102 disables) - G17 ; select XY plane for arcs - - # = #<_td> - # = [#/2] - o1 if [EXISTS[#<_z_clearance>]] - # = #<_z_clearance> - o1 else - # = #5 - o1 endif - - # = [ATAN[#4-#2]/[#3-#1]] ; slot angle from p1 to p2 - - G0 Z# - - G0 X#1 Y#2 - G0 Z#6 - G1 Z#7 ; plunge to cut depth - G1 X#3 Y#4 ; cut centerline of slot - - - # = [[#5-#<_td>]/2] ; offset from centerline to slot edge (compensated for tool) - - ; Trace obround perimeter: two straights + two semicircles at each end - o100 if [#] - o101 if [#8 GT 0] ; pre-finish pass offset inward by fincut - G1 X[#3 +[SIN[#]*[#-#8]]] Y[#4 -[COS[#]*[#-#8]]] ; point 1 - G3 X[#3 -[SIN[#]*[#-#8]]] Y[#4 +[COS[#]*[#-#8]]] I#3 J#4 ; point 2 - G1 X[#1 -[SIN[#]*[#-#8]]] Y[#2 +[COS[#]*[#-#8]]] ; point 3 - G3 X[#1 +[SIN[#]*[#-#8]]] Y[#2 -[COS[#]*[#-#8]]] I#1 J#2 ; point 4 - G1 X[#3 +[SIN[#]*[#-#8]]] Y[#4 -[COS[#]*[#-#8]]] ; point 1 - o101 endif - - G1 X[#3 +[SIN[#]*[#]]] Y[#4 -[COS[#]*[#]]] ; point 1 - G3 X[#3 -[SIN[#]*[#]]] Y[#4 +[COS[#]*[#]]] I#3 J#4 ; point 2 - G1 X[#1 -[SIN[#]*[#]]] Y[#2 +[COS[#]*[#]]] ; point 3 - G3 X[#1 +[SIN[#]*[#]]] Y[#2 -[COS[#]*[#]]] I#1 J#2 ; point 4 - G1 X[#3 +[SIN[#]*[#]]] Y[#4 -[COS[#]*[#]]] ; point 1 - - G0 X#3 Y#4 - G0 Z#6 - o100 else - o102 if [#8 GT 0] - G1 X[#3 -[SIN[#]*[#-#8]]] Y[#4 +[COS[#]*[#-#8]]] ; point 2 - G2 X[#3 +[SIN[#]*[#-#8]]] Y[#4 -[COS[#]*[#-#8]]] I#3 J#4 ; point 1 - G1 X[#1 +[SIN[#]*[#-#8]]] Y[#2 -[COS[#]*[#-#8]]] ; point 4 - G2 X[#1 -[SIN[#]*[#-#8]]] Y[#2 +[COS[#]*[#-#8]]] I#1 J#2 ; point 3 - G1 X[#3 -[SIN[#]*[#-#8]]] Y[#4 +[COS[#]*[#-#8]]] ; point 2 - o102 endif - - G1 X[#3 -[SIN[#]*[#]]] Y[#4 +[COS[#]*[#]]] ; point 2 - G2 X[#3 +[SIN[#]*[#]]] Y[#4 -[COS[#]*[#]]] I#3 J#4 ; point 1 - G1 X[#1 +[SIN[#]*[#]]] Y[#2 -[COS[#]*[#]]] ; point 4 - G2 X[#1 -[SIN[#]*[#]]] Y[#2 +[COS[#]*[#]]] I#1 J#2 ; point 3 - G1 X[#3 -[SIN[#]*[#]]] Y[#4 +[COS[#]*[#]]] ; point 2 - o100 endif - - G0 X#3 Y#4 - G0 Z# - - - -o endsub - -F5 -o call [0] [-0.0] [0] [-0.0-0.3] [0.33] [0.1] [-0.15] -o call [0] [-1.5] [0] [-1.5-0.3] [0.33] [0.1] [-0.15] -o call [0] [-3.0] [0] [-3.0-0.3] [0.33] [0.1] [-0.15] -;o call [0] [-4.5] [0] [-4.5-0.3] [0.33] [0.1] [-0.15] -;o call [0] [-6.0] [0] [-6.0-0.3] [0.33] [0.1] [-0.15] - - - -M2 \ No newline at end of file diff --git a/nc_files/slot_chop.ngc b/nc_files/slot_chop.ngc index 36411ac..e165c6a 100755 --- a/nc_files/slot_chop.ngc +++ b/nc_files/slot_chop.ngc @@ -16,7 +16,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/slot_troch.ngc b/nc_files/slot_troch.ngc index 36693eb..fc3325b 100755 --- a/nc_files/slot_troch.ngc +++ b/nc_files/slot_troch.ngc @@ -16,7 +16,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> @@ -30,7 +30,7 @@ o sub o3 endif # = [ATAN[#4-#2]/[#3-#1]] - # = [[#5-#<_td>]/2] + # = [[#5-#5410]/2] @@ -57,7 +57,7 @@ o sub o100 if [#] - # = [[#5-#<_td>]/2-#8] + # = [[#5-#5410]/2-#8] G1 X[#1+#*COS[#] -[SIN[#]*[#]]] Y[#2+#*SIN[#] +[COS[#]*[#]]] G3 X[#1+#*COS[#] +[SIN[#]*[#]]] Y[#2+#*SIN[#] -[COS[#]*[#]]] I[#1+#*COS[#]] J[#2+#*SIN[#]] @@ -71,7 +71,7 @@ o sub # = [#+#] o200 endwhile - # = [[#5-#<_td>]/2] + # = [[#5-#5410]/2] G1 X[#3 +[SIN[#]*[#]]] Y[#4 -[COS[#]*[#]]] ; point 1 G3 X[#3 -[SIN[#]*[#]]] Y[#4 +[COS[#]*[#]]] I#3 J#4 ; point 2 @@ -80,7 +80,7 @@ o sub G1 X[#3 +[SIN[#]*[#]]] Y[#4 -[COS[#]*[#]]] ; point 1 o100 else - # = [[#5-#<_td>]/2-#8] + # = [[#5-#5410]/2-#8] G1 X[#1+#*COS[#] +[SIN[#]*[#]]] Y[#2+#*SIN[#] -[COS[#]*[#]]] G2 X[#1+#*COS[#] -[SIN[#]*[#]]] Y[#2+#*SIN[#] +[COS[#]*[#]]] I[#1+#*COS[#]] J[#2+#*SIN[#]] @@ -94,7 +94,7 @@ o sub # = [#+#] o200 endwhile - # = [[#5-#<_td>]/2] + # = [[#5-#5410]/2] G1 X[#3 -[SIN[#]*[#]]] Y[#4 +[COS[#]*[#]]] ; point 2 G2 X[#3 +[SIN[#]*[#]]] Y[#4 -[COS[#]*[#]]] I#3 J#4 ; point 1 diff --git a/nc_files/spquircle_boss.ngc b/nc_files/spquircle_boss.ngc index ecdd761..93bb48b 100755 --- a/nc_files/spquircle_boss.ngc +++ b/nc_files/spquircle_boss.ngc @@ -16,7 +16,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/spquircle_pocket.ngc b/nc_files/spquircle_pocket.ngc index 973bf7d..812c3a2 100755 --- a/nc_files/spquircle_pocket.ngc +++ b/nc_files/spquircle_pocket.ngc @@ -17,7 +17,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/squircle_boss.ngc b/nc_files/squircle_boss.ngc index 1078d28..810aca0 100755 --- a/nc_files/squircle_boss.ngc +++ b/nc_files/squircle_boss.ngc @@ -11,7 +11,7 @@ o sub M101 ; enable Z-axis (M102 disables) G17 ; select XY plane for arcs - # = #<_td> + # = #5410 # = [#/2] o1 if [EXISTS[#<_z_clearance>]] # = #<_z_clearance> diff --git a/nc_files/subs/bore.ngc b/nc_files/subs/bore.ngc new file mode 100644 index 0000000..e883f7d --- /dev/null +++ b/nc_files/subs/bore.ngc @@ -0,0 +1,36 @@ +; bore - helical boring subroutine. Spirals down in full-circle passes, +; then a partial-arc cleanup and a spring pass at final depth. +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +o sub + ; o call [x][y] [d] [stepdown] + ; #1=x #2=y #3=d #4=stepdown + + G90 + G91.1 + + G0 X#1 Y#2 + G0 Z#<_z_top> + G1 X[#1+#3/2-#5410/2] Y[#2] + G17 + + # = [#3/2-#5410/2] + + # = [#<_z_top> - #4] + o101 while [# GT #<_z_bot>] + G3 X[#1+#] Y[#2] I[-#] Z[#] P1 + # = [# - #4] + o101 endwhile + + o102 if [#<_z_top> GT #<_z_bot>] + # = [[#-#<_z_bot>]/#4*360] + G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[-#] Z[#<_z_bot>] + G3 X[#1+COS[#]*#] Y[#2+SIN[#]*#] I[-COS[#]*#] J[-SIN[#]*#] Z[#<_z_bot>] + o102 endif + + G0 X#1 Y#2 + G0 Z0 + +o endsub + +M2 diff --git a/nc_files/subs/drill.ngc b/nc_files/subs/drill.ngc new file mode 100644 index 0000000..be67ee9 --- /dev/null +++ b/nc_files/subs/drill.ngc @@ -0,0 +1,36 @@ +; drill - peck-drilling subroutine +; Requires globals: #<_z_top>, #<_z_bot> +; Optional global: #<_z_clearance> +o sub + ; x, y, peck + ; #1 #2 #3 + + G90 ; absolute x,y,z + M101 ; enable Z-axis (M102 disables) + + o2 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o2 else + # = #<_z_top> + o2 endif + + G0 Z# + G0 X#1 Y#2 + G0 Z#<_z_top> + + o104 if [#3 NE 0] ; peck drilling + # = [#<_z_top> - #3] ; first peck target (one peck below top) + o101 while [# GT #<_z_bot>] + G1 Z# + G0 Z#<_z_top> ; full retract + G0 Z[#+.02] ; rapid back to just above previous depth + # = [#-#3] + o101 endwhile + o104 endif + + G1 Z#<_z_bot> + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/drill_man.ngc b/nc_files/subs/drill_man.ngc new file mode 100644 index 0000000..31706bd --- /dev/null +++ b/nc_files/subs/drill_man.ngc @@ -0,0 +1,16 @@ +; drill_man - positions XY, disables Z, pauses for manual drilling +; No globals required (Z is disabled for the whole operation) +o sub + ; x, y + ; #1 #2 + + G90 ; absolute x,y,z + M102 ; disable Z-axis (M101 enables) + + G0 X#1 Y#2 + + M0 ; pause for operator + +o endsub + +M2 diff --git a/nc_files/subs/drill_retr.ngc b/nc_files/subs/drill_retr.ngc new file mode 100644 index 0000000..cf000de --- /dev/null +++ b/nc_files/subs/drill_retr.ngc @@ -0,0 +1,26 @@ +; drill_retr - semi-manual drill: retracts Z, disables Z for manual plunge, +; then re-enables and retracts on resume. +; Optional global: #<_z_clearance> (else falls back to #<_z_top>) +o sub + ; x, y + ; #1 #2 + + G90 ; absolute x,y,z + + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + + M101 + G0 Z# + G0 X#1 Y#2 + M102 ; disable Z so operator can plunge manually + M0 ; pause + M101 ; re-enable Z + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/frame_circ.ngc b/nc_files/subs/frame_circ.ngc new file mode 100644 index 0000000..ad57b12 --- /dev/null +++ b/nc_files/subs/frame_circ.ngc @@ -0,0 +1,84 @@ +; frame_circ - cuts along the perimeter of a circle (inside or outside). +; Lead-in arc capped at min(tool_radius, 15% of diameter, available_clearance). +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +; Optional global: #<_z_clearance> +o sub + ; o call [mode] [x][y] [diameter] [fincut] + ; #1=mode #2=x #3=y #4=diameter #5=fincut + + # = [FIX[#1/1] MOD 2 EQ 1] + # = [FIX[#1/8] MOD 2 EQ 1] + # = [FIX[#1/1] MOD 2 EQ 0] + # = [FIX[#1/8] MOD 2 EQ 0] + + G90 + G90.1 + M101 + G17 + + # = #5410 + # = [#/2] + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + + ; lead-in arc radius: capped at tool radius, 15% of pocket diameter, + ; and available clearance between tool and pocket wall + # = # + o10 if [# GT [#4*0.15]] + # = [#4*0.15] + o10 endif + ; for inside cuts, also cap to available radial clearance + o11 if [#] + # = [[#4/2 - #] * 0.4] + o12 if [# LT #] + # = # + o12 endif + o11 endif + o13 if [# LT 0.001] + # = 0.001 + o13 endif + + G0 Z# + + o20 if [# AND #] + G0 X[#2-#] Y[#3 + #4/2 - # - #] + G0 Z#<_z_top> + G1 Z#<_z_bot> + G2 X#2 Y[#3 + #4/2 - #] I#2 J[#3 + #4/2 - # - #] + G2 X#2 Y[#3 + #4/2 - #] I#2 J#3 + G2 X[#2+#] Y[#3 + #4/2 - # - #] I#2 J[#3 + #4/2 - # - #] + + o20 elseif [# AND #] + G0 X[#2+#] Y[#3 + #4/2 - # - #] + G0 Z#<_z_top> + G1 Z#<_z_bot> + G3 X#2 Y[#3 + #4/2 - #] I#2 J[#3 + #4/2 - # - #] + G3 X#2 Y[#3 + #4/2 - #] I#2 J#3 + G3 X[#2-#] Y[#3 + #4/2 - # - #] I#2 J[#3 + #4/2 - # - #] + + o20 elseif [# AND #] + G0 X[#2+#] Y[#3 + #4/2 + # + #] + G0 Z#<_z_top> + G1 Z#<_z_bot> + G2 X#2 Y[#3 + #4/2 + #] I#2 J[#3 + #4/2 + # + #] + G3 X#2 Y[#3 + #4/2 + #] I#2 J#3 + G2 X[#2-#] Y[#3 + #4/2 + #+ #] I#2 J[#3 + #4/2 + # + #] + + o20 elseif [# AND #] + G0 X[#2-#] Y[#3 + #4/2 + # + #] + G0 Z#<_z_top> + G1 Z#<_z_bot> + G3 X#2 Y[#3 + #4/2 + #] I#2 J[#3 + #4/2 + # + #] + G2 X#2 Y[#3 + #4/2 + #] I#2 J#3 + G3 X[#2+#] Y[#3 + #4/2 + #+ #] I#2 J[#3 + #4/2 + # + #] + o20 endif + + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/frame_rect.ngc b/nc_files/subs/frame_rect.ngc new file mode 100644 index 0000000..4af5361 --- /dev/null +++ b/nc_files/subs/frame_rect.ngc @@ -0,0 +1,138 @@ +; frame_rect - cuts along the perimeter of a rectangle (inside or outside). +; Supports optional corner radii. +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +; Optional global: #<_z_clearance> +o sub + ; o call [mode] [x1][y1] [x2][y2] [radius] + ; #1=mode #2=x1 #3=y1 #4=x2 #5=y2 #6=radius + + # = [FIX[#1/1] MOD 2 EQ 1] + # = [FIX[#1/8] MOD 2 EQ 1] + # = [FIX[#1/1] MOD 2 EQ 0] + # = [FIX[#1/8] MOD 2 EQ 0] + + G90 + G91.1 + M101 + G17 + + # = #5410 + # = [#/2] + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + + # = #2 + # = #4 + o3 if [#4 LT #2] + # = #4 + # = #2 + o3 endif + # = #3 + # = #5 + o4 if [#5 LT #3] + # = #5 + # = #3 + o4 endif + + G0 Z# + + o10 if [# AND #] + G0 X[[#2+#4]/2] Y[[#3+#5]/2] + G0 Z#<_z_top> + G1 Z#<_z_bot> + G1 X[#-#] + o102 if [#6 GT #] + G1 Y[#+#6] + G2 X[#-#6] Y[#+#] J0 I[-#6+#] + G1 X[#+#6] + G2 Y[#+#6] X[#+#] I0 J[+#6-#] + G1 Y[#-#6] + G2 X[#+#6] Y[#-#] J0 I[+#6-#] + G1 X[#-#6] + G2 Y[#-#6] X[#-#] I0 J[-#6+#] + o102 else + G1 Y[#+#] + G1 X[#-#] + G1 Y[#-#] + G1 X[#-#] + G1 Y[#+#] + o102 endif + G1 Y[[#3+#5]/2] + G0 X[[#2+#4]/2] Y[[#3+#5]/2] + G0 Z#<_z_top> + + o10 elseif [# AND #] + G0 X[[#2+#4]/2] Y[[#3+#5]/2] + G0 Z#<_z_top> + G1 Z#<_z_bot> + G1 X[#-#] + o101 if [#6 GT #] + G1 Y[#-#6] + G3 X[#-#6] Y[#-#] J0 I[-#6+#] + G1 X[#+#6] + G3 Y[#-#6] X[#+#] I0 J[-#6+#] + G1 Y[#+#6] + G3 X[#+#6] Y[#+#] J0 I[+#6-#] + G1 X[#-#6] + G3 Y[#+#6] X[#-#] I0 J[+#6-#] + o101 else + G1 Y[#-#] + G1 X[#+#] + G1 Y[#+#] + G1 X[#-#] + G1 Y[#-#] + o101 endif + G1 Y[[#3+#5]/2] + G0 X[[#2+#4]/2] Y[[#3+#5]/2] + G0 Z#<_z_top> + + o10 elseif [# AND #] + G0 X[#-#] Y[#+#] + G0 Z#<_z_top> + G1 Z#<_z_bot> + o104 if [#6 GT 0] + G1 Y[#+#6] + G3 X[#+#6] Y[#-#] J0 I[+#6+#] + G1 X[#-#6] + G3 Y[#+#6] X[#+#] I0 J[+#6+#] + G1 Y[#-#6] + G3 X[#-#6] Y[#+#] J0 I[-#6-#] + G1 X[#+#6] + G3 Y[#-#6] X[#-#] I0 J[-#6-#] + o104 else + G1 Y[#-#] + G1 X[#+#] + G1 Y[#+#] + G1 X[#-#] + o104 endif + G0 Z#<_z_top> + + o10 elseif [# AND #] + G0 X[#-#] Y[#-#] + G0 Z#<_z_top> + G1 Z#<_z_bot> + o103 if [#6 GT 0] + G1 Y[#-#6] + G2 X[#+#6] Y[#+#] J0 I[+#6+#] + G1 X[#-#6] + G2 Y[#-#6] X[#+#] I0 J[-#6-#] + G1 Y[#+#6] + G2 X[#-#6] Y[#-#] J0 I[-#6-#] + G1 X[#+#6] + G2 Y[#+#6] X[#-#] I0 J[+#6+#] + o103 else + G1 Y[#+#] + G1 X[#+#] + G1 Y[#-#] + G1 X[#-#] + o103 endif + G0 Z#<_z_top> + o10 endif + +o endsub + +M2 diff --git a/nc_files/subs/pocket_circ.ngc b/nc_files/subs/pocket_circ.ngc new file mode 100644 index 0000000..5012a63 --- /dev/null +++ b/nc_files/subs/pocket_circ.ngc @@ -0,0 +1,139 @@ +; pocket_circ - circular pocket cut with an outward spiral from center. +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +; Optional globals: #<_z_clearance>, #<_rampang>, #<_stepover> +o sub + ; o call [mode] [x][y] [diameter] [fincut] + ; #1=mode #2=x #3=y #4=diameter #5=fincut + + # = [FIX[#1/1] MOD 2 EQ 1] + # = [FIX[#1/4] MOD 2 EQ 1] + # = [FIX[#1/1] MOD 2 EQ 0] + # = [FIX[#1/4] MOD 2 EQ 0] + + G90 + G90.1 + M101 + G17 + + # = #5410 + # = [#/2] + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + o2 if [EXISTS[#<_rampang>]] + # = #<_rampang> + o2 else + # = 5 + o2 endif + o3 if [EXISTS[#<_stepover>]] + # = #<_stepover> + o3 else + # = [#*0.4] + o3 endif + + o4 if [# GT #4] + o5 return ; tool bigger than pocket + o4 endif + + # = 0 + # = 0 + o100 if [#] + # = [#*0.3] + o115 if [[[#4-#]/2-ABS[#5]] LE #] + # = [[[#4-#]/2-ABS[#5]]*0.8] + o115 endif + + # = [#*2*3.14*TAN[#]] + ; guard: if z_step is tiny, avoid infinite loop + o116 if [# LT 0.0001] + # = 0.0001 + o116 endif + + G0 Z# + G0 X[#2+#] Y[#3] + G0 Z#<_z_top> + + # = [#<_z_top>-#] + o101 while [# GT #<_z_bot>] + o102 if [#] + G3 X[#2+#] Y[#3] I[#2] J[#3] Z[#] P1 + o102 else + G2 X[#2+#] Y[#3] I[#2] J[#3] Z[#] P1 + o102 endif + # = [# - #] + o101 endwhile + + ; finish plunge to exact depth + ; guard: avoid division by zero if z_top == z_bot + o117 if [ABS[#<_z_top>-#<_z_bot>] GT 0.0001] + # = [[#-#<_z_bot>]/[#<_z_top>-#<_z_bot>]*360] + o117 else + # = 0 + o117 endif + o103 if [#] + G3 X[#2+COS[#]*#] Y[#3+SIN[#]*#] I[#2] J[#3] Z[#<_z_bot>] + G3 X[#2+COS[#]*#] Y[#3+SIN[#]*#] I[#2] J[#3] Z[#<_z_bot>] + o103 else + G2 X[#2+COS[#]*#] Y[#3-SIN[#]*#] I[#2] J[#3] Z[#<_z_bot>] + G2 X[#2+COS[#]*#] Y[#3-SIN[#]*#] I[#2] J[#3] Z[#<_z_bot>] + o103 endif + + o100 elseif [#] + G0 Z# + G0 X[#2] Y[#3] + G0 Z[#<_z_top>] + G1 Z[#<_z_bot>] + o100 endif + + ; spiral outward + # = # + # = # + # = 0 + o105 while [# LT [[#4-#]/2-ABS[#5]]] + o106 if [#] + G1 X[#2+COS[#]*#] Y[#3+SIN[#]*#] + o106 else + G1 X[#2+COS[#]*#] Y[#3-SIN[#]*#] + o106 endif + # = [#+1] + # = [#+[#-#]/360*#] + # = [#+1] + o109 if [# GT 360000] + o105 BREAK ; safety limit + o109 endif + o105 endwhile + + ; pre-finish circle + # = [[#4-#]/2-ABS[#5]] + o107 if [#] + G1 X[#2+COS[#]*#] Y[#3+SIN[#]*#] + G3 X[#2+COS[#]*#] Y[#3+SIN[#]*#] I[#2] J[#3] + o107 else + G1 X[#2+COS[#]*#] Y[#3-SIN[#]*#] + G2 X[#2+COS[#]*#] Y[#3-SIN[#]*#] I[#2] J[#3] + o107 endif + + ; finish cut + o104 if [ABS[#5] GT 0.0] + # = [[#4-#]/2] + o108 if [#] + G1 X[#2+COS[#]*#] Y[#3+SIN[#]*#] + G3 X[#2+COS[#]*#] Y[#3+SIN[#]*#] I[#2] J[#3] + # = [[#4-#]/2*0.9] + G1 X[#2+COS[#]*#] Y[#3+SIN[#]*#] + o108 else + G1 X[#2+COS[#]*#] Y[#3-SIN[#]*#] + G2 X[#2+COS[#]*#] Y[#3-SIN[#]*#] I[#2] J[#3] + # = [[#4-#]/2*0.9] + G1 X[#2+COS[#]*#] Y[#3-SIN[#]*#] + o108 endif + o104 endif + + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/pocket_rect.ngc b/nc_files/subs/pocket_rect.ngc new file mode 100644 index 0000000..e101161 --- /dev/null +++ b/nc_files/subs/pocket_rect.ngc @@ -0,0 +1,171 @@ +; pocket_rect - rectangular pocket, zigzag along the long axis. +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +; Optional globals: #<_z_clearance>, #<_stepover>, #<_rampang> +o sub + ; o call [mode] [x1][y1] [x2][y2] [fincut] + ; #1=mode #2=x1 #3=y1 #4=x2 #5=y2 #6=fincut + + # = [FIX[#1/4] MOD 2 EQ 1] + # = [FIX[#1/4] MOD 2 EQ 0] + + G90 + G90.1 + M101 + G17 + + # = #5410 + # = [#/2] + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + o2 if [EXISTS[#<_stepover>]] + # = #<_stepover> + o2 else + # = [#*0.4] + o2 endif + o3 if [EXISTS[#<_rampang>]] + # = #<_rampang> + o3 else + # = 5 + o3 endif + + ; sort coords + # = #2 + # = #4 + o11 if [#4 LT #2] + # = #4 + # = #2 + o11 endif + # = #3 + # = #5 + o12 if [#5 LT #3] + # = #5 + # = #3 + o12 endif + + # = #6 + o13 if [# LT 0] + # = [0 - #] + o13 endif + + # = [# + # + #] + # = [# - # - #] + # = [# + # + #] + # = [# - # - #] + + # = [# - #] + # = [# - #] + + o14 if [[# LE 0] OR [# LE 0]] + o15 return + o14 endif + + G0 Z# + + o20 if [# GE #] + G0 X# Y# + G0 Z#<_z_top> + o21 if [#] + # = [#*0.3] + o22 if [[2*#] GT #] + # = [#/2 - 0.001] + o22 endif + # = [#*2*3.14*TAN[#]] + o25 if [# LT 0.0001] + # = 0.0001 + o25 endif + G0 X[#+2*#] Y# + # = [#<_z_top>-#] + o23 while [# GT #<_z_bot>] + G3 X[#+2*#] Y# I[-#] J0 Z# + # = [# - #] + o23 endwhile + G3 X[#+2*#] Y# I[-#] J0 Z#<_z_bot> + G1 X# + o21 else + G1 Z#<_z_bot> + o21 endif + + # = # + # = # + # = # + o30 while [1] + G1 X# Y# + # = [# + #] + o31 if [# GE #] + # = # + G1 Y# + # = # + # = # + # = # + G1 X# + o30 BREAK + o31 endif + G1 Y# + # = # + # = # + # = # + # = # + o30 endwhile + + o20 else + G0 X# Y# + G0 Z#<_z_top> + o41 if [#] + # = [#*0.3] + o42 if [[2*#] GT #] + # = [#/2 - 0.001] + o42 endif + # = [#*2*3.14*TAN[#]] + o45 if [# LT 0.0001] + # = 0.0001 + o45 endif + G0 X# Y[#+2*#] + # = [#<_z_top>-#] + o43 while [# GT #<_z_bot>] + G3 X# Y[#+2*#] I0 J[-#] Z# + # = [# - #] + o43 endwhile + G3 X# Y[#+2*#] I0 J[-#] Z#<_z_bot> + G1 Y# + o41 else + G1 Z#<_z_bot> + o41 endif + + # = # + # = # + # = # + o50 while [1] + G1 Y# X# + # = [# + #] + o51 if [# GE #] + # = # + G1 X# + # = # + # = # + # = # + G1 Y# + o50 BREAK + o51 endif + G1 X# + # = # + # = # + # = # + # = # + o50 endwhile + o20 endif + + G1 X# Y# + G1 X# Y# + G1 X# Y# + G1 X# Y# + G1 X# Y# + + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/poly_frame.ngc b/nc_files/subs/poly_frame.ngc new file mode 100644 index 0000000..2a29baa --- /dev/null +++ b/nc_files/subs/poly_frame.ngc @@ -0,0 +1,63 @@ +; poly_frame - perimeter cut of a regular polygon. +; apothem = flat-to-flat distance / 2 (center to midpoint of edge). +; rotation in degrees: 0 places first vertex on +X axis, CCW positive. +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +; Optional global: #<_z_clearance> +o sub + ; o call [mode] [x][y] [n_sides] [apothem] [rotation] [fincut] + ; #1=mode #2=x #3=y #4=n_sides #5=apothem #6=rotation #7=fincut + + # = [FIX[#1/1] MOD 2 EQ 1] + # = [FIX[#1/8] MOD 2 EQ 1] + # = [FIX[#1/1] MOD 2 EQ 0] + # = [FIX[#1/8] MOD 2 EQ 0] + + G90 + G90.1 + M101 + G17 + + # = #5410 + # = [#/2] + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + + o10 if [#] + # = [#5 - # - #7] + o10 else + # = [#5 + # + #7] + o10 endif + + # = [# / COS[180/#4]] + # = [360/#4] + + o11 if [[# AND #] OR [# AND #]] + # = 1 + o11 else + # = -1 + o11 endif + + G0 Z# + + # = [#2 + #*COS[#6]] + # = [#3 + #*SIN[#6]] + G0 X# Y# + G0 Z#<_z_top> + G1 Z#<_z_bot> + + # = 1 + o20 while [# LE #4] + # = [#6 + #*#*#] + G1 X[#2 + #*COS[#]] Y[#3 + #*SIN[#]] + # = [# + 1] + o20 endwhile + + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/poly_pocket.ngc b/nc_files/subs/poly_pocket.ngc new file mode 100644 index 0000000..110a170 --- /dev/null +++ b/nc_files/subs/poly_pocket.ngc @@ -0,0 +1,82 @@ +; poly_pocket - filled polygon pocket, concentric outward from center. +; apothem = flat-to-flat distance / 2 (center to midpoint of edge). +; rotation in degrees: 0 places first vertex on +X axis, CCW positive. +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +; Optional globals: #<_z_clearance>, #<_stepover> +o sub + ; o call [mode] [x][y] [n_sides] [apothem] [rotation] [fincut] + ; #1=mode #2=x #3=y #4=n_sides #5=apothem #6=rotation #7=fincut + + # = [FIX[#1/1] MOD 2 EQ 1] + # = [FIX[#1/1] MOD 2 EQ 0] + + G90 + G90.1 + M101 + G17 + + # = #5410 + # = [#/2] + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + o2 if [EXISTS[#<_stepover>]] + # = #<_stepover> + o2 else + # = [#*0.4] + o2 endif + + # = #7 + o13 if [# LT 0] + # = [0 - #] + o13 endif + + # = [#5 - # - #] + # = [360/#4] + + o14 if [# LE 0] + o15 return + o14 endif + + o16 if [#] + # = 1 + o16 else + # = -1 + o16 endif + + G0 Z# + G0 X#2 Y#3 + G0 Z#<_z_top> + G1 Z#<_z_bot> + + # = # + o30 while [# LT #] + # = [# / COS[180/#4]] + G1 X[#2 + #*COS[#6]] Y[#3 + #*SIN[#6]] + # = 1 + o31 while [# LE #4] + # = [#6 + #*#*#] + G1 X[#2 + #*COS[#]] Y[#3 + #*SIN[#]] + # = [# + 1] + o31 endwhile + # = [# + #] + o30 endwhile + + ; final pass at max_apothem + # = [# / COS[180/#4]] + G1 X[#2 + #*COS[#6]] Y[#3 + #*SIN[#6]] + # = 1 + o40 while [# LE #4] + # = [#6 + #*#*#] + G1 X[#2 + #*COS[#]] Y[#3 + #*SIN[#]] + # = [# + 1] + o40 endwhile + + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/slot.ngc b/nc_files/subs/slot.ngc new file mode 100644 index 0000000..e03a220 --- /dev/null +++ b/nc_files/subs/slot.ngc @@ -0,0 +1,73 @@ +; slot - slot/obround cut between two points (x1,y1) and (x2,y2). +; Requires globals: #<_z_top>, #<_z_bot> +; Requires tool loaded (uses #5410 for diameter) +; Optional global: #<_z_clearance> +o sub + ; o call [mode] [x1][y1] [x2][y2] [width] [fincut] + ; #1=mode #2=x1 #3=y1 #4=x2 #5=y2 #6=width #7=fincut + + # = [FIX[#1/1] MOD 2 EQ 1] + # = [FIX[#1/1] MOD 2 EQ 0] + + G90 + G90.1 + M101 + G17 + + # = #5410 + # = [#/2] + o1 if [EXISTS[#<_z_clearance>]] + # = #<_z_clearance> + o1 else + # = #<_z_top> + o1 endif + + # = [ATAN[#5-#3]/[#4-#2]] + + G0 Z# + G0 X#2 Y#3 + G0 Z#<_z_top> + G1 Z#<_z_bot> + G1 X#4 Y#5 + + # = [[#6-#5410]/2] + + o100 if [#] + o101 if [#7 GT 0] + G1 X[#4 +[SIN[#]*[#-#7]]] Y[#5 -[COS[#]*[#-#7]]] + G3 X[#4 -[SIN[#]*[#-#7]]] Y[#5 +[COS[#]*[#-#7]]] I#4 J#5 + G1 X[#2 -[SIN[#]*[#-#7]]] Y[#3 +[COS[#]*[#-#7]]] + G3 X[#2 +[SIN[#]*[#-#7]]] Y[#3 -[COS[#]*[#-#7]]] I#2 J#3 + G1 X[#4 +[SIN[#]*[#-#7]]] Y[#5 -[COS[#]*[#-#7]]] + o101 endif + + G1 X[#4 +[SIN[#]*[#]]] Y[#5 -[COS[#]*[#]]] + G3 X[#4 -[SIN[#]*[#]]] Y[#5 +[COS[#]*[#]]] I#4 J#5 + G1 X[#2 -[SIN[#]*[#]]] Y[#3 +[COS[#]*[#]]] + G3 X[#2 +[SIN[#]*[#]]] Y[#3 -[COS[#]*[#]]] I#2 J#3 + G1 X[#4 +[SIN[#]*[#]]] Y[#5 -[COS[#]*[#]]] + + G0 X#4 Y#5 + G0 Z#<_z_top> + o100 else + o102 if [#7 GT 0] + G1 X[#4 -[SIN[#]*[#-#7]]] Y[#5 +[COS[#]*[#-#7]]] + G2 X[#4 +[SIN[#]*[#-#7]]] Y[#5 -[COS[#]*[#-#7]]] I#4 J#5 + G1 X[#2 +[SIN[#]*[#-#7]]] Y[#3 -[COS[#]*[#-#7]]] + G2 X[#2 -[SIN[#]*[#-#7]]] Y[#3 +[COS[#]*[#-#7]]] I#2 J#3 + G1 X[#4 -[SIN[#]*[#-#7]]] Y[#5 +[COS[#]*[#-#7]]] + o102 endif + + G1 X[#4 -[SIN[#]*[#]]] Y[#5 +[COS[#]*[#]]] + G2 X[#4 +[SIN[#]*[#]]] Y[#5 -[COS[#]*[#]]] I#4 J#5 + G1 X[#2 +[SIN[#]*[#]]] Y[#3 -[COS[#]*[#]]] + G2 X[#2 -[SIN[#]*[#]]] Y[#3 +[COS[#]*[#]]] I#2 J#3 + G1 X[#4 -[SIN[#]*[#]]] Y[#5 +[COS[#]*[#]]] + o100 endif + + G0 X#4 Y#5 + G0 Z# + +o endsub + +M2 diff --git a/nc_files/subs/z_home.ngc b/nc_files/subs/z_home.ngc new file mode 100644 index 0000000..c8009da --- /dev/null +++ b/nc_files/subs/z_home.ngc @@ -0,0 +1,8 @@ +; z_home - rapid Z to machine zero (quill fully up). +; Uses G53 to bypass all offsets (work, tool, G92). +; Safe to call any time. No arguments. +o sub + G53 G0 Z0 +o endsub + +M2 diff --git a/readme.md b/readme.md index a8ea0e1..c551e5a 100755 --- a/readme.md +++ b/readme.md @@ -1,24 +1,26 @@ +# Lagun Mill - LinuxCNC +## Docs -# TODO -- [ ] understand offsets better -- [ ] understand toolchange better -- [ ] pendant buttons +- [nc_files/MACROS.md](nc_files/MACROS.md) — macro subroutine reference (drill, pocket, frame, slot, bore, polygon) +- [nc_files/OFFSETS.md](nc_files/OFFSETS.md) — quick reference for work offsets, tool offsets, cutter comp +- [nc_files/TOOLS.md](nc_files/TOOLS.md) — deep-dive on tool changes, G10, G41/G42, GMOCCAPY interface +- [configs/lagun_gmoccapy/README.md](configs/lagun_gmoccapy/README.md) — machine config, wiring, HAL, pendant mapping + +## Hardware TODO +- [ ] pendant buttons (wire ESTOP/START/STOP on GPIO 029/030/031) - [ ] holders for wrenches etc - [ ] permanent good fix for z axis bracket -# CAM options? -https://www.scorchworks.com/Fengrave/fengrave.html -https://www.estlcam.de/ -https://www.grzsoftware.com/ +## Software TODO +- [x] Use `#5410` (tool diameter from table) instead of `#<_td>` global +- [x] Reorder macro args to put mode argument first +- [x] Fix macro bugs (iteration limits, division guards, frame_circ lead-in clamp) +- [x] `o` macro: rapids to machine Z=0 via `G53 G0 Z0` +- [NOT HAPPENNING] Set up auto tool measurement (tool setter probe + M6 remap) +- [NOT HAPPENNING] Auto-start LinuxCNC on boot (dwm + startx — see [config README](configs/lagun_gmoccapy/README.md#auto-start-setup)) -# CLAUDE todos -1. check out the macros in nc_files - A. Read and understand them - B. Generate a better MACROS.md - C. Comment the code (do not change/fix anything, just add terse comments, especially at the beginning of macros) - D. Search for bugs in the macros and add them to this document -2. document and understand the lagun_gmoccapy config (this is the only active/relevant config) - A. Read and understand it - B. Generate better comments (do not change anything functionally, just add comments) - C. Generate a README.md \ No newline at end of file +## CAM options +- https://www.scorchworks.com/Fengrave/fengrave.html +- https://www.estlcam.de/ +- https://www.grzsoftware.com/