Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objSheetMetalDocument As SolidEdgePart.SheetMetalDocument = 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
Try
OleMessageFilter.Register()
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objSheetMetalDocument = objApplication.ActiveDocument
objModels = objSheetMetalDocument.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
aErrorMessages = Array.CreateInstance(GetType(String), 0)
aWarningMessages = Array.CreateInstance(GetType(String), 0)
' Move the current feature to synchronous.
objSheetMetalDocument.MoveToSynchronous(objFeature, _
bIgnoreWarnings, _
bExtentSelection, _
lNumberOfFeaturesCausingError, _
aErrorMessages, _
lNumberOfFeaturesCausingWarning, _
aWarningMessages)
End If
Next
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module