If you have not caught up with Dimension Styles yet, and are still placing dimensions using just the active settings (Style: None), then you may have faced the challenge of having to propagate a change to all dimensions. Dimension styles make it really easy to do this, and we encourage you to use them. In this blog, I will explain how to do this programmatically in MicroStation VBA.
Say you have several dimensions in a sheet and you want to change all of them to use a text frame. You just have to write a few lines of simple code.
Here’s what the code is doing:
Sub ChangeDimensionTextFrame() Dim oDimStyle As DimensionStyle Dim oDim As DimensionElement ' Scan all graphical elements of the active model Set ee = ActiveModelReference.GraphicalElementCache.Scan Do While ee.MoveNext If ee.Current.IsDimensionElement Then Set oDim = ee.Current ' Get the dimension element's style object Set oDimStyle = oDim.DimensionStyle ' Change the setting in style oDimStyle.TextFrameType = MsdDimTextFrameTypeBox ' Set the dimension element's style object oDim.DimensionStyle = oDimStyle oDim.Rewrite oDim.Redraw
End If Loop End Sub
More blogs coming up, so be there...
Tahnks for share this.I´m starting not only to learn about mbva but also implement it my daily Workflow.
So your posts are usefully and easy to read.¡¡ I really appreciate it.Thanks again,
How would one use this code to change dimension font?