AnsweredAssumed Answered

Applying a Coordinate Transform obtained from GetCoincidentTransform to a part

Question asked by Rachit Kumar on Sep 25, 2018
Latest reply on Sep 27, 2018 by Josh Brady



I'm currently in the process of trying to automate comparison of some models (single parts) to pull out files with similar geometry from a folder. I've written a macro that automatically compares each of the files to each other and pulls out the proper files, but these files are often in different spaces (relative to the origin and built on different planes) and I need them to be in the same coordinate space for a later comparison/calculation of interference. I'm currently trying to apply a transform to these files to get them into the same space (by having all the files be "registered" to a starting file).


I've looked into using 2019 SOLIDWORKS API Help - GetCoincidenceTransform2 Method (IBody2) to get the matrix representing the transform of a part to the starting file, but I'm not sure how to compare two parts together (the method seems to be applied to a body rather than to the entire part), as well as how to subsequently apply that matrix to the part to transform it properly and save it before the subsequent calculations.


I've experimented with just getting the list of bodies in a part and getting the coincident transform between the first body in each part to obtain a coincident matrix (as the parts are not overly complex and largely contain only one body), and it seems to work relatively well to retrieve the matrix, but I still cannot figure out how to apply the transform to the part to get it into the same space.


Any suggestions/help would be appreciated!