Changing Measure Precision

Changing Measure Precision

Anonymous
Not applicable
6,707 Views
8 Replies
Message 1 of 9

Changing Measure Precision

Anonymous
Not applicable

Is there a way to change the default measure precision to a 4-place decimal? We get better results when mating parts to each other.

0 Likes
6,708 Views
8 Replies
Replies (8)
Message 2 of 9

Paul.Normand
Alumni
Alumni

Hi,

 

Go to Tools>Documents Settings>Units tab and set the display precision.

 

You can also set the precision "on the fly" in the measure command. Start the Measure command, click the arrow and select Precision from the flyout. This setting is forgotten when you exit, but persists for the current session.

 

Cheers,

Paul



Paul Normand
Principal Content Developer/SME
Design Lifecycle and Simulation (DLS)
Autodesk, Inc.

0 Likes
Message 3 of 9

bobvdd
Alumni
Alumni

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
Message 4 of 9

Curtis_Waguespack
Consultant
Consultant

@Anonymous wrote:

Is there a way to change the default measure precision to a 4-place decimal? We get better results when mating parts to each other.


 

Vote for this idea here:

http://forums.autodesk.com/t5/inventor-ideas/measuring-tool-save-precision-level-application-options/idi-p/5512986

EESignature

0 Likes
Message 5 of 9

admaiora
Mentor
Mentor

You can save it simply as template

 

Senza titolo-1.jpg

 

 

 

qqqqq.jpg

 

 

22.jpg

 

 

 

3333.jpg

Admaiora
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

_____________________________________________________________________________
Facebook | Twitter | Youtube

0 Likes
Message 6 of 9

bobvdd
Alumni
Alumni

@admaiora  Your solution with template would solve the default precision when creating new dimensions but it would not affect the default precision when MEASURING , right? Unless I completely misunderstood.

 

Cheers

Bob




Bob Van der Donck


Principal UX designer DMG group
0 Likes
Message 7 of 9

SBix26
Consultant
Consultant

All academic at this point since measurement precision is now saved in files...

Sam B
Inventor Pro 2018.2.3 | Windows 7 SP1
LinkedIn

0 Likes
Message 8 of 9

mcgyvr
Consultant
Consultant

@SBix26 wrote:

All academic at this point since measurement precision is now saved in files...

Sam B
Inventor Pro 2018.2.3 | Windows 7 SP1
LinkedIn


yeah weird that an Autodesk employee responded to a ~2 year old post like that..



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 9 of 9

bobvdd
Alumni
Alumni

Nobody's perfect 🙂

Bob




Bob Van der Donck


Principal UX designer DMG group