Тема: Добавление текста в именованную группу объектов

Нашел как создать именованную группу, но не знаю, как присвоить группе дополнительные элементы:

<code>
     Dim groupObj As AcadGroup
    Set groupObj = ThisDrawing.Groups.Add("TEST_GROUP")
</code>

прошу помогите пожалуйста.

Re: Добавление текста в именованную группу объектов

<code>Sub Example_AppendItems()
    ' This example creates a group and several objects.
    ' It then appends the objects to the group.
   
    ' Create the new group
    Dim groupObj As AcadGroup
    Set groupObj = ThisDrawing.Groups.Add("TEST_GROUP")
           
    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double

    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)
   
    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double

    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
   
    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0

    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#

    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll
   
    ' Iterate through the model space collection.
    ' Collect the objects found into an array of objects
    ' to be added to the group.
    ReDim appendObjs(0 To ThisDrawing.ModelSpace.count - 1) As AcadEntity
    Dim I As Integer
    For I = 0 To ThisDrawing.ModelSpace.count - 1

        Set appendObjs(I) = ThisDrawing.ModelSpace.Item(I)
    Next
   
    ' Add the array of objects to the group
    groupObj.AppendItems appendObjs
   
    ThisDrawing.Regen acActiveViewport
   
End Sub</code>

Re: Добавление текста в именованную группу объектов

спасибо . Если кратко,  то  вот что получилось.

Dim SSS As AcadSelectionSet
Dim groupObj As AcadGroup
Dim objents() As AcadEntity
...
Set SSS = ThisDrawing.PickfirstSelectionSet
SSS.SelectOnScreen
Set groupObj = ThisDrawing.Groups.Add("1")


ReDim objents(SSS.Count - 1)  
  
  For i = 0 To SSS.Count - 1
    Set objents(i) = SSS(i)   
   Next i

groupObj.AppendItems objents
....