Check out a useful tool to check if any dimensions in a drawing have been overwritten. It examines all dimensions in the detail sheet and checks whether they have been overwritten or not. If any dimension is overwritten, it will highlight these dimensions in red and then show the user the number of dimensions affected via a message box.
The undo code (undo wrapper) ensures that all changes made by your iLogic code can be easily undone by the user, maintaining the integrity of the design.
Below is the iLogic code for Autodesk Inventor:
'iLogic code By Dutt Thakar 'Originally posted on https://clintbrown.co.uk
oDoc = ThisDoc.Document
oNamer = "Highlight Dimension Overrides"
Dim UNDO As Transaction
UNDO = ThisApplication.TransactionManager.StartTransaction(oDoc, oNamer)
' Undo Wrapper -------------------------------------------------------------------------------------
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oColor As Color
'Creating a color based On R, G, B values, here I want To highlight In red so kept it As (255,0,0)
oColor = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
Dim oDim As DrawingDimension
Dim DimCount As Integer = 0
For Each oDim In oSheet.DrawingDimensions
If oDim.OverrideModelValue <> oDim.ModelValue Or oDim.HideValue = True Then
oDim.Text.Color = oColor
DimCount = DimCount + 1
Else
oDim.Text.Color = ThisApplication.TransientObjects.CreateColor(0, 0, 0)
End If
Next
If DimCount>0
MessageBox.Show(DimCount & " Dimensions are overridden")
Else
MessageBox.Show("No Dimensions are overridden")
End If
iLogicVb.DocumentUpdate
' Undo Wrapper -------------------------------------------------------------------------------------
UNDO.End
Notes:
- This version of the code was briefly tested in Inventor 2021.
- Like always, please, test all iLogic code extensively in non-production files. Do not use any code in a production environment until YOU have thoroughly tested it and verified that it works as expected. Always backup any data before running any experimental code. You are ultimately responsible for any iLogic code you run, so be sure to test it thoroughly!
Credits: Dutt Thakar - https://clintbrown.co.uk/
Autodesk iLogic breakdown: Show superscript dimensions