CADTutor: The best free help for AutoCAD on the web

Michael BeallMichael’s Corner #111
March 2012

Customizing For Fun & Profit

by Michael Beall

OK, it may not be necessarily for 'Profit', but I think customizing is fun, and hopefully some of you will agree. After checking out these ideas, perhaps your productivity will go up, and you will 'profit' from some time-savings!

The topics from the trenches (I just made that up; you can use it) for this month include…

…Automating the 'No Island' setting for hatching on a Tool Palette
…Making a button on the QAT to set your favorite Osnap conditions
…Configuring the Ctrl + F keyboard shortcut to be more 'Windows-compliant'
…Using the Delete Duplicate Objects command to clean up your drawing

Hope you're looking forward to Spring as much as I am!

If you would like to contact me directly, you can do that also.

Blessings to one and all,
Michael

Change the Quick Preview in Hatch to ‘No Islands’

Drawing with hatching“Live and Learn”. That's why I love training AutoCAD, because during any given month of training, I'm going to bump into another way of doing something. Such as hatching an object that has 'islands' in it, but more specifically, how to put it on a Tool Palette button.

Case in point, you place a rectangle/pline around an area on the floor plan that is, say, the Accounting Department. Now you want to hatch that area, but by default, when you hover in a closed area with furniture 'islands', the hatch goes around the furniture.

Driven from the Tool Palette, you will need 2 buttons. The first one will set the HPISLANDDETECTION variable to <2>, which means 'No Islands'. The second button you will need will be one with the hatch you want to place.

How to Automate a 'No Islands' Hatch

  1. Create new commandOpen your Tool Palette (Ctrl + 3), then right-click on the title bar and click Customize Commands. This opens up a nominal view of the CUI.

  2. Just above the Command list, click the button for Create A New Command. This will add Command 1 to the list of commands.

  3. Now, drag Command 1 out of the list and drop it onto the palette. You will see a white box labeled Command 1.

  4. Right-click on the Command 1 box, the click Properties and change the Command String to read as follows:

    ^C^CHPISLANDDETECTION;2

  5. Change the name of your button to something like 'No Islands', then click OK to save your changes and close Properties.

    Now you'll want to draw a hatch on the desired layer with the settings you will want to use each time you hatch a Department or when you will want to select an object for hatching.

    Properties

    In this exercise, I created a crosshatch pattern using the User Defined hatch pattern with a distance of 6″ at an angle of 45 degrees.

  6. After configuring the hatch properties, add the hatch to your drawing.

  7. Drag to the paletteAfter the hatch has been placed, click on the hatch to select it, then click on a line of the hatch and drag and drop it onto the tool palette.

At this point, the next time you have created a shape around an area in your drawing, and you want to hatch the shape and not go around the 'islands' in the drawing, click the No Islands button, then click your hatch button and add the hatch!

Note: Curiously, there is also the variable HPISLANDDETECTIONMODE which has a range of 0 or 1. I left this variable set to <1>. It relates to 'legacy island detection', so I'm going to have to dig into this one at a later date. Just FYI.

Top of page

Power Tool

OSMODE on the QAT

It's been 8 years since I covered this, and I encountered a need for it last month, so let's take a quick look at adding yet another button to the Quick Access Toolbar.

Why is it that all the crazy things in AutoCAD happen when you're in a hurry?? You go to snap to something, and for some reason your Osnap is Off. Wouldn't it be cool if you could just hit a button and have the Osnap settings just the way you want 'em? The variable OSMODE contains a bitcode that represents the current collection of object snaps you have turned on.

This exercise shows you how to identify the OSMODE value for your favorite settings, then make a button to retrieve that value.

