VBA - Invalid Group Name - Using ACAD2000

VBA - Invalid Group Name - Using ACAD2000

Anonymous
Not applicable
1,389 Views
2 Replies
Message 1 of 3

VBA - Invalid Group Name - Using ACAD2000

Anonymous
Not applicable

Greetings ... Simplest example I can muster to demonstrate group name reference call failure. When created via code and using more than two letters, it fails  , use two letters it works . Now if the same group is manually created through the UI using the group name of "Group4" the trim command works .

Note: Code execution leaves the command open for item selection in the ACAD window. This image shows the commandline demonstrating the error message "Invalid Group Name" when using name Group4 and the success of name G4.

Please review these photos for the commandline output ... facebook account is not necessary to view.
http://www.facebook.com/album.php?ai...1&l=f06b8fe6e8

Any ideas how to work around this in ACAD2000? Does this work correctly in more current versions? Such as ACAD2002, 2004 or 2006? How about .NET API versions?

Code:
'Example of Group Name Reference Failure
Public Sub Create_and_ReferenceGroup()
    'Run with an empty open document
    Dim oacadapp As AutoCAD.AcadApplication
    Set oacadapp = AutoCAD.AcadApplication
    
    Dim oacaddoc As AutoCAD.AcadDocument
    Set oacaddoc = oacadapp.ActiveDocument
    
    Dim oGroup As AcadGroup
    Dim oGroupArray(1) As AcadEntity
    Set oGroup = oacaddoc.Groups.Add("Group4")
    Set oGroup = oacaddoc.Groups.Add("G4")
    oacaddoc.SendCommand "_trim" & vbCr & "g" & vbCr & oacaddoc.Groups.Item("Group4").Name & vbCr & oacaddoc.Groups.Item("G4").Name & vbCr
End Sub

Thanks, Brian M Sardeson
Production Development Engr - Engr Support Specialist
Skyline Corp www.skylinecorp.com
AU Presenter - '08 / Attendee - '06-'07
Inventor 5 - 2010 / AutoCAD 12 - 2010
Pgmr: VB / VBA / .NET / SQL / LISP (If i must)
MAMSUG - Past Director '07 - '09

0 Likes
1,390 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

For those of you who cannot access social networking pages to review the JPG files in the link above ..


This is the commandline from the UI manual entry:

836i9AEC7AB17A3BC08E

 


This is the commandline from the code example:

834i6F09570C67165750.

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

Please Use UPPER CASE LETTERS  as name:

Set oGroup = oacaddoc.Groups.Add("GROUP4")

This Solves the problem

0 Likes