Been a long time since I've written any lisp. I am trying to write a lisp to get the current linetype, load new linetype and set as current, allow you to draw a line with that newly loaded linetype then return the linetype to previous linetype. Make since? Here is the code;
(defun c:ldlt()
(setq CLT (getvar "celtype"))
(setq a "data")
(if (= (tblsearch "ltype" a) nil)
(command "-linetype" "l" a "data.lin" "")
(princ)
)
(setq D "data")
(command "-linetype" "_s" D "")
(command "line")
; (setvar "celtype" CLT)
)
If I leave the (setvar "celtype" CLT) line in it just restores to CLT and draws a line. If I take it out it does load and set the linetype and lets me draw the line with the linetype but does not return the previous linetype. Any help greatly appreciated.
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Something like this perhaps.
(defun c:ldlt () (setq CLT (getvar "celtype")) (setq a "data") (if (= (tblsearch "ltype" a) nil) (command "-linetype" "l" a "data.lin" "") ) (setq D "data") (command "-linetype" "_s" D "") (command "line") (while (> (getvar 'cmdactive) 0) (command pause) ) (setvar "celtype" CLT) (princ) )
HTH
Henrique