Looking at the image again, I have some questions.
You have a second overall Dimension on the right end of the bottom right figure, but no other overalls along sides with more than one Dimension. I assume that's because there's no single edge on either end of the figure to Dimension that overall height along. It would be a serious challenge to figure out how to instruct a routine to determine that. Is the overall Dimension something you would want the routine to draw, rather than putting it in yourself where needed?
Many of your strings of multiple Dimensions along the same side are continuous, but some are stepped. Is that a matter of how crowded the text is between the extension lines on the ones that are stepped? Again, telling a routine how to figure that out, and what to do about it, would be difficult.
Would you ever have a concave situation such as this?

How should that be handled?
Not really a routine's problem, but a question of how you draw and how you define your Dimension Style: I notice that the Polylines are not drawn with precision and the Dimensions are rounded, because [upper-right figure] 377 + 99 does not equal 475.
Kent Cooper, AIA