Texture mapping orientation

I have created a render material and added it to a face in a part

RenderMaterial texRM = texRM = modelDoc.Extension.CreateRenderMaterial(AppearanceFilename);

texRM.MappingType = 0;

texRM.TextureFilename = textureImageFilePath;

texRM.LinkToFile = false;

texRM.FixedAspectRatio = true;

texRM.FitHeight = true;

texRM.FitWidth = true;

texRM.WidthMirror = false;

texRM.HeightMirror = false;

texRM.RotationAngle = 0;

texRM.Height = ipr.height;

texRM.Width = ipr.width;

texRM.Emission = 1.0;

texRM.SetUDirection2(ipr.mappingUDir[0], ipr.mappingUDir[1], ipr.mappingUDir[2]);

texRM.SetVDirection2(ipr.mappingVDir[0], ipr.mappingVDir[1], ipr.mappingVDir[2]);

bool result = texRM.AddEntity(aFace2Object);

This works most of the time but occasionally the texture image will be flipped horizontally and vertically.

I cannot detect when this will occur so I can set the mirror properties.

Furthermore, the functions SetUDirection2 and SetVDirection2  appears to have no impact on texture orientation, is this expected?

I would like to know how textures are oriented by default and the proper way to position/orient them through the API

SolidworksApi macros