[Search tip detail and code files using keywords, tip number, author name, etc ]
 
Switch to a New Current Layer without Layman
Tip# 3900 By Dave Alexander On 21-May-2012
0
Rated By 0 users
Categories : Layer Tools
Software type : AutoCAD 2013
Rename File To : No Files to download.
Label items in your AutoCAD drawing on the appropriate layer without having to change layers.

Tipster Dave Alexander shares a way to label items in your AutoCAD drawing on the appropriate layer without having to change layers.

"Make a toolbar or palette item that inserts a block or draws a new object and sets the correct layer for the item to a new layer that is based on the current layer. For example, heating pipe layer M-HOTW-PIPE-RETN-N is current. You need to put identification on the pipe, such as HWS. You set up a macro that checks the current layer and sets the new current layer by changing the minor group of the pipe layer M-HOTW-[PIPE]-RETN-N to M-HOTW-IDNT-RETN-N and setting it as the current layer. The pipe identification can be read from a separate file, or can be derived from the pipe layer name by selecting parts of it such as M-[H]OT[W]-PIPE-[R]ETN-N to set the pipe identification as HWR. The macro can insert the identification as a block of the same name or used as a variable for text or mtext.

"The really exciting thing is that by using this principle, you can make a LISP program that will allow you to make a selection set of multiple different entities on different layers and change them all from Existing layers to New layers, or Future, or Demolition. The other exciting thing is that you take AutoCAD out of the equation and allow the user to think in terms of mechanical systems, piping, pipe identification, and so on. New users do not have to decide what the pipe identification should be, only that the pipe needs to be identified."

Notes from Cadalyst Tip Reviewer Brian Benton: This tipster is using the National CAD Standards (NCS) from the United States as a layering example. The NCS has a method for creating layers: each part of the layer name means something. This tip uses that layer-naming convention to assist in creating new layers automatically with a LISP routine. Any layer standard can be used here, as long as your LISP routine is coded properly. If you can’t code in LISP you can also try creating labels in text, mleaders, or blocks. Put those labels in a tool palette, and edit them so that they automatically insert on a specific layer.

 

Average Rating:
0


User comments
Comment by Tabib,Soopida
Posted on 2012-05-22 01:53:44
Hello, Thank you for this useful tip, but please give an example step by step instruction. cheers, Soopida
Comment by Alexander,Dave
Posted on 2012-05-22 10:59:23
The simple example is as follows, The last field in the layer name is for status, E for existing, F for future, N for new and D for demolition. You want to change an entity status from New to Existing. Develop a lisp file that uses an entity selection, and lists the entity properties assigning a variable for the entity layer. You create a new layer by using the original layer name and substituting E for N and changind the layer of the entity properties using the new layer name. Now for the fun part. You can set the entity layer status variable in a tool bar button macro that starts the process of selecting an entity to change. Four buttons, one for each status. You change the lisp file to use the variable set by the macro. You can now also change the lisp file to accommodate a selection set of entities.


Log In