AddItems method example
Sub AddItems_Example()
Dim ssetObj As AcadSelectionSet
Dim i As Integer
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
Dim circObj As AcadCircle
Dim centerPt(0 To 2) As Double
Dim dRadius As Double
Dim ssetName
ssetName = InputBox("Type a name for the selection set:")
Set ssetObj = ThisDrawing.SelectionSets.Add(ssetName)
startPoint(0) = 3: startPoint(1) = 1: startPoint(2) = 0
endPoint(0) = 5: endPoint(1) = 5: endPoint(2) = 0
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
centerPt(0) = 3: centerPt(1) = 1: centerPt(2) = 0
dRadius = 5
Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, dRadius)
ReDim ssobjs(0 To ThisDrawing.ModelSpace.Count - 1) As AcadEntity
For i = 0 To ThisDrawing.ModelSpace.Count - 1
Set ssobjs(i) = ThisDrawing.ModelSpace.Item(i)
Next i
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
© Bricsys NV. All rights reserved. |