Centralize Dimension Text

Centralize Dimension Text

cad
Advocate Advocate
421 Views
2 Replies
Message 1 of 3

Centralize Dimension Text

cad
Advocate
Advocate

Hi

 

I am at the first stage of iLogic.

Just Making some simple Conditional or Mathematical codes.

 

I got a code below to Centralize the Dimension text.

That works perfectly on the Active sheet.

 

Can I use something similar that works for All the sheets of Current Document. ?

 

 

    ' Set a reference to the active drawing document
    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

    ' Iterate over all dimensions in the drawing and
    ' center them if they are linear or angular.

    For Each oDrawingDim In oSheet.DrawingDimensions
        If TypeOf oDrawingDim Is LinearGeneralDimension Or _
           TypeOf oDrawingDim Is AngularGeneralDimension Then
             oDrawingDim.CenterText
        End If
    Next


 

Thanks.

0 Likes
Accepted solutions (1)
422 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

Yes you can use it in all sheet with following code

 

 ' Set a reference to the active drawing document
    
Dim odoc As Document
odoc = ThisApplication.ActiveDocument ' Set a reference to the active sheet Dim oSheet As Sheet For Each oSheet in oDoc.Sheets Dim oDrawingDim As DrawingDimension ' Iterate over all dimensions in the drawing and ' center them if they are linear or angular. For Each oDrawingDim In oSheet.DrawingDimensions If TypeOf oDrawingDim Is LinearGeneralDimension Or _ TypeOf oDrawingDim Is AngularGeneralDimension Then oDrawingDim.CenterText End If Next
Next
Message 3 of 3

cad
Advocate
Advocate

Perfect !!!

 

Many thanks.

0 Likes