save/treat each part of an assembly c#

I am trying to do something on sldprt files from a top level of a big assembly.

Exist an macro to load parts and do specific action on?

current view is the assembly top level

for each part on current assembly

0:

get all parts

     load if is "sldprt"

          do something about (save it for example)

if is a sub-assembly

goto 0

SolidworksApi/macros