TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jxphklibin on March 28, 2009, 01:41:06 AM
-
Why it doesn't works? Any help thanks!!
(defun c:test (/ *doc*)
(setq *Doc* (vla-get-ActiveDocument (vlax-get-acad-object)))
(vlax-for n (vla-get-layers *DOC*)
(vla-put-Freeze n :vlax-false)
)
;(vla-regen)
)
(defun C:LayUnFrz (/ acadDocument theLayers)
(vl-load-com)
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(vlax-for item theLayers
(vlax-put-property item "Freeze" ':vlax-false)
)
(princ)
)
-
I knows , The current layer can not be frozen, thawed operation, it is excluded, or else they will make mistakes.
(defun c:test (/ *app *doc *blk)
(setq *App (vlax-get-acad-object))
(setq *Doc (vla-get-ActiveDocument *APP))
(vlax-for n (vla-get-layers *DOC)
(if (/= (strcase (vla-get-name n))
(strcase (getvar "clayer"))
)
(vla-put-Freeze n :vlax-false) ;(vlax-dump-object n t)
)
)
(command "regen") ;(vla-regen)
)
;
(defun C:LayUnFrz (/ acadDocument theLayers)
(vl-load-com)
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(vlax-for item theLayers
(if (/= (strcase (vla-get-name item))
(strcase (getvar "clayer"))
)
(vlax-put-property item "Freeze" ':vlax-false)
)
)
(princ)
)
-
Here is an example:
;;; Thaw layer group
;;; Written by kpblc (kpblc2000@gmail.com)
(defun c:thla (/ adoc la_mask)
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startundomark adoc)
(if (setq la_mask
(getstring t
"\nEnter the mask of layer names to be thawed <Exit> : "
)
)
(progn
(setq la_mask (strcase (strcat "*" la_mask "*") t))
(vlax-for item (vla-get-layers adoc)
(if (wcmatch (strcase (vla-get-name item) t) la_mask)
(if (not (equal (vla-get-activelayer adoc) item))
(vla-put-freeze item :vlax-false)
)
)
)
)
)
(vla-endundomark adoc)
)
-
Thanks CAB very much!