Orienting brep to tangent of a contour of surface at given point

Hi Guys,

I am trying to orient a ‘building’ brep to the surface that it is on at given points. I have managed to place the buildings in place, but I cannot find a way to find the tangent on the XY plane of the surface at a given point to then find the rotation angle for the horizontal plane/brep. Surface|Plane>Evaluate curve isn’t giving me a ray I can then measure the rotation angle with and I can’t find anything else that might work.

Apologies if this is a simple fix, I’m quite new to grasshopper and still finding my feet! Attached are the .gh and .3dm files, and the grasshopper has data internalised.

Many Thanks!
Lizzie

20230322 Orient to Surface Help File.3dm (197.5 KB)

20230322 Orient to Surface Help File.gh (114.1 KB)


20230322 Orient to Surface Help File_re.gh (71.4 KB)

Hi HS_Kim,
This is great! Do you know how you would make it so those buildings are still parallel to the xy plane and intersect with the slope? Is it a matter of adjusting the data output from eval. surface? Maybe projecting that to xy plane or something?
Many Thanks
Lizzie