面域是由AcadEntity数组建立的。以上小程序能方便的理解,VBA的AcadEntity实体数组。 Sub ls() Dim mm() As AcadEntity mm = oLine Dim objRegion As Variant objRegion = ThisDrawing.ModelSpace.AddRegion(mm) End Sub Function oLine() As AcadEntity() Dim Ent As AcadEntity Dim pp() As AcadEntity kk = 0 With ThisDrawing For Each Ent In .ModelSpace If Ent.Layer = "粗实线" Then ReDim Preserve pp(kk) As AcadEntity Set pp(kk) = Ent kk = kk + 1 End If Next End With oLine = pp End Function |