Results 1 to 4 of 4

Thread: get the name of the group object with a Autolisp?

  1. #1
    Member
    Join Date
    2007-08
    Posts
    18
    Login to Give a bone
    0

    Unhappy get the name of the group object with a Autolisp?

    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

  2. #2
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: get the name of the group object with a Autolisp?

    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 !

  3. #3
    Member
    Join Date
    2007-08
    Posts
    18
    Login to Give a bone
    0

    Default Re: get the name of the group object with a Autolisp?

    Irneb,
    I found a solution. This was as we say here in Brazil ... "serves the same finger nose" ...

    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
    Thanks!
    Last edited by Opie; 2009-05-26 at 02:20 PM. Reason: [code] tags added

  4. #4
    Member
    Join Date
    2012-10
    Posts
    3
    Login to Give a bone
    0

    Default Re: get the name of the group object with a Autolisp?

    It's good! But sometime an object belong more than 1 group, and this code did not consider about that.

Similar Threads

  1. Replies: 0
    Last Post: 2014-06-17, 01:09 AM
  2. Creating Object data (AutoLisp)
    By gisvision in forum AutoLISP
    Replies: 1
    Last Post: 2010-05-02, 12:39 PM
  3. Object Group issue
    By jmctamney in forum AutoCAD General
    Replies: 7
    Last Post: 2008-03-12, 12:24 PM
  4. Replies: 3
    Last Post: 2004-06-14, 06:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •