Need help with deleting overlapping objects.

Need help with deleting overlapping objects.

abdul.raufJJ89F
Advocate Advocate
1,325 Views
4 Replies
Message 1 of 5

Need help with deleting overlapping objects.

abdul.raufJJ89F
Advocate
Advocate

Hi,
I need help regarding deleting overlapping objects (blocks), I tried overkill command but it is not working.
As I am a new user can somebody provide me with the lisp with the following conditions that it ask the user to select objects (by window selection) and delete any overlapping objects (partially or fully) irrespective of their color or name.

I have attached the sample dwg file.
Thanks

0 Likes
1,326 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant

@abdul.raufJJ89F wrote:

....
As I am a new user can somebody provide me with the lisp....


 

Oh, that should be the reason for us to provide you anything? Really? I would expect something like "Can you recommend me some book that I could start learning" or "I searched the whole Internet, found this but here is this I don't understand..., can you help me?"

 

So maybe I just expecting too much... so here is something simple that you can learn from... if that's why you're here.

 

(defun c:BlockOverlaps (/ LM:UniqueFuzz-p ss i ent pnt lst fuz sn)
  
  ;; Unique-p with Fuzz  -  Lee Mac
  ;; Returns T if a list contains items considered distinct to
  ;; a given tolerance
  
  (defun LM:UniqueFuzz-p ( l f )
    (or (null l)
	(and (not (vl-some (function (lambda ( x ) (equal x (car l) f))) (cdr l)))
	     (LM:UniqueFuzz-p (cdr l) f))))
  
  ; -----------------------------------------------------------------------
  
  (if (and (setq fuz 220)
	   (setq sn (ssadd))
	   (setq ss (ssget '((0 . "INSERT"))))
	   )
    (repeat (setq i (sslength ss))
      (setq ent (ssname ss (setq i (1- i)))
	    pnt (cdr (assoc 10 (entget ent))))
      (if (LM:UniqueFuzz-p (cons pnt lst) fuz)
	(setq lst (cons pnt lst))
	(ssadd ent sn))))
  (command "_.REGEN")
  (if (> (sslength sn) 0)
    (sssetfirst nil sn))
  (princ)
  )
Message 3 of 5

pendean
Community Legend
Community Legend

That's more than just an overlap my friend 

 

Capture.PNG 

 

 

0 Likes
Message 4 of 5

john.uhden
Mentor
Mentor

1 dislike.

Stop feeding the hungry; they are probably already overweight.

John F. Uhden

0 Likes
Message 5 of 5

gameschess
Contributor
Contributor
A LISP would be overkill.. heh... When you run the overkill command you need to set your tolerance. Measure the distance between the objects and set that to your tolerance... In this case... try 300, it will remove any duplicate objects within 300' of each other.... the problem is... which one do you want to keep? 300' is a lot to simply be an "overlap"
0 Likes