mikewolf2k 发表于 2005-3-25 19:04:00

你想怎么统计?

cqy 发表于 2005-4-1 14:09:00

比如:100-DN50,50-DN50.....等分布在图面上,统计100+50+...

mikewolf2k 发表于 2005-4-1 19:32:00

你这个要专门编程的话可以实现。建议你看看这个:<A href="http://www.mjtd.com/mcdown/list.asp?id=511" target="_blank" >http://www.mjtd.com/mcdown/list.asp?id=511</A>

lzws03 发表于 2005-4-20 18:26:00

版主,现在好多工具箱里都集成了这个功能了,但都是对于单行文字有效,对于多行文字无效,不知道您这个程序怎么样,下载下来回去试试再说吧。

xuelinhe 发表于 2005-9-4 15:04:00

如何加载啊?请教!!!

wusulizhi 发表于 2005-9-20 20:33:00

<P>谢谢了,</P>

dianbotang 发表于 2009-4-5 03:20:00

cqy发表于2005-4-1 14:09:00static/image/common/back.gif比如:100-DN50,50-DN50.....等分布在图面上,统计100+50+...

<p>实现这个很简单,把楼主的程序稍作修改就可以了。</p><p>可用于单行文字和多行文字。</p><p>根据需要自行修改过滤条件。</p><p>'数字求和<br/>Sub totalnumber()<br/>&nbsp;&nbsp;&nbsp; Dim total As Double<br/>&nbsp;&nbsp;&nbsp; total = 0<br/>&nbsp;&nbsp;&nbsp; Dim ssetObj As AcadSelectionSet<br/>&nbsp;&nbsp;&nbsp; Set ssetObj = CreateSelectionSet("numberobj")<br/>&nbsp;&nbsp;&nbsp; Dim fType, fData<br/>&nbsp;&nbsp;&nbsp; BuildFilter fType, fData, 0, "*text", 1, "*DN50"<br/>&nbsp;&nbsp;&nbsp; ssetObj.SelectOnScreen fType, fData<br/>&nbsp;&nbsp;&nbsp; For i = 0 To ssetObj.Count - 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total = total + Val(ssetObj(i).TextString)<br/>&nbsp;&nbsp;&nbsp; Next<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ssetObj.Delete<br/>&nbsp;&nbsp;&nbsp; ActiveDocument.Utility.Prompt "总和=" &amp; total<br/>End Sub</p><p>Public Function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet<br/>&nbsp; '返回一个空白选择集<br/>&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim ss As AcadSelectionSet<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; On Error Resume Next<br/>&nbsp;&nbsp;&nbsp; Set ss = ThisDrawing.SelectionSets(ssName)<br/>&nbsp;&nbsp;&nbsp; If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)<br/>&nbsp;&nbsp;&nbsp; ss.Clear<br/>&nbsp;&nbsp;&nbsp; Set CreateSelectionSet = ss<br/>End Function<br/>Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())<br/>&nbsp;&nbsp;&nbsp; '用数组方式填充一对变量以用作为选择集过滤器使用<br/>&nbsp;&nbsp;&nbsp; Dim fType() As Integer, fData()<br/>&nbsp;&nbsp;&nbsp; Dim Index As Long, i As Long<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Index = LBound(gCodes) - 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; For i = LBound(gCodes) To UBound(gCodes) Step 2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Index = Index + 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReDim Preserve fType(0 To Index)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReDim Preserve fData(0 To Index)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fType(Index) = CInt(gCodes(i))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fData(Index) = gCodes(i + 1)<br/>&nbsp;&nbsp;&nbsp; Next<br/>&nbsp;&nbsp;&nbsp; typeArray = fType: dataArray = fData<br/>End Sub</p><p></p>

chamous 发表于 2009-11-14 08:40:00

返回值是零.

scf0413 发表于 2011-1-16 21:41:01

大哥们能否提供个C#求和的代码啊?供小弟学习学习

mp3_2004 发表于 2012-11-30 00:35:42

文字求和,留着备用
页: 1 [2] 3
查看完整版本: 将数字求和的程序