By Adam Nagy
If you create a HighlightSet and add objects to it, but do not see the result, one possible explanation could be that the HighlightSet got released before you could see the result: maybe you declared the HighlightSet inside the function and so it ran out of scope and got released.
Make sure you declare the variable outside the function so that it can live on:
' Needs to be declared globally Private hs As HighlightSet Sub HighlightSample() Dim doc As AssemblyDocument Set doc = ThisApplication.ActiveDocument' If the HighlightSet was declared' inside the function, then when the function' ends and 'hs' goes out of scope it would get' released which would delete the' HighlightSet and would clear the' highlighting in the UI'Dim hs As HighlightSet Set hs = doc.CreateHighlightSet Dim tr As TransientObjects Set tr = ThisApplication.TransientObjects Dim c As Color Set c = tr.CreateColor(255, 0, 0, 0.8) hs.Color = c Dim occ As ComponentOccurrence Set occ = doc.ComponentDefinition.Occurrences(1) Dim f As Face Set f = occ.SurfaceBodies(1).Faces(1) hs.AddItem f End Sub Sub ClearHighlight() Set hs = Nothing End Sub