Isolate part: iLogic or VBA command?

Isolate part: iLogic or VBA command?

Anonymous
Not applicable
3,801 Views
2 Replies
Message 1 of 3

Isolate part: iLogic or VBA command?

Anonymous
Not applicable

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.

0 Likes
Accepted solutions (2)
3,802 Views
2 Replies
Replies (2)
Message 2 of 3

pball
Mentor
Mentor
Accepted 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

 

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
Message 3 of 3

Anonymous
Not applicable
Accepted solution

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.

  • You can either select one component, and see what else intersects with it.
  • You can select multiple components, and see what else intersect with them, but not each other. (Click Yes)
  • You can select multiple components, and see if they intersect with each other. (Click No)
  • You can select nothing, and see all the interference in the entire assembly.
0 Likes