|
#=============================================================
) J1 I4 R3 C A: N proc PB_CMD_Zmax_Zmin_start_of_program { } {
7 K/ V2 E2 X9 V; O #=============================================================
& B# E/ v5 m4 r" f/ ~ #
% K7 m! S8 v# S1 x # This custom command may be used to check for the maximum
0 v6 d6 y1 {6 X, z* _ # travel for each axis. A warning will be output for each
* V8 u1 C H1 F6 R0 W6 v # GOTO that exceeds the limits. It does not check for
* `4 X% J) c/ u2 X+ f! z. B! B' B # parallel axis such as Z and W. It does not account for
0 a, X; L8 A1 N% X # any modifications done by the user to mom_pos before the8 k* e% D$ y( E' g
# coordinates are output.1 f+ ^' N: ? @- @! f0 J" Y! q1 X
#
5 K2 N7 e: ]+ f, S9 w #' u: j. g8 ^; C' _6 Z
# Import and call this command in PB_CMD_before_motion.
: m! y% w! Z; J) L: h: R #
' o- N9 a; |. _! m" {9 F1 ~3 p" @ #
& K N7 a4 b' ^5 \' {% H3 @ global mom_sys_max_travel
i% S5 n) ]+ z7 p* b4 V global mom_sys_min_travel3 c6 X5 u6 }" S3 E
global mom_kin_x_axis_limit
6 {. _/ b% H! g Y: C global mom_kin_y_axis_limit/ D* z8 V2 E D
global mom_kin_z_axis_limit- ?) I% x) r. Q( g- ^) Y# d
global mom_pos1 \! r0 e3 m4 l. l: @4 G
global mom_cycle_rapid_to_pos+ S0 }0 E$ J/ c! \5 T4 |
global mom_cycle_feed_to_pos* L" o# t. H/ r9 J. o* a9 ?
global mom_cycle_retract_to_pos& `1 S# ]+ T$ I. F2 C ~! @
global mom_motion_type2 q6 `9 m7 a- l$ g) |. u
global mom_warning_info# j; V \7 g) s/ p
; E- }5 \( u7 `( a" y' c! P if {![info exists mom_sys_max_travel]} {% h) ]# [+ p% d5 i" u
/ i- n$ D0 O( T8 V$ Y. Y0 k for {set i 0} {$i < 3} {incr i} {
: ? H$ I9 |& N' `/ x" P5 z6 W l) Y
set mom_sys_max_travel($i) $mom_pos($i)
; A; h, v4 p5 N* _& t8 K6 d set mom_sys_min_travel($i) $mom_pos($i)
% x" }# Q* i4 L9 U7 |% d6 o, O0 g }
& N/ a) D7 p$ @+ E% O! x4 C2 n) W( H1 E8 v3 o0 |7 ]3 P! j
} elseif { ![string compare "CYCLE" $mom_motion_type] } {* Z- p A# f/ q9 K6 Z4 M
( W9 j: T0 v4 z6 o# G$ ^- d
for {set i 0} {$i < 3} {incr i} {
) U4 i; e# O! `) @' y. }
& E; f0 l; m$ [ if {$mom_cycle_rapid_to_pos($i) < $mom_sys_min_travel($i)} {
* j1 h0 Y5 ~) f; r; @% T; I* H6 _- ] set mom_sys_min_travel($i) $mom_cycle_rapid_to_pos($i)
' O1 @1 ~" Q1 |# K# c4 G0 A' S3 [5 g }0 N! T7 H( q0 R* |
if {$mom_cycle_rapid_to_pos($i) > $mom_sys_max_travel($i)} {
, V8 e+ E R, P( X5 i2 m, p, P' g6 p$ L set mom_sys_max_travel($i) $mom_cycle_rapid_to_pos($i)
- Z" u7 }3 W% W X* M, { }
" s, X1 n, R3 s3 u6 H p if {$mom_cycle_feed_to_pos($i) < $mom_sys_min_travel($i)} {6 f+ K5 x% i0 [# M# [$ |
set mom_sys_min_travel($i) $mom_cycle_feed_to_pos($i)
$ |6 b, s# E- R3 }0 C }# K8 R% Z; s7 g0 t3 w. \$ }
if {$mom_cycle_feed_to_pos($i) > $mom_sys_max_travel($i)} {0 C9 |1 t6 f* o
set mom_sys_max_travel($i) $mom_cycle_feed_to_pos($i)
5 x3 j1 x, e: _9 r3 H3 ]$ f% a }
$ l3 h/ I. P# e3 m: {, Z if {$mom_cycle_retract_to_pos($i) < $mom_sys_min_travel($i)} {5 r( C" [& ~: b
set mom_sys_min_travel($i) $mom_cycle_retract_to_pos($i)& x9 ~# T$ i: d
}; M5 g" Z+ L1 ~5 D: T& w4 A/ a
if {$mom_cycle_retract_to_pos($i) > $mom_sys_max_travel($i)} {" {& O" G! q" I/ g9 J
set mom_sys_max_travel($i) $mom_cycle_retract_to_pos($i)0 O0 j8 _, g! a2 A2 {* S
}
. ]; U' \6 O: r. T$ |) @ }
9 }' }; E( \& X) n: P1 m! X8 H3 J2 B" \ E9 |" d
} else {
7 m: e. n. C. E& D( M8 E4 S" }+ i3 F; T0 q- f
for {set i 0} {$i < 3} {incr i} {
" o/ n9 F$ z' e( e9 Z if {$mom_pos($i) < $mom_sys_min_travel($i)} {5 r k& l& |4 P) p4 e+ l
set mom_sys_min_travel($i) $mom_pos($i)
9 U* B1 @3 X, n- a( K* L. y' B }; j+ d( b( A8 F d+ g7 [' p
if {$mom_pos($i) > $mom_sys_max_travel($i)} {
* V1 \) H3 N9 q$ V7 ~+ r8 K set mom_sys_max_travel($i) $mom_pos($i)
6 q* p3 s3 O( [1 n# W5 X; R }
4 k& h6 Y# D9 J5 b& ?" d: I }
* A. C+ h2 z5 Q: ]+ t }! n/ A$ @! t! m: \' |
2 Y- v( }+ I+ g9 r' J& ]/ v, A8 T if {[expr $mom_sys_max_travel(0) - $mom_sys_min_travel(0)] > $mom_kin_x_axis_limit} {
! L; {3 [5 V# h2 U6 N3 L set mom_warning_info "Maximum X axis travel exceeded, did not alter output"" p9 Z, M$ F4 Q( }
MOM_catch_warning
; i8 K0 B$ M' _2 l }, \/ o0 q" l: S( ?6 d0 W
9 W- W' n9 ?$ z# @/ @& ]
if {[expr $mom_sys_max_travel(1) - $mom_sys_min_travel(1)] > $mom_kin_y_axis_limit} {
, G0 j' S" R2 w/ C" b3 | set mom_warning_info "Maximum Y axis travel exceeded, did not alter output"
, q3 ^2 I `4 i; v MOM_catch_warning
0 \+ q- J6 N3 | }) h: [( a, V1 M2 a
9 P! | }/ s0 F' [: }# K7 e& S s
if {[expr $mom_sys_max_travel(2) - $mom_sys_min_travel(2)] > $mom_kin_z_axis_limit} {5 L D( H }- J4 w0 G) Q
set mom_warning_info "Maximum Z axis travel exceeded, did not alter output"8 U/ Z* r6 Q7 k
MOM_catch_warning
( s( b ?0 Q. w, X; x# D z }' G; @- o& }( f& ?+ G7 b( D
}
& l& V- H3 R/ p5 w$ Q/ A8 ~, s1 o6 I: Q/ h1 i9 o
. ~8 d! I. A y5 w+ V( f; F |
|