- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Have you considered that the 499.4 raw number you are supplying may be getting understood as 'database units', instead of your intended 'document' units? This is a fairly well known issue that a ton of us wish we could eliminate, once and for all, but it persists, due to global use. Any raw numbers specified within the code, that are in a 'length' scenario, are usually understood by the 'system' as 'database units' (centimeters), instead of whatever length units you may be using within your document.
Try this (set-up to ensure the 499.4 is understood as Inches): (you could also just use some simple math)
Sub Main
Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
For Each oDim As DrawingDimension In oSheet.DrawingDimensions
If oDim.ModelValue <= UnitConv(499.4, UnitsTypeEnum.kInchLengthUnits) Then
If Round(oDim.ModelValue * 10, 1) -Round(oDim.ModelValue * 10, 0) = 0 Then
oDim.Precision = 0
Else
oDim.Precision = 1
End If
Else
oDim.Precision = 0
End If
Next
End Sub
Function UnitConv(oVal As Double, oIntendedUnits As UnitsTypeEnum) As Double
'just set up to deal with 'Length' type units right now
'this converts your Inches input to 'database units' so the rule will understand it as intended
Return ThisApplication.UnitsOfMeasure.ConvertUnits(oVal, oIntendedUnits, UnitsTypeEnum.kDatabaseLengthUnits)
End Function
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS)
.
If you want and have time, I would appreciate your Vote(s) for My IDEAS
or you can Explore My CONTRIBUTIONS
Wesley Crihfield
(Not an Autodesk Employee)