GetBoundingBox method example

Sub Example_GetBoundingBox()

     ' This example creates text and finds the bounding box for the text.

 

     Dim myText As String

     Dim textObj As IntelliCAD.Text

     Dim insPt As IntelliCAD.Point

     Dim height As Double

     Set insPt = Library.CreatePoint(3, 7)

     height = 5

     myText = "Test string for bounding box"

     ' Add the Text object

     Set textObj = ThisDocument.ModelSpace.AddText(myText, insPt, height)

     textObj.Update

     ThisDocument.ActiveViewport.ZoomExtents

 

     ' Return the bounding box for the text and return the lower left

     ' and upper right corners of the box.

     Dim LL As Point

     Dim UR As Point

 

     textObj.GetBoundingBox LL, UR

     MsgBox "The extents of the bounding box for the text are:" & Chr(13) & "Lower Left: " & LL.x & ", " & LL.y & Chr(13) & "Max Extent: " & UR.x & ", " & UR.y

End Sub