AutoCAD Land Desktop (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AUTOMATIC UPDATE LAYER STATE

4 REPLIES 4
Reply
Message 1 of 5
sujeev
1781 Views, 4 Replies

AUTOMATIC UPDATE LAYER STATE

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.

4 REPLIES 4
Message 2 of 5
AutoDiagram
in reply to: sujeev

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?

Message 3 of 5
bcsurvey
in reply to: AutoDiagram

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!

Civil 3D 2019 (6.1)
Windows 10 Pro (21H2)
(i7-11850H @ 2.50 GHz)
32GB RAM
NVIDIA RTX A2000
Message 4 of 5
cgentile
in reply to: bcsurvey

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

 

Message 5 of 5
bcsurvey
in reply to: cgentile

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:

 

http://forums.autodesk.com/t5/AutoCAD-Civil-3D-General/Auto-update-layer-states/m-p/5170169/highligh...

 

There is a response to the code you provided.

 

Let the Epic CAD Coding Battle of History . . . . BEGIN!!! 

 

 

Civil 3D 2019 (6.1)
Windows 10 Pro (21H2)
(i7-11850H @ 2.50 GHz)
32GB RAM
NVIDIA RTX A2000

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report