Donate Now Goal amount for this year: 2500 USD, Received: 1627 USD (65%)

Results 1 to 5 of 5
Like Tree5Likes
  • 3 Post By josephpeel
  • 2 Post By josephpeel

Thread: Revit to/from Excel with Dynamo

  1. #1
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Current Local Time
    04:41 PM

    Revit to/from Excel with Dynamo

    A while ago I read this excellent example of a simple, practical use for dynamo and thought it was a good place to get started with learning to use it (rather than all the parametric form stuff, for which I can see absolutely no use in MEP projects...)
    I do a lot of import and export of data using BIMLink but it would be nice to achieve the same results with Dynamo in a way that can be customised for our own design processes.

    I found Dynamo is really very user freindly and logical once you work out where everything is in the menus. For some reason everything seems to have completely different names in the Add-in for Revit2014 version compared to the examples in the link above.
    However, I manged to get the export and import functions working in an evening with no previous Dynamo experience, so I have included images of them both.
    Revit to/from Excel with Dynamo-excel.pngRevit to/from Excel with Dynamo-excel.png
    It works... but needs some improvements for it to be practically useful...

    - I tried including ID and Coordinates but this info comes out in a form that cant be written directly to excel. This can be solved by changing the ID or Location into a string but this involves making/modifying a custom block. This is actually not too difficult as there are many blocks available through the package download function that can be tweaked to do what you want without having to totally learn python. As you can see the import program doesnt use the ID yet, it just assumes the order of the objects is the same..
    - Select Type can be very very slow in large projects and finding stuff in the list is a pain, so I tried using Select Instance (Click on object in Revit)-> Extract the Type from the Instance -> Select all instances of Type. But I have not yet manged to make this work. Is there another way to do "Select all instances"? Also how would you select all instances of things that dont appear in the family type list? (Eg. spaces)
    Clicking an object to select all its instances would also prevent the errors that come up when you choose a type from the list that doesnt have any instances placed in the project.
    - It would be nice to write the parameter names to the head of the columns in excel so its also Human readable.
    Also reading the parameters to be exported from a preprepared excel sheet would be more useful than having to type them all in dynamo. many excel sheets with different sets of parameters could be used with the same dynamo Export and Import programs.
    -A preview that requires confirmation before actually writing stuff to revit would also be safer.

    I am going to develop this further, to get a bit of experience with dynamo, and will probably work all these things out by trial and error but if anyone has any suggestions let me know Im sure a reliable, and FREE import export tool in dynamo is something that would be useful to many of us.
    Last edited by josephpeel; October 15th, 2014 at 07:02 AM.
    chompi0n, ThatBIMGuy and Drew like this.

  2. #2
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Current Local Time
    04:41 PM
    OK, so I managed to download and install an old version of Dynamo and thats why everything looked different from the example version.... DOH!

    Here is v2 of the To Excel program in the latest version of Dynamo (7.2.0)
    Revit to/from Excel with Dynamo-excel-v2.jpg
    (Note that the last 'data' field has not been connected for testing. This should be connected to the Watch below to write the excel sheet)
    I had this working perfectly yesterday but I updated dynamo and now the custom "Get Type" block isnt working..
    Anyone know another way to get type from an instance?

    However, when it does work, it uses the selection of a single object in a view to select all the other instances (Much more intuitive than a list of types) and then only the parameters that exist in the object can be selected (Rather than making typing errors in strings). The selected 5 parameter names get written to the column headers in excel and then the columns are filled with the parameter values. The ID number is also included (Now a standard function in Dynamo 7.2.0).

    One problem with writing data to excel with dynamo is that, even though you can specify the row and column, the write operation erases everything else in the worksheet. So the excel sheet needs to be written in a single operation. So the title and column lists are combined before writing.

    Next step is to make an Import program that reads the parameter names from the columns and uses the ID to write data to the correct objects. So no user input required except selecting the correct excel sheet.

    This is how the select all instances part should work (before it was updated);
    Revit to/from Excel with Dynamo-all-instances-select-instance.jpg select all instances of type seems to have been changed, i guess that sort of thing will remain a problem as dynamo is developed further.
    Last edited by josephpeel; October 15th, 2014 at 07:03 AM.
    ThatBIMGuy and tuekappel like this.

  3. #3
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Current Local Time
    04:41 PM
    Another update;
    Got the export side working perfectly. There was an error with an older version of "Single Item or List" so I had to remove that from "Get Type" (It only needs a single family anyway). It now looks like this;
    Revit to/from Excel with Dynamo-excel-v2.jpgRevit to/from Excel with Dynamo-excel.jpg

    So far so good... then I attempted to build the import side using the ID parameter as in the BIM Troublemaker blog;
    Revit to/from Excel with Dynamo-excel-v2.jpg
    This method requires no input at all from the user( Except excel sheet location), as it reads the parameter names, data and object ids in from the excel sheet.
    So far none of the methods or packages for selecting elements by thier ID (Long or short) have been succesful... and until I can be sure the correct data will be written to the correct objects this is not something that can be used on active projects
    If anyone wishes to play around with this I have attached the dynamo files, maybe you will have more luck getting the custom node/code parts to work.
    Attached Files Attached Files

  4. #4
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Current Local Time
    04:41 PM
    Ok, to conclude this example;
    I learned a few things from this about dynamo. It is not really suited to making a generic tool that can be applied to lots of things. Different types of parameters come out in different ways and need to pass through excel and come back correctly as number or string, so adapt the definition for what you want to do.
    Also, "If its not broken dont fix it". Upgrading dynamo can totally destroy your programs because of all the new improvements to nodes so dont upgrade stuff unless you have time to fix it. After upgrade to 7.4 the From Excel part of this did absolutely nothing when run, so it couldnt even be debugged. I rebuilt it with new nodes and it worked fine.

    The Element by ID function is included in a package of useful revit stuff called Clockwork. This is the only custom node I had to use.
    Another important thing with export to excel is the format. Anything with units gets converted to text in excel and wont import into a parameter with length, volume etc.. Remove units with SIUnit.Value (Or medieval equivalent for non SI) before writing numbers to excel

    This example extracts the Offset of all the electrical fixtures, so we can find everything that is at height 0 (Lazy reviters that didnt add a height so fixtures are half in the floor..) and set it to 500mm or something in excel before re-importing.
    Works fine with Dynamo version 0.74 and Clockwork package. Feel free to adapt it for something useful..

    More than one parameter can be added by copying all the parameter bits and adding an extra line to the lists with +
    Attached Files Attached Files
    Last edited by josephpeel; December 10th, 2014 at 11:52 PM.

  5. #5
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    London, United Kingdom
    Current Local Time
    03:41 PM
    I'm going to come steal your trials and tribulations when I need to use Dynamo to Excel Thanks Joseph!

Similar Threads

  1. Replies: 0
    Last Post: September 15th, 2014, 05:45 AM
  2. Replies: 0
    Last Post: September 8th, 2014, 12:45 PM
  3. BIM Troublemaker: Practical Dynamo - Excel Linking
    By BIM Troublemaker in forum Blog Feeds
    Replies: 0
    Last Post: September 3rd, 2014, 03:45 AM
  4. Replies: 0
    Last Post: August 26th, 2013, 07:45 AM
  5. Revit and excel
    By Darius in forum Architecture and General Revit Questions
    Replies: 8
    Last Post: June 28th, 2013, 01:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts