Private Sub GetCurrentMaterialName_Click(sender As Object, e As EventArgs) Handles GetCurrentMaterialName.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objSMDoc As SolidEdgePart.SheetMetalDocument = Nothing
Dim myMatTable As SolidEdgeFramework.MatTable = Nothing
Dim strMTlName As String = ""
Try
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
' Get the material table object from the application
myMatTable = objApplication.GetMaterialTable()
objSMDoc = objApplication.ActiveDocument
If (objSMDoc Is Nothing) Then
MsgBox("Failed to get Sheet Metal Document object.")
End If
Call myMatTable.GetCurrentMaterialName(objSMDoc, strMTlName)
MsgBox("Current Material Name: " + strMTlName)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub