edit Ordinate dimension

edit Ordinate dimension

Anonymous
Not applicable
629 Views
2 Replies
Message 1 of 3

edit Ordinate dimension

Anonymous
Not applicable

Hi everybody!

 

i am writing a macro that adds a tollerance and a few things to the selected ordinate dimension. the macro itself works, but not as i would like it to..

 

the problem is that whatever number of the ordinate dimension i select, it allways adds the tollerance to the very first value of the ordinate dimension, wich is the 0...

 

i would like it to do one of these two things (first one is better)

 

1) add the tollerance to the actual dimension the mouse is clicking on,

2) add the tollerance to the LAST (instead of first) dimension.

 

so basically at the moment if i have a ordinate dimension set with the values " 0 ------- 30 ---------------------100" the result is

" 0 +0,05 -------------30 -------------------------100"

i would like it to be

"0--------------------30-----------------------------100 +0,05"

 

it could be by clicking on the "100" value and executing the macro, or automatically by selecting the whole ordinate dimension...

 

thank you

 

best regards

 

alcom

 

[code]

 

Public Sub tolleranz()

        Dim oDrawDoc As DrawingDocument
        Set oDrawDoc = ThisApplication.ActiveDocument

        Dim oDrawingDims() As DrawingDimension
        Dim a As Integer
        a = 0
       
        Dim i As Long
        For i = 1 To oDrawDoc.SelectSet.Count
        If Not oDrawDoc.SelectSet.Item(i) Is Nothing Then
        If TypeOf oDrawDoc.SelectSet.Item(i) Is OrdinateDimension Then
        a = a + 1
        ReDim Preserve oDrawingDims(0 To a)
        Set oDrawingDims(a) = oDrawDoc.SelectSet.Item(i)
        End If
        End If
        Next

       
       
        Dim n As Integer
        For n = 1 To a
        oDrawingDims(n).Tolerance.SetToSymmetric ("0,05")
        oDrawingDims(n).IsInspectionDimension = True
        oDrawingDims(n).SetInspectionDimensionData kRoundedEndsInspectionBorder, "", "100%"

        Next
End Sub

 

[/code]

0 Likes
630 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

already solved! here is teh code for who might need it!

 

 

-------------------------------------------------

 

 

Public Sub tolleranz()

        Dim oDrawDoc As DrawingDocument
        Set oDrawDoc = ThisApplication.ActiveDocument

        Dim oDrawingDims() As DrawingDimension
        Dim oDrawingDims2() As OrdinateDimension
        Dim a As Integer
        Dim b As Integer
        Dim c As Integer
        a = 0
        b = 0
       
        Dim i As Long
        For i = 1 To oDrawDoc.SelectSet.Count
       
        If Not oDrawDoc.SelectSet.Item(i) Is Nothing Then
     
       
                     'normale bemaßung
                     If TypeOf oDrawDoc.SelectSet.Item(i) Is GeneralDimension Then
                     'Only add Dimensions to the ObjectCollection
                     a = a + 1
                     ReDim Preserve oDrawingDims(0 To a)
                     Set oDrawingDims(a) = oDrawDoc.SelectSet.Item(i)
                     End If
                    
                   
                     'koordinatenbemaßung
                     If TypeOf oDrawDoc.SelectSet.Item(i) Is OrdinateDimension Then
                     'Only add Dimensions to the ObjectCollection
                     b = b + 1
                     ReDim Preserve oDrawingDims2(0 To b)
                     Set oDrawingDims2(b) = oDrawDoc.SelectSet.Item(i)
                     End If
                   
       
       
        End If
        Next

       
       
        Dim n As Integer
        For n = 1 To a
        MsgBox (n)
        oDrawingDims(n).Tolerance.SetToSymmetric ("0,01")
        oDrawingDims(n).IsInspectionDimension = True
        oDrawingDims(n).SetInspectionDimensionData kRoundedEndsInspectionBorder, "                           ", "100%"
        Next
       
       
        For n = 1 To b
        c = oDrawingDims2(n).OrdinateDimensionSet.Members.Count
        oDrawingDims2(n).OrdinateDimensionSet.Members.Item(c).Tolerance.SetToSymmetric ("0,01")
        oDrawingDims2(n).OrdinateDimensionSet.Members.Item(c).IsInspectionDimension = True
        oDrawingDims2(n).OrdinateDimensionSet.Members.Item(c).SetInspectionDimensionData kRoundedEndsInspectionBorder, "                           ", "100%"
       
        Next
End Sub
 
       
      
       

 

 

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

hmmm sorry, still not working as expected!

 

it does not allways put the tollerance on the very last measure.. sometimes its just somewhere in the middle.. (see image..)

0 Likes