本帖最后由 作者 于 2009-1-6 11:03:12 编辑
Sub qzx() '取线 Dim sset As AcadSelectionSet '声明选择集 Set sset = ThisDrawing.SelectionSets.Add("SS1") 'set选择集 Dim FilterType(0) As Integer Dim FilterData(0) As Variant FilterType(0) = 0 FilterData(0) = "LWPolyline,line" '只可选择多段线和直线 sset.SelectOnScreen FilterType, FilterData '从屏幕选择对象 For Each ent In sset '遍历所选择集中对象 hj = ent.Length + hj 'hj代表合计 Next MsgBox hj '对话框显示合计 ThisDrawing.SelectionSets("SS1").Delete '删除选择集 End Sub |