(inside quadrangle, vertex 1 should be largest) (computes direction for polygon cw or ccw and swaps indices if required) (ok for non-pathological 4 sided polygons including convex) (info: iquad: internal quadrilateral, four x,y points, cw/ccw dir, radius comp) o sub # = #1 (=1) # = #2 (=1) # = #3 (=2 2conv|3climb) # = #4 (=10) # = #5 (=.1) # = #6 (=.02) # = #7 (=0.2) # = #8 (=0) # = #9 # = #10 # = #11 # = #12 # = #13 # = #14 # = #15 # = #16 # = #17 (=1) # = #18 (=0) # = #19 (=0) # = #20 (=0) # = #21 (=0) # = #22 (=1) # = #23 (=0) # = #24 (=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, iquad: bad direction # - EXITING) (print, iquad: bad direction # - EXITING) (AXIS,notify, iquad: bad direction - EXITING) m2 o endif (compute direction eg cw,ccw for points as specified:) o call [4][#][#][#][#][#][#][#][#] # = #<_dir:> o if [# NE #] (print swap for pointsdir=# user:#) (swap 1234 --> 1432) # = # # = # # = # # = # # = # # = # o endif (apply scale, rotate, then offset to all input points) o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> o call [#][#][#][#][#][#] # = #<_move:x> # = #<_move:y> 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:cos> # = #<_line:sin> o call [#][#][#][#] # = #<_line:cos> # = #<_line:sin> (compute angles at line interesctions:) o call [#][#][#][#][#][#] # = #<_dot:ang> o call [#][#][#][#][#][#] # = #<_dot:ang> 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, iquad: too many passes - EXITING) (print, iquad: too many passes - EXITING) (AXIS,notify, iquad: too many passes - EXITING) m2 o endif o if [# EQ 1] (entry point:) (for acute angle: go along the 1-->2 line to enter) (at a point where tool will fit) # = [ # / [TAN[#/2]]] # = [# / #] (print entry 12 k=# elen12=# angle=#) # = [# + # * #] # = [# + # * #] (compute pre-entry points:) o if [# EQ 2] # = [# + # * # - # * #] # = [# - # * # - # * #] # = [# + # * #] # = [# + # * #] # = [ # * #] # = [ # * #] o else (dir EQ 3 CCW) # = [# - # * # - # * #] # = [# + # * # - # * #] # = [# + # * #] # = [# + # * #] # = [ # * #] # = [ # * #] o endif g0 x # y # (preentry 1) g0 x # y # (preentry 2) o if [# EQ 2] / g42 (cutter radius comp right of path) g2 x # y # i # j # (arc entry) o else (dir EQ 3 CCW) / g41 (cutter radius comp left of path) g3 x # y # i # j # (arc entry) o endif # = # # = # (rampdown finishes at point 2, to exit: need to turn corner at 2) (and go along the 2-->3 line enough to exit) # = [ # / [TAN[#/2]]] # = [# / #] (print exit 23 k=# elen23=# angle=#) (need a test here: if you go along 23 too far you gouge vertex 3) # = [# + # * #] # = [# + # * #] g1 z # (plunge to start height todo:g0) o endif x # y # z# (ramp down to zcurrent) x # y # x # y # x # y # # = [# + 1] o endwhile (print a= # # k=#) (print b= # #) g1 x # y # g1 x # y # g0 z # g40 o endsub