[No...] Posted December 5, 2022 Share Posted December 5, 2022 Does anyone know the math behind (base) alignments? They use a matrix and a vector value, but how are these connected? What I need is the X/Y offset of the alignment origin in reference to machine zero. I can read the matrix and vector data and at first I thought vector alone would do. But there are some alignments rotated by 90 degrees in relation to the CMM system, then the vector seems to be wrong (e.g. X is negative). So I guess I need to rotate it according to the matrix, right? How would I do that? Link to comment Share on other sites More sharing options...
[Ja...] Posted December 5, 2022 Share Posted December 5, 2022 This requires extensive knowledge of linear algebra, which, it sounds like you have. The normal vectors of the base alignment can be hard coded into a 3x3 matrix, where the first column is the <a,b,c> normal unit vector of the X axis, the second column of the Y axis, and third column of the Z axis. To figure out the offset from the mach coordinate system, I imagine you could make a secondary alignment, and in the drop down choose (CMM system) which I believe is the machine coordinate system. Then make a theoretical point at (0,0,0) on that alignment. You can then toggle to the Base Alignment to see what the (x,y,z) coordinates change to. There's probably a better way, but that's what I came up with off the top of my head. Link to comment Share on other sites More sharing options...
[Je...] Posted December 5, 2022 Share Posted December 5, 2022 Please sign in to view this quote. . I will remember this when the machines take over. . Link to comment Share on other sites More sharing options...
[No...] Posted December 5, 2022 Author Share Posted December 5, 2022 Please sign in to view this quote. 🤣 🤣 🤣 Link to comment Share on other sites More sharing options...
[No...] Posted December 5, 2022 Author Share Posted December 5, 2022 Please sign in to view this quote. Maybe I should have put this in the PCM board. To claim I have this knowledge would be a lie. But at least I have a vague imagination of what happens here. 😕 When I output the matrix values the system returns a 3x3 array of numbers. But I I'm not even sure what is row and what is column. Maybe there's a function somewhere that will calculate it for me? I assume the vector is in the order X/Y/Z: What is row and what is column here? If I multiply it as shown, I don't get reasonable results. Please sign in to view this quote. Interesting idea! I already made a program to shift all alignments in the CMM system. Maybe I could modify it so it just spits out the offsets. But first I'd rather try and understand how to do this matrix transformation myself. Because with roughly 1000 alignments to analyze, I think that'd be a bit faster... Link to comment Share on other sites More sharing options...
[Ri...] Posted December 5, 2022 Share Posted December 5, 2022 The closest thing I could find was a post from Eric. viewtopic.php?p=21696#p21696 Link to comment Share on other sites More sharing options...
[No...] Posted December 6, 2022 Author Share Posted December 6, 2022 Please sign in to view this quote. Wait a minute. Do you really mean the COLUMNS? Because I always thought I need to multiply by the rows, like this: https://www.varsitytutors.com/hotmath/h ... y-a-matrix Actually, if I go by the columns, the results look much more like what I would expect. But is it really correct? Link to comment Share on other sites More sharing options...
[No...] Posted December 6, 2022 Author Share Posted December 6, 2022 It was indeed the columns. Case closed. 😎 A big Thank You goes to Jaxon for pointing me in the right direction! Link to comment Share on other sites More sharing options...
[Da...] Posted December 12, 2022 Share Posted December 12, 2022 I use the "writeDiffCoordSysToFile" function in PCM quite a bit. This will output a file that contains values for your 3x3 rotation matrix as well as translation for x, y, and z. In the measurement plan I will create two alignment characteristics. One recalling the machine coordinate system and the other the alignment of choice. For example, using two alignment characteristics named "BASE" and "MCS": writeDiffCoordSysToFile("BASE", "MCS", "coord_diff.txt") Now if I want to change my reference frame of any coordinate from BASE to MCS, I use python as follows: import numpy as np def get_transformation(filename): diff = np.genfromtxt(filename) r = diff[:9].reshape((3,3)) t = diff[9:].reshape((3,1)) return r, t r, t = get_transformation('coord_diff.txt') # example point with respect to BASE point = np.array([28.05, -4.76, 2.36]).reshape((3,1)) # change reference frame to MCS point_mcs = r@point + t # change from MCS to BASE point_base = np.linalg.inv(r)@(point_mcs - t) # print point value examples print(f'original point: {point}') print(f'MCS point: {point_mcs}') print(f'BASE point: {point_base}') Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in