Specifies the X scale factor for the block or external reference (xref).
Supported platforms: Windows only
VBA:
object.XScaleFactor
Type: BlockReference, ExternalReference, MInsertBlock
The object this property applies to.
Read-only: No
Type: Double
A non-zero real number.
The initial scale factor is 1.0.
VBA:
Sub Example_XScaleFactor() ' This example creates a block containing a circle. ' It then inserts the block and changes the XScaleFactor. ' 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) ' Find the current XScaleFactor for the block reference Dim currXScaleFactor As Double currXScaleFactor = blockRefObj.XScaleFactor ZoomAll MsgBox "The current XScaleFactor for the block reference is " & blockRefObj.XScaleFactor, , "XScaleFactor Example" ' Change the XScaleFactor for the block reference blockRefObj.XScaleFactor = currXScaleFactor + 2 ZoomAll MsgBox "The new XScaleFactor for the block reference is " & blockRefObj.XScaleFactor, , "XScaleFactor Example" End Sub
Visual LISP:
(vl-load-com) (defun c:Example_XScaleFactor() ;; This example creates a block containing a circle. ;; It then inserts the block and changes the XScaleFactor. (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 XScaleFactor for the block reference (setq currXScaleFactor (vla-get-XScaleFactor blockRefObj)) (vla-ZoomAll acadObj) (alert (strcat "The current XScaleFactor for the block reference is " (rtos (vla-get-XScaleFactor blockRefObj) 2))) ;; Change the XScaleFactor for the block reference (vla-put-XScaleFactor blockRefObj (+ currXScaleFactor 2)) (vla-ZoomAll acadObj) (alert (strcat "The new XScaleFactor for the block reference is " (rtos (vla-get-XScaleFactor blockRefObj) 2))) )