Jump to content

Overkill 'match' selectionsset


Aftertouch

Recommended Posts

Hello everybody.

Got myself a tough one again...

ย 

When i use the 'overkill' command, a bunch of lines are deleted.

It is possible to create a selectionset of the remaining line after a delete action is exectued...

ย 

so when overkill detects a dublicate, it deletes one object, and adds the other one to a new selection set.

Too bad overkill isnt a LSP anymore... ๐Ÿ˜ž

Edited by Aftertouch
Link to comment
Share on other sites

You have to implement OVERKILL command inside LISP and then instead of using OVERKILL command you use LISP instead...

Try this - it worked for me :

ย 

(defun c:selremainafteroverkill ( / unique *adoc* fuzz ss el rl dl p s i e k kk f ff eel )

  (vl-load-com)

  (defun unique ( l )
    (if l
      (cons (car l) (unique (vl-remove (car l) l)))
    )
  )

  (setq *adoc* (vla-get-activedocument (vlax-get-acad-object)))
  (if (= 8 (logand 8 (getvar 'undoctl)))
    (vla-endundomark *adoc*)
  )
  (vla-startundomark *adoc*)
  (initget 6)
  (setq fuzz (getreal "\nFuzz factor for OVERKILL <1e-4> : "))
  (if (null fuzz) (setq fuzz 1e-4))
  (setq sss (ssadd))
  (setq ss (ssget "_A" (list (cons 410 (if (= 1 (getvar 'cvport)) (getvar 'ctab) "Model")))))
  (if ss
    (progn
      (setq el (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
      (ssget "_:L")
      (vl-cmdf "_.-overkill" "_p" "" "_o" fuzz "_i" "_a" "_p" "_y" "")
      (foreach ee el
        (if (entget ee)
          (setq rl (cons ee rl))
          (setq dl (cons ee dl))
        )
      )
      (vl-cmdf "_.undo" "1")
      (setq k 0 kk 0)
      (foreach ee dl
        (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartpoint (list ee))))
          (progn
            (setq p (vlax-curve-getpointatparam ee (/ (+ (vlax-curve-getstartparam ee) (vlax-curve-getendparam ee)) 2.0)))
            (setq p (trans p 0 1))
            (setq s (ssget "_C" p p))
            (if s
              (progn
                (repeat (setq i (sslength s))
                  (if (vl-position (setq e (ssname s (setq i (1- i)))) rl)
                    (ssadd e sss)
                  )
                )
              )
              (progn
                (setq k (1+ k))
                (setq f t)
              )
            )
          )
          (progn
            (setq eel (cons (vl-remove-if '(lambda ( x ) (vl-position (car x) '(-1 5 6 8 39 43 62 347 370 380 390 420 430 440))) (entget ee)) eel))
            (setq kk (1+ kk))
            (setq ff t)
          )
        )
        (entdel ee)
      )
    )
  )
  (foreach ee rl
    (if (vl-member-if '(lambda ( x ) (equal (vl-remove-if '(lambda ( y ) (vl-position (car y) '(-1 5 6 8 39 43 62 347 370 380 390 420 430 440))) (entget ee)) x 1e-6)) eel)
      (ssadd ee sss)
    )
  )
  (if (/= (sslength sss) 0)
    (progn
      (prompt "\nEntities that haven't been erased by OVERKILL are highlighted - there are : ") (princ (sslength sss)) (prompt " entities in remaining sel.set... Selection set is stored in \"sss\" variable...")
      (sssetfirst nil sss)
    )
    (setq sss nil)
  )
  (if f
    (progn
      (prompt "\nSome entities that are OVERKILLED are curves but placed out of visible screen during operation, so those remaining overlap entities couldn't be highlighted... Total OVERKILLED of these curves : ") (princ k)
    )
  )
  (if ff
    (progn
      (prompt "\nSome entities that are OVERKILLED don't belong to curves... Those entities belong to : ") (prin1 (unique eel)) (prompt " entity types... Total OVERKILLED these entity types : ") (princ kk)
    )
  )
  (vla-endundomark *adoc*)
  (princ)
)

HTH., M.R.

Edited by marko_ribar
  • Thanks 1
Link to comment
Share on other sites

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