AnsweredAssumed Answered

get assembly component (any level) if name is given

Question asked by Jana Stahn on Feb 15, 2019
Latest reply on Feb 21, 2019 by Jana Stahn

Take for example this assembly:

 

I would like to know about methods to get the component that is highlighted in the picture from the following information:

- I have the IModelDoc2/IAssemblyDoc of the assembly (A.SLDASM)

- I know that the name of the component is "E-1/F^E-1/I-1".

 

As far as I know, I could use IAssemblyDoc.GetComponents(false) to get all components of A.SLDASM, then iterate them until I get the one with the correct name. But is there a better/faster way? Can I get it directly? IAssemblyDoc.GetComponentByName only works for top level components, so this method is no option. The GetCorresponding methods (of IModelDocExtension and of IComponent2) do not seem to work in this context either.

Outcomes