Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dears,
Could you please help me how to enable/disable the "Substitute" function via iLogic/API?
Thanks!
Solved! Go to Solution.
Dears,
Could you please help me how to enable/disable the "Substitute" function via iLogic/API?
Thanks!
Solved! Go to Solution.
Hi @ngdnam88. I am not familiar with that, but I do know the command that gets executed when you choose that item in the right-click menu is named "CMxSubstituteCmd". You may be able to simulate choosing that item in the right-click menu by using the
ThisApplication.CommandManager.ControlDefinitions.Item("CMxSubstituteCmd").Execute()
line of code.
However, since I am not familiar with it, I do not know if there is a Inventor API equivalent to executing the command. It makes me think of the ModelStates though. When we have an assembly open, and right click on the main ModelStates folder, it gives us the 'expandable' option named 'New Substitute', which has 3 sub options named 'Derive Assembly', 'Simplify', and 'Select Part File'. I pretty much never use those, but this sort of sounds like that last option, but maybe initiating it in reverse order (from the part, instead of from the assembly). Not sure though.
Wesley Crihfield
(Not an Autodesk Employee)
This example rule works but only if the substitute property was turned on at least once before. Not sure why it doesn't work beforehand.
Sub Main
Dim oDoc As PartDocument = ThisDoc.Document
oDoc.BrowserPanes("Model").TopNode.DoSelect
ThisApplication.CommandManager.ControlDefinitions.Item("CMxSubstituteCmd").Execute
End Sub
Actually this is just a property of a partdocument object. Couldn't get easier!
Sub Main
Dim oDoc As PartDocument = ThisDoc.Document
oDoc.IsSubstitutePart = True
End Sub