Get Tolerance for HoleThreadNote

Hillebrand
Participant

Get Tolerance for HoleThreadNote

Hillebrand
Participant
Participant

I need some help.

I want to collect all tolerances used in a drawing view.

Collecting the drawing tolerances for DrawingDimensions works fine. But it is a problem to get the tolerances defined for  holefeatures in parts model.

Unbenannt.JPG

 

 
   HoleThreadNote first = sheet.DrawingNotes.HoleThreadNotes.Cast<HoleThreadNote> ().First ();
   
   string a = first.Text.Text;
   // a = "n3,00 H7 DURCH"  
   string holTol = first.Tolerance.HoleTolerance;
   // holTol = "";
   string shaftTol = first.Tolerance.ShaftTolerance;
   // shaftTol = "";
 
Is there another method to get the "model" tolerances? Only possible by parsing the text string?
Thank you!
 
Regards
Petra
0 Likes
Reply
Accepted solutions (2)
544 Views
2 Replies
Replies (2)

HideoYamada
Advisor
Advisor
Accepted solution

Hi,

 

This code get Tolerance object that is corresponding to HoleThreadNote.

 

Sub test()
    Dim oSheet As Sheet
    Set oSheet = ThisApplication.ActiveDocument.ActiveSheet
    Dim oHoleThreadNote As HoleThreadNote
    Set oHoleThreadNote = oSheet.DrawingNotes.HoleThreadNotes(1)
    
    Dim oFace As Face
    For Each oFace In oHoleThreadNote.Intent.Geometry.ModelGeometry.Faces
        If TypeOf oFace.CreatedByFeature Is HoleFeature Then
            Dim oHoleFeature As HoleFeature
            Set oHoleFeature = oFace.CreatedByFeature
            Dim oTolerance As Tolerance
            Set oTolerance = oHoleFeature.HoleDiameter.Tolerance
            Debug.Print oTolerance.HoleTolerance
            Exit For
        End If
    Next oFace
    
End Sub

oHoleThreadNote.Intent.Geometry.ModelGeometry is pointing the edge in the part model.

 

=====

Freeradical

 Hideo Yamada

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp

Hillebrand
Participant
Participant
Accepted solution

Works perfect!

Thank you so much!

0 Likes