Macro as Linear Pattern

Hello everyone,

I'm totally green in API but I have to write a macro which automatically addes many times the same part in definite orientation. It looks like Linear Component Pattern but in three direction. It would be great if I can declare number of part firstly.

Any ideas, suggestions?

Thakns for help

SolidworksApi macros