AddItems method example

Private Sub AddItems_Example()

' This example creates a selection set, and a line and circle objects.

' It then adds the objects to the selection set and clears the set.

 

     Dim ssetObj As IntelliCAD.SelectionSet

     Dim I As Integer

     Dim lineObj As IntelliCAD.Line

     Dim startPoint As IntelliCAD.Point

     Dim endPoint As IntelliCAD.Point

     Dim circObj As IntelliCAD.Circle

     Dim centerPt As IntelliCAD.Point

     Dim radius As Double

     Dim ssetName

     ssetName = InputBox("Type a name for the selection set:")

     Set ssetObj = ThisDocument.SelectionSets.Add(ssetName)

 

     ' Create a line object in model space

     Set startPoint = Library.CreatePoint(3, 1, 0)

     Set endPoint = Library.CreatePoint(5, 5, 0)

     Set lineObj = ThisDocument.ModelSpace.AddLine(startPoint, endPoint)

 

     ' Create a circle object in model space

     Set centerPt = Library.CreatePoint(3, 1, 0)

     radius = 5

     Set circObj = ThisDocument.ModelSpace.AddCircle(centerPt, radius)

     ' Collect the objects into an array of objects

     ' to be added to the selection set.

     ReDim ssobjs(1 To ThisDocument.ModelSpace.Count) As IntelliCAD.Entity

For I = 1 To ThisDocument.ModelSpace.Count

          Set ssobjs(I) = ThisDocument.ModelSpace.Item(I)

Next I

 

     ' Add the array of objects to the selection set

     ssetObj.AddItems ssobjs

     MsgBox "No. of items in sel. set = " & ssetObj.Count

     ssetObj.Clear

     MsgBox "No. of items in sel. set (after clearing) = " & ssetObj.Count

End Sub