If you want a 4 digit precision as default and want to avoid setting the precision value for every new session, I suggest you add following small macros as button in the ribbon. To add a macro in the ribbon, use the Customize menu from Tools > Options > customize.
You will first have to create a class file in the VBA editor with name ClsMeasure and with following contents.
If you need a different precision, simply change the line precision = 4 to a different value
'*************************************************************
' The declarations and functions below need to be copied into
' a class module whose name is "clsMeasure". The name can be
' changed but you'll need to change the declaration in the
' calling function "InteractiveMeasureDistance" and
' "InteractiveMeasureAngle" to use the new name.
' Declare the event objects
Private WithEvents oInteractEvents As InteractionEvents
Private WithEvents oMeasureEvents As MeasureEvents
' Declare a flag that's used to determine when measuring stops.
Private bStillMeasuring As Boolean
Private eMeasureType As MeasureTypeEnum
Public Sub Measure(MeasureType As MeasureTypeEnum)
eMeasureType = MeasureType
' Initialize flag.
bStillMeasuring = True
' Create an InteractionEvents object.
Set oInteractEvents = ThisApplication.CommandManager.CreateInteractionEvents
' Set a reference to the measure events.
Set oMeasureEvents = oInteractEvents.MeasureEvents
oMeasureEvents.Enabled = True
' Start the InteractionEvents object.
oInteractEvents.Start
' Start measure tool
If eMeasureType = kDistanceMeasure Then
oMeasureEvents.Measure kDistanceMeasure
Else
oMeasureEvents.Measure kAngleMeasure
End If
' Loop until a selection is made.
Do While bStillMeasuring
DoEvents
Loop
' Stop the InteractionEvents object.
oInteractEvents.Stop
' Clean up.
Set oMeasureEvents = Nothing
Set oInteractEvents = Nothing
End Sub
Private Sub oInteractEvents_OnTerminate()
' Set the flag to indicate we're done.
bStillMeasuring = False
End Sub
Private Sub oMeasureEvents_OnMeasure(ByVal MeasureType As MeasureTypeEnum, ByVal MeasuredValue As Double, ByVal Context As NameValueMap)
Dim precision As Integer
precision = 4
Dim strMeasuredValue As String
If eMeasureType = kDistanceMeasure Then
MeasuredValue = ThisApplication.ActiveDocument.UnitsOfMeasure.ConvertUnits(MeasuredValue, kDatabaseLengthUnits, kDefaultDisplayLengthUnits)
MeasuredValue = Round(MeasuredValue, precision)
Dim sLengthUnit As String
sLengthUnit = ThisApplication.ActiveDocument.UnitsOfMeasure.GetStringFromType(ThisApplication.ActiveDocument.UnitsOfMeasure.LengthUnits)
strmeasurevalue = Str(MeasuredValue) + " " + sLengthUnit
MsgBox "Distance = " & strmeasurevalue, vbOKOnly, "Measure Distance"
Else
MeasuredValue = ThisApplication.ActiveDocument.UnitsOfMeasure.ConvertUnits(MeasuredValue, kDatabaseAngleUnits, kDefaultDisplayAngleUnits)
MeasuredValue = Round(MeasuredValue, precision)
Dim sAngularUnit As String
sAngularUnit = ThisApplication.ActiveDocument.UnitsOfMeasure.GetStringFromType(ThisApplication.ActiveDocument.UnitsOfMeasure.AngleUnits)
strmeasurevalue = Str(MeasuredValue) + " " + sAngularUnit
MsgBox "Angle = " & strmeasurevalue, vbOKOnly, "Measure Angle"
End If
' Set the flag to indicate we're done.
bStillMeasuring = False
End Sub
Then as a final step , you will have to create a new module in the VBA editor with following two macros in it:
Public Sub InteractiveMeasureDistance()
' Create a new clsMeasure object.
Dim oMeasure As New ClsMeasure
' Call the Measure method of the clsMeasure object
Call oMeasure.Measure(kDistanceMeasure)
End Sub
Public Sub InteractiveMeasureAngle()
' Create a new clsMeasure object.
Dim oMeasure As New ClsMeasure
' Call the Measure method of the clsMeasure object
Call oMeasure.Measure(kAngleMeasure)
End Sub
Cheers
Bob
Bob Van der Donck
Principal UX designer DMG group