[求助]只把图层打开的对象加入到选择集遇到问题
<p>各位高手,麻烦你们帮帮我 看看程序,我只想把图层设置为打开的那些实体对象加入到选择集,可以下面的代码却没有把任何对象加入到选择集,请帮我看看问题出在什么地方了 谢谢</p><p>'把图层设置为关闭的过滤掉<br/> Dim entry As AcadLayer<br/> ReDim filterdata(0 To ThisDrawing.Layers.Count - 1) As String<br/> Dim NO1 As Integer<br/> NO1 = 0<br/> '遍历图层<br/> For Each entry In ThisDrawing.Layers<br/> If entry.LayerOn = True Then<br/> filterdata(NO1) = entry.Name<br/> End If<br/> Next<br/> '定义选择集过滤器<br/> Dim filterTYPE1() As Integer<br/> Dim filterDATA1() As String<br/> Dim e1 As Integer<br/> For e1 = 0 To NO1<br/> filterTYPE1(e1) = 8<br/> filterDATA1(e1) = filterdata(e1)<br/> Next e1<br/> ssetObj.Select acSelectionSetAll, , , filterTYPE1, filterDATA1</p> <p>你没有加入“OR”的逻辑,所以就变成了“AND”了。</p><p>如果只是OR,可以把所有图层用逗号隔开,所以上面的程序可以简单化, 只需要把过滤的图层名组合在一行里用逗号隔开。</p> <p>dim n as integer,i as integer</p><p>dim ft(0) as integer</p><p>dim fd(0) </p><p>ft(0)=8</p><p>dim Sl() as string</p><p>n=-1</p><p>for i=0 to thisdrawing.layers.count-1</p><p>if thisdrawing.layers(i).layeron=true then</p><p> n=n+1</p><p>redim preserve sl(n)</p><p> sl(n)=thisdrawing.layers(i).name</p><p>endif</p><p>next i</p><p>fd(0)=join(sl,",")</p><p>dim sset as acadselection</p><p>.......</p><p>....</p> <p>真心感谢 上面两位。</p>
页:
[1]