Boolean Operations

I’m looking for a way to do boolean operations between two STLs in Paraview. Unions, Differences, etc…

This is unfortunately for a compute environment that doesn’t have Meshlab, Blender, etc…, but it DOES have Paraview.

I’ve looked around and it seems that there’s not a way to do this directly, but maybe it can be done with a script? Does anybody have experience with this?

Thanks.

-David O.

There is a VTK filter called PolyData Boolean Operations, but it is not available in ParaView yet.

Feel free to open an issue, are to contribute yourself !

BooleanOperation.xml (3.1 KB) is an XML plugin you can load from the Tools -> Manage Plugins… menu item. In the plugin manager dialog, click “Load New…” and navigate to where you saved this XML plugin. Click OK. After you have loaded it, you will have a Boolean Operation filter available in the Filters menu. Click on a polydata source and apply this filter. In the dialog that appears, you can pick a second polydata source.

1 Like

Thanks @cory.quammen

@cory.quammen,
I would like to run this Plugin to detect interference (Intersection) between parts.
I start with a MultiBlockDataSet of unstructured grids. I run Merge Blocks on this and get an Unstructured Grid. Then I tried a Programmable Filter to run the vtkGeometryFilter on the unstructured grid and output a Polygonal mesh for use with the BooleanOperation. However, the Programmable filter output is a polygonal mesh of quads rather than hexs, and the BooleanOperation fails due to “No points/cells to operate on”.

Is there a way to convert an unstructured grid of hex elements to a Polygonal mesh of hex elements in order to use your plugin?

Thanks for any hints - I am probably not setting something in the vtkGeometryFilter, but I have no clue.

Dennis
P.S. 5 work days til retirement, but I hope to knock this out before I leave!

@DennisConklin The Boolean Operation filter operates only on two input polydata consisting of only triangles. To compute with an intersection occurs between two blocks consisting of hex meshes you would first need to extract those blocks (Extract Block), Merge Blocks into an unstructured grid, Extract Surface to get the quad mesh, and then finally apply Triangulate to produce a polydata consisting of triangles.

This checks only if two blocks intersect, however, so you would need to do the same operation pairwise for each set of potentially overlapping blocks. You could do some preliminary checks like require that bounding boxes overlap before doing the more computationally intensive mesh intersection test to speed things up.

@cory.quammen Everytime I try this I get a segmentation error crash. I can’t believe that my datasets are big enough to actually run out of memory, so I’m thinking something else is going on. Any other restrictions that you can think of for this procedure??

Thanks

Procedurally, that’s all you should have to do. Can you provide any more info about the crash (stack trace, etc.)?

The boolean operations algorithm isn’t bulletproof, unfortunately, so you may be hitting a bug in it.

You can use this lib: GitHub - zippy84/vtkbool: A new boolean operations filter for VTK

@cory.quammen Thank you so much for providing the plugin. Is there a reason its not included in Paraview? is there a separate repo that provides a collection of things like this that aren’t standard? e.g. “dev”, ot “canary” filters or ones that aren’t currently robust for mainstream use?

@kayarre It’s not included in ParaView because the boolean operations filter isn’t terribly reliable. There is not a repository for such things that I know of, but it’s an interesting idea to have one.

Adding the xml shared @cory.quammen, as well as a plugin for vtkBool would be a simple first step for this.

thank you @mwestphal, maybe I don’t understand but was thinking a git repository that could hold the xml and plugin for things like this?

Adding the xml locally worked for me in this scenario. I have not tried creating a plugin before.

I would be happy create a repo for things like this, but am curious if the Paraview community would also find it beneficial?

You could do that, but most likely not many people will find it.

You could add the pluging directly to the ParaView official source code for easier access.

am curious if the Paraview community would also find it beneficial?

Definitely !

@mwestphal I believe I understand now. I agree that sounds good, but if vtkbool is not very robust will it get accepted into source?

As an optional plugin depending on vtkBool, yes.

1 Like