Jump to content

Block Overkill (Free LISP for you)


Recommended Posts

Posted (edited)

Hi guys,

 

As thanks for helping me out through the journey of AutoLISP from multiple posts, I've decided to make a small contribution to CADTutor.net with my own code that you can download from here:

https://www.cadtutor.net/forum/files/file/27-block-overkill/

 

Upon issuing the BOVERKILL command, This LISP will allow you to either delete blocks that area "duplicated" on top of one another, or move them to a specified layer. This LISP deletes blocks in which the blocks in comparison abides to the following three criteria below:

 

  1. It shares the same insertion point to a specified tolerance
  2. It shares the same effective name
  3. It shares the same effective scale to the same specified tolerance

 

Modes of Overkill

Thanks to a wonderful suggestion from one of the insights in this forum, the program has been further upgraded as of 20 April 2023. This LISP routine now also allows for three modes of overkill:

 

  1. Distance
  2. Plane-Axis
  3. Axes

 

The "Distance" mode is the default mode and is the most widely used mode of overkill. This mode determines that two blocks are considered duplicates if the distance between them is within the specified tolerance inputted by the user.

 

The "Plane-Axis" mode determines that two blocks are duplicates if the proximity of the blocks in comparison lies within one tolerance specified for one of the planes , and a separate tolerance along the third axis (normal) of that plane. Calculations are done to the UCS.

 

The "Axes" mode determines that two blocks are duplicates by comparing three different tolerances across each axis individually. All three tolerances must be met for the program to consider the blocks a duplicate. Just like the previous mode, the UCS will be used by the program to perform the calculations.

 

 

Following this, the program will also draw a circle (of a radius set within the LISP routine) on the insertion points of the processed blocks. These circles will be drawn in the "BOVERKILL-Duplicates" layer. After which it prints a report of the quantity of the deleted or modified blocks to the command line. This feature makes it easy for users to identify where duplicates are found on a large drawing with thousands of blocks.

 

However, the dynamic properties of the block are far too hard for me to calculate as they have different position, rotation and visibility parameters that could be altered by the user. As such, they are ignored.

 

Note that the rotation of the block does not fall in the criteria above as mirroring the block alters it's rotation values, and thus will fail on some circumstances. This means that the blocks will still be processed if as long as the three criteria above satisfy and objects are not rotated the same way.

 

This LISP was inspired when using block counting routines (for example from Lee Mac's Block Counter routine or your own custom routines) reporting incorrect numbers due to duplicate blocks. The OVERKILL command for one reason or another is not able to delete duplicate dynamic blocks that are (for example, rotated normally then rotate through dynamic rotation to the original position). I've also cycled through the net for solutions to no avail. Thus, I opened this program for you folks to use.

 

It's not a perfect code but I hope it will make working for you much more convenient.

 

Any feedbacks, comments, and criticisms are welcomed as I look to learn and get better. Enjoy.

 

Thanks,

Jonathan Handojo

Edited by Jonathan Handojo
Updated to include the three modes of the overkill
  • Like 3
  • Thanks 3
Posted

Thanks Jonathan, a useful routine.

 

How I can I modify the routine so that instead of the duplicate block being deleted it instead is moved to a pre-specified layer?

 

Regards

Patrick

Posted
5 hours ago, Least said:

Thanks Jonathan, a useful routine.

 

How I can I modify the routine so that instead of the duplicate block being deleted it instead is moved to a pre-specified layer?

 

Regards

Patrick

 

You're welcome Patrick.

 

Good suggestion. I've modified the program to do as requested.

  • Like 1
Posted (edited)

Sorry folks, I just realised a small mistake in my code which would somehow give unexpected results. I've now amended for this in the new version. I hope this is the end of all bugs.

Edited by Jonathan Handojo
  • 3 weeks later...
  • 2 years later...
Posted

Hi guys. I'm Polat from Türkiye. All tte time thinking about how can ı delete double blocks becaues original overkill command not working but boverkill always deleted. Thank you very much bro. You are amazing🙏

  • 7 months later...
Posted (edited)

Awesome code, I was wondering if it was possible to have a tolerance for elevation.
That way it can be used as a fast way to delete irrelevant spot levels that are only 20mm apart from one another etc.
ie. Delete duplicate spot levels that are within 100mm of each other and only differ in elevation by about 10-20mm

Edited by KraZeyMike
Posted
On 3/28/2023 at 10:08 AM, KraZeyMike said:

Awesome code, I was wondering if it was possible to have a tolerance for elevation.
That way it can be used as a fast way to delete irrelevant spot levels that are only 20mm apart from one another etc.
ie. Delete duplicate spot levels that are within 100mm of each other and only differ in elevation by about 10-20mm

 

If I understood correctly, for example, if the blocks are within 100mm of each other along the XY-plane, but are only within 20mm of each other along the Z-axis, then delete the block?

 

It's certainly possible.

  • 3 weeks later...
Posted
On 31/03/2023 at 12:34, Jonathan Handojo said:

 

If I understood correctly, for example, if the blocks are within 100mm of each other along the XY-plane, but are only within 20mm of each other along the Z-axis, then delete the block?

 

It's certainly possible.


Exactly, a lisp like that would be invaluable for large amounts of spot elevations

Posted

...Being able to specify the XY Plane tolerance and then the Z-Axis tolerance would be a dream come true, I am just not yet good enough at lisp to amend this routine correctly.
Any help would be greatly appreciated. 

Posted
On 4/19/2023 at 10:58 AM, KraZeyMike said:

...Being able to specify the XY Plane tolerance and then the Z-Axis tolerance would be a dream come true, I am just not yet good enough at lisp to amend this routine correctly.
Any help would be greatly appreciated. 

Hi,

 

Thanks to your suggestion, this program has now been upgraded. Your issue should now be resolved in this newer version of the program. Let me know if the calculation are failing, as I did not have many chances to try this on a larger scale.

  • Thanks 1
Posted
14 hours ago, Jonathan Handojo said:

Hi,

 

Thanks to your suggestion, this program has now been upgraded. Your issue should now be resolved in this newer version of the program. Let me know if the calculation are failing, as I did not have many chances to try this on a larger scale.

Awesome :) 

You probably get this all the time, but I think you are an absolute legend!

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...