ScaleFactor Property (ActiveX)

Specifies the scale factor for the object.

Supported platforms: Windows only

Signature

VBA:

object.ScaleFactor
object

Type: Attribute, AttributeReference, DgnUnderlay, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, DwfUnderlay, GeomapImage, Leader, MLeader, MLeaderStyle, PdfUnderlay, RasterImage, Shape, Text, Tolerance, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Double (ACAD_NOUNITS)

A real number greater than 0.0. A scale factor greater than 1 enlarges the object. A scale factor between 0 and 1 shrinks the object.

Remarks

The initial value for this property is 1.0000.

The scale factor is often referred to as the relative X scale factor. The scale factor is applied to the object's width to allow the width to be adjusted independently of the height. For example, if the scale factor value is 0.8, then the object will be drawn with a width that is 80 percent of its normal unadjusted width.

Dimension, leader, and tolerance objects: This property overrides the DIMSCALE system variable.

If you are working in paper space, the scale factor for dimensions will equal 0.0 and AutoCAD will compute a reasonable default value based on the scaling between the current model space viewport and paper space. You will not be able to change the scale factor for a dimension in paper space.

Examples

VBA:

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)))
)