Friday, March 30, 2007

Making a Selective Purge Button

Someone asked if there were an easy way to purge some, but not all, unused items in their drawing. For instance they do not want to purge unused layers. They have prepopulated their architectural background with all the anticipated architectural layers and don't want lose them.

A previous purge tip shows how to selectively purge items with the Purge dialog; however, the user simply wants a button that will purge all unused Blocks, Linetypes, Mline styles, Plot styles, Shapes, Table styles, and Text styles but NOT the Layers or Dimension styles. It's a fair request, and it sounds like a good job for a Toolbar button macro or Tool Palette macro.

Welcome to CUI 101!

Type CUI at the command line to bring up the Customize User Interface dialog. We're going to work this dialog from the upper left down, then from upper right down.

In the "Customizations" section, set your CUI to Custom.cui, (this is so we don't modify or "mess up" the default ACAD.CUI). Select the Toolbars branch, right-click, and add a new toolbar named Utilities.

In the Command List section, use the New button to add a new command macro.

Select the broom for the Button Image.

Use the Properties section to rename your new command macro to Selective Purge. Change the Macro to run the PURGE command with desired responses:


Does this look like gobbledygook? We need to use the command line version of PURGE to be able to place the command and responses into a macro. Let's dissect this macro: The ^C^C represents two Escapes (this gets us out of whatever command might be active when we click on the button). Then we run the MULTIPLE command to repeat the next command, -PURGE (command line version), until canceled. The semi-colons act as Enters. Then use B for Block, * for all, and answer the prompt to verify each item to be purged with N for No. Then we do the same sequence for LT (Linetypes), P (Plotstyles), SH (Shapes), ST (Text Styles), M (Multiline Styles), and finally R (Registered applications). The last ^C (Esc) cancels the MULTIPLE command.

The last step is to drag our new command onto our new toolbar. Select the Selective Purge command from the Command List and drag it up to the Utilities toolbar in the Customizations tree (clumsily illustrated above).

Now that we have a Toolbar with a Selective Purge command, you can also drop the new command onto a Tool Palette. Make sure that your new Toolbar is displayed and open your Tool Palette window (Ctrl+3). Right-click the title bar of the tool palette and click Customize Palettes... Now drag the button from the toolbar to the desired palette. The black horizontal line indicates where the command will be placed. Close the Customize dialog.

Wednesday, March 21, 2007

Boxing your Text

Use the Express Tool TCIRCLE to place a box around text.

Command: TCIRCLE
Select objects: [select your text]
Enter distance offset factor <0.35>: [Enter]
Enclose text with [Circles/Slots/Rectangles] <circles>: R
Create rectangles of constant or variable size [Constant/Variable] <variable>: C
Maintain constant rectangle [Width/Height/Both] <both>: [Enter]

Depending on your Text type, you will get different results with this tool. Whereas the TCIRCLE command works well on Mtext and individual lines of text, it doesn't do particularly well for paragraphs of Dtext. For this, consider using the TBGBOXTEXT command.

TCIRCLE and Mtext

TCIRCLE and Dtext


Note: the command TBGBOXTEXT is an older command on the Benham (my company) menu and as such is not available to non-Benham users.

You can choose to enclose your text with a rectangle (as above), a slot (shown below), or a circle.

The prompts for constant or variable size control whether TCIRCLE creates objects that just fit the selected text or are the same size for all selected text.

Using Slots with Constant size

Using Slots with Variable size

AutoCAD 2007 Distance Quirk

An interesting change to the AutoCAD distance command occurred in the 2007 release. When using object snaps to query distances of model space objects from paper space, you're now given the model space distance. Compare this to previous versions where you first needed to make model space active to query model space distances.

For example: consider this simple plan in a viewport at a scale of 1/8"=1'-0". Using AutoCAD 2006, execute the distance command from paper space and snap to the end points of the top line.

Command: DIST
Specify first point: [pick left endpoint]
Specify second point: [pick right endpoint]
Distance = 0'-4 1/2", Angle in XY Plane = 0, Angle from XY Plane = 0
Delta X = 0'-4 1/2", Delta Y = 0'-0", Delta Z = 0'-0"

Now perform the same operation using AutoCAD 2007 and compare the results.

Command: DIST
Specify first point: [pick left endpoint]
Specify second point: [pick right endpoint]
Distance = 36'-0", Angle in XY Plane = 0, Angle from XY Plane = 0
Delta X = 36'-0", Delta Y = 0'-0", Delta Z = 0'-0"