Solid Edge Framework Type Library
GetMRUMaterialList Method
Returns the list of materials in MRU list.
Returns the list of libraries of the materials.
Returns the total number of materials as long.
Description
Returns the list of most recently used materials and their corresponding libraries.
Syntax
Visual Basic
Public Sub GetMRUMaterialList( _
   ByRef MaterialNames As Variant, _
   ByRef LibraryNames As Variant, _
   ByRef plNumMaterials As Long _
) 
Parameters
MaterialNames
Returns the list of materials in MRU list.
LibraryNames
Returns the list of libraries of the materials.
plNumMaterials
Returns the total number of materials as long.
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 objDocument As SolidEdgePart.PartDocument = Nothing
        Dim strMaterial As String = ""
        Dim varGetPropVal As Object = Nothing
        Dim listOfMaterials As Object = Nothing
        Dim listOfLibraries As Object = Nothing
        Dim numMaterials As Long
        Dim strMessage As String

        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()

            ' Get material list
            objMatTable.GetMRUMaterialList(listOfMaterials, listOfLibraries, numMaterials)

            strMaterial = listOfMaterials(1)
            strLibrary = listOfLibraries(1)

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

            strMessage = String.Format("2nd MRU Material is = {0} and its library is = {1}", strMaterial, strLibrary)
            MsgBox(strMessage)

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

    End Sub

End Class
See Also

MatTable Object  | MatTable Members