Std CloseAllWindows: Difference between revisions

From FreeCAD Documentation
(Added 'Scripting'.)
No edit summary
Line 47: Line 47:


A document is closed with the {{incode|closeDocument}} method of the FreeCAD application. For a scripting example see [[Std_New|Std New]].
A document is closed with the {{incode|closeDocument}} method of the FreeCAD application. For a scripting example see [[Std_New|Std New]].

To close all empty documents:

{{Code|code=
import FreeCAD

for docName, doc in FreeCAD.listDocuments().items():
if doc.Objects.__len__() == 0:
FreeCAD.closeDocument(docName)
}}


<!--T:12-->
<!--T:12-->

Revision as of 09:09, 16 March 2020

Std CloseAllWindows

Menu location
File → Close All
Workbenches
All
Default shortcut
None
Introduced in version
-
See also
Std Close

Description

The Std CloseAllWindows command closes all documents.

Usage

  1. Select the File → Close All option from the menu.
  2. If there are unsaved documents a dialog box will prompt you to save them:
    • Press the Save button to save the active document. If required enter a filename first.
    • Press the Discard button to discard the active document and lose all changes.

Options

  • If there are multiple unsaved documents: check the Apply answer to all checkbox to avoid being prompted for each unsaved document separately.
  • If there are unsaved documents: press Esc or the Cancel button to abort the command.

Preferences

  • The last used file location is stored: Tools → Edit parameters... → BaseApp → Preferences → General → FileOpenSavePath.

Scripting

See also: FreeCAD Scripting Basics.

A document is closed with the closeDocument method of the FreeCAD application. For a scripting example see Std New.