Solid Edge Framework Type Library
Open Method
Specifies the filename (including Path) of a previously saved file to open.
Not currently implemented.
Not currently implemented.
Member of the RevisionRuleType constant set that specifies a revision rule for the operation.
Specifies whether to stop the Open operation if the rule specified by RevisionRuleOption is not applicable. When set to true, the operation stops.
Description
Opens a specified document.
Syntax
Visual Basic
Public Function Open( _
   ByVal Filename As String, _
   Optional ByVal DocRelationAutoServer As Variant, _
   Optional ByVal AltPath As Variant, _
   Optional ByVal RecognizeFeaturesIfPartTemplate As Variant, _
   Optional ByVal RevisionRuleOption As Variant, _
   Optional ByVal StopFileOpenIfRevisionRuleNotApplicable As Variant _
) As Object
Parameters
Filename
Specifies the filename (including Path) of a previously saved file to open.
DocRelationAutoServer
Not currently implemented.
AltPath
Not currently implemented.
RecognizeFeaturesIfPartTemplate
RevisionRuleOption
Member of the RevisionRuleType constant set that specifies a revision rule for the operation.
StopFileOpenIfRevisionRuleNotApplicable
Specifies whether to stop the Open operation if the rule specified by RevisionRuleOption is not applicable. When set to true, the operation stops.
Remarks

The Filename parameter can optionally contain newline characters to separate additional information: a configuration name and configuration overrides.

e.g : sFileName = String.Format("{0}{1}{2}{3}{4}{5}{6}", path, vbLf, configurationName, vbLf, iOverride, vbLf, iSimplify)

Example
Imports System.IO
Imports System.Runtime.InteropServices

Module Example
    <STAThread()> _
    Sub Main()
        Dim objTrainingFolder As DirectoryInfo
        Dim objApplication As SolidEdgeFramework.Application = Nothing

        Try
            OleMessageFilter.Register()

            objTrainingFolder = GetTrainingFolder()
            objApplication = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application"))
            objApplication.Visible = True

            OpenSolidEdgeDocument(objApplication, Path.Combine(objTrainingFolder.FullName, "bar.par"))
            OpenAssemblyWithConfiguration(objApplication, Path.Combine(objTrainingFolder.FullName, "Try It\BrakePedalAssy.asm"), "default,rkriggs")

        Catch ex As Exception
            Console.WriteLine(ex.Message)
        Finally
            OleMessageFilter.Revoke()
        End Try
    End Sub

    Sub OpenSolidEdgeDocument(ByVal objApplication As SolidEdgeFramework.Application, ByVal path As String)
        Dim objDocuments As SolidEdgeFramework.Documents
        Dim objDocument As SolidEdgeFramework.SolidEdgeDocument
        Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument
        Dim objDraftDocument As SolidEdgeDraft.DraftDocument
        Dim objPartDocument As SolidEdgePart.PartDocument
        Dim objSheetMetalDocument As SolidEdgePart.SheetMetalDocument
        Dim objWeldmentDocument As SolidEdgePart.WeldmentDocument

        objDocuments = objApplication.Documents
        objDocument = objDocuments.Open(path)

        Select Case objDocument.Type
            Case SolidEdgeFramework.DocumentTypeConstants.igAssemblyDocument
                objAssemblyDocument = objDocument
            Case SolidEdgeFramework.DocumentTypeConstants.igDraftDocument
                objDraftDocument = objDocument
            Case SolidEdgeFramework.DocumentTypeConstants.igPartDocument
                objPartDocument = objDocument
            Case SolidEdgeFramework.DocumentTypeConstants.igSheetMetalDocument
                objSheetMetalDocument = objDocument
            Case SolidEdgeFramework.DocumentTypeConstants.igUnknownDocument
                ' Handle case
            Case SolidEdgeFramework.DocumentTypeConstants.igWeldmentAssemblyDocument
                ' Weldment Assembly Document
            Case SolidEdgeFramework.DocumentTypeConstants.igWeldmentDocument
                objWeldmentDocument = objDocument
        End Select
    End Sub

    Sub OpenAssemblyWithConfiguration(ByVal objApplication As SolidEdgeFramework.Application, ByVal path As String, ByVal configurationName As String)
        Dim objDocuments As SolidEdgeFramework.Documents
        Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument
        Dim sFileName As String
        Dim iOverride As Integer

        iOverride = 0 'No assembly override (default)
        'iOverride = 1 'Override configuration: all parts active
        'iOverride = 2 'Override configuration: all parts inactive

        'The Filename parameter can optionally contain newline characters to separate additional information: a configuration name and configuration overrides. 
        sFileName = String.Format("{0}{1}{2}{3}{4}", path, vbLf, configurationName, vbLf, iOverride)

        objDocuments = objApplication.Documents
        objAssemblyDocument = objDocuments.Open(sFileName)
    End Sub

    Function GetTrainingFolder() As DirectoryInfo
        Dim objInstallData As SEInstallDataLib.SEInstallData = Nothing
        Dim objInstallFolder As DirectoryInfo = Nothing
        Dim objTrainingFolder As DirectoryInfo = Nothing

        Try
            objInstallData = New SEInstallDataLib.SEInstallData
            objInstallFolder = New DirectoryInfo(objInstallData.GetInstalledPath())
            objTrainingFolder = New DirectoryInfo(Path.Combine(objInstallFolder.Parent.FullName, "Training"))
        Catch
        Finally
            If Not (objInstallData Is Nothing) Then
                Marshal.FinalReleaseComObject(objInstallData)
                objInstallData = Nothing
            End If
        End Try

        Return objTrainingFolder
    End Function
End Module
See Also

Documents Collection  | Documents Members