|
#=============================================================" R- m t6 E' |1 ?
proc PB_CMD_Zmax_Zmin_start_of_program { } {
1 X% e G# \% L! O2 } #=============================================================
: v) _/ Q1 _, t #8 I* \" r: W6 L1 w
# This custom command may be used to check for the maximum
0 H+ x; ]% J* x% b # travel for each axis. A warning will be output for each
( J- {, L% v; F" N # GOTO that exceeds the limits. It does not check for0 E# M! c' {. B
# parallel axis such as Z and W. It does not account for
8 u$ X0 d+ Z- G; s1 r! ], ~ # any modifications done by the user to mom_pos before the# g# E1 D( F3 b0 j% \$ r. z% M
# coordinates are output.+ T M {/ Y' }
#
" s. d2 m t) Y2 e9 m4 r #
3 i+ r; Q; c" _! {- ^: N. E$ g4 {' E # Import and call this command in PB_CMD_before_motion.
9 ~0 }& z$ z6 R #
0 l+ R0 K7 l" Q+ v #
. t# Y, g) f; J global mom_sys_max_travel9 T, x% h$ k! o& c
global mom_sys_min_travel
5 R: N- y6 r/ J. U( r! O( J7 p global mom_kin_x_axis_limit. o r% v, b3 b! \" _
global mom_kin_y_axis_limit
" v- W! t! h+ M; J9 @* T" b" U global mom_kin_z_axis_limit% B: ^* @! k, P6 u
global mom_pos
$ O. M2 A- @0 [0 x$ e5 T: ]! E global mom_cycle_rapid_to_pos
/ A" d7 c" k A7 v global mom_cycle_feed_to_pos
. c9 x" ^: _. P2 k2 R. B global mom_cycle_retract_to_pos
" ?) c$ p0 X* L% J global mom_motion_type
% f( j* L6 }9 \9 q" a4 P global mom_warning_info5 Z! s. d7 u Q3 h/ B% U
% D4 T* J1 e7 S. x4 c
if {![info exists mom_sys_max_travel]} {
8 P- l0 V2 n( ^& A$ O2 o; U- E# r V* ]
for {set i 0} {$i < 3} {incr i} {( v4 a& G; J1 W# f. F9 u6 {2 w0 o
% c* U H% k. p/ [
set mom_sys_max_travel($i) $mom_pos($i)7 m5 D, M( v; P# t8 C5 {
set mom_sys_min_travel($i) $mom_pos($i), i" G0 A Z Q( Q
}
; s6 r! a* f% G
: R5 d+ |5 T) U( t# O* {& l* n } elseif { ![string compare "CYCLE" $mom_motion_type] } {+ S" W! b7 R5 G1 Q
, ]9 T9 V/ K- F
for {set i 0} {$i < 3} {incr i} {7 g; M; [; F7 ^3 i) Y" Z/ T6 v7 q
: L0 u. H/ C, ? if {$mom_cycle_rapid_to_pos($i) < $mom_sys_min_travel($i)} {
# l R% ^4 p! p! K C0 U5 i$ ~ set mom_sys_min_travel($i) $mom_cycle_rapid_to_pos($i)
" C: M" r9 I- S4 w0 W3 X }
, r; Z2 Q7 I5 P. P* T: A if {$mom_cycle_rapid_to_pos($i) > $mom_sys_max_travel($i)} {% P7 ~4 t8 Q1 B" g
set mom_sys_max_travel($i) $mom_cycle_rapid_to_pos($i)
7 `% Q& R! d- e2 ~6 F }
% o1 p/ ^ J" D% ^4 K: o! u/ c if {$mom_cycle_feed_to_pos($i) < $mom_sys_min_travel($i)} {8 @, }1 e# u3 i8 }/ F
set mom_sys_min_travel($i) $mom_cycle_feed_to_pos($i) h% ?( g" W4 P
}$ b2 c, s8 Z6 `
if {$mom_cycle_feed_to_pos($i) > $mom_sys_max_travel($i)} {
, t$ |* z9 ~' m9 p7 ~) M" } set mom_sys_max_travel($i) $mom_cycle_feed_to_pos($i)
: A/ T6 P1 U7 x5 ?) Y3 ~9 k }$ n8 C+ g$ |# Q, q' m
if {$mom_cycle_retract_to_pos($i) < $mom_sys_min_travel($i)} {
2 S9 Z( E* b; f- ? set mom_sys_min_travel($i) $mom_cycle_retract_to_pos($i)5 p6 {/ f* v9 ]3 {: B' `2 s4 A
}
/ b! r$ C! _& y9 ] if {$mom_cycle_retract_to_pos($i) > $mom_sys_max_travel($i)} {: e- ^2 H5 l0 h$ A+ ^; u6 [* Z
set mom_sys_max_travel($i) $mom_cycle_retract_to_pos($i)
: ^: O8 H; N' @8 R. W9 a }
; G, o) `/ ?" Y5 D7 o8 g4 f m }6 p% ^$ T6 ~$ }2 o" w3 E
" C6 z0 P. H0 P8 u3 `
} else {$ e( i. @, _$ ]: f% Y
& w$ m, w9 X* z: U8 T. R# t for {set i 0} {$i < 3} {incr i} {
! U1 e9 w2 r5 T; t8 e: B if {$mom_pos($i) < $mom_sys_min_travel($i)} {; h8 V9 N3 { |4 U" b
set mom_sys_min_travel($i) $mom_pos($i)0 f0 ?/ ?/ }* d! p* I2 F( h, @4 h2 O
}. t4 `9 B4 \* M' O4 U
if {$mom_pos($i) > $mom_sys_max_travel($i)} {# O$ }8 A3 C$ U5 {
set mom_sys_max_travel($i) $mom_pos($i)4 k3 R6 u- }9 G% i) \
}
6 P; Z6 N$ t. @- w2 m: `; O9 ^ }
7 E* J9 [. g( X+ h/ F }
# J: s$ H+ C8 u
7 j; s. }) T, a6 W# Y' V if {[expr $mom_sys_max_travel(0) - $mom_sys_min_travel(0)] > $mom_kin_x_axis_limit} {3 k% N$ p& d+ ?9 z5 k( U
set mom_warning_info "Maximum X axis travel exceeded, did not alter output"5 I" O8 D8 c+ g% c
MOM_catch_warning
1 i! w5 ]3 ^) R8 D }
5 [3 t9 }$ \7 [2 ?! z6 f* u9 S5 l( I" y
if {[expr $mom_sys_max_travel(1) - $mom_sys_min_travel(1)] > $mom_kin_y_axis_limit} {
" ^) [5 w5 d2 p: y5 i3 o1 U/ U set mom_warning_info "Maximum Y axis travel exceeded, did not alter output"
4 h( }/ n2 P# Q& n# Q7 r! h; Y MOM_catch_warning
: q+ f+ x; _$ w z3 T }
O) F. U) u1 ^ n) m# Y. ~ Z$ P8 b' Q2 A: p$ A
if {[expr $mom_sys_max_travel(2) - $mom_sys_min_travel(2)] > $mom_kin_z_axis_limit} {
& D$ X- X8 t# J1 A$ w set mom_warning_info "Maximum Z axis travel exceeded, did not alter output"
$ o2 q" F1 }; D- R( ~, h6 P Z, w MOM_catch_warning
0 V% R4 a6 X7 r9 o }; @6 J e" ~3 `7 J% o
}
; o5 V2 f* ^" v: M
" L% E6 i1 p6 ^ `
+ @) l( f1 S. i |
|