Wednesday, December 05, 2007

Delete Duplicates

OVERKILL

Have you ever had a drawing (from an outside source of course) with lines atop lines, or multiple line segments used where a single line would serve? There's an AutoCAD Express Tool to help with cleaning up such drawings. Start the OVERKILL command from pull down:

Express > Modify > Delete Duplicate Objects

The following dialog is displayed (shown with default options):

So what's it do? Primarily it deletes duplicate entities: text on top of text, blocks on top of blocks, lines on top of lines, plines on top of plines, etc. Where there were multiple entities that are exactly the same in size, position, orientation, etc. only one remains after running OVERKILL.

The dialog allows you to set certain comparison options.

  • The Numeric Fuzz - this value specifies how far off the geometry can be and still be considered duplicate. Increase this value if you have multiple lines, blocks, text, etc. almost on top of one another, but just ever so slightly shifted. (Which one is kept is anyone's guess.)
  • All the Ignore toggles tell OVERKILL to treat identical objects as one that may reside on different Layers, have discreet Colors, Linetypes, etc. Use in any desired combination.
    In this example there are two north arrow blocks, one slightly offset from the other. I've changed the color of one of the blocks to red to make it more apparent. Running OVERKILL with the Ignore Color toggle checked, and a fuzz factor greater than the offset, leaves just one north arrow block. Oh look, it's the red one.
  • I recommend unchecking the PLINES optimization, for the first run anyway. This option examines plines for excess vertices and segments that track back upon themselves. It's a powerful and useful option, but it really slows down the comparison process. I'd run it in a subsequent session and limit it to just some of the plines at a time.
    The left Pline shows the original vertices. Run OVERKILL with Pline optimization to obtain the right Pline.
  • The OVERLAP toggle tells OVERKILL to treat co-linear entities as one if they partially overlap.
  • The END to END toggle combines co-linear objects whose endpoints touch (or are within the fuzz factor).

    In this example the top part has lines that overlap, as indicated by the black and red lines, and lines that almost touch. Running OVERKILL with the Ignore Color toggle checked, and a fuzz factor greater than the gap, results in the two lines below.
If you're very brave, and really understand this command and its options, you can even run it against multiple drawings using a script and the command line version, -OVERKILL.
Command: -OVERKILL
Select objects: 2144 found
Select objects:
IGNORE=Color
Fuzz=0.000001, Optimize PLINES=Y, etc...
Enter an option to change
[Ignore/Fuzz/Plines/parTial/Endtoend] <done>:

Hint: You probably want to do this on a copy of the drawings.