<snip>
Tim, I test your code , Z axis have flaw. see demo
I think the issue is that the distance calculated is always positive, and based on the pick point order it should be negative. I guess one could see which way the vector variable 'vec' is pointing, and tell the distance to be positive or negative.
Or you can just use the path option, and it will extrude it along the whole path.
Or you can just leave out the last part of the command, and let it be open ended so the user can select the end point of the extrusion.
Or... (I am sure there are more options)