Need help with followme along a helix; face twisting about edge

I’m creating a free plugin that creates accurate gears, worms, pulleys and threaded rods (so I can 3D print them for something I’m making) and I’m having an issue I would like some assistance with. In making the worm (gear) I need to extrude the tooth profile along a helix, but when I use followme, besides the surface extruding along the path (array of edges) as I want it is also rotating about the path. I’ve googled a bit and see this is normal behavior for followme but would like to know if anyone can tell me how to prevent the face from rotating about the path. I’ve attached the relevant part of the code below, along with images of the helix w/ simple test face created by the code, the result of followme of the face along the helix and the desired result I’d like to get (created with the helix and face extruded in the gui using the “upright extruder” plugin). I looked at the plugin code but it’s more complex than my current ruby/SketchUp skill and I don’t want to “steal” it’s code in my plugin… Help with this issue would be appreciated. Thanks,

Oh, I should probably mention I’m using Sketchup Make and I’d like the plugin to not require Pro features…

Also just noticed that followme is tilting the face into the curve, as in the face is no longer in the same plane that it was before followme was called… will have to think about how this will affect the profile of the tooth…

helix_followme_issue.rb

The Follow Me tool will create its first face by projecting the template face along the vector defined by the line of the first segment. As a result, the tilted face is perpendicular (normal) to the first edge and slightly smaller.

I’m not sure … I played around with different ways of doing the same thing and the Follow Me seems to insist on twisting as it turns and ascends no matter how I create the path. I think you need to use a different approach.

I have a free plugin that has the matrix operations to do this … you’re more than welcome to “steal” any or all of it as long as you leave the first two lines intact. If you need some help with interpreting what it does, let me know.