Workflow: Building Masses from .OSM Files

Overview: This workflow allows the user to source .OSM files from, form a polygon from the building points, extrude them and turn them into individual families within Revit.

Packages: ‘Elk’, ‘Landform’ and ‘SpringNodes’.

Dynamo Script: Download from Dropbox

Header - OSM to Mass

Step 1: Getting your .OSM file

Go to and zoom to your location. Make sure that the bounding box includes all the buildings that you’d like to mass. Select ‘Export’, and choose your source. The normal export function usually works fine but the website offers a number of options.

NOTE: Generally, the larger your bounding box, and the more content contained within it, the longer your Dynamo script takes to run. In most cases, it runs quite quickly and smoothly. I have also come across .OSM files missing the building data which it should contain and displayed on the website. Zooming your bounding box in or out a little and re-exporting your .OSM file often resolves this issue.

Website - OSM to Mass

Step 2: Open Revit, Dynamo and your .DYN script

Open a new or existing Revit project, I often use a new project to test and then link if needed. From within Revit, open Dynamo and open the .DYN script.

Script - OSM to Mass

Step 3: Inserting the required information

Use the ‘File Path’ node to select your .OSM file. In the ‘Extrude Buildings’ group, you can use the code blocks to set your maximum and minimum extrude heights. In the ‘Create Families from Building Extrusions’ group, I have chosen to use a typical mass .RFT file but this can be changed along with the family category.

Now you can select ‘Run’!

Dynamo Result - OSM to Mass

Step 4: Back to Revit

Back in Revit if you go to a 3D view, or any view, the Dynamo geometry should be visible.

Geometry - OSM to Mass

Next go to the ‘Massing & Site’ tab, and select ‘Show Mass’.

Show Mass - OSM to Mass

Your building masses should now appear in Revit as individual families, and if you go to your Project Browser, Families and Mass they should now appear there too.

You can now close Dynamo, we’re done!

Building Families - OSM to Mass

Credit to Timothy Logan for his ‘Elk’ nodes and video tutorials!

