# MeshPatch Command

**URL:** <https://discourse.mcneel.com/t/meshpatch-command/142382>\
**Category:** Rhino for Windows\
**Tags:** windows\
**Created:** [May 11, 2022, 4:35am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382 "2022-05-11T04:35:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike24](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mike24/32/642495_2.png) [@Mike24](https://discourse.mcneel.com/u/Mike24)\
**Post date:** [May 11, 2022, 4:35am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382/1 "2022-05-11T04:35:14Z")

</div>

MeshPatch command when creating a Mesh from contour lines creates flat tops in valleys and also on ridges. Is there anyway to avoid this inconsistency when using MeshPatch? Is there a better way to create a mesh from contour lines? It also does it when using Delaunay Mesh in Grasshopper. Does Delaunay Mesh in GH use the same technique as MeshPatch in Rhino?

 ![2022-05-10 22_10_10-Mesh Valleys.3dm (1 MB) - Rhinoceros 7 Commercial - Perspective](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/d/b/cdb5a1649843cd0d5827c2050e7fd62b5d2fd3da.jpeg)  
[Mesh Valley.gh](https://discourse.mcneel.com/uploads/short-url/jF6GdUuwMPr7Fl17iAsx3TuuXNx.gh) (3.7 KB)  
[Mesh Valleys.3dm](https://discourse.mcneel.com/uploads/short-url/fwWuUWdjotvnfN8W7JmlPwxz1OE.3dm) (2.5 MB)

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [May 11, 2022, 8:55am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382/2 "2022-05-11T08:55:24Z")

</div>

Yes, they use the same basic algorithm, and yes, this effet is pretty common. In general it is best to avoid making terrain meshes from contour curves if possible, as this kind of stuff is bound to happen. Contour lines are already an interpretation/interpolation of DEM height points, so one step removed from the original measures. Remaking a mesh from those is then two steps removed.

All data in between the contour curves is simply linearly interpolated (and not always in the best fashion) and thus does not necessarily accurately reflect what the terrain is really doing in that area.  
This is especially true in the flatter areas where the spacing between contour curves is large.

The best thing to do is try and find a DEM points file and create your terrain mesh from that. At least then you know that the terrain mesh is accurate at each data point, and as the points are regularly spaced even in the flatter areas, you have more data points to work with and the effect you see above should not happen.

---

<div class="post-metadata">

**Author:** ![Mike24](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mike24/32/642495_2.png) [@Mike24](https://discourse.mcneel.com/u/Mike24)\
**Post date:** [May 13, 2022, 1:56am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382/3 "2022-05-13T01:56:32Z")

</div>

Unfortunately, these contours are all that I can go by and the person who gave me this isn’t willing to give me anything else. Is there a better command that can create the mesh with a different algorithm that would come out better on the ridges and in the valleys?

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [May 13, 2022, 2:44am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382/4 "2022-05-13T02:44:21Z")

</div>

A shot in the dark, but does a `QuadRemesh` of the mesh do anything you like - to say 5000+ quads?

-Pascal

---

<div class="post-metadata">

**Author:** ![Mike24](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mike24/32/642495_2.png) [@Mike24](https://discourse.mcneel.com/u/Mike24)\
**Post date:** [May 13, 2022, 4:18am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382/5 "2022-05-13T04:18:00Z")

</div>

I lose a lot of accuracy if I use QuadRemesh @ 5000+ quads. Even tried it at 20k. The mesh was created from the contours and it did great except for the ridges and valleys.

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [May 13, 2022, 9:23am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382/6 "2022-05-13T09:23:17Z")

</div>

> [@Mike24](#):
>
> Is there a better command that can create the mesh with a different algorithm that would come out better on the ridges and in the valleys?

Not that I know of. The only way I have to fix this stuff is to give the mesh patch additional points to go through in order to force a better subdivision. This is completely manual.

One way -

- Draw polylines in between the contours in the valley areas (snapping to contour lines)
- Explode the polylines and Rebuild with say 10 points (so each segment has ~10 points)
- Select the contour lines and the drawn polylines, ExtractPt to get points
- MeshPatch the points

This is just a small sample area I tried on your file:

 ![M4](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/2/b/92b401235e82852fccec820fb22b470a9880130d.jpeg)  
 ![M3](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/c/b/6cbfb1b3f04e3376187b59b235119ecb0e963930.png)

Another way:

- Use TweenCurves in between neighboring contour lines with a large amount of sample points to get decent intermediate data points
- Include those in your MeshPatch

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/8/c/98c0bcb6caff99ffc90ba65bd3e48595f4b7d14a.png)

---

<div class="post-metadata">

**Author:** ![Mike24](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mike24/32/642495_2.png) [@Mike24](https://discourse.mcneel.com/u/Mike24)\
**Post date:** [May 14, 2022, 2:44am UTC](https://discourse.mcneel.com/t/meshpatch-command/142382/7 "2022-05-14T02:44:55Z")

</div>

TweenCurves helped but it did create the same problem, just at a smaller scale. It certainly is better than it was.

I like the idea of the poly line. Great suggestion!
