TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MvdP on November 01, 2006, 08:18:53 AM
-
I got a question about canceling an getfiled box.
Here is a piece of code what i got.
(SETQ route1 (getfiled "Select file" "Drawing" "dwg" 1))
but when i hit the cancel button in this dialog box or the escape button is this what the command line says:
Command: nil; error: bad argument type: stringp nil
Can this piece of code be changed/modified so it that when i hit either the cancel or escape button i will return to my main dialog box.?
-
The var is being set to nil in my test.
I suspect your routine is not handling that condition.
Need more of your code.
-
CAB here is more of my code.
Here is piece of my DCL
:button { label = "Tekening Naam"; mnemonic = "N"; fixed_width = true; key = "path";}
:text{ key = "route"; width = 75;fixed_width = true;}
Here is more of my LSP
(action_tile "path" "(paden)")
(set_tile "route" route1)
(set_tile "dwgnaam" dwgnaam)
(defun paden ()
(if (= pq20 nil)
(progn
(setq pq12 (getvar "dwgname"))
(setq lengte (strlen pq12))
(if (> lengte 7)
(progn
(setq pq00 (substr pq12 1 7))
(WHILE (= pq00 "Drawing")
(SETQ route1 (getfiled "Select file" "Drawing" "dwg" 1))
(setq lengte (strlen route1))
(setq nwlengte (- lengte 10))
(setq pq00 (substr route1 nwlengte))
(set_tile "route" route1)
(set_tile "dwgnaam" route1)
(setq naam route1)
(SETQ pq12 nil)
)
)
)
)
)
)
I hope this wil do.
-
Maybe this will work for you.
(defun paden ()
(if (= pq20 nil)
(progn
(setq pq12 (getvar "dwgname"))
(setq lengte (strlen pq12))
(if (> lengte 7)
(progn
(setq pq00 (substr pq12 1 7))
(while (= pq00 "Drawing")
(setq route1 (getfiled "Select file" "Drawing" "dwg" 1))
(if route1
(progn
(setq lengte (strlen route1))
(setq nwlengte (- lengte 10))
(setq pq00 (substr route1 nwlengte))
(set_tile "route" route1)
(set_tile "dwgnaam" route1)
(setq naam route1)
(setq pq12 nil)
)
(setq pq00 nil) ; exit paden
)
)
)
)
)
)
)
-
Yes CAB it is working.You're a lifesaver.
Thank you so much.
-
You're welcome, any time.