layer management

layer management

654work
Collaborator Collaborator
708 Views
3 Replies
Message 1 of 4

layer management

654work
Collaborator
Collaborator

I’m attempting to write a routine (it’s been a long time 20+ years) for layer management and would like some advice.  What I’m attempting to accomplish with this is for various layers to be turned off, frozen, viewport freeze and/or change viewport color.  I have written the lisp routine to manage the layers display but would like to add the ability to verify the user is in paperspace and in a viewport along with verifying the layers to be modified existing either in the file or an attached xref.  Please make suggestions and places to find information on writing lisp code

 

Civil 3D 2018, latest patches

WIN 10

0 Likes
709 Views
3 Replies
Replies (3)
Message 2 of 4

Moshe-A
Mentor
Mentor

@654work  hi,

 

(setvar "ctab" "model") ; switch to model tab

 

 

(setvar "ctab" "layout1") ; switch to layout1 tab

(command "mspace")      ; switch from paper space to model space

(setvar "cvport" 2)           ; enter first viewport  (each vp has an id, the first is 2 cause 1 is reserve for outside paperspace)

 

; from inside vp call vplayer to manipulate vp properties

(command "vplayer" ......)

 

 

enjoy

moshe

 

 

 

0 Likes
Message 3 of 4

CodeDing
Advisor
Advisor

@654work ,

 

Here's some more info for you to use.

(if (and (not (eq "Model" (getvar 'CTAB)));<--user is Not in model space
	 (> (getvar 'CVPORT) 1));<--user is inside a vport
  (do stuff...)
  (else do stuff...)
);if

(setq modLayers '("lyr1" "lyr2" "lyr3"))
(foreach lyr modLayers
  (if (tblsearch "LAYER" lyr)
    (layer exists, do stuff...)
    (layer does not exist, do other stuff...)
  );if
);foreach

Best,

~DD

0 Likes
Message 4 of 4

654work
Collaborator
Collaborator

Thank you for the suggestions.  I'll give these a try, probably tonight after I get a project out the door.

0 Likes