Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

adding a sub-component as a participant in an assembly feature in iLogic/API

1 REPLY 1
Reply
Message 1 of 2
MikeGillam5072
506 Views, 1 Reply

adding a sub-component as a participant in an assembly feature in iLogic/API

Is there a trick to making a sub-component participate in a feature (ExtrudeFeature, SweepFeature, etc.)?

 

I've tried using the SweepFeature.AddParticipant(ComponentOccurrence) and ExtrudeFeature(ComponentOccurrence) functions, and both work fine when the ComponentOcurrence is a direct component of the assembly.

 

However, if I explode down another level, and pass in a ComponentOccurrence for a sub-component, I get an INVALID_ARG error.

 

I can do this manually in the Inventor model browser.

 

I worked around the problem by collapsing the assembly structure, but now my customer is pressing me "to do it right".

 

If necessary, I'll reconstruct a the code snippet that was failing.

 

Any help is appreciated.  thanks

1 REPLY 1
Message 2 of 2
YuhanZhang
in reply to: MikeGillam5072

Below sample will show how to implement it:

 

Sub AddParticipantSample()
    ' New an assembly, place a sub-assembly which has two occurrences
    ' create an extrude feature on the first occurrence of the sub-assembly
    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oExtrude As ExtrudeFeature
    Set oExtrude = oDoc.ComponentDefinition.Features.ExtrudeFeatures(1)
    
    Dim oOcc As ComponentOccurrence
    Set oOcc = oDoc.ComponentDefinition.Occurrences(1)
    
    Dim oSubOccProxy As ComponentOccurrenceProxy
    oOcc.CreateGeometryProxy oOcc.SubOccurrences(2), oSubOccProxy
    
    oExtrude.AddParticipant oSubOccProxy
End Sub

 You may want to see a topic in API document titled "Introduction to proxies", it will explain the concept of proxy. Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report