Export bodies from Assembly

I have an assembly with multiple components, and each component has multi bodies.

I want to export certain bodies (as STL) of each component from my assembly.

I use the SaveAs method in IModelDocExtension to save my STL, but the resulting file always contains all of the bodies in the assembly, no matter if I hide, or select certain bodies or not.

When I use this method in a part, only the visible bodies are exported. (Selecting bodies gives a prompt to choose which bodies you want to export.)

Is there a solution for this problem to save only the visible bodies from my assembly?

I use SW2010.

Thanks for your help.

SolidworksApi macros