(require: angle at intersection of p1-2 and p1-4 must be obtuse) (cw traverse: p1,p2,p3,p4) (ccw traverse: p1,p4,p3,p2) (info: ihex: internal hexagon, cw/ccw dir, radius compensation) o sub # = #1 (=1) # = #2 (=2000) # = #3 (=10) # = #4 (=2 2conv | 3climb) # = #5 (distance across flats) # = #6 # = #7 # = #8 (=0.2) # = #9 (=0) # = #10 (=1) # = #11 (=0) # = #12 (=0) # = #13 (=0) # = #14 (=0) # = #15 (=1) # = #16 (=0) # = #17 (=0) o if [# EQ 0] # = 1.0 (debug, scale was 0, setting #) o endif o call [#][#][#][#] # = [#5410 + .001] o if [[# NE 2] AND [# NE 3]] (debug, ihex: direction must be 2 or 3 - EXITING) (print, ihex: direction must be 2 or 3 - EXITING) (AXIS,notify, ihex: direction must be 2 or 3 - EXITING) m2 o endif # = [#/2] #

= [#/cos[30]] # = [#

* cos[60]] # = [#

* sin[60]] (p1 -> p2 -> is cw) (apply scale,rotate, then offset to all input points) # = #

# = 0 o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = # # = [0 - #] o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = [0 - #] # = [0 - #] o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = [0 - #

] # = 0 o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = [0 -# ] # = # o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = # # = # o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> # = [#/2] # = [0 - #] # = [0 - #] (get lengths and angles for connecting lines) o call [#][#][#][#] # = #<_line:phi> o call [#][#][#][#] # = #<_line:len> # = #<_line:phi> # = #<_line:cos> # = #<_line:sin> o call [#][#][#][#] # = #<_line:phi> o call [#][#][#][#] # = #<_line:len> # = #<_line:phi> # = #<_line:cos> # = #<_line:sin> g40 (cutter radius compensation off) f # s # m3 (spindle cw) o if [# GT 0] o call [#] o endif g0 z# # = # # = 1 o while [# GT #] # = [# + #] o if [# LT #] # = # o endif o if [# GT 100] (debug, ihex: too many passes - EXITING) (print, ihex: too many passes - EXITING) (AXIS,notify, ihex: too many passes - EXITING) m2 o endif o if [#

EQ 2] o if [# EQ 1] (arc entry along line1-2 where corner 1 is obtuse) # = [# + 1 * # * cos[#]] (entry) # = [# + 1 * # * sin[#]] # = [# + 2 * # * sin[#]] (preentry 1) # = [# - 2 * # * cos[#]] # = [# + # * cos[#]] (preentry 2) # = [# + # * sin[#]] # = [0 - # * sin[#]] (r vector) # = [0 + # * cos[#]] g0 x # y # (preentry 1) g0 x # y # (preentry 2) / g42 (cutter radius comp right of path) g2 x # y # i # j # (arc entry) # = [#] # = [#] (go along the 2-->3 line to exit) (angle between 1-->2 and 2-->3) (only necessary for acute angles) # = [180 + # - #] # = [# / ABS[TAN[#/2]]] # = [#/#] (print angle=# elen=# k=#) o if [# GE 1] (debug, ihex: can't get in final corner k=# - EXITING) (print, ihex: cant' get in final corner k=# - EXITING) (AXIS,notify, ihex: can't get in final corner - EXITING) m2 o endif # = [# + # * # * #] # = [# + # * # * #] g1 z # (plunge) o endif x # y # z# x # y # x # y # x # y # x # y # x # y # # = [# + 1] o else (dir EQ 3 CCW) o if [# EQ 1] (arc entry along line4-1 where corner 1 is obtuse) # = [# + 1 * # * cos[#]] (entry) # = [# + 1 * # * sin[#]] # = [# - 2 * # * sin[#]] (preentry 1) # = [# + 2 * # * cos[#]] # = [# + # * cos[#]] (preentry 2) # = [# + # * sin[#]] # = [0 + # * sin[#]] (r vector) # = [0 - # * cos[#]] g0 x # y # (preentry 1) g0 x # y # (preentry 2) / g41 (cutter radius comp left of path) g3 x # y # i # j # (arc entry) # = [#] # = [#] (go along the 4-->3 line to exit) (angle between 4-->3 and 1-->4) (only necessary for acute angles) # = [180 - # + #] # = [# / ABS[TAN[#/2]]] # = [#/#] o if [# GE 1] (debug, ihex: cant get in corner k=# - EXITING) (print, ihex: cant get in corner k=# - EXITING) (AXIS,notify, ihex: cant get in corner - EXITING) m2 o endif # = [# + 1.01* # * # * #] # = [# + 1.01* # * # * #] g1 z # (plunge) o endif x # y # z# x # y # x # y # x # y # x # y # x # y # # = [# + 1] o endif o endwhile g1 x # y # g1 x # y # g0 z # g40 o endsub