I'm programming a rule that searches an assembly for a certain criteria, selects the parts based on that, and I want to show only those selected parts. I can do this manually if I select the parts in the assembly tree, and then right click and choose "Isolate" however after searching through the forums and API Help, I can't seem to find any command that would allow me to do this, although I can do it manually. Is there a way to program this manual option, or am I just missing something?
The criteria I'm using is interference, and I want to see just the two parts that interfere. I've been collecting code and modifying it, and I'm so close. I'm able to recursively search through sub assemblies, and find the parts. I just need to only show the ones that I've selected through the code. I'll post the final code so anyone can use it afterwards.
Solved! Go to Solution.
Solved by pball. Go to Solution.
Well if you can select the parts you want programically I have a solution for isolating them. All commands in inventor are available while scripting, some just don't have a simple way to access them.
Attached is a text file of all the commands availble while scripting and shown below is a function to run those commands and the isolate and undo isolate examples. Hope this helps.
'isolate currently selected parts run_cmd("AssemblyIsolateCmd") 'undo isolation run_cmd("AssemblyIsolateundoCmd") 'function to run commands Function Run_CMD(ByVal cmd As String) As Boolean ' Get the CommandManager object. Dim oCommandMgr As CommandManager Set oCommandMgr = ThisApplication.CommandManager ' Get control definition for the line command. Dim oControlDef As ControlDefinition Set oControlDef = oCommandMgr.ControlDefinitions.Item(cmd) ' Execute the command. Call oControlDef.Execute End Function
That worked. I now have two versions that I can share now. This is taken from the API Library as an example, but modified as an external rule for iLogic.
The attached rules are editable like Text, and can be run as an External Rule as is, or copied into a rule contained within a part or assembly.
I can't take much credit, as I just compiled the code, and converted it into iLogic. That being said, I can't confirm that it will work for everyone, but it works for all of my examples.
This basically works as a smarter Analyze Interference option.