CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于缩放对象 (VBA/ActiveX)

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

摘要: 通过指定基点和长度来缩放对象,基点和长度用作基于当前图形单位的比例因子。可以缩放所有图形对象以及属性参照对象。

通过指定基点和长度来缩放对象,基点和长度用作基于当前图形单位的比例因子。可以缩放所有图形对象以及属性参照对象。

若要缩放对象,请使用为该对象提供的方法。此方法在XYZ方向上均等地缩放对象。它将比例的基点和比例因子作为输入。基点是具有三个双精度的变体数组。这些双精度表示指定比例开始点的 3D WCS 坐标。比例因子是缩放对象所依据的因子。对象的尺寸乘以比例因子。比例因子大于 1 可放大对象。介于 0 和 1 之间的比例因子会减少对象。ScaleEntity



缩放折线

本示例创建一条闭合的轻量级折线,然后将该折线缩放 0.5。

Sub Ch4_ScalePolyline()
  ' Create the polyline
  Dim plineObj As AcadLWPolyline
  Dim points(0 To 11) As Double
  points(0) = 1: points(1) = 2
  points(2) = 1: points(3) = 3
  points(4) = 2: points(5) = 3
  points(6) = 3: points(7) = 3
  points(8) = 4: points(9) = 4
  points(10) = 4: points(11) = 2
  Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
  plineObj.Closed = True
  ZoomAll

  ' Define the scale
  Dim basePoint(0 To 2) As Double
  Dim scalefactor As Double
  basePoint(0) = 4: basePoint(1) = 4.25: basePoint(2) = 0
  scalefactor = 0.5

  ' Scale the polyline
  plineObj.ScaleEntity basePoint, scalefactor
  plineObj.Update
End Sub

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 08:52

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部