Unit Round Off

Published on February 10, 2012

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.


Tags:
Like this article? Share it!

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Privacy Policy