Hide Table of Contents
SaveAs Method (IModelDocExtension)

Saves the document to a different name.

.NET Syntax

Visual Basic (Declaration) 
Function SaveAs( _
   ByVal Name As System.String, _
   ByVal Version As System.Integer, _
   ByVal Options As System.Integer, _
   ByVal ExportData As System.Object, _
   ByRef Errors As System.Integer, _
   ByRef Warnings As System.Integer _
) As System.Boolean
Visual Basic (Usage) 
Dim instance As IModelDocExtension
Dim Name As System.String
Dim Version As System.Integer
Dim Options As System.Integer
Dim ExportData As System.Object
Dim Errors As System.Integer
Dim Warnings As System.Integer
Dim value As System.Boolean
 
value = instance.SaveAs(Name, Version, Options, ExportData, Errors, Warnings)
C# 
System.bool SaveAs( 
   System.string Name,
   System.int Version,
   System.int Options,
   System.object ExportData,
   out System.int Errors,
   out System.int Warnings
)
C++/CLI 
System.bool SaveAs( 
&   System.String^ Name,
&   System.int Version,
&   System.int Options,
&   System.Object^ ExportData,
&   [Out] System.int Errors,
&   [Out] System.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) (see Remarks)
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 or null
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

To save as an IGES, STL, or STEP file, the document to convert must be the active document. Before calling this method:

  1. Call ISldWorks::ActivateDoc3 to make the document to convert the active document.
  2. Call ISldWorks::ActiveDoc to get the active document.

This method:

  • Overwrites existing files unless they are read only.

  • Results in the FileSaveNotify event 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 Nothing or null for the Errors argument.

Even if the file is saved successfully, there might be warnings or information that occur during the save operation 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 Nothing or 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) 2015 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.