What's new

Traversing ENTIRE Assembly ( including parts )

eneyer

Member
Traversing ENTIRE Assembly ( including parts )

I am traversing parts to get the dimensions. That works fine.

When I traverse an assembly, the session is an AssemblySession of which I can only get the child Occurrences. That is fine until I get down to the part level. At that point, I can’t switch gears into part mode (PartSession) for each part and the dimensions/parameters that I am looking for.
 

shubhab

Member


Hi Eric,

It should be possible to get to the part level and then query for dimensions.
You can get the design session(IADDesignSession) for the occurrence and then assign that to the part session(IADPartSession) object. From here onward, you can query the part for it's dimensions as you did for a regular part.

Here is the sample VB code snippet:

Dim objPartSession As IADPartSession
Dim DesignSession As IADDesignSession

Do While ((OccurrencesEnum.HasMoreElements = True)
Set eachOccurrence = OccurrencesEnum.NextElement
Set objPartSession = eachOccurrence.DesignSession
MsgBox (objPartSession.FeatureCount)
Loop

In the above code snippet, I am assuming that you have only parts in an assembly.

Let me know if you need any more clarification.

Thanks,
Shubha,
Alibre, Inc.
 

eneyer

Member


That's exactly what I needed. Thank you very much for your help. Looking in the API documentation, I didn't see the connection between a DesignSession and a PartSession. It works perfectly now.
 
Top