Jump to content

Selects everything that touches pre-selected objects


Recommended Posts

Mr Tusky, I appreciate you, realy it is a good job. Thanks


So how do choose those who touch the blocks?



Link to comment
Share on other sites

For blocks you are forced to use the code I edited which only processes the selected entity: the reason is that I use (nentsel) to retrieve the nested entity, which I cannot do with a (ssget) as in the code I put in the attached file.

Link to comment
Share on other sites

If touch means only requires accuracy at the level of a rectangle circumscribing the selected object.

It can be implemented simply like this.

; TOUCHSEL - exceed 2024.06.25
; Selects all objects that touch the selected object's bounding boxes.

(defun c:TOUCHSEL ( / ss ssl i ss_all ent obj bbox llp urp ss2 ss2l j ent2 )
  (if (setq ss (ssget))
      (setq ssl (sslength ss))
      (setq i 0)
      (setq ss_all (ssadd))
      (repeat ssl
        (setq ent (ssname ss i))
        (setq obj (vlax-ename->vla-object ent))
        (setq bbox (vla-getboundingbox obj 'll 'ur))
        (setq llp (vlax-safearray->list ll))
        (setq urp (vlax-safearray->list ur))
        (if (setq ss2 (ssget "C" llp urp))
            (setq ss2l (sslength ss2))
            (setq j 0)
            (repeat ss2l
              (setq ent2 (ssname ss2 j))
              (setq ss_all (ssadd ent2 ss_all))
              (setq j (+ j 1))
        (setq i (+ i 1))
      (sssetfirst nil ss_all)



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.

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