Solid Edge Framework Type Library
ImportMaterialDataFromFile Method
Path of input file as string.
Name of Material library as string.
Description
Overwrites all the data of input material library with data from XML or EXCEL file.
Syntax
Visual Basic
Public Sub ImportMaterialDataFromFile( _
   ByVal bstrXMLFile As String, _
   ByVal bstrMatLibFile As String _
) 
Parameters
bstrXMLFile
Path of input file as string.
bstrMatLibFile
Name of Material library as string.
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 strMaterialFolderPath As String = ""
        Dim strLibrary As String = "Materials"
        Dim varPropList As Object = Nothing

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

            Dim strXMLLibraryPath As String = "C:\Temp\Materials_Exported.xml"

        objMatTable.ImportMaterialDataFromFile(strXMLLibraryPath, strLibrary)

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

    End Sub

End Class
See Also

MatTable Object  | MatTable Members