Controlling the Inputs Automatically

Hello All,
Please help me fixing the orientation of surface.
when direction of curve changes the direction/orientation of surface changes inturn which leads to next operations.
how to fix the direction of surface? I think there must be some rule.
this will be useful while creating UDF.
in below link "Controlling the Inputs Automatically" is explains about line orientation, but unable to download the " PktCurveOrientation.CATPart."
http://catiadoc.free.fr/online/cfyugpkt_C2/cfyugpktmt0003.htm
Regards
Prashant.