Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- Creo Parametric
- :
- Customization
- :
- Re: Transformation matrix of two csys

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-09-2018
10:12 AM

01-09-2018
10:12 AM

Hello

I am aware how to find transformation matrix using API for a component of assembly using Toolkit.

Is this possible to find transformation matrix between two csys using Toolkit API? If yes, what should be the API or approach for same.

Any thought will be of great help.

Thanks and Regards

Ketan

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-09-2018
06:43 PM

01-09-2018
06:43 PM

Hi all,
Pro/Toolkit User Guide has a chapter 'Transforming to Coordinate System Datum Coordinates' - the basic steps are outlined there.
This is how one would do it without using cursory online search:
Get ProCsys from ProFeature using ProFeatureGeomitemVisit and ProGeomitemToCys or ProCsysInit or ProSolidCsysVisit whatever is more convinient.
Having ProCsys handle - get ProGeomitemdata with ProCsysDataGet - this data has everything for determining transformation from coordinate system in question to a model reference frame.
Create a matrix (from csys to model frame) using
ProMatrixInit(
geomdata->data.p_csys_data->x_vector,
geomdata->data.p_csys_data->y_vector,
geomdata->data.p_csys_data->z_vector,
geomdata->data.p_csys_data->origin );
Repeat those steps for another coordinate system.
The rest is an excercise of matrix multiplications and inversions - the functions for matrix manipulation are in Pro/Toolkit examples 'UtilMatrix.c' file.
it would be a good idea to pay attention to matrix multiplicaiton order A * B is not equal to B *A - turn left and make three steps forward would end being in a quite different location comparing to three steps forward and turn left...
HIH.
FV.

10 REPLIES 10

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-09-2018
01:02 PM

01-09-2018
01:02 PM

Re: Transformation matrix of two csys

A cursory online search finds that there doesn't seem to be a function in the Toolkit API to calculate a transformation matrix. So, you'll likely have to delve into the linear algebra necessary to write your own function, or there is probably a linear matrix algebra library available for your language. You'll just have to find a non-toolkit solution.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-09-2018
06:43 PM

01-09-2018
06:43 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-09-2018
11:16 PM

01-09-2018
11:16 PM

Re: Transformation matrix of two csys

In Creo Toolkit you can get the transformation matrix for

1. Assembly to Part / Part To Assembly (CSYS) usingProAsmcomppathTrfGet

ProAsmcomppathTrfGet |

2. Drawing sheetProDrawingSheetTrfGet

ProDrawingSheetTrfGet |

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-10-2018
01:24 AM

01-10-2018
01:24 AM

Re: Transformation matrix of two csys

Thank you all for your valuable response.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-10-2018
06:52 AM

01-10-2018
06:52 AM

Re: Transformation matrix of two csys

Touche.

I figured it might be simple enough to use the mathematical libraries that have matrix manipulation routines, since the results I found on a search seemed to indicate that a simple "get transformation matrix" function wasn't evidently available. I also didn't know what language the initial poster was using. I've written such routines in the past and it's nothing very difficult when we're dealing with three dimensions.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-10-2018
08:06 AM

01-10-2018
08:06 AM

Re: Transformation matrix of two csys

I am using C++... Do share if it is applicable to me

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-09-2018
12:11 PM

02-09-2018
12:11 PM

Re: Transformation matrix of two csys

Planning to apply this methodology in toolkit tomorrow....

If A.asm has five levels of sub assembly like this: A.asm is main assembly which has B.asm. B.asm has C.asm. C.asm has D.asm and D.asm has E.asm. E.asm has part F.prt... Inturn, A.asm is top level assembly which has f.prt at level 6. What we need to find is transformation matrix between csys of A.asm and f.prt. If I find default csys of a.asm and f.prt, I will have two matrix one for each csys. Does these two matrix multiplication result into what I want that is transformation between a.asm and f.prt ??

If A.asm has five levels of sub assembly like this: A.asm is main assembly which has B.asm. B.asm has C.asm. C.asm has D.asm and D.asm has E.asm. E.asm has part F.prt... Inturn, A.asm is top level assembly which has f.prt at level 6. What we need to find is transformation matrix between csys of A.asm and f.prt. If I find default csys of a.asm and f.prt, I will have two matrix one for each csys. Does these two matrix multiplication result into what I want that is transformation between a.asm and f.prt ??

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-09-2018
03:19 PM

02-09-2018
03:19 PM

Re: Transformation matrix of two csys

Matrix wise it's just dividing the A matrix by the F matrix to get the transformation matrix from A to F to get T (or F to A?). Apparently this is determined by multiplying the A matrix by the inverse of the F matrix (or the F matrix by the inverse of the A matrix) You'll have to check to see which solution is the one that you will apply, but since multiplying A by T = F, it is easy to see that it's done right.

This seems like a good start: https://www.wikihow.com/Divide-Matrices

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-15-2018
03:46 AM

02-15-2018
03:46 AM

Re: Transformation matrix of two csys

My experience is that the linear algebra for this stuff can be a bit of a pain, and as others have mentioned, it definitely requires a bit of attention to detail.

For example, coordinates returned via ProCsysDataGet() (or pfcCoordSystem_ptr->GetCoordSys() in OTK) returns the coordinates in a way that I typically find to be the exact OPPOSITE of what I typically need, so I almost always end up needing to take the inverse of the matrix.

Similarly, ProAsmcomppathTrfGet is useful to get the transformation from the "desired part" to the "top assembly"... but its never quite that simple.

I often find that if I need to find how "CSYS A" in "Y.PRT" is related to "CSYS B" in "Z.PRT", often times I need to run through the logic of:

- ProCsysDataGet to get matrix from "CSYS A" to default csys of "Y.PRT"
- ProAsmcomppathTrfGet to go "upward" from the local csys of "Y.PRT" to the top of the tree
- ProAsmcomppathTrfGet to go "downward" from the top of the tree to the local csys of "Z.PRT"
- ProCsysDataGet to get from the local csys of "Z.PRT" to "CSYS B"

FYI - there ARE some free libraries out there like Eigen and Ogre3D which can help with some of the heavy lifting. I can't say I've ever used them... but I've certainly thought about it several times 🙂

Hope this helps!

Thanks,

James Sullivan

President & Founder

CadActive Technologies - www.cadactive.com

CadActive Technologies - www.cadactive.com

Top Tags

- ptcuser_portal
- creo_customization_proe…
- creo_parametric_proengi…
- creo_system_administrat…
- group discussion
- toolkit
- creo
- protoolkit
- creo_machining_proengin…
- j-link
- jlink
- api
- drawing
- creo_simulate_proengine…
- automation
- vb_api
- parametric
- vb
- creo parametric
- group blog
- object_toolkit
- vbapi
- weblink
- creo customization
- creo toolkit
- pro_toolkit
- vb api
- assembly
- c++
- customization