mayuezxl 发表于 2006-8-17 15:58:00

[求助][VBA]关于选择集

<P>Dim filterType1(1) As Integer, filterDate1(1) As Variant&nbsp;</P>
<P>Dim SsetObj As AcadSelectionSet</P>
<P><BR>filterType1(0) = 0<BR>filterDate1(0) = "Text"<BR>filterType1(1) = 8<BR>filterDate1(1) = LayName</P>
<P>Set SsetObj = ThisDrawing.SelectionSets.Add("WenBen")</P>
<P>SsetObj.Select acSelectionSetAll, , , filterType1, filterDate1</P>
<P>Debug.Print SsetObj.Count</P>
<P>SsetObj.Delete</P>
<P>我想统计指定图层上有多少文本,按照上面的程序,总是显示是0,不知哪里不对,请高手指点</P>

lazybug 发表于 2006-8-17 17:28:00

<P>你的图曾名是什么呢?就是"LayName"</P>
<P>那试试这样:</P>
<P>filterDate1(1) = "LayName"</P>

mayuezxl 发表于 2006-8-17 19:20:00

LayName 是一个变量,获取不同的图层名。

mayuezxl 发表于 2006-8-17 19:31:00

<P>解决了</P>
<P>&nbsp;Dim FilterType1(3) As Integer, FiLterData1(3) As Variant</P>
<P>&nbsp;FilterType1(0) = -4<BR>&nbsp; FiLterData1(0) = "&lt;or"<BR>&nbsp; FilterType1(1) = 0<BR>&nbsp; FiLterData1(1) = "Text"<BR>&nbsp; FilterType1(2) = 8<BR>&nbsp; FiLterData1(2) = LayName<BR>&nbsp; FilterType1(3) = -4<BR>&nbsp; FiLterData1(3) = "or&gt;"</P>
<P>Set SsetObj = ThisDrawing.SelectionSets.Add("WenBen")</P>
<P>SsetObj.Select acSelectionSetAll, , , filterType1, filterDate1</P>
<P>Debug.Print SsetObj.Count</P>
<P>SsetObj.Delete</P>

mayuezxl 发表于 2006-8-17 19:45:00

<P>不对,还是出不来,请高手指点</P>

雪山飞狐_lzh 发表于 2006-8-18 01:06:00

<P>你的第一个程序没有问题的</P>

mmm96 发表于 2006-8-18 09:01:00

<P><BR>&nbsp;Dim FilterType1(1) As Integer, FiLterData1(1) As Variant</P>
<P><BR>&nbsp; FilterType1(0) = 0<BR>&nbsp; FiLterData1(0) = "Text"<BR>&nbsp; FilterType1(1) = 8<BR>&nbsp; FiLterData1(1) = "LayName"</P>
<P><BR>&nbsp; Dim ssetobj As AcadSelectionSet</P>
<P>Set ssetobj = ThisDrawing.SelectionSets.Add("wenben")<BR>ssetobj.Select acSelectionSetAll, , , FilterType1, FiLterData1<BR>Debug.Print ssetobj.Count</P>
<P>ssetobj.Delete<BR><BR>注意华横线部分</P>

mayuezxl 发表于 2006-8-18 14:58:00

<P>第一个好像是没问题,可能脑袋有点晕了。呵呵~</P>
<P>想再请教一个问题,图层上有单行和多行文字,同时要统计出来,哪该怎么写程序啊?</P>

lazybug 发表于 2006-8-18 16:04:00

建两个选择集,FiLterData1(0) = "MText"再统计一遍

wyj7485 发表于 2006-8-18 16:50:00

mayuezxl发表于2006-8-18 14:58:00static/image/common/back.gif第一个好像是没问题,可能脑袋有点晕了。呵呵~
想再请教一个问题,图层上有单行和多行文字,同时要统计出来,哪该怎么写程序啊?

<BR>
页: [1]
查看完整版本: [求助][VBA]关于选择集