- 积分
- 1417
- 明经币
- 个
- 注册时间
- 2002-12-8
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-8-4 13:07:00
|
显示全部楼层
我是了一下没有出现你说的情况。
矩形绘制程序入内
Function AddRectangle(varPnt1 As Variant, varPnt2 As Variant) As AcadLWPolyline
On Error GoTo Err_Control
Dim objSpace As AcadBlock
If ThisDrawing.ActiveSpace = acModelSpace Then
Set objSpace = ThisDrawing.ModelSpace
Else
Set objSpace = ThisDrawing.PaperSpace
End If
Dim plineObj As AcadLWPolyline
Dim points(0 To 7) As Double
points(0) = varPnt1(0): points(1) = varPnt1(1)
points(2) = varPnt1(0): points(3) = varPnt2(1)
points(4) = varPnt2(0): points(5) = varPnt2(1)
points(6) = varPnt2(0): points(7) = varPnt1(1)
Set plineObj = objSpace.AddLightWeightPolyline(points)
plineObj.Closed = True
Set AddRectangle = plineObj
Exit_Here:
Exit Function
Err_Control:
Resume Exit_Here
End Function
Sub addrec()
Dim pnt1 As Variant
Dim pnt2 As Variant
pnt1 = ThisDrawing.Utility.GetPoint(, "请输入角点:")
pnt2 = ThisDrawing.Utility.GetCorner(pnt1, "请输入另一角点:")
AddRectangle pnt1, pnt2
End Sub |
|