Imports System.Runtime.InteropServices
Public Class Form1
'#region UseNeutralFactorFromExcel
Private Sub UseNeutralFactorFromExcel_Click(sender As Object, e As EventArgs) Handles UseNeutralFactorFromExcel.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objSMDoc As SolidEdgePart.SheetMetalDocument = Nothing
Dim myMatTable As SolidEdgeFramework.MatTable = Nothing
Dim bUseNFValueFromExcel As Boolean = True
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("Turning ON Option 'Use Neutral Factor From Excel'!")
Call myMatTable.UseNeutralFactorFromExcel(objSMDoc, bUseNFValueFromExcel)
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 UseNeutralFactorFromExcel_Click(object sender, EventArgs e)
{
SolidEdgeFramework.Application objApplication = null;
SolidEdgePart.SheetMetalDocument objSMDoc = null;
SolidEdgeFramework.MatTable myMatTable = null;
bool bUseNFValueFromExcel = true;
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("Turning ON Option 'Use Neutral Factor From Excel'!");
myMatTable.UseNeutralFactorFromExcel(objSMDoc, bUseNFValueFromExcel);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}