I wrote a script for a IK/FK leg switch with a no flip knee setup.
The way I`m doing the no flip knee is like in the Art of Rigging. After creating the ikhandles I zero out all pole vectors except the polevectorX and put a value of 0.01. This causes the knee to flip sideways but I know i have to put a value of 90 into the twist attribute to get back to the original position, because I created the joints in a linear way. But if the joint are not linear the twist value changes. I know if you duplicate the joints and use that as a reference you can find the right twist value but how would I go about it in a script ? I tried some things but failed with all of them.
Also if there is a better way of doing a no flip knee let me know.