|
#=============================================================# W. u( ^9 K, z3 {4 T
proc PB_CMD_Zmax_Zmin_start_of_program { } {
" N& M# N6 d/ k$ j) d% T #=============================================================; X6 U( F& R7 g
#6 r$ p' z3 s% c; G& q
# This custom command may be used to check for the maximum
; w# p6 b6 M" y" Q' u5 @. | # travel for each axis. A warning will be output for each
7 Z* ~0 R, X+ a- J5 A7 R' e5 z # GOTO that exceeds the limits. It does not check for( o! Y% @/ L" T0 P! G, r% E
# parallel axis such as Z and W. It does not account for
2 c$ S8 h6 b, K, k2 P# i; e! K& [ # any modifications done by the user to mom_pos before the. K0 e3 F. c, x6 ^
# coordinates are output.
" {: e( y" Z3 d# J3 |4 Q #; M+ S9 h: I( W; N6 A/ f, C& U
#6 l& S( h! L& d8 I* p6 L! y4 F* l
# Import and call this command in PB_CMD_before_motion.3 p' j; c! |- ^
#* k+ q2 a6 @5 N- U
#& u9 Y4 j5 O% h/ r, G2 c
global mom_sys_max_travel( x6 L# ]9 r8 M3 J7 b, I
global mom_sys_min_travel2 J' x1 v( q/ j+ J- h$ S
global mom_kin_x_axis_limit i) g/ f* \0 n% E
global mom_kin_y_axis_limit
+ u! w' _: a* S. t global mom_kin_z_axis_limit
* A4 M4 r* n* T! l global mom_pos
7 ?$ `1 F* ^& b4 E" [ global mom_cycle_rapid_to_pos4 t/ U1 j, o; L$ ]2 }
global mom_cycle_feed_to_pos. G+ i) F' _- i8 C# f# Q
global mom_cycle_retract_to_pos3 L# K( j5 O- \! r
global mom_motion_type
. x4 g& G, \7 O' j4 l global mom_warning_info
* H {" R9 I& X# n3 m
/ \# c" g+ Q; q( O6 l# Y if {![info exists mom_sys_max_travel]} {
; P! Y3 N( ~% y' o* W- M# R6 ?4 _) e9 m
for {set i 0} {$i < 3} {incr i} {- V0 T( y- l) s5 k& W0 L! R
J3 k2 a/ g4 m8 M) l! g$ i, y F
set mom_sys_max_travel($i) $mom_pos($i)7 M; ]2 X$ D' B/ i4 ?; a
set mom_sys_min_travel($i) $mom_pos($i)1 Q: ~" U w! B1 R/ X0 N) l
}- F! x! K+ }1 h u8 n+ t3 @! q
4 i$ C/ ^' j/ _# {
} elseif { ![string compare "CYCLE" $mom_motion_type] } {
' x$ B. o, Y7 C0 ]! d# |/ H( a5 R5 |% K
for {set i 0} {$i < 3} {incr i} {9 y. J- e) r4 n9 b' s# `+ ^7 D7 z
6 K3 r: I" o* h) V* ]# W5 A if {$mom_cycle_rapid_to_pos($i) < $mom_sys_min_travel($i)} {
1 r% d2 [/ q7 i6 y+ o$ n' e set mom_sys_min_travel($i) $mom_cycle_rapid_to_pos($i)
% y U, ]/ V* Q! l) l2 S }, v. D: t+ B$ s& _8 P/ r9 h
if {$mom_cycle_rapid_to_pos($i) > $mom_sys_max_travel($i)} {: L1 k/ C- S* M) E: t" D/ u! Q
set mom_sys_max_travel($i) $mom_cycle_rapid_to_pos($i)
' |( L* i' j0 Q( S+ x6 i }6 {+ ]% y. n# ]; L2 k& m6 _! ~, e2 r
if {$mom_cycle_feed_to_pos($i) < $mom_sys_min_travel($i)} {$ I2 n! f: U: E+ J3 ]6 u0 o
set mom_sys_min_travel($i) $mom_cycle_feed_to_pos($i)
. z6 o: e! E/ f) D9 Y: S5 j }% N0 h4 L9 _" f) G% x( p; j/ L
if {$mom_cycle_feed_to_pos($i) > $mom_sys_max_travel($i)} {2 k# O! d) k8 m0 O1 j+ o! D" u
set mom_sys_max_travel($i) $mom_cycle_feed_to_pos($i)
0 N8 d6 E$ U+ N }$ L; a2 D$ T1 ?+ u" K8 i
if {$mom_cycle_retract_to_pos($i) < $mom_sys_min_travel($i)} {
/ e# J# U3 x& E0 i set mom_sys_min_travel($i) $mom_cycle_retract_to_pos($i)
7 J- h, c2 R6 W$ d' x }4 A- y; ?7 X* H' k) W# M
if {$mom_cycle_retract_to_pos($i) > $mom_sys_max_travel($i)} {3 D' G) O8 C! T8 t
set mom_sys_max_travel($i) $mom_cycle_retract_to_pos($i)* y: }- [* `0 ?3 L
}7 c1 u/ W; x4 ^, I3 G
}/ ?% {/ t; u3 x7 }( I
+ F8 F/ G8 y+ ^& O o8 ?4 ?' D
} else {
) F5 v& ~+ I" m0 M8 }+ u* V0 _
* j- j! b& k4 K* i4 |+ C# V( H" b9 x N for {set i 0} {$i < 3} {incr i} {, s; e a2 A* P7 h8 P
if {$mom_pos($i) < $mom_sys_min_travel($i)} {
. f& S" R- L! w- G5 R0 e set mom_sys_min_travel($i) $mom_pos($i)
( |, J) z2 P+ C5 o* F# ` }
0 ?) B$ v" s, r1 q0 N! ^! i) F if {$mom_pos($i) > $mom_sys_max_travel($i)} {
! M6 }4 j b$ K' Z$ G set mom_sys_max_travel($i) $mom_pos($i)
" G( J3 Z# n, X9 E- J t* @' g+ Y( K }
5 x2 m E( D7 s/ H4 j }: J" b$ J5 E7 S5 p e
}; V9 u4 `5 d- c# _0 `/ e7 ~& r
5 C1 H% H8 V9 G
if {[expr $mom_sys_max_travel(0) - $mom_sys_min_travel(0)] > $mom_kin_x_axis_limit} {
* H2 b; u5 N6 [4 |1 K$ Z set mom_warning_info "Maximum X axis travel exceeded, did not alter output"/ o/ }0 ~% n# H; \3 X
MOM_catch_warning
. B4 e* a' A8 q, b4 G }6 f6 W5 k9 Y( x! H7 @" j E
3 ?$ P7 @( Z* @" D- B. }* [! R/ N7 V if {[expr $mom_sys_max_travel(1) - $mom_sys_min_travel(1)] > $mom_kin_y_axis_limit} {: Q, }# u- v' X' [# c8 Q+ b* v7 |# j
set mom_warning_info "Maximum Y axis travel exceeded, did not alter output"
3 n: l$ ~" o8 G) C# C. z MOM_catch_warning# d: H" S' e1 b' z4 V; \4 t+ E7 u
}2 f5 Y @; c9 i; i9 A3 K! Y0 w% x
1 L: s" ?2 j/ T; L
if {[expr $mom_sys_max_travel(2) - $mom_sys_min_travel(2)] > $mom_kin_z_axis_limit} {
2 n: q2 Q. ?# b' \8 h& W" ~4 ~& B9 x set mom_warning_info "Maximum Z axis travel exceeded, did not alter output"
( p& ?* m4 K+ \/ | MOM_catch_warning
) n. E6 q* a3 ?" v; J/ g }% b0 u# V; l9 ~0 L
}
8 D4 y: q' ]) s, L" }& S' F) |, Q- B- d" M0 U
4 Q. E# ^# b# L1 b; Z1 @9 W
|
|