# ConMesh to build custom surface offset

**URL:** <https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491>\
**Category:** Grasshopper\
**Tags:** windows\
**Created:** [March 8, 2024, 5:07am UTC](https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491 "2024-03-08T05:07:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![feklee](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/feklee/32/760993_2.png) [@feklee](https://discourse.mcneel.com/u/feklee)\
**Post date:** [March 8, 2024, 5:07am UTC](https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491/1 "2024-03-08T05:07:00Z")

</div>

I was unhappy with `Offset` as it added additional vertices. Also, I need to know the relation between the original and the new vertices. So I created my own little surface offset:

 ![Screenshot of the Grasshopper definition](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/0/b/5/0b52b67002a4f889d046d458a0773b704be66f27.jpeg)  
[2024-03-08\_ConMesh.gh](https://discourse.mcneel.com/uploads/short-url/bY5WQQKvwS38drNaKVlaPPoCwQo.gh) (11.1 KB)

I use `ConMesh` to build the offset. I give it the new vertices and the original faces, and I am a bit surprised that this works: After all, the vertices of the original faces don’t coincide with the new vertices.

_Is it reliable to do so? Why does this even work?_

---

<div class="post-metadata">

**Author:** ![adel.albloushi](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@adel.albloushi](https://discourse.mcneel.com/u/adel.albloushi)\
**Post date:** [March 8, 2024, 5:38am UTC](https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491/2 "2024-03-08T05:38:06Z")

</div>

_important: while the word “surface” is generic in everyday language, in rhino it refers to “nurbs surfaces”. your algorithm deals with meshes._

Some mesh offset algorithms do work the way you did it in grasshopper. It calculates the normal of each vertex and moves the new vertices in the direction of that normal.  
now the normal is unit vector (which is to say that it moves the vertex 1 unit length). if you add a multiplier battery after the normal output, you can control the distance.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/d/1/cd163feb881871013ad3dbbb5bd937a554d426c0.png)

it works because a) the resulting offset has the same number of vertices and b) the face object is simply a list of vertex indices that construct that face. in the pane bellow , you see that each face is a tuple (a list basically).  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/7/6/f767d4d1cbe8b08526c873c478ca1a8df5ce5f66.png)

when you’re constructing the resulting mesh, you’re keeping the order of the vertices, and you’re recreating the exact number of faces with the exact lists of vertex indices.

---

<div class="post-metadata">

**Author:** ![feklee](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/feklee/32/760993_2.png) [@feklee](https://discourse.mcneel.com/u/feklee)\
**Post date:** [March 8, 2024, 6:44am UTC](https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491/3 "2024-03-08T06:44:24Z")

</div>

> [@adel.albloushi](#):
>
> while the word “surface” is generic in everyday language, in rhino it refers to “nurbs surfaces”

Yes, treat is as colloquial meaning of surface. 😅 I am fully aware of the difference in meaning inside Rhino.

> [@](#):
>
> Some mesh offset algorithms do work the way you did it in grasshopper.

My expectation was that `Offset` does so, but it doesn’t. In fact, even for my simple example, the result is slightly different. But the real problem, as I already mentioned, is that `Offset` may add additional faces. Even if it doesn’t – which depends on the original mesh – I need to have a guarantee that the resulting vertices are in the same order as the original ones. With my algorithm, I do have that.

> [@](#):
>
> the face object is simply a list of vertex indices that construct that face

That’s the explanation I was looking for. Now it all makes sense, thank you!

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 8, 2024, 8:58am UTC](https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491/4 "2024-03-08T08:58:34Z")

</div>

Just keep in mind the offset is done with vectors at the vertex normals and not like a brep offset where sub-surfaces itself are offset…

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/a/a/1/aa1d7be770f55040b89b9a3b653c76e5bc8878b5.jpeg)

[2024-03-08\_ConMesh\_vectors.gh](https://discourse.mcneel.com/uploads/short-url/g5zNGe2VMRfX4nUjNcI4HAciD8Y.gh) (7.2 KB)

---

<div class="post-metadata">

**Author:** ![feklee](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/feklee/32/760993_2.png) [@feklee](https://discourse.mcneel.com/u/feklee)\
**Post date:** [March 8, 2024, 9:44am UTC](https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491/5 "2024-03-08T09:44:55Z")

</div>

> [@martinsiegrist](#):
>
> offset is done with vectors at the vertex normals

🤔 That should be what I want. With the mesh that I’m working with, I get a nice and clean output.

Thanks!

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/772775_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [March 8, 2024, 9:48am UTC](https://discourse.mcneel.com/t/conmesh-to-build-custom-surface-offset/177491/6 "2024-03-08T09:48:05Z")

</div>

I wrote that because your title says ‘…surface offset’

To be precise, a mesh consist of vertices and faces, not surfaces.
