[VBA]遍历图层中的对象
请大家帮帮忙,VBA如何遍历指定图层中的对象? 选择集+过滤器 <P>Dim ss1 As AcadSelectionSet<BR>Dim layername As String<BR>Dim acadent As AcadEntity</P><P>'指定图层名称</P>
<P>layername = "MAIN"</P>
<P>'得到选择集</P>
<P>Dim gpCode(0) As Integer<BR>Dim dataValue(0) As Variant<BR>gpCode(0) = 8<BR>dataValue(0) = layername</P>
<P>Set ss1 = ThisDrawing.SelectionSets.Add("ss3")<BR>ss1.Select acSelectionSetAll, , , gpCode, dataValue</P>
<P>For Each acadent In ss1<BR> '对象处理<BR>Next</P> <P>先用 select 选择你想要的图层上的所有对象,然后用for each遍历选择集时的所有对象,有问题请与403893004联系</P> 收集此帖子
页:
[1]