Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
can set model view name to drawing view with ProDrawingViewOrientationFromNameSet but there is not Get API for same.
Is there workaround to get it ?
Following code sets model view name
//Get current drawing
ProDrawing model;
result = ProMdlCurrentGet((ProMdl*)&model);
if(result != PRO_TK_NO_ERROR)
{
ProEngineerEnd();
return false;
}
ProMdlName name;
result = ProMdlNameGet(model, name);
ProMdldata data;
result = ProMdlDataGet(model, &data);
ProView view;
result = ProDrawingViewInit(model, 1, &view);
ProName name1;
result=ProDrawingViewNameGet(model, view, name1);
ProMatrix metrix;
result = ProDrawingViewTransformGet(model, view, PRO_B_TRUE, metrix);
if(result==PRO_TK_NO_ERROR)
{
result = ProDrawingViewOrientationFromNameSet(model, view, L"ABC", L"Isometric", 0.0, 0.0);
}
result = ProDrawingViewRegenerate(model, view);
ProDrawingCurrentSheetSet(model, 1);
int iWin;
ProWindowCurrentGet(&iWin);
ProDrawingtreeRefresh(model,iWin);
//Window Refit
ProWindowRefit(iWin);
But how to get Model View name
Solved! Go to Solution.
Hello all,
Suresh,
One of possible workarounds:
get drawing view model with ProDrawingViewSolidGet,
get named views from ProSolid with ProViewNamesGet,
loop through array of view names,
for each view - use ProViewNameToView and ProViewMatrixGet to get model view matrix,
get rid of shift and scale, normalize matrix and compare it to the drawing view matrix.
HIH.
Feliks.
I am able to that but facing issue in comparing model view matrix with drawing view matrix.
Can you please suggets me how on "get rid of shift and scale, normalize model view matrix"
Thanks,
Suresh
Here is a snippet from Toolkit User Guide:
Following method worked for me,
void GetViewOrientationMatrix(ProMatrix viewMatrix, ProMatrix viewOrientMatrix)
ProError status = PRO_TK_NO_ERROR;
ProVector vector1 = {viewMatrix[0][0], viewMatrix[0][1], viewMatrix[0][2]};
ProVector vector2 = {viewMatrix[1][0], viewMatrix[1][1], viewMatrix[1][2]};
ProVector vector3 = {viewMatrix[2][0], viewMatrix[2][1], viewMatrix[2][2]};
viewOrientMatrix[0][0] = vector1[0];
viewOrientMatrix[0][1] = vector1[1];
viewOrientMatrix[0][2] = vector1[2];
viewOrientMatrix[0][3] = 0.0;
viewOrientMatrix[1][0] = vector2[0];
viewOrientMatrix[1][1] = vector2[1];
viewOrientMatrix[1][2] = vector2[2];
viewOrientMatrix[1][3] = 0.0;
viewOrientMatrix[2][0] = vector3[0];
viewOrientMatrix[2][1] = vector3[1];
viewOrientMatrix[2][2] = vector3[2];
viewOrientMatrix[2][3] = 0.0;
viewOrientMatrix[3][0] = 0.0;
viewOrientMatrix[3][1] = 0.0;
viewOrientMatrix[3][2] = 0.0;
viewOrientMatrix[3][3] = 1.0;
double * NormalizeVector(double input[3], double output[3])
double len;
len = VectorLength(input);
if (len < PRO_UTIL_ALMOST_ZERO)
output[0] = input[0];
output[1] = input[1];
output[2] = input[2];
return output;
else
return(VectorScale(1.0/len, input, output));
double VectorLength(double v[3])
return(sqrt(v[0] * v[0] +
v[1] * v[1] +
v[2] * v[2]));
double * VectorScale(double scalar, double vector[3], double result[3])
result[0] = scalar * vector[0];
result[1] = scalar * vector[1];
result[2] = scalar * vector[2];
return(result);
Some limitations in this workaround: