Rotating instances in a circular pattern?

Hi,

I'm currently modeling a fully parametric Halbach cylinder array ​and I'm having trouble with getting the magnet slots to resolve correctly.

Here's an example of a semi-parametric version I've made:

3eSl28r.png?1

The center of the rectangular magnets are all coincident with a specified diameter. Their position is dictated by the number of instances.

The formula for the tilt angle is simple enough: 2 x the magnet's position angle. This way, at 90° the magnet is rotated a full 180° and at 180°, its rotated back to its original angle (0°/360°).

I've tried using a circular pattern and the "Instances to vary" option, but I wasn't able to get the tilt angle to change as I want. I get "The increment is too big to cause the dimention to reverse. Try again with a smaller increment." but no matter how small an increment I use, the same thing happens.

UqYAMtC.png?1

Is there a tool I can use to solve this problem?

I've also considered creating a python script to generate the geometry I need and import it in solidworks. Is this a viable solution or a fool's errand?

Thank you.

SolidworksSketching