AutoCAD/Layer States

Advertisement


Question
QUESTION: Like you I have been working with Autolisp since its inception; probably not as advanced though.
I am particularly interested in Layer Stacking and was wondering how you managed the complete drawing set one file?  Can you separate different drawing types as well as different floor levels?
My main question, however, is about identifying the plot ON/OFF state of layers.  Do you have any functions for displaying or hiding layers that  are not to be plotted.

Regards.

ANSWER: Colin:
I'm using a system of layer names that have a common prefix for each floor, and suffixes that identify various parts of the drawings like walls, lower cabinets, upper cabinets, furniture, etc.  That said, it's really fairly easy to write a LISP routine to freeze all the layers and thaw all the layers on the the first floor:
(command "_.-layer" "_f" "*" "_t" "1*" "")
On the issue of plotting and visibility, I'm not understanding the reasoning behind the request.  If you don't want to see the layer and you don't want it to plot, you can just freeze or turn off the layer.  However, I have posed the question to the newsgroups, "How can one use LISP to check whether or not the layer will plot?"  As far as I can see, tblsearch doesn't look at whether or not a layer plots.  Just object type, layer name, whether it's frozen or thawed, it's color (negative if the layer is turned off), and linetype.
(tblsearch "layer" "2")
((0 . "LAYER") (2 . "2") (70 . 0) (62 . 7) (6 . "Continuous"))
object type: LAYER
layer name: 2
layer state: thawed
Color:  7
linetype:  continuous

Making a layer non-plot has one purpose:  To not plot objects that display on screen.  If the object doesn't display on screen, it's not supposed to plot.
If I get a good response from my newsgroup request, I'll post a follow-up here.

Keep in touch
Bill DeShawn
http://my.sterling.net/~bdeshawn


---------- FOLLOW-UP ----------

QUESTION: Thanks Bill,
(Layer-state 7) lists the layers currently set to plot. I thought someone may have already used this list for a function to highlight or turn off layers that will not plot - (similar to using Plot Preview) in order to quickly check the plot condition of a drawing.
Regards
Colin

Answer

OK.  I got a response the the newsgroups

Here is an example of how to detect the plot state of a layer:

(setq layobj (tblobjname "layer" (getstring "\nLayer name:  ")))
(setq elist (entget layobj))
(setq plotstate (cdr (assoc 290 elist)))
(if (= plotstate 0 )(princ "Will not plot.  ")(princ "Will plot.  "))

Keep in touch
Bill DeShawn
http://my.sterling.net~bdeshawn

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill DeShawn

Expertise

I can address all 2-D questions and some 3-D questions. I do programming in AutoLISP if it doesn`t involve solid modeling. I can also address menu customization issues and can help you find answers to questions I can`t answer by taking your question directly to Autodesk via their newsgroups.

Experience

I used to do electronic and mechanical design for a flat panel monitor manufacturer, and now I do architectural drafting for an architect. I did and do AutoLISP and menu customization and take pride in making my lisp routines to do the work exactly the way the client likes them done.

Publications
I had a routine published in CADENCE magazine (no longer in publication and taken over by CADALYST). Some of my routines are published on my website at http://my.sterling.net/~bdeshawn

©2012 About.com, a part of The New York Times Company. All rights reserved.