I noticed that the Clip Closed Surface filter doesn’t seem to have this issue with concave parts; is there a way to extract this closed part from the filter result as a 2D surface to then use to calculate the area? Or any other methods to accurately calculate the cross-sectional area?
You can search for Green’s Theorem or divergence theorem.
But, in essence you integrate the coordinate*normal over the outline to get the area of the surface.
You need a slice which is oriented towards a major direction here (alternative, use transform to make sure it is)
In paraview you can do the following:
add filter
slice
linear extrusion (makes sure the normals are pointing exactly outwards)
coordinates
surface normals
slice again
calculator = coordsY*Normals_Y (replace Y with whatever orientation you have)
integrate the results of the calculator. This should give your area
Thanks for your help. This method is much better in terms of accuracy, however unfortunately it doesn’t really work well for my needs:
As you mentioned the slice needs to be oriented towards a major direction, but a majority of the time, the slice I want to find the area of isn’t oriented towards any major direction
The area calculation is a Python script that’s run as part of a web app, so it’s difficult to use the transform filter to orient the slice correctly in Python to use this method
In addition to finding the area of the slice, I ideally need to be able to show this slice as a 2D surface on my STL (as shown in the picture below), which can’t be done with this method
Because of these reasons, it seemed to me that being able to extract the closed part from the Clip Closed Surface filter result as a 2D surface would be the best option. Is this possible?
Take your Clip Closed Surface filter and add the following to your pipeline:
Generate Surface Normals: All of the cells on the plane you just used in your clip closed surface filter will have the same surface normal value
Calculator filter: compute the dot product of the “Normals” (point data generated with Generate Surface Normals) with the normal to the plane you used in “Clip Closed Surface”. This will generate a new data value on your data that is equal to 1 on the plane used in “clip closed surface” filter and not equal to 1 every where else
Threshold your data by your calculator result and keep only the values greater than or equal to 1
This works well, thanks! I have another question, is there a way to use this method if the area I want to find and show has a hole in the middle of it, like in the screenshot below? Sometimes I need to use the vtk BooleanOperations filter (loaded as a plugin) to find the boolean difference between my STL and a cylinder, then find and show the area of a cross-section cutting through where the STL and cylinder intersect. In my original method, after using the Delaunay2D filter, I would remove the part of the surface that represented the cylinder using the Threshold filter to exclude any negative distance values (which I get from the output of the BooleanOperations filter).
However, if I use the Clip Closed Surface filter, this data array is deleted so I can’t use the Threshold filter to remove the part of the surface that represents the cylinder. I did also try to follow your method and then use the BooleanOperations filter to find the boolean difference between the surface and the cylinder but this led to Paraview crashing. Is there a way to remove the cylinder part from the surface?
I’ve managed to solve the cylinder problem by turning on ‘Reorient Difference Cells’ in the BooleanOperations filter. However, I’ve noticed a new issue with the Clip Closed Surface filter. After running the boolean difference operation between the STL and cylinder, if I use Clip Closed Surface filter, sometimes the holes aren’t completely closed. This generally seems to happen if the filter cuts through the difference area between the STL and cylinder and there are two or more areas in the result, as shown in the screenshot. Is this a bug or am I doing something wrong?