Move 方法 (ActiveX) 
沿矢量移动对象。 支持的平台:仅限 Windows 签名VBA: object.Move Point1, Point2 
 返回值 (RetVal)无返回值。 言论您指定的两个点定义了一个位移向量,指示给定对象要移动多远以及移动方向。 ![]() 给定对象,并指示两个点 ![]() 移动的对象 例子VBA: Sub Example_Move()
    ' This example creates a circle and then performs
    ' a move on that circle.
    
    ' Create the circle
    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
    
    ' Define the points that make up the move vector
    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
        
    MsgBox "Move the circle 2 units in the X direction.", , "Move Example"
    
    ' Move the circle
    circleObj.Move point1, point2
    
    ZoomAll
    MsgBox "Move completed.", , "Move Example"
    
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_Move()
    ;; This example creates a circle and then performs
    ;; a move on that circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    ;; Create the circle
    (setq center (vlax-3d-point 2 2 0)
          radius 0.5)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)
    
    ;; Define the points that make up the move vector
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 2 0 0))
        
    (alert "Move the circle 2 units in the X direction.")
    
    ;; Move the circle
    (vla-Move circleObj point1 point2)
    
    (vla-ZoomAll acadObj)
    (alert "Move completed.")
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-5 00:03
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.