Possible to write a lisp for layer on whole viewports.

Possible to write a lisp for layer on whole viewports.

smallƑish
Advocate Advocate
1,662 Views
10 Replies
Message 1 of 11

Possible to write a lisp for layer on whole viewports.

smallƑish
Advocate
Advocate

In my drawing have 20+ layouts each has multiple viewports. All viewports layer properties are different...Instead of selecting each model space of each viewports,  selecting all layers, making all layer on, non freeze, enable print etc...... Can we do it with any lisp.? 

0 Likes
1,663 Views
10 Replies
Replies (10)
Message 2 of 11

paullimapa
Mentor
Mentor

What you are referring to has nothing to do with Pspace Vports.

Layers turned off/frozen/noplot can be turned on/thawed/plot once by using this sequence of commands regardless of Model or Layout:

 

(command"_.Layer""_T""*""_On""*""_P""_P""*""")

 

paulli_apa_0-1678431377949.pngpaulli_apa_0-1678431377949.png

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 11

komondormrex
Mentor
Mentor

you are wrong. paperspace viewports have independent layers settings, which may differ from those of modelspace.

0 Likes
Message 4 of 11

paullimapa
Mentor
Mentor

Papace Vports do have layer settings. But the only setting that comes close to what your OP described is called freeze/thaw but not on/off or plot enabled or disabled. 
https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/AutoC...


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 11

paullimapa
Mentor
Mentor

FYI: Here’s a code to vplayer thaw all layers in all layouts written over a decade ago:

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-to-thaw-all-layers-frozen-...

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 6 of 11

komondormrex
Mentor
Mentor

komondormrex_0-1678448576590.pngkomondormrex_0-1678448576590.png

 

0 Likes
Message 7 of 11

paullimapa
Mentor
Mentor

 

\Now those are the correct terminology.

These can all be done by slightly modifying the code I posted earlier like this:

(setq clayout (getvar 'ctab))
(foreach layout (layoutlist)
  (setvar 'ctab layout)
;  (command "_.vplayer" "_thaw" "*" "_all" "")
  (command "_.vplayer" "_M" "_A" "*" "_all" "")
)
(setvar 'ctab clayout)

Also, read up on VPLAYEROVERRIDESMODE setting:

Without A Net: Reset Layer Viewport Overrides from VPLAYER (typepad.com)


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 11

smallƑish
Advocate
Advocate

frozen layers are still as it is in layout 1 . I don't know what's wrong 

0 Likes
Message 9 of 11

paullimapa
Mentor
Mentor

Post your dwg here so I can take a look


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 10 of 11

smallƑish
Advocate
Advocate

In the dwg file, there are 9 layouts. each even number layouts Layer VP-SET will be disabled for plotting,

either layer is freeze, off, print disable, etc.

I have made this for your easy understanding.

please try your code.

0 Likes
Message 11 of 11

paullimapa
Mentor
Mentor

apparently the override setting applies to all the VP Columns except for VP Freeze column

so I've modified the code and called it VPO...give this a try:

(defun c:vpo (/ clayout)
 (setq clayout (getvar 'ctab))
 (foreach layout (layoutlist)
  (setvar 'ctab layout)
;  (command "_.vplayer" "_M" "_A" "*" "_all" "")
  (command "_.vplayer" "_T" "*" "_all" "_M" "_A" "*" "_all" "")
 )
 (setvar 'ctab clayout)(princ)
) ; defun

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes