Jump to content

Recommended Posts

Posted

Hi, I need an AutoLISP routine for AutoCAD that performs an OVERKILL-equivalent cleanup directly inside block definitions, without manually opening each block using BEDIT or REFEDIT.

The routine should iterate through the drawing’s BlockTable records / block definitions and process the geometry contained inside each eligible block definition.

Technical requirements:

Process normal user-created block definitions directly.

Do not explode block references.

Do not require manually opening or closing each block.

Skip Xrefs, layout blocks, anonymous/system blocks, and any block definitions that should not be modified.

Process nested block definitions as well, while avoiding infinite loops or repeated unnecessary processing.

Remove duplicate and overlapping entities in a way equivalent, or as close as technically possible, to AutoCAD's OVERKILL command.

Preserve the original block structure, insertion points, attributes, dynamic block functionality, layers, colors, linetypes, and other entity properties.

Avoid modifying block references themselves unless absolutely necessary.

Prefer operating directly on the entities stored in each BlockTableRecord rather than entering Block Editor.

Ideally, the routine should also:

Purge or ignore invalid/erased objects safely.

Handle common geometry types such as Lines, Polylines, Arcs, Circles, and similar entities.

Use an appropriate geometric tolerance for duplicate detection.

Provide a final report showing:

Number of block definitions processed.

Number of blocks skipped.

Number of duplicate/overlapping entities removed, if detectable.

Any blocks that failed to process.

My main goal is to run one command on a drawing and automatically clean duplicate geometry inside all blocks, including nested blocks, without manually opening each block one by one.

Please also advise whether this can be implemented reliably in pure AutoLISP / Visual LISP, or whether a C# AutoCAD .NET plugin would be a better approach, especially if the native OVERKILL command cannot operate directly on BlockTableRecord entities.
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...