Rotation of a family on its axis


I have a duct ventilation accessory, and I would like to apply a rotation to it on its axis (angle defined by the XY and Z plane)
I started a script to apply this rotation. He works.
But now we need to know the current angle to calculate the angle of rotation to apply.
This is where I’m stuck
On image 1, the floor view, where I have to apply the rotation on the family on the right
image 1
On image 2, a section (with an example of an angle)
image 2

Hello @Alain_Hamel …could something here help

Thanks for your answer, but you get the same as me.
With Rotate Fitting, the rotation is made from the starting angle.
You should actually calculate the value of 38°, and apply a value of -38° in your script.
But by default I do not know this value, precisely I would like to calculate it

Hi,think it will be difficult as it will depends how your damperfamily is build