CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

比例因子属性 (ActiveX)

2023-1-3 07:05| 发布者: admin| 查看: 203| 评论: 0|来自: AutoCAD

摘要: 指定对象的比例因子。

指定对象的比例因子。

支持的平台:仅窗口

签名

工 务 局:

object.ScaleFactor
对象

类型:属性,属性引用DgnUnderlayDim3PointAngularDimAlignedDimAngular,DimArcLengthDimDiametric,Dimension,DimOrdinate,DimRadial,DimRadialLargeDimRotatedDwfUnderlayGeomapImageLeaderMLeader,MLeaderStylepdf底层光栅图像形状文本容差擦除

此属性适用的对象。

属性值

只读:

类型:双人间 (ACAD_NOUNITS)

大于 0.0 的实数。比例因子大于 1 可放大对象。介于 0 和 1 之间的比例因子可缩小对象。

言论

此属性的初始值为 1.0000。

比例因子通常称为相对X比例因子。比例因子应用于对象的宽度,以允许独立于高度调整宽度。例如,如果比例因子值为 0.8,则绘制对象的宽度将是其正常未调整宽度的 80%。

尺寸、引线和公差对象:此属性将覆盖 DIMSCALE 系统变量。

如果在图纸空间中工作,则尺寸的比例因子将等于 0.0,AutoCAD 将根据当前模型空间视口和图纸空间之间的缩放比例计算合理的默认值。您将无法更改图纸空间中尺寸的比例因子。

例子

工 务 局:

Sub Example_ScaleFactor()
    ' This example creates a text object in model space.
    ' It then finds the current scale factor and changes it.
    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
    
    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 0.5
    
    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    
    ' Find the current scale factor for the text object
    Dim currScaleFactor As Double
    currScaleFactor = textObj.scalefactor
    MsgBox "The scale factor of the text is " & textObj.scalefactor, , "ScaleFactor Example"
    
    ' Change the scale factor for the text object
    textObj.scalefactor = currScaleFactor + 1
    ThisDrawing.Regen True
    MsgBox "The scale factor of the text is now " & textObj.scalefactor, , "ScaleFactor Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ScaleFactor()
    ;; This example creates a text object in model space.
    ;; It then finds the current scale factor and changes it.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the text object
    (setq textString "Hello, World."
          insertionPoint (vlax-3d-point 2 2 0)
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)
    
    ;; Find the current scale factor for the text object
    (setq currScaleFactor (vla-get-Scalefactor textObj))
    (alert (strcat "The scale factor of the text is " (rtos currScaleFactor 2)))
    
    ;; Change the scale factor for the text object
    (vla-put-Scalefactor textObj (1+ currScaleFactor))
    (vla-Regen doc :vlax-true)
    (alert (strcat "The scale factor of the text is now " (rtos (vla-get-Scalefactor textObj) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 15:33

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部