Hide Table of Contents
ReloadOrReplace Method (IModelDocExtension)

Reloads or replaces this model document.

.NET Syntax

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

Parameters

ReadOnly
True to set the model document read-only after reload or replace, false to allow write access
ReplaceFileName

Replacement model document; null or Nothing to reload the current 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)

ForceReload
True to force the reload, false to not

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 reload or replace the model if the top assembly has been opened invisibly. In that case, make the model visible by calling IModelDoc2::Visible before calling this method.

 

You must call this method 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 this method 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 this method. Additionally if you set this method'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 this method 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 2022 FCS, Revision Number 30


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 (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) 2022 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.