本帖最后由 作者 于 2008-6-22 12:31:56 编辑
首先分析一下VBA的帮助文件 Sub Example_AddRegion() ' This example creates a region from an arc and a line. Dim curves(0 To 1) As AcadEntity
' Define the arc Dim centerPoint(0 To 2) As Double Dim radius As Double Dim startAngle As Double Dim endAngle As Double centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0# radius = 2# startAngle = 0 endAngle = 3.141592 Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle) ' Define the line Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint) 在生成面域前做如下定义(前面已经定义,为了方便在此增加一行) 生成面域必须要用Dim curves(0 To 1) As AcadEntity实体数组 ' Create the region RetVal = object.AddRegion(ObjectList) RetVal Variant This method outputs an array of the newly created MSITStore:C:\Program%20Files\AutoCAD%202004\help\acadauto.chm::/idh_region_object.htm">Region objects. 输出新的区域目标数组的方法。 Dim regionObj As Variant 变体数据 regionObj = ThisDrawing.ModelSpace.AddRegion(curves) 面域生成的必要条件。 End Sub
因此,你这条语句不成立 For Each ko In sel Set reg = ThisDrawing.ModelSpace.AddRegion(ko) reg.color = acBlue 另外,你说的要做其它事,常用的测量面积或boolean,你还要干什么事?半句话就不理解你的目的了。 |