GetBoundingBox method example


Sub GetBoundingBox_Example()
' This example creates text and finds the bounding box for the text.
    Dim myText As String
    Dim textObj As AcadText
    Dim insPt(0 To 2) As Double
    Dim height As Double
    insPt(0) = 3: insPt(1) = 7: insPt(2) = 0
    height = 5
    myText = "Test string for bounding box"
    ' Add the Text object
    Set textObj = ThisDrawing.ModelSpace.AddText(myText, insPt, height)
    textObj.Update
    ThisDrawing.Application.ZoomExtents
    ' Return the bounding box for the text and return the lower left
    ' and upper right corners of the box.
    Dim LL As Variant
    Dim UR As Variant
    textObj.GetBoundingBox LL, UR
    MsgBox "The extents of the bounding box for the text are:" & Chr(13) & _
    "Lower Left: " & LL(0) & ", " & LL(1) & Chr(13) & "Max Extent: " & UR(0) & ", " & UR(1)
End Sub

© Bricsys NV. All rights reserved.