|
|
tcnt : 0 # Count the number of tool changes. @. C$ A% Q. s% K$ g4 h" u
output_z : yes #Output Z Min and Z Max values (yes or no)1 w1 T4 j3 B9 V5 i) w# E' s0 v
tool_table : 1 #Tool table, 0=no, 1=yes, 2=Predator VCNC, 3=MetaCut View) l! _7 |7 e# l |/ ~0 [
tooltable : 1 #Read for tool table and pwrtt - use tool_table to disable
; M! H+ Q! i9 E! z( f+ N- U# P9 J0 g& c3 V4 ^) Y* U9 S
# --------------------------------------------------------------------------
. l2 P" w7 L: b1 R& X- K# Buffer 3 - Holds the variable 'tlplnno' for each toolpath segment
+ \( ?& j: _3 O8 x# S5 a# --------------------------------------------------------------------------7 @7 W0 n, j: C
rc3 : 1
- M& V- U5 b9 @ A1 C9 a5 u' n v; _wc3 : 1
# I- v0 K$ u- w3 m) _' pfbuf 3 0 1 0 # Buffer 3 E( b7 n$ s1 m/ C
% C/ U+ J$ m5 q- F: T
# --------------------------------------------------------------------------
7 z- V( c9 `7 |6 ~; \# Buffer 4 - Holds the variable 't' for each toolpath segment3 ~# U) L. O7 D* ] ~! e% a
# -------------------------------------------------------------------------- m# G8 Z4 Y9 |8 i: {4 w
rc4 : 1
! H" q/ I) H4 M! R" @% Fwc4 : 18 b5 `& P& h$ y* y* s( ?2 g( ]7 U
fbuf 4 0 1 0 # Buffer 4
5 Y0 s# F" o4 q& z& X! \) x2 l/ L' G. F6 |7 B
# --------------------------------------------------------------------------5 O8 Q# p% x, k0 h
# Buffer 5 - Min / Max
3 q9 `$ }& A7 v0 E5 u! O# --------------------------------------------------------------------------
. |& Y6 R6 Y# n9 fb5_gcode : 00 i# Y$ O# |+ V2 }+ I+ W$ C" L
b5_zmin : 0
9 F- ]* o! D, i2 Pb5_zmax : 0
+ W0 C* B; H+ P8 h+ ^rc5 : 2
, C: q" [0 z1 O' V5 F" Z; awc5 : 1
! _" \: w% P$ h5 @3 k, Psize5 : 0
k- N* T7 Z7 w( S4 T8 e0 z% e: I! y% {3 b' ?. [* Z" {
fbuf 5 0 3 0 #Min / Max% Z; @! S! w, Z. L7 Q% {4 B# I
/ L4 G0 P6 W1 A
& c- a5 `( ~2 A+ v5 \9 xfmt X 2 x_tmin # Total x_min
4 Q2 ]$ ]0 ^! K3 s6 l* Y1 @fmt X 2 x_tmax # Total x_max$ b5 |& z' H( z0 b3 e# R
fmt Y 2 y_tmin # Total y_min& R" n; n& j" c1 v; \/ @$ P
fmt Y 2 y_tmax # Total y_max, G3 j( l$ E. b4 \' ^; q
fmt Z 2 z_tmin # Total z_min
+ c* S1 U4 T h& ~) rfmt Z 2 z_tmax # Total z_max9 D( B# B- u; c* ?
fmt Z 2 min_depth # Tool z_min* A0 i1 f% _& Y( [& P
fmt Z 2 max_depth # Tool z_max
1 a3 V& b( D& G4 E3 O
( _% c1 }( _$ K7 l; {
+ [9 b* M# g% ?- O4 C7 cpsof #Start of file for non-zero tool number# v- L( p0 H/ Q. o# }$ t6 b
ptravel
* v/ n( Z/ E5 `! M3 S$ g pwritbuf58 I5 p7 M' D( p/ T; z
! j9 Y7 m$ N8 I) V3 G
if output_z = yes & tcnt > 1,
& I2 f2 Q- }. ~ [" `( @$ d% ~2 N# W( I, p$ B
"(OVERALL MAX - ", *z_tmax, ")", e
6 [' H( J( b# q M3 i "(OVERALL MIN - ", *z_tmin, ")", e8 q% E: G! D9 i, V
]
0 i: }4 N) g) F" \
/ D% }5 Y. C- X3 P* I9 I# --------------------------------------------------------------------------
5 } P2 g% m' M8 D6 H+ _8 ]% n% h# Tooltable Output+ w* ?3 C( j6 t+ e# L" V
# --------------------------------------------------------------------------9 c+ _1 b0 q+ k J- A
pwrtt # Write tool table, scans entire file, null tools are negative
" P+ Q% @+ Q7 l' O7 \6 P t = wbuf(4,wc4) #Buffers out tool number values$ B# n$ U% J3 S7 o
if tool_table = 1, ptooltable( U# B' W* A- U, [+ m. @
if t >= zero, tcnt = tcnt + one ) e% u1 |1 {! R3 c
ptravel; g# f+ T9 d y
pwritbuf5% ~% H- f D8 z2 c/ T: b
7 t8 h/ ]- b, Z9 x: g9 ]. }ptooltable # Write tool table, scans entire file, null tools are negative
2 C( C6 e3 y" e, Q ? tnote = t
* `7 J, w: h3 l; y" U) G: s. c toffnote = tloffno
6 c5 I' ~. M+ S; x( }' _ tlngnote = tlngno
5 ~4 L }% r% ` r
. t# W' M9 F/ f$ \ z0 f4 o4 _ if t >= zero,
+ X. ]) P f% p- r: M [
7 [$ p. J) Z# o if tcr>0, "(", *t, " | ", plistcomm, " | ", *tlngno, " | ", *tloffno, " | ", *tldia, punit, " | ", *tcr, ")"
8 S1 C( [* r. ^5 _& B9 f# Q if tcr=0, "(", *t, " | ", plistcomm, " | ", *tlngno, " | ", *tloffno, " | ", *tldia, punit, ")"$ \& _4 h" {0 y: V2 k: H
]
5 O1 B% T0 {+ o- c1 i& s 4 g, B7 h( W* r
punit # Tool unit
- S: @: h5 `; K9 z8 _ a if met_tool, "mm"* a- Z9 T( X# y7 T2 R W5 y9 H9 F
else, 34; e# _% p5 k: Q, T9 M
+ G6 o5 t6 Y: K! h- ?
ptravel # Tool travel limit calculation. |5 I: N" ^* q+ r* ]
if x_min < x_tmin, x_tmin = x_min0 U( h, ~5 p9 z
if x_max > x_tmax, x_tmax = x_max6 c) }+ R _2 m' m
if y_min < y_tmin, y_tmin = y_min
1 c5 }. T. e1 n if y_max > y_tmax, y_tmax = y_max
( E' e8 W9 m: c+ Y9 L5 {0 `# W if z_min < z_tmin, z_tmin = z_min0 A' J( ~: _1 l5 f; v/ m5 c
if z_max > z_tmax, z_tmax = z_max
' o- d& C" i2 z7 H; [ # [7 f0 F* j6 B s+ U$ d/ M/ d$ ^7 _
# --------------------------------------------------------------------------
% G" d! Q- a+ {' ^! S# s# Buffer 5 Read / Write Routines4 Q" `) Y. R, T h- U$ S( O, U: z
# --------------------------------------------------------------------------. t' t' M+ ?0 N9 L5 N5 G
pwritbuf5 # Write Buffer 1: s& @! A3 J) O5 ~* q
b5_gcode = gcode, M& c4 @3 @: W2 D- Z! v1 D9 I
b5_zmin = z_min
5 B0 g0 C1 S) t/ } b5_zmax = z_max
* l, n, E& r- ~5 T2 D$ s8 b' J( F8 N b5_gcode = wbuf(5, wc5), ~! I3 t* [6 S1 l
; ~1 @$ P! A4 ~- v: k
preadbuf5 # Read Buffer 18 M. ~6 L; @% K4 x
size5 = rbuf(5,0)7 m; q& b3 _# J. [
b5_gcode = 1000/ [ Q& S6 t2 |" H- D- r
min_depth = 999994 t. B% ]/ z+ Y- w; {
max_depth = -99999! ~9 {% I+ d2 Z/ j+ K3 d4 S
while rc5 <= size5 & b5_gcode = 1000,& f7 F* `( l9 e- [. _+ r
[0 B- @- q* B/ e( B% J& K; d3 M) l! v
if rc5 <= size5, b5_gcode = rbuf(5,rc5)
0 w" K7 _6 C8 h2 D6 |& d" c if b5_zmin < min_depth, min_depth = b5_zmin
% c% E) b' `5 j+ B5 z. u6 T1 k5 P/ k if b5_zmax > max_depth, max_depth = b5_zmax
5 D) J6 M" r# w B* S- G$ c' a5 k ] |
|