How to Add a Custom Osnap Button to the QAT

  1. On the Status bar, right-click OSNAP, then click Settings to open the Drafting Settings dialog box on the Object Snap tab.

  2. Check the boxes for your favorite(s), then click OK. I'm just going to set it to Node.

  3. At the command line, type OSMODE, then press [Enter] to see the value for the snaps you selected. The OSMODE value is derived from the current setting of snaps on the Drafting Settings tab. For Node snap only, the value is <8>.

    Create a new commandGold Star Tip: To find how the OSMODE variable is calculated, go to Express Tools tabTools panelSystem Variable Editor. Scroll down the list and click OSMODE to see the bitcode used to calculate the value.

  4. Open the CUI. Under Command List, click Create a New Command to create Commandx.

  5. Click your new 'Commandx' to open the Properties panel on the right side of the CUI.

    Properties panel
  6. Drag to the QATAdd the values similar to those shown in this figure for Name, some type of Description, and Command Display Name. Your button will now be alphabetized in the Command list.

  7. Edit the Command String field to read as follows (notice the apostrophe at the beginning)

    'OSMODE;8;

    The apostrophe runs the OSMODE command transparently. Since you usually discover that the Osnap is off when you're in the middle of a command, this button will set the Osnap while the command is still running.

  8. At this point, click Apply to apply your edits to your new command.

  9. To add your new button to the Quick Access Toolbar, drag it from the Command list and release it where you want it up on the Quick Access Toolbar. You should be good to go!

Top of page

The Odd Spot

Change Ctrl + F to Find

Drag to the Customizations paneMany of you may use Ctrl + S in Word or Excel or AutoCAD to Save your file. When you're in Word or in your browser, you can use Ctrl + F to launch the Find routine. Except in AutoCAD… where it toggles your Osnap On and Off.

So let's say we set Ctrl + F to be the Find command!

How to Assign the Find Command to Ctrl + F

  1. Open the CUI dialog box by typing CUI at the command line.

  2. In the Customizations pane, expand Partial CUI Files, then expand Custom. Now expand the Keyboard Shortcuts node.

  3. Under Command List, drag the Find command up into the Customizations pane and release it next to Shortcut Keys to add it to the listing.

    Note: If the recently added command does not initially appear in the Shortcuts pane, you may have to OK out of the CUI, then re-open it.

  4. ShortcutsIn the Shortcuts pane next to the Find command, click in the Keys column to display an edit box — confirm NumLock is Off — then hold down Ctrl + F and press [Enter]. The Find command will now alphabetize in the list, and you should now see a green checkmark in the column preceding the Find command name.

  5. Click OK to close out of the CUI, then hit Ctrl + F to launch Find!

Top of page

The Basics

Delete Duplicate Objects [Overkill]

Delete Duplicate ObjectsIt's not uncommon to find objects that are copied on top of each other. Sometimes you do it because you forget that the Copy command is now in Multiple mode by default, or sometimes you simply 'discover' duplicates.

The Delete Duplicate Objects command was made for just those occasions.

Note: You can also type OVERKILL to launch this command, too.

How to Use Delete Duplicate Objects

  1. To set this up, open a drawing, then copy something on top of itself.

  2. On the expanded Modify panel (Home tab), click Delete Duplicate Objects.

    PurgeNote: Yes, the Delete Duplicate Objects icon looks virtually identical to the Purge 'broom', which is why I didn't see it at first. Purge is located on the File pulldown menu or in the Application menu (red 'A')Drawing Utilities. But most folks just type PU (the alias for Purge).

  3. When prompted, you can select the area where you suspect duplications, or type ALL to select all the objects in the drawing.

  4. Press [Enter] after selecting objects, and the dialog box comes up with the default settings.

  5. I find that the defaults are just fine, so click OK and you will get a report regarding what was deleted.

    207 duplicate(s) deleted
    1202 overlapping object(s) or segment(s) deleted

Top of page

Left Field

Chicago = Garrett's
Of all the places I have traveled, my favorite US destination continues to be Chicago. I've been going there since the mid-80's and I continue to enjoy being up there. I first discovered Garrett Popcorn Shops early on in my visits downtown, and although they closed everybody's favorite Michigan Avenue location, the devoted will make the necessary adjustment. If you find yourself in Chicago and have a passion for caramel corn, you have to check 'em out. http://www.garrettpopcorn.com

Share this page:

Share at Facebook Submit a link at Reddit Share at StumbleUpon Share at del.icio.us Share at Technorati

Local Navigation

Sponsored Links

Accessibility statement

Valid XHTML 1.0!Valid CSS!Creative Commons Licence