明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1022|回复: 0

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

[复制链接]
发表于 2008-6-13 16:21:00 | 显示全部楼层 |阅读模式

Sub mianyu()
Dim p1 As Variant '端点坐标
Dim p2 As Variant

Dim l() As Double

Dim temp(1 To 2) As AcadPolyline

p1 = ThisDrawing.Utility.GetPoint(, "输入点:")
z = 0
p1(2) = z
ReDim l(0 To 2)
l(0) = p1(0)
l(1) = p1(1)
l(2) = z
On Error GoTo Err_Control
Do 
  p2 = ThisDrawing.Utility.GetPoint(p1, vbCr & "输入下一点:") 
  z = 0
  p2(2) = z 
  
  lub = UBound(l) 
  ReDim Preserve l(lub + 3)
  For i = 1 To 3
    l(lub + i) = p2(i - 1)
  Next i
  If lub > 3 Then
    templ.Delete
  End If
  Set templ = ThisDrawing.ModelSpace.AddPolyline(l)
  p1 = p2
Loop

Err_Control:
Set temp2 = ThisDrawing.ModelSpace.AddPolyline(l)
Dim regions As Variant
regions = ThisDrawing.ModelSpace.AddRegion(temp)
End Sub

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 09:35 , Processed in 0.156158 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表