有同感,selectatpoint语句总搞不定。有一连续切割的等高实体,想按叠放顺序输出各部分的体积,才学VBA,功底不够,代码被改的惨不忍睹了,另外图很大,看到有说会影响选取。
Sub selsetTest()
Dim i, H As Integer
Dim p(0 To 2) As Double
Dim sset As AcadSelectionSet
Dim element As AcadEntity
Set sset = ThisDrawing.SelectionSets.Add("ss1")
H =300
For i = 1 To H * 10
p(0) = -0.05: p(1) = i * 0.1 - 0.05: p(2) = 0
sset.SelectAtPoint (p)
element = sset.Item(0)
MsgBox i & ":" & element.Volume
sset.RemoveItems (0)
Next i
setobj.Delete
End Sub