the code also keeps any custom text in your ordinate dimension.
Imports Inventor
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Imports System
Imports System.Windows.Forms
Imports System.Text.RegularExpressions
AddReference "System.Drawing.dll"
AddReference "System.Xml.dll"
'Dim oDoc As DrawingDocument
'oDoc = ThisApplication.ActiveDocument
Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView
'Define the drawing dims collection
Dim oDrawingDims As DrawingDimension
On Error Resume Next
'Loop through all dimensions and replace the zero with precision to just zero
For Each oView In oSheet.DrawingViews
For Each oDrawingDims In oDoc.ActiveSheet.DrawingDimensions
' Use regex to check if the text contains patterns like ".00" or "2X .00" without digits directly before the dot
If Regex.IsMatch(oDrawingDims.Text.Text, "(^|\D)\.[0]+(\D|$)") Then
'oDrawingDims.HideValue = True
'oDrawingDims.Text.FormattedText = "0"
oDrawingDims.Precision = 0
End If
'Use Origin Indicator - DrawingOrdinateDimensionUseOriginIndicatorCtxCmd
'Hide Origin Indicator - DrawingOrdinateHoleOriginIndicatorCtxCmd
Next
Next
'Next
SendKeys.SendWait("{ESC}")
AppActivate(ThisApplication.Caption)