It's BONUS time! The R14 Layer Bonus Routines31 Mar, 1998 By: Lynn Allen
After you install and open AutoCAD R14, you might find three bonus toolbars appearing right smack-dab in the middle of the screen. When thus confronted, you'll probably be inclined to banish them into exile, but hold on! The bonus routines attached to these toolbars will bring sighs of delight to you proficient AutoCAD users. Those of you who are new to AutoCAD will appreciate these added features as well, but I'd stick to the basics first, and return to the bonus routines when you're more familiar with the software.
In general, the bonus routines are a combination of AutoLISP, AutoCAD Runtime Extension (ARX) and Visual Basic programs that have been collected from Autodesk employees as well as AutoCAD users. The primary goal behind this collection of bonus routines was to "make the AutoCAD user happy." These routines are not officially proclaimed to be bullet-proof, so be warned that you might find an occasional bug.
There's no way I can cover all of the bonus routines in one column, so we'll take them a few at a time. If you didn't install the bonus routines when you installed AutoCAD, you might need to go get your AutoCAD CD and install this extra Bonus Tools component. If you selected Typical Installation (which is the default), the bonus toolbars will not be loaded; you'll have to install the Bonus Routines from the installation CD. If you chose Full Installation, you already have them installed. If you've banished the Bonus toolbars, you should be able to use the View=>Toolbars... option from the pulldown menu to display them. Be sure to change the menu group from ACAD to AC_Bonus.
If you don't see the Bonus pulldown menu, you'll need to use the MENULOAD command to get them, which can be found in the Tools pulldown menu under Customize menus...
Select the Browse button to find the menu file. It's located under R14 in the Bonus\Cadtools directory under the name of AC_bonus (either of the MNS or MNC versions will work). Loading this file should add the additional Bonus pulldown menu as well as display the Bonus toolbars. Now, we're ready to dive in.
The routines are broken up into five major sections: Layers, Text, Modify, Draw and Tools. We'll tackle Layers this month.
Layer management is key to effective AutoCAD drawing. Other than adding a Layer Manager, the bonus routines also include quick-and-easy ways to control the layers within your drawing.
Let's take a look. (Note: since I like to give credit where credit is due, I've listed the names of the talented programmers next to the routines they've developed. There's a trick for displaying all of the authors' names. See if you can find it.
LMAN-the new Layer Manager (This routine was written by Randy Kintzley. He was hired by Autodesk to create bonus tools for the VIP Subscription program after his hard work on several of the bonus tools shipped with R14.)
A huge wish-list request was granted with this nice AutoLISP routine. If you find yourself using a few basic layering configurations in your daily work and tire of resetting them over and over, then this routine is for you! Now you can save these layer configurations for use in the same drawing or, as a file, export them to other drawings. This command is the first Layer command in the Bonus pulldown menu as well as the first button on the Bonus Layer Tools toolbar. Let's take a look at the options in this command.
Save: Layer configurations are referred to as States. When you have created a configuration of layers for later use, you select the Save button to save the current Layer State. By default, AutoCAD will save the current configuration to the name "Layer_State1." As you save layer configurations, you'll notice the name automatically increases the counter by one. You can, of course, key in your own name if you prefer. Layer State files have an LAY extension.
If you make changes to a configuration you've already saved, you can resave it by selecting the same State name or using the Edit button.
Edit: Selecting Edit... displays the Layer & Linetype Properties dialog box, permitting you to make modifications to the selected State. You can also create new layers in your drawing using this option, but I don't recommend doing so. I noticed that when I was freezing some layers in Edit mode and then creating a new layer, it automatically came in Frozen. You'll also find that when restoring a different Layer State, a warning message displays, recommending that you resave this configuration to contain the new layers. I never resaved them, and they appear to work just fine. You'll save yourself from these warnings by obliging, however. I don't see any of this stuff as a real issue because, frankly, you should be using standard layer commands to create layers, not the Layer Manager. I just wanted to give you a heads-up.
Delete: This option is used to remove an existing Layer State. A warning message will appear to ask whether you really want to delete the selected layer state.
Import: and eXport: These options display dialog boxes that permit you to save your current configurations to an LAY file or to import an existing LAY file. You'll also notice a Find File button in the Import dialog box that sends you to a nice Browse/Search-tabbed dialog box to find saved LAY files. The Import file dialog box also contains a cool Locate button that does a quick search for LAY files through the existing search paths. Autodesk has included several LAY files for your use.
Restore: This option restores the layer settings of the selected layer state. (Hot tip: you can double click on a Layer State to quickly restore and exit the Layer Manager dialog box.)
Bonus Routines in Action
Several of the following bonus routines came from one file called bnslayer.lsp. (These routines were created by Dominic Panholzer, last year's San Francisco AutoCAD User Group president, who now works full-time developing Bonus tools for the AutoCAD VIP Subscription program.)
LAYMCH: (Layer Match) Next on the pulldown and toolbar, this command is used to change the layer(s) of one or more selected objects to match the layer of a selected destination object. You'll find this very similar to the MATCHPROP command, but this only matches layers.
It's very simple. You select the objects that reside on a wrong layer, then select an object that resides on the target layer. All of the selected objects will change to match the layer of the destination object. Note that you can also key in the name of the layer.
Select objects to be changed:
Select objects: 3 found
Select objects: [Enter]
Type name/Select entity on destination layer: <Select the target layer object>
3 objects changed to layer LIGHT.
LAYCUR: Change to Current Layer (bnslayer.lsp). This routine is a very simple command that switches the selected objects so they reside on the current layer.
Select objects to be CHANGED to the current layer:
Select objects: 1 found
Select objects: [Enter]
1 object changed to layer CASE (the current layer).
LAYISO: Layer Isolate (bnslayer.lsp). I really like this one. LAYISO is used to isolate one or more layers. In other words, it turns off all of the layers except for those that correspond to the selected objects. If you only want to see dimensions, you can select a dimension and all of the other layers will turn off, leaving only those objects on the dimension layer. You'll also see that it sets one of the isolated layers to be current (the first selected unless you use a window).
Select object(s) on the layer(s) to be ISOLATED:
Select objects: 1 found
Layer OVERHEAD has been isolated.
LAYFRZ: Layer Freeze (bnslayer.lsp). This routine freezes the layers of selected objects. Very simply, as you select objects, you'll see them disappear as their layers will be frozen. You must select the objects one at a time. This is a great way to quickly freeze layers for editing or perhaps plotting purposes.
Options/Undo/<Pick an object on the layer to be FROZEN>:
Layer WALL has been frozen.
Undo will thaw the layer just frozen (you might notice a delay because Thaw requires a REGEN). Options will send you to some complex options that relate to blocks or external references. Here is a quick explanation of the Options: No nesting/Entity level nesting/<Block level nesting>:
No nesting. If you select a block or xref as your object, the layer on which the block or xref is inserted will be the designated frozen layer.
Entity level nesting. This option freezes all of the layers of the object selected, even if the object is nested in an xref or block.
Block level nesting. If you select a block, then No nesting will occur and the layer that the block was inserted on will be frozen. If you select an xref, then the layer of the object itself will be frozen (similar to Entity level nesting).
I admit that it's somewhat confusing. However, LAYFRZ will not let you freeze the current layer. Once I selected options, I couldn't use the Undo option.
LAYOFF: Layer Off (bnslayer.lsp). This routine is identical to LAYFRZ, except that it turns layers off rather then freezing them. LAYOFF permits you to turn off the current layer, but it will issue a warning before doing so.
LAYLCK and LAYULK: Layer Lock and Layer Unlock (bnslayer.lsp). These two routines are simpler then LAYOFF and LAYFRZ. They lock/unlock the layer of one selected object. The nesting options do not exist in these two commands.
LAYOFF and LAYON: Layer Off and Turn All Layers On (bnslayer.lsp). These two routines are not in the Bonus toolbars. They appear only in the pulldown menu. Simply put, they turn off or on all of the layers in the drawing. Remember, if a layer is frozen, these routines will not affect those frozen layers.
I only made a dent in the Bonus routines. There are many more great tools to go. Be sure to experiment and try them on your own. You'll find the HELP function does a great job of explaining most of these tools. The bonus routines are really the icing on the cake as far as I'm concerned, comprised of some priceless goodies we can all use to our benefit.
About the Author: Lynn Allen
For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX. Visit the Equipped Mold Designer here!
For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP. Visit the Equipped Architect here!