明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1557|回复: 3

这是一位朋友的统计程序,哪位告诉我怎么用

[复制链接]
发表于 2004-7-21 09:18:00 | 显示全部楼层 |阅读模式
我很需要它,可是我不会加载使用它!希望谁帮我解决一下! 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:00:00 | 显示全部楼层
我一直在线等,希望哪一位援手!
发表于 2004-7-21 10:28:00 | 显示全部楼层
你发的不是地方,这是VBA的程序,这里的LISP的版块,你应该去VBA版块等
 楼主| 发表于 2004-7-21 10:34:00 | 显示全部楼层
谢谢,我知道了,我这就去,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-30 22:20 , Processed in 0.161505 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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