Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
MjDeck
in reply to: Charlies_3D_T

Hi @Charlies_3D_T , here's a version of your rule that will arrange only horizontal and vertical dimensions.
I'm not sure what you mean by "center an ordinate set". Can you provide some screenshots? Before and after would be helpful.
This rule will arrange ordinate dimensions that are not in a set.

 

Option Explicit On

Sub Main
	Dim oDoc As DrawingDocument
	oDoc = ThisDoc.Document

	' Set a reference to the active sheet
	Dim oSheet As Sheet
	oSheet = oDoc.ActiveSheet

	Dim oDrawingDim As DrawingDimension
	Dim oDimsToBeArranged As ObjectCollection
	'Dim oOrdinateDimsToBeArranged As ObjectCollection

	' Iterate over all dimensions in the drawing and
	' center them if they are linear or angular.
	' Add them to the ObjectCollection to be arranged

	Dim oDrawingDimensions = oSheet.DrawingDimensions

	oDimsToBeArranged = ThisApplication.TransientObjects.CreateObjectCollection

	For Each oDrawingDim In oDrawingDimensions
		If TypeOf oDrawingDim Is LinearGeneralDimension Then
			oDrawingDim.CenterText
			Dim oLinDim As LinearGeneralDimension = oDrawingDim
			If oLinDim.DimensionType = DimensionTypeEnum.kHorizontalDimensionType Or oLinDim.DimensionType = DimensionTypeEnum.kVerticalDimensionType Then
				If Not (oLinDim.IsBaselineSetMember Or oLinDim.IsChainSetMember) Then
					oDimsToBeArranged.Add(oDrawingDim)
				End If
			End If
		ElseIf TypeOf oDrawingDim Is OrdinateDimension Then
			Dim ordDim As OrdinateDimension = oDrawingDim
			If Not ordDim.IsOrdinateSetMember Then
				oDimsToBeArranged.Add(oDrawingDim)
			End If
		End If
	Next

	If oDimsToBeArranged.Count > 0 Then
		oDrawingDimensions.Arrange(oDimsToBeArranged)
	End If
End Sub 

 


Mike Deck
Software Developer
Autodesk, Inc.