Solid Edge Framework Type Library
GetSaveAsFileName Method
Solid Edge Framework Type Library > Application Object : GetSaveAsFileName Method
Member of the LinksUpdateOption constant set that is applicable when a linked document (which has been in-place activated and modified) is saved to a new name.
Specifies the index number in the FileFormat property of the Application object that indicates the filter to be used when saving the document.
Specifies the suggested file name. If this argument is omitted, the active document name is used.
Specifies the file filtering criteria. The filter string consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. For example, the following string specifies a text file filter: "Text Files (*.txt),*.txt" . To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons. For example: "Solid Edge Files (*.asm; *.prt),*.asm;*.prt". If omitted, this argument defaults to "All Files (*.*),*.*". If you wish to use standard Solid Edge filters, "default" will get the filter based on the active document. If no active doc, the filter for part is returned. If a filter for a particular file type is desired, whether that type of file is active or not, pass in "default_XXX" where "XXX" is one of the file extensions like "par" or "asm".
Specifies the index number of the default file filtering criteria from one to the number of filters specified in FileFilter. If this argument is omitted, or if is greater than the number of filters present, the first file filter is used.
If this argument is omitted, the dialog title is "Save As."
Specifies if the document being saved is a template.
Description
Returns the new name of the file to save.
Syntax
Visual Basic
Public Function GetSaveAsFileName( _
   ByRef LinkSaveOption As Integer, _
   ByRef SelectedFilter As Long, _
   Optional ByVal InitialFilename As Variant, _
   Optional ByVal FileFilter As Variant, _
   Optional ByVal FilterIndex As Variant, _
   Optional ByVal Title As Variant, _
   Optional ByVal IsTemplate As Variant _
) As Variant
Parameters
LinkSaveOption
Member of the LinksUpdateOption constant set that is applicable when a linked document (which has been in-place activated and modified) is saved to a new name.
SelectedFilter
Specifies the index number in the FileFormat property of the Application object that indicates the filter to be used when saving the document.
InitialFilename
Specifies the suggested file name. If this argument is omitted, the active document name is used.
FileFilter
Specifies the file filtering criteria. The filter string consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. For example, the following string specifies a text file filter: "Text Files (*.txt),*.txt" . To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons. For example: "Solid Edge Files (*.asm; *.prt),*.asm;*.prt". If omitted, this argument defaults to "All Files (*.*),*.*". If you wish to use standard Solid Edge filters, "default" will get the filter based on the active document. If no active doc, the filter for part is returned. If a filter for a particular file type is desired, whether that type of file is active or not, pass in "default_XXX" where "XXX" is one of the file extensions like "par" or "asm".
FilterIndex
Specifies the index number of the default file filtering criteria from one to the number of filters specified in FileFilter. If this argument is omitted, or if is greater than the number of filters present, the first file filter is used.
Title
If this argument is omitted, the dialog title is "Save As."
IsTemplate
Specifies if the document being saved is a template.
Example
Imports Microsoft.VisualBasic
Imports System
Imports System.Runtime.InteropServices

Namespace Examples
    Friend Class Program
        <STAThread>
        Shared Sub Main(ByVal args() As String)
            Dim application As SolidEdgeFramework.Application = Nothing
            Dim linksUpdateOption As Integer = CInt(Fix(SolidEdgeFramework.LinksUpdateOption.igNoLinksUpdate))
            Dim selectedfilter As Integer = 0
            Dim strInitialFileName As Object = String.Empty
            Dim strFileFilter As Object = String.Empty
            Dim filterIndex As Object = 0
            Dim strSaveAsFileName As Object = Nothing

            Try
                ' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register()

                ' Attempt to connect to a running instance of Solid Edge.
                application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

                'If the input filter is provided and the filter is "default", it get's the active document and base the filter on the document type.
                'If there is no active document it defaults to the filter list for a part file.
                strFileFilter = "default"
                strSaveAsFileName = application.GetSaveAsFileName(linksUpdateOption, selectedfilter, strInitialFileName, strFileFilter, filterIndex)

                'To get the default filter for a non-active document, the filter passed in can be one of the folllowing:
                strFileFilter = "default_asm"
                strSaveAsFileName = application.GetSaveAsFileName(linksUpdateOption, selectedfilter, strInitialFileName, strFileFilter, filterIndex)

                strFileFilter = "default_dft"
                strSaveAsFileName = application.GetSaveAsFileName(linksUpdateOption, selectedfilter, strInitialFileName, strFileFilter, filterIndex)

                strFileFilter = "default_familyasm"
                strSaveAsFileName = application.GetSaveAsFileName(linksUpdateOption, selectedfilter, strInitialFileName, strFileFilter, filterIndex)

                strFileFilter = "default_par"
                strSaveAsFileName = application.GetSaveAsFileName(linksUpdateOption, selectedfilter, strInitialFileName, strFileFilter, filterIndex)

                strFileFilter = "default_psm"
                strSaveAsFileName = application.GetSaveAsFileName(linksUpdateOption, selectedfilter, strInitialFileName, strFileFilter, filterIndex)

                strFileFilter = "default_pwd"
                strSaveAsFileName = application.GetSaveAsFileName(linksUpdateOption, selectedfilter, strInitialFileName, strFileFilter, filterIndex)
            Catch ex As System.Exception
                Console.WriteLine(ex)
            Finally
                OleMessageFilter.Unregister()
            End Try
        End Sub
    End Class
End Namespace
using System;
using System.Runtime.InteropServices;

namespace Examples
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = null;
            int linksUpdateOption = (int)SolidEdgeFramework.LinksUpdateOption.igNoLinksUpdate;
            int selectedfilter = 0;
            object strInitialFileName = String.Empty;
            object strFileFilter = String.Empty;
            object filterIndex = 0;
            object strSaveAsFileName = null;

            try
            {
                // See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register();

                // Attempt to connect to a running instance of Solid Edge.
                application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

                //If the input filter is provided and the filter is "default", it get's the active document and base the filter on the document type.
                //If there is no active document it defaults to the filter list for a part file.
                strFileFilter = "default";
                strSaveAsFileName = application.GetSaveAsFileName(out linksUpdateOption, out selectedfilter, strInitialFileName, strFileFilter, filterIndex);

                //To get the default filter for a non-active document, the filter passed in can be one of the folllowing:
                strFileFilter = "default_asm";
                strSaveAsFileName = application.GetSaveAsFileName(out linksUpdateOption, out selectedfilter, strInitialFileName, strFileFilter, filterIndex);

                strFileFilter = "default_dft";
                strSaveAsFileName = application.GetSaveAsFileName(out linksUpdateOption, out selectedfilter, strInitialFileName, strFileFilter, filterIndex);

                strFileFilter = "default_familyasm";
                strSaveAsFileName = application.GetSaveAsFileName(out linksUpdateOption, out selectedfilter, strInitialFileName, strFileFilter, filterIndex);

                strFileFilter = "default_par";
                strSaveAsFileName = application.GetSaveAsFileName(out linksUpdateOption, out selectedfilter, strInitialFileName, strFileFilter, filterIndex);

                strFileFilter = "default_psm";
                strSaveAsFileName = application.GetSaveAsFileName(out linksUpdateOption, out selectedfilter, strInitialFileName, strFileFilter, filterIndex);

                strFileFilter = "default_pwd";
                strSaveAsFileName = application.GetSaveAsFileName(out linksUpdateOption, out selectedfilter, strInitialFileName, strFileFilter, filterIndex);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}
See Also

Application Object  | Application Members