Author Topic: Visual Lisp to UnFreeze Layers  (Read 2438 times)

0 Members and 1 Guest are viewing this topic.

jxphklibin

  • Guest
Visual Lisp to UnFreeze Layers
« on: March 28, 2009, 01:41:06 AM »
Why it doesn't works? Any help thanks!!
Code: [Select]
(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)
)

jxphklibin

  • Guest
Re: Visual Lisp to UnFreeze Layers
« Reply #1 on: March 28, 2009, 02:43:39 AM »
I knows , The current layer can not be frozen, thawed operation, it is excluded, or else they will make mistakes.

Code: [Select]
(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)
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10388
Re: Visual Lisp to UnFreeze Layers
« Reply #2 on: March 28, 2009, 07:39:45 AM »
Here is an example:
Code: [Select]
;;; 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)
)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

jxphklibin

  • Guest
Re: Visual Lisp to UnFreeze Layers
« Reply #3 on: March 28, 2009, 08:14:23 AM »
Thanks CAB very much!