36 thoughts on “Workflow: Building Masses from .OSM Files

    1. Thanks, Luke!

      It’s a start anyway. Contained in the OSM data is the number of levels per building, I’m currently exploring the option to set a generic height per level and extruding them accordingly for hopefully a little more accurate result. I’ll keep you posted!

      1. Hey Davitt

        Awesome script. Did you ever get it to work based on the levels per building? I’m just starting out with dynamo and I’m not sure how to extract that data out of the osm file.

      2. i have run these nodes but all i see in Revit are the dynamo geometry. I tried clicking show massing vain, i even tried running them from the conceptual mass family template and then load them in the project to no when i close the dynamo window the dynamo geometry in revit disappear. What could be the problem.

      3. hi david,
        what about the extruction of the osm setting a generic height per level?
        I have a shp with a high attribute but when I extrude de shape, the high doesnt correspond to the correct high of the building in the real life

  1. Hello–Am trying this as a complete newbie to Dynamo .. although, I have worked with osm files before in City Engine. I am getting errors that I don’t understand. Figured out that you have to install these “package” files for it to work, but something is not going well. Polygon/PolyCurve say: ” Warning: One or more of the input types are not matching. Couldn’t find a version of ByPoints that takes arguments of type .” And Curve.ExtrudeAsSolid says: “Warning: Internal error, please report: Dereferencing a non-pointer.”
    Does anyone know what is wrong?
    Thanks ….

    1. Hi Robin!

      The first thing I would check is you’re .OSM file. Try going to again and zooming your bounding box in or out a little from the last time and re-exporting your .OSM file. For some reason this can often resolve the issue.

      If the problem continues, get in touch again and I’ll see what I can do!

      1. The strings were not attached as in your image, so I attached them to match it and that seemed to be the problem, because it worked! The heights were far too high, so I have to adjust heights. Should the min and max heights be set according to the actual heights or is that meant to be a default setting? Are those units in feet? I still have warnings, but they are apparently because some of the building corners got cut off in the rectangular osm I used. Thank you!

        1. That’s great, glad it’s working!

          Yes, you can adjust the min and max heights to suit. As far as I am aware, unless specified, Dynamo is unit-less. So it could depend on the template you are using in Revit. For me it imports as millimeters, but I’m sure with a little playing around you can get what you need. Best of luck!

        2. Okay, I see what I have to figure out. Thank you so much for this! This is fantastic. I have been searching for a way to do this for a long time.

  2. Hi, This sounds great but unfortunatetly I do get different warnings and I am quite new to Revit.
    1. Polygon.ByPoints operation failed.
    You must supply more than 2 points to

    2. Internal error, please report: Dereferencing a non-pointer. (3f47aacd)

    3. PolyCurve.ByPoints operation failed.

    I do get a 2d geometry as a preview but no masses.
    Thank you.

    1. There’s a few things I’d suggest trying!

      1. Make sure all the outlined node packages are installed.

      2. Make sure all of the wires and nodes are connected correctly, same as displayed above.

      3. I have also come across .OSM files missing the building data which it should contain and displayed on the website. Zooming your bounding box in or out a little and re-exporting your .OSM file often resolves this issue.

      I hope this helps! If the problem persists let me know, and you can send me on the files and I’ll take a look for you.

  3. I keep getting the following error “Warning: PolyCurve.ByPoints operation failed.
    Cannot make a PolyCurve from an empty list”
    I have tried all off the above without any luck. All strings are connected correctly. The builings are imported to Revit, but when I select show mass, nothing happens and they stay as in Dynamo. So there is no families created.

  4. Hi, I have no errors (anymore) in Dynamo, but somehow I don’t get any data into Revit.
    I have selected conceptual mass.rft.
    “list” in “FamilyInstance.ByGeometry” showing 0: null and 1:null. Is this the problem?
    Do you know what I’m doing wrong?

  5. Hi,

    This is a great tutorial.

    I have successfully used Dynamo to bring topography ( and building masses and streets ( into a Revit project.

    Building masses come into the model at 0’/0m elevation.

    How do I map streets and building masses to the toposurface? Is a new Dynamo script required?

  6. I would like to expand the script so it stores the height in an instance parameter per family. That way it can easier be edited. Do you have any tips on how to do this?

  7. All right! I got it to work so that it creates 3 families:

    1) family with the buildings with a known height (colored white)

    2) family with the buildings that have unknown height but do have number of levels in the osm (colored orange)

    3) family with the buildings that have neither and use a random height (colored red)

    Let me know if you’re interested, I’m happy to share the code

    1. Hi Pieter,

      I would love to hear how you did this – thats my next thought too, how to edit the heights to be more accurate.



      1. I’m going to post a package online soon with some nodes in it that should help with this. I wanted to finetune it even more, but unfortunately i have hit a wall as the awesome osm nodes don’t bring in enough date to build more complex shapes.

  8. Hello!
    i’m just starting learning dynamo and can’t find “MathRandomIntegerMin”, can you please help me?

  9. Davitt,

    Thanks for sharing this is super sweet! I started playing with Dynamo only yesterday but was able to successfully run the script. I do have one question. The dynamo generated blue lines and points are still on in the Revit file after I close Dynamo. How do you remove this content? I can’t select it to hide it nor can I find a category under Visibility Graphics.


  10. I have an issue with Mass models..
    Once I ran the script I managed to view them in the actual project, but I cannot select them or edit. The odd thing is, once I close Dynamo, they still got stuck in there. What should I do?

    1. Problem solved.. the mass family wasn’t charged properly… Must I have to use these mass family or one of my choice?

  11. I love the idea, but can’t get it to work for me! 😦 It’s saying there’s a conflict with Springnodes and Landform, and they can’t both be loaded at the same time. I’m a very, very new learner with Dynamo – anyone able to help me out?

  12. I am having problems making this work with revit 2020. i get to a point when i can see orange outlines of what appears to be the masses, but if i save and restart, its a blank file. I think it just may be that some things are broken in workflow, I just do not know how to make it right. Help would be appreciated, I am a total newbie

  13. re:to those for whom it is broken

    If you’re seeing only orange outlines what you see is the dynamo geometry.

    The problem for me was that the Number.ToString node was broken, replacing it with the Springs package’s Number.ToString node solved it (which is weird, because that is exactly what the Number.ToString node in the dyn file is)

    That node is essential because it numbers the buildings – if it fails all instances of the list that feeds into familyName will simply be “building” (expand the list on the final node – you’ll see errors for not having unique family names)

    The Math.RandomIntegerMin also gives me an error, but that can be bypassed (just feed the number of one code block into distance at Curve.ExtrudeAsSolid – all buildings will be of the same height but you’ll have the extrusions to start with)

Leave a Reply to Pieter Schiettecatte Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.