I am wondering if anyone knows a way to pull a dimension style’s ‘Precision’ Settings? I am created a QA family to check the precision of our dimension styles against an ‘acceptable’ list. Some of our users have been rounding dimensions…
I can get the dim styles to check against project settings but the project settings are often changing on individual dim styles. I cant find a way to pull this information, Im hoping someone has a way!
That too is on my to-do list. I believe it’s been done but I don’t know yet how they did it.
There is a BuiltInParameter Enumeration for DIM_STYLE_LINEAR_UNITS on RevitAPIDocs that looks promising but I’m still new to the API so not sure yet how to utilize it.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import FilteredElementCollector, DimensionType, BuiltInParameter
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
dim_styles = FilteredElementCollector(doc)\
.OfClass(DimensionType)\
.ToElements()
bip = BuiltInParameter.DIM_STYLE_LINEAR_UNITS
is_default = []
for dim in dim_styles:
format_ops = dim.GetUnitsFormatOptions()
if format_ops.UseDefault:
is_default.append(True)
else:
is_default.append(False)
OUT = zip(dim_styles, is_default)
This gets all dimension styles (DimensionType objects) in the current document and returns the DimensionType and whether or not is uses default formatting (boolean).
Rethinking what I want to do here (which is probably different from the OP).
Instead of determining which styles are different from the project settings, what I really want to know is which displayed dimension strings are different from the actual dimensional values.
Luckily, @john_pierson has us hooked up in Rhythm for exactly this sort of thing! Thanks John!
I’m using Dimensions.DisplayValueString and comparing it to Dimensions.ValueString which works great until the units of the dimension are set to something other than feet/inch. If, for example, the dimension style is set to display inches my comparison comes back as false (not equal) even though it’s technically the same dimension (e.g., 4’-0" vs 48").
Any thoughts on that?
Right now I’m planning on parsing out the numerical value of the dimension from Dimensions.ValueString so I can compare that to the Dimension.Value output.
Thanks for the reply guys! actually what you are describing is basically what I am trying to do! Im not trying to compare it to project settings but, as you say, compare shown values vs. actual values to make sure precision is correct/not rounded.
I am not familiar with Humanizer either, I will have to look at that.