Solid Edge ST7 SDK
Frequently Used Programs
Get Solid Edge Version

Following function will return Solid Edge Version.

Get Solid Edge Version
Copy Code
Public Function oGetSolidEdgeVersion() As String
    Try
        Dim install As New SEInstallDataLib.SEInstallData
        Dim strSEVersion As String = String.Empty

        strSEVersion = install.GetVersion.ToString
        oReleaseObject(install)
        oForceGarbageCollection()

        Return strSEVersion
    Catch ex As Exception
        Return Nothing

    End Try

End Function
Get Solid Edge Status

Following function will return Solid Edge Status.

Get Solid Edge Version
Copy Code
Public Function oGetSEStatus(ByVal strFName As String) As SolidEdgeFramework.DocumentStatus
    Dim objPropertySets As SolidEdgeFileProperties.PropertySets = Nothing

    Try
        objPropertySets = New SolidEdgeFileProperties.PropertySets
        Call objPropertySets.Open(strFName, True)
        Return objPropertySets.Item("ExtendedSummaryInformation").item("Status").value
        objPropertySets.Close()
        oReleaseObject(objPropertySets)
        oForceGarbageCollection()
        Exit Function
    Catch ex As Exception
        Return SolidEdgeFramework.DocumentStatus.igStatusUnknown
        oReleaseObject(objPropertySets)
        oForceGarbageCollection()
        Exit Function
    End Try


End Function
Get Solid Edge Path

Following function will return Solid Edge Path.

Get Solid Edge Path
Copy Code
Public Function () As String

    Dim strSEPath As String = String.Empty
    Dim install As SEInstallDataLib.SEInstallData = Nothing
    Try
        install = New SEInstallDataLib.SEInstallData
        strSEPath = install.GetInstalledPath
    Catch ex As Exception
        Return Nothing
    Finally
        oReleaseObject(install)
        oForceGarbageCollection()
    End Try

    Return strSEPath

End Function
Release Solid Edge Object

Following function will Release Solid Edge Object.

Release Solid Edge Object
Copy Code
Sub (ByVal obj As Object)
    Try
        If Not (obj Is Nothing) Then
            'this should only be used when programming applications that run in their own process space
            Marshal.FinalReleaseComObject(obj)
        End If
    Catch ex As Exception
        obj = Nothing
    End Try
End Sub
Kill Solid Edge Process

Following function will kill Solid Edge process.

Kill Solid Edge
Copy Code
Public Function (ByVal Name As String) As Long

    Dim LocalProcs As Process()
    Dim Proc As Process
    Dim i As Integer

    LocalProcs = System.Diagnostics.Process.GetProcesses
    For Each Proc In LocalProcs
        If UCase(Proc.ProcessName) = UCase(Name) Then
            Try
                Proc.Kill()
                oReleaseObject(Proc)
                oReleaseObject(LocalProcs)
                oForceGarbageCollection()
                Return 0
            Catch ex As System.Exception
                oReleaseObject(Proc)
                oReleaseObject(LocalProcs)
                oForceGarbageCollection()
                Return 1
                Exit Function
            End Try
        End If
        i += 1
    Next
    oReleaseObject(Proc)
    oReleaseObject(LocalProcs)
    oForceGarbageCollection()
    Return 1


End Function
Check File Attribute

Following function will check file attributes.

Cehck File Attribute
Copy Code
Public Function (ByVal filename As String, ByVal attribute As IO.FileAttributes) As Boolean
    If IO.File.Exists(filename) Then
        If (IO.File.GetAttributes(filename) And attribute) > 0 Then
            Return True
        Else
            Return False
        End If
    Else
        Return False
    End If
End Function
Connecting to Revision Manager

Following function will help you to connect to Revision Manager.

