Author Topic: Unfrozen a list of layers  (Read 4952 times)

0 Members and 1 Guest are viewing this topic.

lamarn

  • Swamp Rat
  • Posts: 636
Re: Unfrozen a list of layers
« Reply #15 on: July 02, 2014, 04:36:17 PM »
Thank you mr. CAB!
Design is something you should do with both hands. My 2d hand , my 3d hand ..

lamarn

  • Swamp Rat
  • Posts: 636
Re: Unfrozen a list of layers
« Reply #16 on: July 08, 2014, 05:13:29 PM »
Can you help with a few lines to get it to work..

Code: [Select]
(defun C:THV (/ doc result oldEcho lyr LayerFrozenList dh rtnList)
  (setq oldEcho (getvar "cmdecho")
  (vlax-for layer (vla-get-Layers doc)
    (if (= (vla-get-freeze layer) :vlax-true)
      (setq result (cons (vla-get-name layer) result)))
    )
  result
)

(setq lst (LayerFrozenList (vla-get-ActiveDocument (vlax-get-acad-object))))
     (if LayerFrozenList
       (progn
         (if (< (length LayerFrozenList) (getvar "maxsort"))
           (setq lyrList (acad_strlsort lyrList))
         )

         (setq dh (load_dialog "ddthaw.dcl"))
         (if (not (new_dialog "ddthaw" dh))(exit))
         (start_list "lyrlist")
         (mapcar 'add_list LayerFrozenList)
         (end_list)
         (action_tile "lyrlist" "(setq rtnList $value)")
         (action_tile "cancel" "(done_dialog 0)")
         (action_tile "accept" "(done_dialog 1)")
         (if (= (start_dialog) 1)
           (progn
             (setq rtnList (read (strcat "(" rtnList ")")))
             (command "_.layer")
             (foreach i rtnList
               (command "thaw" (nth i LayerFrozenList))
             )
             (command "")
           )
         )
         (unload_dialog dh)
       )
       (alert "Viewport does not contain\n   any vp frozen layers!\n")
     )
     (princ)
)
Design is something you should do with both hands. My 2d hand , my 3d hand ..

hanhphuc

  • Newt
  • Posts: 64
Re: Unfrozen a list of layers
« Reply #17 on: July 09, 2014, 03:50:16 AM »
Just had a quick fixed. not perfect yet
1. add in, (vl-load-com) & doc
2. setq lst instead of setq LayerFrozenList
3. (setq oldEcho (getvar "cmdecho") ..; parenthesis not close
4. (if lst; instead of  (if LayerFrozenList..
5.  (and (= (start_dialog) 1) rtnList)
reset oldEcho
etc..

Code: [Select]
(defun C:THV (/ doc result oldEcho lyr LayerFrozenList dh rtnList)
 
  (defun unfrozen-layers (layerlist / ents i l)
;;; Tharwat 20. march. 2012 ;;;
  (foreach x layerlist
    (if (setq l (tblobjname "LAYER" x))
      (progn
(entmod (subst '(70 . 0) (assoc 70 (entget l)) (entget l)))
;; This line turns the layer on
(entmod (subst (cons 62 (abs (cdr (assoc 62 (entget l))))) (assoc 62 (entget l)) (entget l))
)
(if (setq ents (ssget "_x" (list (cons 8 x))))
  (repeat (setq i (sslength ents)) (entupd (ssname ents (setq i (1- i)))))
)
      )
    )
  )
  (princ)
)

(defun LayerFrozenList(doc / result)
  (vlax-for layer (vla-get-Layers doc)
    (if (= (vla-get-freeze layer) :vlax-true)
      (setq result (cons (vla-get-name layer) result)))
    )
  result
)


(setq doc     (vla-get-activedocument (vlax-get-acad-object))
      oldEcho (getvar "cmdecho")
      lst     (LayerFrozenList doc)
      ) ;_ end of setq
 (setvar "cmdecho" 0)
     (if lst; LayerFrozenList
       (progn
         (if (< (length lst) (getvar "maxsort"))
           (setq lyrList (acad_strlsort lyrList))
         )

         (setq dh (load_dialog "ddthaw.dcl"))
         (if (not (new_dialog "ddthaw" dh))(exit))
         (start_list "lyrlist")
         (mapcar 'add_list lst)
         (end_list)
         (action_tile "lyrlist" "(setq rtnList $value)")
         (action_tile "cancel" "(done_dialog 0)")
         (action_tile "accept" "(done_dialog 1)")
         (if (and (= (start_dialog) 1) rtnList)
           (progn
             (setq rtnList (read (strcat "(" rtnList ")")))
             (command "_.layer")
             (foreach i rtnList
               (command "thaw" (nth i lst))
             )
             (command "")
           )
         )
         (unload_dialog dh)
       )
       (alert "Viewport does not contain\n   any vp frozen layers!\n")
     )

    (setvar "cmdecho" oldEcho)
     (princ)
)
(vl-load-com)
( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" ) ; error: too many arguments

lamarn

  • Swamp Rat
  • Posts: 636
Re: Unfrozen a list of layers
« Reply #18 on: July 09, 2014, 03:21:09 PM »
Thanks for your reply!

instead of using (vla-get-freeze ... i need the vp equevalent... something lik (vla-get-vpfreeze..
I dont know. vpfreeze does not exist. i has tp be something else.
Design is something you should do with both hands. My 2d hand , my 3d hand ..