create view by room with dynamo

image by archi-lab

This is another one of the long overdue posts, or if someone prefers, posts that I have been sitting on for a while and just didn’t have time to release them. This particular workflow was inspired by work that Mario Guttman (http://www.whitefeet.com/) presented at the  AU. Building data is something that every BIM person had to deal with at some point in time. Previously I was exposed to third party software packages like Codebook or dRofus that were used in order to generate huge quantity of Room Data Sheets and in general to manage what goes into each room. Those days are over for me since I no longer work in Healthcare and don’t have to manage 1000s of RDS. I am not going to hide my excitement for that. :-) Either way, with the ascent of Dynamo and its almost unlimited potential in accessing data contained in a Revit model, I lean more towards using custom, and project tailored data extraction workflows than third party plugins. I guess, what I am trying to say is that WhiteFeet is amazing, but it is someone else’s plugin and at the end of the day I would either have to ask Mario for some project specific changes ($$$) or change my project requirements to fit the plugin (insert your PA’s angry face). This is why I decided to ultimately take Mario’s idea and turn it into Dynamo workflow with some added options and enhanced flexibility (ability to assign view templates to newly created views, ability to re-size the crop box so that it always fits into the “room tag”, ability to add missing shared parameters to a project). All in all the process presented below is just a first step in couple step process that allowed me to get Room Data Sheets going for a project that I was working on and have them all done in less than a day – now that’s what I call savings ($$$).
This code is relatively simple and uses the Bounding Box property of the room to create a new Floor Plan view associated with it. It takes an input of a list of Rooms and Crop Box offset in Feet (I know that new Dynamo is supposed to be unit-less but Revit still operates in FT under the hood). I usually set the offset to 3.5 since a door swinging out of the room with a width of 3′-6″ will not get cropped this way. It works for me, but feel free to make it bigger or smaller. Let’s go through the inputs really quickly so that we are all clear on what goes where:

Rooms: This is a List of Rooms. Now you can pass a single room in, but make sure that its in a list format. You can use Archi-lab node called Get Rooms by Level to do just what its called.

Prefix: This is a name prefix for the views. Every new Floor plan will be named Prefix-RoomNumber-RoomName. If you do not specify prefix here, a default value “archilab” will be added to all views.

Offset: This is a value by which the Crop Box will be offset from the room. If you set this to 0 the new view will be cropped to a Room Bounding Box. If you do not supply an input here a default value of 1 FT will be applied.

RunMe: This is a Boolean toggle that when set to False will disable this node. Obviously given that Dynamo now, runs on Automatic mode it might cause your definition to crash if Dynamo constantly tries to create new rooms. Of course that would only happen if you made any changes to rooms in the model which would cause Dynamo to re-execute. Also, this value if not set will be set to True by default so be careful with it, especially in the Auto Run mode. Here’s a full set up: example_01 There is one more thing to be cautious of when working with this node. It will check if Floor Plan view with the same name as the one that is about to be created already exists in the project. If that’s the case then it will not create another copy of it, but rather reset the bounding box to a new location. Of course if you change a room name or number and re-run this definition it will create another view since the name might not match exactly. In the image above you can see that I am using couple of custom nodes to filter for Rooms. They are currently part of the archi-lab package. List Contains is a new node that was created for this workflow and used here to FILTER OUT unwanted rooms. As you can see I was creating a Room Data Sheet workflow and didn’t need to include all rooms so I listed some that should be excluded from the process. Here’s the code for it and its really simple:  

UPDATE 01/10/2020:

Since there were some changes in the API between Revit 2018 and 2020 this script needed an update. Here’s a potential new version: 

The one line of code that I needed to change had to do with View no longer having a property called ViewName. Instead in the latest API its simply set by setting Name property.

Downloads for this updated script will be available on my Patreon page. Thanks for supporting archi-lab.net!

Cheers!

Support archi-lab on Patreon!

50 Comments

  1. andrew says:

    Have their been any issues/reports of these packages working/not working in 2016? I tried it over the weekend and could not get it to work. Thanks.

  2. Brad says:

    Have you made this script available to download? If not how can I get the floor plan by room node as I cannot find it and I’m running Dynamo 0.8?

    Please help as I have recently started using Dynamo and I need to produce 600 RDS, I have done a script to create sheets and number and name them as our office standards it’s just creating the floor plan for each room I’m struggling to create, once I have these views I am going to tag with out RDS room tag

    Please can you point me in the right direction

    Thanks

    Brad

    • No, I am not planning on sharing this definition. The idea for this blog and the only reason I share stuff here for free is because I want people to try it themselves and hopefully learn from it. I am sorry. However, if you are really in a pinch and want me to make this work for your specific application and then teach it to you or folks in your office, we can talk about a different arrangement. It will not be free though.

      Good luck!

  3. Brad says:

    Hi Konrad

    Could you point me I. The direction of where I can get the floor plan by room node as I’m pretty much there it’s just this node.

    If you was to make this work for me how much would it be?

    My email is bradleyclarkes@hotmail.com

    Thanks

    Brad

  4. vitalij says:

    Thank you, Konrad!

  5. Paul Sommer says:

    Hi Konrad…I’m a newbee and very willing to learn. Where can I get the nodes? I could not find it in Dynamo’s packages. I think I understand this definition. Could you please if you don’t send me all the nodes too for this example

  6. Paul_Sommer says:

    Ah. Okay. Got it. Thanks!. Keep up the good work!

  7. Eric Richter says:

    Hey Konrad,

    I have tried using this definition, and it works well except I need the new crop box to follow the exact bounding box of the room if that makes sense. Currently, this node only creates rectangular crop boxes around the rooms. I was wondering if you could point me in the right direction or show me what I need to do to create a crop box that will be the exact non-rectangular shape of the room.
    My email is Larze123@gmail.com if you need it.

    Thanks

  8. Galen says:

    Hi Konrad,
    Great work with this one, it’s a great node!
    One comment is that in the newest ArchiLab package, the node needs to be changed very slightly to read Rooms not Room before it will work on the whole list.
    I am wondering how this could be used in the existing phase. The Get Rooms by Level only seems to pull the New Construction phase rooms.

    Thanks!!

    • Yes, I am aware of that. I need to update the whole package to 0.9.1 and so far I had time to take care of just a few nodes. It’s the new ability to define data types for the inputs. My previous names, now are not just names, but if they happen to coincide with the Type, they get treated as type specific input. I have to check all of my nodes for that.

  9. mario says:

    Konrad,

    I noticed in the GH Forums, there is a lot of community help, however as the Dynamo community evolves it quickly goes into the realm of consultancies and specialists.

    In your opinion, is this driven by how difficult it is to get Autodesk Products to work and how the Revit API simply doesn’t do some of things that are needed?

    • Mario,

      In all honesty I can only speculate why it is. My best guess is that as it is right now, Dynamo doesn’t really foster community support (poor forum platform, lack of developer support, slow responsiveness etc), hence making it more difficult for people that would otherwise be willing to contribute to the community. On the other hand there is also the difference in audience. I don’t see Dynamo having much academic use hence it doesn’t draw a large crowd from that community. Instead, it is really a platform intended for AEC professionals and it’s usually hard to get people with day jobs to also contribute to the online community in their spare time (which as most professionals will claim they have much less than academic peers). Of course there might be a whole array of different reasons. I just don’t see the two communities being similar and that composition – both from software and human standpoint – makes all the difference.

      Ps. I hope this is not a suggestion that I have regressed in my contributions to the Dynamo community? :-)

  10. David says:

    Konrad,
    I’m running into a “TypeError” issue with line #73 of the floorPlanByRoom.py script. Error says it’s expecting Guid and is getting a string.

    “File “”, line 75, in TypeError: expected Guid, got str”

  11. David says:

    Line 75 error is caused by a change in the latest version 0.9… change the get_Parameter value to read like so…
    i.get_Parameter(BuiltInParameter.ROOM_NUMBER).AsString()
    Thanks Konrad!! Awesome script!!

  12. Chase says:

    It looks like this node has changed some since this post went out, so not sure how much functionality has changed. I’m new to Dynamo so bear with me (just had training last week). I’m attempting to create a script that automatically creates enlarged plans of rooms, keys them (with callouts) on the main floor plan, and assigns a view template to them. I’ve gotten this to work in terms of filtering by room name and using the floorplan.byroom node, but I’m wondering if there is a way to modify the node so that it creates a callout on the main floor plan. It is also not allowing me to assign a view template via the Apply View Template node, and I’m also getting an error about a string view name – but not sure how far back it is coming from (maybe in the parameter value by name, but not sure what I’m doing wrong there).

    Attachment:  Capture.png

    • I don’t think there are nodes available in Dynamo that will handle creation of callouts. There is a method in the Revit API http://revitapisearch.com/html/272ce735-271e-6ae3-8b36-c31207c99e56.htm that should allow you to do that but you will need to script that either with Zero Touch C# node or using Python custom node. Archi-lab package was last released for Revit 2016 and Dynamo 1.0 so please make sure you are on those versions. If these nodes are still missing, I will check it out just let me know. Cheers!

      • Chase says:

        I found the error I was having with the output – it seems like line 99 of the custom python script in the floorplan.byroom node was incorrectly called out as view.CropBoxVisible = False, and I was taking a stab that it should match the items above and be newview.CropBoxVisible = False. Making this change gave no errors in the output and allowed me to assign view templates directly with a final node in the Dynamo script. Now I’m on to tackle the custom python node to create the callout. Thanks!

        )

    • Sean Johns says:

      Thanks Konrad and Chase. I’m trying to implement an efficient way of generating Room data sheets. I was able to modify your capture to run its operation on all the rooms in my test file and apply a view template too.

      The next step is to figure out how I can create internal elevations.

      *I should point out a minor glitch with my version however: It needs to be run twice for some reason. the first time the script is run, it creates the first room plan, then when I hit run again, it generates the others. (I’m using Dynamo 1.2 on Revit 2017)

  13. robert says:

    Awsome!
    thanks!

  14. AdamHamilton says:

    Konrad -awesome as always…I had to change the line 99 to newViews as well to get it to run on my list. Otherwise it only did the first view. v1.3.1

  15. Dave Plumb says:

    I just created my own Room Data Sheet graph.
    Standing on the shoulders of giants! Many thanks, Konrad. It took me maybe 20 minutes to have a functioning program.

    I also noticed, as did Sean, that it seems to only do one room the first time it’s run.
    Simply re-run the graph and the second time, it creates them all as expected. Odd.

  16. Dave Plumb says:

    Aha!
    I think I have found the cause of the “Only creates the first” problem.
    I happened to be on a Drafting View when I ran the graph, and it only created the first RDS View.
    Then I closed everything, reopened, and made sure my Current View was a Floor Plan.
    Sure enough, it worked fine, and created all of the RDS Views I was expecting.
    In Dynamo, the time it failed, I got a Traceback to Line 99 in the Python node (inside FloorPlan.ByRoom)
    As Chase mentions above, line 99 is
    view.CropBoxVisible = False
    view. refers to the current View, which in my case was a Drafting View. Drafting Views do not have Crop Boxes, so the Python script fails at that point
    Line 999 should read (again, as Chase found)
    newview.CropBoxVisible = False

  17. Loek van Steijn says:

    Hello Konrad,
    Can you make such Python script also for creating a floor plan by Bounding Box? so no Room is needed. I want to create floor plans for Model Groups.

    Thanx in advance.

  18. Loek van Steijn says:

    Hello Konrad,
    Is it also possible to create/ edit this script to create plan views based on just bounding boxes?

  19. Jedrzej says:

    Hello Konrad,
    I’m having some issues with FloorPlan.ByRoom node – the same as mentioned before with line 99. Node creates plan rooms as expected, but due to errors, every next node is not working (viewport create, set template, set parameter).
    In the .zip file there are some screenshots and dynamo file, but I could send you a project test file if you need.

    Thanks in advance!
    Jedrzej

  20. wanna says:

    Hi Konrad K Sobon,

    Is it possible to create view by room across the link model ? Recently, i have been trying got error that “levelID” which is not corresponding to the level in the python script. So i check the parameter of Levelid of room through revit lookup add in …. and i observe no parameter available thru link model. Can you please advise ?
    Thanks

  21. Mohammad says:

    Hey Konrad,

    thanks for your great work!

    I was just trying to use the script, but it shows me error (see image). I did exactly the way you did, except I am getting the rooms by using categories and all element of category – shouldn’t be a issue related to that I suppose.

    I tried to use bakery node for getting guid, still not working.

    Attachment:  Guid-to-str.png

  22. iv says:

    I made a skript using your package to create areaplan by selecting areas, interestingly enough it was working just well, but then I try to run this skript again to see that the node “AreaPlan.ByArea” is vanished.

    Any help would be appreciated!

  23. Malcolm Stewart says:

    Hi Konrad,

    Thanks for the post!

    I have just started using Dynamo and I am having a bit of trouble getting this script to work. I have been getting a warning attached to the FloorPlan.ByRoom node:

    Traceback (most recent call last):
    File “”, line 97, in
    AttributeError: ‘ViewPlan’ object has no attribute ‘ViewName’

    Any help in resolving this will be much appreciated.

    Thanks,
    Malcolm

  24. Rachel Reade says:

    Hey Konrad,

    I’ve recently been using your script above and I’m having issues with it cropping the room plans. For some reason it creates all the plans named correctly but doesn’t crop any of them to the room.

    Any help would be appreciated

    • Thanks for pointing it out. I made an update to address the issue. It had to do with changes in the API from older versions of Revit to latest 2020. Please see the post again for the updated graph.

  25. Greg Peterson says:

    Hi Konrad,

    I did skim thru the article so hopefully i didn’t miss this but was curious. In your image at beginning of article it appears that the RDS views are being created as dependent views, which is what I’m looking for, however, the node from archilab is creating independent views. Is this correct and if so, is it possible to create new plan views as dependents of a selected view?
    Thanks for your time.
    Greg

  26. Gaston says:

    Hello, Im trying to use this node but a traceback error appears
    “Nonetype” object has no attribute “Min”

    Would be very helpful if somebody could help me, thanks

Reply to Brad Cancel Reply