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 objModel As SolidEdgePart.Model = Nothing
Dim objFeatures As SolidEdgePart.Features = Nothing
Dim objFeature As Object = Nothing
Dim bIgnoreWarnings As Boolean
Dim bExtentSelection As Boolean
Dim aErrorMessages As Array
Dim aWarningMessages As Array
Dim lNumberOfFeaturesCausingError As Long
Dim lNumberOfFeaturesCausingWarning As Long
Dim dVolumeDifference As Double
Try
OleMessageFilter.Register()
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objPartDocument = objApplication.ActiveDocument
objModels = objPartDocument.Models
objModel = objModels.Item(1)
objFeatures = objModel.Features
' Loop through all the features of the model.
For Each objFeature In objFeatures
' Make sure we're dealing with an ordered feature!
If objFeature.ModelingModeType = SolidEdgePart.ModelingModeConstants.seModelingModeOrdered Then
bIgnoreWarnings = True
bExtentSelection = True
dVolumeDifference = 0
aErrorMessages = Array.CreateInstance(GetType(String), 0)
aWarningMessages = Array.CreateInstance(GetType(String), 0)
' Move the current feature to synchronous.
objPartDocument.MoveToSynchronous(objFeature, _
bIgnoreWarnings, _
bExtentSelection, _
lNumberOfFeaturesCausingError, _
aErrorMessages, _
lNumberOfFeaturesCausingWarning, _
aWarningMessages, _
dVolumeDifference)
End If
Next
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module