I've got a macro that rotates IFC objects.
If I apply multiple rotations one after the other, the object starts to move away from the original origin at an increasing speed.
My original code did use the Matrix4D at the user's selected origin, which could be far away from 0,0,0.
targetmatrix = Matrix4D.BuildTransformMatrix(Vector3D(ps1), Vector3D(0, 0, 0), spinor, Vector3D(1, 1, 1))
It doesn't make a difference if the ShellMeshInstance vertices are defined close to zero or far away, both objects act exactly the same.
If I use the above shown matrix, rotating directly around the user defined origin, far away from zero, I get a visible shift after about 17 rotations.
If I shift it to zero first, like the below code, I get a visible shift after about 6 rotations.
matrixtozero = Matrix4D.BuildTransformMatrix(ps1, Point3D(0, 0, 0), 0, 1.0, 1.0, 1.0)
matrixbacktops1 = Matrix4D.BuildTransformMatrix(Point3D(0, 0, 0), ps1, 0, 1.0, 1.0, 1.0)
targetmatrix = Matrix4D.BuildTransformMatrix(Vector3D(0, 0, 0), Vector3D(0, 0, 0), spinor, Vector3D(1, 1, 1))
targetmatrixinverted = Matrix4D.BuildTransformMatrix(Vector3D(0, 0, 0), Vector3D(0, 0, 0), spinor.Reverse, Vector3D(1, 1, 1))
o.Transform(TransformData(matrixtozero, None)) # move object to zero
o.Transform(TransformData(targetmatrix, None)) # apply rotation about 1 axis and origon at 0,0,0
o.Transform(TransformData(targetmatrixinverted, None)) # apply the exact opposite rotation
o.Transform(TransformData(matrixbacktops1, None)) # move object back to where it was
Before and after each rotation I copy the ShellMeshInstance's current GlobalTransformation into a list.
After doing 6 times the above the object has moved several metres.

Here it shows about 10 metres, on the screen it's more than 20. Don't understand the difference.
Either way, shifting it to zero or not, I could understand if the rotation would be slightly affected, but there is no reason why it should translate, the targetmatrix is set explicitly to no shift (Vector3D(0,0,0)), so it must not.
What is the reason for this translation? This looks suspiciously like a bug to me.
------------------------------
Ronny Schneider
------------------------------