- 积分
- 401
- 明经币
- 个
- 注册时间
- 2004-7-20
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
下面链接是一位朋友的统计求和图形中数据的程序源吗?谁能告诉我怎么用它好吗?
是什么类型的!
dispbbs.asp?boardID=16&ID=16561&page=5
统计求和图形中数据的程序源程序?求助
Sub totalnumber() Dim total As Double total = 0 Dim ssetObj As AcadSelectionSet Set ssetObj = CreateSelectionSet("numberobj") Dim ftype, fdata BuildFilter ftype, fdata, 0, "text" ssetObj.SelectOnScreen ftype, fdata For i = 0 To ssetObj.Count - 1 If IsNumeric(ssetObj.Item(i).TextString) Then total = total + ssetObj.Item(i).TextString Else End If Next i
ssetobj.delete ActiveDocument.Utility.Prompt "总和=" & total End Sub Public function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet '返回一个空白选择集 Dim ss As AcadSelectionSet On Error Resume Next Set ss = ThisDrawing.SelectionSets(ssName) If err Then Set ss = ThisDrawing.SelectionSets.Add(ssName) ss.Clear Set CreateSelectionSet = ss End Function Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes()) '用数组方式填充一对变量以用作为选择集过滤器使用 Dim ftype() As Integer, fdata() Dim index As Long, i As Long index = LBound(gCodes) - 1 For i = LBound(gCodes) To UBound(gCodes) Step 2 index = index + 1 ReDim Preserve ftype(0 To index) ReDim Preserve fdata(0 To index) ftype(index) = CInt(gCodes(i)) fdata(index) = gCodes(i + 1) Next typeArray = ftype: dataArray = fdata End Sub |
|