Hello:
I have a simple "shadow box" LISP routine that will function normally when invoked from my Custom User Interface (CUI) menu - but will not fuction when I create a tool for it in a Tool Palette. As you can see below, the routine is fairly simple . . . it saves the current layer (clayer); creates a custom layer for the shadow-box; draws the shadow-box with only two inputs; and restores the original layer.
(defun C:Shdw_Box (/ clayer ll ur ul lr tx pw ll2 lr2 ur2)
(setq clayer (getvar "CLAYER"))
(command "-LAYER" "M" "G-Symb-Shdw-Box" "C" "YELLOW" "" "LW" "0.35" "" "Lt" "Continuous" "" "")
(setq ll (getpoint "\nPick Lower-Left Corner: ")
ur (getpoint "\nPick Upper-Right Corner: ")
ul (list (car ll) (cadr ur))
lr (list (car ur) (cadr ll))
tx (getvar "TEXTSIZE") pw (/ tx 3.0) ll2 (list (+ (min (car ll) (car lr) (car ul) (car ur)) (* pw 2.0))
(- (min (cadr ll) (cadr lr) (cadr ul) (cadr ur)) (* pw 0.75)))
lr2 (list (+ (max (car ll) (car lr) (car ul) (car ur)) (* pw 0.75))
(- (min (cadr ll) (cadr lr) (cadr ul) (cadr ur)) (* pw 0.75)))
ur2 (list (+ (max (car ll) (car lr) (car ul) (car ur)) (* pw 0.75))
(- (max (cadr ll) (cadr lr) (cadr ul) (cadr ur)) (* pw 2.0))))
(command "PLINE" ll "W" 0 "" lr ur ul "C"
"PLINE" ll2 lr2 ur2 "" "PEDIT" "L" "W" (* pw 1.5) "")
(command "-LAYER" "S" clayer "")
(princ))
I execute the routine with the following: ^c^c^p(Load "Shdw_Box") shdw_box;^p
When executed from the CUI menu, I am prompted for both inputs (lower left and upper right).
However, when executed from the tool palette it skips past the "Pick Lower-Left Corner" without allowing an input and pauses on the "Pick Upper-Right Corner" selection. Afterwhich, I get the following error message:
Pick Upper-Right Corner: bad argument type: numberp: nil
Can anyone help me with this issue? I am not an experienced LISP programmer and am baffled why the routine works flawlessly when executed from one source and not another.
Cheers!
Edited by: mikem@themcdermottgroup.com on Jan 14, 2009 3:00 AM