cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Edge co-ordinate in drawing view

SOLVED
Highlighted
Tanzanite

Edge co-ordinate in drawing view

Hello,

I have edge handler selected by user from ProSelect API. This selected edge is in drawing view. I would like to know edge coordinates in terms of drawing sheet origin using pro toolkit.

What XYZ co-ordinate I will get if I will use API something like EdgeXYZEval? Will it be of assembly co-ordinate? If yes, how one can convert it to screen co-ordinate of drawing file?

Let me know if you need more clarification.

Any thought will be of great help on this.

Thanks and Regards

Ketan

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Edge co-ordinate in drawing view

Hi all,

Ketan please take a look at the code corrections.

ProAsmcomppath error is due to a part selection , the correct technique is to check for a NULL as an owner of ProAsmcomppath and reinit if this was the case or simply initialize matrix to identity matrix - the results would be the same.

I was not correct suggesting inverting matrix - this suggestion was related to drawing sheet matrix when you'll need to go from 'paper coordinates' to drawing coordinates - not needed in your case.

HIH.

Feliks.

Ketan Lalcheta wrote:

Hello,

I tried below code snippet:

/***************************************************************************

ProError status  = PRO_TK_GENERAL_ERROR;


ProAsmcomppath objCompPath;
status = ProSelectionAsmcomppathGet(objSelection,&objCompPath);
if (status != PRO_TK_NO_ERROR){return status;}


{

ProModelitem mi = {(ProType)0,0,0};

status = ProSelectionModelitemGet( objSelection, &mi);

if (status != PRO_TK_NO_ERROR){return status;}

if( objCompPath.owner == NULL) {

    status = ProAsmcomppathInit( mi.owner, NULL, 0, &objCompPath);

    if (status != PRO_TK_NO_ERROR){return status;}

}

}

ProMatrix objMatrixCompAsm;

status = ProAsmcomppathTrfGet(&objCompPath,PRO_B_TRUE,objMatrixCompAsm);

if (status != PRO_TK_NO_ERROR){return status;}

ProView objView;
status = ProSelectionViewGet(objSelection,&objView);
if (status != PRO_TK_NO_ERROR){return status;}

ProDrawing objDrawing;
status = ProSelectionDrawingGet(objSelection,&objDrawing);
if (status != PRO_TK_NO_ERROR){return status;}

ProPoint3d objSelPoint;
status = ProSelectionPoint3dGet(objSelection,objSelPoint);
if (status != PRO_TK_NO_ERROR){return status;}

ProVector objSelPointTemp;
objSelPointTemp[0] = objSelPoint[0];
objSelPointTemp[1] = objSelPoint[1];
objSelPointTemp[2] = objSelPoint[2];

ProName objViewName;
status = ProDrawingViewNameGet(objDrawing,objView,objViewName);
if (status != PRO_TK_NO_ERROR){return status;}

ProMatrix objMatrixView;

//wrong
//status = ProViewMatrixGet(objDrawing,objView,objMatrixView);
//wrong

status = ProDrawingViewTrfGet( objDrawing, objView, PRO_B_TRUE, objMatrixView);

if (status != PRO_TK_NO_ERROR){return status;}

//needed if you have drawing coordinates which are 'paper measurements' so to speak

//ProMatrix objMatrixSheet;

//status = ProDrawingSheetTrfGet(..., objMatrixSheet)

//ProMatrix objMatrixView_Inv;
//ProUtilMatrixInvert(objMatrixSheet,objMatrixView_Inv);
//if (status != PRO_TK_NO_ERROR){return status;}

ProMatrix objMatrixCompAsm;
status = ProAsmcomppathTrfGet(&objCompPath,PRO_B_TRUE,objMatrixCompAsm);
if (status != PRO_TK_NO_ERROR){return status;}

ProVector objSelPointAfterAsm;

//from component to assembly
status = ProPntTrfEval(objSelPointTemp,objMatrixCompAsm,objSelPointAfterAsm);
if (status != PRO_TK_NO_ERROR){return status;}
//from assembly to drawing
status = ProPntTrfEval(objSelPointAfterAsm,objMatrixView,objLeaderLocationFrmAsm);
if (status != PRO_TK_NO_ERROR){return status;}

/***************************************************************************

let me know whether it is correct or not. In addition to that, ProViewMatrixGet API return -1.

THanks and Regards

Ketan

6 REPLIES 6

Re: Edge co-ordinate in drawing view

Hello all,

Ketan, here is a workflow:

- from the edge's ProSelection get ProAsmcomppath, ProDrawing and ProView

- get Point3d from ProSelection

- get assembly component path transformation from part to assembly

- get transformation from assembly to drawing view ( don't forget to invert )

- get transformation from drawing view to drawing sheet ( this one is optional)

- multiply transformation matrixes to get the total transformation

- transfer Point3d using the final matrix to view ( drawing) coordinates

HIH.

Feliks.

Re: Edge co-ordinate in drawing view


Thanks Feliks for this information.

Could you please help me from below step no 3 as I could reach till that point and could not find how to proceed further:

1. from the edge's ProSelection get ProAsmcomppath [ProSelectionAsmcomppathGet], ProDrawing [ProSelectionDrawingGet] and Proview[ProSelectionViewGet]

2. get Point3d from ProSelection [ProSelectionPoint3dGet]

3. get assembly component path transformation from part to assembly

4. get transformation from assembly to drawing view ( don't forget to invert )

5. get transformation from drawing view to drawing sheet ( this one is optional)

6. multiply transformation matrixes to get the total transformation

7. transfer Point3d using the final matrix to view ( drawing) coordinates

To conclude, I got 3D point of selection and transformation matrix of 3d point with respect to assembly. Now, I am not sure how to proceed.

Thanks and Regards

Ketan

Re: Edge co-ordinate in drawing view

Hello,

I tried below code snippet:

/***************************************************************************

ProError status  = PRO_TK_GENERAL_ERROR;


ProAsmcomppath objCompPath;
status = ProSelectionAsmcomppathGet(objSelection,&objCompPath);
if (status != PRO_TK_NO_ERROR){return status;}

ProView objView;
status = ProSelectionViewGet(objSelection,&objView);
if (status != PRO_TK_NO_ERROR){return status;}

ProDrawing objDrawing;
status = ProSelectionDrawingGet(objSelection,&objDrawing);
if (status != PRO_TK_NO_ERROR){return status;}

ProPoint3d objSelPoint;
status = ProSelectionPoint3dGet(objSelection,objSelPoint);
if (status != PRO_TK_NO_ERROR){return status;}

ProVector objSelPointTemp;
objSelPointTemp[0] = objSelPoint[0];
objSelPointTemp[1] = objSelPoint[1];
objSelPointTemp[2] = objSelPoint[2];

ProName objViewName;
status = ProDrawingViewNameGet(objDrawing,objView,objViewName);
if (status != PRO_TK_NO_ERROR){return status;}

ProMatrix objMatrixView;
status = ProViewMatrixGet(objDrawing,objView,objMatrixView);
if (status != PRO_TK_NO_ERROR){return status;}

ProMatrix objMatrixView_Inv;
ProUtilMatrixInvert(objMatrixView,objMatrixView_Inv);
if (status != PRO_TK_NO_ERROR){return status;}

ProMatrix objMatrixCompAsm;
status = ProAsmcomppathTrfGet(&objCompPath,PRO_B_TRUE,objMatrixCompAsm);
if (status != PRO_TK_NO_ERROR){return status;}

ProVector objSelPointAfterAsm;
status = ProPntTrfEval(objSelPointTemp,objMatrixCompAsm,objSelPointAfterAsm);
if (status != PRO_TK_NO_ERROR){return status;}
 
status = ProPntTrfEval(objSelPointAfterAsm,objMatrixView_Inv,objLeaderLocationFrmAsm);
if (status != PRO_TK_NO_ERROR){return status;}

/***************************************************************************

let me know whether it is correct or not. In addition to that, ProViewMatrixGet API return -1.

THanks and Regards

Ketan

Re: Edge co-ordinate in drawing view

Hi all,

Ketan please take a look at the code corrections.

ProAsmcomppath error is due to a part selection , the correct technique is to check for a NULL as an owner of ProAsmcomppath and reinit if this was the case or simply initialize matrix to identity matrix - the results would be the same.

I was not correct suggesting inverting matrix - this suggestion was related to drawing sheet matrix when you'll need to go from 'paper coordinates' to drawing coordinates - not needed in your case.

HIH.

Feliks.

Ketan Lalcheta wrote:

Hello,

I tried below code snippet:

/***************************************************************************

ProError status  = PRO_TK_GENERAL_ERROR;


ProAsmcomppath objCompPath;
status = ProSelectionAsmcomppathGet(objSelection,&objCompPath);
if (status != PRO_TK_NO_ERROR){return status;}


{

ProModelitem mi = {(ProType)0,0,0};

status = ProSelectionModelitemGet( objSelection, &mi);

if (status != PRO_TK_NO_ERROR){return status;}

if( objCompPath.owner == NULL) {

    status = ProAsmcomppathInit( mi.owner, NULL, 0, &objCompPath);

    if (status != PRO_TK_NO_ERROR){return status;}

}

}

ProMatrix objMatrixCompAsm;

status = ProAsmcomppathTrfGet(&objCompPath,PRO_B_TRUE,objMatrixCompAsm);

if (status != PRO_TK_NO_ERROR){return status;}

ProView objView;
status = ProSelectionViewGet(objSelection,&objView);
if (status != PRO_TK_NO_ERROR){return status;}

ProDrawing objDrawing;
status = ProSelectionDrawingGet(objSelection,&objDrawing);
if (status != PRO_TK_NO_ERROR){return status;}

ProPoint3d objSelPoint;
status = ProSelectionPoint3dGet(objSelection,objSelPoint);
if (status != PRO_TK_NO_ERROR){return status;}

ProVector objSelPointTemp;
objSelPointTemp[0] = objSelPoint[0];
objSelPointTemp[1] = objSelPoint[1];
objSelPointTemp[2] = objSelPoint[2];

ProName objViewName;
status = ProDrawingViewNameGet(objDrawing,objView,objViewName);
if (status != PRO_TK_NO_ERROR){return status;}

ProMatrix objMatrixView;

//wrong
//status = ProViewMatrixGet(objDrawing,objView,objMatrixView);
//wrong

status = ProDrawingViewTrfGet( objDrawing, objView, PRO_B_TRUE, objMatrixView);

if (status != PRO_TK_NO_ERROR){return status;}

//needed if you have drawing coordinates which are 'paper measurements' so to speak

//ProMatrix objMatrixSheet;

//status = ProDrawingSheetTrfGet(..., objMatrixSheet)

//ProMatrix objMatrixView_Inv;
//ProUtilMatrixInvert(objMatrixSheet,objMatrixView_Inv);
//if (status != PRO_TK_NO_ERROR){return status;}

ProMatrix objMatrixCompAsm;
status = ProAsmcomppathTrfGet(&objCompPath,PRO_B_TRUE,objMatrixCompAsm);
if (status != PRO_TK_NO_ERROR){return status;}

ProVector objSelPointAfterAsm;

//from component to assembly
status = ProPntTrfEval(objSelPointTemp,objMatrixCompAsm,objSelPointAfterAsm);
if (status != PRO_TK_NO_ERROR){return status;}
//from assembly to drawing
status = ProPntTrfEval(objSelPointAfterAsm,objMatrixView,objLeaderLocationFrmAsm);
if (status != PRO_TK_NO_ERROR){return status;}

/***************************************************************************

let me know whether it is correct or not. In addition to that, ProViewMatrixGet API return -1.

THanks and Regards

Ketan

Re: Edge co-ordinate in drawing view

Thanks a lot Feliks.

It worked. Appreciate your effort to make me understand in detail.

Regards

Ketan

Re: Edge co-ordinate in drawing view

I use this method <ProDrawingViewTransformGet>,Translate the (0,0,0)point from the 3D model to 2D drawing origin.