- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Yes. HoleThreadNotes are a bit odd, and have a lot of options, that can be set-up within their Styles and depending on the application and what they are attached to. They are rarely actually overridden, in a way that is easily detectable.
I think we may have to use some custom string contents searching to be more accurate for this purpose. One thing we can do is check its FormattedHoleThreadNote to see if it contains the expected "<" and ">" symbols, because it uses XML formatting within it. If it doesn't contain one (or either) of these symbols, it has definitely been manually edited, in a way that has over written the default contents. The default contents are always references to existing data, such as Parameters, surrounded by those symbols, so that it places the 'linked' values in their place within the final output text that you see. However if the user has left some of this default formatting and only replaced parts of it, then some of those symbols may still exist within the formatted text and this check will fail to find it.
One other check we can do is check to see if its value has been hidden. This is an odd situation, but possible. If you right click on one then select "Hide Value", then you right click it again and use "Text...", you can type in whatever you want it to show that way too. When you choose "Text..." on a normal (unedited) note, it will show a "Format Text" dialog, in which only shows "<<>>". That "<<>>" is where the normal formatted text is inserted. Then you can type something in either before or after that symbol, and it will show either before or after the usual note contents. But after you've hidden the notes value, that "<<>>" symbol is no longer in there, so what you type in there will be the only thing that shows.
Here's the updated code:
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 oTO As TransientObjects = ThisApplication.TransientObjects
Dim oColor As Color
oAns = MsgBox("Highlight [Yes] or UnHighlight [No]", vbYesNo + vbQuestion, "")
If oAns = vbYes Then
oColor = oTO.CreateColor(255, 0, 255)
Else
oColor = oTO.CreateColor(0, 0, 0)
oColor.ColorSourceType = ColorSourceTypeEnum.kLayerColorSource
End If
Dim oHoleNotes As Inventor.HoleThreadNotes = oSheet.DrawingNotes.HoleThreadNotes
If oHoleNotes.Count > 0 Then
For Each oHN As HoleThreadNote In oHoleNotes
If oHN.ModelValueOverridden Or _
oHN.FormattedHoleThreadNote.Contains("<") = False Or _
oHN.HideValue = True Then
oHN.Text.Color = oColor
End If
Next
End IfYou may have some other ideas unique you your usual documentation style too, that you may have to add in there to catch the trickier edits.
If 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)