Connecting to Revision Manager
Copy Code
Public Function (ByVal blnAppVisibility As Boolean, ByVal blnDisplayAlerts As Boolean) As Boolean

    'to connect to a running instance of Revision Manager
    Try
        '("Word.Application")
        '("Excel.Application")
        '("RevisionManager.Application")
        objRevManApp = Marshal.GetActiveObject("RevisionManager.Application")
        objRevManApp.DisplayAlerts = blnDisplayAlerts
        objRevManApp.Visible = blnAppVisibility
        Return True

    Catch ex As System.Exception

        'SE not running then start it
        Try
            objRevManApp = Activator.CreateInstance(objRevManType)
            objRevManApp.DisplayAlerts = blnDisplayAlerts
            objRevManApp.Visible = blnAppVisibility
            Return True
        Catch ex1 As Exception
            Return False
        End Try
    End Try

    Return False
End Function
Is Valid File Name?

Following function will determine whether File Name is valid or not.

Is Valid File Name?
Copy Code
Public Function (ByVal fn As String) As Boolean
    Try
        If System.IO.File.Exists(fn) Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Return False
    End Try
End Function
Is Solid Edge File?

Following function will determine if File belongs to Solid Edge or not.

Is Solid Edge File?
Copy Code
'pass in the full path including filename or just the filename
Public Function (ByVal Filename As String) As Boolean
    Try
        Dim validFileTypes As String() = {"par", "psm", "asm", "dft", "pwd"}
        Dim strFileNameOnly As String = String.Empty

        strFileNameOnly = System.IO.Path.GetFileName(Filename)
        If strFileNameOnly = String.Empty Then
            Return False
        End If
        If System.IO.Path.HasExtension(strFileNameOnly) Then
            'it has an extension now check to see if it is a valid SE one
            Dim strExtension As String = System.IO.Path.GetExtension(strFileNameOnly)
            For i As Integer = 0 To validFileTypes.Length - 1
                If strExtension.ToLower = "." + validFileTypes(i).ToLower Then
                    Return True
                End If
            Next
            Return False
        Else
            Return False
        End If
    Catch ex As Exception
        Return False
    End Try
End Function
Is Solid Edge Part File?

Following function will determine if File is Solid Edge Part file or not.

Is Solid Edge Part File?
Copy Code
'pass in the full path including filename or just the filename
Public Function (ByVal Filename As String) As Boolean
    Dim sExtension As String = Nothing
    Dim bPart As Boolean = False

    Try
        sExtension = System.IO.Path.GetExtension(Filename)
        If (sExtension.ToLower = ".par") Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Return False
    End Try

End Function
Is Solid Edge Sheet Metal File?

Following function will determine if File is Solid Edge Sheet Metal file or not.

Is Solid Edge Sheet Metal File?
Copy Code
'pass in the full path including filename or just the filename
Public Function oIsSolidEdgeSheetMetalFile(ByVal Filename As String) As Boolean
    Dim sExtension As String = Nothing
    Dim bPart As Boolean = False

    Try
        sExtension = System.IO.Path.GetExtension(Filename)
        If (sExtension.ToLower = ".psm") Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Return False
    End Try
End Function
Is Solid Edge Draft File?

Following function will determine if File is Solid Edge Draft file or not.

Is Solid Edge Draft File?
Copy Code
'pass in the full path including filename or just the filename
Public Function (ByVal Filename As String) As Boolean
    Dim sExtension As String = Nothing
    Dim bPart As Boolean = False

    Try
        sExtension = System.IO.Path.GetExtension(Filename)
        If (sExtension.ToLower = ".dft") Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Return False
    End Try
End Function
Is Solid Edge Assembly File?

Following function will determine if File is Solid Edge Assembly file or not.

Is Solid Edge Assembly File?
Copy Code
'pass in the full path including filename or just the filename
Public Function (ByVal Filename As String) As Boolean
    Dim sExtension As String = Nothing
    Dim bPart As Boolean = False

    Try
        sExtension = System.IO.Path.GetExtension(Filename)
        If (sExtension.ToLower = ".asm") Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Return False
    End Try
End Function
Is Solid Edge Weldment File?

Following function will determine if File is Solid Edge Weldment file or not.

Is Solid Edge Weldment File?
Copy Code
'pass in the full path including filename or just the filename
Public Function (ByVal Filename As String) As Boolean
    Dim sExtension As String = Nothing
    Dim bPart As Boolean = False

    Try
        sExtension = System.IO.Path.GetExtension(Filename)
        If (sExtension.ToLower = ".pwd") Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Return False
    End Try
End Function