iLogic: Show Overridden Dimensions

By Dutt Thakar

I have written a handy iLogic utility to check if any dimensions on a drawing are overridden. It scans all of the dimensions on the sheet and checks whether they are overridden or not. If any dimensions are overridden, it will highlight them in red and then show the user that how many dimensions are overridden via message box.

Click me for HD version

To make it easy to undo the changes to the drawing, I have placed the code in an undo wrapper.

Here is the iLogic code:

'iLogic code By Dutt Thakar 'Originally posted on https://clintbrown.co.uk/ilogic-show-overridden-dimensions

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.

As always, please test all iLogic code extensively on non-production files. Do not use any code in a production environment until YOU have thoroughly tested it and have verified that it works as expected. Always back up any data before running any experimental code. You are ultimately responsible for any iLogic code that you run, so make sure you test it thoroughly!

About the Author:

Dutt Thakar has been using Inventor and Vault since 2014 . He works for a company that creates food and dairy processing plants and equipment. Dutt’s career has been spent mostly working as a Mechanical Design Engineer. In his current role, Dutt creates automated models and drawings using Inventor and iLogic (apart from doing regular projects). He also uses VBA and VB.Net to create automations using the Inventor API.

LinkedIn | Blog