The example above writes the results to the iLogic Log window, and the units are in database units (centimeters), instead of document units, and the view's scale is not taken into consideration either. If you would like to further refine the numerical size results, you could modify the 'Main' routine like this:
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Return
Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a view.")
If oView Is Nothing Then Return
Dim oViewBox As Box2d = GetViewGeomBox2d(oView)
If oViewBox Is Nothing Then Return
Dim dWidth As Double = oViewBox.MaxPoint.X - oViewBox.MinPoint.X
Dim dHeight As Double = oViewBox.MaxPoint.Y - oViewBox.MinPoint.Y
'adjust for view scale to get 'actual size' results
dWidth = IIf (oView.Scale > 1, dWidth * oView.Scale, dWidth / oView.Scale)
dHeight = IIf (oView.Scale > 1, dHeight * oView.Scale, dHeight / oView.Scale)
'convert units from database units (centimeters) to document units
Dim UOM As UnitsOfMeasure = ThisDoc.Document.UnitsOfMeasure
dWidth = UOM.ConvertUnits(dWidth, UnitsTypeEnum.kDatabaseLengthUnits, UOM.LengthUnits)
dHeight = UOM.ConvertUnits(dHeight, UnitsTypeEnum.kDatabaseLengthUnits, UOM.LengthUnits)
Logger.Info("View Geometry Bounding Box Size: " & dWidth & " x " & dHeight)
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)