Skip to main content
1-Visitor
September 22, 2016
Solved

How to insert table to the right upper corner of the drawing

  • September 22, 2016
  • 2 replies
  • 2140 views

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


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Best answer by GabrielZaha

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

2 replies

1-Visitor
September 22, 2016

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.

14-Alexandrite
September 22, 2016

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

TomasLoun1-VisitorAuthor
1-Visitor
September 22, 2016

Thank you Gabriel, this is what I was looking for.