How can I instantiate objects along an edge without gaps and fix the normals?

I'm trying to make a procedural building with Geometry Nodes using faces as the base and instantiated objects for details.

However, I am having trouble getting the objects to instantiate at the edges so that they are created without gaps, and also the normals of the extruded faces are not correct.
Any idea how I can fix this?

(Blender 3.6.1)

This question may seem simple, but it has two complications:

1. You would always have to consider the normals in the instantiation.
2. You would have to divide the curve so that the instances have space without gaps.

The first hurdle is that the normals are lost in the way you process the curves.
The second hurdle is that the node Resample Curve can process a certain length as input, but if the subdivision does not run out completely, the node interpolates the subdivision to the whole length of the spline. You could, of course, fill in the gaps by stretching the objects after instantiation, but that didn't seem particularly useful to me.

So I would recommend the following setup:

• Here, I extrude the mesh first and then separate the edges from each other so I can edit them independently. Also at the beginning, I capture the height and width of the object to be instantiated (these values control the subdivision and height of the extrusion later).
• Then I calculate whether and in how many parts an edge has to be subdivided to accommodate a certain number of objects. Here, the subdivision should correspond to the width of the object, and I divide the rest among the areas at the corners.
• To do this, I convert the edges into curves and resample them, as long as there is room for at least one object in them. I use the previously calculated "trimming" to move the inner points in such a way, that exactly a certain number of objects in them will turn out.
• I then use the manually subdivided inner curves to instantiate the objects and extrude the corners.
• Finally, I check whether the normals of the extruded corners correspond to those of the base mesh, and correct their alignment if the normals differ.

(Blender 3.6+)

PS: Please note that this solution only works with meshes whose points are all planar at the same Z-position!

• this is brilliant, thank you so much for your time and effort in helping me. Commented Aug 1, 2023 at 19:07
• @Pooyaheydari You are welcome! ...thank you for this interesting question! Commented Aug 1, 2023 at 19:08