Select and highlight groups

Select and highlight groups

carlos_m_gil_p
Advocate Advocate
134 Views
3 Replies
Message 1 of 4

Select and highlight groups

carlos_m_gil_p
Advocate
Advocate

Hi guys, how are you?
I wanted to ask you a question.
What filter do you use to select groups with ssget?
I've tried all kinds of filters and haven't been able to.
Or if you have any functions that could help me, I'd appreciate it.
The goal is to select a screen with ssget and highlight only the selected groups.
I've attached a dwg with some groups and an image of what I want to achieve.
Thank you very much in advance.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Accepted solutions (1)
135 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor
Accepted solution

try this code:

; selgrpall function selections & highlights entities in all groups
; modified from
; selgrp 
; By Gopinath Taget
; https://adndevblog.typepad.com/autocad/2012/12/how-to-add-a-group-in-a-selection-set-from-an-autolisp-function.html
(defun selgrpall (/ a1 ent GetGroupList grp grplst ss ) ; (grpname)
; GetGroupList retrieves all group names and return as a list 
 (defun GetGroupList (/ grp grpList)
  (setq grp (dictsearch (namedobjdict) "ACAD_GROUP")) ; Get the ACAD_GROUP dictionary
  (setq grpList (list)) ; Initialize an empty list for group names
  ; Loop through the dictionary entries to extract group names (group code 3)
  (while (/= (assoc 3 grp) nil) 
    (setq grpList (cons (cdr (assoc 3 grp)) grpList)) ; Add the group name to the list
    (setq grp (cdr (member (assoc 3 grp) grp))) ; Move to the next entry
  )
  (reverse grpList) ; Return the list of group names in the correct order
 ) ; defun
; main function
 (if (setq grplst (GetGroupList)) ; if groups
  (progn ; then
   (setq grp (dictsearch (namedobjdict) "ACAD_GROUP"))
   (setq ss (ssadd)) ; initialize selection set
   (foreach grpname grplst ; cycle through each group
    (setq a1 (dictsearch (cdr (assoc -1 grp)) grpname))
    (while (/= (assoc 340 a1) nil)
      (setq ent (assoc 340 a1))
      (setq ss (ssadd (cdr ent) ss))
      (setq a1 (subst (cons 0 "") ent a1))
    ) ; while
   ) ; foreach
   (sssetfirst nil ss) ; highlight the selection set set
  ) ; progn
 ) ; if
) ; defun 
(load "selgrpall")
(selgrpall)

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 4

carlos_m_gil_p
Advocate
Advocate

Hi bro, thanks for your help. Select all in the drawing.
I needed to use an ssget selection, but now with this, I can modify it myself.
Thank you so much from the bottom of my heart.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 4 of 4

paullimapa
Mentor
Mentor

you are welcome...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes