door set handing

In this post i will demonstrate how to automatically determine if door is left or right handed.

One of my fellow Bloggers asked me this morning about determining door set handing programmatically (or any other automated way). Dynamo is a pretty good at accessing Revit API so i quickly cooked up a solution using three of the door properties: HandFlipped, ToRoom and FacingFlipped. Those three combined together make it easy to determine if a door is left or right handed. For all doors swinging into space that has no room placed (most likely exterior) there is another set of hardware called Right Hand Reversed and Left Hand Reversed. Here’s a solution:

Here’s what the Dynamo definition looks like:

 

Here’s the code that sits under the hood of Door Set Handing node:

Door Set Handing is now a custom node available for download here: Dynamo Download Page.

Preview of this functionality:


Also, Håvard Vasshaug has made a short video and a write up on his blog demonstrating this node in real world application. You can find it here.

PS. 02/26/2015

In response to questions posted below originally by Dominik, I made some changes to the Door Set Handing Node. Code that you see above reflects those changes. There is an additional input now, for a Phase, since extracting door ToRoom and FromRoom information required that input. I had originally made a silly assumption that everyone’s phases would be called “New Construction” or “Existing”, while in reality some people like to change their names. Anyways, it was an issue with Phase names, and the node should be working well. Thank you to Dominik and recently Jan for pointing out that the node wasn’t functioning well. Here’s the latest example that uses Document.Phases from Clockwork package, to extract a phase on which door might reside:

responseToDominik

Support archi-lab on Patreon!

