Hide Table of Contents
SaveAs Method (IModelDocExtension)

Obsolete. Superseded by IModelDocExtension::SaveAs2.

.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
Full pathname of the document to save; the file extension indicates any conversion that should be performed (for example, Part1.igs to save in IGES format) (see Remarks)
Version
Format in which to save this document as defined in swSaveAsVersion_e (see Remarks)
Options
Option indicating how to save the document as defined in swSaveAsOptions_e (see Remarks)
ExportData
IExportPdfData object for exporting drawing sheets to PDF (see Remarks)
Errors
Errors that caused the save to fail as defined in swFileSaveError_e (see Remarks)
Warnings
Warnings or extra information generated during the save operation as defined in swFileSaveWarning_e (see Remarks)

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:

  • Exports the entire model, unless faces or bodies are selected, in which case, it exports only those. Call IModelDoc2::ClearSelection2 before calling IModelDocExtension::SaveAs to clear the selection list and export the entire model.

  • 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.

Use Name to specify the full pathname of the saved document. If you specify only the file name, then it is saved in the active document's directory. The filename extension indicates the 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 formatted, use Version to specify 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 ExportData to specify which drawings sheets to save to PDF. If ExportData is Nothing or null, then all sheets are saved to PDF. Saving a document as PDF when the document is open as view-only is not supported.

Use Options to specify save options. You can specify additional 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 Errors is 0. If the save is not successful, then the returned value is false and Errors 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, set Errors to Nothing or null.

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. Warnings 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, set Warnings to Nothing or null.

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) 2019 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.