Hole Style - find settings in saved drawings

Hole Style - find settings in saved drawings

andrew_canfield
Collaborator Collaborator
469 Views
2 Replies
Message 1 of 3

Hole Style - find settings in saved drawings

andrew_canfield
Collaborator
Collaborator

A tapped hole note was using this as a hole & note thread:

 

 

 

IN <QTYNOTE> PLACES
DRILL<HDIA> X <HDPT> DEEP
& TAP <THRP> X <THRD> DEEP

 

 

 

But it has now been modified to this:

 

IN <QTYNOTE> PLACES
DRILL <TDDIA> X <HDPT> DEEP
& TAP <THRP> X <THRD> DEEP

 

 

How do I create code to search for the old hole note style?

 

I wish I could write code, I read up on it but where do you start?

 

VBA editor (this is going to be a one off - I hope)

 

New module? ( in the ApplicationProject? idk)

 

Find where the drawings are saved.

Look inside each .idw file for code which equals :

 

IN <QTYNOTE> PLACES
DRILL<HDIA> X <HDPT> DEEP
& TAP <THRP> X <THRD> DEEP

 

print a list of those files?

 

How do I do that?

 

I need to read up on what these mean.. I've seen descriptions would like to see video, vbae.JPG

 

Thanks for your interest

 

 

 

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

dgreatice
Collaborator
Collaborator

Hi,

 

Try this :

1. Select on Application Project

2. Select Module1

3. At Properties - Module1, rename to HoleNoteFormat

4. Then in this module you copy this code:

 

Public Sub ChangeFormatHoleNote()
    Dim oDwgDoc As DrawingDocument
    Set oDwgDoc = ThisApplication.ActiveDocument
   
    Dim oSht As Sheet
    Set oSht = oDwgDoc.ActiveSheet
   
    Dim oDwgView As DrawingView
   
    Dim oDwgNote As DrawingNotes
   
    Dim oHoleThreadNote As HoleThreadNote
   
    Dim OldThreadNoteFormat As String
    OldThreadNoteFormat = "IN <QuantityNote/> PLACES<Br/>DRILL <HoleProperty HolePropertyID='kHoleDiameterHoleProperty' Precision='2' AlternatePrecision='2' UpperTolerance='0.000000' LowerTolerance='0.000000' ToleranceType='kSymmetricTolerance' TolerancePrecision='2' ToleranceAlternatePrecision='2'></HoleProperty> x <HoleProperty HolePropertyID='kHoleDepthHoleProperty' Precision='2' AlternatePrecision='2' UpperTolerance='0.000000' LowerTolerance='0.000000' ToleranceType='kSymmetricTolerance' TolerancePrecision='2' ToleranceAlternatePrecision='2'></HoleProperty> DEEP<Br/>&amp; TAP <HoleProperty HolePropertyID='kThreadDesignationHoleProperty'></HoleProperty> x <HoleProperty HolePropertyID='kThreadDepthHoleProperty' Precision='2' AlternatePrecision='2' UpperTolerance='0.000000' LowerTolerance='0.000000' ToleranceType='kSymmetricTolerance' TolerancePrecision='2' ToleranceAlternatePrecision='2'></HoleProperty> DEEP"
   
    Dim NewThreadNoteFormat As String
    NewThreadNoteFormat = "IN <QuantityNote/> PLACES<Br/>DRILL <HoleProperty HolePropertyID='kTapDrillDiameterHoleProperty' ></HoleProperty> x <HoleProperty HolePropertyID='kHoleDepthHoleProperty' ></HoleProperty> DEEP<Br/>&amp; TAP <HoleProperty HolePropertyID='kThreadDesignationHoleProperty'></HoleProperty> x <HoleProperty HolePropertyID='kThreadDepthHoleProperty' ></HoleProperty> DEEP"

For Each oDwgView in oSht.DrawingViews

Set oDwgNote = oSht.DrawingNotes
    For Each oHoleThreadNote In oDwgNote.HoleThreadNotes
        If oHoleThreadNote.FormattedHoleThreadNote = OldThreadNoteFormat Then
            oHoleThreadNote.FormattedHoleThreadNote = NewThreadNoteFormat
        End If
        oHoleThreadNote.QuantityDefinition = kNumberOfLikeHolesNormalToView 'or replace with kNumberOfHolesInFeature
        'OldQuantityFormat = oHoleThreadNote.FormattedHoleThreadNote
        'key = InputBox("TEST", "TEST", OldQuantityFormat)
    Next

next
End Sub

 

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 3 of 3

andrew_canfield
Collaborator
Collaborator

Many Thanks 🙂

 

I've tested it on a drawing with the old style & a macro box pops up.

 

vba1.JPG

 

Run on a drawing without the old style & no marco box

 

 

 

vba2.JPG

 

 

Hopefully I've understood the instructions.

 

Can drawings saved on the hard drive be searched without being opened? 

0 Likes