Hi
I am importing a layer state for different drawings. is there any way so that the layer state updated automatically in all drawings each time i change the parrent layer state file.
Hi, an employee of mine is struggling with the same issue, he'd like to create a "Master Layer State" that will actively and automatically change all the layer states inside of his drawing as needed.
Is there any way to do this?
I'm having the same needs.
I've found a few posts related to this, but nothing referring to any OOTB tools in C3D 14 (I do see that this is a Land Desktop section of the forum). Other posts were found in the customization sections, but as I am not as familiar as needed to make the most of the information in those posts, I'm hoping that someone can suggest either a way to accomplish this, or offer a lisp file that is cut and dry.
Thanks!
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've submitted a message in a more appropriate section of the forum (though the Customization section would have been best) and added your last post to it. This thread is located here:
There is a response to the code you provided.
Let the Epic CAD Coding Battle of History . . . . BEGIN!!!
Can't find what you're looking for? Ask the community or share your knowledge.