用vba如何创建面域啊?
<p>我用addline方法画了几条封闭线段(线段定义的不是一个数组),用addregion想将这几条线段创建面域不知为何做不了</p><p>刚接触VBA,望高手赐教~</p><p>有没有一个方法象Autolisp那样指定两个点就可以将两点范围内的封闭曲线做成面域?</p><p>谢谢哦~~</p> <p>下面是我弄的一个构建面域的试验程序,你可以用选择集来构建。</p><p>Sub q()<br/>Dim obj(0 To 1) As AcadPolyline</p><p>Dim x1(0 To 14) As Double<br/>Dim x2(0 To 14) As Double<br/>Dim y1(0 To 3) As Double<br/>Dim y2(0 To 3) As Double<br/>x1(0) = 915.532<br/>x1(1) = 459.517<br/>x1(2) = 0<br/>x1(3) = 948.256<br/>x1(4) = 461.206<br/>x1(5) = 0<br/>x1(6) = 948.256<br/>x1(7) = 434.545<br/>x1(8) = 0<br/>x1(9) = 905.75<br/>x1(10) = 435.993<br/>x1(11) = 0<br/>x1(12) = 915.532<br/>x1(13) = 459.517<br/>x1(14) = 0<br/>x2(0) = 948.541<br/>x2(1) = 458.139<br/>x2(2) = 0<br/>x2(3) = 956.261<br/>x2(4) = 439.321<br/>x2(5) = 0<br/>x2(6) = 956.261<br/>x2(7) = 404.46<br/>x2(8) = 0<br/>x2(9) = 915.497<br/>x2(10) = 429.448<br/>x2(11) = 0<br/>x2(12) = 948.541<br/>x2(13) = 458.139<br/>x2(14) = 0<br/>Set obj(0) = ThisDrawing.ModelSpace.AddPolyline(x1)<br/>Set obj(1) = ThisDrawing.ModelSpace.AddPolyline(x2)<br/>Dim regions As Variant<br/>regions = ThisDrawing.ModelSpace.AddRegion(obj)<br/>Dim r1 As AcadRegion<br/>Dim r2 As AcadRegion<br/> Set r1 = regions(0)<br/> Set r2 = regions(1)<br/> <br/> r1.Boolean acIntersection, r2<br/> MsgBox "mj is :" & r1.Area<br/>End Sub<br/></p> <p>谢谢laoxie指教~</p><p>试试好不好用~</p> <p>不错,不过面域相交用的一般比较少吧!想差用的可能比较多</p><p>.....................</p><p>.................</p><p>if regions(0)>region(1) then</p><p>r1=regions(0)</p><p>r2=regions(1)</p><p>else </p><p> r1=regions(1)</p><p>r2=regions(0)</p><p>end if</p><p>r1.boolean acsubtraction r2</p><p>.....................</p>
页:
[1]