Blog 8: Converting Walls into 2D Geometry


In my previous posts, I worked on extracting and refining walls from a 3D LiDAR scan. I want to transform those cleaned wall points into a standard 2D floor plan. Below, I’ll walk through the process of generating DXF (for CAD software) and PDF (for easy viewing) files—and outline my plans to compare them to the reference drawings I recently received.
From 3D Walls to 2D Points
Even though walls are inherently vertical, their exact coordinates span X, Y, and Z. To produce a floor plan, I only need X and Y. The script projects the wall points onto the XY plane and discards altitude data, thereby flattening the walls onto a 2D layout.
Generating a Floor Outline
Once I have all the 2D wall points, my code utilizes geometric algorithms, such as the minimum rotated rectangle or a convex hull, to generate a simple boundary polygon. This step helps isolate the overall shape of the room(s), turning scattered wall points into a more continuous, closed outline.
Exporting to DXF and PDF
DXF: Ideal for CAD environments. My script creates line segments along the polygon’s edges, labelling each wall segment’s length in meters, and then places a total floor-area label at the centroid.
PDF: This format is Perfect for quick sharing or presentation—no special software is needed. I plot the raw wall points and the extracted outline in different colours, annotate each edge length,
Compared to the Supervisor’s Reference
I recently received my supervisor's PDF and DXF floor plans of the same scanned area. The next step is to compare my automatically generated drawings with these reference plans. I’ll look for the following:
Alignment: Are primary walls lining up, or is there an offset?
Scale: Do the lengths match known room dimensions?
Missing Details: Are any doors, windows, or small walls in the reference not captured in my LiDAR data?
By cross-checking these points, I can refine my process further or confirm that my LiDAR-based approach is accurate enough for practical use.


PDF exported
DXF exported


Plans provided by supervisor, we are scanning LAB H106

