要移动对象,请使用该对象的 Move 方法。这个方法需要输入两个坐标值。这两个坐标值定义了位移矢量,指示给定对象移动的距离和方向。
Sub Ch4_MoveCircle()
' 创建圆
Dim circleObj As AcadCircle
Dim center(0 To 2) As Double
Dim radius As Double
center(0) = 2#: center(1) = 2#: center(2) = 0#
radius = 0.5
Set circleObj = ThisDrawing.ModelSpace. _
AddCircle(center, radius)
ZoomAll
' 定义组成移动矢量的点。
' 移动矢量将圆沿 x 轴移动
' 两个单位。
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
point1(0) = 0: point1(1) = 0: point1(2) = 0
point2(0) = 2: point2(1) = 0: point2(2) = 0
' 移动圆
circleObj.Move point1, point2
circleObj.Update
End Sub