Over the long holiday weekend, an interesting discussion came up over on Twitter.
Okay, last @DynamoBIM piece i am missing. Put two objects a distance of 10'-0 7/16" apart. Dimension them, and set the dim style to round to 1/8", so you see 10'-0 1/2". How do you get the 10'-0 1/2" in Dynamo? It always shows the 7/16", which is correct, but not what i need.— Aaron Maller (@Twiceroadsfool) August 31, 2018
Aaron has some serious model audit graphs and one of the next steps is to compare a dimension’s displayed string value to what it could (or should) be if it were not rounded.
Well, thankfully the Revit API has a method that seems to work for this. This is the ability to obtain the “ValueString” from the dimension.
This method has actually been exposed in Rhythm for quite some time now.
Earlier I said that is seems to work. That is because this method always returns the dimension’s string value per the project setting. 😒 (in the case of our example our project is 1/256” and the dimension type for this is 1/8”)
The string value obtained via Revit Lookup.
After investigating this a bit through the Revit Lookup tool from the building coder , I decided to test out what would happen if we modify the project settings to match the dimension type, then retrieve the value string.
The dimension string value being reported as what we see!
Seeing that this worked, I was very excited. We now have the logic involved that we need to roll into a solution. Here are the steps that we need to reproduce in code.
- Get dimension’s formatting given a selection.
- Use that formatting to modify our project settings.
- Retrieve the value string from the dimension.
- Change the project units back to what they were.
Luckily, we are able to replicate this using a process called Transaction Rollback. Essentially we make the changes, get the data we want and undo those changes.
Now that we have that all mapped out there will be a new node in the next release of Rhythm to do this for you. Here is a GIF of it in action.
I hope this node helps people out with their model auditing tasks! (look for the next release soon)