我定义了一个动态数组
<P>请问如何将一系列相互连接的PL生成面域啊?</P><P>我定义了一个动态数组</P>
<P>Dim polylineobj() as Acadpolyline</P>
<P>..................</P>
<P>do</P>
<P>.......</P>
<P>set polylineobj() =thisdrawing...........addpolyline(points)</P>
<P>.......</P>
<P>loop</P>
<P>生成的最后一条PL与第一条的起点相连</P>
<P>再生成面域addregion(polylineobj)</P>
<P>运行的时候提示addregion方法错误,是不是不能这样生成面域啊,</P> 你看看帮助文件就行了 从来没有见过给数组赋值的,VB不是VC,VC倒可以给它一个指针! <PRE class=Code>看看下面的你就会了</PRE><PRE class=Code>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)
' Create the region
Dim regionObj As Variant
regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
regionObj(0).Color = acRed
ZoomAll
End Sub</PRE>
页:
[1]