Hi Everyone,
I was trying to get the transformation matrix for mating two bodies, but I have a problem in calling GetCoincidenceTransform() correctly. I always got "Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call." How can I call the function properly? Because I thought all parameter already set as requested.
Moreover, why hr is still having S_OK although having that failure?
Please help me point out the problem. Many thanks, isnaini
Here is my implementation code:
--------------------------
void mateComponent(IBody2 * mainBody, IBody2 * otherBody)
{
IMathTransform * mTransform1 = NULL;
//CComPtr
//double x, y, z, xform1[16], xform2[16];
HRESULT hr = NOERROR;
VARIANT_BOOL boolVal = VARIANT_FALSE;
IDispatch *pBody = otherBody;
try
{
//Get Matrix
hr = mainBody->GetCoincidenceTransform(pBody, &mTransform1, &boolVal);
//mTransform1->get_IArrayData(xform1);
//otherBody->Copy(&pBody);
//hres = otherBody->GetCoincidenceTransform(otherBody, &mTransform2, NULL);
//mTransform2->get_IArrayData(xform2);
}
catch (_com_error e)
{
CoUninitialize();
MessageBox(NULL, e.ErrorMessage(), NULL, MB_OK | MB_SETFOREGROUND);
exit(EXIT_FAILURE);
}
}
----------------------------------
SolidworksApi macros