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 Integer, _
   ByRef NewDoc As ModelDoc2 _
) As Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Doc As ModelDoc2
Dim Option As Integer
Dim NewDoc As ModelDoc2
Dim value As Integer
 
value = instance.CloseAndReopen(Doc, Option, NewDoc)
C# 
int CloseAndReopen( 
   ModelDoc2 Doc,
   int Option,
   out ModelDoc2 NewDoc
)
C++/CLI 
int CloseAndReopen( 
&   ModelDoc2^ Doc,
&   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

You must be a SolidWorks subscription customer to access the SolidWorks API forum's documents.

  1. Open https://forum.solidworks.com/community/solidworks/api?view=documents.
  2. Log in.
  3. Click SolidWorks > API to open the SolidWorks API forum.
  4. Click the Documents tab.
  5. Locate and download Close and Reopen a Drawing Document (VBA, VB.NET, C#).

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