Creating meshes from scratch

Hi all,
I am a python user(beginner) trying to understand meshes and meshing algorithms like Marching cubes, Ball Pivot and Marching tetrahedra. I saw basic example provided with rhinoscriptsyntax, It was hard to imagine how hard it was to make mesh faces assigned from points. One way i could think of not Reinventing the wheel was to call mesh from points commands in python . I needs some direction to head towards creating meshes in rhino
I was suggested Libraries but i not smart enough to figure out how to or where to use them exactly.

If you are not familiar with polygon meshes, this can help you get started.

Using Rhino.Python and the rhinoscriptsyntax, you can create a simple mesh like this:

import rhinoscriptsyntax as rs

vertices = []
vertices.append((0.0,0.0,0.0))
vertices.append((5.0, 0.0, 0.0))
vertices.append((10.0, 0.0, 0.0))
vertices.append((0.0, 5.0, 0.0))
vertices.append((5.0, 5.0, 0.0))
vertices.append((10.0, 5.0, 0.0))
vertices.append((0.0, 10.0, 0.0))
vertices.append((5.0, 10.0, 0.0))
vertices.append((10.0, 10.0, 0.0))

faceVertices = []
faceVertices.append((0,1,4,4))
faceVertices.append((2,4,1,1))
faceVertices.append((0,4,3,3))
faceVertices.append((2,5,4,4))
faceVertices.append((3,4,6,6))
faceVertices.append((5,8,4,4))
faceVertices.append((6,4,7,7))
faceVertices.append((8,7,4,4))

rs.AddMesh( vertices, faceVertices )

The rhinoscriptsyntax AddMesh function just call into RhinoCommon and creates a Rhino.Geometry.Mesh object.

http://4.rhino3d.com/5/rhinocommon/?topic=html/T_Rhino_Geometry_Mesh.htm

Does this help?

1 Like

Thanks Dale ,
I saw the mesh example but its very hard in case if its a random point cloud.