This question may seem simple, but it has two complications:
- You would always have to consider the normals in the instantiation.
- 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!