I am trying to write a script that transposes block xforms so they relate to Unity’s cooridnate system for my VR. Would really like to maintain firm single source of the model. Rhino is so much better for obvious reasons.

I thought I had this solved but then did some more different blocks… and no. Some blocks will work depending on their symmetry and rotations.

Unity has Y as up and rhino’s X+ is unity’s X- and Rhino’s Y+ is unity’s Z-. I know, right?

So in the matrix row 3 relates to position in both. That’s solved and easy.

rows and colums 0-2 however are a bit trickier. I *think* I’ve got the order correct. This is the setup I’ve had the most success with, and it’s the only one I’ve deduced through trial and error that has a pattern to it… I.e. every row and column follows the same order (0,2,1) but rows for columns. Easier to see in picture:

```
unityXform(0, 0) = rhinoXform(0, 0) '* -1
unityXform(0, 1) = rhinoXform(2, 0) '* -1
unityXform(0, 2) = rhinoXform(1, 0) '* -1
unityXform(1, 0) = rhinoXform(0, 2) '* -1
unityXform(1, 1) = rhinoXform(2, 2) '* -1
unityXform(1, 2) = rhinoXform(1, 2) '* -1
unityXform(2, 0) = rhinoXform(0, 1) '* -1
unityXform(2, 1) = rhinoXform(2, 1) '* -1
unityXform(2, 2) = rhinoXform(1, 1) '* -1
'correct position
unityXform(0, 3) = rhinoXform(0, 3) * -1
unityXform(1, 3) = rhinoXform(2, 3)
unityXform(2, 3) = rhinoXform(1, 3) * -1
' correct units
unityXform(0, 3) = unityXform(0, 3) / 1000
unityXform(1, 3) = unityXform(1, 3) / 1000
unityXform(2, 3) = unityXform(2, 3) / 1000
```

So, assuming I’ve got the transposition part right, that leaves sign inversion.

These matricies are an absolute mystery to me and I’m doing this just by transforming the result in Unity and then spitting the numbers back out and comparing in excel. I think I’m starting to go a bit insane.

Hoping first that the solution is obvious to someone, and second to that… Interested in trying a brute force approach to the sign inversions. I think there’s 512 different possible combinations… So if I could write a loop that just exported all of them and then I could look for the correct transforms in unity and delete the wrong ones. 512 isn’t really that many, considering the way I’m doing this sortof in a dark room with a flashlight.

I have ZERO idea how to approach that though.

EDIT: I think I have tried all the obvious patterns for inversion, like inverting first of each row, first of each column, middle everything, first two, first and last, … etc. been working on this for a while. A small error on a pass though could have caused me to skip over an otherwise correct solution I suppose.