Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objDocuments As SolidEdgeFramework.Documents = Nothing
Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim objOccurrences As SolidEdgeAssembly.Occurrences = Nothing
Dim objOccurrence As SolidEdgeAssembly.Occurrence = Nothing
Dim objAdjustablePart As SolidEdgeAssembly.AdjustablePart = Nothing
Dim bAdjustToFit As Boolean
Try
OleMessageFilter.Register()
' Start Solid Edge
objApplication = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application"))
objApplication.Visible = True
objDocuments = objApplication.Documents
objAssemblyDocument = objDocuments.Open("anyfilename.asm")
objOccurrences = objAssemblyDocument.Occurrences
objOccurrence = objOccurrences.Item(1)
objAdjustablePart = objOccurrence.GetAdjustablePart()
bAdjustToFit = objAdjustablePart.AdjustToFit
' Demo toggling the AdjustToFit property.
objAdjustablePart.AdjustToFit = Not bAdjustToFit
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module