Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi,
when I am creating new table or inserting it by ProDrawingTableCreate or ProDwgtableRetrieve I have to specify the origin - the point where the table is inserted.
This point is in screen coordinates, but I need to place the table to concrete position (for example right upper corner) on the drawing, not on screen. How to recalculate the drawing position to the screen coordinates?
Tom
Solved! Go to Solution.
You need the transformation matrix from drawing coordinates to screen coordinates.
What I found that work best for me is to get the transformation from screen to drawing coordinates first using ProDrawingSheetTrfGet function
Then I calculate the inverse matrix. Use the inverse matrix in ProPntTrfEval function to get the screen coordinates.
Here is a sample code:
status = ProDrawingSheetTrfGet(drawing,1,drw_size,matrix1);
ProUtilMatrixInvert(matrix1,matrix2);
ProPntTrfEval(drw_point,matrix2,scr_point);
status = ProDwgtableRetrieve(drawing, tableName, table_path, 0, scr_point, NULL, NULL, &table);
status = ProDwgtableDisplay(&table);
You can find the ProUtilMatrixInvert function in <Creo load point>\protoolkit\protk_appls\pt_examples\pt_utils\UtilMatrix.c
Hi,
When placing the table, right after selecting the table file a little window pops up that allows to switch to placement based on absolute coords of the drawing.
If you got the table origin at the correct corner of the table you could just specify absolute drawing coords of the corner of your drawing to place it there.
It's just too bad i can't post a picture of the window cause i have no available Creo licence at the moment.
You need the transformation matrix from drawing coordinates to screen coordinates.
What I found that work best for me is to get the transformation from screen to drawing coordinates first using ProDrawingSheetTrfGet function
Then I calculate the inverse matrix. Use the inverse matrix in ProPntTrfEval function to get the screen coordinates.
Here is a sample code:
status = ProDrawingSheetTrfGet(drawing,1,drw_size,matrix1);
ProUtilMatrixInvert(matrix1,matrix2);
ProPntTrfEval(drw_point,matrix2,scr_point);
status = ProDwgtableRetrieve(drawing, tableName, table_path, 0, scr_point, NULL, NULL, &table);
status = ProDwgtableDisplay(&table);
You can find the ProUtilMatrixInvert function in <Creo load point>\protoolkit\protk_appls\pt_examples\pt_utils\UtilMatrix.c
Thank you Gabriel, this is what I was looking for.