Prepare pointclouds from aerial LIDAR scans for 3D printing
A tool to turn pointcloud data from aerial lidar scans into solid meshes for 3D printing. You can find examples of meshes made with this software on Thingiverse.
.xyztext files that contain comma separated numbers. I've tested this tool with data from this website which provides free data for the German state NRW.
.xyzfiles into the data folder. You can also put them somewhere else and configure the location later.
create_mesh.batand put in your configuration. You need to set your latitude and longitude. You can also set the size of the square you'd like to extract.
create_mesh.batfile. It will now run all the steps required to generate the mesh. Depending on how much data there is to process, this will take between a few minutes and an hour. Once finished, the window closes and if everything worked, a file called
mesh.stlcan be found in the project directory.
If you followed these steps and it did or did not work, please tell me about it!
This paragraph will explain what each line of the batch file does.
pointcloudtool.exe extract %datadirectory% pointcloud.xyz %latitude% %longitude% %projection% %size%
This line runs the code from this repository to search all
.xyzfiles in the
%datadirectory%. It collects all points that are in the specified square and writes them to the file
pointcloudtool.exe fix pointcloud.xyz pointcloud.xyz heightmap.xyz
This line runs the same program to fix holes in the pointcloud by adding new points where there are holes. These holes confuse the mesh reconstruction algorithm later. It also creates a simplified heightmap of the pointcloud with normals.
%meshlab% -i pointcloud.xyz -i heightmap.xyz -o mesh.stl -s filter_script.mlx
This line runs Meshlab with a script that contains instructions on how to reconstruct the mesh. First, Meshlab runs a surface reconstruction algorithm on the heightmap. This can be done because normals where calculated for it earlier. Then, the normals of this mesh are transferred to the actual, high-detail pointcloud. The mesh reconstruction algorithm is run again, now on the big pointcloud. This mesh is then saved to mesh.stl.
pointcloudtool.exe makeSolid mesh.stl mesh.stl cube.stl %size% %verticaloffset%
This line, again, uses the program from this project. It adds new triangles around the seam of the mesh and connects them, resulting in a watertight, solid mesh. This could already be 3D-printed! Furthermore, it creates a box with the exact horizontal and vertical dimensions that where configured.
%blender% -b -P intersect.py -- mesh.stl cube.stl mesh.stl
This line uses Blender calculate the boolean intersection between the solid mesh and the box. The result of this is the final mesh.
This project is distributed under the MIT licensense. Exempt from the license are the parts that link a source, as I didn't write them.
License for the preview image in this document:
Land NRW (2018)
Datenlizenz Deutschland - Namensnennung - Version 2.0 (www.govdata.de/dl-de/by-2-0)