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: 

Accessing nested assembly component features?

0 REPLIES 0
Reply
Message 1 of 1
TommySWE
213 Views, 0 Replies

Accessing nested assembly component features?

I can't for the life of me figure out how to get a hold of features like work planes, origin planes, sketches etc that are nested under an assembly component.

 

So if I have an assembly and the browser tree looks something like this:

 

Assemly.iam

|-Representations

|-Origin

|

|-Part 1

   |-Origin

   |-Work Plane A

   |-Work Plane B

|

|- Part2

   |-Origin

   |-Work Plane C

   |-Work Plane D

|

|-Work Plane E

 

How can I access/target only the work/origin planes nested under the part components? I want to manipulate, among other things, the visibility states for these component work planes, but all I've been able to do so far is to change the state of "Work Plane E" (which is on root level) using:

 

SyntaxEditor Code Snippet

Dim openDoc As AssemblyDocument
openDoc = ThisDoc.Document
'Dim partCompDef As PartComponentDefinition

    'For Each WPOcc In openDoc.ComponentDefinition.WorkPlanes
    'WPOcc.Visible = True
    'Next

 

I've come as far as being able to turn the occurrences off themselves by doing this:

SyntaxEditor Code Snippet

Dim openDoc As AssemblyDocument
openDoc = ThisDoc.Document
'Dim partCompDef As PartComponentDefinition

     'toggle work features in the open document (top level assembly)
    For Each CompOcc In openDoc.ComponentDefinition.Occurrences()
        CompOcc.Visible = False
    Next

The problem I'm having is I cant reach into the occurrences, my approach is to try and get the occurrences, see if each occurrence is a part, if it is a part, look into the parts' nested work features and turn visibility on/off for work planes etc of my choosing. I did notice that if a component has a visible work plane (Such as A,B,C or D in the illustratioin), turning the component visibility off and then back on does turn the nested work plane visibility off, even when you set the component back to visible. But it seems like a poor way of solving the problem, as I dont want the component visibility states to be affected by the script.

 

Is this possible to do, because I was looking around in the API for four hours yesterday trying to find something to gain access to nested features?

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report