- 积分
- 10513
- 明经币
- 个
- 注册时间
- 2002-6-3
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2002-11-20 20:15:00
|
显示全部楼层
获取图幅的左下角和右上角的坐标
可以用Document.Limits来获取,也可以系统变量LIMMAX和LIMMIN。
范例如下:
Sub Example_Limits()
' This example finds the current limits for the drawing.
' It then changes the limits for the drawing. The grid
' is turned on to show the limits.
' Turn on the grid for the active viewport
ThisDrawing.ActiveViewport.GridOn = True
ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
' Find the current limits
Dim currLimits As Variant
currLimits = ThisDrawing.Limits
MsgBox "The current drawing limits are " & vbCrLf _
& "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
& "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"
' Change the limits
Dim newLimits(0 To 3) As Double
newLimits(0) = 2#: newLimits(1) = 2#: newLimits(2) = 4#: newLimits(3) = 4#
ThisDrawing.Limits = newLimits
ThisDrawing.Regen acActiveViewport
MsgBox "The new drawing limits are " & vbCrLf _
& "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
& "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"
' Reset the drawing limits
ThisDrawing.Limits = currLimits
ThisDrawing.Regen acActiveViewport
MsgBox "The drawing limits have been reset to " & vbCrLf _
& "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
& "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"
End Sub |
|