Imports System.Runtime.InteropServices
Public Class DefaultCustomOccurrenceProperties
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim objSEApp As SolidEdgeFramework.Application = Nothing
Dim objAsmDoc As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim objAsmProps As SolidEdgeAssembly.AssemblyProperties = Nothing
Dim objDefCustOccProps As SolidEdgeAssembly.DefaultCustomOccurrenceProperties = Nothing
Dim i As Integer
Dim DefPropName As String
Try
'Get active instance of SE
objSEApp = Marshal.GetActiveObject("SolidEdge.Application")
objAsmDoc = objSEApp.ActiveDocument
objAsmProps = objAsmDoc.AssemblyProperties
objAsmProps.LoadCustomOccurrenceProperties()
objDefCustOccProps = objAsmProps.DefaultCustomOccurrenceProperties
For i = 1 To objDefCustOccProps.Count
DefPropName = objDefCustOccProps.Item(i).Name
MsgBox(DefPropName)
Next
Catch ex As Exception
MsgBox(ex.ToString)
Finally
End Try
End Sub
End Class
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class DefaultCustomOccurrenceProperties
{
private void Button1_Click(object sender, EventArgs e)
{
SolidEdgeFramework.Application objSEApp = null;
SolidEdgeAssembly.AssemblyDocument objAsmDoc = null;
SolidEdgeAssembly.AssemblyProperties objAsmProps = null;
SolidEdgeAssembly.DefaultCustomOccurrenceProperties objDefCustOccProps = null;
int i = 0;
string DefPropName = null;
try
{
//Get active instance of SE
objSEApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
objAsmDoc = objSEApp.ActiveDocument;
objAsmProps = objAsmDoc.AssemblyProperties;
objAsmProps.LoadCustomOccurrenceProperties();
objDefCustOccProps = objAsmProps.DefaultCustomOccurrenceProperties;
for (i = 1; i <= objDefCustOccProps.Count; i++)
{
DefPropName = objDefCustOccProps.Item(i).Name;
MessageBox.Show(DefPropName);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
}
}
public DefaultCustomOccurrenceProperties()
{
SubscribeToEvents();
}
//Converted event handler wireups:
private bool EventsSubscribed = false;
private void SubscribeToEvents()
{
if (EventsSubscribed)
return;
else
EventsSubscribed = true;
Button1.Click += Button1_Click;
}
}