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:



  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

    Greetings, Hans Hendriks.

    • Konrad says:


      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:

    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:

    Would you be so kind to contact me in reference to the door set. Looking for some assistance on getting started.
    Chris Warden

    • 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,

      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

    best regards

  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

  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:

    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,


  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:


    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:

    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 (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

  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?

    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:

    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
    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 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:

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

Leave a Comment