Hello everyone,
You know right which is the best of the motivations for me to write a new post aren't you??
Sure, is your feedback!! This post comes very close to a previous one where we introduced a method on how to Create finish walls per Room, exactly because one of you asked:
"Is there any way not to convert the units before putting the values in the node? "
I think the question was very legit, at the end of the day, the majority of the people that look at a Dynamo solution, they do because want to save time and avoid tedious work...
For the sake of the old post, I've been happy to go that way so you all know that Revit works internally in feet. But now, I roll up my sleeves, change the script in the node, and explain to you
how to convert units with python in Revit 2022
It's been a while that this topic is very discussed around the internet, that's because Autodesk announced some years ago a change in the #RevitAPI that would have introduced a new class
Among different use, one of them would have been the replacement of the DisplayUnitType, an enumeration to which we were always referencing to define the units.
For a good time (till Revit V2021), Autodesk gave the possibility to work with both of them and in general, was more convenient to stick with the old method to grant compatibility with older versions of Revit.
But now we can no more, the DisplayUnitType Enumeration disappeared from the #RevitAPI and we need to move on!
So, inspired by the sentence
from Revit V22 onward, you need to use ForgeTypeId
we decided to write these couple of python functions that, prior to the recognization of the program version you're running, decide if to go for the old-fashioned or the new way of converting units. Here is the code:
As you can see, I also add to the end of the code-snip a little description of how it will act.
This one was a very technical post and if you arrived reading until this line, well, congrats bro, I know you like to code as well!
That means knowing the BRO CODE!!
After this quote, I finish the post with a giant smile,
Cheers!!
Commenti