Imports System.Runtime.InteropServices
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim objApp As SolidEdgeFramework.Application = Nothing
Dim objDoc As SolidEdgePart.PartDocument = Nothing
Dim objsym As SolidEdgeFrameworkSupport.SymbolicPMI = Nothing
Dim objPMIGroup As SolidEdgeFrameworkSupport.SymbolicPMIGroup = Nothing
Dim objPMI As SolidEdgeFrameworkSupport.PMI = Nothing
Dim i As Integer
Try
' Create/get the application with specific settings
objApp = Marshal.GetActiveObject("SolidEdge.Application")
' Get the active JT document containing symbolic PMI group.
objDoc = objApp.ActiveDocument
' Get PMI
objDoc.PMI_ByModelState(PMIObj:=objPMI)
'Get symbolic PMI Group
objPMIGroup = objPMI.SymbolicPMIGroup
objPMIGroup.ClearPlane()
objPMIGroup.ClearStyle()
Dim i As Integer
i = objPMI.SymbolicPMIGroup.count()
objsym = objPMIGroup.Item(1)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class Form1
{
private void Button1_Click(object sender, EventArgs e)
{
SolidEdgeFramework.Application objApp = null;
SolidEdgePart.PartDocument objDoc = null;
SolidEdgeFrameworkSupport.SymbolicPMI objsym = null;
SolidEdgeFrameworkSupport.SymbolicPMIGroup objPMIGroup = null;
SolidEdgeFrameworkSupport.PMI objPMI = null;
int i = 0;
try
{
// Create/get the application with specific settings
objApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
// Get the active JT document containing symbolic PMI group.
objDoc = objApp.ActiveDocument;
// Get PMI
objDoc.PMI_ByModelState(PMIObj:objPMI);
//Get symbolic PMI Group
objPMIGroup = objPMI.SymbolicPMIGroup;
objPMIGroup.ClearPlane();
objPMIGroup.ClearStyle();
int i = objPMI.SymbolicPMIGroup.count();
objsym = objPMIGroup.Item(1);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public Form1()
{
SubscribeToEvents();
}
private bool EventsSubscribed = false;
private void SubscribeToEvents()
{
if (EventsSubscribed)
return;
else
EventsSubscribed = true;
Button1.Click += Button1_Click;
}
}