Polygon mesh with edge count higher than 4

Hi all,

I have a network of lines that forms a complex hexagon grid. What I’m trying to do is convert this network into a mesh and also retain the same faces. I need this in order to use the deconstruct mesh utility and mesh connectivity features. The face normals and vertice normals are really handy features.

Is there any way to do this? I tried using the plankton mesh, but I wasn’t able to deconstruct the plankton mesh or use evaluate the mesh using any tools. I tried looking, but couldn’t find any.

I also tried the ngon mesh plugin, but I couldn’t get any desireable results out of it.

Here is my file:
ngon mesh.gh (23.1 KB)

This is the kind of mesh I wish to use:

And this is the kind of mesh I am getting after trying various methods:

Any help is appreciated. Thankyou!

By definition, mesh can contain faces with 3 or 4 edges only. NGon is a merely representation of the aforementioned mesh.

Alright, but I have seen some meshes that have more than 4 edges, like this example from ngon:

5_Vertex.gh (35.3 KB)



:thinking: OK you should be able join different faces into one NGon. But I’m afraid many Mesh operations are still based on triangles/quads

Ah, that’s a shame. So i guess I would have to go about creating a surface at each mesh face. I was hoping to avoid this as the gh file becomes unnecessarily heavy. Meshes are nice and light to work with, not to mention the connectivity data

Which information specifically are you missing?
Face and vertex normals are more ambiguous with non planar ngons than for triangular meshes, but there are reasonable ways to calculate them which would be possible to add.

You would need closed polylines.
Adjacency is ready for you as well for faces, edges and vertices and combinations of them.
Incase you need a library there is NGonsCore.dll

I need the vertex normals, face normals, and neighbouring vertices. I tried getting the neighbours, but it always gives me the triangulated mesh neighbours.

What I tried doing is using the centre of the polyline and then getting a normal from that point. This is getting really heavy really fast and doesn’t feel like the right direction. What kind of method would you suggest?


Thanks, I am currently experimenting with it. Is there any specific style that I can use for an Ngon mesh that can give me similar results to deconstruct mesh?


Ngon mesh is the same rhino mesh, so you can use native grasshopper components as well.

To deconstruct mesh I always use GetPolylines component and construct FromPolylines.

What specific thing you are looking for, I can write incase it is useful?

I bet you would need a deconstruct component and construct component that has additional ngon data.
But there is already a component that does similar thing AdjustVertices. It lets you change vertex position.

For instance this would do a trick to adjust vertices.
It takes all vertices from Mesh MB and changes MA vertices positions of MB.
MB faces information is ignored so F input can be whatever.

I think I figured out how to do it.

Another good samaritan on this forum had posted a python script on how to create closed polylines from a network of closed curves:

I used that in combination with the Ngon mesh creator. The only part I am not completely happy about is the way I am getting the face normals. Though this has solved my problem, I don’t know if there is a more elegant way to achieve the same.

Is this one of the methods you were talking about @DanielPiker? I have basically taken all the vertex normals of a the polyline boundary, and created an average normal that is at the centre of the polyline.

Thanks for your help @Petras1!

Here is the script in case someone needs it in the future:
ngon mesh.gh (18.8 KB)

Have you checked Ngon mesh center component? It does a good approximation of polygon normals, by summing up cross-products of edge segments.

There are two components for both vertex and face normals. I had discussion about this with Dale a while ago.

Does the python code take open curves and turns to closed polylines?

ngon mesh1.gh (27.3 KB)

It seems that python is running Weaverbird component in the background.
You can use this component directly is you have the Weaverbird installed.

Yes, just checked the Ngon Centres component, It seems to work well, thanks!

1 Like