Private Sub SetDocumentToGageTableAssociation_Click(sender As Object, e As EventArgs) Handles SetDocumentToGageTableAssociation.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objSMDoc As SolidEdgePart.SheetMetalDocument = Nothing
Dim myMatTable As SolidEdgeFramework.MatTable = Nothing
Dim bUseNFFromExcel As Boolean = True
Dim bAddAssociation As Boolean = True
Dim strInputGage As String = "16 gage"
Dim strInutGageTable As String = "Stainless Steel"
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
MsgBox("Adding 'Document to Gage Table' Association!")
Call myMatTable.SetDocumentToGageTableAssociation(objSMDoc, strInputGage, strInutGageTable, bUseNFFromExcel, bAddAssociation)
MsgBox("Removing 'Document to Gage Table' Association!")
bUseNFFromExcel = False
bAddAssociation = False
strInputGage = ""
strInutGageTable = ""
Call myMatTable.SetDocumentToGageTableAssociation(objSMDoc, strInputGage, strInutGageTable, bUseNFFromExcel, bAddAssociation)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub