Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
tyler.warner
in reply to: 37xitp4

Your code with the addition of the unit conversion seems to be working for me.

It could be a style that's replacing the period with a comma for the decimal, see these links (Link1 , Link2 ).

 

Public Sub Test()

Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveEditDocument

Dim oUOM As UnitsOfMeasure
Set oUOM = oDrawDoc.UnitsOfMeasure

Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet

Dim oDim As DrawingDimension
Dim oInspDimShape As InspectionDimensionShapeEnum
Dim oInspDimNumber As String
Dim oInspDimRate As String
Dim oInspDimTolUpper As Double
Dim oInspDimTolLower As Double

    For Each oDim In oSheet.DrawingDimensions
        If oDim.IsInspectionDimension Then
            oDim.GetInspectionDimensionData oInspDimShape, oInspDimNumber, oInspDimRate

            oInspDimTolUpper = oDim.Tolerance.Upper
            oInspDimTolLower = oDim.Tolerance.Lower
            oInspDimTolUpper = oUOM.ConvertUnits(oDim.Tolerance.Upper, UnitsTypeEnum.kDatabaseLengthUnits, UnitsTypeEnum.kInchLengthUnits)
            oInspDimTolLower = oUOM.ConvertUnits(oDim.Tolerance.Lower, UnitsTypeEnum.kDatabaseLengthUnits, UnitsTypeEnum.kInchLengthUnits)
        
            Debug.Print CStr(oInspDimShape)
            Debug.Print oInspDimNumber
            Debug.Print oInspDimRate
            Debug.Print "Tol Type: " + CStr(oDim.Tolerance.ToleranceType)
            Debug.Print "Tol Value: " + CStr(oDim.Text.Text)
            Debug.Print "Tol Upper: " + CStr(oInspDimTolUpper)
            Debug.Print "Tol Lower: " + CStr(oInspDimTolLower)
            Debug.Print ""
        End If
    Next
    
End Sub

 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.