Creating mesh faces leaving a naked (split) edge?



OK, so I replace some bigger mesh faces (triangles) with smaller faces, and along one of the face edges (the red line pictured below) I would like to make a “naked edge”, so that when running the command “Mesh.SplitDisjointMesh” it would separate the mesh along that very (red) line.

Fig. 1: Naked edge along the red line, how?

Is there any trick I can use when creating the smaller faces which will result in the (red) edge becoming naked on SplitDisjointMesh?

// Rolf


After some sweat and bitter tears I got the following: A mesh box splitted by a double curved NURBS Surface. The split works irrespective of the directions of the Box and the Surface (any direction is ok). No rotation transform is performed.

The yellow line shows the splitted edge (which is sticky for now though). So problem is that the splitted edge is not “naked” and thus the mesh is not separated along that edge, and I don’t know how to make it naked.

This means that when I run the command mesh.SplitDisjointMesh I get three meshes, the upper part of the box (removed from the copy in the back), and the “band” of faces involved with the split (red faces), which I have splitted, but which are still stuck together, and the third bit, the lower box.

So how do I go about to separate the mesh along the (yellow) split-line?

(the faces are splitted already, I just don’t know how to separate the faces along the splitted edge and make the faces stick to the upper and lower part of the mesh respectively).

// Rolf

(Jussi Aaltonen) #3

Rolf, you can make edge naked by splitting one of the connected faces. Topologically edge is naked if it only connects to one face. It’s not enough to duplicate the edge vertices and connect top and bottom faces to own vertices. Am I making any sense?

(Jussi Aaltonen) #4

To split the red mesh along the yellow edges you need to unweld those edges and then explode.


Yes. When you disclose the secret about how to split them. :slight_smile:

The red faces already are splitted along the yellow “split-line”, into four separate smaller faces, like so :

     /  \
    /    \
   --------   <-- two adjacent edges
  /  \  /  \ 
 /    \/    \

OK, so now I saw that you said I should unweld along that split-line. So now I wonder how I unweld along an edge… (I will of course look it up in the documentation, if it’s explained there).


So I found that Unwelded edges are defined like so:

“Unwelded edges are edges where the faces that share the edge have unique mesh vertexes (not mesh topology vertexes) at both ends of the edge.”

How strange then that the other edges didn’t “weld” when I created them, because I used existing Vertexes from the old MeshFace which was replaced (oldFace.A, oldFace.B and oldFace.C). Still all the red faces ended up being a separate mesh when Disjointing the final mesh. Hm.

// Rolf


Hi Rolf,

_SplitDisjointMesh works on meshes which are seperated but joined. It does not work if the meshes are joined and adjacent sharing a set of unwelded edges between. See below example and use the _ShowEdges command on the mesh, then enable the AllEdges option.

SplitDisjointMesh.3dm (41.9 KB)

Once you run the command _SplitDisjointMesh on the example you’ll see that it remains a single mesh. To seperate both meshes, run _Explode. If you do this with your example mesh, it should behave the same. If not, please post the mesh so i can investigate further.


Hi @clement,
Thank you for trying to help. It seems I have another problem to solve before I can follow your advice in detail.

Problem is that, if I do not run the command m.Vertices.CombineIdentical(...); on the mesh after constructing it, my code only returns an invalid mesh, and thus I can’t bake it. And if I run the command then I suppose this can be the cause to why any disjoint edges/vertices disappears (?).

But I have no idea why the mesh becomes invalid in the first place. I do define new faces with CCW winding, and I get no hints about why it’s not valid, and I can’t even investigate without being able to bake the mesh. Sigh.

This is what I do to the mesh after constructing it, otherwise it returns an invalid mesh :

protected void RemoveFaces(Mesh m, List<int> facesIndexesToRemove, bool DoCombineVertices = true)
  var noDupes = facesIndexesToRemove.Distinct().OrderByDescending(x => x);
  if (DoCombineVertices)
    m.Vertices.CombineIdentical(false, false);

// Rolf

Example of code that constructs faces “below” the split-line (split-edge is between A & D). Also the A and D vertices are duplicated before calling this method.

private void MakeFaces2(Mesh m, int pt_A, int pt_B, int pt_C, int pt_D, ref int[] newFaces)
           * Finding Shortest diagonal
           *          A       D
           *          _________
           *         / \       \
           *        /     \     \
           *       /          \  \
           *      -----------------
           *     B                 C/V
  var ptA = m.Vertices[pt_A];
  var ptB = m.Vertices[pt_B];
  var ptC = m.Vertices[pt_C];
  var ptD = m.Vertices[pt_D];

  if (ptA.DistanceTo(ptC) < ptD.DistanceTo(ptB))
 // newFaces[0] = upper triangle
    newFaces[1] = m.Faces.AddFace(pt_D, pt_A, pt_C);
    newFaces[2] = m.Faces.AddFace(pt_C, pt_A, pt_B);
 // newFaces[0] = upper triangle
    newFaces[1] = m.Faces.AddFace(pt_D, pt_A, pt_B);
    newFaces[2] = m.Faces.AddFace(pt_B, pt_C, pt_D);


You could add each face to the document if you do not have too many so you can inspect the geometry.



@Jussi_Aaltonen, i think if the mesh falls apart into two or more mesh parts and contains mesh parts enclosed by unwelded edges, he could also use:




I just found the solution, or the problem and its solution.

When drawing a Mesh Box with Rhino, somehow that mesh is not valid after modifying it. So this time I tried to run the command m_mesh.Vertices.CombineIdentical(...); before I split the mesh (but not after, like I did before), then my code returned a valid mesh!

< scratching head >

And moreover, now when exploding the mesh it separates nicely along the split-edge, like it should :


But what is it with the need for running mesh.Vertices.CombineIdentical(...) on Rhino-created meshes before they can be modified with success? Strange.

// Rolf


Even when you use mesh.EnsurePrivateCopy() before manipulating it ? How do you update the mesh ?



This is how I now start out in my code (added only the last row, then it started to work as expected):

Mesh m_mesh;
if (M.Faces.QuadCount > 0)
m_mesh = M.DuplicateMesh();
m_mesh.Vertices.CombineIdentical(true, true);

I’ve never seen the command mesh.EnsurePrivateCopy() though. I’ll try that one as well.

I tried replacing ....CombineIdentical() with mesh.EnsurePrivateCopy() but no go. Invalid mesh. CombineIdentical is what it takes. Is it the ConvertQuadsToTriangles() -command that messes up the mesh?

In any case, now it works. Thank you @clement and @Jussi_Aaltonen for your assistance, it lead me to try the right things. (I’m also happy to learn that it wasn’t my code that was the problem… :slight_smile: )

// Rolf


Hi Rolf, EnsurePrivateCopy may not be required as you duplicate the mesh in your code. It should be used, if at all, before you do anything else on the mesh to make sure it is not controlled by the document…

glad it’s working now :wink:


(Jussi Aaltonen) #14

Yes, mesh.ExplodeAtUnweldEdges() does the same thing as _Explode command.