兰州人 发表于 2009-2-16 20:05:00

功能模块返回,建立面域数组

<p>面域是由AcadEntity数组建立的。以上小程序能方便的理解,VBA的AcadEntity实体数组。</p><p>Sub ls()<br/>&nbsp; Dim mm() As AcadEntity<br/>&nbsp; mm = oLine<br/>&nbsp;&nbsp;&nbsp; Dim objRegion As Variant<br/>&nbsp;&nbsp;&nbsp; objRegion = ThisDrawing.ModelSpace.AddRegion(mm)<br/>End Sub<br/>Function oLine() As AcadEntity()<br/>&nbsp; Dim Ent As AcadEntity<br/>&nbsp; Dim pp() As AcadEntity<br/>&nbsp; kk = 0<br/>&nbsp; With ThisDrawing<br/>&nbsp;&nbsp;&nbsp; For Each Ent In .ModelSpace<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Ent.Layer = "粗实线" Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReDim Preserve pp(kk) As AcadEntity<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set pp(kk) = Ent<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kk = kk + 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; Next<br/>&nbsp; End With<br/>&nbsp; oLine = pp<br/>End Function</p>
页: [1]
查看完整版本: 功能模块返回,建立面域数组