Insertion point for a tolerance, text, block, or shape, and the origin (upper-left corner) of an OLE object.
Supported platforms: Windows only
VBA:
object.InsertionPoint
Type: Attribute, AttributeReference, BlockReference, ComparedReference, ExternalReference, MInsertBlock, MText, OLE, PointCloud, PointCloudEx, Shape, Table, Text, Tolerance
The objects this property applies to.
Read-only: No
Type: Variant (three-element array of doubles)
A 3D WCS coordinate representing the insertion or origin point.
MText: Specifies the location for a corner of the text boundary. Use the AttachmentPoint property to specify which corner of the text boundary is to be positioned at this insertion point.
Text: This property is read-only except for text whose Alignment property is set to acAlignmentLeft, acAlignmentAligned, or acAlignmentFit. To position text whose justification is other than left, aligned, or fit, use the TextAlignmentPoint property.
VBA:
Sub Example_InsertionPoint() ' This example creates a text object in model space. ' It then changes the insertion point of the text object. 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 ' Return the current value of the insertion point Dim currInsertionPoint As Variant currInsertionPoint = textObj.insertionPoint MsgBox "The insertion point of the text is " & currInsertionPoint(0) & ", " & currInsertionPoint(1) & ", " & currInsertionPoint(2), vbInformation, "InsertionPoint Example" ' Change the insertion point of the text object and ' update the display of the text object. insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0 textObj.insertionPoint = insertionPoint textObj.Update MsgBox "The new insertion point of the text is " & textObj.insertionPoint(0) & ", " & textObj.insertionPoint(1) & ", " & textObj.insertionPoint(2), vbInformation, "InsertionPoint Example" End Sub
Visual LISP:
(vl-load-com) (defun c:Example_InsertionPoint() ;; This example creates a text object in model space. ;; It then changes the insertion point of the text object. (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) ;; Return the current value of the insertion point (setq currInsertionPoint (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint textObj)))) (alert (strcat "The insertion point of the text is " (rtos (nth 0 currInsertionPoint) 2) ", " (rtos (nth 1 currInsertionPoint) 2) ", " (rtos (nth 2 currInsertionPoint) 2))) ;; Change the insertion point of the text object and ;; update the display of the text object. (setq insertionPoint (vlax-3d-point 3 3 0)) (vla-put-insertionPoint textObj insertionPoint) (vla-Update textObj) (setq newInsertionPoint (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint textObj)))) (alert (strcat "The new insertion point of the text is " (rtos (nth 0 newInsertionPoint) 2) ", " (rtos (nth 1 newInsertionPoint) 2) ", " (rtos (nth 2 newInsertionPoint) 2))) )