ConvertToCurrentAreaDisplay Example

AEC Auto

ConvertToCurrentAreaDisplay Example

Sub Example_ConvertToCurrentAreaDisplay()
    
    ' This example returns the value of ConvertToCurrentAreaDisplay
    ' for the current drawing.
    Dim dbPref As AecArchBaseDatabasePreferences
    Set dbPref = AecArchBaseApplication.ActiveDocument.preferences
    
    ' Set the area display units to square yards
    dbPref.AreaDisplayUnit = aecUnitSquareYard
    
    Dim SourceArea As Double
    Dim TargetArea As Double
    
    SourceArea = 36.0 *  36.0 'Square units, assumes drawing set to inch units
    TargetArea = dbPref.ConvertToCurrentAreaDisplay(SourceArea)
    
    MsgBox "The area to convert is " & sourcearea & " square inches." & vbCrLf & _
        "The AreaDisplayUnit is set to square yard." & vbCrLf & _
        "The value for ConvertToCurrentAreaDisplay is " & TargetArea & " square yards.", _
        vbInformation, "ConvertToCurrentAreaDisplay Example"
    
End Sub