Hide Table of Contents
SaveAs Method (IModelDocExtension)

Saves the document to a different name.

.NET Syntax

Visual Basic (Declaration) 
Function SaveAs( _
   ByVal Name As String, _
   ByVal Version As Integer, _
   ByVal Options As Integer, _
   ByVal ExportData As Object, _
   ByRef Errors As Integer, _
   ByRef Warnings As Integer _
) As Boolean
Visual Basic (Usage) 
Dim instance As IModelDocExtension
Dim Name As String
Dim Version As Integer
Dim Options As Integer
Dim ExportData As Object
Dim Errors As Integer
Dim Warnings As Integer
Dim value As Boolean
 
value = instance.SaveAs(Name, Version, Options, ExportData, Errors, Warnings)
C# 
bool SaveAs( 
   string Name,
   int Version,
   int Options,
   object ExportData,
   out int Errors,
   out int Warnings
)
C++/CLI 
bool SaveAs( 
&   String^ Name,
&   int Version,
&   int Options,
&   Object^ ExportData,
&   [Out] int Errors,
&   [Out] int Warnings
) 

Parameters

Name
New name of the document; the file extension indicates any conversion that should be performed (for example, Part1.igs to save to IGES)
Version
Format in which to save this document as defined in swSaveAsVersion_e
Options
Option indicating how to save the document as defined in swSaveAsOptions_e
ExportData
IExportPdfData object for exporting drawing sheets to PDF or Nothing
Errors
Errors that caused the save to fail as defined in swFileSaveError_e
Warnings
Warnings or extra information generated during the save operation as defined in swFileSaveWarning_e

Return Value

True if the save is successful, false if not

Example

Remarks

This method:

  • Overwrites existing files unless they are read-only.

  • Results in FileSaveNotify being sent to any application listening.

  • Removes any configuration-specific bitmap previews, except the current configuration's.

Saving a document as PDF when the document is open as view-only is not supported.

Do not use ModelDocExtension::SaveAs to copy assemblies, drawings, or parts with in-context references. Instead, use ISldWorks::CopyDocument or ISldworks::ICopyDocument.

The Name argument refers to the new name for the saved document. The filename extension indicates any conversion that should be performed (for example,  "Part1.igs" to save to IGES). If the filename extension does not uniquely indicate how the file should be saved, use the Version argument to determine how to save the file. For example, to save:

  • A standard drawing document as a detached drawing, specify swSaveAsDetachedDrawing for Version.

  • A detached drawing as a standard drawing, specify swSaveAsStandardDrawing for Version.

  • A standard or detached drawing document in the same format, specify swSaveAsCurrentVersion for Version.

Use the ExportData parameter to specify which drawings sheets to save to PDF. Saving a document as PDF when the document is open as view-only is not supported.

You can specify additional Save As options using ISldWorks::SetUserPreferenceIntegerValue. For example:

' Save assembly as multibody part and save exterior faces as surface bodies

swApp.SetUserPreferenceIntegerValue swSaveAssemblyAsPartOptions, _

swSaveAsmAsPart_ExteriorFaces

swModelDocExt.SaveAs "H:\Assem1.SLDPRT", swSaveAsCurrentVersion, _

swSaveAsOptions_Silent, Nothing, nErrors, nWarnings

 

- or -

 

' Save all drawing sheets in active drawing document as an eDrawings file

swApp.SetUserPreferenceIntegerValue swEdrawingsSaveAsSelectionOption, swEdrawingSaveAll

swModelDocExt.SaveAs "H:\Grid.edrw", swSaveAsCurrentVersion, _

swSaveAsOptions_Silent, Nothing, nErrors, nWarnings

 

If the file is saved successfully, then the returned value is True and the Errors argument is 0. If the save is not successful, then the returned value is false and the Errors argument contains a bitwise OR of the error codes that were generated in saving the document. Check the masks against the swFileSaveError_e enumeration. If you do not want SolidWorks to return error information, you can pass in NULL for the Errors argument.

Even if the file is saved successfully, there might be warnings or information that occurs during the save in which you might be interested. The Warnings argument contains a bitwise OR of the warning codes that were generated when saving the document. Check the masks against the swFileSaveWarning_e enumeration. If you do not want warning information returned, you can pass in NULL for the Warnings argument.

Use IModelDoc2::Save3 to save a file using its current name.

 

 

See Also

Availability

SolidWorks 2007 SP1, Revision Number 15.1


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   SaveAs Method (IModelDocExtension)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2010 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.