# Combine Models vtkbool error

**URL:** <https://discourse.slicer.org/t/combine-models-vtkbool-error/19162>\
**Category:** Support\
**Created:** [August 11, 2021, 10:11pm UTC](https://discourse.slicer.org/t/combine-models-vtkbool-error/19162 "2021-08-11T22:11:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [August 11, 2021, 10:11pm UTC](https://discourse.slicer.org/t/combine-models-vtkbool-error/19162/1 "2021-08-11T22:11:51Z")

</div>

Hello, I’ve been trying to use the new [“Combine Models” module](https://discourse.slicer.org/t/new-experimental-feature-boolean-operations-union-intersection-difference-on-meshes/16048) from the Sandbox extension, but have run into errors. Specifically, the error is “Contact ends suddenly at point 2.” from VTK, and the created union model is empty. Searching, I found that @lassoan reported a similar error to the developer in March 2021 ([Difference of meshes sometimes an empty mesh · Issue #40 · zippy84/vtkbool · GitHub](https://github.com/zippy84/vtkbool/issues/40)) and had some back and forth. I don’t fully understand what the issue is, or how to resolve it. I am trying to combine a model derived from a segmentation with a portion of a rectangular solid. The overlap volume is deliberately small (but should be present) and the overlap volume includes two almost parallel faces, which I gather from reading the github issue might be part of the problem? I am trying to set up a workflow which will work the same way without failing across multiple cases. I don’t really understand how to identify or fix “non-manifold edges” in my meshes, or how to tell if that is what is causing the problem. I can share the meshes which lead to the error if that would be helpful. Thanks!

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [August 12, 2021, 12:11am UTC](https://discourse.slicer.org/t/combine-models-vtkbool-error/19162/2 "2021-08-12T00:11:52Z")

</div>

vtkBool has worked quite well for [BoneReconstructionPlanner](https://github.com/SlicerIGT/SlicerBoneReconstructionPlanner) project to make surgical guides.

In the past if the result was an empty model it was because there was no-contact between the input objects or some of the input models had non-manifold edges or the input models meshes were not made of triangles

Here is a way to check if a model has non-manifold edges:

```auto
myModel = getNode('myModel')
featureEdges = vtk.vtkFeatureEdges()
featureEdges.SetInputData(myModel.GetPolyData())
featureEdges.BoundaryEdgesOff()
featureEdges.FeatureEdgesOff()
featureEdges.ManifoldEdgesOff()
featureEdges.NonManifoldEdgesOn()
featureEdges.Update()
areNonManifoldEdges = featureEdges.GetOutput().GetNumberOfPoints()

```

Hope it helps you

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [August 12, 2021, 1:23am UTC](https://discourse.slicer.org/t/combine-models-vtkbool-error/19162/3 "2021-08-12T01:23:47Z")

</div>

Thanks for the helpful code, I really appreciate it. It did not identify any non-manifold edges in my models, but after reading a bit more about them ([helpful link](https://www.sculpteo.com/en/3d-learning-hub/create-3d-file/fix-non-manifold-geometry/)), I understand better what they are and why they might cause problems. While neither model individually has non-manifold edges, the two models might just barely touch in places and end up sharing an edge or vertex when finding the union of the two. Empirically, it was not a problem for me to just increase the degree of overlap by 1 mm, and this resolved the error. This is an OK workaround for me.
