Author Topic: what layers are frozen in what viewport/layout tabs  (Read 6210 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Re: what layers are frozen in what viewport/layout tabs
« Reply #15 on: August 28, 2008, 05:46:39 AM »
hmmm I'll have to try it at work today as I was upgraded from 2002 to 2007 yesterday, finally. I'll give it a shot once I get all of my custom stuff going and report back.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: what layers are frozen in what viewport/layout tabs
« Reply #16 on: August 28, 2008, 08:32:07 AM »
There is a problem with the VP ID# in ACAD2000 & later versions. I know it's just a reference number but until a layout is activated for the first time the ID# is not valid.
Not sure if this is still a problem with 2007+
I will look at the routine again today to see if I can refine it.
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.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: what layers are frozen in what viewport/layout tabs
« Reply #17 on: August 28, 2008, 12:18:59 PM »
This one seems to work with 2002+. I took out the VP# and just checked for enames that were layers rather than code 331.

Code: [Select]
;;  By ronjonp modified by CAB
;;  Reports all the frozen layers in each VP by layouts
(defun c:VPFrzReport (/ a b c lastln ll ln ss lastvp flg)
  (if (setq ss (ssget "x" '((0 . "VIEWPORT"))))
    (foreach e (mapcar 'cadr (ssnamex ss))
      ;;CABS pspace vport filter
      (setq a (cdr (assoc 330 (entget e)))
    b (cdr (assoc 340 (entget a)))
    c (cdr (assoc 331 (entget b)))
    ln (cdr (assoc 410 (entget e)))
    flg nil
      )
      (if (or (null lastln) (/= ln lastln))
(progn
  (setq lastln ln)
  (princ (strcat "\n" ln))
)
      )
      (if (not (equal c e))
(foreach i (entget e)
  (if (and (= (type (setq ll (cdr i))) 'ENAME)
   (setq ll (entget ll))
   (= (cdr (assoc 0 ll)) "LAYER")
      )
    (progn
      (setq flg t)
      (princ (strcat "\n     '"
     (cdr (assoc 2 ll))
     "' controlled in vport"
     )
      )
    )
  )
)
      )
      (if (and (or (null lastvp) (/= e lastvp)) flg)
(progn
  (setq lastvp e)
  (princ (strcat "\n     ----------"))
)
      )
    )
  )
  (princ)
)
(c:VPFrzReport)

Output:
Code: [Select]
C:VPFRZREPORT
Layout1
     'Layer1' controlled in vport
     'Layer2' controlled in vport
     'Layer3' controlled in vport
     'Layer4' controlled in vport
     ----------
     'Layer1' controlled in vport
     'Layer2' controlled in vport
     'Layer3' controlled in vport
     'Layer4' controlled in vport
     ----------
     'Layer1' controlled in vport
     'Layer2' controlled in vport
     'Layer3' controlled in vport
     'Layer4' controlled in vport
     ----------
     'Layer1' controlled in vport
     'Layer2' controlled in vport
     'Layer3' controlled in vport
     'Layer4' controlled in vport
     ----------
Layout2
     'Layer2' controlled in vport
     'Layer3' controlled in vport
     ----------

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: what layers are frozen in what viewport/layout tabs
« Reply #18 on: August 28, 2008, 01:44:54 PM »
Thanks Ron, One more revision.
Code: [Select]
;;  By ronjonp modified by CAB
;;  Reports all the frozen layers in each VP by layouts
;;  CAB added file output
(defun c:VPFrzReport (/ a b c lastln ll ln ss lastvp flg fname fn path+file)
 
  (if (setq ss (ssget "x" '((0 . "VIEWPORT"))))
   (if (and (setq path+file (vla-get-fullname (vla-get-ActiveDocument (vlax-get-acad-object))))
            (setq path+file (strcat (vl-filename-directory path+file) "\\"
                                    (vl-filename-base path+file) "-VPF.txt"))
            (setq fn (open path+file "w")) ; overwrite file
            )
    (progn
    (foreach e (mapcar 'cadr (ssnamex ss))
      ;;CABS pspace vport filter
      (setq a (cdr (assoc 330 (entget e)))
    b (cdr (assoc 340 (entget a)))
    c (cdr (assoc 331 (entget b)))
    ln (cdr (assoc 410 (entget e)))
    flg nil
      )
      (if (or (null lastln) (/= ln lastln))
(progn
  (setq lastln ln)
  (princ (strcat "\n" ln) fn)
)
      )
      (if (not (equal c e))
(foreach i (entget e)
  (if (and (= (type (setq ll (cdr i))) 'ENAME)
   (setq ll (entget ll))
   (= (cdr (assoc 0 ll)) "LAYER")
      )
    (progn
      (setq flg t)
      (princ (strcat "\n     '"
     (cdr (assoc 2 ll))
     "' controlled in vport"
     ) fn
      )
    )
  )
)
      )
      (if (and (or (null lastvp) (/= e lastvp)) flg)
(progn
  (setq lastvp e)
  (princ (strcat "\n     ----------") fn)
)
      )
    )
    (close fn)
   )
  )
    )
  (princ)
)
(c:VPFrzReport)
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.

ELOQUINTET

  • Guest
Re: what layers are frozen in what viewport/layout tabs
« Reply #19 on: August 28, 2008, 01:53:12 PM »
i appreciate all the work but did you see my message that i just upgraded to 2007. i haven't had a chance to test anything as i'm trying to fix my basic setup first but will get back to this next week. thanks