AutoCAD Land Desktop

AutoCAD Land Desktop

Reply
Active Contributor
sujeev
Posts: 31
Registered: ‎08-05-2010
Message 1 of 5 (680 Views)

AUTOMATIC UPDATE LAYER STATE

680 Views, 4 Replies
12-15-2011 12:47 AM

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.

Active Member
AutoDiagram
Posts: 7
Registered: ‎11-09-2012
Message 2 of 5 (590 Views)

Re: AUTOMATIC UPDATE LAYER STATE

05-29-2013 01:38 PM 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?

Valued Mentor
bcsurvey
Posts: 285
Registered: ‎04-29-2008
Message 3 of 5 (116 Views)

Re: AUTOMATIC UPDATE LAYER STATE

07-23-2014 08:06 AM 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 2014
Windows 7 Professional SP1
Dell Precision T1700
(i7 @ 3.40 GHz)
8GB RAM
Nvidia Quadro K600
Contributor
cgentile
Posts: 19
Registered: ‎05-29-2013
Message 4 of 5 (109 Views)

Re: AUTOMATIC UPDATE LAYER STATE

07-23-2014 09:33 AM 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

 

Valued Mentor
bcsurvey
Posts: 285
Registered: ‎04-29-2008
Message 5 of 5 (105 Views)

Re: AUTOMATIC UPDATE LAYER STATE

07-23-2014 10:42 AM 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 2014
Windows 7 Professional SP1
Dell Precision T1700
(i7 @ 3.40 GHz)
8GB RAM
Nvidia Quadro K600
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.