Units

My model document is in MMGS unit  system.

However, I use API to get a smaller distance number which seems in MKS unit system. What's More annoying is that I could not change the unit system through API! You could see the code as follows:

short unitArray[5] = {0,0,0,0,0};

short denom = 16;

hr = iSwModel->IGetUnits(unitArray);

ASSERT(S_OK == hr);

hr = iSwModel->SetUnits(swMM,swDECIMAL,denom,unitArray[3],FALSE);

ASSERT(S_OK == hr);

hr = iSwModel->IGetUnits(unitArray);

ASSERT(S_OK == hr);

I want to know what's wrong? Is it possible to get the distance number I want and HOW? Thanks.

SolidworksApi macros