AboutScott Cook Expertise I`ve been using AutoCAD since 1987 and programming AutoLISP nearly as long. I can answer questions about programming AutoCAD (except ARX) and production enhancement techniques. I cannot answer questions about AutoCAD crashes or DWG corruption. AutoCAD PROGRAMMING (menus, lisp) related questions only!
Experience Since 1987. Author of Plot2000 software for for AutoCAD, http://www.plot2000.com.
PROGRAMMING QUESTIONS ONLY PLEASE. Questions that are NOT related to programming or AutoCAD customization (menus and lisp only please) are outside the scope of my volunteer services and will NOT BE ANSWERED.
We're in the process of standardizing our drawings starting w/ our layering schemes. Typically, we create our 'base drawing' which includes all of existing/proposed contours, utilities, drainage, etc. in their own respective layers. When we create a new drawing focusing on grading, for example, we xref in this 'base drawing', freeze out the layers not associated w/ grading, & apply appropriate color to each xrefed layers. Currently, we deal w/ about 75 layers per drawing. Each individual layers are color specific & changes depending on the drawing you're creating (grading, utilities, drainage, etc). The reason for the colors is for plotting reasons (color dependent). We're suppose to memorize which color goes w/ which layer but still often missed. I'm not so sure how can this be done but i think it's feasible. I've done some simple lisp programming in the past but not as complicated as this task. I need your expertise or any input would be appreciated just to get me started. I've done quite a bit of research for tblsearch & changing layer properties but not sure of the sytax using w/ loops & if..then.
Thx,
Mike
P.S. We use Land Desktop 2005
Answer sorry, I just realized you were asking about changing existing layer colors.
That's another common problem. You might find some shareware stuff. I've seen people take different approaches, but all involved the use of a lisp routine of some sort. You probably won't escape the need to write something to suit your needs. Ideally, it would be applied automatically by "rules" set in your drawing and operate against some kind of config file.
I've written stuff like this, but it can become overly complex pretty quickly - especially based on the special needs as you move from project to project.
The approach I took for one client was to create an .INI file that was stored in the project folder. The lisp routine operates against rules defined in that INI file for the "type" of drawing it was. Each section contained wildcard patterns with freeze, thaw, color, etc.
You'd need to come up with a way to store the dwg type in a block attribute that your lisp routine looks for - then read the config file for the appropriate rules and run them.
This particular client needed it to run prior to every plot - because the xrefs were live and being modified by other disciplines - and during a large batchplot 5 minutes prior to a deadline, layers were being added in the xrefs and popping up on other drawings where they shouldn't.
All kinds of issues - same problem for lots of people. Sorry I can't be specific about coding - it's something you are going to have to get a bit further into and ask more specific questions for me to be able to help in that regard.