71 Comments

  1. Steve says:

    Will this update automatically if the entire plan is mirrored?

    • Konrad says:

      Yes, mirroring doors will not affect correctness of this definition. Also, it does not “update itself”, you would have to re-run the Dynamo definition, but yes after you run it again it will update all doors that were mirrored.

  2. Compliments!

    Would it be also easy possible to write a right value to a Revit parameter?
    This for forwarding the right “Operation” parameter
    http://www.buildingsmart-tech.org/ifc/IFC2x3/TC1/html/ifcsharedbldgelements/lexical/ifcdoorstyleoperationenum.htm

    Greetings, Hans Hendriks.

    • Konrad says:

      Hans,

      Yes, I dont see why not. This IFC standard looks pretty nice. I wish I had it when i first started looking at this issue. I really just did this as a quick proof of concept for a friend of mine so I haven’t tested for all possible door type and combinations. The way it works now, its possible to write any parameter back to door family. Those code block nodes that you see and values within them that have ” ” around them mean that its text. Feel free to change any string/text value to any other and it will write that.

  3. zcgt21 says:

    Hello:
    I’m a spanish speaker, so my english es very bad, I hope you understand.

    I’m following the instructions of the video and the image, but the code doesn’t work, I don’t know what is happening, when I do the last part, (Element.SetParameterByName) and apply “run” the node it’s turn yellow and show me the Warning: Dereferencing a non-pointer. I no have idea.

    Even edit my family door and create a new parameter called “Abatimiento”.

    Thanks for your time.

    • This must be a language issue. I have never tried running Dynamo on a non-english version of software so I have no idea how the code gets translated. My guess is that is is not getting translated at all, but parameters in Revit do. This can cause a lot of problems if parameters called out in code are stored under different name. Try creating parameters in English that match ones used in my video. Other than that I am not sure what I can do for you. I am sorry.

  4. Chris Warden says:

    Konrad,
    Would you be so kind to contact me in reference to the door set. Looking for some assistance on getting started.
    Thanks
    Chris Warden
    785-727-2416

    • Chris,

      I would say give it a go and post questions here or on a Dynamo blog if you run into trouble. I will try and help as time permits (I am a practicing architect working for a busy office so there might be delays).

      Good luck!

  5. Dominik says:

    I have the same problem
    “Warning: Dereferencing a non-pointer”
    I tested this with the parameters of your example or others and always getting thie serror message.

    Any idea where the problem could be?

    best regards
    Dominik

    • Dominik,

      Can you post an image or a definition + Revit file that you are testing this on? Since max file size upload for this blog is 2MB use Dropbox or any other similar service for sending me large files. I will need to see it to be able to respond.

  6. Dominik says:

    Hi Konrad,
    thanks for your answer.
    I zipped the rvt and the definition file here
    https://www.dropbox.com/s/92b63hzmxxggmi8/wall_swing.zip?dl=0

    best regards
    Dominik

  7. Jan says:

    Hi Konrad,

    Same problem here:
    “Warning: Dereferencing a non-pointer”

    Did you manage to troubleshoot Dominik’s issue already?
    Thank you for your help.

  8. Dominik says:

    Hi Konrad,
    You’re the best! Now it works!!

    Many thanks for the help and your great scripts.

    best regards
    Dominik

  9. Eugenijus says:

    Hi, thank You for the great script.

    For some reasons it does not work on a real project, but does work on a test one. I think the problem is in the way you get information “to_room = i.ToRoom[phase]”. For some reasons i don’t have a room in the phase doors are created, but i do have a room in the next phase. Maybe due to this, the entire list get empty.

    Also, i don’t get the logics of assigning ‘left’ and ‘lhr’. According to the code, only ‘left’ can be assigned for every matching internal door and only can be ‘lhr’ is assigned for every matching external door.

    • Eugenijus,

      You might be correct about the Phase. I am not sure why I chose to use this method to obtain ToRoom property of a door, but there is another way to get that: just use i.ToRoom and not include the Phase and that will get the room in the latest phase of the project. I think I will incorporate that change when I get a chance because it makes for a more flexible solution where user doesn’t have to think about what Phases are the Rooms/Doors on. Thank you for the suggestion.

    • Oh I missed the second part of your question. Yes, you are correct, if the goal is to eliminate all of the Right and RightHandedReversed doors from the Project, then this tools serves as means of quickly identifying doors that violate the code. I didn’t intend this tool to be the enforcer of the code, but rather quickly allow you to visualize what handing all of your doors have. In case that any of the handing is incorrect, please feel free to change it, and then re-run the definition so that all parameters update. Again, this tool will not flip/reverse doors for you, it will rather tell you that you need to do it yourself.
      As far as assigning LHR and RHR goes, this is purely based on an assumption that you DO NOT have a room on the exterior of the building so exterior door when queried for a room it will return None. Now, in case that you are missing interior rooms as well, this tool will treat those interior doors as exterior because of missing room information.

  10. Erkki Karjalainen says:

    Hello
    I have the same problem to
    “Warning: Dereferencing a non-pointer”
    When you passed Dominiks problem, so could you explain the thinking behind what was wrong, or send me working code.
    T Erkki

  11. Jan says:

    Hi Konrad,

    it was working beautifully but after installing Revit update 7 it does not work anymore.
    The custom node ‘DoorSetNG’ is now turning red.

    I am sorry to bother you with this again, but how do you fix this?

    Thansk a lot,

    Jan

  12. Jan says:

    Hi Konrad,

    I just figured it out.
    It is not your node that broke but Eugenijus’s node.
    It still works with yours (incl. the phases).

  13. Mikhail says:

    Why does the Run button disappears, when i open your script in dynamo?

  14. Krzysztof says:

    hey,

    I’m new to dynamo and tried to use your “script” (I don’t know if it’s the proper way to call it) and get w yellow warning sign above every “Element.SetParameterByName” piece. It reads “Warning: No function called SetParameterByName on a _SingleFunctionObject that takes string,string could be found”. Would you be so kind as to help me with this?

    • Krzysztof, that warning usually means that you are feeding in a wrong type of data. Is the Parameter you are trying to write a string (text) parameter? Please check that it’s not a double or boolean, because passing a string to boolean will throw that error.

      • Krzysztof says:

        I am copying exactly what is shown in the image above, I also tried your updated version that includes phasing. Am I supposed to create some parameter in side my door family, or is Dynamo supposed to do it for me with some kind of Project parameter? I suppose it’s a noobie question, but I installed Dynamo a few days ago solely for the purpose of showing the “left”, “right” parameter in my doors and have no idea what I’m doing :)

  15. Chris says:

    Hello,
    I’m trying to use your Door Set Handing but the Element.SetParameterByName turns yellow and bounces a message: “Warning: Internal Error, please report. Dereferencing a non-pointer”. I know it worked a year ago. Any idea how to make it work?

  16. yesnox says:

    Hi and thanks for this great example.
    Concerning the phasing, all works perfectly until there is at least one “demolished” element in the file (“Phase Demolished” parameter different than “none”).
    Even with only one demolished element in the file there is no more output at all (see enclosed file), however the macro runs without warnings.
    Any suggestions?

    • I would recommend that you exclude all doors that were demolished. Please use a node called Phase.Demolished that you can find in archi-lab package and then just combine that with List.FilterByBool to exclude demolished doors.

  17. Karen says:

    Hello Konrad, thank you for this post and sharing the code. Is there any way for this definition to work with groups? I’ve got apartment layout groups in my projects and when I run the definition it can’t complete unless I ungroup. Thanks, Karen

    • Karen,

      Yes, there is a way to re-write that to make it operate on groups. You would basically just need to write a piece of code that tells it to edit the group or ungroup it, and then perform the operation and restore the group. It would have to be a custom piece of code, which I have not written yet. Please post this question to a Dynamo forum and I am sure someone will be keen to write it.

      • Karen says:

        Hello Konrad, thanks for your response. A colleague found that the definition works perfect if the shared parameter for Door Set Handing is changed by selecting ‘Values can vary by group instance’ in project parameter settings also.

  18. Joshua says:

    Hi Konrad,

    Thanks for putting this together and it’s great help! I have created the same definition in Dynamo and also added the shared parameter to the doors, however I only get “RHR” and “LHR” no matter how I flip the door, is there a step I have missed? Can you kindly help me a bit in that?

    Thanks in advance.

  19. Rana Ajaz says:

    I am using Revit 2017 and Dynamo 0.9.1.4062 (not an expert user)
    trying to use custom node Door set handing but got error as under

    Warning: Internal error, please report: Dereferencing a non-pointer. (3f47aacd)
    over element.setparameterbyname

    please reply soon
    regards

  20. Elisa says:

    Hi Konrad, thank you very much for sharing, I am trying to use your script but the attached error appears. Can you hepl me?
    Elisa

    Attachment:  doors.jpg

  21. Elisa says:

    Hi Konrad,

    Thanks for putting this together and it’s great help, ideed. I am new in Dynamo, and tried to run the script, but the attached warnind appears and the script does not give any data back. can you hepl me?

    Attachment:  doors-1.jpg

  22. Johanna says:

    Hi
    First time trying dynamo
    It is not working for me :(
    There is nothing comming out from the Door set handling code?
    Waring no function is called
    got the files from
    https://vasshaug.net/2015/04/23/door-handing-in-revit-with-dynamo-update/
    But I am using 2017

    Attachment:  Trying.png

    • I can see a few issues here. First and foremost the nodes that are red, indicate that they are mission. I think they are missing because you don’t have packages that they are from installed. Try going to Package Manager and installing Archi-lab and Steam Nodes perhaps. I am not entirely sure what package is the Tool.GetPhaseByName node from. Try googling around to find out.

  23. Johanna says:

    Hallo Sorry but dont really understand what you want me do to. went to https://dynamopackages.com/# but it only a vote site got “the nod” or “the code” from your Github and the other cod which was the same from Vasshaugs page. Checked it with what you written on you page. I am not a coder dont understand how you found out the definitions in Revit for the positioning is to_room and Faceflipped , Handflipped: But it dosen’t really matter just want it to work.

  24. Johanna says:

    Hi
    thanks I got it. In the Dynamo programs there is a tab called packeges. It is working great now thanks

  25. Pawel says:

    Dear All,
    It would be useful to add a check like try: except: to check if a door exists in the correct phase. I hade this error because one door was in a different phase. All doors could be filtered by a phase but this just saves a trouble I suppose.

  26. Marco Lucchesi says:

    Hi Konrad,
    Compliments for your work!
    I can’t display the node’s download about door set handing and I don’t know why.
    Also I’m working with 2018 version of revit and Dynamo 0.9.1. Is this node compatible with these versions?

    Thanks

  27. Tocosh Nankurunaisa says:

    Hello Konrad, thanks you for sharing your script.
    How can i do to show the information of the door set handing in a tag (like in your video), i tried with project, sharing and global parameters and the door tag don´t show that information; Schedules and Object properties inside Revit have not problem with that, when i create a door set project parameter, your script run nice for all the doors in the project, when i create a door set parameter inside the door family, your script run only for the doors that include the parameter inside in the family, but when i try to get the information in a tag (right, left), i can´t do that. can you please explain me, how do you that in your video.
    Thanks in advance.

  28. Tocosh Nankurunaisa says:

    Hi Konrad,
    I found the solution creating a shared parameters first and then using that in a project parameter. Everything is fine at the moment, my schedules and my tags.
    Now i need to discovery a way to get that your script read only the doors that i want to read, because i created my owns families for the project and in aluminium profiles, normaly with fixed glasses or sliding, i don´t need the opening information, but cause the parameter “Door Set” is a project parameter, the script run for all the doors in the project. i will try to combine a List.FilterByBool with something else to exclude aluminium doors, but i am new with Dynamo. Any idea? Thanks in advance.

    • That sounds like a fine idea. Please give it a try and report if you need any help. Please remember that I can’t see what you are doing. Be brief, but detailed and hopefully attach samples or images of things that you want me to comment on. Otherwise it’s not possible for me to do that.

  29. Cem Altineller says:

    Hi,
    Was googling something and encountered your page. Awesome solution, but have some questions,

    How does it work with fire strategy?
    Do you also assume that the door is set correctly when its placed in the first place? Flipping is done only once?

    • I am not sure I understand the question. Let’s assume I have no idea what fire strategy is. Can you try and explain this to me like I am a 5 year old. Images and examples will help tremendously.

  30. Simon says:

    Hi Konrad,

    This looks great. Usually we do this with a plugin developed by our supplier, but ran into problems in my current project because the plugin can only count doors7windows in main model and primary design options. How does this react to doors in other design options? Also, what does the reversed outputs mean?

  31. Filippo Costantin says:

    Hi Konrad,

    I’m using your Dynamo package, but it’s not working. The “Door set handing” package provides two functions and these are not read by “Element set parameter by name”. I have attached a screen from my script.

    Thank you very much,

    Your work is great!

    FIlippo

    Attachment:  Door-handing.png

  32. Chris Mroz says:

    This is an amazing example of what Dynamo can do – Thanks for sharing! I’m trying to think of a way to make it more accurate. Technically a door is RHR or LHR when it is opened towards the secured space. This could be an office or other interior room. Currently this isn’t how the script works. I was thinking about creating an instance parameter indicating a “reverse swing” door and filtering things, but that’s a bit more manual than I would like. Any idea of a better way to do this?

    • You can get a ToRoom() property from a Door, and use that to determine if the room is “secured”. I am not sure what determines if the room is secured, but I am sure you can sort it out.

  33. to anyone with the “Warning: Dereferencing a non-pointer” problem – I think there’s some kind of struggle with phase naming. If the phase doesn’t matter to you, you can edit the python script removing reference to the phase, and it should work OK.

    Caveat: I’m no dynamo expert! but it worked for me :)

    Attachment:  Capture.png

    • Yes, so you can remove the phase reference in the code, but bear in mind that it doesn’t actually stop Revit from using a Phase when getting that Room. What it does, it make it grab the room from a currently active phase by default. Just FYI.

    • Jarno says:

      Removed all phases from my project, and deleted the reference in the script, but im still getting this error :(.

      very wierd since if i open a new file, and place some doors in it, it works fine..

      • Jarno says:

        Well fixed it, by adding this instead of the all category instances.
        Think it also selected instances witch had locked parameters, so i could not change them.

        Attachment:  Knipsel.jpg

  34. Tobias Sheehan says:

    Dear Konrad,

    Hopefully you are able to spare some time for me. I tested your node in a workshared project but the door handing node does not seem to produce any results. I have ot it working if I test it in a new non workshared project but for some reasong it doesn’t work in the workshared file.
    I have attached a screenshot of the completed run of the script.

    • It probably has nothing to do with the file being workshared or not. I will guess it has to do with Curtain Wall Doors or Doors embedded into Curtain Wall Panels. We will need a sample file (Revit), and the Script (Dynamo) to even consider checking it out.

Leave a Comment