squared spring shape

I’m trying to make a variation on a spring. One can imagine a normal spring being made by wrapping a round bar around a cylinder. The wrap direction is always a little bit along the axis of the cylinder as well as around it giving a constant slope upwards if the spring is upright.

Instead of wrapping around a cylinder, I want to wrap the round bar around something that has a rounded off square for a cross section,

It is important that the slope remain constant on both the straight and curved sections.

Any ideas as to how to go about this?


Add a NURBS Circle and select the 2 open ends and hit C. Hit 3D in F9, select each point in sucession and move it up an incremental amount to get a spiral. Shft-D a couple of times and stack the duplicates on top of one another. Select all and Ctrl-J in Object mode. In Edit mode select the end of one curve and the beginning of the one above it and F to join.
Select all the verts of one corner and set weight to 90 and press “Set Weight”. Repeat for all corners. Add another NURBS Circle and scale to the diameter of the wire and name it Profile. Select the coil and type “Profile” into the BevOb: field.