Sub getArea()
Dim objEnts() As AcadEntity Dim objEnt As AcadEntity Dim ssSet As AcadSelectionSet Dim iCount As Long Dim lngCount As Long Dim objRegion1 As Variant Dim objRegion As AcadRegion
lngCount = ThisDrawing.SelectionSets.Count If lngCount > 0 Then For iCount = lngCount - 1 To 0 Step -1 Set ssSet = ThisDrawing.SelectionSets(iCount) If ssSet.Name = "SSSS" Then ssSet.Delete Next End If
Set ssSet = ThisDrawing.SelectionSets.Add("SSSS")
ssSet.SelectOnScreen lngCount = ssSet.Count If lngCount > 0 Then ReDim objEnts(0 To lngCount - 1) For iCount = 0 To lngCount - 1 Set objEnts(iCount) = ssSet(iCount) Next End If objRegion1 = ThisDrawing.ModelSpace.AddRegion(objEnts) For iCount = LBound(objRegion1) To UBound(objRegion1) Set objRegion = objRegion1(iCount) 'dblArea1 = dblArea1 + objRegion.Area
MsgBox Cstr(objRegion.Area) Next ssSet.Delete Set objEnt = Nothing Set ssSet = Nothing Set objRegion = Nothing End Sub
|