How to get an acute angle

I have the following situation

I want the angle the the nearest x and y vector (within 45 degrees) of the lines shown. What would be the best way to get his? I have marked up the angles I am looking for on the most onerous conditions to show what it is I am trying to do.

please post the dynamo graph as you ask some question, It may difficult to understant what you are after with a IMG like this,anyhow I hope you are after the node.“Vector.AngleWithVector”

So hopefully the image helps with the question

Its based on rooms I need the most acute angle where I’ve drawn red lines

Dynamo Forum Question.dyn (23.7 KB)

I would use Vector.AngleWithVector like @saju_autodesk recommended. Compare the vector of your line to the X, Y, and Z axes and then get the smallest one. That should be what you’re looking for.