Get Hole Notes From IDW

Get Hole Notes From IDW

Boleivia
Contributor Contributor
685 Views
3 Replies
Message 1 of 4

Get Hole Notes From IDW

Boleivia
Contributor
Contributor

I am working on some VB code to reterive the dimensions fron an IDW and put  them on an excel spreadsheet for an Inspection report. I found some code to which gets the linear dimensions and have added tolerance type and tolerance bands. All this works good.

I have been unable to get the hole notes off the IDW. Got the general notes to work with the following Code:

   

Dim invDrawNotes As Inventor.DrawingNotes
    Dim invActDrawNotes As Inventor.DrawingNote
    Set invDrawNotes = invActSHT.DrawingNotes
        For Each invActDrawNotes In invDrawNotes
          Debug.Print invActDrawNotes.Text
          exCells(intIndex, 3) = invActDrawNotes.Text
          exCells(intIndex, 5) = "Note"
          exCells(intIndex, 6).Value = strSheetName
          intIndex = intIndex + 1
        Next

 

Im trying this code to get the Hole Notes. The code finds the holes and lists their properties but what I'm after is the hole note text which i can seem to get at. Are the hole notes text exposed  and which object should I be looking at?

 

'Get Threaded Holess
    Dim invHoleThreadNotes As Inventor.HoleThreadNotes
    Dim invActHoleThreadNotes As Inventor.HoleThreadNote
    Set invHoleThreadNotes = invActSHT.DrawingNotes.HoleThreadNotes
        For Each invActHoleThreadNotes In invHoleThreadNotes
          Debug.Print invActHoleThreadNotes.FormattedHoleThreadNote, "Found Hole"
          Debug.Print invActHoleThreadNotes.Hole
          intIndex = intIndex + 1
        Next

 

Any Help would be appericated.

Thanks

Scott

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

alewer
Advocate
Advocate
Accepted solution

I believe that the HoleThreadNote.Text.Text property will work. Try replacing your For/Next loop with this:

 

  Dim oHoleNote As Inventor.HoleThreadNote
  For Each oHoleNote In invActSHT.DrawingNotes.HoleThreadNotes
    Debug.Print oHoleNote.Text.Text
  Next

Let me know if it works or if you have any more questions. Good luck!

0 Likes
Message 3 of 4

Boleivia
Contributor
Contributor

Works perfect thanks for your help. I guess I need to do some reading on navigating object models, any suggestions

Thanks again

0 Likes
Message 4 of 4

alewer
Advocate
Advocate

To get the object model: If you haven't already installed the developer tools, I suggest that you do (directions here).

 

Perhaps more importantly, learn to use break points and watches in VBA. This blog post describes one technique. To answer your question, I added a watch on the sheet object and stepped through the macro. Using the watch, I found the Text.Text property in seconds.

0 Likes