API: Close and Reopen a Drawing Document (VBA, VB.NET, C#)

Version 5

    This example shows how to close a drawing without unloading its references from memory in order to reopen it quickly. This example also shows how to specify which file to open in response to the FileCloseNotify event.

     

    1. Extract the archive in a convenient location.
    2. Copy the files in \TestFiles to c:\testfiles.
    3. In SolidWorks 2012, open c:\testfiles\TopLevelAssembly-v3.slddrw.
    4. Open an Immediate Window.
    5. Run the macro (VBA, VB.NET, C#).
    6. Select an option in the dialog.
    7. Click Close and Reopen Current Drawing.
        * If option 1, 2, 3, or 4 is chosen:
          * The drawing is closed.
          * The FileCloseNotify event is fired.
          * The event handler specifies the same drawing to reopen.
          * The same drawing is reopened.
          * The FileOpenPostNotify event is fired.
        * If option 5 or 6 is chosen:
          * The drawing is closed.
          * The FileCloseNotify event is fired.
          * The event handler specifies c:\testfiles\TopLevelAssembly-v4.slddrw to open.
          * The new drawing is opened.
          * The ReferencedPreNotify event is fired, because new file references need to
            be loaded with the new drawing.
          * The FileOpenPostNotify event is fired.
    8. Inspect the Immediate Window.
    9. Click OK in the status dialog.

     

     

    Note:

    - Subscription Services required for full access.

    - Looking for more API Examples?

     

     

    Copyright © 2011 Dassault Systèmes SolidWorks Corp. All rights reserved.
    Do not distribute or reproduce without the written consent of Dassault Systèmes SolidWorks Corp.