I've only found posts for this topic on the Land Desktop and ACAD customization sections of this forum, and can't find anything useful in the Help section of C3D14 . . .
Is there a way to process .dwgs (either OOTB function or lisp) that will update layer states in viewports instead of having to go into each one and set an existing state? When 1 viewport (which shares its layer state with several others) has its layer state changed, and those changes need to be made to the other viewports, it's cumbersome to have to go into each one and re-assign the layer state, especially when we're talking about a dozen or more drawings or even layout tabs in a single dwg. For now, I'll only ask about multiple layout tabs in one drawing before inquiring into a way to update viewport layer states in multiple .dwgs.
Thank you
Hi Bill,
What you've described is a very early step in the development of where all moderate to large projects usually wind up. I do use the VPFreeze to bring the first viewport of what will be many to look the way I'd like. But you know as well as I that, unless one has been doing the same type of work for many years, down the road as the project develops, new layers may need to be incorporated into the drawing. Instead of having to see the layer states of other viewports (where new layers may or may not need to be visible) it would very useful to have the power to "assign" layer states to viewports such that when that state changes, these changes are also made in the respective viewports. Otherwise, you're bouncing from dwg to dwg, layout to layout, viewport to viewport to assign the desired state.
I actually received this in response to a post I submitted this morning in the Land Desktop forum (it still exists!). I'll have to get with some more saavy CAD users here to be sure I understand the use of matchline files, but it seems to be a feasible method, albeit not as user friendly as most CAD users would like:
cgentile wrote:
bc, we tailored this lisp to our needs and file structure, but the variables are pretty self explanatory. We use it in a script to run through a file directory which it opens the file, runs the lisp, saves, close, and continues on. We use ScriptWriter by Lee Mac to do this. The script saves us a large amount of time especially with large sets. Changing layer states is still a bit hard-coded; it can definitely be more user friendly...
The file structure we use in out office has each sheet as a separate file that references multiple "working" files. Through trial and error, we found the best way to manage layerstates is to have them saved in an external reference that will be in every plan drawing. For us, that is our matchline file which we use for matchlines, street labels, limit of work, etc. This eliminates the need to import or delete a layerstate into a sheet drawing file. This also makes sets more accessible for multiple users to modify the drawings. We are exploring (setvar "visretain" 0) to see if the external reference's layerstate is changed in its host file if those changes appear in the sheet file in which its layerstate is applied.
Let you know of that development, but for now I hope this can get you started.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::;;; ;;;;;;;; update layerstate for sheet drawings ;;;;;::;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::;; (vl-load-com) (defun c:uLS ( / nlsname olsname path dname vportlist vport) (setq pcli "RHT";client folder pnum "RHTS401";project number pname "RHTs401 #####" ;project name tb "22x34";titleblock size file to match XXXs###_TB_##x##.dwg format );project path info (setq pxref (strcat "P:\\" pcli "\\" pname "\\AutoCAD\\Xrefs\\") pacad (strcat "P:\\" pcli "\\" pname "\\AutoCAD\\") psheets (strcat "P:\\" pcli "\\" pname "\\AutoCAD\\Sheets\\") plstate (strcat "P:\\" pcli "\\" pname "\\AutoCAD\\Sheets\\Layer States")
match (strcat pnum "_d_match.dwg") tb (strcat pnum "_tb_" tb ".dwg") dxr "*" );paths and filenames (setq lsname "0l_layout"
nlsname (strcat match lsname) ;new layer state NAME olsname (strcat match lsname) ;old layer state NAME ;; lsfname "0l_layout.las" ;.las FILENAME ;; suspended
) ;layerstates (command "vplayer" "m" "a" "*" "a" "") ;removes viewport overrides (layerstate-delete olsname) ;deletes old layerstate ;; (layerstate-import (strcat plstate lsfname)) ;imports .las file ;; suspended (if (/= (getvar "ctab") "model") (progn (setq vportlist (vl-sort (vports) '(lambda (v1 v2) (< (car v1) (car v2))))) ;lists viewports (if (> (length vportlist) 1) (progn (command "_mspace") ;activate vport (foreach vport (cdr vportlist) (setvar "cvport" (car vport)) (layerstate-restore nlsname (vlax-vla-object->ename (vla-get-activepviewport (vla-get-activedocument (vlax-get-acad-object))))) ;restore ) ;end foreach (command "pspace") ;deactivate vport ) ;end progn ) ;end if ) ;end progn ) ;end if (command "-purge" "a" "*" "n") (setvar "psltscale" 1) (servar "msltscale" 0) (setvar "dimscale" 1) (setvar "ltscale" 1)
(setvar "visretain" 0) );defun
I don't know how to do exactly what you want. But in the mean time the VPLAYER command might help.
Allen
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Can't find what you're looking for? Ask the community or share your knowledge.