I think I may have a good starting point for you here. This iLogic code starts off by building a series of List objects. The first List is to hold all the different DrawingTypeEnum variations that aren't linear, so we can use this weed them out later. Since there were 6 non-linear types and 7 linear types, it was almost a toss-up as to which way to filter them. The next 3 List objects are to hold the dimensions, according to their orientation, as we filter through them. One for Horizontal dims, one or Vertical dims, and one for (other) dims that are neither Horizontal nor Vertical (most likely aligned). Then I start to loop through each sheet, then each DrawingDimension on each sheet. The first check in the filter system checking to see if this is any of the non-linear types. Then I check for the two simplest types Horizontal and Vertical. Then I start checking the orientation of their DimensionLine geometry. Then any that don't match any of these filters, get added to the last List (oODims). After all the loops and checks are done, you should have 3 filtered lists to work with. Now you can loop through each list applying your Style and/or any arrangement/alignment methods to them.
Here's the code:
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOKOnly, "WRONG DOCUMENT TYPE")
Return
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
'Build list of all non-linear DimensionTypeEnum variants to check against
Dim oNLTypes As New List(Of DimensionTypeEnum)
oNLTypes.Add(DimensionTypeEnum.kAngularDimensionType)
oNLTypes.Add(DimensionTypeEnum.kAngularForeshortenedDimensionType)
oNLTypes.Add(DimensionTypeEnum.kArcLengthDimensionType)
oNLTypes.Add(DimensionTypeEnum.kArcLengthForeshortenedDimensionType)
oNLTypes.Add(DimensionTypeEnum.kDiametricDimensionType)
oNLTypes.Add(DimensionTypeEnum.kParallelDiametricDimensionType)
'Build a list to hold all the Horizontally oriented dims
Dim oHDims As New List(Of DrawingDimension)
'Build a list to hold all the Vertically oriented dims
Dim oVDims As New List(Of DrawingDimension)
'Build a list to hold all the other Aligned (neither Horizontal nor Vertical) dims
Dim oODims As New List(Of DrawingDimension)
Dim oNonLinear As Boolean
For Each oSheet As Inventor.Sheet In oDDoc.Sheets
For Each oDDim As DrawingDimension In oSheet.DrawingDimensions
oNonLinear = False
For Each oDType As DimensionTypeEnum In oNLTypes
If oDDim.DimensionType = oDType Then oNonLinear = True
Next
If oNonLinear = False Then
If oDDim.DimensionType = DimensionTypeEnum.kHorizontalDimensionType Then
oHDims.Add(oDDim)
ElseIf oDDim.DimensionType = DimensionTypeEnum.kVerticalDimensionType Then
oVDims.Add(oDDim)
ElseIf TypeOf oDDim.DimensionLine Is LineSegment2d Then
Dim oLS2d As LineSegment2d = oDDim.DimensionLine
If oLS2d.Direction.X = 1 Or _
oLS2d.Direction.X = -1 Then
'It's Horizontal, so add it to our oHDims list
oHDims.Add(oDDim)
ElseIf oLS2d.Direction.Y = 1 Or _
oLS2d.Direction.Y = -1 Then
'It's Vertical, so add it to our oVDims list
oVDims.Add(oDDim)
End If
Else
'It's neither Horizontal or Vertical, so it must be at an angle
oODims.Add(oDDim)
End If
End If
Next
Next
'Now you can start iterating through each List and applying which ever Styles to them
'and do whatever alignment you want with them.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.
Wesley Crihfield

(Not an Autodesk Employee)