Is there a way to apply heat loads programmatically?

Let's say I have n stacked cubes and I want to apply a power load to each of them as a function of their relative position. If n is large this can be a huge pain to do through the GUI. Is there a way to apply loads programmatically in this situation?

SolidworksSimulation