Solid Edge Framework Type Library
GetMaterialLibraryList Method
Returns the list containing only names of material libraries.
Returns the count of material libraries.
Description
Returns the list containing only names of material libraries in materials folder.
Syntax
Visual Basic
Public Sub GetMaterialLibraryList( _
   ByRef MaterialLibList As Variant, _
   ByRef plNumMaterialLibraries As Long _
) 
Parameters
MaterialLibList
Returns the list containing only names of material libraries.
plNumMaterialLibraries
Returns the count of material libraries.
Remarks
This API will return only name's of material libraries available on users machine. If you need full path of material libraries then use GetMaterialLibraryFileList API.
Example
Imports System.IO
Imports System.Runtime.InteropServices

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim objApp As SolidEdgeFramework.Application = Nothing
        Dim objType As Type = Nothing
        Dim objMatTable As SolidEdgeFramework.MatTable = Nothing
        Dim strLibrary As String = ""
        Dim strMaterial As String = ""
        Dim strMessage As String
        Dim listOfLibraries As Object = Nothing
        Dim numMaterials As Long
        Dim listOfMaterials As Object = Nothing
        Try
            Try
                ' Get SE handle
                objApp = Marshal.GetActiveObject("SolidEdge.Application")
            Catch ex As Exception
                If objApp Is Nothing Then
                    ' Get the type from the Solid Edge ProgID
                    objType = Type.GetTypeFromProgID("SolidEdge.Application")
                    ' Start Solid Edge
                    objApp = Activator.CreateInstance(objType)
                End If
            Finally
                ' Make Solid Edge visible
                objApp.Visible = True
            End Try
            ' Get material table object handle
            objMatTable = objApp.GetMaterialTable()
            objMatTable.GetMaterialLibraryList(listOfLibraries, numMaterials)
            strLibrary = listOfLibraries(2)
            'Get material list
            objMatTable.GetMaterialListFromLibrary(strLibrary, numMaterials, listOfMaterials)

            strMessage = String.Format("Number of materials -->{0}", numMaterials)
            MsgBox(strMessage)
            strMaterial = listOfMaterials(5)
            strMessage = String.Format("5th Material is --> {0}", strMaterial)
            MsgBox(strMessage)
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

    End Sub
End Class
See Also

MatTable Object  | MatTable Members