CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

YScaleFactor Property (ActiveX)

2023-1-3 00:43| 发布者: admin| 查看: 575| 评论: 0|来自: AutoCAD

摘要: 指定 块或外部参照 (外部参照) 的 Y 比例因子。

指定块或外部参照 (外部参照) 的Y比例因子。

支持的平台:仅窗口

签名

工 务 局:

object.YScaleFactor
对象

类型:块引用,比较引用,外部引用最小块

此属性适用的对象。

属性值

只读:

类型:

非零实数。

言论

初始比例因子为 1.0。

例子

工 务 局:

Sub Example_YScaleFactor()
    ' This example creates a block containing a circle.
    ' It then inserts the block and changes the YScaleFactor.
    
    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")
    
    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)
   
    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
    ZoomAll
    
    ' Find the current YScaleFactor for the block reference
    Dim currYScaleFactor As Double
    currYScaleFactor = blockRefObj.YScaleFactor
    MsgBox "The current YScaleFactor for the block reference is " & blockRefObj.YScaleFactor, , "YScaleFactor Example"
    
    ' Change the YScaleFactor for the block reference
    blockRefObj.YScaleFactor = currYScaleFactor + 2
    ZoomAll
    MsgBox "The new YScaleFactor for the block reference is " & blockRefObj.YScaleFactor, , "YScaleFactor Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_YScaleFactor()
    ;; This example creates a block containing a circle.
    ;; It then inserts the block and changes the YScaleFactor.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "CircleBlock"))
    
    ;; Add a circle to the block
    (setq center (vlax-3d-point 0 0 0)
          radius 1)
    (setq circleObj (vla-AddCircle blockObj center radius))
   
    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "CircleBlock" 1 1 1 0))
    
    ;; Find the current YScaleFactor for the block reference
    (setq currYScaleFactor (vla-get-YScaleFactor blockRefObj))
    (vla-ZoomAll acadObj)
    (alert (strcat "The current YScaleFactor for the block reference is " (rtos (vla-get-YScaleFactor blockRefObj) 2)))
    
    ;; Change the YScaleFactor for the block reference
    (vla-put-YScaleFactor blockRefObj (+ currYScaleFactor 2))
    (vla-ZoomAll acadObj)
    (alert (strcat "The new YScaleFactor for the block reference is " (rtos (vla-get-YScaleFactor blockRefObj) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 17:14

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部