Imports System.Runtime.InteropServices
Public Class Form1
Private Sub GetPSMGaugeInfoForDoc_Click(sender As Object, e As EventArgs) Handles GetPSMGaugeInfoForDoc.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objSMDoc As SolidEdgePart.SheetMetalDocument = Nothing
Dim myMatTable As SolidEdgeFramework.MatTable = Nothing
Dim strCurrGageName As String = ""
Dim strGageFilePath As String = ""
Dim nMTLUsingExcel As Integer
Dim strMTLGageTableName As String = ""
Dim nDocUsingExcel As Integer
Dim strDocGageTableName As String = ""
Dim nCountBendRadiusVals As Integer
Dim nCountBendAngleVals As Integer
Dim nCountNFVals As Integer
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.GetPSMGaugeInfoForDoc(objSMDoc,
strCurrGageName,
strGageFilePath,
nMTLUsingExcel,
strMTLGageTableName,
nDocUsingExcel,
strDocGageTableName,
nCountBendRadiusVals,
nCountBendAngleVals,
nCountNFVals)
MsgBox("Current Gage: " + strCurrGageName)
MsgBox("Current Gage File: " + strGageFilePath)
MsgBox("Material Using Excel: " + nMTLUsingExcel.ToString)
MsgBox("Material Gage Table: " + strMTLGageTableName)
MsgBox("Document Using Excel: " + nDocUsingExcel.ToString)
MsgBox("Document Gage Table: " + strDocGageTableName)
MsgBox("Count Of Bend Radius Values: " + nCountBendRadiusVals.ToString)
MsgBox("Count Of Bend Angle Values: " + nCountBendAngleVals.ToString)
MsgBox("Count Of Bend Neutral Factor Values: " + nCountNFVals.ToString)
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 GetPSMGaugeInfoForDoc_Click(object sender, EventArgs e)
{
SolidEdgeFramework.Application objApplication = null;
SolidEdgePart.SheetMetalDocument objSMDoc = null;
SolidEdgeFramework.MatTable myMatTable = null;
string strCurrGageName = "";
string strGageFilePath = "";
int nMTLUsingExcel = 0;
string strMTLGageTableName = "";
int nDocUsingExcel = 0;
string strDocGageTableName = "";
int nCountBendRadiusVals = 0;
int nCountBendAngleVals = 0;
int nCountNFVals = 0;
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.");
}
myMatTable.GetPSMGaugeInfoForDoc(objSMDoc, strCurrGageName, strGageFilePath, nMTLUsingExcel, strMTLGageTableName, nDocUsingExcel, strDocGageTableName, nCountBendRadiusVals, nCountBendAngleVals, nCountNFVals);
MessageBox.Show("Current Gage: " + strCurrGageName);
MessageBox.Show("Current Gage File: " + strGageFilePath);
MessageBox.Show("Material Using Excel: " + nMTLUsingExcel.ToString());
MessageBox.Show("Material Gage Table: " + strMTLGageTableName);
MessageBox.Show("Document Using Excel: " + nDocUsingExcel.ToString());
MessageBox.Show("Document Gage Table: " + strDocGageTableName);
MessageBox.Show("Count Of Bend Radius Values: " + nCountBendRadiusVals.ToString());
MessageBox.Show("Count Of Bend Angle Values: " + nCountBendAngleVals.ToString());
MessageBox.Show("Count Of Bend Neutral Factor Values: " + nCountNFVals.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}