I'm going to have to steal that code and try and work my way through it. Another idea I had was to be able to pick a pline to follow as a path while still doing the twisty thingy, but I think that's maybe a bit advanced for me at the moment

Steal away

Following a path is exactly what the routine does, except it's a path calculated on the fly. It's actually quite simple if you study the vlax-curve functions a bit.

Here's the simplified pseudocode:

1. Pick a curve object

2. Divide the curve into points. Save all points into a list.

3. Pick a point and a height (in reality a straight-up path).

4. Divide height into equally spaced Z-incrementions.

5. Lift point in Z-direction in a distance of one incremention.

6. While point has not reached the Z-value of the height, do a. and b.:

6a. Rotate all curve-points around the point. Save the new 'row' of points.

6b. Lift point in Z-direction

7. Pass all rows of points to a 3Dmesh creation

1-2) This could be any curve object, except that parameters for each type of curve can differ and therefore can require a different calculation. E.g. splines have a more intricate set of parameters that would require another algorithm than lwpoly's.

Division is based on the horizontal segmentation set by the user (or SURFTAB1).

3) This actually constitutes a path that starts at the point, goes straight up and ends at the specified height. A skew or irregular path or one represented by an object wouldn't be much different, and it would be very easy to divide a path object the same way as the base curve in step 2. is divided.

4) Based on the vertical segmentation specified by the user (or SURFTAB2).

6a) Rotation is in this example done with POLAR. I suspect this to be a rather slow method and that it could be optimized by a matrix rotation.

7) Saving the points as they are calculated is the tricky part when passing it to a mesh. It depends on the creation method. ENTMAKE will require a point list for each vertex while Add3DMesh will require an array of doubles with the point structure represented by the sequence of doubles.

Notice that the example creates an n-closed mesh because, during division of the base curve, it considers the last vertex of each segment to belong to the following segment - which, in the last segment, will be the first segment. So it'll have to be n-closed "manually" by ENTMAKE.