Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objPartDocument As SolidEdgePart.PartDocument = Nothing
Dim objModels As SolidEdgePart.Models = Nothing
Dim objConstructions As SolidEdgePart.Constructions = Nothing
Dim objToggleToConstruction As SolidEdgePart.ToggleToConstruction = Nothing
Dim BodyArray(1) As Object
Dim iDesignBodiesCount As Long
Dim iDesignBodyCountAfterToggle As Long
Try
OleMessageFilter.Register()
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objPartDocument = objApplication.ActiveDocument
objModels = objPartDocument.Models
objConstructions = objPartDocument.Constructions
objPartDocument.ModelingMode = SolidEdgePart.ModelingModeConstants.seModelingModeOrdered
' assumes an input file with at least two design bodies
BodyArray = New Object(1) {}
BodyArray(1) = objModels.Item(2).Body
objToggleToConstruction = objConstructions.ToggleToConstructions.Add(1, BodyArray)
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module