InsertionPoint property example

Sub InsertionPoint_Example()
' This example creates text and adds it to the drawing.
' It then obtains the InsertionPoint and TextAlignmentPoint properties.
    Dim sBuf As String
    Dim textObj As AcadText
    Dim insPt(0 To 2) As Double
    insPt(0) = 0: insPt(1) = 9
    Dim dHeight As Double
    dHeight = 1
    sBuf = "Test string for the AddText method"
    ' Add the text Object
    Set textObj = ThisDrawing.ModelSpace.AddText(sBuf, insPt, dHeight)
    textObj.Update
    ThisDrawing.Application.ZoomExtents
    Dim vInsertionPoint As Variant
    vInsertionPoint = textObj.InsertionPoint
    MsgBox "Insertion Point: " & _
    Chr(13) & "x = " & vInsertionPoint(0) & _
    Chr(13) & "y = " & vInsertionPoint(1) & _
    Chr(13) & "z = " & vInsertionPoint(2)
    Dim vTextAlignmentPoint As Variant
    vTextAlignmentPoint = textObj.InsertionPoint
    MsgBox "Text Alignment Point: " & _
    Chr(13) & "x = " & vTextAlignmentPoint(0) & _
    Chr(13) & "y = " & vTextAlignmentPoint(1) & _
    Chr(13) & "z = " & vTextAlignmentPoint(2)
End Sub

© Bricsys NV. All rights reserved.