Loop through each part in an assembly and make it the displayed part

Hello,

I need to be able to loop through each part in an assembly and make it my displayed part.

Noticed that there was an export bom to excel with a screen shot of the part and was hoping that there was a more stripped down example of code that could be used to do this task with out all of the excel stuff intermingled.

I had some code that I though was working but for some reason some of the parts in the assembly are being missed.

I am working in a team center environment and have assemblies that are some times 10 layers deep.

Any help would be appreciated.

Carlo posted some code that will loop through an assembly and make each top level component the displayed part in turn.
http://nxjournaling.com/comment/542#comment-542

Using the above code along with the article about processing every part in an assembly, you should be able to get what you need.
http://www.nxjournaling.com/content/creating-subroutine-process-all-comp...