Solid Edge Framework Type Library
GetMaterialLibraryFileList Method
Returns the list containing full path of material libraries.
Returns the count of material libraries.
Description
Returns the list containing full path of material libraries in materials folder.
Syntax
Visual Basic
Public Sub GetMaterialLibraryFileList( _
   ByRef MaterialLibList As Variant, _
   ByRef plNumMaterialLibraries As Long _
) 
Parameters
MaterialLibList
Returns the list containing full path of material libraries.
plNumMaterialLibraries
Returns the count of material libraries.
Remarks
This API will return only full path of material libraries available on users machine. If you need only name's of material libraries then use GetMaterialLibraryList API.
Example
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 = "Materials"
        Dim strMaterial As String = ""
        Dim strMessage As String
        Dim listOfLibraries As Object = Nothing
        Dim numMaterials As Long
        Try
            ' Get SE handle
            objApp = Marshal.GetActiveObject("SolidEdge.Application")

            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)
                ' Make Solid Edge visible
                objApp.Visible = True
            End If
            ' Get material table object handle
            objMatTable = objApp.GetMaterialTable()
            strMaterial = "Steel"

            ' Get material list
            objMatTable.GetMaterialLibraryFileList(listOfLibraries, numMaterials)
            strLibrary = listOfLibraries(2)
            strMessage = String.Format("Number oF Material Libraries = {0}", numMaterials)
            MsgBox(strMessage)

            objMatTable.CreateNewMaterialLibrary("")
            ' Get material list
            listOfLibraries = Nothing
            numMaterials = 0
            objMatTable.GetMaterialLibraryFileList(listOfLibraries, numMaterials)
            strLibrary = listOfLibraries(2)

            strMessage = String.Format("Number oF Material Libraries = {0}", numMaterials)
            MsgBox(strMessage)

            strMessage = String.Format("2nd Library is = {0}", strLibrary)
            MsgBox(strMessage)

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

    End Sub

End Class
See Also

MatTable Object  | MatTable Members