Issue:
You wish that you had a way to automatically do the following list of general house keeping chores for your assembly files:
- sort the browser tree in descending order so that part numbers are easier to index and find
- collapse any browser nodes that have been left expanded in the browser tree
- return the view to the Home view
- zoom all
Here is an iLogic rule to do these things. You can set this rule up to run anytime a file is closed using the iLogic event triggers.
'-----start of ilogic-----
'sort components in the browser
ThisApplication.CommandManager.ControlDefinitions.Item _
("AssemblyBonusTools_AlphaSortComponentsCmd").Execute
'set a reference to the document
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
'Set a reference to the top node of the active browser
Dim oTopNode As BrowserNode
oTopNode = oDoc.BrowserPanes.ActivePane.TopNode
Dim oNode As BrowserNode
For Each oNode In oTopNode.BrowserNodes
' If the node is visible and expanded, collapse it.
If oNode.Visible = True And oNode.Expanded = True Then
oNode.Expanded = False
End If
Next
'Return view to Home view
ThisApplication.CommandManager.ControlDefinitions.Item _
("AppViewCubeHomeCmd").Execute
'zoom all
ThisApplication.ActiveView.Fit
'-----end of ilogic-----
I originally had:
which works in older versions, but I have amended it as follows, based on some feedback from "prachu" on the Inventor forums.
you can also use:
****Edit****
I originally had:
'Return view to Home view
ThisApplication.CommandManager.ControlDefinitions.Item _
("AppForceIsoCmd").Execute
which works in older versions, but I have amended it as follows, based on some feedback from "prachu" on the Inventor forums.
'Return view to Home view
ThisApplication.CommandManager.ControlDefinitions.Item _
("AppViewCubeHomeCmd").Execute
you can also use:
'Return view to Home view
ThisApplication.CommandManager.ControlDefinitions.Item _
("AppIsometricViewCmd").Execute