Automate drawing basic elements based on floor plan

Automate drawing basic elements based on floor plan

emailmatthijs
Explorer Explorer
679 Views
5 Replies
Message 1 of 6

Automate drawing basic elements based on floor plan

emailmatthijs
Explorer
Explorer

I am looking into ways to reduce the amount of work that goes into converting a floor plan (mostly DWGs) into a production-ready Revit drawing. It would be awesome if the starting point could be made such that basic elements, i.e. walls and doors, would already be drawn in and at most would need some checking, rather than having to draw everything over by hand.

 

Have others had success into automating the drawing of basic elements in Revit based on a floor plan? And if so, what solution did you end up using?

 

I have been looking into if I could maybe leverage AI, with the current surge of interest due to LLM, or maybe with more established CV (Computer Vision, e.g. OpenCV) techniques, to be able detect these basic elements within a floor plan. Unfortunately so far I have not found a fully satisfactory solution.

 

My ideal solution is something I would be able to self-host due to security and privacy concerns. And be able to integrate into an Add-in of my own (for own use, not to sell).

 

What I have found so far myself:

  1. On the Autodesk forum itself: Converting CAD to Revit. The post is old and almost all links are now dead. And I hope that with the recent developments of AI, there might be new solutions available to us.
  2. Using OpenCV to detect walls and doors. This would allow me to self-host and has the advantage that, rather than just DWGs, it would work with images and PDFs as well. However it would probably be hard to make it fault tolerant enough, i.e. being capable of dealing with inconsistent floor plans.
  3. Rasterscan. When trying their online trial, the results were disappointing compared to what I have seen in some of their videos. It seems commercial and part of a service, given their GitHub repo, so I am unlikely to be able to self-host it.
  4. Helix. Requires very clean DWG layers. So it is like missing part of the first step of what I am hoping to find a solution for (the detection). Or another way to put it, it has very bad detection for my intended use that has floor plans of inconsistent quality.
0 Likes
680 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni

Just drawing walls and doors sound pretty easy to me. For a trivial sample, you can look at the very early code from The Building Coder to generate a little house:

   

  

The little house code is available in the external command Lab2_0_CreateLittleHouse in the AdnRevitApiLabsXtra:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 6

emailmatthijs
Explorer
Explorer

Thank you for your quick response Jeremy!

 

The drawing of the walls and doors themselves using the Revit API is indeed the easy part. As part of my efforts to try and make drawing using Revit easier for my use case, I already did various experiments using the Revit API to see what would be possible. Half the time I ended up researching one of your posts, so I am a big fan of your work!

 

The hard part of my question is in determining where to draw them in the first place. It as if the corners list in your example was not hardcoded, but it first had to be decided based on a floor plan with potentially all kind of noise, like a DWG with no layers and potentially with all kinds of unrelated shapes, such as chairs. My starting point is a DWG file (simplified: just a bunch of lines) or an image (simplified: just a bunch of pixels) as the floor plan. And so I am hoping there is a solution, either some smart algorithm to detect wall and door shapes in lines (probably ideal), or have AI assist in detecting these shapes somehow. Or maybe this is a mostly already solved problem in CV (Computer Vision), and I just have to learn to tweak it correctly, to get good enough results that way.

0 Likes
Message 4 of 6

jeremy_tammik
Alumni
Alumni

So, you question basically has absolutely nothing to do with Revit or its API, and concerns purely the generation and cleanup of 2D floor plans, or maybe not even the generation, but only the cleanup of existing plans? Do you have any control over the plan generation at all? Where do they come from? If you can generate them yourself, you can easily create so the no cleanup is required.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 6

emailmatthijs
Explorer
Explorer

> So, you question basically has absolutely nothing to do with Revit or its API

That could end up being the case, yes. However, the answer could very well be: "There is this or that trick in the API you could leverage to detect a curve line combined with a straight line with which you might be able to detect doors." Hence I am asking here with the hope to find out.

 

Also one of my own experiments in the matter so far involved using the Revit API to see what it could read from a linked DWG and to see if I could somehow detect the doors in it, but there was too much data in my test cases that brute forcing wouldn't work, and I was uncertain how to go about transforming and filtering the data, and whether it would even be viable. So I stopped there.

 

> Do you have any control over the plan generation at all?
No, these are provided to me from external sources. They (parts of the floor plan, such as walls and doors) are the thing I need to initially redraw in Revit (this part I am trying to automate) before being able to do any further work in Revit.

 

> If you can generate them yourself, you can easily create so the no cleanup is required.
I agree, if that were the case, things would be easy.

0 Likes
Message 6 of 6

jeremy_tammik
Alumni
Alumni

Thank you for clarifying. OK, well, item by item:

  

I am not aware of any such support from the Revit product or API whatsoever.

  

I think your best bet would be to consider the task completely separate from Revit and its API.

  

One avenue that I would suggest would be to work on an optimal prompt for an image-enabled AI asking it foer what you need. Something along the following lines:

   

Consider the given image a 2D house floor plan sketch. Please identify the wall curves and all door and window instances. Determine and extract the pixel coordinates of each wall, door and window start and end point and list these as text in a CSV file specifying element type, X and Y start point pixel coordinates, X and Y end point pixel coordinates, for example like this:

      

wall, 10, 25, 10, 400
door, 10, 50, 10, 100
window, 10, 200, 10, 250

   

Looking forward to hearing how that goes for you and what you end up with.

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes