Incorrect transformation matrix index locations
Issue: I noticed an issue in the https://www.codestack.net/solidworks-api/geometry/transformation/get-coordinate-system-transform/ webpage. You can verify this issue by measuring the transform a Coordinate System that matches the SolidWorks Part coordinate system. Since no transformation is performed, the macro should return an identity matrix (all zeros except 1's along the diagonal). Instead, the code incorrectly returns 1's along the first column. As you can see in the SolidWorks documentation (https://help.solidworks.com/2022/english/api/sldworksapi/get_coordinate_system_transform_example_vb.htm), this is because SolidWorks does not populate SldWorks.MathTransform in a standard transform format.
Fix: In your macro code, replace this:
Debug.Print vMatrix(0) & "," & vMatrix(1) & "," & vMatrix(2) & "," & vMatrix(3) & ","
Debug.Print vMatrix(4) & "," & vMatrix(5) & "," & vMatrix(6) & "," & vMatrix(7) & ","
Debug.Print vMatrix(8) & "," & vMatrix(9) & "," & vMatrix(10) & "," & vMatrix(11) & ","
Debug.Print vMatrix(12) & "," & vMatrix(13) & "," & vMatrix(14) & "," & vMatrix(15)
With this:
Debug.Print vMatrix(0) & "," & vMatrix(1) & "," & vMatrix(2) & "," & vMatrix(9) & ","
Debug.Print vMatrix(3) & "," & vMatrix(4) & "," & vMatrix(5) & "," & vMatrix(10) & ","
Debug.Print vMatrix(6) & "," & vMatrix(7) & "," & vMatrix(8) & "," & vMatrix(11) & ","
Debug.Print vMatrix(13) & "," & vMatrix(14) & "," & vMatrix(15) & "," & vMatrix(12)
and update the maxtrix-output-immediate.png with the correct output.