Stepping through multiple parts and/or assemblies in an assembly file

I've posted before about a project I'm working on that will analyze a part file and gather structural member info if it has a length property. I decided to write a separate post because I'm not sure if my initial approach was correct. I'm looking for a way to step through part(s) and/or assembly(ies) in an assembly file and run my code that collects member information. What I really need is a check on my logic. To me the solution would involve a function for part files and a function for assembly files so that I can call them while in a loop. Would this be the appropriate approach?

SolidworksApi/macros