Value of overridden dimensions

BCampbellNWL
Contributor
Contributor

Value of overridden dimensions

BCampbellNWL
Contributor
Contributor

Im using C# to create some tools, and I was wondering, is it possible to get the value of the "Replace With Text" on dimensions? the idea is to make a tool to identify overridden dimensions to help identify problems in the model. 

 

BCampbellNWL_0-1667845260438.png

Thanks!

-Ben

 

0 Likes
Reply
Accepted solutions (1)
524 Views
4 Replies
Replies (4)

architect.bim
Collaborator
Collaborator

Hi, Benjamin!

Sure you can. Collect the Dimension object. Get its ValueOverride property value if you dimension is single-segment. For multi-segment dimension first get its Segments and use the corresponding property of the DimensionSegment class.


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes

BCampbellNWL
Contributor
Contributor

Hey Maxim! Ive grabbed all the dimensions from the current view using the FilteredElementCollector, but I cant seem to be able to grab ValueOverride as a parameter for those elements. Do you know how I would apply it to my elements in a Foreach loop?

0 Likes

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @BCampbellNWL ,

 

Does this help?

FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Dimensions).WhereElementIsNotElementType();
foreach(Element e in collector)
  {
   if(e is Dimension)
     {
       Dimension dimension = e as Dimension;
       string dimensionTextValue = dimension.ValueOverride;//Get Text Value
       dimension.ValueOverride = "Your Text Value";//Set Text Value
     }
  }

Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

BCampbellNWL
Contributor
Contributor

That worked perfectly! Thank you!

0 Likes