Hi,
How can I get the name of the group object with Autolisp? I want to select an object, which belongs to a group and get the name of this group. In design there are several groups.
Tanks!
Ederson
|
Hi,
How can I get the name of the group object with Autolisp? I want to select an object, which belongs to a group and get the name of this group. In design there are several groups.
Tanks!
Ederson
The entity's data (after entget) has a (102 . "{ACAD_REACTORS") DXF code, directly after which is a 330 code which points to the GROUP entity. Again this has a (102 . "{ACAD_REACTORS") DXF code, directly after which is a 330 code which points to the DICTIONARY entry which has the group's name in code 2. Convoluted but that's how it is !
Irneb,
I found a solution. This was as we say here in Brazil ... "serves the same finger nose" ...
Thanks!Code:(defun obtername_grupo (group_object / ent_name acad_reactors vlx_objetc); group_name (setq ent_name (entget group_object)) (if (setq acad_reactors (member '(102 . "{ACAD_REACTORS") ent_name)) (while (and (setq acad_reactors (cdr acad_reactors)) (eq (caar acad_reactors) 330) (eq (vla-get-ObjectName (setq vlx_objetc (vlax-ename->vla-object (cdar acad_reactors)))) "AcDbGroup")); end of and (if (equal (cadr acad_reactors) '(102 . "}")) (setq acad_reactors nil)); end of if (setq group_name (vla-get-Name vlx_objetc))); end of while ); end of if ); end of defun obtername_grupo
Last edited by Opie; 2009-05-26 at 02:20 PM. Reason: [code] tags added
It's good! But sometime an object belong more than 1 group, and this code did not consider about that.