Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: Change dimension with VBA, kind of working

$
0
0
Is this better Jan?

Sub DIMchaacc() Dim startPoint As Point3d Dim point As Point3d, point2 As Point3d Dim lngTemp As Long Dim oDimensions As ElementEnumerator Dim oDimension As DimensionElement Dim oDimstyle As DimensionStyle Dim oValue As String Dim oRound As String Dim O As Integer If ActiveModelReference.AnyElementsSelected Then Set oDimensions = ActiveModelReference.GetSelectedElements Do While oDimensions.MoveNext Set oDimension = oDimensions.Current For i = 1 To oDimension.SegmentsCount Set oDimstyle = oDimension.DimensionStyle oValue = oDimension.ActualValue(i) If oDimstyle.PrimaryMasterUnitLabel = "mm" Then oValue = oValue * 1000 End If oValue = Round(oValue, 3) oRound = Mid(oValue, InStr(oValue, ".") + 1) O = Len(oRound) If O = 0 Then oDimstyle.PrimaryAccuracy = msdDimAccuracy0 Else If O = 1 Then oDimstyle.PrimaryAccuracy = msdDimAccuracy1 Else If O = 2 Then oDimstyle.PrimaryAccuracy = msdDimAccuracy2 Else If O = 3 Then oDimstyle.PrimaryAccuracy = msdDimAccuracy3 End If End If End If End If oDimension.DimensionStyle = oDimstyle oDimension.Rewrite oDimension.Redraw Next i Loop End If End Sub

Only have 2 dimension styles at my current work place, one for mm and another for meters.

regards,

Josh

Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>