# How to rotate coordinate system of a surface?

I’m building a context model by extruding closed polylines from a DWG files. Then using custom nodes to place either a gable or mansard shaped roof mass on the top of each surface of each mass solid. However, I’m having some issues with the gable custom node. The node takes in the top surface of a mass, translates that surface to a given height, scaling it inwards to get the slanted sides and finally lofting both bottom and top perimeters curves from the surfaces. This only works when the base surface is orthogonal to the world coordinate system. If the base surface is rotated, the shape of the mansard roof stays orthogonal resulting in a twisted shape. How can I fix this?

I tried to solve this problem by adding these nodes to rotate the coordinate system according to the underlying mass.

But got an unexpected result

Try getting the lines, sorting by length, get the first two, offset them towards each other, get the endpoints for each, and build a polycurve by those points. Move in up by the height, and then loft that with the original surface.

Can’t understand why I didn’t think of your method in the first place. It’s so simple. At the end I offseted the perimeter curves from the base surface, translated that in Z direction and loft both curve. That’s it.

1 Like