Solid Edge Framework Type Library
SetDocumentToGageTableAssociation Method
Sheet Metal Document.
Specify Gage table name as string.
Specify Gage as string.
Set as "True" is you wish to use neutral factor from excel file else set as "False".
Set as "True" if you wish to create an association between the sheet metal file and the Gage table else set as "False".
Description
This method will create an association between the sheet metal file and the Gage table.
Syntax
Visual Basic
Public Sub SetDocumentToGageTableAssociation( _
   ByVal pDocument As Object, _
   ByVal bstrDocGageName As String, _
   ByVal bstrDocGageTableName As String, _
   ByVal bUseNeutralFactorFromExcel As Boolean, _
   ByVal bAddAssociation As Boolean _
) 
Parameters
pDocument
Sheet Metal Document.
bstrDocGageName
Specify Gage table name as string.
bstrDocGageTableName
Specify Gage as string.
bUseNeutralFactorFromExcel
Set as "True" is you wish to use neutral factor from excel file else set as "False".
bAddAssociation
Set as "True" if you wish to create an association between the sheet metal file and the Gage table else set as "False".
Example
Imports System.Runtime.InteropServices

Public Class Form1

    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
End Class
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

public class Form1
{

    private void SetDocumentToGageTableAssociation_Click(object sender, EventArgs e)
    {
        SolidEdgeFramework.Application objApplication = null;
        SolidEdgePart.SheetMetalDocument objSMDoc = null;
        SolidEdgeFramework.MatTable myMatTable = null;
        bool bUseNFFromExcel = true;
        bool bAddAssociation = true;
        string strInputGage = "16 gage";
        string strInutGageTable = "Stainless Steel";

        try
        {
            objApplication = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
            // Get the material table object from the application
            myMatTable = objApplication.GetMaterialTable();

            objSMDoc = objApplication.ActiveDocument;
            if (objSMDoc == null)
            {
                MessageBox.Show("Failed to get Sheet Metal Document object.");
            }
            MessageBox.Show("Adding 'Document to Gage Table' Association!");
            myMatTable.SetDocumentToGageTableAssociation(objSMDoc, strInputGage, strInutGageTable, bUseNFFromExcel, bAddAssociation);

            MessageBox.Show("Removing 'Document to Gage Table' Association!");
            bUseNFFromExcel = false;
            bAddAssociation = false;
            strInputGage = "";
            strInutGageTable = "";
            myMatTable.SetDocumentToGageTableAssociation(objSMDoc, strInputGage, strInutGageTable, bUseNFFromExcel, bAddAssociation);

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }
}
See Also

MatTable Object  | MatTable Members