70 lines · 3.1 KB
Raw Download
1
# SaveUtils – FreeCAD Workbench Addon
2
3
![SaveUtils Example in the FreeCAD File menu](https://jefftml.s3.amazonaws.com/thumbs/SaveUtilsExample2.png)
4
5
[SaveUtils](https://github.com/jefe317/SaveUtils/) adds four convenience commands to FreeCAD's **File** menu:
6
7
| Command | What it does |
8
|---|---|
9
| **Save with Timestamp** | Saves as `<basename>-YYYYMMDD-HHMMSS.FCStd` |
10
| **Save Increment** | Saves as the next `<basename>-01.FCStd`, `…-02.FCStd` |
11
| **Save As with Timestamp** | Asks for a base filename, then saves as `<base>-YYYYMMDD-HHMMSS.FCStd` |
12
| **Save As Increment** | Asks for a base filename, then saves as the next `<base>-01.FCStd`, `…-02.FCStd` |
13
14
All four save the document under the new name and **leave you working in that new file**, exactly
15
like FreeCAD's own *Save As*. The file you started in stays on disk as it last was.
16
17
The difference between the two pairs is only where the name comes from:
18
19
- The **Save** commands derive it automatically from the open document — no dialog.
20
- The **Save As** commands open a file dialog so you pick the base name yourself.
21
22
## Behavior details
23
24
### Naming
25
- **Timestamp** commands append `-YYYYMMDD-HHMMSS.FCStd`. If the name already ends with that
26
  pattern it is **replaced**, not doubled:  
27
  `design-20240101-120000.FCStd``design-20240315-093045.FCStd`
28
- **Increment** commands append `-NN.FCStd`, zero-padded to 2 digits. The folder is scanned for
29
  existing `<basename>-NN.FCStd` files and the **highest number found is incremented**, so
30
  repeated use never overwrites an earlier snapshot:  
31
  `design.FCStd` with `design-01`/`design-02` on disk → `design-03.FCStd`
32
- Only counters directly following the basename count, so `design-detail-01.FCStd` does not
33
  affect `design`'s numbering.
34
- If the open file is itself an increment (`design-03.FCStd`), the basename is `design`.
35
36
### Unsaved documents
37
A document that has never been saved has no name to derive from, so the **Save** commands fall
38
back to the same file dialog the **Save As** commands use.
39
40
### The chosen name is a *base*
41
In the **Save As** commands the name you pick in the dialog is the base, not the final filename —
42
picking `design.FCStd` writes `design-20240315-093045.FCStd`. Nothing is written to the name you
43
typed, which is why the dialog does not ask about overwriting it.
44
45
## Installation
46
47
### Manual
48
49
Add this repository to your Addon Custom Repositories
50
1. In FreeCAD, go to Edit > Preferences > Addon Manager.
51
2. Under Costom Repositories, click the green plus button to Add https://github.com/jefe317/SaveUtils/ with the branch main.
52
3. Click Apply, close the Preferences window.
53
4. In Tools > Addon Manager, you can now search for "SaveUtils" and install it via the Install button.
54
5. Restart FreeCAD.  
55
   The four items appear near the top of the **File** menu.
56
57
### Via Addon Manager
58
59
If this repo is listed in a custom addon source, you can install it through  
60
**Tools > Addon Manager > Search for SaveUtils > Install**.
61
62
## Requirements
63
64
- FreeCAD 0.20 or later  
65
- PySide2 (bundled with FreeCAD)
66
67
## License
68
69
GPL v3
70