|
发表于 2008-6-22 12:25:00
|
显示全部楼层
首先分析一下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 regionRetVal = object.AddRegion(ObjectList)RetVal Variant This method outputs an array of the newly created 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,你还要干什么事?半句话就不理解你的目的了。 |
|