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?
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,
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.
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