VBA- Unable to change tolerance precision

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
All the values I put in to set my tolerance are being rounded to three decimal places even though the value is four place and I am setting the dimension precision to four place.
For Example: I have a hole of diameter 2.0466. It is to have a tolerance of +.0005/-.0000. When tolerance.setToDeviation is called, the .0005 is strangely forced to .001 and is set as this in the part file. The precision value had already been set to 4 at this point.
All suggestions and help is greatly appreciated!
I am using the following code in Inventor 2010:
'Create hole feature
Call oCompDef.Features.HoleFeatures.AddDrilledByThroughAllExtent(oLinearPlacementDef, dDiameter, kExtentDirection)
'Get hole feature just created
Dim oHole As HoleFeature
Set oHole = oCompDef.Features.HoleFeatures.Item(oCompDef.Features.HoleFeatures.Count) ' need most recent index
'Get the parameter controlling its diameter
Dim oDiamParam As Parameter
Set oDiamParam = oHole.HoleDiameter
'Set Precision
oDiamParam.Precision = dPrecision
'Set the tolerance
If (sToleranceType = "Deviation") Then
Call oDiamParam.Tolerance.SetToDeviation(dUpperTol, dLowerTol)
ElseIf (sToleranceType = "Limits") Then
Call oDiamParam.Tolerance.SetToLimits(kLimitsStackedTolerance, dUpperTol / 2, dLowerTol / 2)
End If
oDoc.Rebuild