Solid Edge Framework Type Library
CreateNewMaterialLibrary Method
Name of Material Library to be created as string.
Description
This API will create a new material library.
Syntax
Visual Basic
Public Sub CreateNewMaterialLibrary( _
   ByVal bstrLibInputName As String _
) 
Parameters
bstrLibInputName
Name of Material Library to be created as string.
Remarks
If Material ibrary name is provided then library with that name will be created otherwise default name will be used.
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

        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 document handle
            objDocument = objApp.Documents.Add("SolidEdge.PartDocument")

            'Create library with default name
            objMatTable.CreateNewMaterialLibrary("")

            'Create library with user provided name
            strLibrary = "MyNewMatLibrary"
            objMatTable.CreateNewMaterialLibrary(strLibrary)

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

    End Sub

End Class
See Also

MatTable Object  | MatTable Members