- 积分
- 401
- 明经币
- 个
- 注册时间
- 2004-7-20
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
在线求助,等........................,
QQ:360167933 电话:13192552835
我是广东的,急要用,希望帮助解决!
这是一位朋友的统计程序,能统计CAD图形中的数字,哪位告诉我怎么用 我很需要它,可是我不会加载使用它!希望谁帮我解决一下!
程序链接: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 |
|