3D terrain model printable from irregular contour lines

hello everyone
I am working on a terrain model and need to create a surface from contour lines.
I was thinking of using network surface and creating a grid with contour lines for one direction and curves perpendicular to this for the other direction.

To create these perpendicular curves I tried using curve closest point
However, in this way it would be necessary to repeat the command for each curve using the point created and the next curve each time.

I enclose an image and the script.

curve closest point recursive.gh (734.2 KB)

Is it possible to develop the commands recursively?
Or maybe any other ideas?

Thank you

This isn’t a recursion problem. It’s a simple Shift Paths or Relative Item problem. Theoretically, the following works:

Only since you have open curves, you’re gonna get funky results. You’ll want a closed curve for every elevation. I began to try sorting the open curves by height in order to close them to the bounding area of your crop, but then realized that you’ve provided an incomplete curve set. Try getting that sorted out first.

Also, your control point density is way too high.

Hello, thank you for your reply.
I had thought of such a solution.
The problem is precisely that I don’t have all closed curves. Because they are obtained by clipping from an area so of course there will be curves cut out.
Also, for each height there is not necessarily only one curve, but there can be more than one.
In this case you would have more than one curve in a path and therefore you could not use the surface between two curves for topology reasons.

After cutting the curves, I sorted them by height and then reconstructed them, turning the polylines into curves.
Although I am not too happy with the result so far.

have a look at the attached script: (edit)
contours-trimmed-sorted-rebuilt.gh (6.5 MB)

I can’t see the result because the curve data isn’t internalized.

I general, yeah, but from the picture it doesn’t seem you’ll run into this problem, or where are the contour lines islanding into different high/low points?

Yes, in this particular case the contour lines do not isolate themselves at different high/low points. But it could happen in the more general case.

Anyway yes I forgot to internalise, bear with me.

if you’d like to have a look.
I’ll see tomorrow

contours-trimmed-sorted-rebuilt.gh (6.5 MB)

Well, then I’d argue, that you after getting your closed curves, you’d then have analzye them against their neighbours for the situation:


and then split them thusly into two touching curves:


You’ll have to use both versions of the curves for the loft/ruled surface/whatever method.

… Something like that. I dunno. Lofting or always seems to go awry when the profiles have different curve degree and do not have their control points placed closest point across from each other.

1 Like


I worked on this script today and managed to achieve a satisfactory result.

I constructed a mesh and then a surface using this mesh.
And then everything else

you could improve the curve reconstruction step, but in this case it still works

take a look this one

contours.gh (7.4 MB)

yes, as you have seen, I think loft is not the solution for this type of job.

I searched but could not find any method to create a surface directly.
I first created the ground surface by creating a mesh of points. then it is possible to build a surface on a mesh in various ways

In any case, I am interested in other possible solutions because this was a specific case, but maybe it does not always work

In my experience, mesh patch works pretty well to create geometry from contour lines that may be open or closed. If you need a surface, then you can drape across the mesh. Another alternative is to quad-remesh the mesh patch and use the quad-remesh as input for subd.

Keep in mind that you should extend the contours beyond the edges of your site and trim the resulting geometry to your site boundaries once you are satisfied with the result.

1 Like

What do you mean with mesh patch?
Mesh from point?

Have you got some exemples of scripts with quad-remesh and subdvs? I think You mean with weavebird

Anyway in this case i think the results of the surface Is quite good. I also think that the surface Is a bit strange, due to the mesh, and the original points/polilynes. If you see my script, you can see. they are distributed like a wave or something like that.



Will scrounge around for an example terrain

1 Like