Dimension Check

Hi all,

Can you please help with the script attached?
I am trying to build a UK brick dimension check basically.
Approaching this one step at the time. And trying to see if I can check the dimension value and edit it in someone, like add text above or overwrite it. So far works fine, problem arrays dealing with dimension segments.
I dont want to delete the segments and dimension everything with individual dimensions.

Is there a way to convert a dimension segment into a dimension without actually do it in in revit?

Thank you