凡事不能急于求成哦,还是从基本学起好,祝你成功!你需要的功能大致如下: Sub test() Dim ss As AcadSelectionSet Dim ft(1) As Integer, fd(1) As Variant Dim l As AcadLine On Error Resume Next '安全创建选择集 Set ss = ThisDrawing.SelectionSets.Add("ss1") If Err Then Err.Clear Set ss = ThisDrawing.SelectionSets.item("ss1") ss.Clear End If '过滤设置 ft(0) = 0: fd(0) = "line" ft(1) = 62: fd(1) = 1 '过滤选择 ss.Select acSelectionSetAll, ft, fd '距离累加 Dim dis As Double For Each l In ss dis = dis + l.Length Next MsgBox "管线总长为:" & dis '删除选择集 ss.Delete End Sub |