Temporarily change appearance of layers

Temporarily change appearance of layers

Anonymous
Not applicable
1,645 Views
12 Replies
Message 1 of 13

Temporarily change appearance of layers

Anonymous
Not applicable

Hi

I need a lisp routine to temporarily change the appearance of layers in Civil 3D 2020, using .ctb-type color-based plotting. Our technology department is standardizing our AutoCAD layer set and they insist on using colors that are faded and hard to see. And I can’t convince them otherwise. So, my solution is to lisp around the issue. I can set a lisp to load on start easy enough. The lisp needs to;

  • Activate when I enter a simple command, such as ‘renov8’
  • Change the appearance of a pre-chosen list of layers for;
    • Screen display color
    • Screen display linetype
    • Leave printing unaffected from original settings
  • Be effective for the current session only;
    • All layer changes revert to original when the dwg is closed (so I don’t ruffle somebody’s feathers)
    • No layer changes get saved to the dwg when I save the work while the lisp is active.
  • A bonus would be having the same layers get their appearance changed in xrefs too, but I’ll be happy to get the first items.

Could someone provide a lisp routine that will accomplish that? I anticipate that I’ll have to do some work setting up a long list of layers, but once it’s done I’ll be set. Thanks for your help!

0 Likes
1,646 Views
12 Replies
Replies (12)
Message 2 of 13

3wood
Advisor
Advisor

You can just turn on / off the transparency button, no need any lisp.

Capture3.PNG

0 Likes
Message 3 of 13

Sea-Haven
Mentor
Mentor

You can set what ever colours you want to see on screen, and then just use a custom ctb when plotting with required colors. A second step would be do a custom layer colours on/off as you have suggested. 

 

One of the things you can do is redefine commands so you could change Save, Quit  and Close to run your color change lisp. Likewise undefine. Also edit menu's to suit.

 

I would look at a list ((layername color LT)(layername color LT)( then its a simple foreach loop or use a txt file. 

0 Likes
Message 4 of 13

Sea-Haven
Mentor
Mentor

Here is layer dump for you just change the file destination d:\\acadtemp

 

If you make say 5+ layers can do something for you for testing, need stuff like layer exist or LT is loaded.

Layername,Colex,LTex,Colnew,LTnew

 

This way have only 1 file with all layers in it can read ex or new very easy.

 

(defun writelays ( / doc fo lay)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq fo (open (setq fname "D:\\Acadtemp\\layerlist.csv") "W"))
(vlax-for lay (vla-get-Layers doc)
(write-line (strcat (vla-get-name lay)"," (rtos (vla-get-color lay)2 0) "," (vla-get-linetype lay) ) fo)
)
(close fo)
(princ)
)
(writelays)

 

0 Likes
Message 5 of 13

Anonymous
Not applicable

Thanks for the thought, 3wood. However, I should clarify; the layer visibility issue is not due to transparency, but rather a poor choice of index colors for the layers. For example, the fiberoptics layer is set to Index color #165, which is practically invisible when drafting in a darkened background. So, I could just change the color, but then the plotting is all messed up because plotting is set to colors as well now, which is unfortunate.

0 Likes
Message 6 of 13

Kent1Cooper
Consultant
Consultant

Here's a cockamamie suggestion:

Make a routine that gets run by your acaddoc.lsp every time you open a drawing, to check whether it's one you want to apply these changes to [from the presence of certain Layers, or something], and if it is, check whether there's a Layer State of a certain name for opening conditions, and if not, create it.  Then check whether there's a your-preferred-conditions Layer State -- if so, Restore it, if not, make your color/linetype changes and Save that State.

 

[Here's the cockamamie part:]  Make a routine that gets run by everyone else's acaddoc.lsp [you'll need to get it into them], that checks whether it's the right kind of drawing, and if so, restores that original-conditions Layer State!

 

Then you don't need to deal with the Layer States except to Restore the original one before Plotting.  You can Save and even Close without worrying about it, and that original State will be restored first thing whenever the drawing is opened by someone else.

Kent Cooper, AIA
0 Likes
Message 7 of 13

ronjonp
Mentor
Mentor

There are multiple layer-* functions that could work for this. Just get your logic down 🙂

0 Likes
Message 8 of 13

3wood
Advisor
Advisor

@Anonymous wrote:

Thanks for the thought, 3wood. However, I should clarify; the layer visibility issue is not due to transparency, but rather a poor choice of index colors for the layers. For example, the fiberoptics layer is set to Index color #165, which is practically invisible when drafting in a darkened background. So, I could just change the color, but then the plotting is all messed up because plotting is set to colors as well now, which is unfortunate.


In that case, you can set up a 'temporary layout' template. 

  1. Create a new layout (any size)
  2. Create a new viewport (any size).
  3. Double click in the middle of the viewport and switch into model space.
  4. Open Layer Manager and change the 'VP Color' of concerned layers to White or whatever color you prefer.
  5. Click 'Maximize Viewport' button and working from there.
  6. You can 'Drag' the 'temporary layout' to any drawing with DesignCenter (Press Ctrl+2)

TASK3.gif

0 Likes
Message 9 of 13

Anonymous
Not applicable

Thanks Sea-Haven. I just need some time to digest this a bit; I'm on a learning curve here. Also, there may be a way to use a layer state in this and bring in a las file, rather than specifying a bunch of individual layer properties. Still looking into it...

0 Likes
Message 10 of 13

Anonymous
Not applicable

Appreciate the feedback, ronjonp. There's more layer functions than I realized; layerstate looks to have some promise. I just need to get it set so that I can easily load a state, but not have the state come up when someone else opens the drawing. Maybe there's a function for that too. Once I get that sorted, then maybe look at a lisp and/or shortcut key to load it up...

0 Likes
Message 11 of 13

Sea-Haven
Mentor
Mentor

We use lisp to plot so another trigger is to check 1 layer if its color is not 163 then that means you have changed it. So plotting via a lisp use the other ctb which has the colors required. see mycolor.ctb I would make a dummy layer and lock it. In a ctb you can change the colors red is now blue.

 

 

 

 

 

(COMMAND "-PLOT"  "Y"  "" "DWG To PDF"
	       "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" "1=2"  "C"
	       "y" "Mycolor.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
    )

 

 

Almost forgot one of our guys thought he would play and edited the VPlayer colors was pulling my hair out till figured it out. So if your working in model color as required but all your layout viewports have correct colors so plot correct. Bit like 3wood suggestion but personally I stay away from editing in viewports.

 

 

 

 

0 Likes
Message 12 of 13

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

... so that I can easily load a state, but not have the state come up when someone else opens the drawing. Maybe there's a function for that too. ....


That is exactly my suggestion in Message 6 above.  The "function for that" is to put a line to restore your desired Layer State into your acaddoc.lsp file, but not in other people's.

Kent Cooper, AIA
0 Likes
Message 13 of 13

mid-awe
Collaborator
Collaborator

Why not just set up VP Overrides so that you print as expected without changing the colors / properties from that which you are familiar? 

 

LIKE SO 

0 Likes