Imports System.Runtime.InteropServices
Public Class Form1
'#region PerformGageDataValidation
Private Sub PerformGageDataValidation_Click(sender As Object, e As EventArgs) Handles PerformGageDataValidation.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objSMDoc As SolidEdgePart.SheetMetalDocument = Nothing
Dim myMatTable As SolidEdgeFramework.MatTable = Nothing
Dim bIsValidgage As Boolean = False
Dim strValidgageTabel As String = "aluminium 6061"
Dim strValidateThisgage As String = "10 Gage AL"
Dim strGageFileName 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
bIsValidgage = myMatTable.PerformGageDataValidation(strGageFileName, strValidgageTabel, strValidateThisgage)
If (bIsValidgage) Then
MsgBox("The gage " + strValidateThisgage + "is Valid")
Else
MsgBox("The gage " + strValidateThisgage + "is Invalid")
End If
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
{
//#region PerformGageDataValidation
private void PerformGageDataValidation_Click(object sender, EventArgs e)
{
SolidEdgeFramework.Application objApplication = null;
SolidEdgePart.SheetMetalDocument objSMDoc = null;
SolidEdgeFramework.MatTable myMatTable = null;
bool bIsValidgage = false;
string strValidgageTabel = "aluminium 6061";
string strValidateThisgage = "10 Gage AL";
string strGageFileName = "";
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.");
}
bIsValidgage = myMatTable.PerformGageDataValidation(strGageFileName, strValidgageTabel, strValidateThisgage);
if (bIsValidgage)
{
MessageBox.Show("The gage " + strValidateThisgage + "is Valid");
}
else
{
MessageBox.Show("The gage " + strValidateThisgage + "is Invalid");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}