Unit Round Off

In MicroStation the round off of working units is controlled by the Settings > Design File > Working Units > Accuracy setting. This applies to both coordinate input and display in MicroStation tools. Unfortunately there is no automatic conversion for us in VBA. The example function below demonstrates a method that can be used to access the design file working unit accuracy setting for displaying coordinates.

Public Function CoordinateReadout(dValue As Double) As String
Select Case ActiveSettings.CoordinateAccuracy
Case MsdCoordinateAccuracy.msdAccuracy0
CoordinateReadout = Format$(dValue, "#0.")
Case MsdCoordinateAccuracy.msdAccuracy1
CoordinateReadout = Format$(dValue, "#0.0")
Case MsdCoordinateAccuracy.msdAccuracy2
CoordinateReadout = Format$(dValue, "#0.00")
Case MsdCoordinateAccuracy.msdAccuracy3
CoordinateReadout = Format$(dValue, "#0.000")
Case MsdCoordinateAccuracy.msdAccuracy4
CoordinateReadout = Format$(dValue, "#0.0000")
Case MsdCoordinateAccuracy.msdAccuracy5
CoordinateReadout = Format$(dValue, "#0.00000")
Case MsdCoordinateAccuracy.msdAccuracy6
CoordinateReadout = Format$(dValue, "#0.000000")
Case Else
CoordinateReadout = CStr(dValue)
End Select
End Function

Note: The function above does not handle of display values using fractions or scientific notation.

EnvisionCAD

EnvisionCAD

Since 1996, EnvisionCAD has been a nationally recognized leader in the configuration, customization, implementation, training & support for CAD software solutions. Our individualized approach has benefited private engineering firms and government agencies alike. Basic or advanced, we can help you get the most from your CAD technology.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *