Std SaveCopy: Difference between revisions

From FreeCAD Documentation
(Added 'Options'.)
(Added 'Scripting'.)
Line 36: Line 36:


* The last used file location is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → General → FileOpenSavePath}}.
* The last used file location is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → General → FileOpenSavePath}}.

==Scripting==

{{Emphasis|See also:}} [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].

A copy of a document is saved with the {{incode|saveCopy}} method of the document object.

{{Code|code=
import FreeCAD
from pathlib import Path

# The folder and filename we will use:
fld = 'D:/testfiles/'
fnm = fld + 'testCopy.FCStd'

# Make sure fld exists:
Path(fld).mkdir(parents=True, exist_ok=True)

doc = FreeCAD.newDocument()
doc.saveCopy(fnm)
}}


{{Docnav
{{Docnav

Revision as of 09:18, 16 March 2020

Std SaveCopy

Menu location
File → Save a Copy...
Workbenches
All
Default shortcut
None
Introduced in version
-
See also
Std SaveAs, Std Save

Description

The Std SaveCopy command saves a copy of the active document under a new file name.

Usage

  1. Select the File → Save a Copy... option from the menu.
  2. Enter a filename in the dialog box.
  3. Press the Save button.

Options

  • 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 copy of a document is saved with the saveCopy method of the document object.

import FreeCAD
from pathlib import Path

# The folder and filename we will use:
fld = 'D:/testfiles/'
fnm = fld + 'testCopy.FCStd'

# Make sure fld exists:
Path(fld).mkdir(parents=True, exist_ok=True)

doc = FreeCAD.newDocument()
doc.saveCopy(fnm)