ON_Mesh::CombineIdenticalVertices() failure c++

Hi;
How do I fuse these places?

C++ Repair mesh.3dm (70.6 KB)

CRhinoGetObject go;
	go.SetCommandPrompt(L"Select Mesh");
	go.GetObjects(1, 1);
	if (go.CommandResult() != CRhinoCommand::success)
	{
		return CRhinoCommand::cancel;
	}
	ON_Mesh* mesh = const_cast<ON_Mesh*>(go.Object(0).Mesh());
	mesh->CombineIdenticalVertices(true, true);
	mesh->CullUnusedVertices();
	mesh->Cleanup(true);
	mesh->CullDegenerateFaces();
	mesh->CullUnusedVertices();
	RhinoApp().ActiveDoc()->AddMeshObject(*mesh);
	RhinoApp().ActiveDoc()->DeleteObject(go.Object(0));

AlignVertices?

Combine works if you have duplicated vertices.

Honestly, I don’t know what’s going on here, because this mesh can’t explode, which means it’s a single mesh, but it has this problem, But there is an edge that divides it in two :joy:

Before getting into cpp are you are able to clean mesh using rhino commands?

Yes, I have run _MeshRepair command to repair.

And rhino prompts Mesh has 13 pairs of faces that intersect each other.
So I think the most important part of is how do I find these faces quickly.

For self intersection I think there is barely any method to do mesh repair both in cpp and standard methods.

Knowing this, how did you generate this mesh?