明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1779|回复: 2

统计求和图形中数据的程序源程序?求助

[复制链接]
发表于 2004-7-21 09:21:00 | 显示全部楼层 |阅读模式
下面链接是一位朋友的统计求和图形中数据的程序源吗?谁能告诉我怎么用它好吗? 是什么类型的! 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
 楼主| 发表于 2004-7-21 10:01:00 | 显示全部楼层
在线等助!
发表于 2004-7-21 10:16:00 | 显示全部楼层
Ask the author & No VBA here.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-19 00:21 , Processed in 0.163361 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表