Mesh cutting / removal using XYZ coordinates

Hi. Not sure if this is the right place to ask this question but I’m hoping that a blender genius could help!

I’m looking for a way to automatically slice a mesh and delete the sections that we don’t want to keep.

For example… we might have a large OBJ mesh (500k triangles) & a csv file with a few hundred XYZ coordinate paths that run through the centre of the mesh.

We need to import the mesh, slice at those coordinates, remove the top section, and probably apply a reasonable decimation to what is left before exporting again as an OBJ. No textures are present

My engineer friend says that this is not possible and we shouldn’t try but I’m sure that this must be doable somehow in something like blender with some smart scripting. He is a very good programmer but I have to convince him before he will start my strange projects.

Any ideas at all? I really hate those words “not possible”!!!

Cheers, Rhys

Sounds like you could do something like that using Animation Nodes or Sverchok. You could probably do it in pure python too but it would be more complicated.

If you use a BOOLEAN modifier with a PLANE (flat geometry) in DIFFERENCE mode, you can slice the mesh as you described:

There might be some stability issues in boolean behavior, but with some simple python can detect and bypass it. Adding Decimation modifier after will complete your pipeline.

Alternatively the process you described is easily executed in Houdini (commercial). You will have 3-4 nodes: file(import)->clip(cut off part you want - super fast operator) -> Polydecimate -> Output. You would be able to use it on any file after.

Could you maybe describe specifically what the situation is? What is it that you are trying to do? Could you provide examples - pictures, sample meshes, sample results, sample CSV files? Right now I understand you have coordinates of points that would make lines going through the centers(that is not a defined thing as well - center of mass?, average of vertex coordinates?, center of bounding box?..). It’s not possible to slice something 3d with 1-dimensional lines so you need planes. It might be hard for you to get help without describing the problem accurately.

There is also the bisect operator, which can be called via python pretty easily.

Hi guys, thanks for your input. MartinZ, sorry you’re right… way too many details left out. I drew a quick picture lol

We scan roads with a 3D scanner and end up with a blank OBJ mesh + a CSV file of XYZ positions that move down the road at around 1 metre above the road surface (we can create or configure any kind of CSV file).

I want to cut all mesh that’s above about 1 metre from the road height (to analyse the road, we don’t need all the triangles relating to the trees, sky, etc)

Regarding the creation of a plane, we also have some rotation data so we can actually extend the “cutting plane” out easily to any distance. Maybe we’re actually trying to create a selection tool that selects triangles and then a delete function? I’m not sure. As long as we keep the road surface and a bit of the road edge information. Any thoughts very much appreciated!

OK, so that’s a lot clearer. So you get a huge single file from the scanning process with the entire scanned road and you need to divide it into one meter sections along the road’s direction, but remove anything let’s say 30 cm above the surface and decimate the result, right? I would recommend first finding a way to quickly and efficiently do what you want to do in Blender manually, then see how it can be optimized and automated. You would need to get the direction of the road and the direction the surface is facing. Surface direction is probably there already in the normals of the mesh. If you have a way of getting the road’s direction accurately at every cut, that sounds doable. I would say it would make sense to write some sort of a script as opposed to doing it manually if you had a couple of hundreds of these files to process.

Will mention that point classification fields (ground, vegetation, buildings, etc) could help if present in your scan data. Can cull by type via lastools. Seems you can classify by height (hopefully localised).