Converting 2D Floor Plan To Revit Step By Step

Posted by Eric on September 11, 2024

This is a personal project to study and practice converting 2D floor plan to a Revit.

Home Sweet Home

Demo

This is my little cozy home in Nanjing, China.

OpenCV Processing

Contour Detection Demo

Wall Detection Demo

Rooms Detection Demo

CNN Detection

Room Detection Demo

Elements Detection Demo

Coordination Extraction

Here, I get the coordination of the walls, doors, windows, etc.

Walls

Wall 1 Polygon Coordinates:

[[ 10 876] [ 39 876] [ 39 892] [ 10 892]]

Wall 2 Polygon Coordinates:

[[518 346] [526 346] [526 438] [518 438]]

Wall 3 Polygon Coordinates:

[[199 876] [238 876] [238 892] [199 892]]

……

Doors

Door 1 Polygon Coordinates:

[[162 568] [170 568] [170 618] [162 618]]

Door 2 Polygon Coordinates:

[[273 252] [287 252] [287 301] [273 301]]

Door 3 Polygon Coordinates:

[[663 550] [714 550] [714 558] [663 558]]

Door 4 Polygon Coordinates:

[[536 522] [587 522] [587 530] [536 530]]

……

Windows

Window 1 Polygon Coordinates:

[[543 876] [746 876] [746 892] [543 892]]

Window 2 Polygon Coordinates:

[[790 452] [806 452] [806 511] [790 511]]

Window 3 Polygon Coordinates:

[[515 892] [531 892] [531 952] [515 952]]

……

Label

I can label the coordination information on an image! Demo

There we go! Coordinates of the walls, windows, doors are extracted and saved in JSON files. Demo

Revit API

It’s time to do some calculation and use Revit API to generate a revit model ;)

Lots of time were spent on configuring the .NET development environments and also the startup REVIT API lessons.

Here, I can click button on the External Tools button in Revit, and my developed addin program will run (coded with C# in Visual Studio).
Demo

And then, with only ONE click, BOOM! Here come the Revit floor plan generated (only walls for now)! Demo

Also we can check this model in 3D. Demo

2024/09/19 Doors and windows are added to the model! Demo

I will work a little bit more to make it better…

To be continued…