Visual LISP program (SSGET, GROUPS, and MOVE)

Visual LISP program (SSGET, GROUPS, and MOVE)

Anonymous
Not applicable
852 Views
2 Replies
Message 1 of 3

Visual LISP program (SSGET, GROUPS, and MOVE)

Anonymous
Not applicable

Hello, I have been working with AutoLISP for about a month now and I have hit the limit of my understanding it seems. 

 

I am working on creating a program that recieves a SSGET output saved as a variable and uses that to grab the group name from the entity. I then needs to take the group name and append a perticular variable (depends on the drawing I am in) onto the end of the group name which will be used to grab the new entity in the specified group and move it mirrored to first entity. Basically need a way to select an entity that is in a very similar group to move it automatically with the other entity. 

 

Hopefully I have all of my vocabulary and deffinitions correctly worded. 

Any help with finding a way to select groups would be much appreciated. 

 

Thanks

0 Likes
853 Views
2 Replies
Replies (2)
Message 2 of 3

dbroad
Mentor
Mentor

Since you are learning, I won't take away the fun of exploration for you by programming a solution.  Groups are implemented with dictionaries in AutoCAD.  To get access to dictionaries, use (namedobjdict).  To get the group dictionary use:

 

(setq grps (dictsearch (namedobjdict) "ACAD_GROUP"))

 

Parsing that list you should notice the group names and the entities that are members of each group.  NOTE:  It is possible for an entity to be a member of more than one group.

 

Strategy:  Use that information to do a reverse lookup on the selection set to find all the groups that an entity is a member of.  You might use ssmemb or convert the selection set to a list and use member to compare.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks for the reply. I have been researching different ways to use the dictionaries in AutoCAD and this is what I have come up with. 

 

(defun c:grups()
  (entget (namedobjdict))
  (setq Head (dictsearch (namedobjdict) "ACAD_GROUP"))
  (setq Boring (dictsearch (cdr (assoc -1 Head)) "BORING_HEAD_11M")) ; "BORING_HEAD_**M" changes from "BORING_HEAD_**" depending on previous selection
  (princ Boring)
  (princ)
)

I am having a little trouble figuring out how to take the output of the variable "Boring" which looks like

 

((-1 . <Entity name: 7ffffb0bea0>) (0 . GROUP) (5 . A82) (102 . {ACAD_REACTORS) (330 . <Entity name: 7ffffb079a0>) (102 . }) (330 . <Entity name: 7ffffb079a0>) (100 . AcDbGroup) (300 . ) (70 . 0) (71 . 1) (340 . <Entity name: 7ffffb0c550>) (340 . <Entity name: 7ffffb0c5e0>)... ect.

 

How can I get the entity name 7ffffb0bea0 and use it to get a selection set? 

 

Thanks,

Trenton

 

0 Likes