Hi guys,
How Can I add a routine to verify if the layer ( AREA-TEMP) were frozen, it will thaw it?
code bellow:
(defun c:BOU (/ pt) ;; save current layer in the variable "clr" (setq clr (getvar "clayer")) ; create (if not exist) and set layer "cotas-perfil" current (command "_layer" "m" "AREA-TEMP" "c" "1" "" "s" "AREA-TEMP" "") (while (setq pt (getpoint "\nPick internal point: ")) (command "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "") ) (setvar "clayer" clr);<-- always restore layer at the end of code (princ) )
thank in advance
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Something like this perhaps
(defun c:BOU (/ clr lay pt) ;; save current layer in the variable "clr" (setq clr (getvar "clayer")) ; create (if not exist) and set layer "cotas-perfil" current (setq lay (tblsearch "LAYER" "AREA-TEMP")) (if (null lay) (command "_layer" "m" "AREA-TEMP" "c" "1" "" "s" "AREA-TEMP" "") (if (= (logand 1 (cdr (assoc 70 lay))) 1) (command "_layer" "t" "AREA-TEMP" "s" "AREA-TEMP" "") (command "_layer" "s" "AREA-TEMP" "") );; if );; if (while (setq pt (getpoint "\nPick internal point: ")) (command "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "") ) (setvar "clayer" clr);<-- always restore layer at the end of code (princ) )
HTH
Henrique
@F.Camargo wrote:
Hi guys,
How Can I add a routine to verify if the layer ( AREA-TEMP) were frozen, it will thaw it?
....
A simpler way is to not bother checking whether it's frozen, but simply thaw it regardless, before making it. It has to be before making it, because if it already exists and is frozen, the Make option will fail, since it can't make a frozen Layer current. If it doesn't exist yet, it won't matter -- a message will go by that it didn't find it to thaw, but it will continue anyway, and make the Layer. And using the Make option, you don't need that Set option you had in there -- that's part of what the Make option does.
....
; create (if not exist) and set layer "cotas-perfil" current
(command "_layer" "t" "AREA-TEMP" "m" "AREA-TEMP" "c" "1" "" "")
(while ....