From intersection with geometry and plans I get coordinate systems where I want to place family instances. For placing families the CS x/y has to be horizontal. What is the easiest way to rotate the CS? Do I have to rotate it around 3 axis and make sure that z axis is positive or is there an easier way?
I would just build a new coordinate system by origin (the location of the coordinate system you found) and vectors, using the global Z axis and the Z axis of the coordinate system as two of the three vectors. The third vector can be found via Vector.Cross.

