Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hole /Thread notes edits

3 REPLIES 3
Reply
Message 1 of 4
eric.mathews
1052 Views, 3 Replies

Hole /Thread notes edits

How can I go about editing the text for a holethread note? I want to proceed the default text w/ the quantity note.

 

E.g.: 7/8 THRU

What I want: ?X 7/8 THRU

 

Any suggestions?

3 REPLIES 3
Message 2 of 4

HoleThreadNote object supports two properties that could be useful:

FormattedHoleThreadNote – that gets and sets the fully formatted string that defines the contents of the dimension or note text.

FormattedQuantityNote – that gets and sets the fully formatted string that defines the contents of the dimension or note text.

Here is a sample:

Private Sub EditHoleThreadNote()
  Dim oDoc As DrawingDocument
  Set oDoc = ThisApplication.ActiveDocument
  Dim oSheet As Sheet
  Set oSheet = oDoc.ActiveSheet
 
  Dim oHoleThreadNotes As HoleThreadNotes
  Set oHoleThreadNotes = oSheet.DrawingNotes.HoleThreadNotes
 
  Dim oNote As HoleThreadNote
  Set oNote = oHoleThreadNotes.Item(1)
  Debug.Print oNote.FormattedHoleThreadNote
  Debug.Print oNote.FormattedQuantityNote
  'make changes
  oNote.FormattedQuantityNote = "<Quantity/> AAA"
End Sub

cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 4

Vladimir,

Thank you for the reply, I must be doing something wrong. I tried your "EditHoleThreadNote" method and it yields no results. I tried inserting the "FormattedQuantityNote" at the front of the "FormattedHoleThreadNote" property and this blows up the entire note. The following is my code.

Public Overloads Sub AddThreadNote(ByVal _intent As GeometryIntent, ByVal _textLocation As Point2d)
                ' Create the hole/thread note.
                Dim _threadNote As HoleThreadNote
                _threadNote = Drawing.ActiveSheet.DrawingNotes.HoleThreadNotes.Add(_textLocation, _intent)
                _threadNote.QuantityDefinition = HoleNoteQuantityEnum.kNumberOfLikeHolesNormalToView
                ' I must reset the text origin because the initial location is (0,0) on the sheet.
                _threadNote.Text.Origin = _textLocation
            End Sub

 

If I'm doing something wrong, I can sure change.

 

Message 4 of 4

Here is very simple VBA code that adds new thread note.

This sample works with the first selected hole in the drawing document.

 

Private Sub AddHoleThreadNote()

  Dim oTG As TransientGeometry
  Set oTG = ThisApplication.TransientGeometry
  
  Dim oDoc As DrawingDocument
  Set oDoc = ThisApplication.ActiveDocument
  Dim oSheet As Sheet
  Set oSheet = oDoc.ActiveSheet
  
  Dim sset As SelectSet
  Set sset = oDoc.SelectSet
  If sset.Count = 0 Then
    Beep
    MsgBox ("Select some hole")
    Exit Sub
  End If
  Dim oCurve As DrawingCurve
  Set oCurve = sset.Item(1).Parent
  
  Dim oHoleThreadNotes As HoleThreadNotes
  Set oHoleThreadNotes = oSheet.DrawingNotes.HoleThreadNotes
   
  Dim oP As Point2d
  Set oP = oTG.CreatePoint2d(18, 25)

  Dim oNote As HoleThreadNote
  Set oNote = oHoleThreadNotes.Add(oP, oCurve)
  
  oNote.QuantityDefinition = kNumberOfLikeHolesNormalToView
  
  'make some changes - I added <QuantityNote/>
  Dim St As String
  St = oNote.FormattedHoleThreadNote
  oNote.FormattedHoleThreadNote = "<QuantityNote/>" & St
  Beep
End Sub

 Holes.PNG


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report