Creating Meshes given points and their connectivity - C#

Hi all,

I am trying to great triangle meshes given a set of points and their corresponding connectivity to neighboring points. It is important that the connectivity doesn’t change.

Thanks in advance.

Hi @lasaths,

Here is a basic mesh box constructed in code:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
      Rhino.Geometry.Mesh mesh = new Rhino.Geometry.Mesh();

      mesh.Vertices.Add(new Rhino.Geometry.Point3d(0.5,  0.5,  0.5));
      mesh.Vertices.Add(new Rhino.Geometry.Point3d(0.5, 0.5, -0.5));
      mesh.Vertices.Add(new Rhino.Geometry.Point3d(0.5, -0.5, 0.5));
      mesh.Vertices.Add(new Rhino.Geometry.Point3d(0.5, -0.5, -0.5));
      mesh.Vertices.Add(new Rhino.Geometry.Point3d(-0.5, 0.5, 0.5));
      mesh.Vertices.Add(new Rhino.Geometry.Point3d(-0.5, 0.5, -0.5));
      mesh.Vertices.Add(new Rhino.Geometry.Point3d(-0.5, -0.5, 0.5));
      mesh.Vertices.Add(new Rhino.Geometry.Point3d(-0.5, -0.5, -0.5));

      mesh.Faces.AddFace(0, 1, 5, 4);
      mesh.Faces.AddFace(0, 4, 6, 2);
      mesh.Faces.AddFace(0, 2, 3, 1);
      mesh.Faces.AddFace(7, 3, 2, 6);
      mesh.Faces.AddFace(7, 6, 4, 5);
      mesh.Faces.AddFace(7, 5, 1, 3);

      mesh.FaceNormals.ComputeFaceNormals();
      mesh.Normals.ComputeNormals();
      mesh.Compact();

      doc.Objects.AddMesh(mesh);
      doc.Views.Redraw();

      return Result.Success;
}

– Dale

1 Like

See attached (Note: No graph island detection is included [ strictly internal that one, sorry]. This means that if there’s islands DON’T use something like Sandbox for your VV Tree).

Anyway for this case - using proximity - the VV and EV are done inside (plus the E List).

Mesh_FromProxPts_EntryLevel_V1.gh (121.8 KB)