程序应该这样吧! private sub totalnumber1() dim pptext as acadtext dim numcount as double 'total count1 dim count1 as double dim ppsetpp1 as acadselectionsets '添加选择集 if not isnull(thisdrawing.selectionsets.item("pptext")) then set ppsetpp1=thisdrawing.selectionsets.item("pptext") ppsetpp1.delete end if dim pp1data(0 to 0) as integer dim pp2filter(0 to 0) as variant ppsetpp1.selectonscreen pp1data,pp2filter '选择文字对象 dim pppmmset() as acadtext redim pppmmset(Ubound(ppsetpp1.count)-1) dim jj as double dim min11() as variant,max11() as variant dim pptext111 as acadtext dim kk as double dim ppheight as double ppheight=0 for jj=0 to Ubound(ppsetpp1.count)-1 set pptext111=ppsetpp1.item(jj) redim min11(jj) redim max11(jj) pptext111.getboundingbox min11(jj),max11(jj) if ppheight=int(abs((max11(jj)-min11(jj))) then '高的字体 count1=count1+ppheight end if '------****矮字体 .........同理 ppheight=int(abs((max11(jj)-min11(jj))) next end sub |