Hide Table of Contents
ReloadOrReplace Method (IModelDoc2)

Reloads or replaces the current model document.

.NET Syntax

Visual Basic (Declaration) 
Function ReloadOrReplace( _
   ByVal ReadOnly As System.Boolean, _
   ByVal ReplaceFileName As System.String, _
   ByVal DiscardChanges As System.Boolean _
) As System.Integer
Visual Basic (Usage) 
Dim instance As IModelDoc2
Dim ReadOnly As System.Boolean
Dim ReplaceFileName As System.String
Dim DiscardChanges As System.Boolean
Dim value As System.Integer
 
value = instance.ReloadOrReplace(ReadOnly, ReplaceFileName, DiscardChanges)
C# 
System.int ReloadOrReplace( 
   System.bool ReadOnly,
   System.string ReplaceFileName,
   System.bool DiscardChanges
)
C++/CLI 
System.int ReloadOrReplace( 
&   System.bool ReadOnly,
&   System.String^ ReplaceFileName,
&   System.bool DiscardChanges
) 

Parameters

ReadOnly

True if the model document is read-only, false if it is not

ReplaceFileName

Replacement model document

DiscardChanges

True to discard changes made to the current model document, false to abort operation if the model document was changed (see Remarks)

Return Value

Error codes as defined by swComponentReloadError_e

Example

Remarks

The model to reload or replace must be open in its own window frame.

 

This method does not work with models that have been opened in the background as a result of being referenced by an assembly. In those cases, first make the document visible using IModelDoc2::Visible, and then call ModelDoc2::ReloadOrReplace.

 

You must call IModelDoc2::ReloadOrReplace after calling IModelDoc2::ForceReleaseLocks, which detaches a file from the file system, to re-attach a detached file to the file system. If you do not call IModelDoc2::ReloadOrReplace after calling IModelDoc2::ForceReleaseLocks, then you will experience problems with OLE objects (e.g., design tables). Any changes made to a file while it is detached are not preserved unless you save the file to disk before calling IModelDoc2::ReloadOrReplace. Additionally if you set IModelDoc2::ReloadOrReplace's DiscardChanges parameter to false and you made changes to a detached file that you are attempting to re-attach to the file system, then IModelDoc2::ReloadOrReplace will fail. DiscardChanges must be set to true to re-attach a detached file.

See ISldWorks::CloseAndReopen to perform a similar function with drawing documents.

 

See Also

Availability

SOLIDWORKS 2001Plus FCS, Revision Number 10.0


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:   ReloadOrReplace Method (IModelDoc2)
*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.