lxq-333 发表于 2008-6-13 16:21:00

新手请教:为什么到最后一步的时候不能画面域

<p>Sub mianyu()<br/>Dim p1 As Variant '端点坐标<br/>Dim p2 As Variant</p><p>Dim l() As Double </p><p>Dim temp(1 To 2) As AcadPolyline</p><p>p1 = ThisDrawing.Utility.GetPoint(, "输入点:") <br/>z = 0<br/>p1(2) = z <br/>ReDim l(0 To 2) <br/>l(0) = p1(0)<br/>l(1) = p1(1)<br/>l(2) = z<br/>On Error GoTo Err_Control <br/>Do&nbsp;<br/>&nbsp; p2 = ThisDrawing.Utility.GetPoint(p1, vbCr &amp; "输入下一点:")&nbsp;<br/>&nbsp; z = 0<br/>&nbsp; p2(2) = z&nbsp;<br/>&nbsp;&nbsp;<br/>&nbsp; lub = UBound(l)&nbsp;<br/>&nbsp; ReDim Preserve l(lub + 3)<br/>&nbsp; For i = 1 To 3<br/>&nbsp;&nbsp;&nbsp; l(lub + i) = p2(i - 1)<br/>&nbsp; Next i<br/>&nbsp; If lub &gt; 3 Then<br/>&nbsp;&nbsp;&nbsp; templ.Delete<br/>&nbsp; End If<br/>&nbsp; Set templ = ThisDrawing.ModelSpace.AddPolyline(l)<br/>&nbsp; p1 = p2<br/>Loop</p><p>Err_Control:<br/>Set temp2 = ThisDrawing.ModelSpace.AddPolyline(l)<br/>Dim regions As Variant<br/>regions = ThisDrawing.ModelSpace.AddRegion(temp)<br/>End Sub</p>
页: [1]
查看完整版本: 新手请教:为什么到最后一步的时候不能画面域