Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim objOccurrences As SolidEdgeAssembly.Occurrences = Nothing
Dim objOccurrence As SolidEdgeAssembly.Occurrence = Nothing
Dim objSubOccurrences As SolidEdgeAssembly.SubOccurrences = Nothing
Dim objSubOccurrence As SolidEdgeAssembly.SubOccurrence = Nothing
Try
OleMessageFilter.Register()
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objAssemblyDocument = objApplication.ActiveDocument
objOccurrences = objAssemblyDocument.Occurrences
For Each objOccurrence In objOccurrences
If (objOccurrence.DisplayCenterline = True) Then
objOccurrence.DisplayCenterline = False
Else
objOccurrence.DisplayCenterline = True
End If
If Not (objOccurrence.SubOccurrences Is Nothing) Then
objSubOccurrences = objOccurrence.SubOccurrences
For Each objSubOccurrence In objSubOccurrences
If (objSubOccurrence.DisplayCenterline = True) Then
objSubOccurrence.DisplayCenterline = False
Else
objSubOccurrence.DisplayCenterline = True
End If
Next
End If
Next
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module