[请教]如何计算出图形中线段和圆弧的数量
用选择集可以实现"如何计算出图形中线段和圆弧的数量"么 dim n as integer,k asintegerfor n = 0 to thisdrawing.modelspace.count-1
if thisdrawing.modelspace(n).entityname="AcDbLine" then
k=k+1
end if
next
msgbox k
谢谢,我自己试试,嘿嘿
在图元很多的时候历遍模型空间会很慢
用选择集解决要好些
Sub test2()
On Error Resume Next
Dim ss As AcadSelectionSet
Dim ft(0) As Integer, fd(0)
ft(0) = 0: fd(0) = "line,arc"
ThisDrawing.SelectionSets("TlsTest").Delete
Set ss = ThisDrawing.SelectionSets.Add("TlsTest")
ss.Select acSelectionSetAll, , , ft, fd
MsgBox ss.Count
End Sub 斑竹说的好,能够用选择集的地方就不要用遍历,否则太慢. 原来选择集是这么用的。谢谢。
页:
[1]