CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于沿矢量移动对象 (VBA/ActiveX)

2023-1-5 00:58| 发布者: admin| 查看: 807| 评论: 0|来自: AutoCAD

摘要: 可以沿指定矢量移动所有图形对象和属性参照对象。

可以沿指定矢量移动所有图形对象和属性参照对象。

若要移动对象,请使用为该对象提供的方法。此方法需要两个坐标作为输入。这些坐标定义了一个位移矢量,指示给定物体要移动多远以及朝什么方向移动。Move



沿矢量移动圆

本示例创建一个圆,然后沿X轴将该圆移动两个单位。

Sub Ch4_MoveCircle()
  ' 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.
  ' The move vector will move the circle 2 units
  ' along the x axis.
  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

  ' Move the circle
  circleObj.Move point1, point2
  circleObj.Update
End Sub

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 06:33

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部