

Re: IMathTransform
Feng Wei Jul 30, 2013 1:14 PM (in response to Oleg Bezyaev)I mean I want to know how Solidworks realize the function "Get_Transform2" of IComponent2. In other words, If I know the positions of a IComponent2 at time t1 and time t2. How to calculate the underlying transformation matrix?

Re: IMathTransform
Artem Taturevych Jul 30, 2013 8:12 PM (in response to Feng Wei)I do not think there are any algorithms behind this API. Most likely the transforms are assigned once you move or mate components and ::Transform2 just returns this values.
I have added the macro which shows how two find the transformation between two selected components to myIntercad.myToolkit: SolidWorks API Tutorials/How To.../Transformation/Get The Transformation Between Components (id=99).
Feel free to download this macro.
____________________________________________________
Regards,
Artem Taturevych, Application Engineer at Intercad (Australia)
translationXpert – addin to translate SolidWorks models
myIntercad – an integrated tool for SolidWorks Professionals

Re: IMathTransform
Feng Wei Jul 31, 2013 1:09 AM (in response to Artem Taturevych)" the transforms are assigned", where is the transform matrix is from??? I mean that if I am not allowed to use the function Get_Transform2, How could you realize the function from data before transform and data after transform. How to calculate the rotation and translation not from the function Get_Transform2

Re: IMathTransform
Feng Wei Jul 31, 2013 1:10 AM (in response to Feng Wei)I am now doing this because my mentor wants to check the correctness of the function. crazy and annoy question

Re: IMathTransform
Artem Taturevych Jul 31, 2013 2:40 AM (in response to Feng Wei)Ok, you can find how the Top/Front/Right Planes and Origin of components transformed regarding to the same entities of top assembly. This is the transformation of the component.
____________________________________________________
Regards,
Artem Taturevych, Application Engineer at Intercad (Australia)
translationXpert – addin to translate SolidWorks models
myIntercad – an integrated tool for SolidWorks Professionals

Re: IMathTransform
Feng Wei Jul 31, 2013 6:30 PM (in response to Artem Taturevych)still confused. could you give me some pictures?

Re: IMathTransform
Artem Taturevych Jul 31, 2013 7:35 PM (in response to Feng Wei)At this picture the Front/Right/Top planes of component coincide with the Front/Right/Top planes of assembly. The both origins also coincide.
That means that the component has 0 transformation matrix.
1 0 0 0
1 0 0 0
1 0 0 0
1 0 0 0
At this picture component moved and rotated. In order to find the transformation you should use the transformation of origin to identify the translation part of the transform and the rotation of planes to identify the rotation sub matrix. You may also need to consider the scale if any.
Refer the vector mathematics of how to build matrix having this data: https://en.wikipedia.org/wiki/Transformation_matrix
____________________________________________________
Regards,
Artem Taturevych, Application Engineer at Intercad (Australia)
translationXpert – addin to translate SolidWorks models
myIntercad – an integrated tool for SolidWorks Professionals

Re: IMathTransform
Feng Wei Aug 5, 2013 1:21 AM (in response to Artem Taturevych)how could you calculate the translation?

Re: IMathTransform
Josh Brady Aug 5, 2013 8:32 AM (in response to Feng Wei)I think you need to take a class or something. 3D transformation matrices are not something you can teach someone over an internet forum.

Re: IMathTransform
Feng Wei Aug 5, 2013 10:26 AM (in response to Josh Brady)I know how to get the transformed points after transformation, But my question is how to calculate the transformation matrix if I do not know it.

Re: IMathTransform
Feng Wei Aug 5, 2013 5:58 PM (in response to Josh Brady)Ok, I think I have found the answer!!!!! Once again, I am disappointed with the reply!
The algorithm is stated in the paper"Estimating 3D rigid body transformations: a comparison of four major algorithms". Four types of methods are described. I calculated using the first method and found the value is extremely close to the value using API function. I hope someone could tell me which is used in solid works!



Re: IMathTransform
Feng Wei Aug 5, 2013 10:26 AM (in response to Artem Taturevych)In my case, there is no " transformation of origin", only trajectories of three points are available.

Re: IMathTransform
Sandip Darveshi Sep 2, 2013 6:49 AM (in response to Feng Wei)Dear Feng,
I hope you are interested in below calculations.
When every entity of a geometric model remains parallel to its initial position, the rigidbody transformation of the model is defined as translation. Translating a model implies that every point on it moves an equal given distance in a given direction.
So
Xnew = Xold + difference
Ynew = Yold + difference
Znew = Zold + difference
Simplified interface for manipulating transformation matrix data:
a b c . n 
d e f . o 
g h i . p 
. 
j k l . m 
The SolidWorks transformation matrix is stored as a homogeneous matrix of 16 elements, ordered as shown. The first 9 (a to i) are elements of a 3x3 rotational submatrix, the next 3 (j,k,l) define a translation vector, the next 1 (m) is a scaling factor. The last 3 elements (n,o,p) are unused in this context.
The 3X3 rotational submatrix represents 3 axis sets: row 1 for xaxis components of rotation, row 2 for yaxis components of rotation, and row 3 for zaxis components of rotations. The 3 axes are constrained to be orthogonal and unified so that they produce a pure rotational transformation. Reflections can also be added to these axes by setting the components to negative. The rotation submatrix coupled with the lowerleft translation vector and the lowerright corner scaling factor creates an affine (a transformation that preserves lines and parallelism, i.e., maps parallel lines to parallel lines) transformation. (All this information is available in SolidWorks API Help.)
This might help you.
Thanks and Regards,
Sandip Darveshi.









