Click point within boundary with selection enclosing object

Click point within boundary with selection enclosing object

martin_leiter
Advocate Advocate
1,253 Views
7 Replies
Message 1 of 8

Click point within boundary with selection enclosing object

martin_leiter
Advocate
Advocate

Hello, I have the following problem: I have a rectangle that also belongs to an Autocad group. How do I manage to select the rectangle and autocad group just by clicking in the empty area inside the rectangle without selecting an object. The click point is already stored in a variable. Ask for your help. Thank you!

0 Likes
Accepted solutions (1)
1,254 Views
7 Replies
Replies (7)
Message 2 of 8

Moshe-A
Mentor
Mentor

@martin_leiter hi,

 

well it depends on what do you want to do with the rectangle. if you want to know is the coordinates of it?

use -BOUNDARY command, the result is a copy of your rectangle.

(to modify it, you have to iterate the group)

 

moshe

 

 

 

0 Likes
Message 3 of 8

martin_leiter
Advocate
Advocate

Hello Moshe, I need the Autocad group in a selection set so that I can pass the selection set at the command "Group select" with the command "Groupedit".

Thank you

0 Likes
Message 4 of 8

Moshe-A
Mentor
Mentor
0 Likes
Message 5 of 8

martin_leiter
Advocate
Advocate

Hello Moshe, thanks for your help. I do not need the group name. I am looking for a possibility without directly choosing the object to get the group into a selection set. Thank you

0 Likes
Message 6 of 8

ВeekeeCZ
Consultant
Consultant
Accepted solution

This selects everything that is closing the picked area. A group selection is applied. 

 

(vl-load-com)

(defun c:ClickInsideToSelect ( / ops enl pts sel)

  (and (setq ops (getvar 'pickstyle))
       (setvar 'pickstyle 1) ; make sure group selection is active
       (setq enl (entlast))
       (setvar 'cmdecho 0)
       (princ "\nPick inside a group: ")
       (vl-cmdf "_.BOUNDARY" pause "")
       (not (equal enl (setq enl (entlast))))
       (setq pts (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) (entget enl))))
       (vl-cmdf "_.ERASE" enl "")
       (setvar 'cmdecho 1)
       (setq sel (ssget "_CP" pts))
       (sssetfirst nil sel)
       )
  (setvar 'pickstyle ops)
  (princ)
  )

 

0 Likes
Message 7 of 8

martin_leiter
Advocate
Advocate

Hello BeekeeCZ, thank you very much for your help. I do not have access to my autocad at the moment. But that looks very good! I will report on Monday as soon as I have tested it. Thank you!

0 Likes
Message 8 of 8

martin_leiter
Advocate
Advocate

Hello BeekeeCZ, Thank you! It works perfectly! That's exactly what I missed!

0 Likes