How to get rotation around axis?

Environment: Microstation V8i SS4, 08.11.09.833

Following situation:

I have got a polygon that represents the half of a double pitch roof (saddle roof). The pictures below show the polygon and a 3D-view of the roof as well:

Now I need to place a beam onto the polygon so that the beam is lying "flush" (hope that this expression is okay here ...)  - the next picture shows the beam as it should be in red:

Unfortunately the beam is placed like the green rectangle ...

The beam is placed by supplying a start and an end point. Moreover you can specify a rotation angle to rotate the beam along the axis.

The green rectangle is constructed with 0° rotation angle - the red one has got an angle of 23,3121°.

Unfortunately I am not able to find a way how to calculate the correct rotation.

I have got the following details:

  • slope angle
  • angle of the slant edge
  • width of the roof
  • width, length, height of the beam

I have attached a .dgn-file that shows the situation ...

Test_2.dgn

Does anyone have a clue how to calculate the rotation angle of the beam?

I am running out of ideas ...