Article - CS165436

How to highlight components in a given assembly using Creo Parametric VB API

Modified: 20-Jan-2025   


Applies To

  • Creo Parametric 1.0 to 11.0
  • Creo Parametric VB API

Description

  • How to highlight components in a given assembly using Creo Parametric VB API
  • How to highlight all component in an assembly (flat level)
  • Unable to highlight components in a given assembly by selecting the components by their component paths like code below
Shared Sub HighlightComponents(ByVal AssemblyId As IpfcAssembly)
    Try
        Dim components As IpfcFeatures
        Dim component As IpfcComponentFeat

        components = CType(AssemblyId, IpfcSolid).ListFeaturesByType(False, EpfcFeatureType.EpfcFEATTYPE_COMPONENT)
        For i = 0 To components.Count - 1
            component = CType(components.Item(i), IpfcComponentFeat)
            Try
                Dim j As Integer = CType(components.Item(i).Number, Integer)
                Dim parentIds As New Cintseq
                parentIds.Append(j)

                Dim path As IpfcComponentPath
                path = (New CMpfcAssembly).CreateComponentPath(AssemblyId, parentIds)

                Dim ComponentToReplace As IpfcSelection
                ComponentToReplace = (New CMpfcSelect).CreateComponentSelection(path)

                ComponentToReplace = CType(component, IpfcSelection)
                ComponentToReplace.Highlight(EpfcStdColor.EpfcCOLOR_WARNING)
            Catch ex As Exception
            End Try
        Next i

    Catch ex As Exception
    End Try
End Sub
This is a printer-friendly version of Article 165436 and may be out of date. For the latest version click CS165436