指定对象的比例因子。 支持的平台:仅窗口 签名工 务 局: object.ScaleFactor
属性值只读:不 类型:双人间 (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)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 08:51
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.