Dear all,
I try to overkill duplicated lines in all blocks in drawing.
I used this Lee's lisp, but now it's not working for this block, please help me to fix.
Autolisp code:
;;http://www.cadtutor.net/forum/showthread.php?48469-Overkill-all-including-blocks&s=d39932f12a90fe5c87c3c8528193bf09
;; Line Kill - Lee Mac
;; Removes duplicate or zero-length lines from the drawing and
;; also from within blocks and nested blocks.
(defun c:LKILL ( / dup lck lst p1 p2 tol zln )
(setq tol 1e-8 ;; Tolerance
zln 0
dup 0
)
(vlax-for lay (vla-get-layers (LM:acdoc))
(if (= :vlax-true (vla-get-lock lay))
(progn
(setq lck (cons lay lck))
(vla-put-lock lay :vlax-false)
)
)
)
(vlax-for blk (vla-get-blocks (LM:acdoc))
(if (= :vlax-false (vla-get-isxref blk))
(vlax-for obj blk
(cond
( (/= "AcDbLine" (vla-get-objectname obj)))
( (equal 0.0
(distance
(setq p1 (vlax-get obj 'startpoint))
(setq p2 (vlax-get obj 'endpoint))
)
tol
)
(setq zln (1+ zln))
(vla-delete obj)
)
( (vl-some
(function
(lambda ( x )
(and (equal (car x) p1 tol) (equal (cadr x) p2 tol))
)
)
lst
)
(setq dup (1+ dup))
(vla-delete obj)
)
( (setq lst (cons (list p1 p2) lst)))
)
)
)
(setq lst nil)
)
(foreach layer lck
(vla-put-lock layer :vlax-true)
)
(vla-regen (LM:acdoc) acallviewports)
(if (< 0 zln)
(princ (strcat "\n" (itoa zln) " zero-length line" (if (= 1 zln) " removed." "s removed.")))
(princ (strcat "\nNo zero-length lines found."))
)
(if (< 0 dup)
(princ (strcat "\n" (itoa dup) " duplicate line" (if (= 1 dup) " removed." "s removed.")))
(princ (strcat "\nNo duplicate lines found."))
)
(princ)
)
;; Active Document - Lee Mac
;; Returns the VLA Active Document Object
(defun LM:acdoc nil
(eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
(LM:acdoc)
)
(vl-load-com)
(princ)
My block (see attached file)
Thanks,
Miquan