Results 1 to 2 of 2

Thread: Cannot find an element's group name using VBA

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2008-02
    Posts
    1
    Login to Give a bone
    0

    Default Cannot find an element's group name using VBA

    Hi,

    I´m new to AutoCAD VBA and I am having trouble getting the name of an element's group.

    I tried the code below (partial), but it didn't work.

    ElseIf MyObject.ObjectName = "AcDbHatch" Then

    Dim objGroup As AcadGroup
    Dim strGroupList As String

    Set objGroup = MyObject.groups.Item
    strGroupList = objGroup.Name
    MsgBox strGroupList, vbOKOnly, "List of Groups"

    Endif

    Thanks in Advance,

    Bernardo from Brazil

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,738
    Login to Give a bone
    0

    Default Re: Cannot find an element's group name using VBA

    VBA doesn't have an api to tell what group an entity belongs to. You would need to use C# to look at it's persistent reactor or use lisp to examine its dxf codes. Norman mentioned on the Autodesk forum the only way. get the ThisDocument.Groups collection, iterate each group's Items collection looking for the ObjectID of the entity in question.
    C:> ED WORKING....

Similar Threads

  1. Replies: 1
    Last Post: 2010-07-15, 08:43 PM
  2. Replies: 12
    Last Post: 2010-01-08, 07:49 PM
  3. Create Layer name using the Drawing name
    By g_wong in forum AutoLISP
    Replies: 14
    Last Post: 2009-01-09, 02:25 AM
  4. How to find the AutoCAD product name from VBA
    By kishorev99 in forum VBA/COM Interop
    Replies: 5
    Last Post: 2008-11-21, 05:19 AM
  5. Structural Element may not be supported -- verify support for element
    By anthony.hoare in forum Revit Structure - General
    Replies: 0
    Last Post: 2007-06-27, 01:56 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
  •