Hide Table of Contents
CloseAndReopen Method (ISldWorks)

Closes and reopens the specified drawing document without unloading its references from memory.

.NET Syntax

Visual Basic (Declaration) 
Function CloseAndReopen( _
   ByVal Doc As ModelDoc2, _
   ByVal Option As System.Integer, _
   ByRef NewDoc As ModelDoc2 _
) As System.Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Doc As ModelDoc2
Dim Option As System.Integer
Dim NewDoc As ModelDoc2
Dim value As System.Integer
 
value = instance.CloseAndReopen(Doc, Option, NewDoc)
C# 
System.int CloseAndReopen( 
   ModelDoc2 Doc,
   System.int Option,
   out ModelDoc2 NewDoc
)
C++/CLI 
System.int CloseAndReopen( 
&   ModelDoc2^ Doc,
&   System.int Option,
&   [Out] ModelDoc2^ NewDoc
) 

Parameters

Doc
IModelDoc2; drawing document to close and reopen
Option
Reopen options as defined in swCloseReopenOption_e
NewDoc
IModelDoc2; reopened drawing document

Return Value

Error code as defined in swCloseReopenError_e

Example

Download Close and Reopen a Drawing Document (VBA, VB.NET, C#) from the SOLIDWORKS API forum. You must be a SOLIDWORKS subscription customer to access the SOLIDWORKS API forum's documents.

Remarks

Before a third-party application can process a drawing document that is open in SOLIDWORKS, it must close the document. Usually when a drawing document is closed, its references are unloaded from memory, and reopening the drawing document takes a lot of time. This method closes a drawing document, keeps its references in memory, and quickly reopens it.

After the drawing document is closed and before it is reopened, SOLIDWORKS fires a FileCloseNotify event with reason swFileCloseNotifyReason_e.swFileCloseNotifyReason_CloseForReload. In the handler of this event, a third-party application can call ISldWorks::SetPromptFileName2 to open a different file, or it can process the specified document before it is reopened in SOLIDWORKS.

See IModelDoc2::ReloadOrReplace to perform a similar function with part and assembly documents.

 

See Also

Availability

SOLIDWORKS 2012 FCS, Revision Number 20.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:   CloseAndReopen Method (ISldWorks)
*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) 2018 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.