Georefencing Modell with Ground Controll Points- Rotation and/or Translation problem!

Hello, everybody,

I want to georeference a model using control points.

What is given?

Several control points in Cartesian coordinates in the Gauss-Krueger Zone 3 reference coordinate system.
What is the goal?

I want to transform the BB-coordinates (Max and Min) of the component into world coordinates (Gausß-Krüger Zone 3) and write them into a .Json file.

My workflow

Revit 2019

  1. Move survey point and project base point unfixed to a known model point whose country coordinates are known
  2. fixiren survey point and project base point
  3. Move PBP fixed to control point coordinates

Dynamo (script in the appendix)
4. select model element to select an element for testing and determine the BB min and max points.
5. the points go as geometry into the node Geometry.Transform
6. the origin coordinate system is the fixed internal base point 0,0,0 and referenced to the survey point. The project base point references the survey point.
internal base point --> survey point --> project base point
7. the reference coordinate system shall be the project base point shifted to the national coordinates and is rotated by the angle to geographic north
8. then the transformed points are written in a .json file

So far so good. If I now have the corners of the base plate drawn in, I do not get what I hoped for. The building is twisted.I thought this is due to the orientation towards the node and therefore I included 360-x and only the angle x in the calculation. Unfortunately without success.In the right picture it looks like a translation problem and in the left one like a rotation problem.
I do not know exactly where to start…

Does anyone have an idea and give me an early Easter present :-)?

Best regards and stay healthy

here the dynamo script