Code outside SwAddin

How can execute code that is not included in the main class? For example, move the code CreateCube in its own class. How to pass this class current ISldWorks.

SolidworksApi macros