How do I reference a part by it's name in the assembly within an iLogic rule?
Example Code:
Dim oDoc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument 'Current Document
Dim oOcc As ComponentOccurrence 'Each Occurrence of a part or subassembly
MsgBox(oDoc.ComponentDefinition.Occurrences("Test Part:1").Definition.Sketches.Count)
Even though a part with this name exists in the assembly, if I execute this code I get "Conversion from string "Test Part:1" to type 'Integer' is not valid.
Is there another way to reference parts in code by their name (other than a For... Next loop with an If statement).
Thanks,
Steve
Solved! Go to Solution.
Solved by rjay75. Go to Solution.
MsgBox(Component.InventorComponent("TestPart:1").Definition.Sketches.Count)