Workflow: Building Masses from .OSM Files


Overview: This workflow allows the user to source .OSM files from www.openstreetmap.org, 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 www.openstreetmap.org 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!

Advertisements

23 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.

  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 openstreetmap.org 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 (opentopography.org) and building masses and streets (openstreetmap.org) 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.

      Cheers

      Rob

      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.

    Thanks,
    Clemson

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s