01-14-2021
05:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-14-2021
05:56 AM
OK. That definitely sounds doable. But how about, since it has already been manually edited, and we are about to manually edit it again (in a way), why not preserve the existing text that someone manually added, so you know what it was, then add that suggested note to a new last line of the call-out.
This code will do that:
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing Document must be active for this rule (" & iLogicVb.RuleName & ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oHoleNotes As HoleThreadNotes = oSheet.DrawingNotes.HoleThreadNotes
Dim oHN As HoleThreadNote
Dim oStr, oEndText, oOtherText, oNewEndText As String
Dim oEndPos As Integer
If oHoleNotes.Count > 0 Then
For Each oHN In oHoleNotes
oStr = oHN.FormattedHoleThreadNote
oEndPos = InStr(StrReverse(oStr), ">")
If oEndPos > 1 Then
'the text you want to put at the end to 'Highlight' it
Dim oHText As String = "THIS HAS BEEN MANUALLY TYPED"
oHN.FormattedHoleThreadNote = oStr & "<Br/>" & oHText
End If
Next
End IfOr if you simply want to remove any/all text after the last ">" character, you could use this:
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing Document must be active for this rule (" & iLogicVb.RuleName & ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oHoleNotes As HoleThreadNotes = oSheet.DrawingNotes.HoleThreadNotes
Dim oHN As HoleThreadNote
Dim oStr, oEndText, oOtherText, oNewEndText As String
Dim oEndPos As Integer
If oHoleNotes.Count > 0 Then
For Each oHN In oHoleNotes
oStr = oHN.FormattedHoleThreadNote
If InStr(StrReverse(oStr), ">") > 1 Then
oHN.FormattedHoleThreadNote = Left(oStr, InStrRev(oStr, ">"))
End If
Next
End IfIf this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE'
.
Wesley Crihfield
(Not an Autodesk Employee)