When you insert certain content center parts in to an assembly you may find that there are certain functions not available to use on these parts. Inserting a tube and pipe fitting for example will insert an instance that has the restructuring commands disabled, promote/demote typically. Why?
These parts are intended to be used in a tube and pipe assembly where these commands will break the functionality so are automatically limited. What happens though when these parts have been inserted as dumb components not in a tube and pipe assembly and you want this functionality.
This is where you can take advantage of the Inventor API and macro functionality.
The simple code below the image will loop through all the components in the assembly and remove any reorder command restrictions - be careful you don't run this on an assembly that is a tube and pipe run assembly though.
Public Sub removedisabledcommands()
Dim odoc As AssemblyDocument
Set odoc = ThisApplication.ActiveDocument
Dim oOcc As ComponentOccurrence
For Each oOcc In odoc.ComponentDefinition.Occurrences
If oOcc.DisabledActionTypes = kReorderAction Then
oOcc.DisabledActionTypes = kNoAction
End If
Next oOcc
End Sub
Alt+F11 for the Macro Editor to add this code (application project not document project)
Alt + F8 for the Macros list to access to run it in the application
Graham Harrison
No comments:
Post a Comment