CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

缩放实体方法 (ActiveX)

2023-1-4 04:00| 发布者: admin| 查看: 631| 评论: 0|来自: AutoCAD

摘要: 在 X、Y 和 Z 方向上均匀缩放对象。

在 X、Y 和 Z 方向上均匀缩放对象。

支持的平台:仅窗口

签名

工 务 局:

object.ScaleEntity BasePoint, ScaleFactor
对象

类型:所有图形对象属性引用尺寸

此方法适用的对象。

基点

访问:仅输入

类型:变体(双精度的三元素数组)

指定基点的 3D WCS 坐标。

比例因子

访问:仅输入

类型:

缩放对象所依据的因子。对象的尺寸乘以比例因子。比例因子大于 1 可放大对象。介于 0 和 1 之间的比例因子会减少对象。比例因子必须大于 0.0。

返回值(RetVal)

无返回值。

言论



比例因子 = 0.5 且比例因子 = 2

例子

工 务 局:

Sub Example_ScaleEntity()
    ' This example creates a lightweight polyline
    ' and then scales that polyline.
    
    ' 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
            
    MsgBox "Scale the polyline by 0.5", , "ScaleEntity Example"
    
    ' 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
    
    ZoomAll
    MsgBox "Scale completed.", , "ScaleEntity Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ScaleEntity()
    ;; This example creates a lightweight polyline
    ;; and then scales that polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 2
                                  1 3
                                  2 3
                                  3 3
                                  4 4
                                  4 2
                                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)
    (vla-ZoomAll acadObj)
            
    (alert "Scale the polyline by 0.5")
    
    ;; Define the scale
    (setq basePoint (vlax-3d-point 4 4.25 0)
          scalefactor 0.5)
    
    ;; Scale the polyline
    (vla-ScaleEntity plineObj basePoint scalefactor)
    
    (vla-ZoomAll acadObj)
    (alert "Scale completed.")
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部