1) The direction is determined by the ECS and vertexes of this polyline.
2) You don't need to know the direction first. You only need to perform a time of offset and then compare some data (fg. the area ). Then you can get the direction.
3)By the way, the sysvalue "offsetgaptype" must be controled.