Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 409ab1ed45 | |||
| 00df48dfe4 | |||
| 5e03fe2f4b | |||
| 0656819123 | |||
| 926d753a40 | |||
| c03dccabb6 | |||
| 776653dd7c | |||
| 9b8be3b8a5 | |||
| d755b70e25 | |||
| 0c4673a89d | |||
| 1b000c92f3 | |||
| eb8cfdf8cc | |||
| 2da2c85f27 | |||
| 359a7253e9 | |||
| 64bbfe9ed3 | |||
| e6dc105134 | |||
| 866029aaa2 | |||
| 85a60c1af6 | |||
| 683535a18f | |||
| d67c8e6231 | |||
| 2841210fb2 | |||
| 170f2555ce | |||
| 6b523d6839 | |||
| 06c9479a3f | |||
| d7ef5280c5 | |||
| f595f38e1c | |||
| a3ee8957f4 | |||
| be2168f70d | |||
| 93066ab60c | |||
| 90ef106e5f | |||
| 02ac56d12f | |||
| 261d00fbb2 | |||
| e2935aff95 | |||
| a95f30f186 | |||
| 429c2b44b5 | |||
| 28b8da3126 | |||
| 9ddbcac775 | |||
| 9628e60ca0 | |||
| bcdee6e0bb | |||
| c2e69ed724 | |||
| 94d23338fe | |||
| 728100c26d | |||
| b470aebe80 | |||
| 05f62b09e0 | |||
| 5d1c33fc82 | |||
| d26de76097 | |||
| 65784cae2f | |||
| 003d388b78 | |||
| 562d066c0e | |||
| eaf6ef741c | |||
| 3026cca31a | |||
| f0095a1ae6 | |||
| aca93d1557 | |||
| 6fffd745fd | |||
| 4a7a8f31f8 | |||
| a1a801fb31 | |||
| 2a6e7105cc | |||
| 035e065b27 | |||
| 67bda4dfd1 | |||
| aba05eb951 | |||
| b8bae7222a | |||
| 32eea80c98 | |||
| fa19a49db9 | |||
| 6ef3d71e02 | |||
| bd6e8ef567 | |||
| 5df84bbaf5 | |||
| eaea3e9087 | |||
| c03a43c88c | |||
| b32448f713 | |||
| f3a23d1c75 | |||
| 2dc406ae86 | |||
| 293ed5fab7 | |||
| d2456921ca | |||
| 93d1e09bf7 | |||
| dddae33285 | |||
| 1eec6d90b7 | |||
| 405217c3e5 | |||
| 86342b8c5c | |||
| 95ba99d710 | |||
| dd2e44bb12 | |||
| 506f79c092 | |||
| 2b7159f363 | |||
| 895264c4cd | |||
| 48ba6ff3c6 | |||
| f103468dba | |||
| dca332201f | |||
| fe3fb381b1 | |||
| 0778d24801 | |||
| 79f53a0999 | |||
| dba3a226f6 | |||
| b72165fd30 | |||
| 8e26fe9388 | |||
| c8c9534022 | |||
| aae2c5e417 | |||
| 2cc6615c2d | |||
| 9c5b3beb73 | |||
| 14acdc2a6d | |||
| bcb67cc2ec | |||
| a8e5bfca73 | |||
| b68d42e5ec | |||
| 1ca2c5299c | |||
| 7d652d0e1f | |||
| 5f98396460 | |||
| bffa846a55 | |||
| 62da9deb29 | |||
| d17bc410a9 | |||
| fe210ece6d | |||
| e8d214716d | |||
| a4d1b5b6a9 | |||
| 8589cdfb84 | |||
| 4a34a258e1 | |||
| 3a951bc8c3 | |||
| 4fa051c9fc | |||
| 31d6873f7d | |||
| 545232be37 | |||
| c1dee61482 | |||
| ad182057b9 | |||
| bfe7792592 | |||
| be2deb8c6f | |||
| cecb1d8b66 | |||
| 427bd730f0 | |||
| 10b8faeba3 | |||
| 649ab0ef91 | |||
| 8be7bb0201 | |||
| 67d5051792 | |||
| 7e8f87dc57 | |||
| 84016f036e | |||
| 5f90d06452 | |||
| 27772ddba1 | |||
| e1b49238ba | |||
| ba35509ca0 | |||
| 32f11961e9 | |||
| 4dda001210 | |||
| f49d5c2f29 | |||
| afde0f8073 | |||
| 2897d3b22e | |||
| 9bcb2ffe68 | |||
| 6af571eb40 | |||
| a5f472c23e | |||
| 34efb90489 | |||
| f060702676 | |||
| d6b1d03695 | |||
| e181015fd1 | |||
| 387e86729c | |||
| 64ff25f380 | |||
| 1dba7f7f04 | |||
| 7d9b28e20d | |||
| 48bcc83e2e | |||
| 1e3cb3e36e | |||
| 4d6664e4ca | |||
| d56dc310b0 | |||
| 4ab612ea67 | |||
| 73f06753b6 | |||
| 292177e085 | |||
| d7111c7326 | |||
| 745184f2fc | |||
| 942f11169c | |||
| 029cf29b49 | |||
| 7ad059aec9 | |||
| a2a00aa9ee | |||
| 59551c59ab | |||
| bf1b09698c | |||
| fc2142b407 | |||
| d3b2c715d3 | |||
| 09308fceb1 | |||
| 8f87509f7d | |||
| c962e5e8cd | |||
| 7df858594d | |||
| fed9605357 | |||
| bf1886e90a | |||
| dfa9afd39f | |||
| 944c658c90 | |||
| 8f8df03358 | |||
| 92fc868aa9 | |||
| 33281cf3bc | |||
| d64816437a | |||
| 8210e94b6d | |||
| f6d969f98a | |||
| 59faca3850 | |||
| 29a2f33664 | |||
| 9d4d7932ee | |||
| 54a207cb8b | |||
| 5bf5de49a5 | |||
| cee995e776 | |||
| b86c75544e | |||
| 249318cffb | |||
| 6f8ee10a86 | |||
| 30cb1238f7 | |||
| db999b2a98 | |||
| e59decda95 | |||
| aca80f2054 | |||
| 0b2efd60b9 | |||
| 54f613e4dd | |||
| ae07e36a7d | |||
| 18fe82ab26 | |||
| 372badfc1b | |||
| 1781b4d323 | |||
| cf5dc813e2 | |||
| b0c8c466b0 | |||
| 85aaed2ccb | |||
| 110efa3598 | |||
| 9fb41f8378 |
@@ -429,6 +429,20 @@ Original SolidCraft drawings, Open for owner review; no runtime assignments.
|
||||
| assets/icons/ui/design/svg/model/status_recovery.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/model/frame_member.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/model/render_environment.svg | SolidCraft contributors | original Studio icon master (64 grid): dome with a grey cube inside | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/style_shaded.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/style_wireframe.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/style_hidden_edges.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/style_translucent.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/select_faces_edges.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/select_bodies.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/select_features.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/select_parts.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/select_components.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/select_sketch.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/display.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/grid.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/ground_shadow.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/flat/ambient_occlusion.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/model/placeholder.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/model/plane.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/model/plane_angle.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
|
||||
@@ -581,6 +595,14 @@ Original SolidCraft drawings, Open for owner review; no runtime assignments.
|
||||
| assets/styles/ui/themes/cga.json | SolidCraft contributors | original SolidCraft theme file using the 16 colours of the IBM Color Graphics Adapter (black, cyan, magenta, and white of its high-intensity palette 1 for the interface) | MIT OR Apache-2.0 |
|
||||
| assets/styles/ui/themes/1-bit.json | SolidCraft contributors | original SolidCraft theme file | MIT OR Apache-2.0 |
|
||||
| assets/styles/ui/themes/1-bit-dark.json | SolidCraft contributors | original SolidCraft theme file | MIT OR Apache-2.0 |
|
||||
| `assets/locales/pending/navbar-customisation.json` | SolidCraft contributors | Original navigation bar editor translations | MIT OR Apache-2.0 |
|
||||
| `assets/locales/pending/navbar-slots.json` | SolidCraft contributors | Original navigation slot translations | MIT OR Apache-2.0 |
|
||||
| assets/locales/bs.json | Tarik Sijercic (tsijercic1) | Original Bosnian translation of SolidCraft's English catalog; no commercial CAD text used | MIT OR Apache-2.0 |
|
||||
| assets/locales/hr.json | Tarik Sijercic (tsijercic1) | Original Croatian translation of SolidCraft's English catalog; no commercial CAD text used | MIT OR Apache-2.0 |
|
||||
| assets/locales/sr.json | Tarik Sijercic (tsijercic1) | Original Serbian (ekavian, Cyrillic) translation of SolidCraft's English catalog; no commercial CAD text used | MIT OR Apache-2.0 |
|
||||
| assets/icons/ui/design/svg/model/finish_edit.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
|
||||
| `assets/locales/pending/sketch-tracking-guides.json` | SolidCraft contributors | Original alignment-guide preference labels and help text | MIT OR Apache-2.0 |
|
||||
| assets/locales/pending/point-clouds.json | SolidCraft contributors | Original point-cloud UI strings and translations | MIT OR Apache-2.0 |
|
||||
|
||||
## Code adapted from sibling projects
|
||||
|
||||
|
||||
@@ -268,7 +268,9 @@ a conflict. `crates/doc/src/format/pending/README.md` has an example.
|
||||
|
||||
**At release time** the maintainer runs `scripts/fold-format-pending.sh`, which moves the pending
|
||||
files into `crates/doc/src/format/v<N>/` and fixes that number for good (see
|
||||
[docs/releasing.md](docs/releasing.md)). Never add a file to a `v<N>/` folder afterwards.
|
||||
[docs/releasing.md](docs/releasing.md)). Never add a file to a `v<N>/` folder afterwards. Drawings
|
||||
follow the same rules with their own numbers, from 1, in `crates/doc/src/drawing/format/` (see its
|
||||
`pending/README.md`), and the same script folds them.
|
||||
|
||||
## Lists many changes add to
|
||||
|
||||
@@ -287,6 +289,9 @@ and a fresh CI run:
|
||||
- **Toolbar commands without help** (`BACKLOG` in `crates/ui-egui/src/command_help.rs`): sorted,
|
||||
one id per line, and it only shrinks. Writing a command's help removes its line; a new command
|
||||
is never added to it.
|
||||
- **`ui.prefs` settings** (`docs/control-protocol.md`): one line per setting, sorted by name, in
|
||||
the list under the protocol table; add a new setting on its own line rather than editing a shared
|
||||
row.
|
||||
- **Languages** (`crates/ui-egui/src/i18n.rs`): one per line, English first, then by id (a test
|
||||
checks it).
|
||||
- **Generated files**: `THIRD-PARTY-LICENSES.txt` and `docs/features.md` are rewritten on `main`
|
||||
|
||||
@@ -1692,9 +1692,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"r-efi 6.0.0",
|
||||
"rand_core 0.10.1",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4208,7 +4210,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"eframe",
|
||||
@@ -4238,15 +4240,16 @@ dependencies = [
|
||||
"ureq",
|
||||
"windows-sys 0.61.2",
|
||||
"winit",
|
||||
"x11rb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-3dx-client"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-cli"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"image",
|
||||
"log",
|
||||
@@ -4258,7 +4261,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-derive"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4267,7 +4270,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-doc"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
@@ -4284,7 +4287,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-engine"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"image",
|
||||
"log",
|
||||
@@ -4305,7 +4308,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-geom"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -4314,7 +4317,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-gpu"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"image",
|
||||
"log",
|
||||
@@ -4334,7 +4337,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-io"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"cadmpeg-core",
|
||||
"cadmpeg-ir",
|
||||
@@ -4358,7 +4361,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-kernel"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"proptest",
|
||||
@@ -4378,7 +4381,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-mcp"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
"solidcraft-engine",
|
||||
@@ -4387,7 +4390,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-render"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"image",
|
||||
"moxcms",
|
||||
@@ -4401,25 +4404,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-sketch"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"harfrust",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"solidcraft-geom",
|
||||
"thiserror 2.0.21",
|
||||
"ttf-parser",
|
||||
"unicode-bidi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-space-mouse"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-ui-egui"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"egui",
|
||||
@@ -4449,7 +4454,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solidcraft-web"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"eframe",
|
||||
"egui",
|
||||
@@ -4918,9 +4923,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "typed-path"
|
||||
version = "0.12.3"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"
|
||||
checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e"
|
||||
|
||||
[[package]]
|
||||
name = "typeid"
|
||||
@@ -5994,7 +5999,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7"
|
||||
|
||||
[[package]]
|
||||
name = "xtask"
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"serde",
|
||||
@@ -6292,16 +6297,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "9.0.4"
|
||||
version = "9.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a954114b47a54df49f83d2722814e86b23d4bb1b54a1b90fb7d92b41619ddc22"
|
||||
checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"getrandom 0.4.3",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"nix 0.31.3",
|
||||
"typed-path",
|
||||
"windows-sys 0.61.2",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ members = ["crates/*", "apps/*", "xtask"]
|
||||
exclude = ["vendor"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.25.1"
|
||||
version = "0.26.0"
|
||||
edition = "2024"
|
||||
license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.95"
|
||||
@@ -80,7 +80,7 @@ cadmpeg-ir = "=0.6.3"
|
||||
cadmpeg-registry = { version = "=0.6.3", default-features = false, features = ["fcstd", "rhino", "step"] }
|
||||
|
||||
# fonts (sketch text outlines; MIT OR Apache-2.0, pure Rust)
|
||||
ttf-parser = { version = "0.25", default-features = false, features = ["std"] }
|
||||
ttf-parser = { version = "0.25", default-features = false, features = ["std", "variable-fonts"] }
|
||||
|
||||
# Ends a process group with the system call (MIT; already in the tree through zip).
|
||||
nix = { version = "0.31", default-features = false, features = ["signal"] }
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
- **Web:** [try it in your browser][web-app], no install.
|
||||
|
||||
ARM64 and 32-bit builds, portable zip, .deb, .rpm, Flatpak and the other packages are on the
|
||||
[downloads page](docs/downloads.md). The downloads aren't signed yet: on Windows choose
|
||||
**More info**, then **Run anyway** in SmartScreen; on macOS right-click SolidCraft and choose **Open**
|
||||
the first time. On SolidCraft 0.11 to 0.14, download once by hand; see
|
||||
[downloads page](docs/downloads.md). The macOS app is signed with a Developer ID and notarized by
|
||||
Apple. The Windows downloads aren't signed yet: choose **More info**, then **Run anyway** in
|
||||
SmartScreen. On SolidCraft 0.11 to 0.14, download once by hand; see
|
||||
[updating](https://docs.solidcraft.io/guide/updates.html#updating-from-011-to-014).
|
||||
|
||||
## What works
|
||||
|
||||
@@ -80,3 +80,697 @@ permanently.
|
||||
- Discord: <https://discord.gg/FtU4NQNVDH>
|
||||
- Releases: <https://github.com/tangency-labs/solidcraft/releases>
|
||||
- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
Status as of **2026-10-14**. SolidCraft supports parametric modelling (sketch →
|
||||
features → parametric timeline) as an open, pure-Rust, agent-drivable application.
|
||||
|
||||
## At a glance
|
||||
|
||||
| Question | Answer |
|
||||
|---|---|
|
||||
| Where are we? | **M0 and M13 done; M1, M2, M5–M7, M9, M10, M14 in progress.** Sketch with solver and the full SKETCH create/modify set; extrude, revolve (two sides, symmetric, to object), fillet/chamfer (variable radius, chord length, a radius per edge, corner patches), holes, threads (cosmetic and modelled), patterns, mirror, shell (inside/outside/both), draft, loft, sweep, coil, split body and split face, delete face, construction planes, axes and points; persistent naming of faces and edges; parameters and configurations; components, joints, motion studies, exploded views; sheet metal and a plastic enclosure subset; STEP/IGES/3MF/STL/OBJ/DXF; FreeCAD/Rhino import; autosave and crash recovery; desktop and browser (wasm) app, CLI, MCP server. |
|
||||
| Features | Every registered command by area — [docs/features.md](docs/features.md) (`cargo xtask features`); registry breadth does not establish workflow or geometric depth |
|
||||
| Reference tests | [Current case count and results](docs/oracle.md): public cases in `tests/oracle/` with analytic or FreeCAD-computed expected values, checked by the reference-test job in [CI](.github/workflows/ci.yml). |
|
||||
| Tests | Solver, profiles, kernel booleans/blends/measures, expressions, timeline, persistent naming, file formats and migrations, assemblies, sheet metal, engine end-to-end, hostile-input fuzz over every command and headless UI scenarios. `cargo xtask ci` reports the current passing counts. |
|
||||
| Gates | `cargo xtask ci`: fmt, clippy -D warnings, tests, asset attribution, layering, wasm32 build — green |
|
||||
| Time to a useful alpha (M0–M6) | ≈ **82 agent hours** remain (sum of the M1–M6 estimates below) |
|
||||
|
||||
Optional GPU viewport ambient occlusion is available in View settings and Graphics preferences,
|
||||
with persistent settings, Performance/Quality graphics presets (Quality combines AO, Fine tessellation and adaptive 2× supersampling; manual combinations show Custom), and the
|
||||
`view.ambient_occlusion` and `view.graphics_preset` commands. See [display settings](docs/ambient-occlusion.md).
|
||||
|
||||
## Scope (owner decision, 2026-10-07)
|
||||
|
||||
The issue batch adds preservation of blind pockets in through cuts, associative projected
|
||||
offsets and plastic face placements, XZ (+Y normal) with a v6 migration preserving older
|
||||
designs, interactive angle placement, file-picker sketch imports, Home/recent controls,
|
||||
toolbar overflow, and the remaining component-frame and assembly WIP work. The enclosure
|
||||
acceptance scenarios now include board resizes; STEP reopening is automated. See [WIP reconciliation](docs/wip-reconciliation.md).
|
||||
Face-based Extrude Join (including outward Press Pull) now defaults to the picked body,
|
||||
so edge-touching assembly neighbours stay separate regardless of body order (#226).
|
||||
|
||||
In scope, in priority order:
|
||||
1. SOLID and SKETCH (now).
|
||||
2. Parameters / functional constraints (done: see `parameters.*`, `expr.evaluate`; unit-aware,
|
||||
cycles reported with their path, rename follows references, deletes list their users):
|
||||
user parameters with units and expressions (+-*/, ^,
|
||||
parentheses, sin/cos/sqrt/min/max/floor/ceil/round, unit conversion), model parameters
|
||||
d1, d2… for every dimension and feature input, references between parameters with a
|
||||
dependency graph and cycle detection, re-evaluation on change, comments, favourites,
|
||||
CSV/JSON import and export.
|
||||
3. Components and assemblies with joints (M9).
|
||||
4. SHEET METAL: flange, contour flange, bend, unfold/refold, flat pattern with DXF export, sheet
|
||||
metal rules (thickness, K-factor, bend radius) (M10).
|
||||
5. A small PLASTIC subset for enclosures, after sheet metal: Boss, Rib, Web, Lip/Groove, Snap Fit.
|
||||
|
||||
Deferred until further notice: MESH, FORM (T-splines), SURFACE beyond what solids need (scope proposed in #772), PCB / 3D
|
||||
PCB / Package, Render, Animation, Simulation, Manufacture/CAM, Drawings.
|
||||
|
||||
## Milestones
|
||||
|
||||
| # | Milestone | Status | Hours left |
|
||||
|---|---|---|---|
|
||||
| M0 | Vertical slice | done | — |
|
||||
| M1 | Sketch depth: command coverage implemented — projection/intersect/include as linked geometry (auto-project on faces, lost-reference warnings, break link), full SKETCH create/modify set (slots, polygons, tangent arcs/circles, ellipse, fit/control splines, conic, text, trim/extend/break, fillet/chamfer, offset, mirror, patterns, move/scale, blend curve, centerline), constraints incl. curvature and polygon with over-constraint refusal, Shift-picked line midpoints in Horizontal/Vertical using persisted points and ordinary constraints (#2087), driven/arc-length/linear-diameter dimensions, AutoConstrain, DXF/SVG insert, 3D sketch curves (Project To Surface, Intersection Curve, Isoparametric Curve, Spun Profile), exact free-form profiles (B-spline/NURBS edges, any spline degree, curves cut by crossings), sweeps and pipes along 3D sketch curves, canvases and decals, curvature combs. Exact free-form Extend and certified associative offsets now preserve geometry and IDs through edits, deletion and reopen. Occurrence-frame 3D wires now store explicit coordinate spaces and retain points and analytic fits through moves, refresh, undo and reopen. Constructive sketch solving (Owen 1991, Fudos & Hoffmann 1997) ahead of the numerical solver: points and rigid clusters are placed on the branch the sketch had, so dimension edits and drags keep their solution; edits that would turn a sketch over are refused; drags re-solve only the sketch per frame. Remaining workflow repairs: mixed offset junctions, legacy natural-spline seams, and damaged legacy wire links lacking frame provenance | in progress | 4 |
|
||||
| M2 | Robust modelling: coplanar booleans in the kernel, holes (placed on faces, at distances from reference edges, and on sketch points), threads (cosmetic, then modelled), patterns, mirror, shell, draft, split, construction geometry | in progress | 16 |
|
||||
| M1 | Sketch depth: command coverage implemented — projection/intersect/include as linked geometry (auto-project on faces, lost-reference warnings, break link), full SKETCH create/modify set (slots, polygons, tangent arcs/circles, ellipse, fit/control splines, conic, text, trim/extend/break, fillet/chamfer, offset, mirror, patterns, move/scale, blend curve, centerline), constraints incl. curvature and polygon with over-constraint refusal, Shift-picked line midpoints in Horizontal/Vertical using persisted points and ordinary constraints (#2087), drawing snaps to where two lines, circles or arcs cross (#4967), driven/arc-length/linear-diameter dimensions, AutoConstrain, DXF/SVG insert, 3D sketch curves (Project To Surface, Intersection Curve, Isoparametric Curve, Spun Profile), exact free-form profiles (B-spline/NURBS edges, any spline degree, curves cut by crossings), sweeps and pipes along 3D sketch curves, canvases and decals, curvature combs. Exact free-form Extend and certified associative offsets now preserve geometry and IDs through edits, deletion and reopen. Occurrence-frame 3D wires now store explicit coordinate spaces and retain points and analytic fits through moves, refresh, undo and reopen. Constructive sketch solving (Owen 1991, Fudos & Hoffmann 1997) ahead of the numerical solver: points and rigid clusters are placed on the branch the sketch had, so dimension edits and drags keep their solution; edits that would turn a sketch over are refused; drags re-solve only the sketch per frame. Remaining workflow repairs: mixed offset junctions, legacy natural-spline seams, and damaged legacy wire links lacking frame provenance | in progress | 4 |
|
||||
| M2 | Robust modelling: coplanar booleans in the kernel, holes (placed on faces and on sketch points), threads (cosmetic, then modelled), patterns, mirror, shell, draft, split, construction geometry | in progress | 16 |
|
||||
| M3 | General fillets and chamfers (curved edges, chains, vertex blends); saddle rolling-ball surfaces now use continuous seam sections and arc-length fitting with shared contact boundaries and bounded accuracy checks; tiny rim edges remain selected instead of nearby wall seams when filleting (#2498) | in progress | 30 |
|
||||
| M4 | Files: STEP import (done — [docs/step-import.md](docs/step-import.md)), FreeCAD/Rhino solids through cadmpeg (done, desktop, browser and CLI), 3MF export and 3MF/STL import as mesh bodies (done), 3MF with B-rep face tags ([docs/formats/3mf-face-tags.md](docs/formats/3mf-face-tags.md), done), constant-section parametric mesh reconstruction, DXF sketches, OBJ import, PLY/XYZ point clouds as a modelling reference and PLY meshes (done — [docs/point-clouds.md](docs/point-clouds.md), #5151) | in progress | 6 |
|
||||
| M5 | Persistent naming of faces and edges (docs/book/src/dev/naming.md): faces named from their exact kernel-reported history (sketch curve sides, caps, revolve sections, primitive sides, blends, shell inner walls, pattern/mirror copies; split pieces told apart by the faces around them, lumps of a cut body named after their faces), edges by their faces; fillets/chamfers, sketches on faces, shell/draft/offset/replace faces, hole placements, joint origins and face appearances resolve by name first and warn when the entity split or vanished: done. sheet metal edges by base sketch line and flange side, shell inner faces, sweep and loft roles: done. kernel-reported face history: done (merged faces answer to every name; operations without history yet fall back to geometric names, flagged unverified; format 14 keeps older designs' geometric names). Left: history through sheet metal, plastic, surface and emboss features; FaceSource certificates through history | in progress | 20 |
|
||||
| M6 | UI depth: selection feedback and origin (done), timeline editing (done: hover and selection highlight modifier faces, including fillets and chamfers; edit feature, history marker drag, dependency-checked single and multi-item reorder, suppress, rename, delete with dependents, re-resolved references; redefining selections refreshes persistent edge/face references while retaining feature identity and dimension names; responsive feature history with width-driven icons/names/title, snapping width resize, bottom/left/browser-stack docking, shared-column collapse, rollback bar, multi-selection and persistent folders), right-docked dialogs (done), live previews for every feature dialog (done), keyboard-first commands with on-canvas value boxes and sketch inline dimensions (done), drag manipulators with automatic join/cut (done: extrude incl. two sides, fillet, shell, hole depth, move, pattern spacing, revolve rotator, extrude taper), dark theme (done), right-click menu with Repeat (done), measure tool (done), section analysis (done), selection filter (done), drag-solve of sketch points (done); appearance controls now preserve body/face/component targeting, named transparent looks, reuse/search and override removal; Browser Expand All / Collapse All (`browser.expand_all`, `browser.collapse_all`) on the design and component menus; preferences | in progress | 6 |
|
||||
| M7 | Thin extrude (walls along open or closed curves: centre, inside, outside or two sides; mitred corners, crossing walls joined; #721), sweep, loft (incl. to a point), rib and web (to next / depth), emboss (planar faces and exact radial emboss/deboss of bounded orthogonal profiles on complete exterior cylinders/sleeves), thread (cosmetic, and modelled M3–M20 outside and inside: the ISO profile screwed in as a faceted cut), coil (smooth B-spline helical walls), pipe, pattern on path, patterns of bodies and components, replace face (parallel), align, remove, feature copy/paste: done. Unique eligible cylindrical targets are inferred for new Emboss features. Left: general curved-face emboss and exact (unfaceted) modelled threads | in progress | 12 |
|
||||
| M8 | Surface workspace (#772). Done: Patch (sketch regions; edge loops filled G0, plus `crown`), Stitch, Thicken (planes and cylinders), Extend (straight edges of planar surfaces), Trim (by a plane, a face or sketch curves swept onto the surface, keeping a side or the picked regions; mutual trim of two surfaces, extended to meet and stitched, #767), Delete Face (healing), Boundary Fill, zebra/draft/curvature-map analysis, Surface Extrude/Revolve/Sweep/Loft from open and closed curves, Offset, Unstitch and Reverse Normal; the continuity-driven core (`kernel/src/bridge.rs`, G0–G3 Hermite rows) with **Blend** (`surface.blend`, #764: edge chains along one or several faces, closed rims paired seam to seam or from picked seams, a dialog), **Match** (`surface.match`), **Boundary** (`surface.boundary`, #763 — two sketch curves exact with G0–G3, three or four as the flat patch of their loop, and curve networks: Coons and Gordon surfaces through sketch, 3D-sketch or edge curves, a point for a three-sided side, G1/G2 against the faces along one direction's edges, joined into their body on request; G1/G2 on two sides that meet at a corner waits for the Gregory-type corner), **Fair** (`surface.fair`, CV fairing), **continuity analysis** (`inspect.continuity`, #770; a toolbar tool with edge markers and a legend, and curvature combs along face isocurves) and a multi-section **loft** with per-end continuity and crown, and guide rails on solid and surface lofts (one or two, scaling or stretching the sections between; #201). Also in the Class-A pass: G1…G4 blend curves in the sketch, chord and variable-radius fillets on curved edges (with honest refusals where the fit cannot hold), and a G2 corner patch where filleted edges meet (kernel; the command refuses until the patch's sections can be sewn to the blends' contacts). Left: bias/form-factor fillet sections (design recorded), a Gregory-type corner, surface Fillet between separate surface bodies (#769), Ruled (#762), Untrim (#761), curved-face Extend (#760), and every remaining #757–#772 item | deferred | — |
|
||||
| M9 | Components and assemblies: New Component / Create Components from Bodies, active component, per-component origin/bodies/sketches/timeline entries, occurrences with transforms, Copy/Paste vs Paste New, nested Browser tree with visibility and isolate; Ground, Move/Copy of occurrences, joints (rigid, revolute, slider, cylindrical, pin-slot, planar, ball) by joint origins with limits and Drive Joints, closed kinematic loops (four-bar, slider-crank: the loop's other joints follow the driven one on its branch, and driving stops where a loop can no longer close), cams (`joint.cam`: a revolute cam drives a slider or revolute follower along a closed sketch profile or the cam's edges, knife, roller or flat followers, worked out again when the profile changes; drives, studies, closed loops, contact sets), As-built Joint, Rigid Group, Contact Sets (driving and motion studies stop where bodies in a set would pass through each other), Motion Study (joint values keyed along a timeline, playback, export of occurrence positions as JSON/CSV), motion analysis (joint values and a point's path charted over a study as value, velocity and acceleration; the parts that collide along a study, with the steps where they do), Exploded views (automatic or by hand, shown without changing placements, and exported as an animation coming apart and back together); interference, per-component physical properties; STEP with assembly structure; URDF export for robot simulators (links with meshes, mass and inertia; joint chains whose values match Drive Joints; docs/urdf.md). Physical properties now measure material-aware component/occurrence placements, descendants and repeated instances, including pending moves and body reassignment offsets; contact geometry and automatic exploded centres respect those offsets. Groundwork done: component tree, occurrences with transforms (instances, Paste New), world placement, active component as authoring frame, ground, Capture/Revert Position, moving bodies and sketches. UI: ASSEMBLE panel dialogs for New Component, Joint (snaps on faces, edges, circles and vertices; animated motion preview; offsets, flip, limits), As-built Joint, Joint Origin, Rigid Group, Drive Joints (live slider), Motion Link, Cam and Interference (overlaps shown red); joints in the timeline and the Browser | in progress | 32 |
|
||||
| M10 | Sheet metal: flange (base, edge, contour), hem, unfold/refold, convert, flat pattern + DXF, rules: done. PLASTIC enclosure subset: Boss, Rib, Web, Lip/Groove, Snap Fit, Rest, Plastic Rules (library, edit, assign; rule draft and clearance as feature defaults): done, tested against hand-computed geometry. UI: SHEET METAL and PLASTIC tabs with dialogs (live preview, Edit Feature, pre-selection) for Flange, Hem, Unfold/Refold, Convert, Sheet Metal Rules, Create Flat Pattern (flat view with bend lines, bend table CSV/JSON and DXF export with exact circle/arc/line cutouts), Boss, Lip/Groove, Snap Fit, Rest, Manage and Assign Plastic Rules; Fold (bend along a sketch line); flanges meeting at a corner closed at any angle with the rule's gap; edge flanges with their own angle and height per edge in one feature; corner reliefs (notch, round, rectangular, tear) chosen by the rule; Convert to Sheet Metal from a solid or shelled body by its bend edges (flat faces, sharp bends) | in progress | 36 |
|
||||
| M11 | 2D drawings | deferred | — |
|
||||
| M12 | Release: cross-platform packages, verification and deliberate publication implemented; original current-UI demo refreshed. Trusted distribution signing and broader performance work remain | in progress | 16 |
|
||||
| M14 | Configurations: a table of rows (parameter expressions and feature suppressions per row) switched with config.activate (undoable, all or nothing), kept through parameter renames and feature deletes (config.configure, config.table, config.column/row/activate). Per-row body materials and appearances (library looks, custom colour/opacity and clearing overrides), undoable activation and save/reopen: done. Ordered typed configuration rules, atomic validation and structured rule editing: done. Component appearance and certified semantic face style columns, atomic preview/apply and independent-copy remapping: done. Exact constructed sketch-side and immutable imported-face lineage now preserve legacy names and reject retargeting. Left: ambiguous shifted/two-sided caps | in progress | 4 |
|
||||
| M13 | Never lose work: atomic saves (temporary file, flush, rename; a crash at any moment leaves the old file or the new one) with the replaced version kept as `<file>.bak`; autosave of unsaved changes to the recovery folder every 5 minutes (preference) and after big operations, only when something changed; "Recover unsaved design?" on the next launch (`doc.recovery_list`, `doc.recover`, `doc.recovery_discard`); a kill-mid-save test (process killed while saving a 0.5 MB design 25 times). File format: `"format": "solidcraft/12"`, older formats upgraded step by step (`doc::format`), newer ones refused with a message, out-of-range numbers and broken placements refused; a corpus of designs saved by M0, components-era, joints-era and current builds (apps/solidcraft-cli/tests/corpus) that must open and evaluate as saved; damaged and hostile variants (truncation, bit flips, hostile values, removed keys, repeated features, deep nesting) never panic | done | 6 |
|
||||
| M15 | Frames and weldments (#4003): structural members along 2D and 3D sketch lines, butt and mitre corners, trim to faces and bodies, end caps, gussets, cosmetic welds and a cut list. Done: the profile library (`frame.profile.list`, `frame.profile.properties`, `frame.profile.insert`): bar, round bar, rectangular and round tube, angle, channel and I-beam, each SolidCraft's own parametric definition with exact fillet arcs and exact section properties (area, centroid, second moments), tested against hand-computed values; members (`frame.member`): one body per straight line of a 2D or 3D frame sketch, following parameter edits, with a built-in profile (its dimensions parameter expressions) or a profile sketch (its drawn material by alternating nested loops), anchor, angle and mirror; each member's name kept with its line. Left: corners, trims, end caps, gussets, welds, cut list, FRAME tab and dialogs | in progress | 60 |
|
||||
|
||||
M6 navigation preferences include **Touchpad**: Shift + pointer movement pans, Alt/Option +
|
||||
pointer movement orbits without a mouse button, and vertical scrolling zooms. Other presets
|
||||
retain their saved two-finger scroll preference; camera motion is available through
|
||||
`view.navigate` and modifier-aware `ui.move` automation.
|
||||
With the **Fusion** preset and two-finger pan enabled, two fingers pan and Shift + two fingers
|
||||
orbit freely, with pinch zoom and mouse bindings unchanged. The shared navigation handler
|
||||
applies the same gestures to model and Render views and blocks orbit on flat pages.
|
||||
|
||||
UI redesign (#2016): the File/start view (#2027) uses shared light/dark navigation,
|
||||
action tiles, recent rows and sample cards, with recovery review and Save As/Export
|
||||
entry points. Document loading, sample caches and recovery safety retain their
|
||||
existing command paths.
|
||||
|
||||
M11 precursor: File → Export Current View as DXF exports shown placed bodies and sketches from the current
|
||||
camera as a 2D millimetre drawing, with hidden edges omitted or dashed. Vector occlusion splits
|
||||
partly hidden edges and includes curved silhouettes. Repeated part meshes and triangle
|
||||
hierarchies are shared; bounded desktop preparation and occlusion use up to eight workers.
|
||||
Curves are approximated; drawing sheets,
|
||||
annotations and exact projected curves remain deferred. See [view DXF](docs/view-dxf.md).
|
||||
|
||||
Drawing foundations: [RFC #860](https://github.com/tangency-labs/solidcraft/issues/860)
|
||||
and the [foundation ledger](docs/drawing-foundations.md) track the bounded implementation
|
||||
packages. The first geometry increment defines validated section records in a plane-local
|
||||
frame; the ledger separates that contract from section producers and the Drawing workspace.
|
||||
|
||||
Desktop view DXF export runs in the file-operation worker with five-stage progress and
|
||||
cooperative cancellation. Curve tolerance (0.0001–1 mm, default 0.01 mm) is remembered alongside
|
||||
the hidden-edge setting. Cancelled exports preserve the model and the previous destination;
|
||||
completed drawings publish atomically. The browser still exports synchronously.
|
||||
|
||||
## Interactive modelling
|
||||
|
||||
- Modelled threads preview their cut before OK using the background worker on desktop.
|
||||
Browser users apply the cut with OK to avoid blocking on every edit.
|
||||
|
||||
- Thread resolves a suggested metric size when a cylindrical face is picked. Diameter and
|
||||
pitch selectors expose the existing metric designation parameter; custom designations stay
|
||||
editable, and Automatic size returns to the face's suggestion. Cosmetic/modelled and
|
||||
full/partial-length options remain available. This does not add tolerance classes or
|
||||
left-hand threads.
|
||||
- New Body extrusion and face-offset previews show completed intermediate geometry while a
|
||||
drag continues, then catch up to the exact final value. Changes to the selected geometry,
|
||||
operation or feature still discard obsolete results. Distance arrows and their value boxes
|
||||
follow the current frame's input.
|
||||
- Large fine modelled threads use pitch-based helix resolution and tighter faceted
|
||||
reconstruction fallbacks, preserving thin crests and closed shells on large shafts.
|
||||
|
||||
## Physical material data
|
||||
|
||||
- Physical material card validation (#923/#922) provides typed SI mechanical and
|
||||
thermal data, per-property sources/conditions and isotropic/orthotropic stability
|
||||
checks through read-only `material.properties.validate`. It does not assign or
|
||||
persist properties, provide a solver or enable rendering; see
|
||||
[the contract and staged follow-ups](docs/physical-material-cards.md).
|
||||
|
||||
- Directional elasticity (#994) queries the validated card in material-local axes
|
||||
through read-only `material.properties.directional`, with source/condition review.
|
||||
It does not assign body frames, predict structural behavior or enable a solver.
|
||||
|
||||
## Library foundations (#785, #786, #787)
|
||||
|
||||
- Local scalar libraries (#846) inspect/export bounded portable catalogs and copy exact
|
||||
selected appearance/material revisions into existing design definitions in one undo step.
|
||||
Appearance offers local loading/search/export; physical materials use existing commands.
|
||||
This slice is independent of the render stack and does not change the document format.
|
||||
See [the contract and limits](docs/book/src/dev/local-libraries.md).
|
||||
|
||||
- Proposed phases cover offline bundled/project/user packs, physical materials and
|
||||
appearances, editable wood mapping, and parameterized component/assembly families.
|
||||
Stable identity/revision, copied design definitions, provenance and resource limits
|
||||
apply from the first implementation. Existing material, appearance and standard-part
|
||||
commands remain the application paths. See [the proposal](docs/book/src/dev/libraries.md)
|
||||
for source/license review and acceptance gates. This is planning only: pack loading,
|
||||
texture rendering and expanded component families are not implemented by this entry.
|
||||
|
||||
## Render foundation
|
||||
|
||||
- Original starter appearances (#1722): 34 opaque recipes through existing commands, with six explicitly unavailable glass recipes and preserved legacy looks; see [the contract](docs/render-starter-appearances.md).
|
||||
|
||||
- Bounded linear film accumulation (#1696) supplies caller-admitted mean/variance storage and complete-pass views; actual progressive consumers remain separate. See [the film contract](docs/render-film.md).
|
||||
|
||||
- Definition-local visual mapping (#1214) supplies a bounded numerical frame, physical repeat coordinates and a deterministic one-time grain-axis suggestion. It adds no saved record or texture consumer; see [the mapping contract](docs/render-visual-mapping.md).
|
||||
|
||||
- Explicit texture normalization (#1218) produces completed float RGBA with
|
||||
role-aware linear color/data semantics, bounded matrix/TRC ICC conversion and
|
||||
opt-in EXIF orientation. It retains high-precision raw samples and records lossy
|
||||
gamut clipping only when explicitly requested. It is not a renderer/resource
|
||||
consumer; see [the supported policy and limits](docs/render-texture-normalization.md).
|
||||
|
||||
- Opt-in opaque PBR (#1046) connects persisted surface parameters to the integrated
|
||||
product viewport and CPU PNG, using a fixed direct-light studio. Geometry and mass
|
||||
stay unchanged. HDRI, transmission and textures remain separate gates.
|
||||
See [the consumer and limitations](docs/render-opaque-pbr.md).
|
||||
|
||||
- Combined integration is tracked in #842, with independent scalar libraries in
|
||||
#863 and richer PBR/material-card transport in #1086. See [phase boundaries and validation gates](docs/render-integration.md).
|
||||
Render/library consumers use the merged asynchronous picker (#1127). Material-card
|
||||
UI (#1094), texture mapping and HDRI lighting remain explicit follow-ups.
|
||||
|
||||
- R4a adds bounded CPU product-image jobs, cancellation and atomic PNG export through
|
||||
engine commands, the Render panel, CLI and persistent MCP. Immutable captures and
|
||||
results stay outside persistence/undo; native workers and cooperative browser tasks
|
||||
share the same work protocol. See [jobs, limits and export](docs/render-jobs.md).
|
||||
|
||||
- R3 adds an overlay-free product scene and the integrated Render workspace, with
|
||||
runtime GPU host capabilities, per-document drafts and named camera/background
|
||||
controls. Design keeps its camera and drawing policy. Raster transparency remains
|
||||
approximate; PBR and environments are later slices. See
|
||||
[workspace and scene contracts](docs/render-workspace.md).
|
||||
|
||||
- R2 adds bounded named render setups in document format 21 and the read/save
|
||||
`render.settings.get/set` commands. Proven render-only changes preserve geometry
|
||||
and prepared world data through undo/redo and checkpoint restore. This slice does
|
||||
not add a Render workspace, PBR, environments or image jobs; see
|
||||
[settings and refresh policy](docs/render-settings.md).
|
||||
- Bounded PNG/JPEG texture admission (#900) validates in-memory sources and returns
|
||||
completed RGBA8 pixels with explicit color/data roles. It is an input utility only:
|
||||
ICC/16-bit normalization, local wood mapping, resource persistence and the renderer
|
||||
consumer remain separate work. See [limits and licensed-file probes](docs/render-texture-input.md).
|
||||
|
||||
- The initial opaque surface numerical contract for #1004 provides bounded linear
|
||||
color/metallic/roughness/IOR admission and an original tested direct-light BRDF.
|
||||
The numerical module alone advertises no capabilities; the installed consumer above
|
||||
provides rendering. See
|
||||
[the model, evidence and remaining consumer gates](docs/render-surface.md).
|
||||
|
||||
- A bounded cooperative Radiance RGBE input utility is available in L1 render;
|
||||
it does not yet enable HDRI/PBR rendering or a document import command. See
|
||||
[the input contract](docs/render-hdr-input.md) and #813 for integration work.
|
||||
- R1 adds renderer-independent backend/profile metadata, strict request resolution and
|
||||
bounded image/scratch admission checks, exposed by the read-only `render.backends`
|
||||
command. It describes the current CPU raster snapshot path without evaluating the model.
|
||||
The legacy Design snapshot route remains unchanged. Later slices above provide the
|
||||
workspace/jobs and opaque PBR; HDRI and optional engines remain future work. See [the contract](docs/render-backends.md)
|
||||
and [the phased proposal (#620)](https://github.com/bherbruck/solidcraft/issues/620).
|
||||
|
||||
## Dimensioning and error reporting
|
||||
|
||||
- Operation length fields share design-unit defaults and input evaluation, including secondary
|
||||
distances, thin walls, blend controls, sheet/plastic rules, joints and motion keys. Canvas
|
||||
handles and sketch previews use the same lengths as committed geometry. Existing stored
|
||||
millimetre values retain their size when edited in a design using another unit (#3271).
|
||||
|
||||
- MCP `execute` accepts `verbose: false`, sharing the compact reply helper used by
|
||||
`batch`: body changes and created sketch IDs stay, while repeated lists are omitted.
|
||||
Both tools retain full replies by default.
|
||||
|
||||
- Sketch Create groups drawing variants under Line, Rectangle, Circle, Arc, Slot,
|
||||
Polygon and Spline. Each open part remembers its last interactive choice per family
|
||||
across sketch sessions and document-tab switches; closing the part resets these UI choices.
|
||||
- Inscribed, circumscribed and edge polygon tools preview their actual outline before
|
||||
placement, including orientation and the selected side count.
|
||||
- Construction (X) preserves the active sketch drawing tool, picked anchors and inline
|
||||
dimension values, so line type can change while a shape is in progress.
|
||||
- Planar sketch construction previews and hover feedback keep the same dashed pattern as
|
||||
committed geometry; centerlines retain their dash-dot pattern.
|
||||
|
||||
- Point has a default Sketch CREATE toolbar button alongside the existing drawing tools.
|
||||
Saved custom layouts are preserved; Reset Toolbar restores the default Point button.
|
||||
- Construction planes cannot take an origin-plane name (XY, XZ, YZ, Top, Front, Right). Plane
|
||||
arguments reject such a name when an older design's construction plane already has it. Use
|
||||
the other alias, the construction feature's numeric ID or an explicit plane; existing
|
||||
stored references keep their saved meaning. Section Analysis uses the same check.
|
||||
- Sketch text can be edited from a letter interior or outline's context menu or the Edit Text command.
|
||||
Interior selection requires every profile boundary to belong to the same text source;
|
||||
the editor highlights the whole source without replacing profile selections.
|
||||
Content, baseline X/Y, height and rotation update the original text source in one undo step;
|
||||
cancelling or rejecting an invalid value preserves the sketch. Position and height fields
|
||||
use the document units captured when editing starts; generated outlines remain associated
|
||||
with their text source, and untouched inputs preserve their saved internal values.
|
||||
Dragging a text outline moves the entire source in one undo step; Escape restores the
|
||||
gesture. Move/Copy on a selected text outline provides unit-aware X/Y distances and rotation
|
||||
about its baseline; copies keep an independent editable text source.
|
||||
- Repeating the initial point of a planar multi-point sketch drawing tool is neutral: the tool
|
||||
waits for a distinct point without a degenerate-shape error or history entry. Typed input
|
||||
and programmatic commands retain their validation.
|
||||
- Circular-pattern and angled-plane axes reject explicitly supplied malformed or expression
|
||||
origins instead of silently rotating about zero. Numeric origins remain in millimetres;
|
||||
associative axis expressions and construction-axis references remain unsupported.
|
||||
- Single-line and rectangle-side dimensioning supports selecting a line or its two endpoints.
|
||||
Type a value and press Enter to commit one undo step; rejected values remain editable and
|
||||
cancellation leaves the sketch unchanged. Fit keeps geometry clear of the Sketch Palette
|
||||
and navigation controls, including enlarged displays and nested pending placements.
|
||||
- Sketch Dimension takes a line and a circle or arc (#1803): it measures from the line to the
|
||||
circle's edge (the gap, 0 when tangent, or how far the edge reaches past a line that cuts
|
||||
it), drives it like any other dimension and keeps the circle on its side of the line.
|
||||
- Sketch Dimension takes a point and a circle or arc, or two circles or arcs (#4064): it
|
||||
measures to the circle's edge (from the point, or between the two edges: the gap, 0 when
|
||||
they touch, how far they overlap, or the narrowest gap between nested circles).
|
||||
- Sketch annotations, live drawing lengths and Measure use document units. Inches show
|
||||
three decimals and retain a meaningful fourth digit. Bare length dimension entry captures
|
||||
the current design unit; changing units leaves existing geometry and expressions intact.
|
||||
Component/canvas distance controls, sketch cursor coordinates, flat-pattern dimensions
|
||||
and pocket depths, interference volumes and parts-library lengths also use design units.
|
||||
- Curvature and Polygon constraints accept complete preselected operands. Fix/Unfix
|
||||
consumes complete point/curve selections consistently; mixed or ambiguous selections
|
||||
retain the picking workflow. Rejected constraints preserve selection and undo history.
|
||||
- Contextual error reporting: a **Create Issue** action beside feature errors opens a
|
||||
reviewable GitHub issue draft with the error, operation settings, build diagnostics and
|
||||
useful reproduction context. The draft is editable, with optional capture of the actual
|
||||
viewport and copy/save controls. Opening GitHub does not submit the issue. Help also exposes
|
||||
reporting for unexpected results that did not produce an error.
|
||||
- The header exposes **Report a bug**, including an accessible compact control on
|
||||
narrow windows. It opens the same editable report and screenshot review without
|
||||
changing the active model or a pending dimension.
|
||||
- Crash reports: every panic (in a command, in the kernel, anywhere else) and every unclean
|
||||
exit (abort, stack overflow, kill: found at the next start through a locked per-run command
|
||||
journal) leaves a local report with the backtrace, version and commit, the command and the
|
||||
design that reproduce it (`solidcraft-cli crashes replay <id>`). Repeats are counted, not
|
||||
rewritten; at most 20 reports, 50 MB and 90 days. The app shows them after a crash (Help >
|
||||
Crash Reports…) with a reviewed issue draft; agents read them through
|
||||
`diagnostics.crash_reports`, the MCP `crash_reports` tool or the CLI. Nothing is sent
|
||||
anywhere. See [crash reports](docs/crash-reports.md).
|
||||
- Agent chat (off by default, desktop): a side panel that drives a coding agent the user
|
||||
already has (Claude Code through its ACP adapter, Codex, Gemini CLI, OpenCode, Grok Build, …) over the
|
||||
Agent Client Protocol, under the user's own login; SolidCraft stores no keys. The agent works
|
||||
through SolidCraft's MCP tools on a gated endpoint of its own: file actions wait for Allow or
|
||||
Deny, crash reports are off limits, 24 changes per message, one undo step per message, and
|
||||
the agent's whole process group ends with the panel or the app. Docks left or right,
|
||||
minimises to a strip. Grok Build discovery includes `~/.grok/bin` and reuses the user's
|
||||
Grok login. See [agent chat](docs/agent-chat.md).
|
||||
- Command scripts from designs (#886): `timeline.export_script` (CLI `solidcraft-cli script`)
|
||||
writes a design's history as a script that `eval` and `run` replay into the same design —
|
||||
user parameters, units, sheet metal and plastic rules and materials as their own commands,
|
||||
then each feature through `timeline.add` with its ids, names and dimension parameters kept,
|
||||
so every feature kind replays exactly and a failing feature fails the same way. Trimming the
|
||||
script after a step gives the design at that step. Appearances, folders, views and
|
||||
configurations are listed as left out; components and joints are not supported yet.
|
||||
|
||||
## 0.2.0 release batch
|
||||
|
||||
- Includes the new axis navigation, adaptive sketch drawing/picking, origin-corner repairs,
|
||||
durable supported profile/face references, endpoint dimensioning and contextual reporting.
|
||||
- Smooth ruled-wall display joins are hidden only within the supported geometric certificate;
|
||||
authored splits and actual creases remain protected. Wireframe retains physical edges.
|
||||
- Paste New uses a bounded current-geometry comparison for supported convex line/circle
|
||||
prisms with separated circular holes; unsupported shapes retain the existing strict check.
|
||||
- Common-bore Union retries check additional boundary curves before recutting the bore,
|
||||
preventing the reproduced thin-web loss. Unknown additional trims refuse; inherited
|
||||
common-cylinder trims retain their existing policy, so this is not a general Boolean proof.
|
||||
- Exact full-path assembly joint editing remains separate work and is not part of this batch.
|
||||
- Stable 0.2.0 is published: all release payload checksums, native cold reopening, deployed
|
||||
web app and both Flatpak architectures were verified. The replacement README demo uses
|
||||
the original electronics enclosure story and animated pointer in the actual English
|
||||
0.2.0 UI, at 4× playback. Publication follows [the release workflow](docs/releasing.md).
|
||||
|
||||
## 0.2.1 critical fixes
|
||||
|
||||
- Separated multi-profile Join/Cut extrusions into one solid target batch their tools using
|
||||
conservative construction bounds, avoiding a Boolean rebuild for every profile. Live
|
||||
extrusion previews build only their tools; confirmation validates the final Boolean.
|
||||
- Coplanar selected body faces share one linked sketch and one extrusion. Automatic Join/Cut
|
||||
keeps the evaluator's participant scope, including parts of an empty imported component. Desktop OK/Enter
|
||||
computes on a scratch session in the background, with atomic acceptance and cancellation.
|
||||
Planar section stitching projects lines/arcs analytically and removes duplicate endpoints.
|
||||
- Imported rotated face groups can check all full start-face seams in one guarded
|
||||
construction. Separated tools may batch a Join when each meets the same single body;
|
||||
nearby uninvolved bodies retain the original contact decisions. Regression comparisons
|
||||
cover all four extrusion operations.
|
||||
- Inward multi-face cuts retain every eligible target and subtract separated tools together.
|
||||
Safe interior classification handles roundoff at shared imported line/arc endpoints.
|
||||
Straight extrusion feedback caches existing face/profile triangles and updates the display
|
||||
directly, including a newly opened STEP's single identity component placement; other
|
||||
extents, moved or repeated components and curved sketch profiles keep the Engine preview.
|
||||
- The extrusion fixes retain tracked Boolean history and the current `solidcraft` packages.
|
||||
Confirmation and tool previews use main's shared background calculation. Main's collapsed
|
||||
blend-wall refusal and its tests are retained, including smaller valid radii and mirrored parts.
|
||||
- Axis view and navigation controls stay anchored to the viewport when feature dialogs or
|
||||
the command palette open, at normal and enlarged display scales. Fit still accounts for
|
||||
dialog coverage; covered controls do not receive clicks through dialogs.
|
||||
- Eligible planar faces survive fillet, chamfer and shell operations with exact source
|
||||
certificates. Sketches placed directly on the enclosure wall and inner floor follow
|
||||
width and wall changes, including after the USB cut and cold reopening.
|
||||
- Remove artificial straight-wall and rounded-corner subdivisions left by shell and
|
||||
extrusion cuts. Identical generated wall segments span adjacent slabs as one physical
|
||||
face, with exact full-height supports and boundary stitching. Preserve authored face
|
||||
splits and face appearances. Permanent regressions cover material, STEP, reopening and
|
||||
unaffected bodies across the extrusion end plane.
|
||||
- Feature dialogs use the available screen height for their fields, with OK and Cancel
|
||||
outside the scrolling region, including enlarged display scales.
|
||||
- Design format 13 records shell-face attachments. Older designs remain readable;
|
||||
newly saved designs require 0.2.1 or later. Ambiguous or unsupported faces still refuse
|
||||
attachment rather than guessing a plane.
|
||||
- Saved projections from a removed strip retain their geometry and report the lost
|
||||
reference. Explicitly reselect the wall to repair that projection.
|
||||
|
||||
## Workspace layouts (#2029)
|
||||
|
||||
- General preferences save Floating or Compact using the universal UI containers.
|
||||
Compact joins the workspace selector and ribbon, docks the content-hugging Browser
|
||||
flush beneath them with a square join, and opens tool sheets below the compass.
|
||||
Sheets remain draggable, rounding all corners away from their right dock; footer
|
||||
backgrounds follow the same corners. A separate preference hides ribbon icon labels
|
||||
for a shorter ribbon in either layout.
|
||||
Assistant keeps the outermost edge and History keeps its chosen dock. Switching
|
||||
retains the active tool, camera, selection and design; system windows and menus
|
||||
keep their existing behavior.
|
||||
|
||||
## View navigation
|
||||
|
||||
- Navigation has an opt-in Free orbit preference for mouse and 3D-mouse rotation through
|
||||
both poles with roll. It defaults off, preserving existing preset snapping and pole limits.
|
||||
The SolidWorks face menu offers Normal to Selection (`view.normal_to`), shared with Look At
|
||||
and Ctrl+8, including repeat-to-flip, preserving scale and projection.
|
||||
|
||||
- Desktop Ctrl/Cmd +/- and 0 change or reset the saved UI scale. The scale slider keeps
|
||||
its layout stable during a drag and applies the selected scale on release.
|
||||
|
||||
- OpenSCAD navigation preset: left drag orbits, right/middle drag pans, Shift+right/middle
|
||||
drag zooms, and the wheel zooms. Available in the shared desktop/web Navigation preferences.
|
||||
- Compact clickable signed X/Y/Z axis tips, smooth drag-to-orbit, and Shift-orbit snapping
|
||||
to 26 standard and diagonal views. Pointer motion accumulates independently of a lightly
|
||||
damped spring, with a boundary margin to prevent flicker. Z-up/Y-up and the nearest square
|
||||
top/bottom heading are preserved. Diagonals include 45-degree edge and isometric corner views.
|
||||
|
||||
## Known limitations
|
||||
|
||||
- Scheduled and manual CI scan locked dependency advisories, bans and sources with
|
||||
cargo-deny. Vulnerabilities fail the scan; unmaintained crates warn. Local vendored
|
||||
patches require separate upstream review because advisory databases cannot version-match
|
||||
their path dependencies. Pull requests retain the existing licence checks.
|
||||
|
||||
- Associative shell-face sketches require a unique certified planar source. Nested shell
|
||||
attachments and ambiguous coincident sources remain unsupported.
|
||||
- G2 fillets: exact quintic blends of straight edges between planar faces, with one planar
|
||||
end face at each end, including sloped ends (#2708). The UI and `solid.fillet` expose
|
||||
`curvature` (alias `g2`); the size is an equivalent circular setback. Curved faces/edges,
|
||||
multi-face ends and corner junctions remain unsupported.
|
||||
- Fillets and chamfers: constant, variable-radius and chord-length fillets; a radius per edge,
|
||||
rounds next to earlier rounds of another radius, and smooth corner patches where three rounds
|
||||
meet (a sphere for equal radii); perpendicular corner fillets after a closed ring of earlier
|
||||
rounds preserve the ring's radii and the enclosed planar face (#1557);
|
||||
mitres between separate rounds of the same radius keep their endpoint tangent, so a later
|
||||
fillet can select an upright and its adjoining bottom mitre as one chain (#2422);
|
||||
straight edges (convex or concave) between planar faces with perpendicular
|
||||
planar end faces (equal-distance chamfers also meet sloped planar end faces, including inner
|
||||
basin rims within the rim width); convex fillets also meet sloped planar ends and reflex
|
||||
corners around pocket rims, with unequal wall slopes and extensions confined to the face;
|
||||
connected equal-distance chamfers also trim each other across unequal sloped rim walls;
|
||||
curved chamfer chains with straight planar ends can terminate across two existing planar
|
||||
bevel faces, splitting their shared seam; picks on the same tangent chain are applied once (#1303);
|
||||
whole smooth loops of a planar face, picked whole or by one edge (tangent
|
||||
chain), including circles and walls at any angle (boss bases and tops, bores, pocket floors,
|
||||
plate outlines), loops with sharp corners between straight or mixed arc/line edges (straight
|
||||
blends meet in mitres; perpendicular curved walls use offset intersections, with D-rim removal
|
||||
checked within 0.1% of analytic offset slices), runs of
|
||||
neighbouring edges along a planar face's loop (two top edges of a box: mitred, ending square;
|
||||
with the edge between them too, the corner becomes a sphere octant),
|
||||
rounded corners rounded again (sphere octants, tori at concave corners); every edge of a
|
||||
convex planar body or of an extruded part; fillets inside patterns; closed chains of curved
|
||||
edges between any two smooth sides (a branch pipe on a main pipe), by a rolling ball (the
|
||||
blend a rational B-spline through exact arcs), closed or ending at planar faces square to the
|
||||
edges, where straight or curved cap edges are trimmed to the contacts (the straight edge
|
||||
between two overlapping extruded arcs); knife edges, where the two faces have opposite
|
||||
normals (a wall that runs out tangent into a face: the ball that fits there); an edge that
|
||||
runs out along an end face tangent to one side (the arc top edge of that wall), cut where the
|
||||
blend meets it; rounds that end in an earlier round on curved faces, in any order (the rounds
|
||||
of two edges at a vertex meet in a crease, as on a box), picked together or one after the
|
||||
other, except a round after a round of the edge between the wall and a flat face that it
|
||||
would run over; the three edges at a vertex of any smooth faces, of one radius, end in a
|
||||
piece of sphere. A limiting blend that collapses a side wall into coincident boundary
|
||||
curves is refused as too large rather than returning an unmeshable face (#1113).
|
||||
- Booleans: prisms along one direction (plates with holes, slots, patterns of them, equal
|
||||
sections stacked end to end) are combined exactly in 2D. Qualified axial cuts preserve
|
||||
annular holes with overrun cutters, including inward Press Pull after a joined extrusion;
|
||||
curved wall qualification rejects false transverse axes instead of filling holes.
|
||||
Bodies touching along one whole face
|
||||
(a part and its mirror image) are stitched; coincident planar faces are pushed apart when
|
||||
their neighbours are planes or cylinders. Other coincident curved configurations can still
|
||||
fail. Bounded containment classification preserves fully internal cavities and nested
|
||||
material islands independently of shell order, with STEP round-trip and material-membership
|
||||
regressions. Near-contact curved shells use the general boolean path rather than a
|
||||
containment shortcut. Spheres are built from six pole-free patches.
|
||||
- Mass properties come from fine tessellation (curved faces within ~1e-4 relative); triangles
|
||||
that cut through curved faces (trimmed faces after booleans) are split onto the surface first.
|
||||
- STEP import (our own reader, crates/kernel/src/step_in) reads solids (B-rep with analytic and B-spline geometry), units,
|
||||
product names, colours and assemblies; analytic offsets on planes, cylinders, cones, spheres
|
||||
and regular tori are read exactly (signed/nested distances, units and face sense). Freeform
|
||||
offset surfaces and pcurve-only edges are not read yet,
|
||||
and assembly components are flattened into bodies. Closed periodic faces (torus, B-spline
|
||||
bands) are split in two for meshing; measure() uses a finer tolerance for small radii.
|
||||
- Persistent naming follows the kernel's exact face history (docs/book/src/dev/naming.md):
|
||||
references resolve by name first, follow splits and merges, and warn when the entity split,
|
||||
merged or vanished, or was found by geometry only (operations that report no history yet).
|
||||
New planar sketch attachments use exact box, extrusion cap/side and immutable imported-face
|
||||
source certificates with checked target and author occurrence paths. A missing or changed
|
||||
source fails explicitly; Redefine Sketch Plane previews reattachment or a fixed plane while
|
||||
retaining current geometry and dimension identities. Unsupported modified faces need an
|
||||
explicit fixed plane. Legacy attachments retain their original resolver behavior.
|
||||
- Modelled threads are cut as a faceted body (curved faces within 1/200 of the pitch); Extrude
|
||||
and Revolve To Object on a curved face cut the tool back to the target's surface.
|
||||
- Explicit sketch breaks preserve exact ellipses, fit/control splines (including high degrees)
|
||||
and conics; analytic trim/break also sees free-form cutters. Free-form curves cut at a tangent
|
||||
touch (no clean crossing) enter that profile as polylines.
|
||||
Sweeps along 3D sketch curves follow their polyline (smooth walls when the path is smooth).
|
||||
A sweep with a twist, an end scale or a parallel or direction orientation (#771) follows its
|
||||
path that way too, even along sketch lines and arcs: B-spline walls through stations, ruled
|
||||
walls through denser stations where the path has corners or the profile has holes.
|
||||
Guide rails (one or two, #771) do the same: each station meets every rail once, and the rail
|
||||
turns the profile and scales it (or stretches it across to the rail) against the start; two
|
||||
rails carry it between them. Rails along a path with sharp corners are refused for now.
|
||||
- Extend intersects exact ellipses and rational/high-degree splines without moving the line or
|
||||
circular support. Associative free-form offsets have a whole-span 0.002 mm normal-distance
|
||||
certificate and refine within bounded node limits while retaining existing IDs.
|
||||
At the node limit, geometric certificate subdivisions accommodate unequal spline parameter
|
||||
speeds without changing stored nodes or relaxing the distance tolerance (#971).
|
||||
Associated offset fit nodes stay hidden from display, picking and snapping; dragging the
|
||||
editable source updates the derived boundary live. Break Association restores point editing.
|
||||
Singular, self-intersecting and ambiguous curves refuse atomically; mixed junctions and nonsmooth
|
||||
closed natural-spline seams remain limitations. New explicitly closed fit splines and closed
|
||||
offset outputs use periodic C2 interpolation, supporting repeated certified offsets; older
|
||||
natural splines are preserved. Clicking the starting fit point deliberately closes a new loop.
|
||||
Newly captured adaptive profile references with complete source coverage retain their outer
|
||||
and hole identities through span-count changes, including parameter edits after extrusion.
|
||||
Partial, intersected or ambiguous boundaries do not qualify for these whole-source references.
|
||||
Legacy curve-span multisets remain exact and unchanged; already-lost selections may need
|
||||
reselection. Format 12 stores the new bounded whole-boundary references.
|
||||
Projected analytic boundaries follow nested loop identities through resizing, including
|
||||
stationary holes and rounded corners. Supported convex, tangent line-and-arc boundaries
|
||||
can lose or regain corner arcs during an inset while preserving reserved curve identities
|
||||
and linked profile selections. Format 12 saves those associations; compatible older closed
|
||||
offsets upgrade structurally without changing their curve IDs. Breaking an association
|
||||
freezes its current boundary and materializes downstream profile references. Child offsets
|
||||
of a boundary with retired arcs still require breaking its association first; mixed or
|
||||
nonconvex junctions and retained references to disappearing individual arcs remain limited.
|
||||
- Extrude and Revolve editors retain original direction, extent expressions, explicit targets,
|
||||
axes, From/To inputs and All-profile intent. No-op edits preserve downstream dimension names
|
||||
and selected occurrence frames; cancel and successful edits preserve one-step undo history.
|
||||
Placed feature edits preview through the edited timeline entry, and cylindrical Emboss guides
|
||||
use the sketch's actual target, author or uniquely placed third-component frame.
|
||||
Revolve rotators follow the actual signed axis and support symmetric and two-sided extents;
|
||||
dragging a To Object extent converts its derived value to an explicit angle. Legacy reversed-axis
|
||||
symmetric geometry is preserved through format 11's explicit legacy convention. New revolves
|
||||
use the sketch-normal direction for each selected profile, including To Object and curved
|
||||
target trimming, independently of the selected axis sign.
|
||||
- Cylindrical emboss/deboss wraps bounded orthogonal line profiles, including holes, concave
|
||||
outlines and nested islands, onto complete exterior cylinders or coaxial sleeves with exact
|
||||
radial walls. New features infer a unique eligible cylinder when the face field is empty;
|
||||
ambiguous targets require an explicit face. Saved target
|
||||
and author occurrence paths retain the chosen placements; missing/split faces refuse rather
|
||||
than retarget. General free-form profiles, seams, stepped cylinders and other curved surfaces
|
||||
remain unsupported. STEP round-trip and independent radial/volume checks cover this subset.
|
||||
- Shell and offset faces work on bodies of planes, cylinders, cones, spheres and tori (convex or not:
|
||||
filleted boxes, bosses, domes, countersinks; corners where four or more planes meet, such as a
|
||||
floor falling to a drain, as long as the corner's edges are all convex or all concave); draft on convex planar bodies and on walls (planes, cylinders → cones) between caps; lofts through three or more sections are smooth (B-spline sides through every section), two
|
||||
sections ruled. Circular-meridian barrels retain curved inner walls through either axial
|
||||
opening (#2421). Solid lofts preserve holes through sections with matching hole counts
|
||||
(#2435), including inner walls and caps with openings; a hole cannot appear or disappear
|
||||
between sections, and sections with holes cannot collapse to a point.
|
||||
|
||||
- Sketch corner tools: fillet and all three chamfer modes pick a connected corner even when
|
||||
its endpoint overlaps the fixed origin or a loose point. Ordinary drawing still snaps to
|
||||
the origin; clicked UI regressions verify geometry, closed profiles and undo.
|
||||
- Sketch display: drawing, picking, highlighting, tool previews and profile shading share
|
||||
adaptive projected curve boundaries. Fit, zoom, display scale and placed sketch frames
|
||||
invalidate the display cache without changing CAD geometry or timeline history. Work
|
||||
budgets and clipped paths prevent unbounded sampling or invented edges across the eye plane.
|
||||
The Sketch Palette scrolls its options on short windows and enlarged displays while
|
||||
keeping constraint status and Finish Sketch visible.
|
||||
- Face projection: closed boundaries have a deterministic outer-first order. Refresh matches
|
||||
existing geometry before assigning positions, retaining saved curve IDs and constraints
|
||||
across enumeration changes and resize, including concentric circles. Ambiguous identities
|
||||
retain the last geometry and report a lost reference; permutation matching is bounded.
|
||||
- Project accepts complete supported preselection in one undo step. Visible external sketch
|
||||
curves and points retain their source sketch identity; model geometry, axes and planes use
|
||||
the existing linked projection commands. Rejection preserves the document and selection;
|
||||
mixed selections retain ordinary tool-first picking.
|
||||
- Inline sketch dimensions: Tab and Shift+Tab cycle within the active shape's value boxes,
|
||||
selecting visited values for replacement. Expression completion retains forward-Tab
|
||||
priority; real keyboard regressions cover rectangles, lines and single-value circles.
|
||||
Typed lengths, radii, line angles, signed arc sweeps and slot lengths persist as constraints
|
||||
and expressions through save/reopen. Shape creation and its dimensions form one undo step;
|
||||
rejected values keep the editable field focused.
|
||||
- Repeated components: Browser selection, visibility, properties, copy and Move/Copy use
|
||||
checked occurrence paths. Active nested occurrences author planar sketches and solids in
|
||||
their selected frame. Pending moves compose through parents; dialog cancellation restores
|
||||
its selected move. Source materials and body/face appearances follow transformed instances.
|
||||
Shared nested definitions remain shared. Deep Paste New copies reachable definition graphs,
|
||||
independent feature/input histories, styles and internal motion records, with bounded geometry
|
||||
checks and explicit external-link notices. Paste New selects the copy while preserving the active
|
||||
authoring context. Imported periodic STEP seams survive placement and reexport with shared
|
||||
topology and appearances intact. Recorded body transfers preserve historical Join/Cut membership,
|
||||
material, placements and machining data through edits, copying, undo and reopen. New 3D wires
|
||||
record their coordinate frame; legacy wires migrate from known provenance without changing
|
||||
coordinates. Broken legacy links with missing provenance can require explicit refresh or relink.
|
||||
See [occurrence workflows](docs/occurrence-workflows.md).
|
||||
- Toolbar drops on panel labels, gaps and margins append commands with insertion feedback;
|
||||
button drops keep insert-before ordering.
|
||||
- Parameters and Configurations have distinct actions in the SOLID toolbar's CONFIGURE panel.
|
||||
Parameters opens the user/model variable editor; Configurations opens the configuration table.
|
||||
Configure remains available in the panel dropdown.
|
||||
- Parameter creation supports Enter with validation and continued keyboard entry. Shared
|
||||
expression autocomplete supports Up/Down selection, Enter/Tab acceptance and Escape dismissal;
|
||||
accepting a suggestion does not submit a parameter or trigger viewport shortcuts.
|
||||
- Movable window title bars follow the app's dark/light header palette. Radial right-click
|
||||
menus are opt-in in Preferences > Navigation; ordinary context menus remain the default.
|
||||
- Desktop distribution: running Windows windows and executable resources use the app icon;
|
||||
packaging validates icon resources. Nix installs launchers, MIME data and generated icons,
|
||||
with explicit launch apps and Vulkan-loader/driver discovery. Flatpak feed instructions
|
||||
register the required runtime source; release checks exercise desktop modelling on X11/Wayland.
|
||||
- OpenGL rendering clamps effective anti-aliasing to 1x across UI pipelines, textures and CAD
|
||||
callbacks to prevent black frames. Other backends retain the requested sample count, and
|
||||
stored preferences remain unchanged.
|
||||
- Configuration rules: ordered typed conditions can drive parameters and suppressions or
|
||||
restrict values. Preview explains effective values without modifying the document; applying
|
||||
rules validates rows atomically. Length expressions retain their authoring units across
|
||||
document-unit changes. The UI supports structured All/Any/Not conditions and rule ordering.
|
||||
Component styles and certified semantic face styles are available; unsupported lineage refuses
|
||||
atomically, and stale certified face paint cannot jump to another surface. See [configurations](docs/configurations.md).
|
||||
- Sheet-metal material: inherited holes, crossing edge notches, overlapping cuts and retained
|
||||
islands share the same boundaries in flat preview, DXF and unfolded solids. Detached material
|
||||
pieces survive unfold/refold as one logical sheet group, including split flanged sheets.
|
||||
Cut-outs made in the flat pattern cross bends at any angle or curved: their edges fold to
|
||||
helices and curves on the bend, their walls square to the sheet. Free-form bases use bounded
|
||||
sampling.
|
||||
Parallel prismatic partial-depth cuts retain pocket side and depth through transfer and
|
||||
unfold/refold, with separate pocket contours in preview and DXF. Planar Intersect preserves
|
||||
exact holes and retained islands, including the union of multiple selected profiles, and
|
||||
records complementary depth layers as pockets while retaining the stock gauge. Unsupported
|
||||
tapered or bend-crossing machining refuses atomically instead of restoring material later.
|
||||
Sketches attach to a sheet's flat faces (base and flanges, either side) by panel, in the
|
||||
flat pattern's coordinates, and follow it through rebuilds and unfold/refold.
|
||||
A flange on another flange's far edge (a return) follows that flange's closed end and keeps
|
||||
clear of the flange beside it, and the returns of one feature are mitred toward each other
|
||||
with the rule's gap where their flanges meet at a corner; returns of separate features, and
|
||||
flanges on returns, are not closed toward each other.
|
||||
- Rolling-ball fillet accuracy: independent offset-cylinder tee references check surface
|
||||
distance, actual trimmed tessellation, supporting-cylinder contacts and tangency at two
|
||||
scales. The measured trimmed-part error is below 0.0001 mm; this is an analytic geometry
|
||||
check. Under-resolved fits return an error.
|
||||
- Contact driving checks the trajectory between clear endpoints, including linked joints,
|
||||
playback and sparse motion exports. Checks use bounded tessellation samples, not exact
|
||||
continuous collision detection; local thin walls and small details remain limitations.
|
||||
See [contact-set limits and recovery](docs/contact-sets.md).
|
||||
|
||||
## Assembly dragging
|
||||
|
||||
The design's first part is grounded when it is made, and a left-button drag repositions a free part (`occurrence.drag`: one undo step, exact occurrence paths including repeated jointed definitions, any floating-chain member carries the chain, grounded parts and joints hold where present, Escape cancels).
|
||||
|
||||
## 3D sketch bridges
|
||||
|
||||
3D sketch drawing snaps to points on other visible sketch planes without flattening them onto
|
||||
the active plane. Bridge endpoints capture their source positions; associative endpoint links,
|
||||
construction-plane selection of 3D wires and loft guide rails remain separate work.
|
||||
Feature dialog header chevrons collapse and restore the form without discarding selections
|
||||
or edited values, including the Appearance panel.
|
||||
## Construction on 3D paths
|
||||
|
||||
Plane Along Path has a viewport path selector, fractional position, live preview and timeline
|
||||
editing. Construction planes and points resolve drawn 3D wires without applying their sketch
|
||||
plane a second time. Curved paths use sampled segments; multi-curve chains, absolute distance
|
||||
and reference-object placement remain separate work, as do loft rails and centerlines.
|
||||
|
||||
## Design properties (#1015)
|
||||
|
||||
- Designs carry project, part number, revision, author, organization, description and licence
|
||||
in an optional `metadata` object (File → Design Properties…, `document.metadata.*`,
|
||||
`inspect_design`). STEP and IGES headers and 3MF model metadata take the fields their format
|
||||
has a place for. Other tools keep their own data under a reverse-DNS key, kept as it is
|
||||
through open, edit and save and never exported. See [design properties](docs/book/src/guide/files.md#design-properties).
|
||||
Per-component properties (a part number per component) can follow with the same type.
|
||||
|
||||
## Document-opening performance
|
||||
|
||||
- Desktop STEP import prepares consecutive independent solids in bounded batches with up
|
||||
to eight workers, retaining serial traversal, result order and persistent source identities.
|
||||
The web path remains serial. Original multi-solid fixtures show 64–81% lower complete
|
||||
import times; single-solid assembly parts are not scheduled across nodes. See
|
||||
[measurements and limits](docs/perf.md#parallel-step-body-preparation-2026-10-12).
|
||||
- Design containers (#303, phase one) separate and deduplicate STEP, raw images and
|
||||
lossless binary mesh arrays while keeping plain JSON as a supported Save As/export
|
||||
format. Generated-mesh storage measurements reduce serialization and decoding work;
|
||||
a seekable reader defers original blobs until after provisional display.
|
||||
See [container format](docs/design-container.md) and [performance measurements](docs/perf.md).
|
||||
- Warm saves with explicit `cache: true` can include a versioned native B-rep cache through SolidCraft-owned topology
|
||||
and geometry records, with a separate truck adapter and bounded binary reader. Exact
|
||||
face-source certificates and operation history survive codec round trips. A provisional
|
||||
picture can be generated before original blobs are read; editing and measurement wait
|
||||
for authoritative reconstruction. Cached metadata binds preview and reconstruction to
|
||||
the same document despite concurrent file writes. Default saves omit this cache and never force cold
|
||||
evaluation or meshing; explicit `preview: true` remains a separate warm-mesh option.
|
||||
Keys, resource budgets and document/revision guards reject incompatible, hostile or
|
||||
stale results. A second modelling kernel still requires its own tested adapter.
|
||||
- Warm saves with explicit `cache: true` can also carry a bounded PNG thumbnail from already cached meshes.
|
||||
Home reads it without rebuilding the design when its local picture is missing;
|
||||
mismatched or malformed thumbnails fall back to normal generation. The image is
|
||||
kernel-independent and saving never forces cold meshing to produce it.
|
||||
|
||||
- Cold rebuild profiling separates parsing, geometry, placement, display meshing and
|
||||
thumbnails. Straight-line closest-point projection and exact curved-surface evaluation
|
||||
reuse reduce repeated work without relaxing geometry checks. Three alternating optimized
|
||||
benchmark runs reduce median rebuild time by 26% on the public sensor enclosure and 22%
|
||||
on a local case assembly; shape measurements and topology match the original build.
|
||||
See [performance measurements](docs/perf.md). Further cold Boolean and import costs remain.
|
||||
- Prepared assembly geometry survives selection and view changes while real geometry and
|
||||
placement changes invalidate it. A Pi assembly edge-selection probe drops from 9.24 s to
|
||||
0.57 s; initial opening is unchanged. Actual Windows desktop profiling measures 15.87 s
|
||||
median opening, with 82% spent rebuilding geometry; halving full opening remains open.
|
||||
|
||||
## Kernel
|
||||
|
||||
- Successful Boolean retries report their strategy and numerical adjustments as
|
||||
feature warnings and structured inspection data. Diagnostics survive cached
|
||||
evaluation, undo/redo and cold reopening; the robustness runner counts retry
|
||||
events by strategy and reports any bounded-log truncation. Existing geometry
|
||||
acceptance checks remain in force.
|
||||
|
||||
- Cylinders of one radius whose axes cross (a second bore across a bore of the same size, a pipe
|
||||
tee of equal pipes) touch at two points, where the mesh intersection cannot trace the curves
|
||||
and a boolean cannot tell the four arms of the crossing apart. When the ordinary boolean fails
|
||||
on such a pair, both faces are split along the line of their cylinder through the touching
|
||||
points (the solids are unchanged), the boolean is taken of those, and its history is composed
|
||||
back over the operands as given (#788). The result keeps the split lines as edges of the bore
|
||||
walls. A crossing the ordinary route fails on and the split faces do not help (a radius of 17.5
|
||||
in a 45 mm block with a tool of 80 mm) is still refused.
|
||||
- Boolean intersection-curve construction refuses point-only, collapsed and non-finite
|
||||
polylines without panicking. Direct constructor regressions retain valid open endpoints
|
||||
and closed spherical intersections; the original interactive trigger remains unidentified.
|
||||
- Shell of a stepped, joined planar body no longer creates horizontal subdivisions across
|
||||
continuous walls. Fresh axis-aligned Cut walls are stitched using their exact construction
|
||||
support and shared topology, preserving real steps and intentional boundaries. The local
|
||||
reported case returns from 86 to 49 faces with unchanged material and bounds; regressions
|
||||
cover stepped stock, STEP round trips and saved projections from removed pieces.
|
||||
|
||||
truck (Apache-2.0) behind our own `kernel` crate, with our own blend operation and boolean
|
||||
retry/validation; see `plan/adr/0001-geometry-kernel.md` (local) — summary in README.
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
//! solidcraft-cli icon --out F.png|F.ico [--size N] the app icon (packaging; drawn, not a file)
|
||||
//!
|
||||
//! --debug (with any command) SolidCraft's debug log on stderr (or RUST_LOG=LEVEL)
|
||||
//! --max-file-size SIZE (with any command) read STEP and design files up to SIZE (2GB, 1500MB; at most 16GB)
|
||||
//! ```
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
#![forbid(unsafe_code)]
|
||||
@@ -99,7 +100,7 @@ const USAGE_BENCH_EDIT: &str = " solidcraft-cli bench-edit <script.json|recipe.
|
||||
/// `save-stress`'s lines in the usage: the file saved over and over.
|
||||
const USAGE_SAVE_STRESS: &str = " solidcraft-cli save-stress <path> <rounds>\n";
|
||||
/// The flags every command takes, at the end of the top-level usage.
|
||||
const USAGE_DEBUG: &str = " --debug, with any command: what SolidCraft logs (why a body has no display plan, why a save left its\n model cache out), on stderr; RUST_LOG=error|warn|info|debug|trace sets one level for every crate\n";
|
||||
const USAGE_DEBUG: &str = " --debug, with any command: what SolidCraft logs (why a body has no display plan, why a save left its\n model cache out), on stderr; RUST_LOG=error|warn|info|debug|trace sets one level for every crate\n --max-file-size SIZE, with any command: read STEP and import files and design files up to SIZE for this run\n (for example 2GB or 1500MB; at most 16GB; the defaults are 512 MB and 256 MB, and a smaller SIZE keeps them)\n";
|
||||
|
||||
/// The commands the CLI takes, in the order the top-level usage lists them.
|
||||
const COMMANDS: &[Command] = &[
|
||||
@@ -131,6 +132,10 @@ const COMMANDS: &[Command] = &[
|
||||
fn main() -> ExitCode {
|
||||
let mut args: Vec<String> = std::env::args().skip(1).collect();
|
||||
logger::init(&mut args);
|
||||
if let Err(e) = max_file_size(&mut args) {
|
||||
eprintln!("error: {e}");
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
let r = match args.first().map(String::as_str) {
|
||||
// Asked-for help is not an error: the command's usage on stdout, exit 0. It is read
|
||||
// before the command runs, so `--help` never starts a run (a fuzz run, a server).
|
||||
@@ -205,6 +210,28 @@ fn main() -> ExitCode {
|
||||
}
|
||||
}
|
||||
|
||||
/// Take `--max-file-size SIZE` (or `--max-file-size=SIZE`), which any command takes, out of the
|
||||
/// arguments and raise the file size limits for this run (#4086). A bad size is an error.
|
||||
fn max_file_size(args: &mut Vec<String>) -> Result<(), String> {
|
||||
let mut size = None;
|
||||
let mut i = 0;
|
||||
while let Some(arg) = args.get(i) {
|
||||
if arg == "--max-file-size" {
|
||||
let value = args.get(i + 1).cloned().ok_or("--max-file-size needs a size, for example --max-file-size 2GB")?;
|
||||
args.drain(i..i + 2);
|
||||
size = Some(value);
|
||||
} else if let Some(value) = arg.strip_prefix("--max-file-size=") {
|
||||
size = Some(value.to_string());
|
||||
args.remove(i);
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
let Some(size) = size else { return Ok(()) };
|
||||
let bytes = solidcraft_engine::io::limits::parse_flag(&size).map_err(|e| format!("--max-file-size: {e}"))?;
|
||||
solidcraft_engine::io::limits::set_override(Some(bytes))
|
||||
}
|
||||
|
||||
fn pretty(v: &Value) -> String {
|
||||
serde_json::to_string_pretty(v).unwrap_or_default()
|
||||
}
|
||||
@@ -241,11 +268,12 @@ fn wants_help(args: &[String]) -> bool {
|
||||
pub fn read_json(path: &str) -> Result<Value, String> {
|
||||
// Through the engine's file access, which refuses anything that is not a regular file and
|
||||
// reads no more than the cap: a character device or a FIFO would otherwise never end.
|
||||
let s = solidcraft_engine::io::vfs::read_to_string(path, solidcraft_engine::io::MAX_DESIGN_BYTES).map_err(|e| format!("{path}: {e}"))?;
|
||||
let s = solidcraft_engine::io::vfs::read_to_string(path, solidcraft_engine::io::limits::max_design_bytes())
|
||||
.map_err(|e| format!("{path}: {}", solidcraft_engine::io::limits::explain(solidcraft_engine::io::limits::Kind::Design, e)))?;
|
||||
serde_json::from_str(&s).map_err(|e| format!("{path}: {e}"))
|
||||
}
|
||||
|
||||
/// A session from a design file, a STEP/3MF/STL file, a command script, or an oracle recipe.
|
||||
/// A session from a design file, a STEP/3MF/STL file, a point cloud, a command script, or an oracle recipe.
|
||||
pub fn load(path: &str) -> Result<Session, String> {
|
||||
load_checked(path, solidcraft_engine::schema::ParamCheck::Off)
|
||||
}
|
||||
@@ -255,11 +283,11 @@ pub fn load(path: &str) -> Result<Session, String> {
|
||||
fn load_checked(path: &str, check: solidcraft_engine::schema::ParamCheck) -> Result<Session, String> {
|
||||
let mut s = Session::default();
|
||||
s.param_check = check;
|
||||
if solidcraft_engine::io::is_step_path(path) || solidcraft_engine::io::is_mesh_path(path) {
|
||||
if solidcraft_engine::io::is_step_path(path) || solidcraft_engine::io::is_mesh_path(path) || solidcraft_engine::io::is_point_cloud_path(path) {
|
||||
s.execute("doc.open", &json!({"path": path})).map_err(|e| e.to_string())?;
|
||||
return Ok(s);
|
||||
}
|
||||
let bytes = solidcraft_engine::io::vfs::read(path, solidcraft_engine::io::MAX_DESIGN_BYTES).map_err(|e| format!("{path}: {e}"))?;
|
||||
let bytes = solidcraft_engine::io::limits::read(path, solidcraft_engine::io::limits::Kind::Design).map_err(|e| format!("{path}: {e}"))?;
|
||||
if solidcraft_engine::io::is_design_container(&bytes) {
|
||||
let doc = solidcraft_engine::io::read_design(&bytes).map_err(|e| format!("{path}: {e}"))?;
|
||||
let mut session = Session::opened_at(doc, None, Some(path));
|
||||
@@ -653,7 +681,7 @@ fn cmd_mcp(args: &[String]) -> Result<(), String> {
|
||||
if let Some(s) = &scope {
|
||||
let roots: Vec<String> = s.roots().iter().map(|r| r.display().to_string()).collect();
|
||||
eprintln!(
|
||||
"solidcraft mcp: files limited to {} and the open design's folder (--allow-path DIR adds one, --allow-any-path lifts the limit)",
|
||||
"solidcraft mcp: files limited to {} and the folders of designs opened or saved here (--allow-path DIR adds one, --allow-any-path lifts the limit)",
|
||||
roots.join(", ")
|
||||
);
|
||||
let design_dir = flag(args, "--in")
|
||||
@@ -820,8 +848,8 @@ pub(crate) fn cmd_bench_open(args: &[String]) -> Result<(), String> {
|
||||
let path = args.first().ok_or("usage: solidcraft-cli bench-open <design.sc | part.step> [--parse-only]")?;
|
||||
let t = std::time::Instant::now();
|
||||
let step = solidcraft_engine::io::is_step_path(path);
|
||||
let limit = if step { solidcraft_engine::io::MAX_STEP_BYTES } else { solidcraft_engine::io::MAX_DESIGN_BYTES };
|
||||
let bytes = solidcraft_engine::io::vfs::read(path, limit).map_err(|e| format!("{path}: {e}"))?;
|
||||
let kind = if step { solidcraft_engine::io::limits::Kind::Step } else { solidcraft_engine::io::limits::Kind::Design };
|
||||
let bytes = solidcraft_engine::io::limits::read(path, kind).map_err(|e| format!("{path}: {e}"))?;
|
||||
let read_ms = t.elapsed().as_secs_f64() * 1000.0;
|
||||
println!("{}", json!({"step": "read", "ms": read_ms, "bytes": bytes.len()}));
|
||||
let t = std::time::Instant::now();
|
||||
|
||||
@@ -157,3 +157,34 @@ fn render_help_keeps_the_registered_gpu_request_controls() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `--max-file-size` (#4086), with any command: the usage names it, a bad size stops the run
|
||||
/// with the reason, and a design over the default limit opens once the flag raises it.
|
||||
#[test]
|
||||
fn max_file_size_raises_the_limit_and_refuses_bad_sizes() {
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_solidcraft-cli")).arg("--help").output().unwrap();
|
||||
assert!(String::from_utf8_lossy(&output.stdout).contains("--max-file-size"));
|
||||
for size in ["17GB", "2", "lots"] {
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_solidcraft-cli")).args(["--max-file-size", size, "exec", "file.new"]).output().unwrap();
|
||||
assert!(!output.status.success(), "{size} was accepted");
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(stderr.starts_with("error: --max-file-size"), "{size}: {stderr}");
|
||||
}
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_solidcraft-cli")).args(["exec", "file.new", "--max-file-size=2GB"]).output().unwrap();
|
||||
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
|
||||
|
||||
// A sparse design file just over the default 256 MB: refused unread, then read with the flag
|
||||
// (and refused for what it holds, which is no design).
|
||||
let dir = std::env::temp_dir().join(format!("solidcraft-cli-4086-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let path = dir.join("big.solidcraft");
|
||||
std::fs::File::create(&path).unwrap().set_len((256 << 20) + 1).unwrap();
|
||||
let path = path.to_string_lossy().to_string();
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_solidcraft-cli")).args(["eval", &path]).output().unwrap();
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(!output.status.success() && stderr.contains("too large") && stderr.contains("--max-file-size"), "{stderr}");
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_solidcraft-cli")).args(["--max-file-size", "1GB", "eval", &path]).output().unwrap();
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(!output.status.success() && !stderr.contains("too large"), "{stderr}");
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ pub enum Intent {
|
||||
Open,
|
||||
/// Add its bodies to the open design (STEP, 3MF, STL).
|
||||
Insert,
|
||||
/// Import it as a theme: it was dropped on Preferences' Import tile (#8226).
|
||||
Theme,
|
||||
}
|
||||
|
||||
/// A stored design, as the file panel lists it.
|
||||
@@ -615,13 +617,15 @@ fn choose_file(accept: &str) -> Result<js_sys::Promise, String> {
|
||||
}
|
||||
|
||||
/// Read files dropped on the page.
|
||||
pub fn take_drops(files: &Rc<Files>, raw: &mut egui::RawInput) {
|
||||
/// `theme`: the pointer is over Preferences' Import tile, so the files are themes.
|
||||
pub fn take_drops(files: &Rc<Files>, raw: &mut egui::RawInput, theme: bool) {
|
||||
let intent = if theme { Intent::Theme } else { Intent::Insert };
|
||||
for f in std::mem::take(&mut raw.dropped_files) {
|
||||
let files = files.clone();
|
||||
spawn_local(async move {
|
||||
let name = f.path().file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "dropped".into());
|
||||
match f.bytes_async().await {
|
||||
Ok(b) => files.arrive(name, b, Intent::Insert),
|
||||
Ok(b) => files.arrive(name, b, intent),
|
||||
Err(e) => files.say(format!("{name}: {e}"), true),
|
||||
}
|
||||
});
|
||||
|
||||
@@ -112,6 +112,13 @@ fn check_download_size(current: usize, incoming: u64) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Ctrl+W (⌘W, without Shift or Alt) while a design is shown closes it in the app, so the
|
||||
/// browser must not close the tab (#5366). On the start page the browser closes the tab.
|
||||
#[cfg(any(target_arch = "wasm32", test))]
|
||||
fn closes_design(key: &str, command: bool, shift: bool, alt: bool, design_shown: bool) -> bool {
|
||||
design_shown && command && !shift && !alt && key.eq_ignore_ascii_case("w")
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod web {
|
||||
use std::rc::Rc;
|
||||
@@ -163,6 +170,23 @@ mod web {
|
||||
thread_local! {
|
||||
/// An open design has unsaved changes: leaving the page asks first.
|
||||
static UNSAVED: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
|
||||
/// A design is shown (not the start page): Ctrl+W closes it, not the browser tab.
|
||||
static DESIGN_SHOWN: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
|
||||
}
|
||||
|
||||
/// Ctrl+W (⌘W) closes the design shown, as on the desktop; on the start page it is left to
|
||||
/// the browser, which closes the tab (#5366). Browsers that keep Ctrl+W to themselves still
|
||||
/// close the tab, after asking when a design is unsaved ([`ask_before_unload`]).
|
||||
fn keep_ctrl_w_for_the_design(window: &web_sys::Window) {
|
||||
let on_key = wasm_bindgen::closure::Closure::<dyn FnMut(web_sys::KeyboardEvent)>::new(|e: web_sys::KeyboardEvent| {
|
||||
let command = e.ctrl_key() || e.meta_key();
|
||||
if crate::closes_design(&e.key(), command, e.shift_key(), e.alt_key(), DESIGN_SHOWN.with(std::cell::Cell::get)) {
|
||||
e.prevent_default();
|
||||
}
|
||||
});
|
||||
let _ = window.add_event_listener_with_callback_and_bool("keydown", on_key.as_ref().unchecked_ref(), true);
|
||||
// The listener lives as long as the page.
|
||||
on_key.forget();
|
||||
}
|
||||
|
||||
/// The browser's "leave site? changes you made may not be saved" prompt while a design has
|
||||
@@ -271,6 +295,10 @@ mod web {
|
||||
!companion
|
||||
});
|
||||
for (name, bytes, intent) in incoming {
|
||||
if intent == Intent::Theme {
|
||||
solidcraft_ui_egui::prefs::import_theme_bytes(&mut self.app, bytes);
|
||||
continue;
|
||||
}
|
||||
let design = solidcraft_engine::io::is_design_path(&name);
|
||||
let path = if design && intent == Intent::Open {
|
||||
// A design from the computer is kept in the browser (a copy), so Save works.
|
||||
@@ -287,7 +315,7 @@ mod web {
|
||||
};
|
||||
match intent {
|
||||
Intent::Open => self.app.open_path(&path),
|
||||
Intent::Insert => self.app.drop_path(&path),
|
||||
Intent::Insert | Intent::Theme => self.app.drop_path(&path),
|
||||
}
|
||||
self.files.panel.set(false);
|
||||
}
|
||||
@@ -353,7 +381,8 @@ mod web {
|
||||
}
|
||||
let mut act: Option<(&'static str, String)> = None;
|
||||
let closed = solidcraft_ui_egui::ui_kit::Window::new(egui::Id::new("sc_browser_files"), "folder", "Files in this browser")
|
||||
.cards(3.0)
|
||||
// Room for long names; the kit still caps the window at the browser's width.
|
||||
.cards(4.0)
|
||||
.show_body(ctx, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
if ui_kit::button(ui, "Open from computer…", ui_kit::Button::Normal).clicked() {
|
||||
@@ -381,61 +410,62 @@ mod web {
|
||||
return;
|
||||
}
|
||||
let entries = self.files.entries.borrow().clone();
|
||||
if entries.is_empty() {
|
||||
ui.label("Designs you save appear here. They stay in this browser.");
|
||||
}
|
||||
egui::ScrollArea::vertical().max_height(360.0).show(ui, |ui| {
|
||||
egui::Grid::new("opfs_files").num_columns(3).spacing([12.0, 6.0]).show(ui, |ui| {
|
||||
// The name takes the width the size and the actions leave (#8097).
|
||||
let empty = "Designs you save appear here. They stay in this browser.";
|
||||
ui_kit::name_list(ui, "opfs_files", &["Name", "Size", "Actions"], empty, |list| {
|
||||
for e in &entries {
|
||||
match &mut self.renaming {
|
||||
Some((from, to)) if *from == e.name => {
|
||||
let r = ui_kit::cell_editor(ui, ui.make_persistent_id(("stored_file_name", from.as_str())), to, "", false);
|
||||
if std::mem::take(&mut self.rename_focus) {
|
||||
r.request_focus();
|
||||
}
|
||||
if r.lost_focus() {
|
||||
act = Some(if ui.input(|i| i.key_pressed(egui::Key::Enter)) {
|
||||
("rename", to.clone())
|
||||
} else {
|
||||
("rename_cancel", String::new())
|
||||
});
|
||||
list.row(&e.name, |row| {
|
||||
match &mut self.renaming {
|
||||
Some((from, to)) if *from == e.name => row.cell(|ui| {
|
||||
let r =
|
||||
ui_kit::cell_editor(ui, ui.make_persistent_id(("stored_file_name", from.as_str())), to, "", false);
|
||||
if std::mem::take(&mut self.rename_focus) {
|
||||
r.request_focus();
|
||||
}
|
||||
if r.lost_focus() {
|
||||
act = Some(if ui.input(|i| i.key_pressed(egui::Key::Enter)) {
|
||||
("rename", to.clone())
|
||||
} else {
|
||||
("rename_cancel", String::new())
|
||||
});
|
||||
}
|
||||
}),
|
||||
_ => {
|
||||
row.name(&e.name);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
ui.label(&e.name);
|
||||
}
|
||||
}
|
||||
ui.label(format!("{:.1} KB", e.size as f64 / 1024.0));
|
||||
ui.horizontal(|ui| {
|
||||
if ui_kit::button(ui, "Open", ui_kit::Button::Small).clicked() {
|
||||
act = Some(("open", e.name.clone()));
|
||||
}
|
||||
let design = solidcraft_engine::io::is_design_path(&e.name);
|
||||
if !design
|
||||
&& ui_kit::button(ui, "Insert", ui_kit::Button::Small)
|
||||
.on_hover_text(solidcraft_ui_egui::i18n::tr("web.files.insert_stored_drawings_hint"))
|
||||
row.cell(|ui| ui.label(format!("{:.1} KB", e.size as f64 / 1024.0)));
|
||||
row.cell(|ui| {
|
||||
if ui_kit::button(ui, "Open", ui_kit::Button::Small).clicked() {
|
||||
act = Some(("open", e.name.clone()));
|
||||
}
|
||||
let design = solidcraft_engine::io::is_design_path(&e.name);
|
||||
if !design
|
||||
&& ui_kit::button(ui, "Insert", ui_kit::Button::Small)
|
||||
.on_hover_text(solidcraft_ui_egui::i18n::tr("web.files.insert_stored_drawings_hint"))
|
||||
.clicked()
|
||||
{
|
||||
act = Some(("insert", e.name.clone()));
|
||||
}
|
||||
if ui_kit::button(ui, "Rename", ui_kit::Button::Small).clicked() {
|
||||
self.renaming = Some((e.name.clone(), e.name.clone()));
|
||||
self.rename_focus = true;
|
||||
}
|
||||
if ui_kit::button(ui, "Save to computer…", ui_kit::Button::Small)
|
||||
.on_hover_text("A copy in a file you choose; the stored design stays here")
|
||||
.clicked()
|
||||
{
|
||||
act = Some(("insert", e.name.clone()));
|
||||
}
|
||||
if ui_kit::button(ui, "Rename", ui_kit::Button::Small).clicked() {
|
||||
self.renaming = Some((e.name.clone(), e.name.clone()));
|
||||
self.rename_focus = true;
|
||||
}
|
||||
if ui_kit::button(ui, "Save to computer…", ui_kit::Button::Small)
|
||||
.on_hover_text("A copy in a file you choose; the stored design stays here")
|
||||
.clicked()
|
||||
{
|
||||
act = Some(("save_copy", e.name.clone()));
|
||||
}
|
||||
if ui_kit::button(ui, "Download", ui_kit::Button::Small).clicked() {
|
||||
act = Some(("download", e.name.clone()));
|
||||
}
|
||||
if ui_kit::button(ui, "Delete", ui_kit::Button::Small).clicked() {
|
||||
act = Some(("delete", e.name.clone()));
|
||||
}
|
||||
{
|
||||
act = Some(("save_copy", e.name.clone()));
|
||||
}
|
||||
if ui_kit::button(ui, "Download", ui_kit::Button::Small).clicked() {
|
||||
act = Some(("download", e.name.clone()));
|
||||
}
|
||||
if ui_kit::button(ui, "Delete", ui_kit::Button::Small).clicked() {
|
||||
act = Some(("delete", e.name.clone()));
|
||||
}
|
||||
});
|
||||
});
|
||||
ui.end_row();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -623,6 +653,7 @@ mod web {
|
||||
self.space_mouse.logic(&mut self.app, ctx);
|
||||
self.files_tick(ctx);
|
||||
UNSAVED.with(|u| u.set(solidcraft_ui_egui::documents::any_dirty(&self.app)));
|
||||
DESIGN_SHOWN.with(|d| d.set(solidcraft_ui_egui::toolbar::design_shown(&self.app)));
|
||||
}
|
||||
fn raw_input_hook(&mut self, ctx: &egui::Context, raw: &mut egui::RawInput) {
|
||||
let now = raw.time.unwrap_or_else(|| ctx.input(|i| i.time));
|
||||
@@ -630,7 +661,8 @@ mod web {
|
||||
ctx.request_repaint_after(delay);
|
||||
}
|
||||
if self.launch.persists() {
|
||||
files::take_drops(&self.files, raw);
|
||||
let theme = solidcraft_ui_egui::prefs::theme_drop_target(&self.app, ctx);
|
||||
files::take_drops(&self.files, raw, theme);
|
||||
} else {
|
||||
raw.dropped_files.clear();
|
||||
}
|
||||
@@ -722,6 +754,7 @@ mod web {
|
||||
ask_before_unload(&window);
|
||||
}
|
||||
leave_tab_switching_to_browser(&window);
|
||||
keep_ctrl_w_for_the_design(&window);
|
||||
let Some(document) = window.document() else { return };
|
||||
let Some(canvas) = document.get_element_by_id(CANVAS_ID).and_then(|e| e.dyn_into::<web_sys::HtmlCanvasElement>().ok()) else {
|
||||
log::error!("missing <canvas id=\"{CANVAS_ID}\">");
|
||||
@@ -954,4 +987,18 @@ mod tests {
|
||||
assert!(!browser_switches_tabs("Tab", false));
|
||||
assert!(!browser_switches_tabs("s", true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ctrl_w_closes_the_design_not_the_tab() {
|
||||
// Ctrl+W and ⌘W (either case of the key) close the design shown.
|
||||
assert!(closes_design("w", true, false, false, true));
|
||||
assert!(closes_design("W", true, false, false, true));
|
||||
// On the start page the browser closes the tab.
|
||||
assert!(!closes_design("w", true, false, false, false));
|
||||
// Ctrl+Shift+W (close the window), plain W and other keys stay the browser's or the app's.
|
||||
assert!(!closes_design("W", true, true, false, true));
|
||||
assert!(!closes_design("w", true, false, true, true));
|
||||
assert!(!closes_design("w", false, false, false, true));
|
||||
assert!(!closes_design("s", true, false, false, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,11 @@ libc = "0.2"
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
|
||||
winit = { version = "0.30", default-features = false, features = ["x11"] }
|
||||
# Bringing the window forward on X11 when a close asks about unsaved designs (src/come_forward.rs):
|
||||
# the window's id, and the window manager request winit doesn't send (MIT OR Apache-2.0; both
|
||||
# already in the tree through eframe and winit).
|
||||
raw-window-handle = "0.6"
|
||||
x11rb = { version = "0.13", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
embed-resource = "3.0.11"
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
//! Bringing the window forward when a close stops at "save changes?".
|
||||
//!
|
||||
//! A close from the taskbar or a window switcher reaches the window while another app has the
|
||||
//! focus. The prompt it opens is only seen once the window comes forward, so the window asks for
|
||||
//! the focus then. A window the user is already in is left alone.
|
||||
//!
|
||||
//! winit's Focus asks as an application, which a window manager with focus-stealing prevention
|
||||
//! (KWin's default) refuses for a window used before the switch away: it only marks the taskbar
|
||||
//! entry. On X11 the request is sent again with the source EWMH gives "direct user actions"
|
||||
//! (`_NET_ACTIVE_WINDOW`, source 2), which is what this is: the prompt is the rest of the user's
|
||||
//! close. Native Wayland has no way for a window to raise itself, so there the attention request
|
||||
//! (xdg-activation) lets the compositor raise it or mark its taskbar entry.
|
||||
//!
|
||||
//! When: not at once. KWin raises the window, then the taskbar's closing context menu hands the
|
||||
//! focus back to the app that had it, a few milliseconds later, and the window would flicker
|
||||
//! forward and back. So the window asks once the menu is gone, `FIRST_AFTER` the close. It asks
|
||||
//! again only if the focus is taken back right after it came (a slow menu) or never came; a later
|
||||
//! switch is the user's own, and the window stays where the user put it.
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// From the close to the first request: past the taskbar menu's focus hand-back (2 to 11 ms on
|
||||
/// KDE Plasma 6), too short to notice.
|
||||
const FIRST_AFTER: Duration = Duration::from_millis(120);
|
||||
/// After the first request, how long the window asks again when it loses the focus: short of
|
||||
/// anything the user does next.
|
||||
const KEEP_ASKING: Duration = Duration::from_millis(400);
|
||||
/// The least time between two requests.
|
||||
const AGAIN_AFTER: Duration = Duration::from_millis(100);
|
||||
/// Focus lost this soon after a request was taken back by the taskbar menu; later, by the user.
|
||||
const TAKEN_BACK_WITHIN: Duration = Duration::from_millis(50);
|
||||
|
||||
/// The window coming forward after a close that asks about unsaved designs.
|
||||
#[derive(Default)]
|
||||
pub struct ComeForward {
|
||||
/// The first request and the end of asking; `None`: not asking.
|
||||
window: Option<(Instant, Instant)>,
|
||||
/// The last request.
|
||||
last: Option<Instant>,
|
||||
/// The window has had the focus since the last request.
|
||||
held: bool,
|
||||
}
|
||||
|
||||
/// What a frame does while the window is coming forward.
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum Step {
|
||||
/// Ask for the focus now.
|
||||
Ask,
|
||||
/// Look again after this long.
|
||||
Wait(Duration),
|
||||
/// Done asking.
|
||||
Done,
|
||||
}
|
||||
|
||||
impl ComeForward {
|
||||
/// A close stopped at the prompt: ask for the focus shortly.
|
||||
pub fn start(&mut self, now: Instant) {
|
||||
let first = now + FIRST_AFTER;
|
||||
self.window = Some((first, first + KEEP_ASKING));
|
||||
self.last = None;
|
||||
self.held = false;
|
||||
}
|
||||
|
||||
/// Every frame: ask once the taskbar menu is gone, and again while the focus is taken back.
|
||||
pub fn tick(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {
|
||||
if self.window.is_none() {
|
||||
return;
|
||||
}
|
||||
let (focused, minimized) = ctx.input(|i| (i.viewport().focused, i.viewport().minimized));
|
||||
// The app may be idle: a frame to look again.
|
||||
match self.step(Instant::now(), focused) {
|
||||
Step::Ask => {
|
||||
bring(ctx, frame, minimized);
|
||||
ctx.request_repaint_after(AGAIN_AFTER);
|
||||
}
|
||||
Step::Wait(after) => ctx.request_repaint_after(after),
|
||||
Step::Done => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn step(&mut self, now: Instant, focused: Option<bool>) -> Step {
|
||||
let Some((first, until)) = self.window else { return Step::Done };
|
||||
if now >= until {
|
||||
self.window = None;
|
||||
return Step::Done;
|
||||
}
|
||||
if now < first {
|
||||
return Step::Wait(first - now);
|
||||
}
|
||||
let Some(last) = self.last else {
|
||||
if focused == Some(true) {
|
||||
// The user went back to the window already.
|
||||
self.window = None;
|
||||
return Step::Done;
|
||||
}
|
||||
self.last = Some(now);
|
||||
return Step::Ask;
|
||||
};
|
||||
if focused == Some(true) {
|
||||
self.held = true;
|
||||
return Step::Wait(until - now);
|
||||
}
|
||||
if self.held {
|
||||
if now.duration_since(last) >= TAKEN_BACK_WITHIN {
|
||||
// The user switched away: leave the window there.
|
||||
self.window = None;
|
||||
return Step::Done;
|
||||
}
|
||||
self.held = false;
|
||||
}
|
||||
let next = last + AGAIN_AFTER;
|
||||
if now < next {
|
||||
return Step::Wait(next - now);
|
||||
}
|
||||
self.last = Some(now);
|
||||
Step::Ask
|
||||
}
|
||||
}
|
||||
|
||||
/// Ask for the focus once.
|
||||
fn bring(ctx: &egui::Context, frame: &eframe::Frame, minimized: Option<bool>) {
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
let raised = match x11_activate(frame) {
|
||||
Ok(sent) => sent,
|
||||
Err(e) => {
|
||||
log::warn!("bringing the window forward through X11: {e}");
|
||||
false
|
||||
}
|
||||
};
|
||||
#[cfg(not(all(unix, not(target_os = "macos"))))]
|
||||
let raised = {
|
||||
let _ = frame;
|
||||
false
|
||||
};
|
||||
for c in commands(minimized, raised) {
|
||||
ctx.send_viewport_cmd(c);
|
||||
}
|
||||
}
|
||||
|
||||
/// The viewport commands for a window in the background; `raised`: the X11 request went out,
|
||||
/// which also restores a minimized window.
|
||||
fn commands(minimized: Option<bool>, raised: bool) -> Vec<egui::ViewportCommand> {
|
||||
if raised {
|
||||
return vec![egui::ViewportCommand::Focus];
|
||||
}
|
||||
let mut commands = Vec::new();
|
||||
if minimized == Some(true) {
|
||||
commands.push(egui::ViewportCommand::Minimized(false));
|
||||
}
|
||||
commands.push(egui::ViewportCommand::Focus);
|
||||
commands.push(egui::ViewportCommand::RequestUserAttention(egui::UserAttentionType::Informational));
|
||||
commands
|
||||
}
|
||||
|
||||
/// Ask the X11 window manager to activate the window as a user action. `Ok(false)`: the window
|
||||
/// isn't an X11 window (native Wayland).
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
fn x11_activate(frame: &eframe::Frame) -> Result<bool, String> {
|
||||
use raw_window_handle::{HasWindowHandle, RawWindowHandle};
|
||||
use x11rb::connection::Connection;
|
||||
use x11rb::protocol::xproto::{ClientMessageEvent, ConnectionExt, EventMask};
|
||||
|
||||
let handle = frame.window_handle().map_err(|e| e.to_string())?;
|
||||
let window = match handle.as_raw() {
|
||||
RawWindowHandle::Xlib(h) => u32::try_from(h.window).map_err(|e| e.to_string())?,
|
||||
RawWindowHandle::Xcb(h) => h.window.get(),
|
||||
_ => return Ok(false),
|
||||
};
|
||||
// A connection of its own: winit's isn't reachable, and a close that asks is rare.
|
||||
let (conn, screen) = x11rb::connect(None).map_err(|e| e.to_string())?;
|
||||
let root = conn.setup().roots.get(screen).ok_or("no X11 screen")?.root;
|
||||
let atom = conn.intern_atom(false, b"_NET_ACTIVE_WINDOW").map_err(|e| e.to_string())?.reply().map_err(|e| e.to_string())?.atom;
|
||||
// Source 2: a direct user action; the time is the server's current time.
|
||||
let event = ClientMessageEvent::new(32, window, atom, [2, x11rb::CURRENT_TIME, 0, 0, 0]);
|
||||
conn.send_event(false, root, EventMask::SUBSTRUCTURE_REDIRECT | EventMask::SUBSTRUCTURE_NOTIFY, event).map_err(|e| e.to_string())?;
|
||||
conn.flush().map_err(|e| e.to_string())?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{AGAIN_AFTER, ComeForward, FIRST_AFTER, KEEP_ASKING, Step};
|
||||
use eframe::egui::{UserAttentionType, ViewportCommand as C};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// The first request waits until the taskbar menu has handed the focus back. The window asks
|
||||
/// again when the focus is taken back right after it came, or never came, no more often than
|
||||
/// every `AGAIN_AFTER` and only for `KEEP_ASKING`; a later switch away is the user's.
|
||||
#[test]
|
||||
fn the_window_asks_once_the_taskbar_menu_is_gone() {
|
||||
let t0 = Instant::now();
|
||||
let ms = |n: u64| Duration::from_millis(n);
|
||||
let at = |n: u64| t0 + ms(n);
|
||||
let (first, again, keep) = (FIRST_AFTER.as_millis() as u64, AGAIN_AFTER.as_millis() as u64, KEEP_ASKING.as_millis() as u64);
|
||||
let mut f = ComeForward::default();
|
||||
assert_eq!(f.step(t0, Some(false)), Step::Done, "not started");
|
||||
f.start(t0);
|
||||
assert_eq!(f.step(t0, Some(false)), Step::Wait(FIRST_AFTER), "the menu is still closing");
|
||||
assert_eq!(f.step(at(5), Some(false)), Step::Wait(ms(first - 5)));
|
||||
assert_eq!(f.step(at(first), Some(false)), Step::Ask);
|
||||
assert_eq!(f.step(at(first + 3), Some(true)), Step::Wait(ms(keep - 3)), "raised");
|
||||
// A slow menu takes the focus back 10 ms later: ask again, not before AGAIN_AFTER.
|
||||
assert_eq!(f.step(at(first + 10), Some(false)), Step::Wait(ms(again - 10)));
|
||||
assert_eq!(f.step(at(first + again), Some(false)), Step::Ask);
|
||||
assert_eq!(f.step(at(first + again + 3), Some(true)), Step::Wait(ms(keep - again - 3)));
|
||||
// The user clicks another app 200 ms later: the window stays behind.
|
||||
assert_eq!(f.step(at(first + again + 200), Some(false)), Step::Done);
|
||||
assert_eq!(f.step(at(first + again + 300), Some(false)), Step::Done);
|
||||
|
||||
// Never raised (the request was refused): ask again every AGAIN_AFTER, for KEEP_ASKING.
|
||||
f.start(t0);
|
||||
assert_eq!(f.step(at(first), None), Step::Ask, "unknown focus counts as out of focus");
|
||||
assert_eq!(f.step(at(first + again), Some(false)), Step::Ask);
|
||||
assert_eq!(f.step(at(first + keep), Some(false)), Step::Done);
|
||||
|
||||
// Back in the window before the first request: nothing to do.
|
||||
f.start(t0);
|
||||
assert_eq!(f.step(at(first), Some(true)), Step::Done);
|
||||
}
|
||||
|
||||
/// Without the X11 request: focus, and the attention mark where focus is refused; a minimized
|
||||
/// window is restored first.
|
||||
#[test]
|
||||
fn a_window_closed_from_the_background_comes_forward() {
|
||||
let forward = [C::Focus, C::RequestUserAttention(UserAttentionType::Informational)];
|
||||
assert_eq!(super::commands(Some(false), false), forward);
|
||||
assert_eq!(super::commands(None, false), forward, "unknown counts as not minimized");
|
||||
let minimized = super::commands(Some(true), false);
|
||||
assert_eq!(minimized.first(), Some(&C::Minimized(false)));
|
||||
assert_eq!(minimized.get(1..), Some(&forward[..]));
|
||||
// The window manager took the X11 request: nothing left to mark.
|
||||
assert_eq!(super::commands(Some(true), true), [C::Focus]);
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
#[path = "../../../assets/icons/app/shared/source/app_icon.rs"]
|
||||
mod app_icon;
|
||||
mod come_forward;
|
||||
mod control_server;
|
||||
mod device_lost;
|
||||
#[cfg(target_os = "windows")]
|
||||
@@ -84,6 +85,8 @@ struct App {
|
||||
frames: u32,
|
||||
/// Started over the control channel: the window doesn't ask for the foreground.
|
||||
take_focus_unwanted: bool,
|
||||
/// Coming forward after a close that asks about unsaved designs.
|
||||
come_forward: come_forward::ComeForward,
|
||||
/// The graphics device: lost, it can't draw again (`App::watch_device`, #4172).
|
||||
gpu: Option<LostWatch>,
|
||||
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||
@@ -139,7 +142,13 @@ impl eframe::App for App {
|
||||
if ctx.input(|i| i.viewport().close_requested()) && !self.solve.quit_requested {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
|
||||
solidcraft_ui_egui::documents::request_quit(&mut self.solve);
|
||||
// Closed from the taskbar or a window switcher while another app had the focus: the
|
||||
// "save changes?" prompt is only seen once the window comes forward.
|
||||
if !self.solve.quit_requested {
|
||||
self.come_forward.start(std::time::Instant::now());
|
||||
}
|
||||
}
|
||||
self.come_forward.tick(ctx, _frame);
|
||||
#[cfg(target_os = "macos")]
|
||||
for f in if self.solve.file_picker_busy() { Vec::new() } else { open_documents::take() } {
|
||||
self.solve.open_path_async(&f);
|
||||
@@ -752,12 +761,15 @@ fn main() -> eframe::Result {
|
||||
let mut sample = false;
|
||||
// `--theme-file PATH`: follow that theme file for this run without saving it (#7573).
|
||||
let mut theme_file: Option<String> = None;
|
||||
let mut max_file_size = None;
|
||||
let mut args = std::env::args().skip(1);
|
||||
while let Some(a) = args.next() {
|
||||
match a.as_str() {
|
||||
"--control" => control_port = args.next().and_then(|p| p.parse().ok()),
|
||||
"--sample" => sample = true,
|
||||
"--theme-file" => theme_file = args.next(),
|
||||
"--max-file-size" => max_file_size = Some(args.next()),
|
||||
s if s.starts_with("--max-file-size=") => max_file_size = Some(s.strip_prefix("--max-file-size=").map(str::to_string)),
|
||||
"--safe-mode" => safe_mode = true,
|
||||
"--version" | "-V" => {
|
||||
println!("solidcraft {}", env!("CARGO_PKG_VERSION"));
|
||||
@@ -778,13 +790,21 @@ fn main() -> eframe::Result {
|
||||
}
|
||||
"--help" | "-h" => {
|
||||
println!(
|
||||
"usage: solidcraft [--control PORT] [--sample] [--theme-file THEME.json] [--crash-log] [--safe-mode] [design.sc | part.step]"
|
||||
"usage: solidcraft [--control PORT] [--sample] [--theme-file THEME.json] [--crash-log] [--safe-mode] [--max-file-size SIZE] [design.sc | part.step]"
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
_ => files.push(a),
|
||||
}
|
||||
}
|
||||
// `--max-file-size 2GB`: the largest files this run reads, over Preferences, never saved (#4086).
|
||||
if let Some(value) = max_file_size {
|
||||
let applied = startup::max_file_size(value.as_deref()).and_then(|bytes| solidcraft_engine::io::limits::set_override(Some(bytes)));
|
||||
if let Err(error) = applied {
|
||||
eprintln!("SolidCraft: {error}");
|
||||
return Err(eframe::Error::AppCreation(std::io::Error::other(error).into()));
|
||||
}
|
||||
}
|
||||
// Settings that don't read are moved aside; launches that never got a window are counted,
|
||||
// and after a few in a row this one starts in safe mode (docs/book/src/guide/troubleshooting.md).
|
||||
let mut notes: Vec<String> = Vec::new();
|
||||
@@ -1060,6 +1080,7 @@ fn main() -> eframe::Result {
|
||||
starting,
|
||||
frames: 0,
|
||||
take_focus_unwanted: control_port.is_some(),
|
||||
come_forward: come_forward::ComeForward::default(),
|
||||
gpu,
|
||||
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||
space_mouse,
|
||||
|
||||
@@ -302,6 +302,14 @@ pub fn system_title_bar(windows: bool, backends: eframe::wgpu::Backends) -> bool
|
||||
windows && backends.contains(Backends::GL) && !backends.intersects(Backends::DX12 | Backends::VULKAN)
|
||||
}
|
||||
|
||||
/// The `--max-file-size` value (#4086): a size such as `2GB` or `1500MB`, at most 16 GB. It raises
|
||||
/// the largest STEP/import and design file this run reads, over the saved preference, without
|
||||
/// saving anything. A missing or bad value stops the start with this error.
|
||||
pub fn max_file_size(value: Option<&str>) -> Result<u64, String> {
|
||||
let value = value.ok_or("--max-file-size needs a size, for example --max-file-size 2GB")?;
|
||||
solidcraft_engine::io::limits::parse_flag(value).map_err(|e| format!("--max-file-size: {e}"))
|
||||
}
|
||||
|
||||
/// The message shown when no window could be opened at all.
|
||||
pub fn no_window_message(error: &str, settings: Option<&Path>) -> String {
|
||||
let folder = settings.map(|d| d.display().to_string()).unwrap_or_else(|| "the SolidCraft settings folder".into());
|
||||
@@ -324,6 +332,16 @@ mod tests {
|
||||
["Integrated", "Discrete small", "Discrete large"].into_iter().map(|name| AdapterChoice { name: name.into(), compatible: true }).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn max_file_size_parses_sizes_and_refuses_bad_ones() {
|
||||
assert_eq!(max_file_size(Some("2GB")), Ok(2 << 30));
|
||||
assert_eq!(max_file_size(Some("1500MB")), Ok(1500 << 20));
|
||||
for bad in [None, Some(""), Some("2"), Some("17GB"), Some("lots"), Some("-1GB")] {
|
||||
let error = max_file_size(bad).unwrap_err();
|
||||
assert!(error.contains("--max-file-size"), "{bad:?}: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn adapter_names_environment_override_and_missing_card_fallback() {
|
||||
let cards = cards();
|
||||
|
||||
@@ -27,6 +27,9 @@ error = { master = "status_error", accent = "surface" }
|
||||
warning = { master = "status_warning", accent = "mesh" }
|
||||
ground = "c_fix"
|
||||
|
||||
# Visual style: Shaded with edges is the generic style icon.
|
||||
style_shaded_edges = "style"
|
||||
|
||||
# Same finished drawing, different semantic operation. Colours live only in palette.toml.
|
||||
sketch_break = { master = "break", accent = "sketch" }
|
||||
sketch_cancel = { master = "close", accent = "sketch" }
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
accessibility false
|
||||
activate false
|
||||
agent_chat false
|
||||
align false
|
||||
ambient_occlusion false
|
||||
appearance false
|
||||
arc3 false
|
||||
arc_center false
|
||||
@@ -83,6 +85,8 @@ decal false
|
||||
delete false
|
||||
delete_face false
|
||||
dimension false
|
||||
display false
|
||||
dots false
|
||||
draft false
|
||||
draft_analysis false
|
||||
drive false
|
||||
@@ -101,6 +105,7 @@ eye false
|
||||
fastener false
|
||||
fillet false
|
||||
finish false
|
||||
finish_edit false
|
||||
fit false
|
||||
fit_section false
|
||||
flange false
|
||||
@@ -110,7 +115,9 @@ folder false
|
||||
frame_member false
|
||||
gear false
|
||||
graph false
|
||||
grid false
|
||||
ground false
|
||||
ground_shadow false
|
||||
help false
|
||||
hem false
|
||||
hole false
|
||||
@@ -210,6 +217,11 @@ section false
|
||||
select false
|
||||
send false
|
||||
settings false
|
||||
settings_keyboard false
|
||||
settings_monitor false
|
||||
settings_mouse false
|
||||
settings_palette false
|
||||
settings_plug false
|
||||
sheet_rules false
|
||||
shell false
|
||||
shield false
|
||||
@@ -247,6 +259,11 @@ star false
|
||||
status_error false
|
||||
status_recovery false
|
||||
style false
|
||||
style_hidden_edges false
|
||||
style_shaded false
|
||||
style_shaded_edges false
|
||||
style_translucent false
|
||||
style_wireframe false
|
||||
suppress false
|
||||
surface false
|
||||
surface_blend false
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"agent_chat": "4a9ae0e7e2c360b4858b3175674c93d096705c92318fecd481e849f3ae650bf4",
|
||||
"agent_link": "2f20d89a0e3e9b28744910dddf7f282a1099ccd91aa160c9841c5b1d9ea9ed0f",
|
||||
"align": "05615db7dd9e4be56ae898e59a68c548b8a8447794442a9a394940651204bc4f",
|
||||
"ambient_occlusion": "973f8ef2326aeaf0face576e5a2c79c7ef3d13638b2c51a5aad199e4ef7edb02",
|
||||
"appearance": "b3162edd92291a5ef402e8499cd52be05beb2fa7eda641163c3f6e98325de2bf",
|
||||
"arc3": "fdca3d501fd557ac989376a12e9c4fa8231fde2b455c20724d1079a466153e9c",
|
||||
"arc_center": "3a5fdeb1d64fc6741f944c4435870b05fccab62293e270da692c6681155cbc51",
|
||||
@@ -88,6 +89,7 @@
|
||||
"dimension": "a926b7c64bc8ca99d8d6dcbb81b95235bd3fc34fbed049aca8b01b4d1147c15d",
|
||||
"disclosure_closed": "49a350c6f2efae78de0be96c524ebee1fd1291ea449a84224b88d37164a4e807",
|
||||
"disclosure_open": "d13ce3f97e3e362a9904fa2bf3412f3f00e4136bc23538b92d41483961d280de",
|
||||
"display": "58b45e5e2230eaf2c80f74b3be2e02a23714c90d6fb03b59ed093a1949993163",
|
||||
"dots": "600f7ff209d93145fc938bc4f6a1e34473e6b9ee22a5b4718f133bc7da5ee58d",
|
||||
"draft": "9c0fc361cacd0ad95ccd54794f4825dfc9901a83a3de752a588faec365d0ee09",
|
||||
"draft_analysis": "eb39c0f90e9cf226da6307365a76015e900dd692dc3f0fdc8f02fe717226261f",
|
||||
@@ -117,7 +119,9 @@
|
||||
"folder": "c19f5230df45a1bda1e92e89de38bba21c91e6eca0517eb15847a7712012d1e5",
|
||||
"gear": "25a1ca48a587850da1104a46005a330873ed196246e3d04e12cf61f26ad2b0d5",
|
||||
"graph": "7156caedd2dbfa2ae53da18b7a2204b8db66c45126859d36caf049a3fd4335a4",
|
||||
"grid": "084b5040d57e9d5183b3db1fad0d17a13ab5bae64676eef703cc06622f9c7438",
|
||||
"ground": "23e2471a9d6872e83028e0e219e330cef1930a4d89456a0fefa1bda8a7e3eb81",
|
||||
"ground_shadow": "a96809ed87f5047c2d7f1274908ed7b65b180613322ac9c10eb0f9d6296c1b66",
|
||||
"help": "8ce4060577483dbdb510be147d2827de50ac20029354008fca55abc0c7edf05d",
|
||||
"hem": "f9b1aafbedcf3dc90c26be308814638e0095fbe31b0647092507343fa60af011",
|
||||
"hole": "f82d47751f826e08682db847a270897474661bfe9f35b6d3678f49a203172563",
|
||||
@@ -263,6 +267,12 @@
|
||||
"screw": "5e30570785360d6a591ea22862a82f1cf62228385c1e96382536db8a453ac791",
|
||||
"section": "cdd13f99f15f6d59bfa21c747810608d6afd00cb8207faf0337928c8521e7eae",
|
||||
"select": "fdf6431270006ca7409c60c37cfed59572de04229f104ec723e6010ffa2b7163",
|
||||
"select_bodies": "8e6e61e083e6097535da3b98d41b607b40fc81b72bbd8c7fb903618c5b35c568",
|
||||
"select_components": "3e6cc847b334e92ce7ec5e5f35dfa929572e0974239790d76563ca4e20b26789",
|
||||
"select_faces_edges": "7b99b5370b1647bf8cea57df7a1053caab641c2f4a94c4d797b9679e6f38d6f1",
|
||||
"select_features": "b050bc19ce86d135cbe50998be681555110e92e179c4c7b101170c6b62c19943",
|
||||
"select_parts": "569adc5595a64187411d8ffeea69eab3b76ddfa33aeead6fd728efdd993bcccc",
|
||||
"select_sketch": "b0605b34a14d4173f7ed80d877109ec0b891a1b395bcab5743a603ed2eae240a",
|
||||
"send": "f83b6cdab792f9567a81d46d7828ed20795513c57a2c7d00fbbe6bd14d2f5848",
|
||||
"settings": "9193dd3a1007c43660d0d47b6499cb2571338b67949e1a99df112057b9bf2b8a",
|
||||
"settings_keyboard": "4968c70788094365af9c6e2b1c15b2aac45cf21212a14b8a256daf1ffe17f41a",
|
||||
@@ -309,6 +319,11 @@
|
||||
"stitch": "6c3205d64007b771ed78d6f8055867578439fb25d591563b32dbd3343c98732d",
|
||||
"stop": "36967eb4d423370d0d6c679b0a71f8d09f4fb2c73eed3e8cc50c604c44b0c32b",
|
||||
"style": "6c2b04234b82ea4858c80190cc7208c60f549358253005afc35ab4e29506b578",
|
||||
"style_hidden_edges": "a707dfc0bdcabe9144865f569abfcb478e493143cbd4331efc1404cf3082f6d2",
|
||||
"style_shaded": "6e5f8f9a9030ab3717f8b2192bbfd3f6b515ad398acf6cb41bc24f1298bc73b4",
|
||||
"style_shaded_edges": "6c2b04234b82ea4858c80190cc7208c60f549358253005afc35ab4e29506b578",
|
||||
"style_translucent": "c46b0cd485cfb9023514908357048b5cba9017a0c4976239da1e98f50e4ab5f9",
|
||||
"style_wireframe": "af7e575d378b5b6850bee9d3ca384efab95c8d4c876c5e3524f3ea771c4380a3",
|
||||
"suppress": "c54fbc01c12c0175d78cd63f692e8aaf73fc2cac79752b2a3ad821ac32734343",
|
||||
"surface": "ba0e839ce0ee03e7ff95a2389a5ecb20bd80c713064d9b1bd5f461f4a80d1921",
|
||||
"surface_blend": "0642f3b4af7d22f379a3c74f54c7b1c9eef0bdda19372ce4df73c0e56bdd7bbc",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Ambient occlusion</title>
|
||||
<g opacity="0.22"><path d="M13 51L51 51A38 38 0 0 0 13 13Z" fill="currentColor" stroke="currentColor" stroke-width="0" stroke-linejoin="round" stroke-linecap="round"/></g>
|
||||
<g opacity="0.38"><path d="M13 51L40 51A27 27 0 0 0 13 24Z" fill="currentColor" stroke="currentColor" stroke-width="0" stroke-linejoin="round" stroke-linecap="round"/></g>
|
||||
<g opacity="0.62"><path d="M13 51L29 51A16 16 0 0 0 13 35Z" fill="currentColor" stroke="currentColor" stroke-width="0" stroke-linejoin="round" stroke-linecap="round"/></g>
|
||||
<path d="M13 10L13 51L54 51" fill="none" stroke="currentColor" stroke-width="5.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 758 B |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Display</title>
|
||||
<path d="M10 22L54 22M10 42L54 42" fill="none" stroke="currentColor" stroke-width="5.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<circle cx="24" cy="22" r="10.5" fill="#ffffff"/>
|
||||
<circle cx="42" cy="42" r="10.5" fill="#ffffff"/>
|
||||
<circle cx="24" cy="22" r="6.4" fill="currentColor"/>
|
||||
<circle cx="42" cy="42" r="6.4" fill="currentColor"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 448 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Grid</title>
|
||||
<path d="M12 12L52 12L52 52L12 52Z" fill="none" stroke="currentColor" stroke-width="5.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M25.3 12L25.3 52M38.7 12L38.7 52M12 25.3L52 25.3M12 38.7L52 38.7" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 407 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Ground shadow</title>
|
||||
<path d="M32 4.8 L48.1 13.9 L48.1 32.1 L32 41.2 L15.9 32.1 L15.9 13.9Z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M9.34 31.35A25 11 0 1 0 54.66 31.35" fill="none" stroke="currentColor" stroke-width="5.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 433 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Bodies</title>
|
||||
<path d="M32 6 L55 19 L55 45 L32 58 L9 45 L9 19Z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 254 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Components</title>
|
||||
<path d="M22.91 5.75 L41.09 16.25 L22.91 26.75 L4.72 16.25ZM4.72 16.25 L22.91 26.75 L22.91 47.75 L4.72 37.25ZM41.09 16.25 L59.28 26.75 L41.09 37.25 L22.91 26.75ZM22.91 26.75 L41.09 37.25 L41.09 58.25 L22.91 47.75ZM59.28 26.75 L41.09 37.25 L41.09 58.25 L59.28 47.75Z" fill="currentColor" stroke="currentColor" stroke-width="4.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M37.46 18.35L22.91 26.75L22.91 43.55" fill="none" stroke="#ffffff" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 621 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Faces and edges</title>
|
||||
<path d="M32 6 L55 19 L32 32 L9 19Z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M32 6 L55 19 L55 45 L32 58 L9 45 L9 19Z" fill="none" stroke="currentColor" stroke-width="4.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M32 32L9 19M32 32L55 19M32 32L32 58" fill="none" stroke="currentColor" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 554 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Features</title>
|
||||
<path d="M32 6 L55 19 L55 45 L32 58 L9 45 L9 19Z" fill="none" stroke="currentColor" stroke-width="4.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M9 19L32 32M32 32L55 19M32 32L32 58" fill="none" stroke="currentColor" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M42 19C42 22.2 37.52 24.8 32 24.8C26.48 24.8 22 22.2 22 19C22 15.8 26.48 13.2 32 13.2C37.52 13.2 42 15.8 42 19Z" fill="currentColor" stroke="currentColor" stroke-width="0.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 632 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Parts</title>
|
||||
<path d="M22.91 5.75 L41.09 16.25 L22.91 26.75 L4.72 16.25ZM4.72 16.25 L22.91 26.75 L22.91 47.75 L4.72 37.25Z" fill="none" stroke="currentColor" stroke-width="4.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M41.09 16.25 L59.28 26.75 L41.09 37.25 L22.91 26.75ZM22.91 26.75 L41.09 37.25 L41.09 58.25 L22.91 47.75ZM59.28 26.75 L41.09 37.25 L41.09 58.25 L59.28 47.75Z" fill="currentColor" stroke="currentColor" stroke-width="4.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 585 B |
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Sketch features</title>
|
||||
<path d="M10 46C18 14 46 14 54 46" fill="none" stroke="currentColor" stroke-width="5" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<circle cx="10" cy="46" r="8.6" fill="#ffffff"/>
|
||||
<circle cx="54" cy="46" r="8.6" fill="#ffffff"/>
|
||||
<circle cx="32" cy="22.5" r="8.6" fill="#ffffff"/>
|
||||
<circle cx="10" cy="46" r="5.8" fill="currentColor"/>
|
||||
<circle cx="54" cy="46" r="5.8" fill="currentColor"/>
|
||||
<circle cx="32" cy="22.5" r="5.8" fill="currentColor"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 563 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Shaded with hidden edges</title>
|
||||
<path d="M32 6 L55 19 L55 45 L32 58 L9 45 L9 19Z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M32 32L15.44 22.64M32 32L48.56 22.64M32 32L32 50.72" fill="none" stroke="#ffffff" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M32 32L32 13.28M32 32L48.56 41.36M32 32L15.44 41.36" fill="none" stroke="#ffffff" stroke-width="3.2" stroke-linejoin="round" stroke-linecap="round" stroke-dasharray="4.5 4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 619 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Shaded</title>
|
||||
<g opacity="0.5"><path d="M32 6 L55 19 L32 32 L9 19Z" fill="currentColor" stroke="currentColor" stroke-width="0.8" stroke-linejoin="round" stroke-linecap="round"/></g>
|
||||
<g opacity="0.8"><path d="M9 19 L32 32 L32 58 L9 45Z" fill="currentColor" stroke="currentColor" stroke-width="0.8" stroke-linejoin="round" stroke-linecap="round"/></g>
|
||||
<path d="M32 32 L55 19 L55 45 L32 58Z" fill="currentColor" stroke="currentColor" stroke-width="0.8" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 583 B |
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Translucent</title>
|
||||
<defs>
|
||||
<clipPath id="tr-clip"><path d="M32 8.6 L52.7 20.3 L52.7 43.7 L32 55.4 L11.3 43.7 L11.3 20.3Z"/></clipPath>
|
||||
</defs>
|
||||
<g clip-path="url(#tr-clip)"><path d="M-71 72L9 -8M-60.5 72L19.5 -8M-50 72L30 -8M-39.5 72L40.5 -8M-29 72L51 -8M-18.5 72L61.5 -8M-8 72L72 -8M2.5 72L82.5 -8M13 72L93 -8M23.5 72L103.5 -8M34 72L114 -8M44.5 72L124.5 -8M55 72L135 -8" fill="none" stroke="currentColor" stroke-width="2.8" stroke-linejoin="round" stroke-linecap="round"/></g>
|
||||
<path d="M32 6 L55 19 L55 45 L32 58 L9 45 L9 19Z" fill="none" stroke="currentColor" stroke-width="5.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M32 32L11.76 20.56M32 32L52.24 20.56M32 32L32 54.88" fill="none" stroke="#ffffff" stroke-width="6.4" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M32 32L11.3 20.3M32 32L52.7 20.3M32 32L32 55.4" fill="none" stroke="currentColor" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Wireframe</title>
|
||||
<path d="M32 6 L55 19 L55 45 L32 58 L9 45 L9 19Z" fill="none" stroke="currentColor" stroke-width="5.2" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
<path d="M32 32L32 6M32 32L55 19M32 32L55 45M32 32L32 58M32 32L9 45M32 32L9 19" fill="none" stroke="currentColor" stroke-width="3.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 433 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<title>Finish Edit</title>
|
||||
<path d="M50 32L14 32M25 21L14 32L25 43" fill="none" stroke="#236ead" stroke-width="5.6" stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 237 B |
@@ -33,6 +33,7 @@
|
||||
"All open designs": "Alle åbne designs",
|
||||
"Allowed expressions, separated by semicolons": "Tilladte udtryk adskilt af semikolon",
|
||||
"Also deletes": "Sletter også",
|
||||
"Also place them from the origin (fully constrained)": "Placer dem også fra origo (fuldt fastlåst)",
|
||||
"Anchor": "Forankring",
|
||||
"Angle 2": "Vinkel 2",
|
||||
"Animate": "Animér",
|
||||
@@ -158,6 +159,7 @@
|
||||
"Designs you open or save appear here.": "Designs, du åbner eller gemmer, vises her.",
|
||||
"Determined by To Object. Choose Angle to edit the angular extent.": "Bestemmes af Til objekt. Vælg Vinkel for at ændre vinkeludstrækningen.",
|
||||
"Diameter": "Diameter",
|
||||
"Dimension new shapes": "Mål nye figurer",
|
||||
"Direction": "Retning",
|
||||
"Discard": "Kassér",
|
||||
"Distance": "Afstand",
|
||||
@@ -169,6 +171,8 @@
|
||||
"Drag to move the hole; click to remove it": "Træk for at flytte hullet; klik for at fjerne det",
|
||||
"Drive Joint": "Bevæg led",
|
||||
"Duration": "Varighed",
|
||||
"Each new shape is also dimensioned from the sketch origin until nothing of it is left free. A shape already attached to the origin or to placed geometry gets none.": "Hver ny figur får også mål fra skitsens origo, indtil intet af den er frit. En figur, der allerede er knyttet til origo eller til placeret geometri, får ingen.",
|
||||
"Each shape you draw gets all its dimensions, at the sizes you drew (typed values win). A size the sketch already sets is left out.": "Hver figur, du tegner, får alle sine mål i de størrelser, du tegnede (indtastede værdier vinder). En størrelse, som skitsen allerede fastlægger, udelades.",
|
||||
"Edges": "Kanter",
|
||||
"Edit": "Redigér",
|
||||
"Edit Profile Sketch": "Redigér profilskitse",
|
||||
@@ -614,6 +618,7 @@
|
||||
"appearance.pbr_opaque": "Uigennemsigtig PBR",
|
||||
"appearance.roughness": "Ruhed",
|
||||
"appearance.surface_response": "Overfladens reaktion på lys",
|
||||
"at the face": "ved fladen",
|
||||
"browser.body_name": "Emne{number}",
|
||||
"browser.calibrate_title": "Kalibrér: {name}",
|
||||
"browser.capture_many": "{count} komponenter er flyttet, men deres positioner er ikke registreret.",
|
||||
@@ -919,6 +924,7 @@
|
||||
"cmd.sketch_spline_control_point": "Spline med kontrolpunkter",
|
||||
"cmd.sketch_spline_control_point_5": "Spline med kontrolpunkter (grad 5)",
|
||||
"cmd.sketch_spline_fit_point": "Spline gennem punkter",
|
||||
"cmd.sketch_spline_reverse": "Vend splinens retning",
|
||||
"cmd.sketch_spun_profile": "Omdrejningsprofil",
|
||||
"cmd.sketch_toggle_driven": "Skift mellem styrende og afledt mål",
|
||||
"cmd.sketch_trim_path": "Trim langs bane",
|
||||
@@ -1190,7 +1196,9 @@
|
||||
"nav.free_orbit.help": "Musen og 3D-musen roterer gennem begge poler og bevarer rulning. Snap til akser med Shift er slået fra.",
|
||||
"nav.free_orbit.label": "Fri rotation af visningen",
|
||||
"nav.fusion.help": "Træk med midterste museknap panorerer, Shift+midterste roterer visningen, træk med højre roterer visningen",
|
||||
"nav.hfss.help": "Alt+træk med venstre museknap panorerer, Shift+Alt+venstre zoomer, Ctrl+træk med venstre fra et tomt område roterer visningen",
|
||||
"nav.inventor.help": "Træk med midterste museknap panorerer, Shift+midterste roterer visningen, Ctrl+midterste zoomer, træk med højre roterer visningen",
|
||||
"nav.maya.help": "Alt+træk med venstre museknap roterer visningen, Alt+midterste panorerer, Alt+højre zoomer; træk med midterste museknap panorerer også",
|
||||
"nav.openscad.help": "Træk med venstre museknap i et tomt område roterer visningen, Shift+venstre markerer med en ramme, træk i skitsegeometri redigerer den; træk med højre eller midterste museknap panorerer, Shift+højre eller Shift+midterste zoomer",
|
||||
"nav.solidworks.help": "Træk med midterste museknap roterer visningen, Ctrl+midterste panorerer, Shift+midterste zoomer, træk med højre roterer visningen",
|
||||
"nav.tinkercad.help": "Træk med højre museknap roterer visningen, træk med midterste eller Shift+højre panorerer",
|
||||
@@ -1209,6 +1217,11 @@
|
||||
"no picture": "intet billede",
|
||||
"none": "ingen",
|
||||
"parts.automatic_name": "automatisk",
|
||||
"parts.dimension.d": "Nominel diameter",
|
||||
"parts.dimension.height": "Højde",
|
||||
"parts.dimension.pitch": "Stigning",
|
||||
"parts.dimension.thickness": "Tykkelse",
|
||||
"parts.dimension.width": "Bredde",
|
||||
"pattern.alignment_2": "Justering 2",
|
||||
"pattern.alignment_hint": "Antal omfatter originalen. Centrér fordeler kopierne ligeligt; Vend vælger siden med den ekstra kopi ved et lige samlet antal.",
|
||||
"pattern.direction_1": "Retning 1",
|
||||
@@ -1279,6 +1292,13 @@
|
||||
"prefs.left_click": "Venstreklik",
|
||||
"prefs.live_input": "Løbende input",
|
||||
"prefs.live_preview": "Løbende forhåndsvisning",
|
||||
"prefs.max_file_size": "Største fil, der kan åbnes",
|
||||
"prefs.max_file_size_design": "Designfiler",
|
||||
"prefs.max_file_size_flag": "Denne kørsel blev startet med --max-file-size {size}, som gælder, indtil SolidCraft lukkes. Disse indstillinger gælder ved start uden denne valgmulighed.",
|
||||
"prefs.max_file_size_note": "Standard: 512 MB og 256 MB; højst 16 GB. Åbning af en fil kræver flere gange dens størrelse i hukommelse. Et design med en stor import kan kræve en højere grænse for designfiler for at kunne gemmes og åbnes igen.",
|
||||
"prefs.max_file_size_step": "STEP- og importfiler",
|
||||
"prefs.max_file_size_web": "Webappen åbner STEP- og importfiler op til 512 MB og design op til 256 MB: en browserfane kan ikke rumme større filer. Grænserne kan hæves i skrivebordsappen.",
|
||||
"prefs.megabytes": "MB",
|
||||
"prefs.minutes": "minutter",
|
||||
"prefs.minutes_suffix": " min",
|
||||
"prefs.mouse": "Mus og pegefelt",
|
||||
@@ -1388,6 +1408,13 @@
|
||||
"render.return_design": "Tilbage til Design",
|
||||
"render.save_setup": "Gem opsætning",
|
||||
"render.setup_name": "Opsætningsnavn",
|
||||
"render.shots_camera_changed": "Kameraet er ændret, siden denne optagelse blev gemt",
|
||||
"render.shots_name_help": "Indtast et unikt navn til den aktuelle optagelse.",
|
||||
"render.shots_no_result": "Ingen rendering endnu",
|
||||
"render.shots_result": "Rendering {number} · {width} × {height}",
|
||||
"render.shots_revert": "Gendan",
|
||||
"render.shots_save": "Gem optagelse",
|
||||
"render.shots_update": "Opdater optagelse",
|
||||
"render.unavailable_preview": "Denne opsætning bruger en type forhåndsvisning, der ikke er tilgængelig.",
|
||||
"render.unsaved": "Ændringer i forhåndsvisning er ikke gemt",
|
||||
"render.use_preview": "Brug integreret forhåndsvisning",
|
||||
@@ -2057,6 +2084,7 @@
|
||||
"ui.heading_utilities": "VÆRKTØJER",
|
||||
"ui.heading_utility": "VÆRKTØJ",
|
||||
"ui.heading_weldments": "SVEJSNING",
|
||||
"ui.height": "Højde",
|
||||
"ui.help": "Hjælp",
|
||||
"ui.hide": "Skjul",
|
||||
"ui.hideAxes": "Skjul akser",
|
||||
@@ -2095,6 +2123,7 @@
|
||||
"ui.language": "Sprog",
|
||||
"ui.layout_compact": "Kompakt",
|
||||
"ui.layout_floating": "Flydende",
|
||||
"ui.length": "Længde",
|
||||
"ui.length_decimals": "Længdedecimaler",
|
||||
"ui.light": "Lys",
|
||||
"ui.line": "Linje",
|
||||
@@ -2182,6 +2211,7 @@
|
||||
"ui.pinToShortcuts": "Fastgør til genveje",
|
||||
"ui.pinToToolbar": "Fastgør til værktøjslinje",
|
||||
"ui.pipe": "Rør",
|
||||
"ui.pitch": "Stigning",
|
||||
"ui.placement": "Placering",
|
||||
"ui.plane": "Plan",
|
||||
"ui.plane_at_angle": "Plan i vinkel",
|
||||
@@ -2365,6 +2395,7 @@
|
||||
"ui.visual_shaded_with_edges": "Skyggelagt med kanter",
|
||||
"ui.visual_style": "Visuel stil",
|
||||
"ui.visual_wireframe": "Trådmodel",
|
||||
"ui.width": "Bredde",
|
||||
"ui.workspace": "arbejdsområde",
|
||||
"ui.workspace_animation_description": "Eksploderede visninger, bevægelsesstudier og storyboards",
|
||||
"ui.workspace_available": "Tilgængelig",
|
||||
|
||||
@@ -17,6 +17,18 @@
|
||||
"cmd.sketch_slot_center_point": "Centre Point Slot",
|
||||
"cmd.sketch_slot_center_to_center": "Centre to Centre Slot",
|
||||
"pattern.alignment_hint": "Counts include the original. Centre balances copies; Flip chooses the extra side for even totals.",
|
||||
"prefs.max_file_size": "Largest file to open",
|
||||
"prefs.max_file_size_design": "Design files",
|
||||
"prefs.max_file_size_flag": "This run started with --max-file-size {size}, which applies until SolidCraft closes. These settings apply when it starts without it.",
|
||||
"prefs.max_file_size_note": "Defaults: 512 MB and 256 MB; at most 16 GB. Opening a file takes several times its size in memory. A design that keeps a large import may need a higher design file limit to save and reopen.",
|
||||
"prefs.max_file_size_step": "STEP and import files",
|
||||
"prefs.max_file_size_web": "The web app opens STEP and import files up to 512 MB and designs up to 256 MB: a browser tab can't hold larger files. The desktop app can raise these limits.",
|
||||
"prefs.megabytes": "MB",
|
||||
"prefs.sketch_state_icons": "Sketch icons in the colour of their state",
|
||||
"prefs.sketch_state_icons_note": "In History and the browser, a sketch's icon takes the colour of its state (under constrained, fully constrained or conflicting) and its tooltip names the state. Off: every sketch has the same icon.",
|
||||
"prefs.sketch_tracking_guides": "Centre and midpoint alignment guides",
|
||||
"prefs.sketch_tracking_guides_note": "Hover over a circle centre or straight-edge midpoint, then move horizontally or vertically to show a temporary dotted guide.",
|
||||
"prefs.status_bar_note": "A thin bar along the window's bottom edge shows what is being edited, the open sketch's state in its colour and the design's units; a click on the units changes them. The sketch's state then no longer shows in the view's corner.",
|
||||
"prefs.theme_follow": "Follow a theme file",
|
||||
"prefs.theme_follow_error": "Not applied: {error}. The last good theme stays on.",
|
||||
"prefs.theme_follow_launch": "Followed for this run only (--theme-file); reloaded whenever another tool rewrites it.",
|
||||
@@ -107,6 +119,10 @@
|
||||
"ui.design_properties.organization": "Organisation",
|
||||
"ui.layout_compact": "Compact",
|
||||
"ui.layout_floating": "Floating",
|
||||
"ui.point_cloud_color_by": "Colour By",
|
||||
"ui.point_cloud_file_colors": "File Colours",
|
||||
"ui.point_cloud_no_file_colors": "The file has no colours",
|
||||
"ui.point_cloud_single_color": "Single Colour",
|
||||
"ui.ribbon_labels": "Show text under ribbon icons",
|
||||
"ui.workspace_layout": "Workspace layout",
|
||||
"ui.zoom_to_cursor_tip": "The wheel zooms towards the point under the cursor (off: towards the view's centre)",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"(active rule)": "(regla activa)",
|
||||
"0 turns it off": "0 lo desactiva",
|
||||
"1. Open GitHub draft below, then paste the report copied to your clipboard.": "1. Abre el borrador de GitHub de abajo y pega el informe copiado al portapapeles.",
|
||||
"1. Open GitHub draft below. Your title and report will be filled in.": "1. Abre el borrador de GitHub de abajo. El título y el informe se rellenarán automáticamente.",
|
||||
@@ -26,6 +27,7 @@
|
||||
"All open designs": "Todos los diseños abiertos",
|
||||
"Allowed expressions, separated by semicolons": "Expresiones permitidas, separadas por punto y coma",
|
||||
"Also deletes": "También elimina",
|
||||
"Also place them from the origin (fully constrained)": "Situarlas también desde el origen (totalmente restringidas)",
|
||||
"Angle 2": "Ángulo 2",
|
||||
"Animate": "Animar",
|
||||
"Appearance name": "Nombre de apariencia",
|
||||
@@ -35,12 +37,16 @@
|
||||
"Apply your appearance first. Exports assigned appearances and materials created in this design.": "Aplique primero la apariencia. Exporta las apariencias asignadas y los materiales creados en este diseño.",
|
||||
"Arc length": "Longitud del arco",
|
||||
"Area": "Área",
|
||||
"As Picked": "Según la selección",
|
||||
"As-Built": "Tal como se construyó",
|
||||
"Assign Rule": "Asignar regla",
|
||||
"Attachment": "Vinculación",
|
||||
"BLEND SURFACE": "SUPERFICIE DE TRANSICIÓN",
|
||||
"BOUNDARY SURFACE": "SUPERFICIE DE CONTORNO",
|
||||
"BROWSER": "EXPLORADOR",
|
||||
"Ball": "Rótula",
|
||||
"Base Height": "Altura de la base",
|
||||
"Bend Line": "Línea de plegado",
|
||||
"Bend Line Position": "Posición de la línea de plegado",
|
||||
"Bend Position": "Posición del pliegue",
|
||||
"Bend Radius": "Radio de plegado",
|
||||
@@ -48,6 +54,7 @@
|
||||
"Bends": "Pliegues",
|
||||
"Bodies": "Cuerpos",
|
||||
"Body": "Cuerpo",
|
||||
"Both": "Ambos",
|
||||
"Boundary": "Contorno",
|
||||
"Bounding box": "Caja delimitadora",
|
||||
"CHECK": "COMPROBAR",
|
||||
@@ -70,6 +77,7 @@
|
||||
"Checked": "Comprobado",
|
||||
"Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates.": "Elige un plano nuevo. La geometría y las cotas del boceto se mantienen en sus coordenadas bidimensionales.",
|
||||
"Choose…": "Elegir…",
|
||||
"Circle or sphere": "Círculo o esfera",
|
||||
"Circular": "Circular",
|
||||
"Circumference": "Circunferencia",
|
||||
"Clockwise": "Horario",
|
||||
@@ -81,6 +89,7 @@
|
||||
"Config Table": "Tabla de config.",
|
||||
"Configuration": "Configuración",
|
||||
"Configuration rules": "Reglas de configuración",
|
||||
"Constant radius": "Radio constante",
|
||||
"Contact": "Contacto",
|
||||
"Contact Sets": "Conjuntos de contacto",
|
||||
"Contact sets": "Conjuntos de contacto",
|
||||
@@ -105,6 +114,8 @@
|
||||
"Curvature (G2)": "Curvatura (G2)",
|
||||
"Curvature change (G3)": "Cambio de curvatura (G3)",
|
||||
"Customize Toolbar": "Personalizar barra de herramientas",
|
||||
"Cylindrical": "Cilíndrica",
|
||||
"Deboss": "Grabado",
|
||||
"Delete": "Eliminar",
|
||||
"Delete all": "Eliminar todo",
|
||||
"Delete rule": "Eliminar regla",
|
||||
@@ -114,6 +125,7 @@
|
||||
"Dependents": "Dependientes",
|
||||
"Designs you open or save appear here.": "Aquí aparecen los diseños que abras o guardes.",
|
||||
"Determined by To Object. Choose Angle to edit the angular extent.": "Determinado por «Hasta objeto». Elige «Ángulo» para modificar la extensión angular.",
|
||||
"Dimension new shapes": "Acotar las formas nuevas",
|
||||
"Direction": "Dirección",
|
||||
"Discard": "Descartar",
|
||||
"Do not export hidden edges": "No exportar aristas ocultas",
|
||||
@@ -122,6 +134,9 @@
|
||||
"Double-clicking the middle button in the view: Home (the home view, framing what is shown), Fit (frame what is shown, keeping the orientation) or nothing": "Doble clic con el botón central en la vista: Inicio (vista inicial que encuadra lo visible), Ajustar (encuadrar sin cambiar la orientación) o nada",
|
||||
"Drive Joint": "Accionar unión",
|
||||
"Duration": "Duración",
|
||||
"Each new shape is also dimensioned from the sketch origin until nothing of it is left free. A shape already attached to the origin or to placed geometry gets none.": "Cada forma nueva también se acota desde el origen del croquis hasta que no quede nada libre. Una forma ya unida al origen o a geometría situada no recibe ninguna.",
|
||||
"Each shape you draw gets all its dimensions, at the sizes you drew (typed values win). A size the sketch already sets is left out.": "Cada forma que dibujas recibe todas sus cotas con los tamaños dibujados (los valores escritos tienen prioridad). Se omite un tamaño que el croquis ya fija.",
|
||||
"Edge": "Arista",
|
||||
"Edges": "Aristas",
|
||||
"Edit": "Editar",
|
||||
"Edit Profile Sketch": "Editar boceto del perfil",
|
||||
@@ -129,6 +144,7 @@
|
||||
"Enabled": "Activado",
|
||||
"End bulge": "Abombamiento final",
|
||||
"End continuity": "Continuidad final",
|
||||
"Equal Distance": "Distancia igual",
|
||||
"Explode": "Explosionar",
|
||||
"Explode Text": "Descomponer texto",
|
||||
"Export Animation…": "Exportar animación…",
|
||||
@@ -148,6 +164,8 @@
|
||||
"Face attachment lost": "Se ha perdido la vinculación de la cara",
|
||||
"Faces": "Caras",
|
||||
"Faces / edges / vertices": "Caras / aristas / vértices",
|
||||
"Faces/Body": "Caras/Cuerpo",
|
||||
"Factor must be a positive number": "El factor debe ser un número positivo",
|
||||
"Fastener": "Sujeción",
|
||||
"Favorites": "Favoritos",
|
||||
"Favourite": "Favorito",
|
||||
@@ -156,20 +174,28 @@
|
||||
"Filter": "Filtrar",
|
||||
"Find in Browser": "Buscar en el explorador",
|
||||
"Finish": "Acabado",
|
||||
"First edge": "Primera arista",
|
||||
"First point": "Primer punto",
|
||||
"Flange Gap": "Separación de pestaña",
|
||||
"Flat Pattern": "Desarrollo plano",
|
||||
"Flat size": "Tamaño del desarrollo",
|
||||
"Follow camera (Look At sketches)": "Seguir cámara (orientar hacia los bocetos)",
|
||||
"Follow the camera (Look At sketches)": "Seguir la cámara (orientar hacia los bocetos)",
|
||||
"Font": "Fuente",
|
||||
"Free Move": "Movimiento libre",
|
||||
"From Bodies": "Desde cuerpos",
|
||||
"From Snap": "Desde el enganche",
|
||||
"From edges": "Aristas de origen",
|
||||
"Full Length": "Longitud total",
|
||||
"Gap": "Separación",
|
||||
"Grid": "Cuadrícula",
|
||||
"HISTORY": "HISTORIAL",
|
||||
"Height": "Altura",
|
||||
"Hem Gap": "Separación de reborde",
|
||||
"Hidden edges": "Aristas ocultas",
|
||||
"History layout": "Disposición del historial",
|
||||
"Hole Depth": "Profundidad del agujero",
|
||||
"Hole Diameter": "Diámetro del agujero",
|
||||
"Holes": "Agujeros",
|
||||
"Holes (edges on them)": "Agujeros (aristas que contienen)",
|
||||
"Home view": "Vista de inicio",
|
||||
@@ -185,10 +211,14 @@
|
||||
"Isocurve": "Isocurva",
|
||||
"Issue title": "Título de la incidencia",
|
||||
"JOINTS": "UNIONES",
|
||||
"Joint 1": "Unión 1",
|
||||
"Joint 2": "Unión 2",
|
||||
"Joint Origin1": "Origen de unión1",
|
||||
"K Factor": "Factor K",
|
||||
"Keep (points on it)": "Conservar (puntos sobre ella)",
|
||||
"Keep Tools": "Conservar herramientas",
|
||||
"Keep of the other surface": "Conservar de la otra superficie",
|
||||
"Knife Edge": "Borde afilado",
|
||||
"LIBRARY": "BIBLIOTECA",
|
||||
"LINKS": "VÍNCULOS",
|
||||
"Later": "Más tarde",
|
||||
@@ -199,7 +229,9 @@
|
||||
"Letter Spacing": "Espaciado entre letras",
|
||||
"Library": "Biblioteca",
|
||||
"Library file": "Archivo de biblioteca",
|
||||
"Library response is missing": "Falta la respuesta de la biblioteca",
|
||||
"Line Spacing": "Interlineado",
|
||||
"Line on plane": "Línea en plano",
|
||||
"Local library": "Biblioteca local",
|
||||
"Loop": "Bucle",
|
||||
"MANAGE": "GESTIONAR",
|
||||
@@ -213,9 +245,12 @@
|
||||
"Material": "Material",
|
||||
"Material copied. Existing body assignments are unchanged.": "Material copiado. Se conservan las asignaciones actuales de los cuerpos.",
|
||||
"Max": "Máx.",
|
||||
"Max Thickness": "Espesor máx.",
|
||||
"Mid Radius": "Radio intermedio",
|
||||
"Middle double-click": "Doble clic central",
|
||||
"Min": "Mín.",
|
||||
"Min Draft": "Ángulo de salida mín.",
|
||||
"Min Thickness": "Espesor mín.",
|
||||
"Mitre": "Inglete",
|
||||
"Model Parameters": "Parámetros del modelo",
|
||||
"Modeled": "Modelado",
|
||||
@@ -230,6 +265,7 @@
|
||||
"Name": "Nombre",
|
||||
"Name on import": "Nombre al importar",
|
||||
"Nearest": "Más cercano",
|
||||
"Neutral plane": "Plano neutro",
|
||||
"New": "Nuevo",
|
||||
"New Comp.": "Nuevo comp.",
|
||||
"New Sketch": "Nuevo boceto",
|
||||
@@ -240,6 +276,7 @@
|
||||
"No matching appearances": "No hay apariencias coincidentes",
|
||||
"No matching physical materials.": "No hay materiales físicos coincidentes.",
|
||||
"No visible bodies or sketches to export.": "No hay cuerpos ni bocetos visibles para exportar.",
|
||||
"Nominal Radius": "Radio nominal",
|
||||
"None": "Ninguno",
|
||||
"Not available yet": "Todavía no disponible",
|
||||
"Notch": "Muesca",
|
||||
@@ -255,19 +292,25 @@
|
||||
"Overall length": "Longitud total",
|
||||
"Param. Graph": "Gráfico de parám.",
|
||||
"Parameter": "Parámetro",
|
||||
"Part length must be greater than zero and at most 2000 mm": "La longitud de la pieza debe ser mayor que cero y como máximo 2000 mm",
|
||||
"Parts": "Piezas",
|
||||
"Pass through": "Pasante",
|
||||
"Path": "Trayectoria",
|
||||
"Pattern": "Patrón",
|
||||
"Per Edge": "Por arista",
|
||||
"Physical material definitions": "Definiciones de materiales físicos",
|
||||
"Pick a part size": "Elige un tamaño de pieza",
|
||||
"Pick the tool bodies": "Selecciona los cuerpos herramienta",
|
||||
"Picked": "Seleccionado",
|
||||
"Picked point": "Punto seleccionado",
|
||||
"Pin-slot": "Pasador-ranura",
|
||||
"Place at the origin instead": "Colocar en el origen",
|
||||
"Planar": "Plana",
|
||||
"Plastic Rules": "Reglas de plástico",
|
||||
"Playback": "Reproducción",
|
||||
"Plot": "Graficar",
|
||||
"Point on line": "Punto en línea",
|
||||
"Point on plane": "Punto en plano",
|
||||
"Position": "Posición",
|
||||
"Position (0 to 1)": "Posición (de 0 a 1)",
|
||||
"Position (G0)": "Posición (G0)",
|
||||
@@ -277,6 +320,7 @@
|
||||
"Preview leaves the current design unchanged.": "La vista previa no modifica el diseño actual.",
|
||||
"Profiles/Curves": "Perfiles/curvas",
|
||||
"Quantity": "Cantidad",
|
||||
"Quantity must be at least 2": "La cantidad debe ser al menos 2",
|
||||
"RECENT": "RECIENTES",
|
||||
"REFERENCE": "REFERENCIA",
|
||||
"RULED SURFACE": "SUPERFICIE REGLADA",
|
||||
@@ -288,6 +332,8 @@
|
||||
"Recover unsaved design?": "¿Recuperar el diseño sin guardar?",
|
||||
"Rectangular": "Rectangular",
|
||||
"Reference face": "Cara de referencia",
|
||||
"Relief Depth": "Profundidad de alivio",
|
||||
"Relief Width": "Ancho de alivio",
|
||||
"Remove Tools": "Eliminar herramientas",
|
||||
"Remove from list": "Quitar de la lista",
|
||||
"Remove override": "Quitar anulación",
|
||||
@@ -304,6 +350,7 @@
|
||||
"Restore the inherited component or physical material appearance": "Restaurar la apariencia heredada del componente o del material físico",
|
||||
"Result": "Resultado",
|
||||
"Retake screenshot": "Repetir captura de pantalla",
|
||||
"Reveal Height": "Altura del escalón",
|
||||
"Reverse": "Invertir",
|
||||
"Reverse Direction": "Invertir dirección",
|
||||
"Revert": "Revertir",
|
||||
@@ -311,7 +358,10 @@
|
||||
"Revert Pos.": "Revertir pos.",
|
||||
"Revert Position": "Revertir posición",
|
||||
"Review the report and screenshot before opening GitHub.": "Revisa el informe y la captura antes de abrir GitHub.",
|
||||
"Revolute": "Revolución",
|
||||
"Rigid": "Rígida",
|
||||
"Rim Edge": "Arista del borde",
|
||||
"Rim face": "Cara del borde",
|
||||
"Roll History Marker Here": "Desplazar marcador de la línea de tiempo hasta aquí",
|
||||
"Round": "Redondo",
|
||||
"Rule": "Regla",
|
||||
@@ -328,11 +378,22 @@
|
||||
"Search": "Buscar",
|
||||
"Search commands": "Buscar comandos",
|
||||
"Search this library": "Buscar en esta biblioteca",
|
||||
"Second edge": "Segunda arista",
|
||||
"Second point": "Segundo punto",
|
||||
"Section": "Sección",
|
||||
"Section position": "Posición de la sección",
|
||||
"Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation).": "Seleccionar otro: mantén pulsado el botón izquierdo sobre el modelo (o haz clic derecho › Seleccionar otro…) para ver todo lo que hay bajo el cursor; vuelve a pulsar en el mismo lugar para seleccionar el siguiente elemento. Haz doble clic con el botón central para volver a Inicio (Preferencias › Navegación).",
|
||||
"Select bodies (a face picks its body)": "Selecciona cuerpos (al seleccionar una cara se selecciona su cuerpo)",
|
||||
"Select bodies or faces instead": "Selecciona cuerpos o caras en su lugar",
|
||||
"Select points of the sketch being edited": "Selecciona puntos del boceto que se está editando",
|
||||
"Select the centre the pattern turns around first": "Selecciona primero el centro alrededor del cual gira el patrón",
|
||||
"Select the curves to offset first": "Selecciona primero las curvas que se van a desfasar",
|
||||
"Select the mirror line": "Selecciona la línea de simetría",
|
||||
"Select the sketch curves or points to mirror first": "Selecciona primero las curvas o puntos del boceto que se van a reflejar",
|
||||
"Select the sketch curves or points to move first": "Selecciona primero las curvas o puntos del boceto que se van a mover",
|
||||
"Select the sketch curves or points to pattern first": "Selecciona primero las curvas o puntos del boceto para el patrón",
|
||||
"Select the sketch curves or points to scale first": "Selecciona primero las curvas o puntos del boceto que se van a escalar",
|
||||
"Select the sketch curves or points to transform first": "Selecciona primero las curvas o puntos del boceto que se van a transformar",
|
||||
"Selection filter": "Filtro de selección",
|
||||
"Semantic faces share their appearance across instances.": "Las caras semánticas comparten su apariencia entre instancias.",
|
||||
"Send your report on GitHub": "Enviar tu informe a GitHub",
|
||||
@@ -350,8 +411,11 @@
|
||||
"Sketch geometry and profiles": "Geometría y perfiles del boceto",
|
||||
"Sketch plane has no body-face attachment.": "El plano del boceto no está vinculado a ninguna cara del cuerpo.",
|
||||
"Sketch points": "Puntos del boceto",
|
||||
"Slider": "Deslizante",
|
||||
"Slot width": "Anchura de la ranura",
|
||||
"SolidCraft closed before these designs were saved. Their last autosave can be opened.": "SolidCraft se cerró antes de guardar estos diseños. Puedes abrir su último guardado automático.",
|
||||
"Spacing 2 must be a non-zero number": "El espaciado 2 debe ser un número distinto de cero",
|
||||
"Spacing must be a non-zero number": "El espaciado debe ser un número distinto de cero",
|
||||
"Specialise": "Especializar",
|
||||
"Speed": "Velocidad",
|
||||
"Square": "Cuadrado",
|
||||
@@ -361,6 +425,7 @@
|
||||
"Start angle": "Ángulo inicial",
|
||||
"Start bulge": "Abombamiento inicial",
|
||||
"Start continuity": "Continuidad inicial",
|
||||
"Stationary Side": "Lado fijo",
|
||||
"Step": "Paso",
|
||||
"Steps": "Pasos",
|
||||
"Stitch the kept pieces": "Coser las piezas conservadas",
|
||||
@@ -369,29 +434,41 @@
|
||||
"Style": "Estilo",
|
||||
"Suppressed": "Suprimido",
|
||||
"Surface": "Superficie",
|
||||
"Surfaces": "Superficies",
|
||||
"Swap Ends": "Intercambiar extremos",
|
||||
"TRIM": "RECORTAR",
|
||||
"Tangent (G1)": "Tangencia (G1)",
|
||||
"Tangent Chain": "Cadena tangente",
|
||||
"Target Face (optional)": "Cara de destino (opcional)",
|
||||
"Tear": "Desgarro",
|
||||
"The dashed sketch is a saved plane guide. Select a new face to repair the attachment.": "El boceto discontinuo sirve de guía del plano guardado. Selecciona una cara nueva para reparar la vinculación.",
|
||||
"The design changed. Reopen Change Part Size for the component.": "El diseño ha cambiado. Vuelve a abrir Cambiar tamaño de pieza para el componente.",
|
||||
"The direction must be an axis or a straight sketch curve that lies in the sketch plane": "La dirección debe ser un eje o una curva recta del boceto que esté en el plano del boceto",
|
||||
"The mirror line cannot also be mirrored": "La línea de simetría no puede reflejarse también",
|
||||
"The mirror line must be a straight curve of this sketch, not an origin axis": "La línea de simetría debe ser una curva recta de este boceto, no un eje del origen",
|
||||
"The saved author occurrence is missing. Select a valid author placement before rebinding.": "Falta la instancia de autor guardada. Selecciona una posición de autor válida antes de volver a vincular.",
|
||||
"Then": "Entonces",
|
||||
"These features will be deleted:": "Se eliminarán estas operaciones:",
|
||||
"These features will fail:": "Estas operaciones fallarán:",
|
||||
"Thickness Outside": "Espesor hacia fuera",
|
||||
"Thickness Variation": "Variación de espesor",
|
||||
"Thin": "Delgado",
|
||||
"Thin Extrude": "Extrusión delgada",
|
||||
"Third plane": "Tercer plano",
|
||||
"Third point": "Tercer punto",
|
||||
"This child is shared. Deleting it removes it from every copy of its parent.": "Este elemento secundario es compartido. Si lo eliminas, desaparecerá de todas las copias de su elemento principal.",
|
||||
"This child is shared. Position changes apply to every copy of its parent.": "Este elemento secundario es compartido. Los cambios de posición se aplican a todas las copias de su elemento principal.",
|
||||
"This face cannot provide a durable attachment. Choose another face or explicitly use a fixed plane.": "Esta cara no permite una vinculación persistente. Elige otra cara o utiliza expresamente un plano fijo.",
|
||||
"Through point": "Por un punto",
|
||||
"To Offset": "Hasta desfase",
|
||||
"To Snap": "Hasta el enganche",
|
||||
"To edges": "Aristas de destino",
|
||||
"Tolerance": "Tolerancia",
|
||||
"Too close": "Demasiado cerca",
|
||||
"Trimming tool (plane, face or curves)": "Herramienta de recorte (plano, cara o curvas)",
|
||||
"Turn off section analysis before exporting the view.": "Desactiva el análisis de sección antes de exportar la vista.",
|
||||
"Type": "Tipo",
|
||||
"Type a distance or an angle to move by": "Escribe una distancia o un ángulo para mover",
|
||||
"UNTRIM": "ANULAR RECORTE",
|
||||
"Unit": "Unidad",
|
||||
"Updating the preview": "Actualizando vista previa",
|
||||
@@ -420,6 +497,17 @@
|
||||
"Z angle": "Ángulo Z",
|
||||
"Z distance": "Distancia Z",
|
||||
"Zebra": "Cebra",
|
||||
"`joint` must be an id or a name": "`joint` debe ser un id o un nombre",
|
||||
"`params` must be an object": "`params` debe ser un objeto",
|
||||
"`values` must be a list": "`values` debe ser una lista",
|
||||
"a chamfer needs a corner of exactly two lines": "un chaflán necesita una esquina de exactamente dos líneas",
|
||||
"a file operation is in progress": "hay una operación de archivo en curso",
|
||||
"a picked curve is no longer in a sketch": "una curva elegida ya no está en un boceto",
|
||||
"a picked curve's sketch has not been solved": "el boceto de una curva elegida no se ha resuelto",
|
||||
"a picked edge has no points": "una arista elegida no tiene puntos",
|
||||
"a picked edge is gone": "una arista elegida ya no existe",
|
||||
"a picked edge's body is gone": "el cuerpo de una arista elegida ya no existe",
|
||||
"add a key for a joint first": "añade primero una clave para una unión",
|
||||
"angle, height": "ángulo, altura",
|
||||
"appearance.dielectric_ior": "Índice de refracción dieléctrico",
|
||||
"appearance.metallic": "Metalicidad",
|
||||
@@ -428,6 +516,8 @@
|
||||
"appearance.pbr_opaque": "PBR opaco",
|
||||
"appearance.roughness": "Rugosidad",
|
||||
"appearance.surface_response": "Respuesta de la superficie",
|
||||
"at the face": "en la cara",
|
||||
"bom.group_children": "Subpiezas en la fila de su pieza",
|
||||
"browser.body_name": "Cuerpo{number}",
|
||||
"browser.calibrate_title": "Calibrar: {name}",
|
||||
"browser.capture_many": "Se han movido {count} componentes, pero sus posiciones no se han capturado.",
|
||||
@@ -438,6 +528,8 @@
|
||||
"browser.move_title": "Mover: {name}",
|
||||
"browser.parameters": "Parámetros ({count})",
|
||||
"browser.precision": "Precisión: {precision}",
|
||||
"browser.sketch_attachment_lost": "{name} (fijación perdida)",
|
||||
"browser.sketch_editing": "{name} (en edición)",
|
||||
"browser.sketch_name": "Boceto{number}",
|
||||
"browser.units": "Unidades: {units}",
|
||||
"cam.flat": "Cara plana",
|
||||
@@ -447,6 +539,11 @@
|
||||
"cam.roller": "Rodillo",
|
||||
"cam.roller_pick": "Rodillo (opcional)",
|
||||
"cam.tip_pick": "Punta (opcional)",
|
||||
"choose a profile": "elige un perfil",
|
||||
"choose the cam's and the follower's joints": "elige las uniones de la leva y del seguidor",
|
||||
"choose the joints to couple": "elige las uniones que acoplar",
|
||||
"click a plane or planar face": "hacer clic en un plano o una cara plana",
|
||||
"click sketch curves": "hacer clic en curvas del boceto",
|
||||
"cmd.appearance_assign": "Apariencia",
|
||||
"cmd.appearance_library": "Biblioteca de apariencias",
|
||||
"cmd.appearance_list": "Listar apariencias",
|
||||
@@ -758,6 +855,7 @@
|
||||
"cmd.sketch_spline_control_point": "Spline por puntos de control",
|
||||
"cmd.sketch_spline_control_point_5": "Spline por puntos de control (grado 5)",
|
||||
"cmd.sketch_spline_fit_point": "Spline por puntos de ajuste",
|
||||
"cmd.sketch_spline_reverse": "Invertir dirección del spline",
|
||||
"cmd.sketch_spun_profile": "Perfil de revolución",
|
||||
"cmd.sketch_toggle_diameter": "Alternar radio / diámetro",
|
||||
"cmd.sketch_toggle_driven": "Alternar cota de referencia",
|
||||
@@ -884,6 +982,8 @@
|
||||
"dxf.progress.write": "Escribiendo DXF (5/5)",
|
||||
"dxf.tolerance": "Tolerancia de curva",
|
||||
"dxf.tolerance_help": "Solo cuerpos visibles y bocetos mostrados. Las curvas usan segmentos rectos. Una tolerancia menor da curvas más finas y consume más tiempo y memoria.",
|
||||
"each rail's curves must be in one sketch": "las curvas de cada guía deben estar en un solo boceto",
|
||||
"feature computation ended without a result": "el cálculo de la operación terminó sin resultado",
|
||||
"file_load.built": "Construido hasta ahora: {built} de {total} operaciones.",
|
||||
"file_load.converting": "Convirtiendo sólido {done} de {total}",
|
||||
"file_load.inserting": "Insertando geometría",
|
||||
@@ -1078,17 +1178,63 @@
|
||||
"no hole": "sin agujero",
|
||||
"no interference": "sin interferencias",
|
||||
"no joint that moves yet": "todavía no hay ninguna unión móvil",
|
||||
"no motion study yet": "todavía no hay ningún estudio de movimiento",
|
||||
"no picture": "sin imagen",
|
||||
"no such joint": "no existe esa unión",
|
||||
"none": "ninguno",
|
||||
"not a move": "no es un movimiento",
|
||||
"not a number": "no es un número",
|
||||
"open a sketch first": "abre primero un boceto",
|
||||
"parts.automatic_name": "automático",
|
||||
"parts.dimension.across_flats": "Entrecaras",
|
||||
"parts.dimension.bore": "Diámetro interior",
|
||||
"parts.dimension.head_diameter": "Diámetro cabeza",
|
||||
"parts.dimension.head_height": "Altura cabeza",
|
||||
"parts.dimension.height": "Altura",
|
||||
"parts.dimension.inner": "Diámetro interior",
|
||||
"parts.dimension.outer": "Diámetro exterior",
|
||||
"parts.dimension.socket": "Hexágono interior",
|
||||
"parts.dimension.socket_depth": "Profundidad hexágono",
|
||||
"parts.dimension.thickness": "Espesor",
|
||||
"parts.dimension.width": "Anchura",
|
||||
"parts.family.bearing": "Rodamiento rígido de bolas (envolvente)",
|
||||
"parts.family.dowel_pin": "Pasador cilíndrico",
|
||||
"parts.family.hex_bolt": "Tornillo de cabeza hexagonal",
|
||||
"parts.family.hex_nut": "Tuerca hexagonal",
|
||||
"parts.family.set_screw": "Prisionero con hexágono interior, punta plana",
|
||||
"parts.family.socket_head_cap_screw": "Tornillo cilíndrico con hexágono interior",
|
||||
"parts.family.washer": "Arandela plana",
|
||||
"pattern.alignment_2": "Alineación 2",
|
||||
"pattern.alignment_hint": "Los recuentos incluyen el original. Centrar equilibra las copias; Invertir elige el lado adicional cuando el total es par.",
|
||||
"pattern.direction_1": "Dirección 1",
|
||||
"pattern.direction_2": "Dirección 2",
|
||||
"pattern.flip_direction": "Invertir dirección",
|
||||
"pick a body or some of its faces": "elige un cuerpo o algunas de sus caras",
|
||||
"pick a hole to seat it, or OK places it at the origin": "selecciona un agujero para colocarlo o pulsa Aceptar para situarlo en el origen",
|
||||
"pick a planar face": "elige una cara plana",
|
||||
"pick a plane or a face as the tool": "elige un plano o una cara como herramienta",
|
||||
"pick a size": "elige un tamaño",
|
||||
"pick edges of a body": "elige aristas de un cuerpo",
|
||||
"pick edges of one body": "elige aristas de un solo cuerpo",
|
||||
"pick edges of the holes to remove": "elige las aristas de los agujeros que quitar",
|
||||
"pick faces of one body": "elige caras de un solo cuerpo",
|
||||
"pick faces to offset": "elige las caras que desfasar",
|
||||
"pick lines of one sketch": "elige líneas de un solo boceto",
|
||||
"pick one or two vertices, edges or faces": "selecciona uno o dos vértices, aristas o caras",
|
||||
"pick one plane or face as the tool, or sketch curves": "elige un plano o una cara como herramienta, o curvas de boceto",
|
||||
"pick sections in two or more sketches": "elige secciones en dos o más bocetos",
|
||||
"pick sketch curves or edges": "elige curvas de boceto o aristas",
|
||||
"pick the face to untrim": "elige la cara a la que quitar el recorte",
|
||||
"pick what to keep": "elige qué conservar",
|
||||
"pick what to keep of the other surface": "elige qué conservar de la otra superficie",
|
||||
"prefs.cpu": "CPU (software)",
|
||||
"prefs.max_file_size": "Tamaño máximo de archivo al abrir",
|
||||
"prefs.max_file_size_design": "Archivos de diseño",
|
||||
"prefs.max_file_size_flag": "Esta ejecución se inició con --max-file-size {size}, que se aplica hasta cerrar SolidCraft. Estos ajustes se aplican al iniciar sin esa opción.",
|
||||
"prefs.max_file_size_note": "Valores predeterminados: 512 MB y 256 MB; máximo 16 GB. Abrir un archivo requiere varias veces su tamaño en memoria. Un diseño que conserva una importación grande puede necesitar un límite mayor para guardarse y volver a abrirse.",
|
||||
"prefs.max_file_size_step": "Archivos STEP y de importación",
|
||||
"prefs.max_file_size_web": "La aplicación web abre archivos STEP y de importación de hasta 512 MB y diseños de hasta 256 MB: una pestaña del navegador no admite archivos mayores. La aplicación de escritorio permite aumentar estos límites.",
|
||||
"prefs.megabytes": "MB",
|
||||
"prefs.minutes_suffix": " min",
|
||||
"prefs.theme_follow": "Seguir un archivo de tema",
|
||||
"prefs.theme_follow_error": "No aplicado: {error}. Se mantiene el último tema válido.",
|
||||
@@ -1720,6 +1866,26 @@
|
||||
"search.suggest": "¿Quisiste decir {label}?",
|
||||
"search.try": "Escribe el nombre de un comando, una operación de este diseño o un parámetro. Para ejecutar un comando con valores, escribe su id y un objeto JSON: {example}",
|
||||
"search.valid": "Válido",
|
||||
"select a direction (an axis, a sketch line or a straight edge) first": "selecciona primero una dirección (un eje, una línea de boceto o una arista recta)",
|
||||
"select a direction (an axis, a sketch line or a straight edge) for the profile to follow": "selecciona una dirección (un eje, una línea de boceto o una arista recta) que seguirá el perfil",
|
||||
"select a point on a component": "selecciona un punto en un componente",
|
||||
"select a profile, edges or sketch lines first": "selecciona primero un perfil, aristas o líneas de boceto",
|
||||
"select an axis": "selecciona un eje",
|
||||
"select an axis, a straight or circular edge, or a cylinder, cone or torus face first": "selecciona primero un eje, una arista recta o circular, o una cara cilíndrica, cónica o toroidal",
|
||||
"select bodies first": "selecciona primero cuerpos",
|
||||
"select corner points, or the two lines of one corner": "selecciona puntos de esquina, o las dos líneas de una esquina",
|
||||
"select one corner point, or the two lines of one corner": "selecciona un punto de esquina, o las dos líneas de una esquina",
|
||||
"select sheet edges first": "selecciona primero aristas de chapa",
|
||||
"select the bend line (a sketch line) first": "selecciona primero la línea de plegado (una línea de boceto)",
|
||||
"select the cam's profile (a sketch profile or the cam's edges)": "selecciona el perfil de la leva (un perfil de boceto o las aristas de la leva)",
|
||||
"select the corner to cut first": "selecciona primero la esquina que cortar",
|
||||
"select the corners to round first": "selecciona primero las esquinas que redondear",
|
||||
"select the fixed face first (a plate's large face)": "selecciona primero la cara fija (la cara grande de una placa)",
|
||||
"select the frame sketch's lines first": "selecciona primero las líneas del boceto del marco",
|
||||
"select the path (sketch lines across the edge)": "selecciona la trayectoria (líneas de boceto a lo largo de la arista)",
|
||||
"select the rim face first": "selecciona primero la cara del borde",
|
||||
"select the sheet edge first": "selecciona primero la arista de la chapa",
|
||||
"select two components": "selecciona dos componentes",
|
||||
"settings.display_quality_note": "Los niveles más finos muestran las caras y aristas curvas con mayor suavidad, pero tardan más en generar la malla. Solo cambia el visor, nunca el diseño ni las exportaciones.",
|
||||
"settings.frame_rate_note": "Muestra los fotogramas por segundo en la esquina inferior derecha de la vista.",
|
||||
"settings.measure_axis_distances": "Mostrar distancias X/Y/Z",
|
||||
@@ -1732,16 +1898,22 @@
|
||||
"settings.reset_intro": "Estos ajustes no funcionan en este ordenador e impedirían iniciar SolidCraft, por lo que se han cambiado:",
|
||||
"settings.reset_title": "Se han cambiado los ajustes",
|
||||
"settings.supersampling_note": "Dibuja la vista a mayor resolución y después la reduce: bordes, líneas y cuadrícula más suaves en pantallas inferiores a 4K. Consume recursos de GPU: unos 2,25× píxeles a 1,5× y 4× a 2×.",
|
||||
"sheet.flange_type_base": "Base",
|
||||
"sheet.flange_type_contour": "Contorno",
|
||||
"sheet.flange_type_edge": "Arista",
|
||||
"shortcut.json_error": "los parámetros deben estar en formato JSON: {error}",
|
||||
"shortcut.no_command": "no existe el comando `{id}`; el texto anterior al JSON debe ser un ID de comando",
|
||||
"shortcut.pin": "Fijar en la parte superior del cuadro S",
|
||||
"shortcut.unpin": "Desfijar",
|
||||
"sketch is missing": "falta el boceto",
|
||||
"sketch.degrees_of_freedom": "{count} grados de libertad",
|
||||
"sketch.dof_left": "Quedan {count} grados de libertad",
|
||||
"sketch.dof_left_one": "Queda {count} grado de libertad",
|
||||
"sketch.draw_curves": "Dibujar como {linetype}",
|
||||
"sketch.make_selection": "Convertir la selección a {linetype}",
|
||||
"sketch.open_ends": "Abiertos {count}",
|
||||
"sketch.status_conflict": "restricciones en conflicto",
|
||||
"sketch.status_fully_constrained": "totalmente restringido",
|
||||
"sketch.untied_ends": "Sin vincular {count}",
|
||||
"sketch_panel.attached": "Vinculado a {body} / {path}",
|
||||
"sketch_panel.author": "Ubicación de autoría: {path}",
|
||||
@@ -1763,7 +1935,24 @@
|
||||
"sketch_text.path_hint": "Curva del boceto que seguirá el texto: haz clic aquí y después en la curva",
|
||||
"sketch_text.use_font_file": "Usar el archivo de fuente {path}",
|
||||
"solid": "sólido",
|
||||
"the angle must be a number": "el ángulo debe ser un número",
|
||||
"the curves must be in one sketch": "las curvas deben estar en un solo boceto",
|
||||
"the direction must be an axis, a sketch line or a straight edge": "la dirección debe ser un eje, una línea de boceto o una arista recta",
|
||||
"the duration must be a number of seconds, 0.001 or more": "la duración debe ser un número de segundos, 0.001 o más",
|
||||
"the line's sketch is gone": "el boceto de la línea ya no existe",
|
||||
"the lines must be in one sketch": "las líneas deben estar en un solo boceto",
|
||||
"the lines must be in one sketch, not the section's": "las líneas deben estar en un solo boceto, no en el de la sección",
|
||||
"the parts library is empty": "la biblioteca de piezas está vacía",
|
||||
"the parts library is not available": "la biblioteca de piezas no está disponible",
|
||||
"the path curves must be in one other sketch": "las curvas de la trayectoria deben estar en un solo boceto distinto",
|
||||
"the path's sketch is gone": "el boceto de la trayectoria ya no existe",
|
||||
"the position must be a number": "la posición debe ser un número",
|
||||
"the preview failed": "falló la vista previa",
|
||||
"the profiles and curves must be in one sketch": "los perfiles y las curvas deben estar en un solo boceto",
|
||||
"the reference face must be on the edges' body": "la cara de referencia debe estar en el cuerpo de las aristas",
|
||||
"the scale must be above 0": "la escala debe ser mayor que 0",
|
||||
"the section's profiles must be in one sketch": "los perfiles de la sección deben estar en un solo boceto",
|
||||
"the two origins are on the same component": "los dos orígenes están en el mismo componente",
|
||||
"thread.automatic_size": "Tamaño automático",
|
||||
"thread.designation": "Designación",
|
||||
"thread.iso_metric": "Métrica ISO",
|
||||
@@ -1790,6 +1979,7 @@
|
||||
"trace.points": "{count} puntos a lo largo de la trayectoria",
|
||||
"trace.stopped_by_contact": "Termina en la muestra {sample}: {a} atravesaría {b}",
|
||||
"trace.stopped_by_loop": "Termina en la muestra {sample}: el bucle que pasa por {joint} no puede cerrarse más",
|
||||
"trim by sketch curves, or by one plane or face": "recorta con curvas de boceto, o con un plano o una cara",
|
||||
"ui.1_degree_of_freedom": "1 grado de libertad",
|
||||
"ui.3d_mouse_axes_reassigned": "Los ejes están reasignados en Preferencias, y eso sigue aplicándose sobre esta calibración.",
|
||||
"ui.3d_mouse_button": "Botón {number}",
|
||||
@@ -2216,6 +2406,8 @@
|
||||
"ui.design_properties.revision": "Revisión",
|
||||
"ui.diameter": "Diámetro",
|
||||
"ui.dimension": "Cota",
|
||||
"ui.direct_interaction": "Interacción directa",
|
||||
"ui.direct_interaction_note": "Trabaja directamente sobre el modelo en la vista. Pulsa una cara plana o un perfil y tira: hacia arriba extruye, hacia abajo dentro de un cuerpo corta, y el movimiento lateral fija el paso",
|
||||
"ui.direction": "Dirección",
|
||||
"ui.display_quality": "Calidad de visualización",
|
||||
"ui.display_quality_coarse": "Baja",
|
||||
@@ -2239,6 +2431,7 @@
|
||||
"ui.editJointLimits": "Editar límites de unión",
|
||||
"ui.edit_section_analysis": "Editar análisis de sección",
|
||||
"ui.ellipse": "Elipse",
|
||||
"ui.emboss_wrap_note": "Los perfiles de líneas ortogonales tangentes a un cilindro compatible se envuelven automáticamente. Elegir una pared para definir el destino.",
|
||||
"ui.end_radius": "Radio final",
|
||||
"ui.end_scale": "Escala final",
|
||||
"ui.entities": "Entidades",
|
||||
@@ -2304,6 +2497,7 @@
|
||||
"ui.heading_extrude": "EXTRUIR",
|
||||
"ui.heading_fillet": "REDONDEO",
|
||||
"ui.heading_finish_sketch": "FINALIZAR BOCETO",
|
||||
"ui.heading_form": "FORMA",
|
||||
"ui.heading_front": "FRONTAL",
|
||||
"ui.heading_hole": "AGUJERO",
|
||||
"ui.heading_home": "INICIO",
|
||||
@@ -2352,6 +2546,7 @@
|
||||
"ui.heading_utilities": "UTILIDADES",
|
||||
"ui.heading_utility": "UTILIDAD",
|
||||
"ui.heading_weldments": "SOLDADURA",
|
||||
"ui.height": "Altura",
|
||||
"ui.help": "Ayuda",
|
||||
"ui.hide": "Ocultar",
|
||||
"ui.hideAxes": "Ocultar ejes",
|
||||
@@ -2379,11 +2574,14 @@
|
||||
"ui.intersect": "Intersecar",
|
||||
"ui.isolate": "Aislar",
|
||||
"ui.join": "Unir",
|
||||
"ui.joint_play": "▶ Reproducir",
|
||||
"ui.joint_stop": "■ Detener",
|
||||
"ui.joints": "Uniones",
|
||||
"ui.keyboard_shortcuts": "Atajos de teclado",
|
||||
"ui.language": "Idioma",
|
||||
"ui.layout_compact": "Compacta",
|
||||
"ui.layout_floating": "Flotante",
|
||||
"ui.length": "Longitud",
|
||||
"ui.length_decimals": "Decimales de longitud",
|
||||
"ui.light": "Claro",
|
||||
"ui.line": "Línea",
|
||||
@@ -2391,6 +2589,7 @@
|
||||
"ui.loft": "Solevación",
|
||||
"ui.look_at": "Mirar hacia",
|
||||
"ui.look_at_anim_desc": "Vista de eje, Mirar hacia, Inicio y Ajustar",
|
||||
"ui.major_radius": "Radio mayor",
|
||||
"ui.manipulator_free_alt": "Arrastre libre del manipulador también con Alt/Option",
|
||||
"ui.manipulator_free_alt_tip": "Activado: Alt/Option o Ctrl/Cmd sobre las flechas de extrusión / manipulador desactiva el ajuste de valores. Desactivado: solo Ctrl/Cmd.",
|
||||
"ui.manufacture": "Fabricación",
|
||||
@@ -2420,8 +2619,10 @@
|
||||
"ui.mesh_format_3mf": "3MF",
|
||||
"ui.mesh_format_3mf_tagged": "3MF con etiquetas de cara",
|
||||
"ui.mesh_format_stl": "STL",
|
||||
"ui.minor_radius": "Radio menor",
|
||||
"ui.mirror": "Simetría",
|
||||
"ui.mirror_line": "Línea de simetría",
|
||||
"ui.modifiers_either": "{first} o {second}",
|
||||
"ui.move": "Mover",
|
||||
"ui.multiple": "Múltiple",
|
||||
"ui.named_views": "Vistas guardadas",
|
||||
@@ -2520,6 +2721,7 @@
|
||||
"ui.reverse_horizontal_pan_direction": "Invertir dirección del desplazamiento horizontal",
|
||||
"ui.reverse_horizontal_pan_tip": "El desplazamiento horizontal con dos dedos y la rueda de pulgar desplazan en sentido contrario",
|
||||
"ui.reverse_zoom_direction": "Invertir dirección del zoom",
|
||||
"ui.revolutions": "Vueltas",
|
||||
"ui.revolve": "Revolución",
|
||||
"ui.ribbon_exit": "Salir",
|
||||
"ui.ribbon_labels": "Mostrar texto bajo los iconos de la cinta",
|
||||
@@ -2535,6 +2737,7 @@
|
||||
"ui.scale": "Escala",
|
||||
"ui.second_rail": "Segunda línea guía",
|
||||
"ui.section_analysis": "Análisis de sección",
|
||||
"ui.section_size": "Tamaño de la sección",
|
||||
"ui.select": "Seleccionar",
|
||||
"ui.selectOther": "Seleccionar otro…",
|
||||
"ui.selectTangentChain": "Seleccionar cadena tangente",
|
||||
@@ -2585,6 +2788,7 @@
|
||||
"ui.start": "Iniciar",
|
||||
"ui.start_over": "Volver a empezar",
|
||||
"ui.start_page": "Página de inicio",
|
||||
"ui.stitch_tolerance_hint": "estricta",
|
||||
"ui.stretch": "Estirar",
|
||||
"ui.supersampling": "Supermuestreo (SSAA)",
|
||||
"ui.supersampling_adaptive": "Solo cuando la vista está inmóvil",
|
||||
@@ -2615,6 +2819,8 @@
|
||||
"ui.to_object": "Hasta objeto",
|
||||
"ui.tool_direction": "Dirección de herramienta",
|
||||
"ui.top": "Superior",
|
||||
"ui.top_diameter": "Diámetro superior",
|
||||
"ui.top_radius": "Radio superior",
|
||||
"ui.torus": "Toro",
|
||||
"ui.total_angle": "Ángulo total",
|
||||
"ui.trackpad_pan_tip": "Los gestos del panel táctil desplazan la vista (desactivado: hacen zoom como la rueda); la rueda del ratón hace zoom, la rueda lateral desplaza horizontalmente y el gesto de pellizco siempre hace zoom",
|
||||
@@ -2640,6 +2846,7 @@
|
||||
"ui.visual_shaded_with_edges": "Sombreado con aristas",
|
||||
"ui.visual_style": "Estilo visual",
|
||||
"ui.visual_wireframe": "Estructura alámbrica",
|
||||
"ui.width": "Anchura",
|
||||
"ui.workspace": "espacio de trabajo",
|
||||
"ui.workspace_animation_description": "Vistas explosionadas, estudios de movimiento y guiones gráficos",
|
||||
"ui.workspace_available": "Disponible",
|
||||
@@ -2695,5 +2902,8 @@
|
||||
"update.up_to_date": "SolidCraft está actualizado.",
|
||||
"update.update_now": "Actualizar ahora",
|
||||
"update.you_have": "Tienes la versión {version}.",
|
||||
"use a positive nominal diameter and a pitch smaller than it": "usa un diámetro nominal positivo y un paso menor que él",
|
||||
"values must be finite numbers": "los valores deben ser números finitos",
|
||||
"values must be numbers or expressions": "los valores deben ser números o expresiones",
|
||||
"↑ ↓ choose · Enter / Tab complete · Esc dismiss": "↑ ↓ elegir · Intro / Tab completar · Esc cerrar"
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"All open designs": "Wszystkie otwarte projekty",
|
||||
"Allowed expressions, separated by semicolons": "Dozwolone wyrażenia, rozdzielone średnikami",
|
||||
"Also deletes": "Usuwa również",
|
||||
"Also place them from the origin (fully constrained)": "Umieść je też względem początku (w pełni związane)",
|
||||
"Angle 2": "Kąt 2",
|
||||
"Animate": "Animuj",
|
||||
"App/system information and command settings are included. Review private details before sharing.": "Dołączone są informacje o aplikacji i systemie oraz ustawienia poleceń. Przed udostępnieniem sprawdź, czy nie ma tam prywatnych danych.",
|
||||
@@ -118,6 +119,7 @@
|
||||
"Describe what happened before continuing.": "Zanim przejdziesz dalej, opisz, co się stało.",
|
||||
"Designs you open or save appear here.": "Tutaj pojawiają się otwierane lub zapisywane projekty.",
|
||||
"Determined by To Object. Choose Angle to edit the angular extent.": "Wynika z opcji Do obiektu. Wybierz Kąt, aby edytować zakres kątowy.",
|
||||
"Dimension new shapes": "Wymiaruj nowe kształty",
|
||||
"Direction": "Kierunek",
|
||||
"Discard": "Odrzuć",
|
||||
"Do not export hidden edges": "Nie eksportuj krawędzi niewidocznych",
|
||||
@@ -131,6 +133,8 @@
|
||||
"Drag to turn the rest in 5° steps. Hold Alt or Ctrl to turn it freely.": "Przeciągnij, aby obrócić podparcie co 5°. Przytrzymaj Alt lub Ctrl, aby obracać swobodnie.",
|
||||
"Drive Joint": "Steruj złączem",
|
||||
"Duration": "Czas trwania",
|
||||
"Each new shape is also dimensioned from the sketch origin until nothing of it is left free. A shape already attached to the origin or to placed geometry gets none.": "Każdy nowy kształt otrzymuje też wymiary od początku szkicu, aż nic nie pozostanie swobodne. Kształt już połączony z początkiem lub z umieszczoną geometrią nie otrzymuje żadnych.",
|
||||
"Each shape you draw gets all its dimensions, at the sizes you drew (typed values win). A size the sketch already sets is left out.": "Każdy narysowany kształt otrzymuje wszystkie swoje wymiary w narysowanych rozmiarach (wpisane wartości mają pierwszeństwo). Rozmiar, który szkic już określa, jest pomijany.",
|
||||
"Edges": "Krawędzie",
|
||||
"Edit": "Edytuj",
|
||||
"Edit Profile Sketch": "Edytuj szkic profilu",
|
||||
@@ -475,6 +479,7 @@
|
||||
"appearance.pbr_opaque": "Nieprzezroczysty PBR",
|
||||
"appearance.roughness": "Chropowatość",
|
||||
"appearance.surface_response": "Reakcja powierzchni",
|
||||
"at the face": "przy ścianie",
|
||||
"browser.body_name": "Bryła{number}",
|
||||
"browser.calibrate_title": "Kalibruj: {name}",
|
||||
"browser.capture_many": "Przesunięto komponenty ({count}), ale ich położenia nie zostały zapamiętane.",
|
||||
@@ -775,6 +780,7 @@
|
||||
"cmd.sketch_spline_control_point": "Splajn z punktów kontrolnych",
|
||||
"cmd.sketch_spline_control_point_5": "Splajn z punktów kontrolnych (stopień 5)",
|
||||
"cmd.sketch_spline_fit_point": "Splajn przez punkty",
|
||||
"cmd.sketch_spline_reverse": "Odwróć kierunek splajnu",
|
||||
"cmd.sketch_spun_profile": "Profil obrotowy",
|
||||
"cmd.sketch_toggle_driven": "Przełącz wymiar sterowany",
|
||||
"cmd.sketch_trim_path": "Przytnij wzdłuż ścieżki",
|
||||
@@ -1057,6 +1063,11 @@
|
||||
"no picture": "brak obrazu",
|
||||
"none": "brak",
|
||||
"parts.automatic_name": "automatycznie",
|
||||
"parts.dimension.d": "Średnica nominalna",
|
||||
"parts.dimension.height": "Wysokość",
|
||||
"parts.dimension.pitch": "Skok",
|
||||
"parts.dimension.thickness": "Grubość",
|
||||
"parts.dimension.width": "Szerokość",
|
||||
"pattern.alignment_2": "Wyrównanie 2",
|
||||
"pattern.alignment_hint": "Liczba obejmuje oryginał. Wyśrodkuj rozkłada kopie po obu stronach; Odwróć wybiera stronę z dodatkową kopią przy parzystej liczbie.",
|
||||
"pattern.direction_1": "Kierunek 1",
|
||||
@@ -1127,6 +1138,13 @@
|
||||
"prefs.left_click": "Kliknięcie lewym",
|
||||
"prefs.live_input": "Bieżące wejście",
|
||||
"prefs.live_preview": "Podgląd na żywo",
|
||||
"prefs.max_file_size": "Maksymalny rozmiar otwieranego pliku",
|
||||
"prefs.max_file_size_design": "Pliki projektów",
|
||||
"prefs.max_file_size_flag": "To uruchomienie używa --max-file-size {size} aż do zamknięcia SolidCraft. Te ustawienia obowiązują przy uruchomieniu bez tej opcji.",
|
||||
"prefs.max_file_size_note": "Domyślnie: 512 MB i 256 MB; maksymalnie 16 GB. Otwarcie pliku wymaga pamięci kilkakrotnie większej od jego rozmiaru. Projekt z dużym importem może wymagać wyższego limitu pliku projektu, aby go zapisać i ponownie otworzyć.",
|
||||
"prefs.max_file_size_step": "Pliki STEP i importu",
|
||||
"prefs.max_file_size_web": "Aplikacja internetowa otwiera pliki STEP i importu do 512 MB oraz projekty do 256 MB: karta przeglądarki nie pomieści większych plików. W aplikacji komputerowej można zwiększyć te limity.",
|
||||
"prefs.megabytes": "MB",
|
||||
"prefs.minutes": "minut",
|
||||
"prefs.minutes_suffix": " min",
|
||||
"prefs.mouse": "Mysz i gładzik",
|
||||
@@ -1893,6 +1911,7 @@
|
||||
"ui.heading_utilities": "NARZĘDZIA",
|
||||
"ui.heading_utility": "NARZĘDZIE",
|
||||
"ui.heading_weldments": "SPAWANIE",
|
||||
"ui.height": "Wysokość",
|
||||
"ui.help": "Pomoc",
|
||||
"ui.hide": "Ukryj",
|
||||
"ui.hideAxes": "Ukryj osie",
|
||||
@@ -1931,6 +1950,7 @@
|
||||
"ui.language": "Język",
|
||||
"ui.layout_compact": "Kompaktowy",
|
||||
"ui.layout_floating": "Pływający",
|
||||
"ui.length": "Długość",
|
||||
"ui.length_decimals": "Miejsca dziesiętne długości",
|
||||
"ui.light": "Jasny",
|
||||
"ui.line": "Linia",
|
||||
@@ -2019,6 +2039,7 @@
|
||||
"ui.pinToShortcuts": "Przypnij do skrótów",
|
||||
"ui.pinToToolbar": "Przypnij do paska narzędzi",
|
||||
"ui.pipe": "Rura",
|
||||
"ui.pitch": "Skok",
|
||||
"ui.placement": "Umiejscowienie",
|
||||
"ui.placement_handles": "Uchwyty umieszczania",
|
||||
"ui.placement_handles_tip": "Uchwyty na podglądzie podparcia, występu lub zatrzasku: przeciągnij znacznik, aby przesunąć element po modelu, obróć go pierścieniem",
|
||||
@@ -2194,6 +2215,7 @@
|
||||
"ui.visual_shaded_with_edges": "Cieniowany z krawędziami",
|
||||
"ui.visual_style": "Styl wizualny",
|
||||
"ui.visual_wireframe": "Model krawędziowy",
|
||||
"ui.width": "Szerokość",
|
||||
"ui.workspace": "środowisko pracy",
|
||||
"ui.workspace_animation_description": "Widoki rozstrzelone, badania ruchu i scenorysy",
|
||||
"ui.workspace_available": "Dostępne",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"All open designs": "Todos os projetos abertos",
|
||||
"Allowed expressions, separated by semicolons": "Expressões permitidas, separadas por ponto e vírgula",
|
||||
"Also deletes": "Também exclui",
|
||||
"Also place them from the origin (fully constrained)": "Posicioná-las também a partir da origem (totalmente restritas)",
|
||||
"Angle 2": "Ângulo 2",
|
||||
"Animate": "Animar",
|
||||
"App/system information and command settings are included. Review private details before sharing.": "Informações do aplicativo/sistema e configurações estão incluídas. Revise detalhes privados antes de compartilhar.",
|
||||
@@ -145,6 +146,7 @@
|
||||
"Designs you open or save appear here.": "Os projetos que você abrir ou salvar aparecem aqui.",
|
||||
"Determined by To Object. Choose Angle to edit the angular extent.": "Determinado por Até o objeto. Escolha Ângulo para editar a extensão angular.",
|
||||
"Diameter": "Diâmetro",
|
||||
"Dimension new shapes": "Cotar novas formas",
|
||||
"Direction": "Direção",
|
||||
"Discard": "Descartar",
|
||||
"Distance": "Distância",
|
||||
@@ -155,6 +157,8 @@
|
||||
"Double-clicking the middle button in the view: Home (the home view, framing what is shown), Fit (frame what is shown, keeping the orientation) or nothing": "Clique duplo com o botão do meio na vista: Início (a vista inicial, enquadrando o que é mostrado), Ajustar (enquadra o que é mostrado, mantendo a orientação) ou nada",
|
||||
"Drive Joint": "Acionar junta",
|
||||
"Duration": "Duração",
|
||||
"Each new shape is also dimensioned from the sketch origin until nothing of it is left free. A shape already attached to the origin or to placed geometry gets none.": "Cada nova forma também recebe cotas a partir da origem do esboço até nada ficar livre. Uma forma já ligada à origem ou a uma geometria posicionada não recebe nenhuma.",
|
||||
"Each shape you draw gets all its dimensions, at the sizes you drew (typed values win). A size the sketch already sets is left out.": "Cada forma que você desenha recebe todas as suas cotas nos tamanhos desenhados (valores digitados têm prioridade). Um tamanho que o esboço já define é omitido.",
|
||||
"Edges": "Arestas",
|
||||
"Edit": "Editar",
|
||||
"Edit Profile Sketch": "Editar esboço do perfil",
|
||||
@@ -578,6 +582,7 @@
|
||||
"appearance.pbr_opaque": "PBR opaco",
|
||||
"appearance.roughness": "Rugosidade",
|
||||
"appearance.surface_response": "Resposta da superfície",
|
||||
"at the face": "na face",
|
||||
"browser.body_name": "Corpo{number}",
|
||||
"browser.calibrate_title": "Calibrar: {name}",
|
||||
"browser.capture_many": "{count} componentes foram movidos, mas suas posições não foram capturadas.",
|
||||
@@ -881,6 +886,7 @@
|
||||
"cmd.sketch_spline_control_point": "Spline por pontos de controle",
|
||||
"cmd.sketch_spline_control_point_5": "Spline por pontos de controle (grau 5)",
|
||||
"cmd.sketch_spline_fit_point": "Spline por pontos de ajuste",
|
||||
"cmd.sketch_spline_reverse": "Inverter direção do spline",
|
||||
"cmd.sketch_spun_profile": "Perfil de revolução",
|
||||
"cmd.sketch_toggle_driven": "Alternar cota conduzida",
|
||||
"cmd.sketch_trim_path": "Aparar ao longo do caminho",
|
||||
@@ -1159,7 +1165,9 @@
|
||||
"nav.free_orbit.label": "Órbita livre",
|
||||
"nav.free_orbit.snap_help": "Mouse e mouse 3D giram através dos dois polos e preservam a rotação da imagem. Mantenha Shift pressionado durante uma órbita por arraste para alinhar a direção da vista e a rotação da imagem.",
|
||||
"nav.fusion.help": "Arrastar com o meio desloca, Shift+meio orbita, arrastar com o direito orbita",
|
||||
"nav.hfss.help": "Alt+arrastar com o esquerdo desloca, Shift+Alt+esquerdo aplica zoom, Ctrl+arrastar com o esquerdo em área vazia orbita",
|
||||
"nav.inventor.help": "Arrastar com o meio desloca, Shift+meio orbita, Ctrl+meio aplica zoom, arrastar com o direito orbita",
|
||||
"nav.maya.help": "Alt+arrastar com o esquerdo orbita, Alt+meio desloca, Alt+direito aplica zoom; arrastar com o meio também desloca",
|
||||
"nav.openscad.help": "Arrastar com o esquerdo no espaço vazio orbita, Shift+arrastar com o esquerdo seleciona por caixa, arrastar a geometria do esboço a edita; arrastar com o direito ou o meio desloca, Shift+arrastar com o direito ou o meio aplica zoom",
|
||||
"nav.solidworks.help": "Arrastar com o meio orbita, Ctrl+meio desloca, Shift+meio aplica zoom, arrastar com o direito orbita",
|
||||
"nav.tinkercad.help": "Arrastar com o direito orbita, arrastar com o meio ou Shift+direito desloca",
|
||||
@@ -1178,6 +1186,11 @@
|
||||
"no picture": "sem imagem",
|
||||
"none": "nenhum",
|
||||
"parts.automatic_name": "automático",
|
||||
"parts.dimension.d": "Diâmetro nominal",
|
||||
"parts.dimension.height": "Altura",
|
||||
"parts.dimension.pitch": "Passo",
|
||||
"parts.dimension.thickness": "Espessura",
|
||||
"parts.dimension.width": "Largura",
|
||||
"pattern.alignment_2": "Alinhamento 2",
|
||||
"pattern.alignment_hint": "As contagens incluem o original. Centralizar equilibra as cópias; Inverter escolhe o lado extra para totais pares.",
|
||||
"pattern.direction_1": "Direção 1",
|
||||
@@ -1248,6 +1261,13 @@
|
||||
"prefs.left_click": "Clique esquerdo",
|
||||
"prefs.live_input": "Entrada ao vivo",
|
||||
"prefs.live_preview": "Visualização ao vivo",
|
||||
"prefs.max_file_size": "Tamanho máximo de arquivo a abrir",
|
||||
"prefs.max_file_size_design": "Arquivos de projeto",
|
||||
"prefs.max_file_size_flag": "Esta execução foi iniciada com --max-file-size {size}, que vale até fechar o SolidCraft. Estas configurações se aplicam ao iniciar sem essa opção.",
|
||||
"prefs.max_file_size_note": "Padrões: 512 MB e 256 MB; máximo de 16 GB. Abrir um arquivo exige várias vezes seu tamanho em memória. Um projeto que mantém uma importação grande pode precisar de um limite maior para ser salvo e reaberto.",
|
||||
"prefs.max_file_size_step": "Arquivos STEP e de importação",
|
||||
"prefs.max_file_size_web": "O aplicativo web abre arquivos STEP e de importação de até 512 MB e projetos de até 256 MB: uma aba do navegador não comporta arquivos maiores. O aplicativo para desktop permite aumentar esses limites.",
|
||||
"prefs.megabytes": "MB",
|
||||
"prefs.minutes": "minutos",
|
||||
"prefs.minutes_suffix": " min",
|
||||
"prefs.mouse": "Mouse e trackpad",
|
||||
@@ -2023,6 +2043,7 @@
|
||||
"ui.heading_utilities": "UTILITÁRIOS",
|
||||
"ui.heading_utility": "UTILITÁRIO",
|
||||
"ui.heading_weldments": "SOLDAGEM",
|
||||
"ui.height": "Altura",
|
||||
"ui.help": "Ajuda",
|
||||
"ui.hide": "Ocultar",
|
||||
"ui.hideAxes": "Ocultar eixos",
|
||||
@@ -2061,6 +2082,7 @@
|
||||
"ui.language": "Idioma",
|
||||
"ui.layout_compact": "Compacto",
|
||||
"ui.layout_floating": "Flutuante",
|
||||
"ui.length": "Comprimento",
|
||||
"ui.length_decimals": "Casas decimais de comprimento",
|
||||
"ui.light": "Claro",
|
||||
"ui.line": "Linha",
|
||||
@@ -2148,6 +2170,7 @@
|
||||
"ui.pinToShortcuts": "Fixar nos atalhos",
|
||||
"ui.pinToToolbar": "Fixar na barra de ferramentas",
|
||||
"ui.pipe": "Tubo",
|
||||
"ui.pitch": "Passo",
|
||||
"ui.placement": "Posicionamento",
|
||||
"ui.plane": "Plano",
|
||||
"ui.plane_at_angle": "Plano em ângulo",
|
||||
@@ -2322,6 +2345,7 @@
|
||||
"ui.visual_shaded_with_edges": "Sombreado com arestas",
|
||||
"ui.visual_style": "Estilo visual",
|
||||
"ui.visual_wireframe": "Aramado",
|
||||
"ui.width": "Largura",
|
||||
"ui.workspace": "espaço de trabalho",
|
||||
"ui.workspace_animation_description": "Vistas explodidas, estudos de movimento e storyboards",
|
||||
"ui.workspace_available": "Disponível",
|
||||
|
||||
@@ -10,7 +10,7 @@ struct U {
|
||||
acc_u: vec4<f32>, // accessibility map axes (xyz, offset)
|
||||
acc_v: vec4<f32>,
|
||||
eye: vec4<f32>, // eye position, w = 1 for perspective (0: orthographic, looking along -back)
|
||||
ao: vec4<f32>, // radius in world units (zero: disabled)
|
||||
ao: vec4<f32>, // x: radius in world units (zero: disabled), y: samples per pixel
|
||||
// analysis colours (`theme::AnalysisColors`): draft positive, between, negative; reachable,
|
||||
// blocked; curvature flat, middle, tight
|
||||
ana_c: array<vec4<f32>, 8>,
|
||||
@@ -333,9 +333,12 @@ fn occlusion(i: TOut) -> f32 {
|
||||
// the buffer runs reversed). The map is cleared to its far plane either way, so a texel
|
||||
// with nothing in it reads as 1 and the `d < 1.0` test below skips it.
|
||||
let flip = reversed();
|
||||
// Fewer samples while the view moves (#7165), spread over the same hemisphere. 32 is the
|
||||
// still picture's count, `AO_SAMPLES` in view.rs.
|
||||
let count = u32(clamp(u.ao.y, 1.0, 32.0));
|
||||
var blocked = 0.0;
|
||||
for (var j = 0u; j < 32u; j = j + 1u) {
|
||||
let f = (f32(j) + 0.5) / 32.0;
|
||||
for (var j = 0u; j < count; j = j + 1u) {
|
||||
let f = (f32(j) + 0.5) / f32(count);
|
||||
let angle = f32(j) * 2.39996323;
|
||||
let direction = t * (cos(angle) * sqrt(f)) + b * (sin(angle) * sqrt(f)) + n * sqrt(1.0 - f);
|
||||
let reach = radius * (0.2 + 0.8 * fract(f32(j) * 0.61803399 + 0.5));
|
||||
@@ -356,7 +359,7 @@ fn occlusion(i: TOut) -> f32 {
|
||||
blocked = blocked + smoothstep(0.005, 0.15, delta) * (1.0 - smoothstep(0.5, 1.0, delta));
|
||||
}
|
||||
}
|
||||
return 1.0 - 0.85 * blocked / 32.0;
|
||||
return 1.0 - 0.85 * blocked / f32(count);
|
||||
}
|
||||
|
||||
/// How fast the normal turns across the pixel (per mm).
|
||||
@@ -650,3 +653,39 @@ fn fs_img(i: IOut) -> @location(0) vec4<f32> {
|
||||
fn fs_line_all(i: LOut) -> @location(0) vec4<f32> {
|
||||
return out_color(i.c);
|
||||
}
|
||||
|
||||
// Point clouds: each point is a round dot a few pixels across, facing the screen, depth-tested
|
||||
// and written like the model's faces, so the model hides the points behind it and they hide it.
|
||||
// The colour's alpha carries the dot's size (eighths of a pixel).
|
||||
|
||||
struct POut {
|
||||
@builtin(position) pos: vec4<f32>,
|
||||
@location(0) c: vec4<f32>,
|
||||
@location(1) wp: vec3<f32>,
|
||||
@location(2) at: vec2<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn vs_point(@builtin(vertex_index) vi: u32, @location(0) p: vec3<f32>, @location(1) c: vec4<f32>) -> POut {
|
||||
var xs = array<f32, 6>(-1.0, 1.0, 1.0, -1.0, 1.0, -1.0);
|
||||
var ys = array<f32, 6>(-1.0, -1.0, 1.0, -1.0, 1.0, 1.0);
|
||||
let at = vec2<f32>(xs[vi], ys[vi]);
|
||||
let size = max(c.a * 255.0 / 8.0, 1.0);
|
||||
let centre = u.vp * vec4<f32>(p, 1.0);
|
||||
let half = u.screen.xy * 0.5;
|
||||
var o: POut;
|
||||
o.pos = vec4<f32>(centre.xy + at * size * 0.5 / half * centre.w, centre.z, centre.w);
|
||||
// Behind the eye: nothing.
|
||||
if (near_z(centre) < 0.0) { o.pos = vec4<f32>(0.0, 0.0, 0.0, -1.0); }
|
||||
o.c = vec4<f32>(c.rgb, 1.0);
|
||||
o.wp = p;
|
||||
// Dots under two pixels are squares: a disc that small loses its centre pixel.
|
||||
o.at = at * select(1.0, 0.0, size < 2.0);
|
||||
return o;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fs_point(i: POut) -> @location(0) vec4<f32> {
|
||||
if (clipped(i.wp) || dot(i.at, i.at) > 1.0) { discard; }
|
||||
return out_color(i.c);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,15 @@ const fn icon_primary(rgb: [u8; 3]) -> Color32 {
|
||||
impl Tokens {
|
||||
pub const fn light() -> Tokens {
|
||||
Tokens {
|
||||
nav_hover: Color32::from_rgb(233, 237, 242),
|
||||
nav_press: Color32::from_rgb(220, 226, 234),
|
||||
nav_dim: Color32::from_rgb(136, 149, 167),
|
||||
nav_viewport: Color32::from_rgb(238, 241, 245),
|
||||
nav_tip: Color32::from_rgb(27, 36, 48),
|
||||
nav_tip_ink: Color32::from_rgb(255, 255, 255),
|
||||
nav_tip_key_border: Color32::from_rgba_unmultiplied_const(128, 140, 160, 153),
|
||||
nav_field: Color32::from_rgb(255, 255, 255),
|
||||
|
||||
borders: crate::theme::Borders::LEGACY,
|
||||
icon_palette: None,
|
||||
file_dim: Color32::from_rgb(58, 70, 86),
|
||||
@@ -184,8 +193,10 @@ impl Tokens {
|
||||
sketch_halo: Color32::from_rgb(240, 243, 247),
|
||||
sketch_point: Color32::BLACK,
|
||||
sketch_locked: Color32::from_rgb(0, 140, 60),
|
||||
dimension: Color32::from_rgb(36, 40, 48),
|
||||
dimension_driven: Color32::from_rgb(120, 126, 138),
|
||||
// Sketch dimensions in a plum of their own, apart from the blue and black curves for
|
||||
// every colour vision mode (#7861).
|
||||
dimension: Color32::from_rgb(130, 42, 110),
|
||||
dimension_driven: Color32::from_rgb(160, 90, 120),
|
||||
sketch_point_free: Color32::from_rgb(30, 90, 200),
|
||||
section_cap: Color32::from_rgb(214, 128, 72),
|
||||
dialog_bg: Color32::from_rgb(250, 251, 252),
|
||||
@@ -314,6 +325,14 @@ impl Tokens {
|
||||
t.render_ink = Color32::from_rgb(224, 116, 174);
|
||||
t.render_soft = Color32::from_rgb(64, 35, 54);
|
||||
t.tab_on_fill_dark = Color32::BLACK;
|
||||
t.nav_hover = Color32::from_rgb(58, 65, 80);
|
||||
t.nav_press = Color32::from_rgb(70, 78, 96);
|
||||
t.nav_dim = Color32::from_rgb(124, 135, 154);
|
||||
t.nav_viewport = Color32::from_rgb(38, 43, 53);
|
||||
t.nav_tip = Color32::from_rgb(238, 241, 245);
|
||||
t.nav_tip_ink = Color32::from_rgb(27, 36, 48);
|
||||
t.nav_tip_key_border = Color32::from_rgba_unmultiplied_const(128, 140, 160, 153);
|
||||
t.nav_field = Color32::from_rgb(47, 52, 62);
|
||||
t.dialog_body = Color32::from_rgb(39, 43, 52);
|
||||
t.dialog_footer = Color32::from_rgb(47, 52, 62);
|
||||
t.dialog_rule = Color32::from_rgb(53, 59, 71);
|
||||
@@ -341,8 +360,9 @@ impl Tokens {
|
||||
t.sketch_halo = Color32::from_rgb(28, 32, 40);
|
||||
t.sketch_point = Color32::from_rgb(232, 234, 238);
|
||||
t.sketch_locked = Color32::from_rgb(96, 204, 116);
|
||||
t.dimension = Color32::from_rgb(224, 228, 234);
|
||||
t.dimension_driven = Color32::from_rgb(142, 150, 164);
|
||||
// Sketch dimensions: Light's plum, lightened for the dark view (#7861).
|
||||
t.dimension = Color32::from_rgb(224, 176, 224);
|
||||
t.dimension_driven = Color32::from_rgb(176, 104, 144);
|
||||
t.sketch_point_free = Color32::from_rgb(92, 150, 255);
|
||||
t.profile_fill = Color32::from_rgba_unmultiplied_const(120, 150, 200, 40);
|
||||
t.dialog_bg = Color32::from_rgb(39, 43, 52);
|
||||
|
||||
@@ -101,6 +101,14 @@
|
||||
"mesh_fill": "#ffffff",
|
||||
"mesh_ink": "#ffffff",
|
||||
"mesh_soft": "#000000",
|
||||
"nav_dim": "#ffffff",
|
||||
"nav_field": "#000000",
|
||||
"nav_hover": "#000000",
|
||||
"nav_press": "#ffffff",
|
||||
"nav_tip": "#ffffff",
|
||||
"nav_tip_ink": "#000000",
|
||||
"nav_tip_key_border": "#000000",
|
||||
"nav_viewport": "#000000",
|
||||
"on_accent": "#000000",
|
||||
"origin_plane": "#000000",
|
||||
"origin_plane_edge": "#ffffff",
|
||||
|
||||
@@ -101,6 +101,14 @@
|
||||
"mesh_fill": "#000000",
|
||||
"mesh_ink": "#000000",
|
||||
"mesh_soft": "#ffffff",
|
||||
"nav_dim": "#000000",
|
||||
"nav_field": "#ffffff",
|
||||
"nav_hover": "#ffffff",
|
||||
"nav_press": "#000000",
|
||||
"nav_tip": "#000000",
|
||||
"nav_tip_ink": "#ffffff",
|
||||
"nav_tip_key_border": "#ffffff",
|
||||
"nav_viewport": "#ffffff",
|
||||
"on_accent": "#ffffff",
|
||||
"origin_plane": "#ffffff",
|
||||
"origin_plane_edge": "#000000",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#efece8",
|
||||
"dialog_label": "#403d38",
|
||||
"dialog_rule": "#d9d5d0",
|
||||
"dimension": "#403d38",
|
||||
"dimension_driven": "#6c6863",
|
||||
"dimension": "#006a70",
|
||||
"dimension_driven": "#4d8a8c",
|
||||
"error": "#c71529",
|
||||
"field": "#fffdfa",
|
||||
"file_rail": "#e1ddd8",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#100b04",
|
||||
"dialog_label": "#f3ca87",
|
||||
"dialog_rule": "#3b280d",
|
||||
"dimension": "#ffe2a5",
|
||||
"dimension_driven": "#9b6922",
|
||||
"dimension": "#f5e050",
|
||||
"dimension_driven": "#a8962e",
|
||||
"error": "#fff0ca",
|
||||
"field": "#100b04",
|
||||
"form_accent": "#ca892b",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#0c223c",
|
||||
"dialog_label": "#e3f0fa",
|
||||
"dialog_rule": "#254764",
|
||||
"dimension": "#e3f0fa",
|
||||
"dimension_driven": "#94b2cb",
|
||||
"dimension": "#ffd970",
|
||||
"dimension_driven": "#c9a95a",
|
||||
"error": "#ff968d",
|
||||
"field": "#071d35",
|
||||
"form_accent": "#baade8",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#1e1e2e",
|
||||
"dialog_label": "#cdd6f4",
|
||||
"dialog_rule": "#45475a",
|
||||
"dimension": "#cdd6f4",
|
||||
"dimension_driven": "#a6adc8",
|
||||
"dimension": "#94e2d5",
|
||||
"dimension_driven": "#6c9d95",
|
||||
"error": "#f38ba8",
|
||||
"field": "#181825",
|
||||
"form_accent": "#a9b2f2",
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
"dialog_footer": "#000000",
|
||||
"dialog_label": "#55ffff",
|
||||
"dialog_rule": "#00aaaa",
|
||||
"dimension": "#ffffff",
|
||||
"dimension_driven": "#aaaaaa",
|
||||
"dimension": "#ffff55",
|
||||
"dimension_driven": "#aa5500",
|
||||
"error": "#ff5555",
|
||||
"field": "#000000",
|
||||
"file_background": "#000000",
|
||||
@@ -101,6 +101,14 @@
|
||||
"mesh_fill": "#55ff55",
|
||||
"mesh_ink": "#55ff55",
|
||||
"mesh_soft": "#000000",
|
||||
"nav_dim": "#55ffff",
|
||||
"nav_field": "#000000",
|
||||
"nav_hover": "#aa00aa",
|
||||
"nav_press": "#ff55ff",
|
||||
"nav_tip": "#ffffff",
|
||||
"nav_tip_ink": "#000000",
|
||||
"nav_tip_key_border": "#55ffff",
|
||||
"nav_viewport": "#000000",
|
||||
"on_accent": "#000000",
|
||||
"origin_plane": "#55ffff20",
|
||||
"origin_plane_edge": "#55ffff80",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#29241f",
|
||||
"dialog_label": "#c3bdb5",
|
||||
"dialog_rule": "#403930",
|
||||
"dimension": "#c3bdb5",
|
||||
"dimension_driven": "#9d9285",
|
||||
"dimension": "#5fc4c0",
|
||||
"dimension_driven": "#4f9895",
|
||||
"error": "#f85052",
|
||||
"field": "#3c352d",
|
||||
"form_accent": "#a6a2fc",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#f4eee3",
|
||||
"dialog_label": "#423e36",
|
||||
"dialog_rule": "#e0d8c9",
|
||||
"dimension": "#423e36",
|
||||
"dimension_driven": "#726a5d",
|
||||
"dimension": "#006a70",
|
||||
"dimension_driven": "#4a8688",
|
||||
"error": "#c71529",
|
||||
"field": "#fdfaf3",
|
||||
"form_accent": "#5844bc",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#ececec",
|
||||
"dialog_label": "#262628",
|
||||
"dialog_rule": "#c6c6c8",
|
||||
"dimension": "#262628",
|
||||
"dimension_driven": "#6e6e73",
|
||||
"dimension": "#00646b",
|
||||
"dimension_driven": "#3d8087",
|
||||
"error": "#d53137",
|
||||
"field": "#ffffff",
|
||||
"form_accent": "#8b62bf",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#25272b",
|
||||
"dialog_label": "#e0e2e5",
|
||||
"dialog_rule": "#484d55",
|
||||
"dimension": "#e0e2e5",
|
||||
"dimension_driven": "#a0a6b0",
|
||||
"dimension": "#5fd0c8",
|
||||
"dimension_driven": "#4a9a95",
|
||||
"error": "#ed7777",
|
||||
"field": "#1c1e21",
|
||||
"form_accent": "#a08fc4",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#061009",
|
||||
"dialog_label": "#8def9f",
|
||||
"dialog_rule": "#173b22",
|
||||
"dimension": "#8def9f",
|
||||
"dimension_driven": "#5b9b6a",
|
||||
"dimension": "#c8ff4d",
|
||||
"dimension_driven": "#7fa040",
|
||||
"error": "#d8ffdf",
|
||||
"field": "#061009",
|
||||
"form_accent": "#1faa4e",
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
"sketch_fixed": "#ebdbb2",
|
||||
"sketch_halo": "#141617",
|
||||
"sketch_locked": "#b8bb26",
|
||||
"dimension": "#ebdbb2",
|
||||
"dimension_driven": "#928374",
|
||||
"dimension": "#fabd2f",
|
||||
"dimension_driven": "#b57614",
|
||||
"sketch_point": "#ebdbb2",
|
||||
"sketch_point_free": "#83a598",
|
||||
"dialog_bg": "#3c3836",
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
"sketch_fixed": "#ebdbb2",
|
||||
"sketch_halo": "#1d2021",
|
||||
"sketch_locked": "#b8bb26",
|
||||
"dimension": "#ebdbb2",
|
||||
"dimension_driven": "#928374",
|
||||
"dimension": "#fabd2f",
|
||||
"dimension_driven": "#b57614",
|
||||
"sketch_point": "#ebdbb2",
|
||||
"sketch_point_free": "#83a598",
|
||||
"dialog_bg": "#3c3836",
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
"sketch_fixed": "#ebdbb2",
|
||||
"sketch_halo": "#1d2021",
|
||||
"sketch_locked": "#b8bb26",
|
||||
"dimension": "#ebdbb2",
|
||||
"dimension_driven": "#928374",
|
||||
"dimension": "#fabd2f",
|
||||
"dimension_driven": "#b57614",
|
||||
"sketch_point": "#ebdbb2",
|
||||
"sketch_point_free": "#83a598",
|
||||
"dialog_bg": "#3c3836",
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
"sketch_fixed": "#282828",
|
||||
"sketch_halo": "#fbf8e3",
|
||||
"sketch_locked": "#79740e",
|
||||
"dimension": "#3c3836",
|
||||
"dimension_driven": "#7c6f64",
|
||||
"dimension": "#1f5c40",
|
||||
"dimension_driven": "#4f7d64",
|
||||
"sketch_point": "#282828",
|
||||
"sketch_point_free": "#076678",
|
||||
"dialog_bg": "#f9f5d7",
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
"sketch_fixed": "#282828",
|
||||
"sketch_halo": "#f6edd0",
|
||||
"sketch_locked": "#79740e",
|
||||
"dimension": "#3c3836",
|
||||
"dimension_driven": "#7c6f64",
|
||||
"dimension": "#1f5c40",
|
||||
"dimension_driven": "#4f7d64",
|
||||
"sketch_point": "#282828",
|
||||
"sketch_point_free": "#076678",
|
||||
"dialog_bg": "#f2e5bc",
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
"sketch_fixed": "#282828",
|
||||
"sketch_halo": "#fcf5d8",
|
||||
"sketch_locked": "#79740e",
|
||||
"dimension": "#3c3836",
|
||||
"dimension_driven": "#7c6f64",
|
||||
"dimension": "#1f5c40",
|
||||
"dimension_driven": "#4f7d64",
|
||||
"sketch_point": "#282828",
|
||||
"sketch_point_free": "#076678",
|
||||
"dialog_bg": "#fbf1c7",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#000000",
|
||||
"dialog_label": "#ffffff",
|
||||
"dialog_rule": "#a0a0a0",
|
||||
"dimension": "#ffffff",
|
||||
"dimension_driven": "#cccccc",
|
||||
"dimension": "#ffff66",
|
||||
"dimension_driven": "#c8c850",
|
||||
"error": "#ff6666",
|
||||
"field": "#000000",
|
||||
"form_accent": "#d98af9",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#2e3440",
|
||||
"dialog_label": "#eceff4",
|
||||
"dialog_rule": "#4c566a",
|
||||
"dimension": "#eceff4",
|
||||
"dimension_driven": "#a4b0c2",
|
||||
"dimension": "#d08770",
|
||||
"dimension_driven": "#a87060",
|
||||
"error": "#bf616a",
|
||||
"field": "#242933",
|
||||
"form_accent": "#cfa7c7",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#282a36",
|
||||
"dialog_label": "#f8f8f2",
|
||||
"dialog_rule": "#50546d",
|
||||
"dimension": "#f8f8f2",
|
||||
"dimension_driven": "#a1a4c4",
|
||||
"dimension": "#8be9fd",
|
||||
"dimension_driven": "#62a3b1",
|
||||
"error": "#ff5555",
|
||||
"field": "#21222c",
|
||||
"form_accent": "#c096e8",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#1b1e20",
|
||||
"dialog_label": "#bbbec1",
|
||||
"dialog_rule": "#2f3235",
|
||||
"dimension": "#bbbec1",
|
||||
"dimension_driven": "#8f9296",
|
||||
"dimension": "#5fc4c0",
|
||||
"dimension_driven": "#4f9895",
|
||||
"error": "#f85052",
|
||||
"field": "#2c2e31",
|
||||
"file_rail": "#0f1113",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#2f343e",
|
||||
"dialog_label": "#b4bbc8",
|
||||
"dialog_rule": "#353b47",
|
||||
"dimension": "#abb2bf",
|
||||
"dimension_driven": "#7f848e",
|
||||
"dimension": "#56b6c2",
|
||||
"dimension_driven": "#3f8590",
|
||||
"error": "#e06c75",
|
||||
"field": "#1e2227",
|
||||
"form_accent": "#d283e9",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#dddddd",
|
||||
"dialog_label": "#222222",
|
||||
"dialog_rule": "#aaaaaa",
|
||||
"dimension": "#222222",
|
||||
"dimension_driven": "#666666",
|
||||
"dimension": "#00787f",
|
||||
"dimension_driven": "#4d9196",
|
||||
"error": "#bb3333",
|
||||
"field": "#ffffff",
|
||||
"form_accent": "#704e81",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#eee8d5",
|
||||
"dialog_label": "#586e75",
|
||||
"dialog_rule": "#b6b3a1",
|
||||
"dimension": "#586e75",
|
||||
"dimension_driven": "#657b83",
|
||||
"dimension": "#136059",
|
||||
"dimension_driven": "#3d8f88",
|
||||
"error": "#dc322f",
|
||||
"field": "#fdf6e3",
|
||||
"form_accent": "#6b70c3",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#c0c0c0",
|
||||
"dialog_label": "#000000",
|
||||
"dialog_rule": "#808080",
|
||||
"dimension": "#000000",
|
||||
"dimension_driven": "#808080",
|
||||
"dimension": "#ffffff",
|
||||
"dimension_driven": "#ffff00",
|
||||
"error": "#ff0000",
|
||||
"field": "#ffffff",
|
||||
"form_accent": "#800080",
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"dialog_footer": "#1a1b26",
|
||||
"dialog_label": "#c0caf5",
|
||||
"dialog_rule": "#414868",
|
||||
"dimension": "#c0caf5",
|
||||
"dimension_driven": "#9aa5ce",
|
||||
"dimension": "#73daca",
|
||||
"dimension_driven": "#4f9a90",
|
||||
"error": "#f7768e",
|
||||
"field": "#16161e",
|
||||
"form_accent": "#b190ec",
|
||||
|
||||
@@ -1,15 +1,40 @@
|
||||
//! Lists the design-format changes in `src/format/`: one file per change, in `v<N>/` once a
|
||||
//! release fixed its number, else in `pending/` (see `src/format/pending/README.md`). The list is
|
||||
//! Lists the format changes of each family of files versioned by `src/format.rs`: designs in
|
||||
//! `src/format/`, drawings in `src/drawing/format/` (#3890). One file per change, in `v<N>/` once a
|
||||
//! release fixed its number, else in `pending/` (see `src/format/pending/README.md`). The lists are
|
||||
//! generated so that a change adds a file and never edits a line another change also edits.
|
||||
|
||||
use std::fmt::Write as _;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// The last format whose upgrade steps are written out in `format.rs` (`JSON_STEPS`).
|
||||
const HAND_WRITTEN: u32 = 22;
|
||||
/// A family's change files: their folder, the last format before them, and the prefix of the
|
||||
/// family's lists in `format.rs`.
|
||||
struct Family {
|
||||
folder: &'static str,
|
||||
base: u32,
|
||||
list_prefix: &'static str,
|
||||
}
|
||||
|
||||
/// Every family, each read by `scripts/fold-format-pending.sh` too. A design's upgrade steps are
|
||||
/// written out in `format.rs` up to 22 (`JSON_STEPS`); a drawing's first format is 1.
|
||||
const FAMILIES: [Family; 2] =
|
||||
[Family { folder: "src/format", base: 22, list_prefix: "" }, Family { folder: "src/drawing/format", base: 1, list_prefix: "DRAWING_" }];
|
||||
|
||||
fn main() {
|
||||
let root = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("src/format");
|
||||
let manifest = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
let mut out = String::new();
|
||||
let mut mods = String::new();
|
||||
for family in &FAMILIES {
|
||||
lists(family, &manifest, &mut out, &mut mods);
|
||||
}
|
||||
out.push_str(&mods);
|
||||
let dest = PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("format_parts.rs");
|
||||
std::fs::write(dest, out).unwrap();
|
||||
}
|
||||
|
||||
/// A family's `FOLDED` and `PENDING` lists; its folded formats follow on from its base.
|
||||
fn lists(family: &Family, manifest: &Path, out: &mut String, mods: &mut String) {
|
||||
let Family { folder, base, list_prefix } = family;
|
||||
let root = manifest.join(folder);
|
||||
println!("cargo:rerun-if-changed={}", root.display());
|
||||
let mut folded: Vec<(u32, PathBuf)> = std::fs::read_dir(&root)
|
||||
.unwrap_or_else(|e| panic!("{}: {e}", root.display()))
|
||||
@@ -21,23 +46,24 @@ fn main() {
|
||||
.collect();
|
||||
folded.sort();
|
||||
for (i, (version, _)) in folded.iter().enumerate() {
|
||||
let expected = HAND_WRITTEN + 1 + i as u32;
|
||||
assert_eq!(*version, expected, "src/format/: expected v{expected}/ next, found v{version}/ (versions are contiguous)");
|
||||
let expected = base + 1 + i as u32;
|
||||
assert_eq!(*version, expected, "{folder}/: expected v{expected}/ next, found v{version}/ (versions are contiguous)");
|
||||
}
|
||||
let mut out = String::new();
|
||||
let mut mods = String::new();
|
||||
out.push_str("/// The changes of each format after the hand-written ones, oldest first.\nconst FOLDED: &[(u32, &[Part])] = &[\n");
|
||||
// Module names start with the family's (`drawing_pending_…`), so two families' changes of one
|
||||
// name never clash.
|
||||
let module = list_prefix.to_ascii_lowercase();
|
||||
let _ = writeln!(
|
||||
out,
|
||||
"/// The changes of each format after the base, oldest first (`{folder}/v<N>/`).\nconst {list_prefix}FOLDED: &[(u32, &[Part])] = &["
|
||||
);
|
||||
for (version, dir) in &folded {
|
||||
let _ = writeln!(out, " ({version}, &[");
|
||||
parts(dir, &format!("v{version}"), &mut out, &mut mods);
|
||||
parts(dir, &format!("{module}v{version}"), out, mods);
|
||||
out.push_str(" ]),\n");
|
||||
}
|
||||
out.push_str("];\n\n/// The changes no release has a number for yet (`src/format/pending/`).\nconst PENDING: &[Part] = &[\n");
|
||||
parts(&root.join("pending"), "pending", &mut out, &mut mods);
|
||||
out.push_str("];\n");
|
||||
out.push_str(&mods);
|
||||
let dest = PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("format_parts.rs");
|
||||
std::fs::write(dest, out).unwrap();
|
||||
let _ = writeln!(out, "];\n\n/// The changes no release has a number for yet (`{folder}/pending/`).\nconst {list_prefix}PENDING: &[Part] = &[");
|
||||
parts(&root.join("pending"), &format!("{module}pending"), out, mods);
|
||||
out.push_str("];\n\n");
|
||||
}
|
||||
|
||||
/// The `Part`s of the change files in `dir`, in file-name order, and a module for each.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! a component's over the physical material's look; a body with none of these keeps the colour
|
||||
//! it was imported with.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use solidcraft_geom::Vec3;
|
||||
@@ -129,6 +129,95 @@ impl Appearances {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.bodies.is_empty() && self.faces.is_empty() && self.components.is_empty()
|
||||
}
|
||||
|
||||
/// Bound bulk appearance operations, including designs read from untrusted files.
|
||||
pub fn check_budget(&self) -> crate::Result<()> {
|
||||
if self.bodies.len().saturating_add(self.faces.len()).saturating_add(self.components.len()) > 100_000 {
|
||||
return Err(crate::DocError::Invalid("at most 100000 appearance overrides can be processed".into()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Build a replacement without changing the source. Equality includes the label and
|
||||
/// every optical value. Physical-material defaults are deliberately outside this scope.
|
||||
/// `None` means no change, allowing callers to preserve history and revision.
|
||||
pub fn replacing(&self, from: &Look, to: &Look, scope: Option<&AppearanceScope>) -> crate::Result<Option<(Self, usize)>> {
|
||||
self.check_budget()?;
|
||||
for look in [from, to] {
|
||||
if !look.opacity.is_finite() || !(0.0..=1.0).contains(&look.opacity) {
|
||||
return Err(crate::DocError::Invalid("opacity must be finite and in 0..1".into()));
|
||||
}
|
||||
look.opaque_surface()?;
|
||||
}
|
||||
if from == to {
|
||||
return Ok(None);
|
||||
}
|
||||
let body_in_scope = |body: &str| scope.is_none_or(|s| s.bodies.contains(body));
|
||||
let component_in_scope = |id: &u64| scope.is_none_or(|s| s.components.contains(id));
|
||||
let count = self.bodies.iter().filter(|(body, look)| body_in_scope(body) && *look == from).count()
|
||||
+ self.faces.iter().filter(|face| body_in_scope(&face.body) && &face.look == from).count()
|
||||
+ self.components.iter().filter(|(id, look)| component_in_scope(id) && *look == from).count();
|
||||
if count == 0 {
|
||||
return Ok(None);
|
||||
}
|
||||
let mut replaced = self.clone();
|
||||
for (body, look) in &mut replaced.bodies {
|
||||
if body_in_scope(body) && look == from {
|
||||
*look = to.clone();
|
||||
}
|
||||
}
|
||||
for face in &mut replaced.faces {
|
||||
if body_in_scope(&face.body) && &face.look == from {
|
||||
face.look = to.clone();
|
||||
}
|
||||
}
|
||||
for (id, look) in &mut replaced.components {
|
||||
if component_in_scope(id) && look == from {
|
||||
*look = to.clone();
|
||||
}
|
||||
}
|
||||
Ok(Some((replaced, count)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Exact override containers for replacement. A body includes its face overrides;
|
||||
/// a component selects its own override, independently of the bodies it owns.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct AppearanceScope {
|
||||
pub bodies: BTreeSet<String>,
|
||||
pub components: BTreeSet<u64>,
|
||||
}
|
||||
|
||||
/// A target in an evaluated model. Face indices are those of `model.faces`.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum AppearanceTarget<'a> {
|
||||
Body(&'a str),
|
||||
Face { body: &'a str, face: usize },
|
||||
Component(u64),
|
||||
}
|
||||
|
||||
/// The four override steps, in descending precedence. Imported paint is a display
|
||||
/// fallback, not an override or physical material, and is not a fifth step.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct AppearanceChain {
|
||||
pub face: Option<Look>,
|
||||
pub body: Option<Look>,
|
||||
pub component: Option<Look>,
|
||||
pub material: Option<Look>,
|
||||
}
|
||||
|
||||
impl AppearanceChain {
|
||||
pub fn steps(&self) -> [(&'static str, Option<&Look>); 4] {
|
||||
[("face", self.face.as_ref()), ("body", self.body.as_ref()), ("component", self.component.as_ref()), ("material", self.material.as_ref())]
|
||||
}
|
||||
|
||||
pub fn active(&self) -> Option<&'static str> {
|
||||
self.steps().into_iter().find_map(|(step, look)| look.map(|_| step))
|
||||
}
|
||||
|
||||
pub fn resolved(&self) -> Option<&Look> {
|
||||
self.steps().into_iter().find_map(|(_, look)| look)
|
||||
}
|
||||
}
|
||||
|
||||
/// The built-in appearance library: (name, colour, opacity).
|
||||
@@ -161,15 +250,96 @@ pub fn material_look(material: &str) -> Option<Look> {
|
||||
}
|
||||
|
||||
impl Document {
|
||||
/// Read the same precedence used by body and face display resolution. Components
|
||||
/// have no material assignment of their own: the material step is present only
|
||||
/// when their directly owned bodies all have the same material look. Empty or
|
||||
/// mixed components have no material step. Root is not an assignable component.
|
||||
pub fn appearance_chain(&self, state: &crate::ModelState, target: AppearanceTarget<'_>) -> crate::Result<AppearanceChain> {
|
||||
self.appearances.check_budget()?;
|
||||
match target {
|
||||
AppearanceTarget::Body(name) | AppearanceTarget::Face { body: name, .. } => {
|
||||
let body = state.body(name).ok_or_else(|| crate::DocError::Invalid(format!("no body `{name}`")))?;
|
||||
let mut chain = self.body_appearance_chain(body.definition_name(), self.model_body_component(body));
|
||||
if let AppearanceTarget::Face { face, .. } = target {
|
||||
if face >= body.body.face_count() {
|
||||
return Err(crate::DocError::Invalid("unknown face index".into()));
|
||||
}
|
||||
let mut overrides = Vec::new();
|
||||
self.apply_face_overrides(body, &mut overrides);
|
||||
chain.face = overrides.into_iter().find_map(|(index, look)| (index == face).then_some(look));
|
||||
}
|
||||
Ok(chain)
|
||||
}
|
||||
AppearanceTarget::Component(id) => {
|
||||
if id == 0 || !self.components.iter().any(|c| c.id == id) {
|
||||
return Err(crate::DocError::Invalid("unknown or root component".into()));
|
||||
}
|
||||
if state.bodies.len() > 100_000 {
|
||||
return Err(crate::DocError::Invalid("too many bodies to read a component appearance chain".into()));
|
||||
}
|
||||
// Legacy ownership can refer to a feature. Index it once, rather
|
||||
// than scanning the timeline for each body of a large component.
|
||||
let features: BTreeMap<_, _> = self.features.iter().rev().map(|f| (f.id, f.component)).collect();
|
||||
let owner = |b: &&crate::ModelBody| {
|
||||
if b.transferred || b.source_name.is_some() {
|
||||
b.component
|
||||
} else {
|
||||
self.body_components.get(&b.name).copied().or_else(|| features.get(&b.feature).copied()).unwrap_or(0)
|
||||
}
|
||||
};
|
||||
let mut materials = state
|
||||
.bodies
|
||||
.iter()
|
||||
.filter(|b| owner(b) == id)
|
||||
.map(|b| self.materials.get(b.definition_name()).and_then(|m| self.material_look(m)));
|
||||
let material = materials.next().flatten().filter(|first| materials.all(|look| look.as_ref() == Some(first)));
|
||||
Ok(AppearanceChain { face: None, body: None, component: self.appearances.components.get(&id).cloned(), material })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn body_appearance_chain(&self, name: &str, component: u64) -> AppearanceChain {
|
||||
AppearanceChain {
|
||||
face: None,
|
||||
body: self.appearances.bodies.get(name).cloned(),
|
||||
component: (component != 0).then(|| self.appearances.components.get(&component).cloned()).flatten(),
|
||||
material: self.materials.get(name).and_then(|material| self.material_look(material)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Resolve a picked face through the same appearance chain used by the viewport.
|
||||
pub fn model_face_look(&self, body: &crate::ModelBody, face: usize) -> Option<Look> {
|
||||
self.face_colors(body).into_iter().find(|(index, _)| *index == face).map(|(_, look)| look).or_else(|| self.model_display_look(body))
|
||||
}
|
||||
|
||||
/// Body appearance including the imported fallback used by `body_color`.
|
||||
pub fn model_display_look(&self, body: &crate::ModelBody) -> Option<Look> {
|
||||
self.model_body_look(body).or_else(|| {
|
||||
let color = body.body.color().or_else(|| body.imported.as_ref().and_then(|p| p.color))?;
|
||||
Some(Look::custom(color.map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8), self.model_body_opacity(body)))
|
||||
})
|
||||
}
|
||||
|
||||
/// Distinct appearances used by an object, including its face overrides. `None` is
|
||||
/// the unassigned/imported body appearance. Repeated faces count as one object user.
|
||||
pub fn model_used_looks(&self, body: &crate::ModelBody) -> Vec<Option<Look>> {
|
||||
let faces = self.face_colors(body);
|
||||
let mut looks = Vec::new();
|
||||
if faces.len() < body.body.face_count() || faces.is_empty() {
|
||||
looks.push(self.model_display_look(body));
|
||||
}
|
||||
for (_, look) in faces {
|
||||
let look = Some(look);
|
||||
if !looks.contains(&look) {
|
||||
looks.push(look);
|
||||
}
|
||||
}
|
||||
looks
|
||||
}
|
||||
|
||||
/// Shared definition appearance for a computed occurrence body.
|
||||
pub fn model_body_look(&self, body: &crate::ModelBody) -> Option<Look> {
|
||||
let name = body.definition_name();
|
||||
self.appearances
|
||||
.bodies
|
||||
.get(name)
|
||||
.cloned()
|
||||
.or_else(|| self.appearances.components.get(&self.model_body_component(body)).cloned())
|
||||
.or_else(|| self.materials.get(name).and_then(|material| self.material_look(material)))
|
||||
self.body_appearance_chain(body.definition_name(), self.model_body_component(body)).resolved().cloned()
|
||||
}
|
||||
/// Effective body opacity, including paint carried from an imported body.
|
||||
pub fn model_body_opacity(&self, body: &crate::ModelBody) -> f64 {
|
||||
@@ -182,15 +352,7 @@ impl Document {
|
||||
/// A body's look (without face appearances): its own, else its component's, else its
|
||||
/// material's.
|
||||
pub fn body_look(&self, name: &str, feature: u64) -> Option<Look> {
|
||||
self.appearances
|
||||
.bodies
|
||||
.get(name)
|
||||
.cloned()
|
||||
.or_else(|| {
|
||||
let c = self.body_component(name, feature);
|
||||
(c != 0).then(|| self.appearances.components.get(&c).cloned()).flatten()
|
||||
})
|
||||
.or_else(|| self.materials.get(name).and_then(|m| self.material_look(m)))
|
||||
self.body_appearance_chain(name, self.body_component(name, feature)).resolved().cloned()
|
||||
}
|
||||
|
||||
/// Face appearances on a body: (point on the face, look).
|
||||
@@ -201,9 +363,19 @@ impl Document {
|
||||
/// The faces of a body with appearances of their own: (B-rep face index, look). A later
|
||||
/// assignment to the same face wins.
|
||||
pub fn face_colors(&self, b: &crate::ModelBody) -> Vec<(usize, Look)> {
|
||||
let mut out = self.imported_face_colors(b);
|
||||
for (index, look) in self.authored_face_colors(b) {
|
||||
out.retain(|(old, _)| *old != index);
|
||||
out.push((index, look));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Imported paint alone, after applying body-appearance precedence.
|
||||
pub(crate) fn imported_face_colors(&self, b: &crate::ModelBody) -> Vec<(usize, Look)> {
|
||||
// An assigned body appearance replaces imported paint; design face appearances still win.
|
||||
let to8 = |x: f32| (x.clamp(0.0, 1.0) * 255.0).round() as u8;
|
||||
let mut out: Vec<(usize, Look)> = if self.appearances.bodies.contains_key(b.definition_name()) {
|
||||
if self.appearances.bodies.contains_key(b.definition_name()) {
|
||||
Vec::new()
|
||||
} else {
|
||||
match b.body.paint() {
|
||||
@@ -219,7 +391,18 @@ impl Document {
|
||||
None => Vec::new(),
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Design-authored face overrides, without imported STEP paint. Linked designs carry
|
||||
/// these independently so an inherited body look does not hide their face overrides.
|
||||
pub fn authored_face_colors(&self, b: &crate::ModelBody) -> Vec<(usize, Look)> {
|
||||
let mut out = Vec::new();
|
||||
self.apply_face_overrides(b, &mut out);
|
||||
out
|
||||
}
|
||||
|
||||
fn apply_face_overrides(&self, b: &crate::ModelBody, out: &mut Vec<(usize, Look)>) {
|
||||
for f in self.appearances.faces.iter().filter(|f| f.body == b.definition_name()) {
|
||||
let (p, look) = (crate::apply_point(&b.source_transform, f.point), f.look.clone());
|
||||
if f.strict_name {
|
||||
@@ -259,7 +442,6 @@ impl Document {
|
||||
out.push((i, look));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,6 +567,28 @@ mod tests {
|
||||
assert!(restored.iter().all(|(face, look)| *look == if *face == 0 { face_look.clone() } else { Look::custom([255, 0, 0], 0.5) }));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linked_paint_retains_imported_faces_without_baking_authored_overrides() {
|
||||
let mut state = crate::ModelState::default();
|
||||
state.bodies.push(imported_box());
|
||||
let body = &state.bodies[0];
|
||||
let mut doc = Document::default();
|
||||
doc.appearances.faces.push(FaceLook {
|
||||
body: body.name.clone(),
|
||||
point: Vec3::ZERO,
|
||||
look: Look::custom([0, 255, 0], 1.0),
|
||||
name: Some(crate::naming::face_names(body)[0].clone()),
|
||||
strict_name: false,
|
||||
certificate: None,
|
||||
});
|
||||
let exported = doc.painted(&state);
|
||||
assert!(exported.bodies[0].body.paint().unwrap().faces.iter().any(|face| face.color == [0., 1., 0.]));
|
||||
let linked = doc.painted_for_link(&state);
|
||||
let faces = &linked.bodies[0].body.paint().unwrap().faces;
|
||||
assert_eq!(faces.len(), body.body.faces(0.01).unwrap().len());
|
||||
assert!(faces.iter().all(|face| face.color == [1., 0., 0.] && face.opacity == 0.5));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn body_appearance_overrides_imported_face_paint() {
|
||||
check_imported_appearance_precedence(&imported_box());
|
||||
@@ -400,6 +604,130 @@ mod tests {
|
||||
check_imported_appearance_precedence(&body);
|
||||
}
|
||||
|
||||
fn chain_fixture() -> (Document, crate::ModelState) {
|
||||
let mut doc = Document::new("Appearance chain");
|
||||
doc.components.push(crate::Component { id: 1, name: "Part".into(), ..Default::default() });
|
||||
doc.body_components.insert("B".into(), 1);
|
||||
let mut state = crate::ModelState::default();
|
||||
state.bodies.push(crate::ModelBody::new("B".into(), solidcraft_kernel::box_solid(Vec3::ZERO, Vec3::new(10., 10., 10.)).unwrap(), 1));
|
||||
(doc, state)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn appearance_chain_agrees_with_display_and_definition_identity() {
|
||||
let (mut doc, mut state) = chain_fixture();
|
||||
let body_look = library("ABS - Red").unwrap();
|
||||
let face_look = library("Steel - Satin PBR").unwrap();
|
||||
doc.appearances.bodies.insert("B".into(), body_look.clone());
|
||||
doc.appearances.components.insert(1, library("ABS - Blue").unwrap());
|
||||
doc.materials.insert("B".into(), "Brass".into());
|
||||
let body = &state.bodies[0];
|
||||
let spot = crate::naming::face_spots(body)[0].unwrap().point;
|
||||
let face_name = crate::naming::face_names(body)[0].clone();
|
||||
doc.appearances.faces.push(FaceLook {
|
||||
body: "B".into(),
|
||||
point: spot,
|
||||
look: face_look.clone(),
|
||||
name: Some(face_name),
|
||||
strict_name: false,
|
||||
certificate: None,
|
||||
});
|
||||
let chain = doc.appearance_chain(&state, AppearanceTarget::Face { body: "B", face: 0 }).unwrap();
|
||||
assert_eq!(chain.active(), Some("face"));
|
||||
assert_eq!(chain.resolved(), Some(&face_look));
|
||||
assert_eq!(doc.model_face_look(body, 0).as_ref(), chain.resolved());
|
||||
let chain = doc.appearance_chain(&state, AppearanceTarget::Body("B")).unwrap();
|
||||
assert_eq!(chain.active(), Some("body"));
|
||||
assert_eq!(doc.model_body_look(body).as_ref(), chain.resolved());
|
||||
assert_eq!(doc.body_look("B", 1).as_ref(), chain.resolved());
|
||||
assert_eq!(chain.component.as_ref().unwrap().name, "ABS - Blue");
|
||||
assert_eq!(chain.material.as_ref().unwrap().name, "Brass");
|
||||
// A computed placement resolves the definition's assignments, not its label.
|
||||
state.bodies[0].name = "Occurrence/B".into();
|
||||
state.bodies[0].source_name = Some("B".into());
|
||||
state.bodies[0].component = 1;
|
||||
let chain = doc.appearance_chain(&state, AppearanceTarget::Body("Occurrence/B")).unwrap();
|
||||
assert_eq!(chain.body, Some(body_look));
|
||||
assert_eq!(chain.material.as_ref().unwrap().name, "Brass");
|
||||
assert!(doc.appearance_chain(&state, AppearanceTarget::Face { body: "Occurrence/B", face: usize::MAX }).is_err());
|
||||
assert!(doc.appearance_chain(&state, AppearanceTarget::Body("missing")).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn appearance_chain_component_material_is_common_or_absent_and_imports_stay_fallbacks() {
|
||||
let (mut doc, mut state) = chain_fixture();
|
||||
state.bodies[0].imported = Some(std::sync::Arc::new(ImportedLook { color: Some([0.2, 0.4, 0.6]), ..Default::default() }));
|
||||
let body = doc.appearance_chain(&state, AppearanceTarget::Body("B")).unwrap();
|
||||
assert_eq!(body.active(), None);
|
||||
assert!(doc.model_display_look(&state.bodies[0]).is_some());
|
||||
doc.materials.insert("B".into(), "Brass".into());
|
||||
assert_eq!(doc.appearance_chain(&state, AppearanceTarget::Component(1)).unwrap().active(), Some("material"));
|
||||
let mut second = state.bodies[0].clone();
|
||||
second.name = "C".into();
|
||||
doc.body_components.insert("C".into(), 1);
|
||||
state.bodies.push(second);
|
||||
assert_eq!(doc.appearance_chain(&state, AppearanceTarget::Component(1)).unwrap().active(), None);
|
||||
doc.materials.insert("C".into(), "Brass".into());
|
||||
assert_eq!(doc.appearance_chain(&state, AppearanceTarget::Component(1)).unwrap().active(), Some("material"));
|
||||
doc.materials.insert("C".into(), "Steel".into());
|
||||
assert_eq!(doc.appearance_chain(&state, AppearanceTarget::Component(1)).unwrap().material, None);
|
||||
doc.appearances.components.insert(1, library("ABS - Blue").unwrap());
|
||||
assert_eq!(doc.appearance_chain(&state, AppearanceTarget::Component(1)).unwrap().active(), Some("component"));
|
||||
state.bodies.clear();
|
||||
assert_eq!(doc.appearance_chain(&state, AppearanceTarget::Component(1)).unwrap().material, None);
|
||||
assert!(doc.appearance_chain(&state, AppearanceTarget::Component(0)).is_err());
|
||||
assert!(doc.appearance_chain(&state, AppearanceTarget::Component(99)).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn appearance_replacement_validates_values_and_design_budget_without_mutation() {
|
||||
let from = library("ABS - Red").unwrap();
|
||||
let to = library("ABS - Blue").unwrap();
|
||||
let mut appearances = Appearances::default();
|
||||
appearances.bodies.insert("B".into(), from.clone());
|
||||
for opacity in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY, -1., 2.] {
|
||||
let mut invalid = to.clone();
|
||||
invalid.opacity = opacity;
|
||||
assert!(appearances.replacing(&from, &invalid, None).is_err());
|
||||
assert!(appearances.replacing(&invalid, &to, None).is_err());
|
||||
assert_eq!(appearances.bodies["B"], from);
|
||||
}
|
||||
let mut invalid = library("Steel - Satin PBR").unwrap();
|
||||
invalid.opacity = 0.5;
|
||||
assert!(appearances.replacing(&from, &invalid, None).is_err());
|
||||
let (changed, count) = appearances.replacing(&from, &to, None).unwrap().unwrap();
|
||||
assert_eq!(count, 1);
|
||||
assert_eq!(changed.bodies["B"], to);
|
||||
assert_eq!(appearances.bodies["B"], from);
|
||||
assert!(appearances.replacing(&from, &from, None).unwrap().is_none());
|
||||
for i in 0..100_000 {
|
||||
appearances.components.insert(i, from.clone());
|
||||
}
|
||||
assert!(appearances.replacing(&from, &to, None).is_err());
|
||||
let (mut doc, state) = chain_fixture();
|
||||
doc.appearances = appearances;
|
||||
assert!(doc.appearance_chain(&state, AppearanceTarget::Body("B")).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn appearance_chain_of_ten_thousand_body_component_has_four_steps() {
|
||||
let (mut doc, mut state) = chain_fixture();
|
||||
let mut body = state.bodies[0].clone();
|
||||
body.source_name = Some("B".into());
|
||||
body.component = 1;
|
||||
state.bodies = (0..10_000)
|
||||
.map(|i| {
|
||||
let mut b = body.clone();
|
||||
b.name = format!("Placed {i}");
|
||||
b
|
||||
})
|
||||
.collect();
|
||||
doc.materials.insert("B".into(), "Brass".into());
|
||||
let chain = doc.appearance_chain(&state, AppearanceTarget::Component(1)).unwrap();
|
||||
assert_eq!(chain.steps().len(), 4);
|
||||
assert_eq!(chain.active(), Some("material"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn library_and_materials() {
|
||||
assert_eq!(library("abs - red").map(|l| l.color), Some([196, 40, 40]));
|
||||
@@ -487,6 +815,8 @@ mod tests {
|
||||
bad.boundary = GlassBoundary::Thin { thickness_mm: 10001.0 };
|
||||
assert!(bad.validate().is_err());
|
||||
}
|
||||
// The swatch shows the transmission as sRGB codes.
|
||||
assert_eq!(find("starter.glass.smoky-neutral").unwrap().preview_color(), [160, 166, 173]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -154,10 +154,7 @@ impl VisualPreset {
|
||||
match self.recipe {
|
||||
Recipe::Opaque(r) => r.color,
|
||||
// A UI swatch of the transmission values, not rendered glass or absorption.
|
||||
Recipe::Glass(r) => r.transmission_linear_rgb.map(|v| {
|
||||
let encoded = if v <= 0.0031308 { 12.92 * v } else { 1.055 * v.powf(1.0 / 2.4) - 0.055 };
|
||||
(encoded.clamp(0.0, 1.0) * 255.0).round() as u8
|
||||
}),
|
||||
Recipe::Glass(r) => r.transmission_linear_rgb.map(solidcraft_geom::srgb::encode8),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,48 @@ fn identity() -> Mat {
|
||||
IDENTITY
|
||||
}
|
||||
|
||||
/// How a component counts in the bill of materials of an assembly it is placed in. It is a part
|
||||
/// property (the `bom_type` key of the component's [`Metadata`](crate::Metadata)); a component
|
||||
/// without one is [`BomType::Normal`].
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum BomType {
|
||||
/// A row of its own; every occurrence adds to its quantity.
|
||||
#[default]
|
||||
Normal,
|
||||
/// No row of its own: what it holds counts as if placed directly in its parent.
|
||||
Phantom,
|
||||
/// Shown, but counted nowhere, and nothing inside it is counted either.
|
||||
Reference,
|
||||
/// Bought: one row, with nothing inside it counted or listed.
|
||||
Purchased,
|
||||
/// Made as one item that doesn't come apart (a welded frame): one row in the assembly it is
|
||||
/// placed in. What it holds is listed in its own bill of materials, and its purchased parts
|
||||
/// also in the parts-only list of the assembly it is placed in.
|
||||
Inseparable,
|
||||
}
|
||||
|
||||
impl BomType {
|
||||
/// Every type, in the order commands and documentation list them.
|
||||
pub const ALL: [BomType; 5] = [BomType::Normal, BomType::Phantom, BomType::Reference, BomType::Purchased, BomType::Inseparable];
|
||||
|
||||
/// The word the design file and commands use.
|
||||
pub fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
BomType::Normal => "normal",
|
||||
BomType::Phantom => "phantom",
|
||||
BomType::Reference => "reference",
|
||||
BomType::Purchased => "purchased",
|
||||
BomType::Inseparable => "inseparable",
|
||||
}
|
||||
}
|
||||
|
||||
/// The type a word names, if it names one.
|
||||
pub fn parse(word: &str) -> Option<BomType> {
|
||||
BomType::ALL.into_iter().find(|t| t.as_str() == word)
|
||||
}
|
||||
}
|
||||
|
||||
/// How deep and how many placements [`Document::placements`] walks.
|
||||
pub const MAX_PLACEMENT_DEPTH: usize = 64;
|
||||
pub const MAX_PLACEMENTS: usize = 100_000;
|
||||
|
||||
@@ -2617,13 +2617,42 @@ pub struct StandardPart {
|
||||
/// A component whose contents come from another design file (Insert Design): where that file
|
||||
/// is, and the Import feature in the component that holds its bodies (Update Links replaces
|
||||
/// them; Break Link keeps them and forgets the file).
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct DesignLink {
|
||||
/// The design file: relative to this design's folder once this design is saved, else as
|
||||
/// given (`/` separates folders).
|
||||
pub path: String,
|
||||
/// The Import feature holding the linked design's bodies.
|
||||
pub feature: u64,
|
||||
/// Last inherited values, by Import body slot. Differing assembly assignments are
|
||||
/// local overrides and survive a source update. Older links start with no baseline.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub inherited: Vec<LinkedBodyProperties>,
|
||||
}
|
||||
|
||||
/// The values last inherited by a linked body, not another editable material library.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct LinkedBodyProperties {
|
||||
pub material: String,
|
||||
/// SHA-256 of the inherited custom definition, for equality only. The complete
|
||||
/// engineering card stays in user_materials, not duplicated once per linked body.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub material_fingerprint: Option<String>,
|
||||
/// Explicit body/component look only: material fallback must remain a fallback.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub appearance: Option<crate::appearance::Look>,
|
||||
/// Last inherited authored face overrides. None marks links saved before face
|
||||
/// inheritance; Some(empty) records that the source has no authored face overrides.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub faces: Option<Vec<crate::appearance::FaceLook>>,
|
||||
}
|
||||
|
||||
impl LinkedBodyProperties {
|
||||
pub fn fingerprint(material: &UserMaterial) -> Result<String> {
|
||||
use sha2::{Digest, Sha256};
|
||||
let bytes = serde_json::to_vec(material).map_err(|e| DocError::Invalid(e.to_string()))?;
|
||||
Ok(format!("{:x}", Sha256::digest(bytes)))
|
||||
}
|
||||
}
|
||||
|
||||
/// A name the design's counter hands out (`Body1`).
|
||||
@@ -2698,6 +2727,9 @@ pub struct Document {
|
||||
/// Reference images on planes (Insert Canvas).
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub canvases: Vec<crate::canvas::Canvas>,
|
||||
/// Scanned points kept as a reference (Insert Point Cloud).
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub point_clouds: Vec<crate::point_cloud::PointCloud>,
|
||||
/// Comments of feature-input parameters (by name).
|
||||
#[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
|
||||
pub param_comments: std::collections::BTreeMap<String, String>,
|
||||
@@ -2903,6 +2935,7 @@ impl Document {
|
||||
.map(|g| g.id)
|
||||
.chain(self.timeline_groups.iter().map(|g| g.id))
|
||||
.chain(self.canvases.iter().map(|c| c.id))
|
||||
.chain(self.point_clouds.iter().map(|c| c.id))
|
||||
.chain(a.joints.iter().map(|j| j.id))
|
||||
.chain(a.contact_sets.iter().map(|c| c.id))
|
||||
.chain(a.studies.iter().map(|s| s.id))
|
||||
@@ -2950,6 +2983,7 @@ impl Document {
|
||||
appearances: Default::default(),
|
||||
favorites: Default::default(),
|
||||
canvases: Vec::new(),
|
||||
point_clouds: Vec::new(),
|
||||
param_comments: Default::default(),
|
||||
browser_groups: Vec::new(),
|
||||
timeline_groups: Vec::new(),
|
||||
@@ -3131,14 +3165,22 @@ impl Document {
|
||||
/// The model with each body carrying the colour, opacity and face colours it is shown with
|
||||
/// (for export).
|
||||
pub fn painted(&self, state: &crate::ModelState) -> crate::ModelState {
|
||||
self.painted_with_faces(state, true)
|
||||
}
|
||||
|
||||
/// Linked designs carry authored face overrides as editable properties. Their STEP
|
||||
/// geometry keeps imported paint, without baking a second copy of those overrides.
|
||||
pub fn painted_for_link(&self, state: &crate::ModelState) -> crate::ModelState {
|
||||
self.painted_with_faces(state, false)
|
||||
}
|
||||
|
||||
fn painted_with_faces(&self, state: &crate::ModelState, authored_faces: bool) -> crate::ModelState {
|
||||
let mut st = state.clone();
|
||||
for b in &mut st.bodies {
|
||||
let c = self.body_color(b);
|
||||
let faces: Vec<solidcraft_kernel::FacePaint> = self
|
||||
.face_colors(b)
|
||||
.into_iter()
|
||||
.map(|(face, l)| solidcraft_kernel::FacePaint { face, color: l.rgb(), opacity: l.opacity as f32 })
|
||||
.collect();
|
||||
let face_colors = if authored_faces { self.face_colors(b) } else { self.imported_face_colors(b) };
|
||||
let faces: Vec<solidcraft_kernel::FacePaint> =
|
||||
face_colors.into_iter().map(|(face, l)| solidcraft_kernel::FacePaint { face, color: l.rgb(), opacity: l.opacity as f32 }).collect();
|
||||
let opacity = self.model_body_opacity(b) as f32;
|
||||
let paint = solidcraft_kernel::Paint { opacity, faces };
|
||||
if c != b.body.color() || b.body.paint() != Some(&paint) {
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
//! A drawing (#3890): sheets of paper that draw designs saved in their own files. A drawing is a
|
||||
//! file of its own, `"format": "solidcraft-drawing/N"`, versioned by the same code as designs
|
||||
//! ([`DRAWING`]); format 1 is this record.
|
||||
//!
|
||||
//! - **Sources** are the designs it draws: an id and the design file's path, relative to the
|
||||
//! drawing's folder once the drawing is saved, else as given, with `/` between folders (a linked
|
||||
//! design's [`DesignLink`](crate::DesignLink) rule). What a design was when the drawing last saw
|
||||
//! it is not saved here.
|
||||
//! - **Sheets**: the paper, a copy of its drawing border, the resolution its pictures are rendered
|
||||
//! at, the component it documents, and whether it is left out of the sheet count or of printing.
|
||||
//! The border is a copy of the profile it was made with, never a name, so a later built-in never
|
||||
//! changes a saved drawing.
|
||||
//! - **Units** follow each view's design or are one length unit for the whole drawing. The
|
||||
//! **language** is the content's, a BCP 47 tag chosen when the drawing is made, whatever the
|
||||
//! interface's is. **Properties** follow [`Metadata`]'s rules.
|
||||
//!
|
||||
//! The rules, which every later kind of record (views, annotations, tables) keeps too:
|
||||
//! - Every object has an id of [`crate::ids`]: random, so objects added side by side never take
|
||||
//! the same one, and written as 13 characters of base32. No two objects share an id, and a run
|
||||
//! never gives a removed object's id again ([`Drawing::allocate_id`]).
|
||||
//! - Every reference between records is an id and must resolve: a file with one that doesn't is
|
||||
//! damaged and refused, never patched.
|
||||
//! - 1 to [`MAX_SHEETS`] sheets and at most [`MAX_SOURCES`] sources; names of 1 to
|
||||
//! [`MAX_NAME_BYTES`] bytes; paths of 1 to [`MAX_PATH_BYTES`] bytes, without NUL.
|
||||
//! - Nothing derived is saved, and a drawing always saves as the same bytes: fields in their
|
||||
//! order, maps sorted.
|
||||
//! - A later change to the record is one file in `src/drawing/format/pending/` (its README).
|
||||
//!
|
||||
//! [`Drawing::from_json`] reads a file in this order: at most [`MAX_DRAWING_BYTES`] of text, the
|
||||
//! family's format check, every number in range, the upgrade, the typed record, then
|
||||
//! [`Drawing::validate`].
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use solidcraft_geom::drawing_sheet::{self, DrawingBorderProfile};
|
||||
|
||||
use crate::format::DRAWING;
|
||||
use crate::ids::{self, IdSource};
|
||||
use crate::{DocError, Metadata, Result, expr};
|
||||
|
||||
/// The most sheets a drawing may have.
|
||||
pub const MAX_SHEETS: usize = 1000;
|
||||
/// The most designs a drawing may draw.
|
||||
pub const MAX_SOURCES: usize = 64;
|
||||
/// The longest name of a drawing or a sheet, in bytes.
|
||||
pub const MAX_NAME_BYTES: usize = 256;
|
||||
/// The longest path to a design, in bytes.
|
||||
pub const MAX_PATH_BYTES: usize = 4096;
|
||||
/// The longest language tag: what RFC 5646 asks every reader to take (§4.4.1).
|
||||
pub const MAX_LANGUAGE_CHARS: usize = 35;
|
||||
/// The largest drawing read, as JSON text.
|
||||
pub const MAX_DRAWING_BYTES: usize = 16 << 20;
|
||||
/// The resolution a sheet's pictures (its shaded views) are rendered at unless it says, in dots
|
||||
/// per inch.
|
||||
pub const DEFAULT_DPI: f64 = 300.0;
|
||||
/// The lowest resolution a sheet may ask for.
|
||||
pub const MIN_DPI: f64 = 25.0;
|
||||
/// The highest resolution a sheet may ask for.
|
||||
pub const MAX_DPI: f64 = 2400.0;
|
||||
|
||||
/// A drawing: its sheets and the designs they draw.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Drawing {
|
||||
/// `solidcraft-drawing/N`: the format this build writes, whatever the file said.
|
||||
pub format: String,
|
||||
/// The changes of `format` this drawing has while they are pending
|
||||
/// ([`Family::pending_names`](crate::format::Family::pending_names)). Empty, and not saved,
|
||||
/// otherwise.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub format_pending: Vec<String>,
|
||||
pub name: String,
|
||||
/// The designs the drawing draws.
|
||||
pub sources: Vec<Source>,
|
||||
/// The drawing's properties and other tools' data, kept as they are.
|
||||
#[serde(default, skip_serializing_if = "Metadata::is_empty")]
|
||||
pub properties: Metadata,
|
||||
#[serde(default)]
|
||||
pub units: Units,
|
||||
/// The language of the drawing's content, a BCP 47 tag (`en-GB`).
|
||||
pub language: String,
|
||||
/// In order, each behind its own `Arc`, so an undo step shares every sheet it didn't change.
|
||||
pub sheets: Vec<Arc<Sheet>>,
|
||||
}
|
||||
|
||||
/// A design the drawing draws.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Source {
|
||||
#[serde(with = "crate::ids")]
|
||||
pub id: u64,
|
||||
/// The design file: relative to the drawing's folder once the drawing is saved, else as given
|
||||
/// (`/` separates folders).
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
/// The length unit a drawing gives its measurements in.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case", deny_unknown_fields)]
|
||||
pub enum Units {
|
||||
/// Each view's design's own units.
|
||||
#[default]
|
||||
FollowModel,
|
||||
/// One length unit for the whole drawing, by its name in [`expr::UNITS`] (`mm`, `in`).
|
||||
Fixed { unit: String },
|
||||
}
|
||||
|
||||
/// One sheet of a drawing.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Sheet {
|
||||
#[serde(with = "crate::ids")]
|
||||
pub id: u64,
|
||||
pub name: String,
|
||||
/// The paper: its size and the way it lies.
|
||||
pub sheet: drawing_sheet::Sheet,
|
||||
/// A copy of the drawing border's profile (`None`: no drawing border).
|
||||
pub border: Option<DrawingBorderProfile>,
|
||||
/// The resolution its pictures (its shaded views) are rendered at, in dots per inch.
|
||||
#[serde(default = "default_dpi")]
|
||||
pub dpi: f64,
|
||||
/// The component the sheet documents, which its title block reads.
|
||||
pub documents: Option<SheetComponent>,
|
||||
#[serde(default)]
|
||||
pub excluded: Excluded,
|
||||
}
|
||||
|
||||
/// A component of one of the drawing's designs.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct SheetComponent {
|
||||
/// The [`Source`]'s id.
|
||||
#[serde(with = "crate::ids")]
|
||||
pub source: u64,
|
||||
/// The component's id in that design, as the design writes it (0: the design itself).
|
||||
pub component: u64,
|
||||
}
|
||||
|
||||
/// What a sheet is left out of.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(default, deny_unknown_fields)]
|
||||
pub struct Excluded {
|
||||
/// The sheet count ("sheet 2 of 3" on the other sheets).
|
||||
pub count: bool,
|
||||
/// Printing and exporting every sheet.
|
||||
pub print: bool,
|
||||
}
|
||||
|
||||
fn default_dpi() -> f64 {
|
||||
DEFAULT_DPI
|
||||
}
|
||||
|
||||
impl Drawing {
|
||||
/// A drawing of no designs yet, named `name` and written in `language`, with one sheet named
|
||||
/// `sheet`: the paper `paper` with a copy of `border`, its id from `id_source`.
|
||||
pub fn new(
|
||||
name: &str,
|
||||
language: &str,
|
||||
sheet: &str,
|
||||
paper: drawing_sheet::Sheet,
|
||||
border: Option<DrawingBorderProfile>,
|
||||
id_source: &mut IdSource,
|
||||
) -> Result<Drawing> {
|
||||
let id = id_source.next(&BTreeSet::new())?;
|
||||
let first = Sheet { id, name: sheet.into(), sheet: paper, border, dpi: DEFAULT_DPI, documents: None, excluded: Excluded::default() };
|
||||
let drawing = Drawing {
|
||||
format: DRAWING.format_string(DRAWING.current()),
|
||||
format_pending: DRAWING.pending_names(),
|
||||
name: name.into(),
|
||||
sources: Vec::new(),
|
||||
properties: Metadata::default(),
|
||||
units: Units::default(),
|
||||
language: language.into(),
|
||||
sheets: vec![Arc::new(first)],
|
||||
};
|
||||
drawing.validate()?;
|
||||
Ok(drawing)
|
||||
}
|
||||
|
||||
/// Read a drawing file's JSON (any format this build knows; older ones are upgraded). A file
|
||||
/// that breaks a rule of the record is damaged and refused, never patched.
|
||||
pub fn from_json(s: &str) -> Result<Drawing> {
|
||||
if s.len() > MAX_DRAWING_BYTES {
|
||||
return Err(DocError::Invalid(format!("drawing too large (at most {} MiB)", MAX_DRAWING_BYTES >> 20)));
|
||||
}
|
||||
let mut v: Value = serde_json::from_str(s).map_err(|e| DocError::Invalid(format!("not a SolidCraft drawing: {e}")))?;
|
||||
let (version, applied) = DRAWING.take_version(&mut v)?;
|
||||
DRAWING.check_numbers(&v, "properties")?;
|
||||
DRAWING.upgrade(&mut v, version, applied.as_deref())?;
|
||||
let d: Drawing = serde_json::from_value(v).map_err(damaged)?;
|
||||
d.validate().map_err(damaged)?;
|
||||
Ok(Drawing { format: DRAWING.format_string(DRAWING.current()), format_pending: DRAWING.pending_names(), ..d })
|
||||
}
|
||||
|
||||
/// The drawing's JSON: the same bytes for the same drawing. JSON longer than a read takes
|
||||
/// ([`MAX_DRAWING_BYTES`]) is refused, so every drawing saved opens again: other tools'
|
||||
/// properties are kept as they came, and indenting them can make a drawing that read in
|
||||
/// under the limit save over it.
|
||||
pub fn to_json(&self) -> Result<String> {
|
||||
let text = serde_json::to_string_pretty(self).map_err(|e| DocError::Invalid(format!("drawing not saved: {e}")))?;
|
||||
require(text.len() <= MAX_DRAWING_BYTES, || format!("drawing too large to save (at most {} MiB)", MAX_DRAWING_BYTES >> 20))?;
|
||||
Ok(text)
|
||||
}
|
||||
|
||||
/// An id for a new object: one no object of the drawing has, from `id_source`, which never
|
||||
/// gives one twice.
|
||||
pub fn allocate_id(&self, id_source: &mut IdSource) -> Result<u64> {
|
||||
id_source.next(&self.ids().collect())
|
||||
}
|
||||
|
||||
/// Every object's id, of every kind: what a new id must differ from. Each later kind adds its
|
||||
/// own here.
|
||||
fn ids(&self) -> impl Iterator<Item = u64> {
|
||||
self.sources.iter().map(|s| s.id).chain(self.sheets.iter().map(|s| s.id))
|
||||
}
|
||||
|
||||
/// The record's rules (the module's notes): what reading a file checks, and what every edit
|
||||
/// keeps.
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
require((1..=MAX_SHEETS).contains(&self.sheets.len()), || format!("a drawing has 1 to {MAX_SHEETS} sheets"))?;
|
||||
require(self.sources.len() <= MAX_SOURCES, || format!("a drawing draws at most {MAX_SOURCES} designs"))?;
|
||||
check_name(&self.name, "the drawing's")?;
|
||||
require(is_language_tag(&self.language), || {
|
||||
format!("the language is not a BCP 47 tag of 2 to {MAX_LANGUAGE_CHARS} characters (such as `en` or `en-GB`)")
|
||||
})?;
|
||||
if let Units::Fixed { unit } = &self.units {
|
||||
// A length unit of the expression unit table, written as the table writes it.
|
||||
let length = unit.trim() == unit.as_str() && expr::unit_info(unit).is_some_and(|(kind, _)| kind == expr::Kind::Length);
|
||||
require(length, || "the drawing's unit is not a length unit (such as `mm` or `in`)".into())?;
|
||||
}
|
||||
let mut seen = BTreeSet::new();
|
||||
for id in self.ids() {
|
||||
require(id != 0, || "an object has the id 0, which is never one".into())?;
|
||||
require(seen.insert(id), || format!("two objects have the id {}", ids::encode(id)))?;
|
||||
}
|
||||
for source in &self.sources {
|
||||
let path = &source.path;
|
||||
require(!path.is_empty() && path.len() <= MAX_PATH_BYTES && !path.contains('\0'), || {
|
||||
format!("source {}: a design's path is 1 to {MAX_PATH_BYTES} bytes, without NUL", ids::encode(source.id))
|
||||
})?;
|
||||
}
|
||||
for sheet in &self.sheets {
|
||||
self.check_sheet(sheet).map_err(|e| DocError::Invalid(format!("sheet {}: {e}", ids::encode(sheet.id))))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// A sheet's own rules, and that the source it documents is one of the drawing's.
|
||||
fn check_sheet(&self, sheet: &Sheet) -> Result<()> {
|
||||
check_name(&sheet.name, "its")?;
|
||||
sheet.sheet.size_mm().map_err(from_sheet)?;
|
||||
if let Some(border) = &sheet.border {
|
||||
border.validate().map_err(from_sheet)?;
|
||||
}
|
||||
require((MIN_DPI..=MAX_DPI).contains(&sheet.dpi), || format!("its pictures are {MIN_DPI} to {MAX_DPI} dpi"))?;
|
||||
match sheet.documents {
|
||||
Some(SheetComponent { source, .. }) => {
|
||||
let named = || format!("it documents source {}, which the drawing doesn't have", ids::encode(source));
|
||||
require(self.sources.iter().any(|s| s.id == source), named)
|
||||
}
|
||||
None => Ok(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `Ok` when `ok`, else the rule `broken` names.
|
||||
fn require(ok: bool, broken: impl FnOnce() -> String) -> Result<()> {
|
||||
if ok { Ok(()) } else { Err(DocError::Invalid(broken())) }
|
||||
}
|
||||
|
||||
/// A name: 1 to [`MAX_NAME_BYTES`] bytes, not only spaces, without control characters.
|
||||
fn check_name(name: &str, whose: &str) -> Result<()> {
|
||||
require(!name.trim().is_empty() && name.len() <= MAX_NAME_BYTES && !name.chars().any(char::is_control), || {
|
||||
format!("{whose} name is 1 to {MAX_NAME_BYTES} bytes, not only spaces, without control characters")
|
||||
})
|
||||
}
|
||||
|
||||
/// A well-formed language tag, as far as a drawing needs (RFC 5646 §2.1): 2 to
|
||||
/// [`MAX_LANGUAGE_CHARS`] characters, subtags of 1 to 8 ASCII letters and digits joined by `-`,
|
||||
/// the first of 2 to 8 letters (`en`, `en-GB`, `zh-Hans-CN`). Whether the subtags are registered
|
||||
/// isn't checked, and a private-use tag alone (`x-…`) isn't taken.
|
||||
fn is_language_tag(tag: &str) -> bool {
|
||||
let mut subtags = tag.split('-');
|
||||
let first = subtags.next().unwrap_or_default();
|
||||
(2..=MAX_LANGUAGE_CHARS).contains(&tag.len())
|
||||
&& (2..=8).contains(&first.len())
|
||||
&& first.bytes().all(|b| b.is_ascii_alphabetic())
|
||||
&& subtags.all(|s| (1..=8).contains(&s.len()) && s.bytes().all(|b| b.is_ascii_alphanumeric()))
|
||||
}
|
||||
|
||||
/// A file that breaks a rule of the record.
|
||||
fn damaged(e: impl std::fmt::Display) -> DocError {
|
||||
DocError::Invalid(format!("damaged drawing: {e}"))
|
||||
}
|
||||
|
||||
fn from_sheet(e: drawing_sheet::Invalid) -> DocError {
|
||||
DocError::Invalid(e.to_string())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "drawing_tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,30 @@
|
||||
# Pending drawing-format changes
|
||||
|
||||
One file per change to what a drawing file saves that no release has shipped yet. Drawings
|
||||
(`"format": "solidcraft-drawing/N"`, #3890) are versioned by the same code as designs
|
||||
(`crates/doc/src/format.rs`, `Family`), from their own first format, 1. Adding a file here is the
|
||||
whole format bump: never edit the `DRAWING` family in `format.rs`, another change's file or a
|
||||
`../v<N>/` folder.
|
||||
|
||||
- Name it after the change, lowercase with dashes: `sheet-views.rs`.
|
||||
- Start it with a `//!` note: what is saved, what an older drawing gets without it, and what
|
||||
the last release does with a drawing that has it (it refuses the newer format number).
|
||||
- If older drawings must be rewritten as they open, add the step to the same file:
|
||||
|
||||
```rust
|
||||
//! …the note…
|
||||
use serde_json::Value;
|
||||
|
||||
pub fn step(v: &mut Value) -> crate::Result<()> {
|
||||
// rewrite the drawing's JSON here
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
Steps run in file-name order, after the steps of every older format.
|
||||
|
||||
While this folder has a change in it, the build writes the next drawing format number (the last
|
||||
folded one + 1, which no release reads), and lists the changes a drawing has in its
|
||||
`format_pending` field, so a later build applies only the steps that drawing is missing. At
|
||||
release time `scripts/fold-format-pending.sh` moves these files into `../v<N>/`, as it does the
|
||||
design format's (`crates/doc/src/format/pending/README.md`).
|
||||
@@ -0,0 +1,553 @@
|
||||
use serde_json::json;
|
||||
use solidcraft_geom::drawing_sheet::{Margins, Orientation, PaperSize, SheetSize};
|
||||
|
||||
use super::*;
|
||||
|
||||
/// The seed every test drawing's ids come from.
|
||||
const SEED: u64 = 3890;
|
||||
|
||||
/// A profile of its own: ISO 5457's filing margin and trimming marks, which the built-in leaves off.
|
||||
fn own_border() -> DrawingBorderProfile {
|
||||
DrawingBorderProfile { filing_margin: true, trimming_mark_mm: Some([10.0, 5.0]), ..DrawingBorderProfile::iso() }
|
||||
}
|
||||
|
||||
/// Three designs on two sheets: the first sheet (A3, the ISO border) documents component 7 of the
|
||||
/// first design; the second (A4 portrait, a border of its own, 600 dpi, left out of printing)
|
||||
/// documents the second design. The third design is on no sheet yet.
|
||||
fn plate() -> Drawing {
|
||||
let mut id_source = IdSource::seeded(SEED);
|
||||
let a3 = drawing_sheet::Sheet::standard(PaperSize::A3, Orientation::Landscape);
|
||||
let mut d = Drawing::new("Plate assembly", "en-GB", "Assembly", a3, Some(DrawingBorderProfile::iso()), &mut id_source).unwrap();
|
||||
for path in ["plate.sc", "../parts/bolt.sc", "bracket.sc"] {
|
||||
let id = d.allocate_id(&mut id_source).unwrap();
|
||||
d.sources.push(Source { id, path: path.into() });
|
||||
}
|
||||
let (plate_id, bolt_id) = (d.sources[0].id, d.sources[1].id);
|
||||
let id = d.allocate_id(&mut id_source).unwrap();
|
||||
d.sheets.push(Arc::new(Sheet {
|
||||
id,
|
||||
name: "Bolt".into(),
|
||||
sheet: drawing_sheet::Sheet::standard(PaperSize::A4, Orientation::Portrait),
|
||||
border: Some(own_border()),
|
||||
dpi: 600.0,
|
||||
documents: Some(SheetComponent { source: bolt_id, component: 0 }),
|
||||
excluded: Excluded { count: false, print: true },
|
||||
}));
|
||||
Arc::make_mut(&mut d.sheets[0]).documents = Some(SheetComponent { source: plate_id, component: 7 });
|
||||
d.properties.set(crate::metadata::Owner::Design, "author", json!("Jane Doe")).unwrap();
|
||||
d.units = Units::Fixed { unit: "in".into() };
|
||||
d.validate().unwrap();
|
||||
d
|
||||
}
|
||||
|
||||
/// One A4 sheet that documents nothing, no sources: the base the caps grow from.
|
||||
fn bare() -> Drawing {
|
||||
let a4 = drawing_sheet::Sheet::standard(PaperSize::A4, Orientation::Landscape);
|
||||
Drawing::new("Bare", "en", "Sheet", a4, None, &mut IdSource::seeded(SEED)).unwrap()
|
||||
}
|
||||
|
||||
fn file(d: &Drawing) -> Value {
|
||||
serde_json::from_str(&d.to_json().unwrap()).unwrap()
|
||||
}
|
||||
|
||||
fn read(file: &Value) -> Result<Drawing> {
|
||||
Drawing::from_json(&file.to_string())
|
||||
}
|
||||
|
||||
/// Why `file` is refused, or "read".
|
||||
fn refusal(file: &Value) -> String {
|
||||
read(file).map_or_else(|e| e.to_string(), |_| "read".into())
|
||||
}
|
||||
|
||||
/// Why `d`'s file, changed by `edit`, is refused, or "read".
|
||||
fn refused(d: &Drawing, edit: impl FnOnce(&mut Value)) -> String {
|
||||
let mut v = file(d);
|
||||
edit(&mut v);
|
||||
refusal(&v)
|
||||
}
|
||||
|
||||
/// A drawing reads back as it was saved, and save, open and save again writes the same bytes, as
|
||||
/// does another run from the same seed. The file holds each field under the record's name for it,
|
||||
/// ids as their 13 characters, and no counter.
|
||||
#[test]
|
||||
fn a_drawing_reads_back_as_saved_and_saves_the_same_bytes_again() {
|
||||
let d = plate();
|
||||
let saved = d.to_json().unwrap();
|
||||
let reopened = Drawing::from_json(&saved).unwrap();
|
||||
assert_eq!(reopened, d);
|
||||
assert_eq!(reopened.to_json().unwrap(), saved);
|
||||
assert_eq!(plate().to_json().unwrap(), saved, "a seeded run makes the same drawing");
|
||||
let v = file(&d);
|
||||
let [plate_id, bolt_id, bracket_id] = [0, 1, 2].map(|i| ids::encode(d.sources[i].id));
|
||||
let [assembly_id, bolt_sheet_id] = [0, 1].map(|i| ids::encode(d.sheets[i].id));
|
||||
assert_eq!(assembly_id, "1ge30wkvq38r0", "the seed's first id, as splitmix64 gives it");
|
||||
assert_eq!(v["format"], DRAWING.format_string(DRAWING.current()));
|
||||
assert_eq!(v.get("format_pending").is_some(), !DRAWING.pending_names().is_empty());
|
||||
assert_eq!(v.get("next_id"), None);
|
||||
assert_eq!((&v["name"], &v["language"]), (&json!("Plate assembly"), &json!("en-GB")));
|
||||
assert_eq!(
|
||||
v["sources"],
|
||||
json!([{"id": plate_id, "path": "plate.sc"}, {"id": bolt_id, "path": "../parts/bolt.sc"}, {"id": bracket_id, "path": "bracket.sc"}])
|
||||
);
|
||||
assert_eq!(v["properties"], json!({"author": "Jane Doe"}));
|
||||
assert_eq!(v["units"], json!({"fixed": {"unit": "in"}}));
|
||||
assert_eq!((&v["sheets"][0]["id"], &v["sheets"][0]["dpi"]), (&json!(assembly_id), &json!(300.0)));
|
||||
assert_eq!(v["sheets"][0]["sheet"], json!({"size": {"standard": "a3"}, "orientation": "landscape"}));
|
||||
assert_eq!(v["sheets"][0]["documents"], json!({"source": plate_id, "component": 7}));
|
||||
assert_eq!(v["sheets"][0]["excluded"], json!({"count": false, "print": false}));
|
||||
assert_eq!(
|
||||
v["sheets"][1],
|
||||
json!({
|
||||
"id": bolt_sheet_id, "name": "Bolt", "sheet": {"size": {"standard": "a4"}, "orientation": "portrait"},
|
||||
"border": serde_json::to_value(own_border()).unwrap(), "dpi": 600.0,
|
||||
"documents": {"source": bolt_id, "component": 0}, "excluded": {"count": false, "print": true}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/// A hand-written file may leave out what has a default, and reads as a new drawing has it; the
|
||||
/// rest is needed.
|
||||
#[test]
|
||||
fn a_file_may_leave_out_what_has_a_default() {
|
||||
let minimal = json!({
|
||||
"format": DRAWING.format_string(1),
|
||||
"name": "Bracket",
|
||||
"sources": [],
|
||||
"language": "de",
|
||||
"sheets": [{"id": "0000000000001", "name": "Blatt 1", "sheet": {"size": {"standard": "a3"}}}]
|
||||
});
|
||||
let d = read(&minimal).unwrap();
|
||||
assert_eq!((d.sheets[0].id, &d.units, d.properties.is_empty()), (1, &Units::FollowModel, true));
|
||||
let sheet = &d.sheets[0];
|
||||
assert_eq!(sheet.sheet, drawing_sheet::Sheet::standard(PaperSize::A3, Orientation::Landscape));
|
||||
assert_eq!((sheet.border, sheet.dpi, sheet.documents, sheet.excluded), (None, DEFAULT_DPI, None, Excluded::default()));
|
||||
// The format as this build writes it, however the file spelt it.
|
||||
let mut spelt = minimal.clone();
|
||||
spelt["format"] = json!("solidcraft-drawing/+1");
|
||||
assert_eq!(read(&spelt).unwrap().format, DRAWING.format_string(DRAWING.current()));
|
||||
for key in ["name", "sources", "language", "sheets"] {
|
||||
let mut v = minimal.clone();
|
||||
v.as_object_mut().unwrap().remove(key);
|
||||
let why = refusal(&v);
|
||||
assert!(why.starts_with("damaged drawing: ") && why.contains(&format!("missing field `{key}`")), "{why}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Every cap on both sides: sheets, sources, the bytes of paths and names (two-byte characters too).
|
||||
#[test]
|
||||
fn every_cap_holds_on_both_sides() {
|
||||
let base = file(&bare());
|
||||
let with = |key: &str, value: Value| {
|
||||
let mut v = base.clone();
|
||||
v[key] = value;
|
||||
v
|
||||
};
|
||||
let sheet = base["sheets"][0].clone();
|
||||
let sheets = |n: u64| {
|
||||
let one = |id: u64| {
|
||||
let mut s = sheet.clone();
|
||||
s["id"] = json!(ids::encode(id));
|
||||
s
|
||||
};
|
||||
Value::Array((1..=n).map(one).collect())
|
||||
};
|
||||
assert_eq!(read(&with("sheets", sheets(1000))).unwrap().sheets.len(), 1000);
|
||||
for n in [0, 1001] {
|
||||
assert_eq!(refusal(&with("sheets", sheets(n))), "damaged drawing: a drawing has 1 to 1000 sheets", "{n} sheets");
|
||||
}
|
||||
// Sources from id 1: the sheet's id is the seed's, far from them.
|
||||
let sources = |n: u64| Value::Array((1..=n).map(|id| json!({"id": ids::encode(id), "path": format!("part{id}.sc")})).collect());
|
||||
assert_eq!(read(&with("sources", sources(64))).unwrap().sources.len(), 64);
|
||||
assert_eq!(refusal(&with("sources", sources(65))), "damaged drawing: a drawing draws at most 64 designs");
|
||||
let path = |p: &str| refusal(&with("sources", json!([{"id": ids::encode(1), "path": p}])));
|
||||
for fits in ["a".repeat(4096), "é".repeat(2048), "/".into()] {
|
||||
assert_eq!(path(fits.as_str()), "read", "{} bytes", fits.len());
|
||||
}
|
||||
let rule = "damaged drawing: source 0000000000001: a design's path is 1 to 4096 bytes, without NUL";
|
||||
for broken in ["a".repeat(4097), "é".repeat(2048) + "a", String::new(), "plate\0.sc".into()] {
|
||||
assert_eq!(path(broken.as_str()), rule, "{} bytes", broken.len());
|
||||
}
|
||||
let names = |name: &str| {
|
||||
let mut sheet_named = base.clone();
|
||||
sheet_named["sheets"][0]["name"] = json!(name);
|
||||
(refusal(&with("name", json!(name))), refusal(&sheet_named))
|
||||
};
|
||||
for fits in ["x".repeat(256), "é".repeat(128), "A".into(), "Blatt 1 – Übersicht".into()] {
|
||||
assert_eq!(names(fits.as_str()), ("read".to_string(), "read".to_string()), "{} bytes", fits.len());
|
||||
}
|
||||
let rule = "name is 1 to 256 bytes, not only spaces, without control characters";
|
||||
let sheet_id = ids::encode(bare().sheets[0].id);
|
||||
for broken in ["x".repeat(257), "é".repeat(128) + "a", String::new(), " ".into(), "two\nlines".into(), "bell\u{7}".into(), "nul\0".into()] {
|
||||
let expected = (format!("damaged drawing: the drawing's {rule}"), format!("damaged drawing: sheet {sheet_id}: its {rule}"));
|
||||
assert_eq!(names(broken.as_str()), expected, "{broken:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The content language is a well-formed BCP 47 tag of 2 to 35 characters.
|
||||
#[test]
|
||||
fn the_language_is_a_bcp_47_tag_of_2_to_35_characters() {
|
||||
let base = file(&bare());
|
||||
let why = |tag: &str| {
|
||||
let mut v = base.clone();
|
||||
v["language"] = json!(tag);
|
||||
refusal(&v)
|
||||
};
|
||||
let longest = "en-abcdefgh-abcdefgh-abcdefgh-abcde";
|
||||
assert_eq!(longest.len(), 35);
|
||||
for tag in ["en", "de", "ast", "en-GB", "EN-gb", "zh-Hans-CN", "sr-Latn-RS", "es-419", longest] {
|
||||
assert_eq!(why(tag), "read", "{tag}");
|
||||
}
|
||||
let rule = "damaged drawing: the language is not a BCP 47 tag of 2 to 35 characters (such as `en` or `en-GB`)";
|
||||
let too_long = format!("{longest}f");
|
||||
let broken =
|
||||
["e", "", too_long.as_str(), "en_GB", "en-", "-en", "en--GB", "e1", "x-private", "en-abcdefghi", "abcdefghi", "日本", "en GB", "en\n"];
|
||||
for tag in broken {
|
||||
assert_eq!(why(tag), rule, "{tag:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A fixed unit is a length unit of the expression unit table, written as the table writes it.
|
||||
#[test]
|
||||
fn a_fixed_unit_is_a_length_unit_of_the_expression_table() {
|
||||
let base = file(&bare());
|
||||
let units = |units: Value| {
|
||||
let mut v = base.clone();
|
||||
v["units"] = units;
|
||||
read(&v).map(|d| d.units)
|
||||
};
|
||||
for (unit, kind, _) in expr::UNITS {
|
||||
assert_eq!(units(json!({"fixed": {"unit": unit}})).is_ok(), kind == expr::Kind::Length, "{unit}");
|
||||
}
|
||||
assert_eq!(units(json!({"fixed": {"unit": "in"}})).unwrap(), Units::Fixed { unit: "in".into() });
|
||||
assert_eq!(units(json!("follow_model")).unwrap(), Units::FollowModel);
|
||||
let rule = "damaged drawing: the drawing's unit is not a length unit (such as `mm` or `in`)";
|
||||
for unit in ["furlong", "deg", "°", "none", "", " in", "in ", "IN"] {
|
||||
assert_eq!(units(json!({"fixed": {"unit": unit}})).unwrap_err().to_string(), rule, "{unit:?}");
|
||||
}
|
||||
for broken in [json!("follow_design"), json!({"fixed": "in"}), json!({"fixed": {}}), json!(null)] {
|
||||
assert!(units(broken.clone()).is_err(), "{broken}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A sheet's border is saved as a copy of its profile, field by field, and read back as saved, so
|
||||
/// a later built-in never changes it; a profile's name in its place is refused.
|
||||
#[test]
|
||||
fn a_border_is_saved_as_a_copy_of_its_profile() {
|
||||
let v = file(&plate());
|
||||
assert_eq!(v["sheets"][0]["border"], serde_json::to_value(DrawingBorderProfile::iso()).unwrap());
|
||||
assert_eq!(v["sheets"][1]["border"], serde_json::to_value(own_border()).unwrap());
|
||||
assert_eq!(read(&v).unwrap().sheets[1].border, Some(own_border()));
|
||||
let mut edited = v.clone();
|
||||
edited["sheets"][0]["border"]["margins"]["left_mm"] = json!(15.0);
|
||||
let iso = DrawingBorderProfile::iso();
|
||||
let wider = DrawingBorderProfile { margins: Margins { left_mm: 15.0, ..iso.margins }, ..iso };
|
||||
assert_eq!(read(&edited).unwrap().sheets[0].border, Some(wider));
|
||||
edited["sheets"][0]["border"] = json!("iso");
|
||||
assert!(refusal(&edited).starts_with("damaged drawing: "));
|
||||
edited["sheets"][0]["border"] = Value::Null;
|
||||
assert_eq!(read(&edited).unwrap().sheets[0].border, None, "no drawing border");
|
||||
}
|
||||
|
||||
/// What reading refuses: each damage the rules name, refused rather than patched, and files this
|
||||
/// build can't read.
|
||||
#[test]
|
||||
fn damaged_files_are_refused_and_never_patched() {
|
||||
let d = plate();
|
||||
let plate_id = ids::encode(d.sources[0].id);
|
||||
let [assembly_id, bolt_sheet_id] = [0, 1].map(|i| ids::encode(d.sheets[i].id));
|
||||
// Two objects with one id, of one kind and of two kinds.
|
||||
assert_eq!(refused(&d, |v| v["sources"][1]["id"] = json!(plate_id)), format!("damaged drawing: two objects have the id {plate_id}"));
|
||||
assert_eq!(refused(&d, |v| v["sheets"][1]["id"] = json!(assembly_id)), format!("damaged drawing: two objects have the id {assembly_id}"));
|
||||
assert_eq!(refused(&d, |v| v["sources"][2]["id"] = json!(bolt_sheet_id)), format!("damaged drawing: two objects have the id {bolt_sheet_id}"));
|
||||
// An id that isn't one, where an object has it and where a reference names it; no number form,
|
||||
// and no counter.
|
||||
let not_an_id = "damaged drawing: an id is 13 characters of lowercase Crockford base32, not all 0";
|
||||
for text in ["0000000000000", "FZZZZZZZZZZZZ", "000000000001", "0000000000001 ", "000000000000o", "g000000000000"] {
|
||||
assert_eq!(refused(&d, |v| v["sources"][2]["id"] = json!(text)), not_an_id, "{text:?}");
|
||||
assert_eq!(refused(&d, |v| v["sheets"][1]["documents"]["source"] = json!(text)), not_an_id, "{text:?}");
|
||||
}
|
||||
assert!(refused(&d, |v| v["sources"][2]["id"] = json!(5)).starts_with("damaged drawing: invalid type"));
|
||||
assert!(refused(&d, |v| v["next_id"] = json!(6)).contains("unknown field `next_id`"));
|
||||
let mut in_memory = d.clone();
|
||||
in_memory.sources[2].id = 0;
|
||||
assert_eq!(in_memory.validate().unwrap_err().to_string(), "an object has the id 0, which is never one");
|
||||
// A reference to nothing, or to an object of another kind; a source a sheet documents removed.
|
||||
for missing in [ids::encode(99), assembly_id.clone()] {
|
||||
let expected = format!("damaged drawing: sheet {bolt_sheet_id}: it documents source {missing}, which the drawing doesn't have");
|
||||
assert_eq!(refused(&d, |v| v["sheets"][1]["documents"]["source"] = json!(missing)), expected);
|
||||
}
|
||||
let without_plate = refused(&d, |v| {
|
||||
v["sources"].as_array_mut().unwrap().remove(0);
|
||||
});
|
||||
assert_eq!(without_plate, format!("damaged drawing: sheet {assembly_id}: it documents source {plate_id}, which the drawing doesn't have"));
|
||||
// The paper, its border and its resolution, through the sheet's own rules.
|
||||
let custom = |sides: Value| refused(&d, |v| v["sheets"][0]["sheet"]["size"] = json!({"custom": {"sides_mm": sides}}));
|
||||
assert_eq!(custom(json!([5000.0, 0.5])), "read");
|
||||
for sides in [json!([5000.1, 100.0]), json!([0.0, 100.0]), json!([-1.0, 100.0])] {
|
||||
let expected = format!("damaged drawing: sheet {assembly_id}: drawing sheet: a custom side is finite, above 0 and at most 5000 mm");
|
||||
assert_eq!(custom(sides), expected);
|
||||
}
|
||||
let why = custom(json!([1e10, 100.0]));
|
||||
assert!(why.starts_with("damaged drawing: the number ") && why.ends_with(" is out of range"), "checked before the record: {why}");
|
||||
let nan = d.to_json().unwrap().replacen("600.0", "NaN", 1);
|
||||
assert!(Drawing::from_json(&nan).unwrap_err().to_string().starts_with("not a SolidCraft drawing: "), "NaN isn't JSON");
|
||||
assert_eq!(
|
||||
refused(&d, |v| v["sheets"][1]["border"]["margins"]["top_mm"] = json!(-1.0)),
|
||||
format!("damaged drawing: sheet {bolt_sheet_id}: drawing sheet: a margin is finite and 0 to 5000 mm")
|
||||
);
|
||||
for dpi in [25.0, 2400.0] {
|
||||
assert_eq!(refused(&d, |v| v["sheets"][1]["dpi"] = json!(dpi)), "read", "{dpi}");
|
||||
}
|
||||
for dpi in [24.9, 2400.1, 0.0, -300.0] {
|
||||
let expected = format!("damaged drawing: sheet {bolt_sheet_id}: its pictures are 25 to 2400 dpi");
|
||||
assert_eq!(refused(&d, |v| v["sheets"][1]["dpi"] = json!(dpi)), expected, "{dpi}");
|
||||
}
|
||||
// In memory, where NaN can be, the same rules.
|
||||
let mut in_memory = plate();
|
||||
Arc::make_mut(&mut in_memory.sheets[1]).dpi = f64::NAN;
|
||||
assert_eq!(in_memory.validate().unwrap_err().to_string(), format!("sheet {bolt_sheet_id}: its pictures are 25 to 2400 dpi"));
|
||||
let sheet = Arc::make_mut(&mut in_memory.sheets[1]);
|
||||
sheet.dpi = DEFAULT_DPI;
|
||||
sheet.sheet.size = SheetSize::Custom { sides_mm: [f64::NAN, 100.0] };
|
||||
assert!(in_memory.validate().unwrap_err().to_string().starts_with(&format!("sheet {bolt_sheet_id}: drawing sheet: a custom side")));
|
||||
// An unknown field anywhere.
|
||||
let unknown: [fn(&mut Value); 8] = [
|
||||
|v| v["views"] = json!([]),
|
||||
|v| v["sources"][0]["name"] = json!("Plate"),
|
||||
|v| v["sheets"][0]["scale"] = json!(1),
|
||||
|v| v["sheets"][0]["sheet"]["colour"] = json!("white"),
|
||||
|v| v["sheets"][0]["border"]["style"] = json!("iso"),
|
||||
|v| v["sheets"][0]["documents"]["view"] = json!(1),
|
||||
|v| v["sheets"][0]["excluded"]["export"] = json!(true),
|
||||
|v| v["units"]["fixed"]["precision"] = json!(2),
|
||||
];
|
||||
for (i, edit) in unknown.into_iter().enumerate() {
|
||||
let why = refused(&d, edit);
|
||||
assert!(why.starts_with("damaged drawing: ") && why.contains("unknown field"), "{i}: {why}");
|
||||
}
|
||||
// A newer build's file is refused as one before anything in it is read: a field this build
|
||||
// doesn't know, or a number out of its range.
|
||||
let (current, newer) = (DRAWING.current(), DRAWING.current() + 1);
|
||||
let why = refused(&d, |v| {
|
||||
v["format"] = json!(DRAWING.format_string(newer));
|
||||
v["views"] = json!([]);
|
||||
v["sheets"][0]["dpi"] = json!(1e10);
|
||||
});
|
||||
assert_eq!(
|
||||
why,
|
||||
format!(
|
||||
"this drawing was saved by a newer SolidCraft (file format {newer}; this version reads formats up to {current}): update SolidCraft to open it"
|
||||
)
|
||||
);
|
||||
// A list of pending changes means nothing beside a format made of none; beside the pending
|
||||
// number, a change this build doesn't know is a newer build's.
|
||||
let why = refused(&d, |v| v["format_pending"] = json!(["a-later-change"]));
|
||||
if DRAWING.pending_names().is_empty() {
|
||||
assert_eq!(why, "read");
|
||||
} else {
|
||||
assert!(why.contains("newer SolidCraft"), "{why}");
|
||||
}
|
||||
// A design is never read as a drawing, nor a drawing as a design.
|
||||
let design = crate::Document::new("Plate").to_json();
|
||||
let design_format = crate::format::format_string(crate::format::FORMAT);
|
||||
assert_eq!(Drawing::from_json(&design).unwrap_err().to_string(), format!("not a SolidCraft drawing (format `{design_format}`)"));
|
||||
let drawing_format = DRAWING.format_string(current);
|
||||
assert_eq!(
|
||||
crate::Document::from_json(&d.to_json().unwrap()).unwrap_err().to_string(),
|
||||
format!("not a SolidCraft design (format `{drawing_format}`)")
|
||||
);
|
||||
// Not an object, not JSON, nested too deeply, too large.
|
||||
assert_eq!(Drawing::from_json("[]").unwrap_err().to_string(), "not a SolidCraft drawing (expected a JSON object)");
|
||||
assert!(Drawing::from_json("").unwrap_err().to_string().starts_with("not a SolidCraft drawing: "));
|
||||
let deep: Value = serde_json::from_str(&format!("{}1{}", "[".repeat(100), "]".repeat(100))).unwrap();
|
||||
assert_eq!(refused(&d, |v| v["views"] = deep), "damaged drawing: nested too deeply");
|
||||
let deeper = format!("{{\"format\": \"{drawing_format}\", \"views\": {}1{}}}", "[".repeat(200), "]".repeat(200));
|
||||
assert!(Drawing::from_json(&deeper).unwrap_err().to_string().starts_with("not a SolidCraft drawing: "));
|
||||
let text = d.to_json().unwrap();
|
||||
let at_cap = text.clone() + &" ".repeat(MAX_DRAWING_BYTES - text.len());
|
||||
assert_eq!(Drawing::from_json(&at_cap).unwrap(), d);
|
||||
assert_eq!(Drawing::from_json(&(at_cap + " ")).unwrap_err().to_string(), "drawing too large (at most 16 MiB)");
|
||||
}
|
||||
|
||||
/// A run never gives an id twice: not one in use, and not a removed object's. Only another run from
|
||||
/// the same seed, which tests and replays start from the same file, can give a removed id again.
|
||||
#[test]
|
||||
fn a_run_never_gives_an_id_twice() {
|
||||
let mut id_source = IdSource::seeded(SEED);
|
||||
let a4 = drawing_sheet::Sheet::standard(PaperSize::A4, Orientation::Landscape);
|
||||
let mut d = Drawing::new("Ids", "en", "Sheet", a4, None, &mut id_source).unwrap();
|
||||
let mut given = BTreeSet::from([d.sheets[0].id]);
|
||||
for _ in 0..MAX_SOURCES {
|
||||
let id = d.allocate_id(&mut id_source).unwrap();
|
||||
d.sources.push(Source { id, path: "part.sc".into() });
|
||||
assert!(given.insert(id), "{id:#x} given twice");
|
||||
}
|
||||
let removed = d.sources.pop().unwrap().id;
|
||||
for _ in 0..10_000 {
|
||||
let id = d.allocate_id(&mut id_source).unwrap();
|
||||
assert!(id != removed && given.insert(id), "{id:#x} given twice");
|
||||
}
|
||||
// The same seed, from the start, over a file it made: every draw up to the removed id is in use.
|
||||
let reopened = Drawing::from_json(&d.to_json().unwrap()).unwrap();
|
||||
let again = reopened.allocate_id(&mut IdSource::seeded(SEED)).unwrap();
|
||||
assert!(!reopened.ids().any(|id| id == again));
|
||||
assert_eq!(again, removed);
|
||||
}
|
||||
|
||||
/// Properties follow the design metadata's rules: other tools' data and a well-known key of another
|
||||
/// kind are kept as they are, never read as numbers, while the same number elsewhere is refused.
|
||||
#[test]
|
||||
fn properties_are_kept_as_they_are() {
|
||||
let mut v = file(&plate());
|
||||
v["properties"]["com.example.pdm"] = json!({"huge": 1e300, "ids": [1, 2, 3]});
|
||||
v["properties"]["revision"] = json!(3);
|
||||
let d = read(&v).unwrap();
|
||||
assert_eq!(d.properties.get("com.example.pdm"), Some(&json!({"huge": 1e300, "ids": [1, 2, 3]})));
|
||||
assert_eq!((d.properties.revision(), d.properties.get("revision")), (None, Some(&json!(3))));
|
||||
assert_eq!(read(&file(&d)).unwrap(), d);
|
||||
v["sheets"][0]["dpi"] = json!(1e300);
|
||||
let why = refusal(&v);
|
||||
assert!(why.starts_with("damaged drawing: the number ") && why.ends_with(" is out of range"), "{why}");
|
||||
}
|
||||
|
||||
/// A drawing whose JSON would be over the read limit isn't saved. Other tools' properties are kept
|
||||
/// as they came, and indenting them can grow a file read in under the limit past it, so the save
|
||||
/// refuses rather than write a file that won't open: every drawing saved opens again.
|
||||
#[test]
|
||||
fn a_drawing_too_large_to_reopen_is_not_saved() {
|
||||
let file = |zeros: usize| {
|
||||
let items = vec!["0"; zeros].join(",");
|
||||
let sheet = r#"{"id":"0000000000001","name":"S","sheet":{"size":{"standard":"a4"}}}"#;
|
||||
let format = DRAWING.format_string(1);
|
||||
format!(
|
||||
r#"{{"format":"{format}","name":"A","sources":[],"language":"en","sheets":[{sheet}],"properties":{{"com.example":{{"items":[{items}]}}}}}}"#
|
||||
)
|
||||
};
|
||||
// The case found in review (#3891): 2,000,000 zeros read in at about 4 MB and indent past 16 MiB.
|
||||
let big = Drawing::from_json(&file(2_000_000)).unwrap();
|
||||
assert_eq!(big.to_json().unwrap_err().to_string(), "drawing too large to save (at most 16 MiB)");
|
||||
let small = Drawing::from_json(&file(100_000)).unwrap();
|
||||
assert_eq!(Drawing::from_json(&small.to_json().unwrap()).unwrap(), small);
|
||||
}
|
||||
|
||||
/// A new drawing has one sheet, its id the source's first, follows its designs' units and renders
|
||||
/// pictures at 300 dpi; a name, language or border that breaks the rules is refused.
|
||||
#[test]
|
||||
fn a_new_drawing_has_one_sheet_and_keeps_the_rules() {
|
||||
let d = bare();
|
||||
let first = IdSource::seeded(SEED).next(&BTreeSet::new()).unwrap();
|
||||
assert_eq!((d.sheets.len(), d.sheets[0].id, d.sheets[0].dpi, &d.units), (1, first, DEFAULT_DPI, &Units::FollowModel));
|
||||
assert_eq!((d.format, d.format_pending), (DRAWING.format_string(DRAWING.current()), DRAWING.pending_names()));
|
||||
let a4 = drawing_sheet::Sheet::standard(PaperSize::A4, Orientation::Landscape);
|
||||
let thin = DrawingBorderProfile { drawing_border_line_mm: 0.0, ..DrawingBorderProfile::iso() };
|
||||
let broken = [("", "en", "Sheet", None), ("Bare", "en_GB", "Sheet", None), ("Bare", "en", "\n", None), ("Bare", "en", "Sheet", Some(thin))];
|
||||
for (name, language, sheet, border) in broken {
|
||||
let made = Drawing::new(name, language, sheet, a4, border, &mut IdSource::seeded(SEED));
|
||||
assert!(made.is_err(), "{name:?} {language:?} {sheet:?} {border:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Hostile input never panics: a valid file's text cut, overwritten and given lies, and its JSON
|
||||
/// values replaced, repeated and dropped. Each read gives an error, or a drawing that keeps the
|
||||
/// rules and reads back as it saves.
|
||||
#[test]
|
||||
fn mutated_files_give_an_error_or_a_valid_drawing_never_a_panic() {
|
||||
let good = plate().to_json().unwrap();
|
||||
let tree: Value = serde_json::from_str(&good).unwrap();
|
||||
let nodes = count(&tree) as u64;
|
||||
let lies = [
|
||||
json!(null),
|
||||
json!(0),
|
||||
json!(-1),
|
||||
json!(1),
|
||||
json!(1e10),
|
||||
json!(u64::MAX),
|
||||
json!(""),
|
||||
json!("x".repeat(300)),
|
||||
json!("0000000000000"),
|
||||
json!("0000000000001"),
|
||||
json!("fzzzzzzzzzzzz"),
|
||||
json!("FZZZZZZZZZZZZ"),
|
||||
json!([]),
|
||||
json!({}),
|
||||
json!(true),
|
||||
json!("follow_model"),
|
||||
json!({"fixed": {"unit": "deg"}}),
|
||||
];
|
||||
let words = ["NaN", "1e400", "-0", "18446744073709551616", "\"", "{", "]", ",", "null", "\u{0}", "é", "o", "I"];
|
||||
let mut seed: u64 = 0x9e37_79b9_7f4a_7c15;
|
||||
let mut rnd = move || {
|
||||
seed ^= seed << 13;
|
||||
seed ^= seed >> 7;
|
||||
seed ^= seed << 17;
|
||||
seed
|
||||
};
|
||||
let mut read_back = 0;
|
||||
for i in 0..10_000 {
|
||||
let text = if i % 2 == 0 {
|
||||
let mut v = tree.clone();
|
||||
let lie = &lies[(rnd() % lies.len() as u64) as usize];
|
||||
mutate(&mut v, &mut ((rnd() % nodes) as usize), lie, rnd() % 3);
|
||||
v.to_string()
|
||||
} else {
|
||||
let mut s = good.clone().into_bytes();
|
||||
for _ in 0..1 + rnd() % 3 {
|
||||
// A run of up to 15 bytes taken out, overwritten by one byte or replaced by a lie.
|
||||
let at = (rnd() % (s.len() as u64 + 1)) as usize;
|
||||
let cut = ((rnd() % 16) as usize).min(s.len() - at);
|
||||
let byte = [(rnd() >> 56) as u8];
|
||||
let put: &[u8] = match rnd() % 3 {
|
||||
0 => &[],
|
||||
1 => &byte,
|
||||
_ => words[(rnd() % words.len() as u64) as usize].as_bytes(),
|
||||
};
|
||||
let next = [&s[..at], put, &s[at + cut..]].concat();
|
||||
s = next;
|
||||
if rnd() % 8 == 0 {
|
||||
s.truncate(at);
|
||||
}
|
||||
}
|
||||
String::from_utf8_lossy(&s).into_owned()
|
||||
};
|
||||
if let Ok(d) = Drawing::from_json(&text) {
|
||||
assert!(d.validate().is_ok() && d.ids().all(|id| id != 0), "{text}");
|
||||
assert_eq!(Drawing::from_json(&d.to_json().unwrap()).unwrap(), d, "{text}");
|
||||
read_back += 1;
|
||||
}
|
||||
}
|
||||
assert!(read_back > 50, "only {read_back} mutated files read: the mutations hardly reach the record's rules");
|
||||
}
|
||||
|
||||
/// The number of values in `v`, itself included.
|
||||
fn count(v: &Value) -> usize {
|
||||
1 + match v {
|
||||
Value::Array(a) => a.iter().map(count).sum::<usize>(),
|
||||
Value::Object(o) => o.values().map(count).sum(),
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// Change the `pick`th value of `v`, depth first: `how` 1 repeats a list's first element (two
|
||||
/// objects with one id), 2 drops an object's first field, and otherwise `lie` takes its place.
|
||||
fn mutate(v: &mut Value, pick: &mut usize, lie: &Value, how: u64) -> bool {
|
||||
if *pick == 0 {
|
||||
match (v, how) {
|
||||
(Value::Array(a), 1) if !a.is_empty() => {
|
||||
let first = a[0].clone();
|
||||
a.push(first);
|
||||
}
|
||||
(Value::Object(o), 2) if !o.is_empty() => {
|
||||
let key = o.keys().next().cloned().unwrap_or_default();
|
||||
o.remove(&key);
|
||||
}
|
||||
(v, _) => *v = lie.clone(),
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*pick -= 1;
|
||||
match v {
|
||||
Value::Array(a) => a.iter_mut().any(|x| mutate(x, pick, lie, how)),
|
||||
Value::Object(o) => o.values_mut().any(|x| mutate(x, pick, lie, how)),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||