From 532d2ea6d775538d08e3a65e8b08b0544c3870f7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 01:04:30 -0800 Subject: [PATCH 1/2] Packaging Tools: Check Fold Lines finds the panels and hinges of a blank and lists what is wrong MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Object › Plug-ins › Packaging Tools › Check Fold Lines, and the Fold Lines panel's Check button, check the fold lines of the selection, or of the document while nothing is selected (`addon.packaging.check`). - Cut lines bound the material: each connected piece that encloses an area is one blank, its largest closed cut line is the outline, and a closed cut line inside it is a hole. A slot drawn as a rectangle across the outline leaves the same material as a notch drawn in it, and an outline drawn as several open cut lines works too. - Creases, partial cuts and perforations divide a blank into panels; the pieces between the same two panels form one hinge. - 15 issue codes, errors and warnings, each naming its lines; cut line ends within a tolerance (0.1 pt, 0.01 to 10) are joined and reported as a gap. With `select`, the lines the issues name are selected. - The panel lists the issues in the interface language, with a summary line; clicking an issue or its Select button selects its lines. The list is kept until the document changes. `vectorcraft_pathops::adjacency` maps paths as live_paint does and keeps, for each edge, every input it lies on and the faces on both sides; the blank model is `vectorcraft_three_d::fold::blanks`. The engine now depends on vectorcraft-three-d directly. Docs: docs/mcp.md (Check Fold Lines), crates/pathops/README.md, ROADMAP. --- Cargo.lock | 2 + ROADMAP.md | 1 + crates/engine/Cargo.toml | 2 + crates/engine/src/cmd/addons/packaging.rs | 8 +- .../engine/src/cmd/addons/packaging/check.rs | 176 +++ .../src/cmd/addons/packaging/check/tests.rs | 165 +++ .../engine/src/cmd/addons/packaging/roles.rs | 4 +- crates/engine/src/cmd/plugin_call/reviewed.rs | 1 + crates/engine/tests/command_sweep.rs | 3 + crates/pathops/README.md | 8 + crates/pathops/src/lib.rs | 4 +- crates/pathops/src/planar.rs | 2 + crates/pathops/src/planar/adjacency.rs | 169 +++ crates/pathops/src/planar/adjacency/tests.rs | 200 +++ crates/pathops/src/planar/map.rs | 16 +- crates/three-d/Cargo.toml | 3 + crates/three-d/src/fold.rs | 1237 +++++++++++++++++ crates/three-d/src/fold/tests.rs | 740 ++++++++++ crates/three-d/src/lib.rs | 1 + crates/ui-egui/src/addons/packaging.rs | 144 +- crates/ui-egui/src/addons/packaging/tests.rs | 133 +- crates/ui-egui/src/i18n/bg.tsv | 19 + crates/ui-egui/src/i18n/bs.tsv | 19 + crates/ui-egui/src/i18n/ca.tsv | 19 + crates/ui-egui/src/i18n/cs.tsv | 19 + crates/ui-egui/src/i18n/da.tsv | 19 + crates/ui-egui/src/i18n/de.tsv | 19 + crates/ui-egui/src/i18n/el.tsv | 19 + crates/ui-egui/src/i18n/es.tsv | 19 + crates/ui-egui/src/i18n/fi.tsv | 19 + crates/ui-egui/src/i18n/fr.tsv | 19 + crates/ui-egui/src/i18n/gu.tsv | 19 + crates/ui-egui/src/i18n/hi.tsv | 19 + crates/ui-egui/src/i18n/hu.tsv | 19 + crates/ui-egui/src/i18n/id.tsv | 19 + crates/ui-egui/src/i18n/it.tsv | 19 + crates/ui-egui/src/i18n/ja.tsv | 19 + crates/ui-egui/src/i18n/ka.tsv | 19 + crates/ui-egui/src/i18n/ko.tsv | 19 + crates/ui-egui/src/i18n/nl.tsv | 19 + crates/ui-egui/src/i18n/pl.tsv | 19 + crates/ui-egui/src/i18n/pt-br.tsv | 19 + crates/ui-egui/src/i18n/ru.tsv | 19 + crates/ui-egui/src/i18n/sv.tsv | 19 + crates/ui-egui/src/i18n/tr.tsv | 19 + crates/ui-egui/src/i18n/uk.tsv | 19 + crates/ui-egui/src/i18n/vi.tsv | 19 + crates/ui-egui/src/i18n/zh-hans.tsv | 19 + crates/ui-egui/src/i18n/zh-hant.tsv | 19 + crates/ui-egui/src/menus/invoke.rs | 5 + docs/mcp.md | 56 +- 51 files changed, 3593 insertions(+), 19 deletions(-) create mode 100644 crates/engine/src/cmd/addons/packaging/check.rs create mode 100644 crates/engine/src/cmd/addons/packaging/check/tests.rs create mode 100644 crates/pathops/src/planar/adjacency.rs create mode 100644 crates/pathops/src/planar/adjacency/tests.rs create mode 100644 crates/three-d/src/fold.rs create mode 100644 crates/three-d/src/fold/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 81946466b5..3b31ba9996 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6709,6 +6709,7 @@ dependencies = [ "vectorcraft-svg", "vectorcraft-testkit", "vectorcraft-text", + "vectorcraft-three-d", "vectorcraft-tools", "vectorcraft-trace", "wat", @@ -7017,6 +7018,7 @@ dependencies = [ name = "vectorcraft-three-d" version = "0.24.1" dependencies = [ + "proptest", "vectorcraft-geom 0.24.1", "vectorcraft-pathops 0.24.1", ] diff --git a/ROADMAP.md b/ROADMAP.md index 6471505555..f658cccb58 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -135,6 +135,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-05: Release Type on a Path joins the Type Tools add-on (Object › Plug-ins › Type Tools): each selected type on a path splits into point type with the same text and attributes, on one straight line starting where its first character sat, and the plain path it was set on, with its exact shape and place in the stacking order and no paint; or keeps only the path or only the text, optionally leaving the original. A dialog with Preview, one undo step (`addon.type.releasePath`, #5532). A VectorCraft addition: headline numbers unchanged. - 2026-11-04: New Document: the units chosen in Preset Details now belong to the chosen document, as the pane's options are listed for the selected preset; the chosen card shows them, every other Recent and Saved card keeps the units its document or preset was made in, and the built-in tabs still follow the chosen units, so switching between inches and millimetres no longer restyles every recent template. Scores and estimates unchanged. - 2026-11-14: Packaging Tools add-on (Object › Plug-ins › Packaging Tools): fold line roles for dielines (Cut, Crease, Partial Cut, Perforation), each carried by the swatch on a path's top stroke through a per-document role table that native files keep; PDF prints a role line on its swatch's separation when that swatch is a spot color, as the default role swatches are, and SVG, DXF and HP-GL keep the stroke's color. Make Cut Line, Make Crease Line, Make Partial Cut Line and Make Perforation Line give the selected paths a role, overprinting by default, and make a missing role swatch; the Fold Lines panel counts each role in the selection or the document, and its Role Swatches… picks another swatch for a role (`addon.packaging.setRole`, `addon.packaging.roles`, `addon.packaging.setRoleSwatch`). A VectorCraft addition: headline numbers unchanged. +- 2026-11-16: Check Fold Lines in the Packaging Tools add-on (Object › Plug-ins › Packaging Tools, and the Fold Lines panel's Check button): the fold lines of the selection or the document are split into blanks, panels and hinges (cut lines bound the material, and creases, partial cuts and perforations divide it into panels), and 15 kinds of issue are listed, errors and warnings, each naming its lines: cut lines that enclose nothing or end loose, gaps closed within a tolerance, a cut on top of a crease, duplicate lines, creases that end inside a panel, divide nothing, lie outside the blank or are not straight, gaps too narrow to map, fold lines in a hole, panels joined by no crease, and fold lines on a non-printing layer. The panel lists the issues in the interface language; clicking one selects its lines (`addon.packaging.check`). A VectorCraft addition: headline numbers unchanged. - 2026-11-02: Mouse wheel over a closed font-family field in Character, Properties or Control changes selected text through the family list using saved font filters (excluding search text), one undo step per notch, stopping at the ends (#5253). Scores and estimates unchanged. - 2026-10-31: Pattern libraries: Window › Swatch Libraries › Patterns and the Swatches panel's library menu open Geometric Patterns, a built-in library of eleven pattern swatches (dots, stripes, checks, a grid and shapes); clicking one adds its pattern and swatch to the document, once, and applies it to the active fill or stroke (`swatch.library.add`). - 2026-11-11: Pattern libraries: Patterns › Grit Textures, a second built-in pattern library, holds eight seamless black textures (Fine Grain, Coarse Grit, Sand, Speckle, Stipple, Scratches, Sparse Flecks and Dense Flecks) on tiles of 18 to 36 pt, each drawn the same way every time; marks that reach past a tile edge continue on the next tile, so the tiles join without a seam (`swatch.library.add`). Scores and estimates unchanged. diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index b46678804b..099f46c028 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -29,6 +29,8 @@ vectorcraft-tools = { workspace = true } vectorcraft-text = { workspace = true } vectorcraft-render = { workspace = true } vectorcraft-pathops = { workspace = true } +# The panels and hinges of a packaging blank (Packaging Tools' Check Fold Lines). +vectorcraft-three-d = { workspace = true } vectorcraft-brush = { workspace = true } vectorcraft-trace = { workspace = true } vectorcraft-svg = { workspace = true } diff --git a/crates/engine/src/cmd/addons/packaging.rs b/crates/engine/src/cmd/addons/packaging.rs index 7e262c3869..6099386b98 100644 --- a/crates/engine/src/cmd/addons/packaging.rs +++ b/crates/engine/src/cmd/addons/packaging.rs @@ -1,9 +1,11 @@ //! Packaging Tools (`addon.packaging.*`), a built-in add-on for the dielines of boxes and other //! folded packaging. A path is a fold line when its top stroke is painted with the swatch of a line //! role: Cut, Crease, Partial Cut or Perforation ([`roles`]). The document's role table maps each -//! role to its swatch, so every format that keeps the stroke's swatch keeps the role. Its submenu +//! role to its swatch, so every format that keeps the stroke's swatch keeps the role. Check Fold +//! Lines ([`check`]) finds the panels and hinges the lines make and what is wrong with them. Its submenu //! (Object › Plug-ins › Packaging Tools) and its Fold Lines panel are the UI's. +mod check; mod roles; pub(crate) use roles::{role_swatch_edited, role_swatches_merged}; @@ -11,7 +13,9 @@ pub(crate) use roles::{role_swatch_edited, role_swatches_merged}; use super::super::CommandSpec; pub fn specs() -> Vec { - roles::specs() + let mut v = roles::specs(); + v.extend(check::specs()); + v } #[cfg(test)] diff --git a/crates/engine/src/cmd/addons/packaging/check.rs b/crates/engine/src/cmd/addons/packaging/check.rs new file mode 100644 index 0000000000..59f195d4df --- /dev/null +++ b/crates/engine/src/cmd/addons/packaging/check.rs @@ -0,0 +1,176 @@ +//! Check Fold Lines (`addon.packaging.check`): the blanks the fold lines make, their panels and +//! hinges, and what is wrong with the lines, found by [`vectorcraft_three_d::fold::blanks`]. + +use serde_json::{Value, json}; +use vectorcraft_doc::{Document, Node, NodeId, NodeKind}; +use vectorcraft_geom::PathData; +use vectorcraft_three_d::fold::{FoldLine, IssueCode, LineKind, MAX_SEGMENTS, blanks}; + +use super::super::super::pathops::length_given; +use super::super::super::{CommandSpec, bad, checked_ids_or_selection, cmd, has_doc, switch_or}; +use super::roles::{Role, RoleTable, can_carry, role_targets}; +use crate::{Result, Session}; + +const CHECK: &str = "addon.packaging.check"; + +/// How far apart the ends of two lines may be and still be joined, in points. +const TOLERANCE: (f64, f64, f64) = (0.01, 0.1, 10.0); + +pub fn specs() -> Vec { + vec![cmd!( + "addon.packaging.check", + "Check Fold Lines", + ["Object", "Plug-ins", "Packaging Tools"], + None, + "{ids?: [id…] (default: the selection), select?: bool (false), tolerance?: pt 0.01..10 (0.1)} check the fold lines (addon.packaging.roles) among the objects (through groups and clip groups), or, while nothing is selected and ids is left out, every fold line of the document that is shown. Cut lines bound the blanks: each connected piece of them that encloses material is one blank, its outline is its largest closed cut line, and a closed cut line inside it is a hole, so a slot drawn as a rectangle across the outline leaves the same material as a notch drawn in it; open cut lines that meet end to end count as one closed cut line. Crease, Partial Cut and Perforation lines divide a blank into panels; the pieces of them between two panels are that pair's hinge. A cut line end that comes within tolerance of another cut line is joined to it. Issues, in this order: noCut, open, looseEnd (errors), gap (a warning: the gap is closed), tooComplex (an error: more than 65,536 segments or 256 panels in a blank), cutOverCrease (an error), duplicate, danglingCrease, noSplit, outside, notStraight (it folds along the line through its longest piece), sliver, ambiguous, loosePanel (joined to the largest panel by no chain of hinges), nonPrinting (warnings). With select, the objects the issues name become the selection, unless no issue names one. Changes nothing in the document → {ok (no error), blanks, panels, hinges, holes, issues: [{severity: error|warning, code, message (English), ids, at?: [x, y]}], scope: ids|selection|document}", + has_doc, + check + )] +} + +/// The English message for an issue (the Fold Lines panel shows it in the interface language). +fn message(code: IssueCode, scope: &str) -> &'static str { + match code { + IssueCode::NoCut if scope == "document" => "No cut lines are in the document.", + IssueCode::NoCut => "No cut lines are in the selection.", + IssueCode::Open => "The cut lines do not enclose an area.", + IssueCode::LooseEnd => "A cut line ends without meeting another cut line.", + IssueCode::Gap => "A gap between cut lines was closed.", + IssueCode::TooComplex => "The fold lines are too complex to check.", + IssueCode::CutOverCrease => "A cut line and a crease lie on top of each other.", + IssueCode::Duplicate => "Two lines of the same role lie on top of each other.", + IssueCode::DanglingCrease => "A crease ends inside a panel.", + IssueCode::NoSplit => "A crease does not divide two panels.", + IssueCode::Outside => "A crease lies outside the cut outline.", + IssueCode::NotStraight => "A crease that is not straight is folded along one straight line.", + IssueCode::Sliver => "A gap between cut lines is too narrow to tell apart.", + IssueCode::Ambiguous => "A cut-out area holds other fold lines.", + IssueCode::LoosePanel => "A panel is not joined to the rest by a crease.", + IssueCode::NonPrinting => "A fold line is on a non-printing layer.", + } +} + +/// Every object of the document that can carry a role and is shown: on a shown layer, in shown +/// groups, and shown itself. +fn shown_targets(d: &Document) -> Vec { + fn walk(n: &Node, out: &mut Vec) { + if !n.visible { + return; + } + match &n.kind { + NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } => children.iter().for_each(|c| walk(c, out)), + _ if can_carry(n) => out.push(n.id), + _ => {} + } + } + let mut out = vec![]; + d.layers.iter().for_each(|l| walk(l, &mut out)); + out +} + +/// The path of object `n` in document coordinates: a path's own, or a compound path's members'. +fn path_of(n: &Node) -> Option { + match &n.kind { + NodeKind::Path { path, .. } => Some(path.clone()), + NodeKind::Compound { children, .. } => Some(PathData::new( + children + .iter() + .filter_map(|c| match &c.kind { + NodeKind::Path { path, .. } => Some(path.subpaths.iter().cloned()), + _ => None, + }) + .flatten() + .collect(), + )), + _ => None, + } +} + +/// Whether object `id` is on a layer, or a sublayer, that does not print. +fn on_non_printing_layer(d: &Document, id: NodeId) -> bool { + d.ancestry(id).unwrap_or_default().iter().filter_map(|a| d.node(*a)).any(|n| matches!(n.kind, NodeKind::Layer { printable: false, .. })) +} + +fn kind(role: Role) -> LineKind { + match role { + Role::Cut => LineKind::Cut, + Role::Crease => LineKind::Crease, + Role::PartialCut => LineKind::PartialCut, + Role::Perforation => LineKind::Perforation, + } +} + +fn check(s: &mut Session, p: &Value) -> Result { + let select = switch_or(p, "select", false, CHECK)?; + let tolerance = match length_given(p, "tolerance", CHECK)? { + None => TOLERANCE.1, + Some(t) if (TOLERANCE.0..=TOLERANCE.2).contains(&t) => t, + Some(_) => return Err(bad(CHECK, format!("`tolerance` must be from {} to {} pt", TOLERANCE.0, TOLERANCE.2))), + }; + let given = p.get("ids").is_some_and(|v| !v.is_null()); + let roots = checked_ids_or_selection(s, p, CHECK)?; + let d = &s.doc()?.doc; + let (scope, targets) = match (given, roots.is_empty()) { + (true, _) => ("ids", role_targets(d, &roots, false).0), + (false, false) => ("selection", role_targets(d, &roots, false).0), + (false, true) => ("document", shown_targets(d)), + }; + let table = RoleTable::of(d); + let mut lines = vec![]; + let mut non_printing = vec![]; + let mut segments = 0usize; + for id in targets { + // Once the lines have more segments than the check takes, it reports them as too complex: + // the rest are not copied. + if segments > MAX_SEGMENTS { + break; + } + let Some(n) = d.node(id) else { continue }; + let (Some(role), Some(path)) = (table.role_of(n), path_of(n)) else { continue }; + if on_non_printing_layer(d, id) { + non_printing.push(id.0); + } + segments = segments.saturating_add(path.subpaths.iter().map(|sp| sp.segment_count()).sum()); + lines.push(FoldLine { path, kind: kind(role), angle: None, key: id.0 }); + } + let (found, mut issues) = blanks(&lines, tolerance); + if !non_printing.is_empty() { + issues.push(vectorcraft_three_d::fold::Issue { code: IssueCode::NonPrinting, keys: non_printing, at: None }); + } + let ok = !issues.iter().any(|i| i.code.is_error()); + let rows: Vec = issues + .iter() + .map(|i| { + let mut row = json!({ + "severity": if i.code.is_error() { "error" } else { "warning" }, + "code": i.code.id(), + "message": message(i.code, scope), + "ids": i.keys, + }); + if let (Some(at), Some(o)) = (i.at, row.as_object_mut()) { + o.insert("at".into(), json!([at.x, at.y])); + } + row + }) + .collect(); + if select { + let mut ids: Vec = issues.iter().flat_map(|i| i.keys.iter().map(|k| NodeId(*k))).filter(|id| d.node(*id).is_some()).collect(); + ids.sort_unstable_by_key(|id| id.0); + ids.dedup(); + if !ids.is_empty() { + s.select(|_, sel| sel.set(ids.iter().copied()))?; + } + } + Ok(json!({ + "ok": ok, + "blanks": found.len(), + "panels": found.iter().map(|b| b.panels.len()).sum::(), + "hinges": found.iter().map(|b| b.hinges.len()).sum::(), + "holes": found.iter().map(|b| b.holes.len()).sum::(), + "issues": rows, + "scope": scope, + })) +} + +#[cfg(test)] +mod tests; diff --git a/crates/engine/src/cmd/addons/packaging/check/tests.rs b/crates/engine/src/cmd/addons/packaging/check/tests.rs new file mode 100644 index 0000000000..427656fc29 --- /dev/null +++ b/crates/engine/src/cmd/addons/packaging/check/tests.rs @@ -0,0 +1,165 @@ +//! Tests for Check Fold Lines: the blanks, panels, hinges and issues of fold lines drawn in a +//! document. + +use serde_json::{Value, json}; + +use crate::*; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 600, "height": 600})).unwrap(); + s +} + +fn path(s: &mut Session, d: &str) -> u64 { + s.execute("path.create", &json!({ "d": d })).unwrap()["id"].as_u64().unwrap() +} + +fn role(s: &mut Session, role: &str, ids: &[u64]) { + s.execute("addon.packaging.setRole", &json!({ "role": role, "ids": ids })).unwrap(); +} + +fn check(s: &mut Session, p: Value) -> Value { + s.execute("addon.packaging.check", &p).unwrap() +} + +fn codes(r: &Value) -> Vec<&str> { + r["issues"].as_array().unwrap().iter().map(|i| i["code"].as_str().unwrap()).collect() +} + +/// A tray blank: a 100 pt base with a 40 pt wall on each side, its outline a cut line and the +/// base's four sides creases → (outline, creases). +fn tray(s: &mut Session) -> (u64, Vec) { + let outline = path(s, "M140 100 L240 100 L240 140 L280 140 L280 240 L240 240 L240 280 L140 280 L140 240 L100 240 L100 140 L140 140 Z"); + let creases = vec![path(s, "M140 140 L240 140"), path(s, "M240 140 L240 240"), path(s, "M240 240 L140 240"), path(s, "M140 240 L140 140")]; + role(s, "cut", &[outline]); + role(s, "crease", &creases); + s.execute("select.none", &json!({})).unwrap(); + (outline, creases) +} + +#[test] +fn a_tray_checks_clean_with_five_panels_and_four_hinges() { + let mut s = session(); + tray(&mut s); + let steps = s.doc().unwrap().history.undo.len(); + let r = check(&mut s, json!({})); + assert_eq!(r["ok"], true, "{r}"); + assert_eq!((r["blanks"].as_u64(), r["panels"].as_u64(), r["hinges"].as_u64(), r["holes"].as_u64()), (Some(1), Some(5), Some(4), Some(0)), "{r}"); + assert!(codes(&r).is_empty(), "{r}"); + assert_eq!(r["scope"], "document"); + assert_eq!(s.doc().unwrap().history.undo.len(), steps, "a check records no undo step"); +} + +#[test] +fn the_selection_or_ids_limit_the_check_to_their_lines() { + let mut s = session(); + let (outline, creases) = tray(&mut s); + s.execute("select.set", &json!({ "ids": [creases[0]] })).unwrap(); + let r = check(&mut s, json!({})); + assert_eq!((r["scope"].as_str(), r["ok"].as_bool()), (Some("selection"), Some(false))); + assert_eq!(codes(&r), ["noCut"]); + assert_eq!(r["issues"][0]["message"], "No cut lines are in the selection."); + let r = check(&mut s, json!({ "ids": [outline] })); + assert_eq!((r["scope"].as_str(), r["ok"].as_bool(), r["panels"].as_u64()), (Some("ids"), Some(true), Some(1)), "{r}"); + // No fold lines at all in the document. + let mut s = session(); + let r = check(&mut s, json!({})); + assert_eq!(codes(&r), ["noCut"]); + assert_eq!(r["issues"][0]["message"], "No cut lines are in the document."); +} + +#[test] +fn issues_name_their_lines_and_select_selects_them() { + let mut s = session(); + let (_, creases) = tray(&mut s); + // A slit from the outline that stops in the middle of the base. + let slit = path(&mut s, "M190 100 L190 190"); + role(&mut s, "cut", &[slit]); + s.execute("select.none", &json!({})).unwrap(); + let r = check(&mut s, json!({})); + assert_eq!(r["ok"], false); + let loose = r["issues"].as_array().unwrap().iter().find(|i| i["code"] == "looseEnd").cloned().unwrap(); + assert_eq!((loose["severity"].as_str(), loose["ids"].clone()), (Some("error"), json!([slit])), "{r}"); + assert_eq!(loose["at"], json!([190.0, 190.0])); + assert!(s.doc().unwrap().selection.objects.is_empty(), "without select, the selection stays"); + let r = check(&mut s, json!({ "select": true })); + let named: std::collections::BTreeSet = + r["issues"].as_array().unwrap().iter().flat_map(|i| i["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap())).collect(); + let selected: std::collections::BTreeSet = s.doc().unwrap().selection.objects.iter().map(|id| id.0).collect(); + assert!(selected.contains(&slit) && selected == named, "{selected:?} {named:?}"); + assert!(!selected.contains(&creases[1])); +} + +#[test] +fn a_clean_check_with_select_leaves_the_selection_alone() { + let mut s = session(); + let (outline, _) = tray(&mut s); + s.execute("select.set", &json!({ "ids": [outline] })).unwrap(); + let r = check(&mut s, json!({ "ids": [outline], "select": true })); + assert!(codes(&r).is_empty(), "{r}"); + assert_eq!(s.doc().unwrap().selection.objects.iter().map(|id| id.0).collect::>(), [outline]); +} + +#[test] +fn tolerance_is_checked_and_joins_gaps_up_to_it() { + let mut s = session(); + tray(&mut s); + for bad in [json!(0.005), json!(10.5), json!("x"), json!(true)] { + let e = s.execute("addon.packaging.check", &json!({ "tolerance": bad })).unwrap_err().to_string(); + assert!(e.contains("tolerance"), "{e}"); + } + let e = s.execute("addon.packaging.check", &json!({ "select": 1 })).unwrap_err().to_string(); + assert!(e.contains("select"), "{e}"); + for edge in [json!(0.01), json!(10), json!("2 mm")] { + assert_eq!(check(&mut s, json!({ "tolerance": edge }))["ok"], true); + } + // A slit that stops 0.5 pt short of a crease: a gap at a tolerance of 1 pt, a loose end at 0.1 pt. + let mut s = session(); + tray(&mut s); + let slit = path(&mut s, "M190 100 L190 139.5"); + role(&mut s, "cut", &[slit]); + s.execute("select.none", &json!({})).unwrap(); + assert!(codes(&check(&mut s, json!({ "tolerance": 0.1 }))).contains(&"looseEnd")); + let near = check(&mut s, json!({ "tolerance": 1 })); + assert!(!codes(&near).contains(&"looseEnd"), "{near}"); +} + +#[test] +fn hidden_lines_are_left_out_and_lines_on_a_non_printing_layer_are_noted() { + let mut s = session(); + let (_, creases) = tray(&mut s); + // A hidden crease is not checked while nothing is selected: the tray has three hinges and a + // panel joined by none. + s.execute("layer.setProps", &json!({ "ids": [creases[0]], "visible": false })).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let r = check(&mut s, json!({})); + assert_eq!((r["panels"].as_u64(), r["hinges"].as_u64()), (Some(4), Some(3)), "{r}"); + // A cut line on a layer that does not print. + let mut s = session(); + s.execute("layer.new", &json!({ "printable": false })).unwrap(); + let (outline, _) = tray(&mut s); + let r = check(&mut s, json!({})); + assert_eq!(r["ok"], true, "a warning only"); + let note = r["issues"].as_array().unwrap().iter().find(|i| i["code"] == "nonPrinting").cloned().unwrap(); + assert_eq!(note["severity"], "warning"); + assert!(note["ids"].as_array().unwrap().contains(&json!(outline)), "{note}"); + assert_eq!(note["message"], "A fold line is on a non-printing layer."); +} + +#[test] +fn a_compound_path_and_a_grouped_line_are_checked() { + let mut s = session(); + let (outline, creases) = tray(&mut s); + // A window: a closed cut line in the base, made a compound path with nothing else. + let window = path(&mut s, "M170 170 L210 170 L210 210 L170 210 Z"); + s.execute("select.set", &json!({ "ids": [window] })).unwrap(); + let compound = s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64(); + let window = compound.unwrap_or(window); + role(&mut s, "cut", &[window]); + s.execute("select.set", &json!({ "ids": [outline, creases[0], creases[1], creases[2], creases[3], window] })).unwrap(); + s.execute("object.group", &json!({})).unwrap(); + let r = check(&mut s, json!({})); + assert_eq!(r["scope"], "selection"); + assert_eq!((r["ok"].as_bool(), r["panels"].as_u64(), r["holes"].as_u64()), (Some(true), Some(5), Some(1)), "{r}"); +} diff --git a/crates/engine/src/cmd/addons/packaging/roles.rs b/crates/engine/src/cmd/addons/packaging/roles.rs index 010384c6c2..2b3c7696f3 100644 --- a/crates/engine/src/cmd/addons/packaging/roles.rs +++ b/crates/engine/src/cmd/addons/packaging/roles.rs @@ -186,7 +186,7 @@ fn free_role_name(d: &Document, table: &RoleTable, role: Role) -> String { /// Whether `n` can carry a role: a path (a live shape too) that is neither a clipping path nor a /// guide, or a compound path. -fn can_carry(n: &Node) -> bool { +pub(super) fn can_carry(n: &Node) -> bool { match &n.kind { NodeKind::Path { clipping, guide, .. } => !clipping && !guide, NodeKind::Compound { .. } => true, @@ -199,7 +199,7 @@ fn can_carry(n: &Node) -> bool { /// how many of `roots` and their members can't (text, images, symbol instances and other objects). /// With `editable`, objects that are locked or hidden, are in a locked or hidden group or layer, or /// are on a locked artboard are left out and counted as skipped. -fn role_targets(d: &Document, roots: &[NodeId], editable: bool) -> (Vec, usize) { +pub(super) fn role_targets(d: &Document, roots: &[NodeId], editable: bool) -> (Vec, usize) { fn walk(n: &Node, out: &mut Vec, skipped: &mut usize) { match &n.kind { NodeKind::Group { children, .. } => { diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 75313d4e4c..1338bb5776 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -40,6 +40,7 @@ pub(super) const ALLOWED: &[&str] = &[ "addon.image.colorMask", "addon.image.removeBackground", "addon.image.removeColorMask", + "addon.packaging.check", "addon.packaging.roles", "addon.packaging.setRole", "addon.packaging.setRoleSwatch", diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index a4c6c1af40..d8c01c6545 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -1011,6 +1011,9 @@ fn structured_junk() { ("addon.packaging.roles", json!({"ids": [-1, 1e300]})), ("addon.packaging.setRoleSwatch", json!({"role": "perforation", "swatch": "[Registration]"})), ("addon.packaging.setRoleSwatch", json!({"role": "cut", "swatch": 5})), + ("addon.packaging.check", json!({"ids": [u64::MAX, -1], "select": "yes", "tolerance": 1e308})), + ("addon.packaging.check", json!({"tolerance": "-5 mm", "select": true})), + ("addon.packaging.check", json!({"ids": [], "tolerance": null})), // Smart Pen add-on. ("addon.pen.append", json!({"id": 2, "x": 1e308, "y": 0, "in": [1e308, -1e308]})), ("addon.pen.append", json!({"id": 2, "subpath": u64::MAX, "x": 0, "y": 0, "segment": "curved"})), diff --git a/crates/pathops/README.md b/crates/pathops/README.md index 08380830b2..2397045a84 100644 --- a/crates/pathops/README.md +++ b/crates/pathops/README.md @@ -61,6 +61,14 @@ Unlike `regions`, which splits the filled areas of closed shapes, `live_paint` t `shape_builder` gives the Shape Builder's regions. With closed paths only, they are the `regions`. Once an open path is among them, they are the `live_paint` faces, so a stroke-only line across a shape splits it and lines can enclose a region of their own. The second list holds the pieces of each path that has no closed subpath, keyed by its index, so the Shape Builder can delete them one by one. The caller closes any open path whose fill should count. Inputs with more than `SHAPE_BUILDER_MAX_SEGMENTS` segments fall back to the filled areas. +```rust +pub struct Adjacency { pub faces: Vec, pub edges: Vec, pub slivers: Vec, pub outlines: Vec } +pub struct MapEdge { pub path: PathData, pub sources: Vec, pub left: Option, pub right: Option, pub piece: usize } +pub fn adjacency(shapes: &[Shape], precision: f64) -> Option; +``` + +`adjacency` maps the paths as `live_paint` does and also reports, for each edge, every input it lies on and the faces on its left and right as it runs along its path (document coordinates, y down). A line drawn on top of another keeps both inputs on the edge, whatever the input order. A piece of line that ends inside a face has that face on both sides. Faces narrower than `precision` are listed as slivers, and `outlines` holds the outer boundary of each connected piece of the paths. It returns `None` for more than `SHAPE_BUILDER_MAX_SEGMENTS` segments, non-finite input or a `precision` that is not a positive number. + ## Offset / stroke ```rust diff --git a/crates/pathops/src/lib.rs b/crates/pathops/src/lib.rs index 49b7c051f1..d35050f70c 100644 --- a/crates/pathops/src/lib.rs +++ b/crates/pathops/src/lib.rs @@ -30,8 +30,8 @@ pub use fit::{fit_cubics, fit_cubics_through}; pub use offset::{Cap, Join, MAX_OFFSET_SEGMENT_PAIRS, offset_path, outline_stroke, stroke_region, try_offset_path}; pub use pathfinder::{FaceMerger, PathfinderOp, Region, Shape, merge_regions, pathfinder, pathfinder_with, region_at, regions, regions_within}; pub use planar::{ - BuilderArrangement, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_SEGMENTS, cut_out, encloses_area, find_gaps, has_open_path, interior_point, - live_paint, live_paint_with_gaps, run_around, shape_builder, shape_builder_with_gap, + Adjacency, BuilderArrangement, MapEdge, MapFace, MapOutline, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_SEGMENTS, adjacency, cut_out, + encloses_area, find_gaps, has_open_path, interior_point, live_paint, live_paint_with_gaps, run_around, shape_builder, shape_builder_with_gap, }; pub use trap::{TRAP_HEIGHT_WIDTH_RANGE, TRAP_MAX_WIDTH, TRAP_MIN_WIDTH, trap_band}; diff --git a/crates/pathops/src/planar.rs b/crates/pathops/src/planar.rs index 75234b3943..f702f993ed 100644 --- a/crates/pathops/src/planar.rs +++ b/crates/pathops/src/planar.rs @@ -26,12 +26,14 @@ use vectorcraft_geom::{FillRule, PathData, SubPath}; use crate::boolean::{DEFAULT_PRECISION, Seg, Tidy, eps_for, is_sliver, segs_to_subpath, snap_horizontals, tidy_segments, to_seg}; use crate::pathfinder::{Region, Shape}; +mod adjacency; mod graph; mod index; mod live_paint; mod map; mod shape_builder; +pub use adjacency::{Adjacency, MapEdge, MapFace, MapOutline, adjacency}; pub(crate) use graph::pin_ends; #[cfg(test)] use index::{Crossings, RectIndex, reference_budget, segment_footprint, work_done}; diff --git a/crates/pathops/src/planar/adjacency.rs b/crates/pathops/src/planar/adjacency.rs new file mode 100644 index 0000000000..52357a0d67 --- /dev/null +++ b/crates/pathops/src/planar/adjacency.rs @@ -0,0 +1,169 @@ +//! Which faces of a planar map each edge separates, and every input each edge lies on. +//! +//! [`live_paint`](super::live_paint) gives each edge under its front-most input only, and says +//! nothing about the faces on its sides. [`adjacency`] reads both from the same planar map, so a +//! caller can tell which faces a line divides and which lines lie on top of each other. + +use super::graph::{find, half_segs, twin, unshear}; +use super::index::RectIndex; +use super::map::{Map, map_with}; +use super::*; + +/// A planar map of some paths with each edge's sides and inputs ([`adjacency`]). +#[derive(Clone, Debug, Default)] +pub struct Adjacency { + pub faces: Vec, + pub edges: Vec, + /// Bounded areas left out as slivers: narrower than the precision on average, such as a thin + /// gap between two lines. + pub slivers: Vec, + /// The outer boundary of each connected piece of the paths. + pub outlines: Vec, +} + +/// A bounded face: its outline, then the outer boundaries of the pieces inside it (as holes), and +/// its area without them. +#[derive(Clone, Debug)] +pub struct MapFace { + pub path: PathData, + pub area: f64, + /// The connected piece of the paths whose edges bound it. + pub piece: usize, +} + +/// An edge: a piece of one or more inputs between two places where paths meet. +#[derive(Clone, Debug)] +pub struct MapEdge { + pub path: PathData, + /// Every input it lies on (indices into the inputs, ascending). + pub sources: Vec, + /// The faces on each side of it as it runs along `path`, seen on the page (document + /// coordinates, y down): `left` on the left. `None` outside every bounded face, or in a sliver. + /// A piece of line that ends loose inside a face has that face on both sides. + pub left: Option, + pub right: Option, + pub piece: usize, +} + +/// The outer boundary of a connected piece of the paths. +#[derive(Clone, Debug)] +pub struct MapOutline { + pub path: PathData, + pub piece: usize, +} + +/// The planar map of `shapes`, every path an edge as in [`live_paint`](super::live_paint), with +/// faces refit to `precision` and slivers narrower than it left out. `None` when the paths can't be +/// swept (non-finite, too degenerate, or more than [`SHAPE_BUILDER_MAX_SEGMENTS`] segments), when +/// `precision` is not a positive number, and when no path has two anchors. +pub fn adjacency(shapes: &[Shape], precision: f64) -> Option { + if !(precision.is_finite() && precision > 0.0) { + return None; + } + let segments: usize = shapes.iter().flat_map(|s| &s.path.subpaths).map(SubPath::segment_count).sum(); + if segments > SHAPE_BUILDER_MAX_SEGMENTS { + return None; + } + let m = map_with(shapes, false, precision)?; + Some(read(&m)) +} + +fn read(m: &Map) -> Adjacency { + let path = |cycle: &[usize], closed: bool| { + let segs: Vec = cycle.iter().flat_map(|&h| half_segs(&m.edges, h)).collect(); + segs_to_subpath(&tidy_segments(segs, closed, &m.tidy), closed) + }; + let unsheared = |subpaths: Vec| unshear(PathData::new(subpaths), &m.anchors, m.snap); + + // Connected pieces, by the vertices the edges join, numbered in the order they are first met. + let vertices = m.edges.iter().flat_map(|e| e.ends).max().map_or(0, |v| v + 1); + let mut parent: Vec = (0..vertices).collect(); + for e in &m.edges { + let (a, b) = (find(&mut parent, e.ends[0]), find(&mut parent, e.ends[1])); + if let Some(p) = parent.get_mut(a) { + *p = b; + } + } + let mut number: Vec> = vec![None; vertices]; + let mut pieces = 0; + let mut piece_of_vertex = |v: usize| { + let root = find(&mut parent, v); + match number.get_mut(root) { + Some(Some(n)) => *n, + Some(slot) => { + *slot = Some(pieces); + pieces += 1; + pieces - 1 + } + None => 0, + } + }; + let edge_pieces: Vec = m.edges.iter().map(|e| piece_of_vertex(e.ends[0])).collect(); + let piece_of = |cycle: &[usize]| cycle.first().and_then(|&h| edge_pieces.get(h / 2)).copied().unwrap_or(0); + + // The face on each half-edge's side: a face's own cycle, and the outer boundaries of the + // pieces inside it, bound it. + let mut face_of: Vec> = vec![None; 2 * m.edges.len()]; + let mut faces = Vec::with_capacity(m.faces.len()); + for (i, (cycle, _, area)) in m.faces.iter().enumerate() { + let holes: Vec<&(Vec, BezPath)> = m.face_holes.get(i).into_iter().flatten().filter_map(|&k| m.holes.get(k)).collect(); + for &h in cycle.iter().chain(holes.iter().flat_map(|(c, _)| c)) { + if let Some(f) = face_of.get_mut(h) { + *f = Some(i); + } + } + let mut subpaths: Vec = path(cycle, true).into_iter().collect(); + subpaths.extend(holes.iter().filter_map(|(c, _)| path(c, true))); + // A hole's outer boundary winds the other way: its area is negative. + let area = area + holes.iter().map(|(_, bp)| bp.area()).sum::(); + faces.push(MapFace { path: unsheared(subpaths), area, piece: piece_of(cycle) }); + } + + // A face walk leaves out the edges that end loose (spurs): such an edge lies inside the face + // around its middle, on both sides. + let mut on_cycle = vec![false; 2 * m.edges.len()]; + let cycles = m.faces.iter().map(|f| &f.0).chain(m.holes.iter().map(|h| &h.0)).chain(m.slivers.iter().map(|s| &s.0)); + for &h in cycles.flatten() { + if let Some(c) = on_cycle.get_mut(h) { + *c = true; + } + } + let spur = |e: usize| !on_cycle.get(2 * e).copied().unwrap_or(true) && !on_cycle.get(twin(2 * e)).copied().unwrap_or(true); + // The faces by their bounds, so that each spur tests only the faces whose bounds hold it; + // built only when there is a spur. + let bezpaths: Vec = if (0..m.edges.len()).any(spur) { faces.iter().map(|f| f.path.to_bezpath()).collect() } else { vec![] }; + let face_index = RectIndex::new(bezpaths.iter().enumerate().map(|(i, bp)| (bp.bounding_box(), i)).collect()); + let face_around = |p: Point| { + face_index + .at(p, 0.0) + .copied() + .filter(|&i| bezpaths.get(i).is_some_and(|bp| bp.winding(p) != 0)) + .min_by(|&a, &b| faces.get(a).map_or(f64::INFINITY, |f| f.area).total_cmp(&faces.get(b).map_or(f64::INFINITY, |f| f.area))) + }; + + // A face cycle winds so its face is on the side where the cross product of the half-edge's + // direction and the way to the face is positive: on the page, with y down, that is the right. + let edges = m + .edges + .iter() + .enumerate() + .filter_map(|(e, edge)| { + let sp = path(&[2 * e], false)?; + let path = unsheared(vec![sp]); + let (left, right) = if spur(e) { + let around = path.to_bezpath().segments().next().map(|s| s.eval(0.5)).and_then(face_around); + (around, around) + } else { + (face_of.get(twin(2 * e)).copied().flatten(), face_of.get(2 * e).copied().flatten()) + }; + Some(MapEdge { path, sources: edge.sources.clone(), left, right, piece: edge_pieces.get(e).copied().unwrap_or(0) }) + }) + .collect(); + let slivers = m.slivers.iter().filter_map(|(cycle, _)| path(cycle, true)).map(|sp| unsheared(vec![sp])).collect(); + let outlines = + m.holes.iter().filter_map(|(cycle, _)| Some(MapOutline { path: unsheared(vec![path(cycle, true)?]), piece: piece_of(cycle) })).collect(); + Adjacency { faces, edges, slivers, outlines } +} + +#[cfg(test)] +mod tests; diff --git a/crates/pathops/src/planar/adjacency/tests.rs b/crates/pathops/src/planar/adjacency/tests.rs new file mode 100644 index 0000000000..8677a7e11a --- /dev/null +++ b/crates/pathops/src/planar/adjacency/tests.rs @@ -0,0 +1,200 @@ +use super::*; +use kurbo::{ParamCurveNearest, Vec2}; +use proptest::prelude::*; +use vectorcraft_geom::{FillRule, Rect, shapes}; + +fn line(a: (f64, f64), b: (f64, f64)) -> Shape { + Shape::new(PathData::single(SubPath::polyline(&[Point::new(a.0, a.1), Point::new(b.0, b.1)], false)), FillRule::NonZero, 0) +} + +fn rect(x0: f64, y0: f64, x1: f64, y1: f64) -> Shape { + Shape::new(shapes::rectangle(Rect::new(x0, y0, x1, y1)), FillRule::NonZero, 0) +} + +fn inside(f: &MapFace, p: Point) -> bool { + f.path.to_bezpath().winding(p) != 0 +} + +/// The edges whose middle lies within 0.01 of `p`. +fn edges_at(a: &Adjacency, p: Point) -> Vec<&MapEdge> { + a.edges + .iter() + .filter(|e| { + let bp = e.path.to_bezpath(); + bp.segments().any(|s| { + let n = s.nearest(p, 1e-6); + n.distance_sq < 1e-4 + }) + }) + .collect() +} + +#[test] +fn a_line_across_a_rectangle_divides_two_faces_it_lies_between() { + let a = adjacency(&[rect(0.0, 0.0, 100.0, 50.0), line((40.0, -10.0), (40.0, 60.0))], DEFAULT_PRECISION).unwrap(); + assert_eq!(a.faces.len(), 2, "{:?}", a.faces); + let left_face = a.faces.iter().position(|f| inside(f, Point::new(20.0, 25.0))).unwrap(); + let right_face = a.faces.iter().position(|f| inside(f, Point::new(70.0, 25.0))).unwrap(); + assert_ne!(left_face, right_face); + assert!((a.faces[left_face].area - 2000.0).abs() < 1e-6 && (a.faces[right_face].area - 3000.0).abs() < 1e-6); + let shared = edges_at(&a, Point::new(40.0, 25.0)); + assert_eq!(shared.len(), 1, "{shared:?}"); + let e = shared[0]; + assert_eq!(e.sources, vec![1]); + let mut sides = [e.left.unwrap(), e.right.unwrap()]; + sides.sort_unstable(); + let mut want = [left_face, right_face]; + want.sort_unstable(); + assert_eq!(sides, want); + // The rectangle's own sides have a face on one side only; the line's ends stick out into no face. + let side = edges_at(&a, Point::new(70.0, 0.0)); + assert_eq!(side.len(), 1); + assert_eq!([side[0].left, side[0].right].iter().flatten().count(), 1); + let stub = edges_at(&a, Point::new(40.0, -5.0)); + assert_eq!((stub[0].left, stub[0].right), (None, None)); + assert!(a.faces.iter().all(|f| f.piece == 0) && a.edges.iter().all(|e| e.piece == 0)); +} + +#[test] +fn a_line_that_ends_inside_a_face_has_that_face_on_both_sides() { + let a = adjacency(&[rect(0.0, 0.0, 100.0, 50.0), line((50.0, 0.0), (50.0, 30.0)), line((20.0, 10.0), (30.0, 20.0))], DEFAULT_PRECISION).unwrap(); + assert_eq!(a.faces.len(), 1); + for at in [Point::new(50.0, 15.0), Point::new(25.0, 15.0)] { + let e = edges_at(&a, at); + assert_eq!(e.len(), 1, "{at:?}"); + assert_eq!((e[0].left, e[0].right), (Some(0), Some(0)), "{at:?}"); + } +} + +#[test] +fn loose_lines_in_many_faces_look_only_at_the_faces_near_them() { + // A 40 × 40 grid of separate squares, then the same with a loose line in each. + let squares: Vec = + (0..1600).map(|k| (f64::from(k % 40) * 20.0, f64::from(k / 40) * 20.0)).map(|(x, y)| rect(x, y, x + 10.0, y + 10.0)).collect(); + let started = super::super::index::work_done(); + assert_eq!(adjacency(&squares, DEFAULT_PRECISION).unwrap().faces.len(), 1600); + let plain = super::super::index::work_done() - started; + let mut all = squares.clone(); + all.extend((0..1600).map(|k| (f64::from(k % 40) * 20.0, f64::from(k / 40) * 20.0)).map(|(x, y)| line((x + 5.0, y), (x + 5.0, y + 5.0)))); + let started = super::super::index::work_done(); + let a = adjacency(&all, DEFAULT_PRECISION).unwrap(); + let work = super::super::index::work_done() - started - plain; + let loose: Vec<&MapEdge> = a.edges.iter().filter(|e| e.sources.len() == 1 && e.sources[0] >= 1600).collect(); + assert_eq!(loose.len(), 1600); + for e in loose { + let mid = e.path.to_bezpath().segments().next().unwrap().eval(0.5); + let face = a.faces.iter().position(|f| inside(f, mid)); + assert_eq!((e.left, e.right), (face, face)); + assert!(face.is_some()); + } + // Testing every face for each loose line would read 1,600 faces per line. + assert!(work <= 64 * 1600, "{work} reads"); +} + +#[test] +fn a_line_on_a_rectangle_side_keeps_both_inputs_in_either_order() { + for flip in [false, true] { + let (r, l) = (rect(0.0, 0.0, 100.0, 50.0), line((-10.0, 50.0), (110.0, 50.0))); + let shapes = if flip { vec![l, r] } else { vec![r, l] }; + let a = adjacency(&shapes, DEFAULT_PRECISION).unwrap(); + let on = edges_at(&a, Point::new(30.0, 50.0)); + assert_eq!(on.len(), 1, "flip {flip}: {on:?}"); + assert_eq!(on[0].sources, vec![0, 1], "flip {flip}"); + } +} + +#[test] +fn each_side_names_the_face_seen_on_that_side_of_the_edge() { + // A tray-like outline with a crease grid, edges drawn in every direction. + let a = adjacency( + &[ + rect(0.0, 0.0, 90.0, 60.0), + line((30.0, 0.0), (30.0, 60.0)), + line((60.0, 60.0), (60.0, 0.0)), + line((90.0, 20.0), (0.0, 20.0)), + line((0.0, 40.0), (90.0, 40.0)), + ], + DEFAULT_PRECISION, + ) + .unwrap(); + assert_eq!(a.faces.len(), 9); + let mut checked = 0; + for e in &a.edges { + let bp = e.path.to_bezpath(); + let Some(seg) = bp.segments().next() else { continue }; + let (p, d) = (seg.eval(0.5), seg.end() - seg.start()); + let n = d.normalize(); + // On the page (y down), the left of a direction (dx, dy) is (dy, -dx). + let (left_at, right_at) = (p + Vec2::new(n.y, -n.x) * 0.5, p + Vec2::new(-n.y, n.x) * 0.5); + for (side, at) in [(e.left, left_at), (e.right, right_at)] { + match side { + Some(f) => assert!(inside(&a.faces[f], at), "{e:?}"), + None => assert!(a.faces.iter().all(|f| !inside(f, at)), "{e:?}"), + } + checked += 1; + } + } + assert!(checked >= 24, "{checked}"); +} + +#[test] +fn a_slot_narrower_than_the_precision_is_a_sliver() { + let a = adjacency(&[rect(0.0, 0.0, 100.0, 50.0), rect(50.0, 10.0, 50.004, 40.0)], DEFAULT_PRECISION).unwrap(); + assert_eq!(a.slivers.len(), 1, "{:?}", a.slivers); + assert_eq!(a.faces.len(), 1); + let b = adjacency(&[rect(0.0, 0.0, 100.0, 50.0), rect(50.0, 10.0, 51.0, 40.0)], DEFAULT_PRECISION).unwrap(); + assert!(b.slivers.is_empty()); + assert_eq!(b.faces.len(), 2, "the slot is a face of its own"); +} + +#[test] +fn a_ring_is_a_face_with_a_hole_and_two_pieces() { + let a = adjacency(&[rect(0.0, 0.0, 100.0, 100.0), rect(30.0, 30.0, 70.0, 70.0)], DEFAULT_PRECISION).unwrap(); + assert_eq!(a.faces.len(), 2); + let ring = a.faces.iter().find(|f| inside(f, Point::new(10.0, 10.0))).unwrap(); + assert!(!inside(ring, Point::new(50.0, 50.0)), "the inner square is a hole in the ring"); + assert!((ring.area - 8400.0).abs() < 1e-6, "{}", ring.area); + assert_eq!(a.outlines.len(), 2); + assert_ne!(a.outlines[0].piece, a.outlines[1].piece); + let inner = a.faces.iter().find(|f| inside(f, Point::new(50.0, 50.0))).unwrap(); + assert_ne!(inner.piece, ring.piece); + let inner_side = edges_at(&a, Point::new(50.0, 30.0)); + let mut sides = [inner_side[0].left, inner_side[0].right]; + sides.sort_unstable(); + assert!(sides.iter().all(Option::is_some), "a ring face on one side, the inner square on the other: {sides:?}"); +} + +#[test] +fn bad_input_gives_no_map() { + assert!(adjacency(&[], DEFAULT_PRECISION).is_none()); + assert!(adjacency(&[line((0.0, 0.0), (f64::NAN, 1.0))], DEFAULT_PRECISION).is_none()); + assert!(adjacency(&[rect(0.0, 0.0, 10.0, 10.0)], 0.0).is_none()); + assert!(adjacency(&[rect(0.0, 0.0, 10.0, 10.0)], f64::INFINITY).is_none()); + let mut points: Vec = (0..=SHAPE_BUILDER_MAX_SEGMENTS + 1).map(|i| Point::new(i as f64, (i % 2) as f64)).collect(); + let open = Shape::new(PathData::single(SubPath::polyline(&points, false)), FillRule::NonZero, 0); + assert!(adjacency(&[open], DEFAULT_PRECISION).is_none(), "over the segment limit"); + points.truncate(64); + let open = Shape::new(PathData::single(SubPath::polyline(&points, false)), FillRule::NonZero, 0); + assert!(adjacency(&[open], DEFAULT_PRECISION).is_some()); +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(64))] + /// Random lines and boxes never panic, and every side an edge names is a face. + #[test] + fn random_lines_give_a_consistent_map( + segs in proptest::collection::vec((-50.0f64..50.0, -50.0f64..50.0, -50.0f64..50.0, -50.0f64..50.0), 1..12), + boxed in any::(), + ) { + let mut shapes: Vec = segs.iter().map(|&(a, b, c, d)| line((a, b), (c, d))).collect(); + if boxed { + shapes.push(rect(-40.0, -40.0, 40.0, 40.0)); + } + if let Some(a) = adjacency(&shapes, DEFAULT_PRECISION) { + for e in &a.edges { + prop_assert!(e.left.is_none_or(|f| f < a.faces.len()) && e.right.is_none_or(|f| f < a.faces.len())); + prop_assert!(e.sources.iter().all(|&s| s < shapes.len())); + } + } + } +} diff --git a/crates/pathops/src/planar/map.rs b/crates/pathops/src/planar/map.rs index aa853b2469..a9b25d24b5 100644 --- a/crates/pathops/src/planar/map.rs +++ b/crates/pathops/src/planar/map.rs @@ -15,23 +15,23 @@ pub(crate) struct Rest { /// The planar graph of `shapes` (in the sweep's frame) with its faces walked: what [`build`] makes /// Live Paint faces and edges from, and what [`Map::merge`] merges faces in. pub(crate) struct Map { - edges: Vec, + pub(super) edges: Vec, around: Vec>, slot_of: Vec, /// Bounded faces: their cycle of half-edges, path and area; and, by their bounds, which can /// hold a point, so finding the face around one tests only those. - faces: Vec<(Vec, BezPath, f64)>, + pub(super) faces: Vec<(Vec, BezPath, f64)>, face_index: RectIndex, /// Bounded faces left out as slivers ([`is_sliver`]): their cycle of half-edges and the inputs /// whose fill covers them (none for a gap, such as a thin cutout). pub(super) slivers: Vec<(Vec, Vec)>, /// Outer boundaries of connected pieces, and the face each one is a hole in. - holes: Vec<(Vec, BezPath)>, - face_holes: Vec>, - tidy: Tidy, + pub(super) holes: Vec<(Vec, BezPath)>, + pub(super) face_holes: Vec>, + pub(super) tidy: Tidy, /// The inputs' anchors (sorted by x) and how close results snap back onto them. - anchors: Vec, - snap: f64, + pub(super) anchors: Vec, + pub(super) snap: f64, } /// With `cover`, also finds which inputs cover each sliver, which only [`Map::merge`] reads; @@ -41,7 +41,7 @@ pub(crate) fn map(shapes: &[Shape], cover: bool) -> Option { } /// [`map`] whose faces and pieces are refit to `precision`, and whose slivers thinner than it are dropped. -fn map_with(shapes: &[Shape], cover: bool, precision: f64) -> Option { +pub(super) fn map_with(shapes: &[Shape], cover: bool, precision: f64) -> Option { let mut inputs: Vec<(BezPath, usize)> = Vec::new(); for (i, s) in shapes.iter().enumerate() { let mut bp = BezPath::new(); diff --git a/crates/three-d/Cargo.toml b/crates/three-d/Cargo.toml index f5eefa1c9b..48d2bfbf05 100644 --- a/crates/three-d/Cargo.toml +++ b/crates/three-d/Cargo.toml @@ -11,3 +11,6 @@ workspace = true [dependencies] vectorcraft-geom = { workspace = true } vectorcraft-pathops = { workspace = true } + +[dev-dependencies] +proptest = { workspace = true } diff --git a/crates/three-d/src/fold.rs b/crates/three-d/src/fold.rs new file mode 100644 index 0000000000..c68f8aa6ca --- /dev/null +++ b/crates/three-d/src/fold.rs @@ -0,0 +1,1237 @@ +//! The panels and hinges of a packaging blank, from its fold lines. +//! +//! Cut lines bound the material. Each connected piece of Cut lines with material is one blank: its +//! outline is the largest closed Cut subpath of the piece when every other face of the piece lies +//! inside it or inside another closed Cut subpath, and the piece's outer boundary otherwise. A face +//! is material when it lies inside that outline and inside no other closed Cut subpath of the piece, +//! so a slot drawn as a rectangle across the outline leaves the same material as a notch drawn in +//! it. Crease, Partial Cut and Perforation lines divide the material into panels; the pieces of them +//! between two panels are that pair's hinge. [`blanks`] also lists what is wrong with the lines +//! ([`IssueCode`]). + +use std::collections::{HashMap, HashSet}; + +use vectorcraft_geom::kurbo::{Line, ParamCurveArclen, ParamCurveNearest, PathSeg}; +use vectorcraft_geom::{BezPath, FillRule, ParamCurve, PathData, Point, Rect, Shape as _, SubPath}; +use vectorcraft_pathops::{Adjacency, DEFAULT_PRECISION, SHAPE_BUILDER_MAX_SEGMENTS, Shape, adjacency, find_gaps, interior_point, unite_all}; + +/// Most panels one blank may have. Its hinges are the edges of a planar graph on its panels, so there +/// are at most 3 × 256 - 6 = 762 of them. +pub const MAX_PANELS: usize = 256; +/// Most segments the fold lines may have together. +pub const MAX_SEGMENTS: usize = SHAPE_BUILDER_MAX_SEGMENTS; + +/// What a fold line does. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LineKind { + /// Separates the material. + Cut, + /// A fold. + Crease, + /// A fold cut part way through the board. + PartialCut, + /// A fold along a line of cuts. + Perforation, +} + +impl LineKind { + /// The angle a line of this kind folds at when it has none of its own, in degrees: Crease and + /// Perforation 90, Partial Cut -90 (VectorCraft's own values); a positive angle folds away from + /// the printed side. A Cut line does not fold: 0. + pub fn default_angle(self) -> f64 { + match self { + LineKind::Cut => 0.0, + LineKind::Crease | LineKind::Perforation => 90.0, + LineKind::PartialCut => -90.0, + } + } +} + +/// A fold line: the path (document coordinates), its kind, its own fold angle in degrees if it has +/// one, and a key the issues name it by. +#[derive(Clone, Debug)] +pub struct FoldLine { + pub path: PathData, + pub kind: LineKind, + pub angle: Option, + pub key: u64, +} + +/// One blank: its panels, the hinges between them, and its holes. +#[derive(Clone, Debug, Default)] +pub struct Blank { + pub panels: Vec, + pub hinges: Vec, + pub holes: Vec, +} + +/// A panel: an area of material between fold lines. +#[derive(Clone, Debug)] +pub struct Panel { + pub outline: PathData, + pub area: f64, +} + +/// The fold between panels `a` and `b` (indices into the blank's panels, `a` < `b`), about the +/// straight line from `from` to `to`, at `angle` degrees, made of the lines `keys`. `straight` is +/// false when its pieces are not on one straight line within the tolerance; it then folds about the +/// line through its longest piece. +#[derive(Clone, Debug)] +pub struct Hinge { + pub a: usize, + pub b: usize, + pub from: Point, + pub to: Point, + pub angle: f64, + pub keys: Vec, + pub straight: bool, +} + +/// What can be wrong with fold lines, in the order [`blanks`] lists them. +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum IssueCode { + /// No Cut line. + NoCut, + /// The Cut lines enclose no area. + Open, + /// An end of a Cut line meets no other fold line within the tolerance (a slit that ends on a + /// crease is not loose). + LooseEnd, + /// An end of a Cut line comes within the tolerance of a Cut line without meeting it; the panels + /// are built with the gap closed. + Gap, + /// Over [`MAX_SEGMENTS`] segments or [`MAX_PANELS`] panels in a blank, or the lines can't be + /// mapped. + TooComplex, + /// A Cut line and a crease lie on top of each other. + CutOverCrease, + /// Two lines of the same kind lie on top of each other. + Duplicate, + /// A crease ends inside a panel. + DanglingCrease, + /// A crease divides no two panels. + NoSplit, + /// A crease lies outside every blank. + Outside, + /// A hinge's pieces are not on one straight line. + NotStraight, + /// A gap between lines is narrower than the planar map can tell apart. + Sliver, + /// A hole holds crease lines, or a blank lies inside a hole. + Ambiguous, + /// A panel is joined to the largest panel of its blank by no chain of hinges. + LoosePanel, + /// A fold line is on a layer that does not print (the caller reports it). + NonPrinting, +} + +impl IssueCode { + /// Every code, in order. + pub const ALL: [IssueCode; 15] = [ + IssueCode::NoCut, + IssueCode::Open, + IssueCode::LooseEnd, + IssueCode::Gap, + IssueCode::TooComplex, + IssueCode::CutOverCrease, + IssueCode::Duplicate, + IssueCode::DanglingCrease, + IssueCode::NoSplit, + IssueCode::Outside, + IssueCode::NotStraight, + IssueCode::Sliver, + IssueCode::Ambiguous, + IssueCode::LoosePanel, + IssueCode::NonPrinting, + ]; + + /// The code's stable id. + pub fn id(self) -> &'static str { + match self { + IssueCode::NoCut => "noCut", + IssueCode::Open => "open", + IssueCode::LooseEnd => "looseEnd", + IssueCode::Gap => "gap", + IssueCode::TooComplex => "tooComplex", + IssueCode::CutOverCrease => "cutOverCrease", + IssueCode::Duplicate => "duplicate", + IssueCode::DanglingCrease => "danglingCrease", + IssueCode::NoSplit => "noSplit", + IssueCode::Outside => "outside", + IssueCode::NotStraight => "notStraight", + IssueCode::Sliver => "sliver", + IssueCode::Ambiguous => "ambiguous", + IssueCode::LoosePanel => "loosePanel", + IssueCode::NonPrinting => "nonPrinting", + } + } + + /// Whether it is an error (the blank can't be made as drawn) rather than a warning. + pub fn is_error(self) -> bool { + matches!(self, IssueCode::NoCut | IssueCode::Open | IssueCode::LooseEnd | IssueCode::TooComplex | IssueCode::CutOverCrease) + } +} + +/// One issue: its code, the lines it is about, and the place it is at, when it has one. +#[derive(Clone, Debug, PartialEq)] +pub struct Issue { + pub code: IssueCode, + pub keys: Vec, + pub at: Option, +} + +impl Issue { + fn new(code: IssueCode, mut keys: Vec, at: Option) -> Self { + keys.sort_unstable(); + keys.dedup(); + Issue { code, keys, at } + } +} + +/// One subpath of a fold line. +struct Piece { + sp: SubPath, + line: usize, +} + +/// The blanks `lines` make, and their issues in [`IssueCode`] order. `tolerance` (points) is how +/// far apart a Cut line's end and another Cut line may be and still be joined, by a line [`blanks`] +/// adds, and how far a hinge's pieces may stray from one straight line. Nothing is built when there +/// is no Cut line, the lines are too complex, or the Cut lines enclose no area. +pub fn blanks(lines: &[FoldLine], tolerance: f64) -> (Vec, Vec) { + let tolerance = if tolerance.is_finite() && tolerance > 0.0 { tolerance } else { DEFAULT_PRECISION }; + // Counted before anything is copied. + let segments = lines.iter().flat_map(|l| &l.path.subpaths).filter(|sp| usable(sp)).try_fold(0usize, |n, sp| { + let n = n.saturating_add(sp.segment_count()); + (n <= MAX_SEGMENTS).then_some(n) + }); + if segments.is_none() { + return (vec![], vec![Issue::new(IssueCode::TooComplex, vec![], None)]); + } + let pieces: Vec = lines + .iter() + .enumerate() + .flat_map(|(line, l)| l.path.subpaths.iter().filter(|sp| usable(sp)).map(move |sp| Piece { sp: sp.clone(), line })) + .collect(); + let mut issues = vec![]; + let kind = |p: &Piece| lines.get(p.line).map_or(LineKind::Cut, |l| l.kind); + let key = |p: &Piece| lines.get(p.line).map_or(0, |l| l.key); + let cuts: Vec<&Piece> = pieces.iter().filter(|p| kind(p) == LineKind::Cut).collect(); + if cuts.is_empty() { + return (vec![], vec![Issue::new(IssueCode::NoCut, vec![], None)]); + } + let folds: Vec<&Piece> = pieces.iter().filter(|p| kind(p) != LineKind::Cut).collect(); + let cut_shapes: Vec = cuts.iter().map(|p| shape(p.sp.clone())).collect(); + let gaps = find_gaps(&cut_shapes, tolerance); + // `find_gaps` takes ends closer than 1/10,000 of the tolerance as joined, which the map may not + // join: those are bridged too, without an issue. + let joined = find_gaps(&cut_shapes, (tolerance * 1e-4).max(1e-6)); + // An end a gap starts or ends at is not loose. + let gap_ends = + Cells::new(gaps.iter().chain(&joined).flatten().map(|&e| (Rect::from_points(e, e), (e.x.to_bits(), e.y.to_bits()))).collect(), 0.0, 4096.0); + let bridged = |at: Point| gap_ends.near(at, 1e-6).into_iter().any(|(x, y)| Point::new(f64::from_bits(x), f64::from_bits(y)).distance(at) <= 1e-6); + issues.extend( + loose_ends(&cuts, &folds, tolerance) + .into_iter() + .filter(|&(_, at)| !bridged(at)) + .map(|(i, at)| Issue::new(IssueCode::LooseEnd, vec![cuts.get(i).map_or(0, |p| key(p))], Some(at))), + ); + if !gaps.is_empty() { + // The cut lines by their ends, to name the line each gap starts from. + let at_ends = cuts.iter().enumerate().flat_map(|(i, p)| ends(&p.sp).into_iter().map(move |e| (Rect::from_points(e, e), (i, e)))); + let by_end = Cells::new(at_ends.map(|(r, (i, e))| (r, (i, e.x.to_bits(), e.y.to_bits()))).collect(), 0.0, 4096.0); + for g in &gaps { + let of = by_end + .near(g[0], 1e-6) + .into_iter() + .find(|&(_, x, y)| Point::new(f64::from_bits(x), f64::from_bits(y)).distance(g[0]) <= 1e-6) + .and_then(|(i, _, _)| cuts.get(i)) + .map(|p| key(p)); + issues.push(Issue::new(IssueCode::Gap, of.into_iter().collect(), Some(g[0]))); + } + } + let gaps: Vec<[Point; 2]> = gaps.into_iter().chain(joined).collect(); + let gap_shape = shape_of_gaps(&gaps); + let Some(material) = Material::new(&cuts, &gaps, cut_shapes.into_iter().chain(gap_shape.clone()).collect()) else { + issues.push(Issue::new(IssueCode::TooComplex, vec![], None)); + return (vec![], sorted(issues)); + }; + if material.blanks.is_empty() { + issues.push(Issue::new(IssueCode::Open, cuts.iter().map(|p| key(p)).collect(), None)); + return (vec![], sorted(issues)); + } + let all: Vec = pieces.iter().map(|p| shape(p.sp.clone())).chain(gap_shape).collect(); + let Some(full) = adjacency(&all, DEFAULT_PRECISION) else { + issues.push(Issue::new(IssueCode::TooComplex, vec![], None)); + return (vec![], sorted(issues)); + }; + let cut_lines: Vec = cuts.iter().map(|p| p.line).collect(); + let ctx = Context { lines, pieces: &pieces, cut_lines: &cut_lines, material: &material, full: &full, tolerance }; + let built = ctx.build(&mut issues); + (built, sorted(issues)) +} + +fn sorted(mut issues: Vec) -> Vec { + issues.sort_by_key(|i| i.code); + issues +} + +/// A subpath with two anchors or more, every coordinate finite. +fn usable(sp: &SubPath) -> bool { + sp.anchors.len() >= 2 && sp.anchors.iter().all(|a| a.p.is_finite() && a.h_in.is_finite() && a.h_out.is_finite()) +} + +fn shape(sp: SubPath) -> Shape { + Shape::new(PathData::single(sp), FillRule::NonZero, 0) +} + +/// The lines across `gaps`, as one input. +fn shape_of_gaps(gaps: &[[Point; 2]]) -> Option { + (!gaps.is_empty()).then(|| Shape::new(PathData::new(gaps.iter().map(|g| SubPath::polyline(g, false)).collect()), FillRule::NonZero, 0)) +} + +/// The two ends of an open subpath; none for a closed one or one that ends where it starts. +fn ends(sp: &SubPath) -> Vec { + match (sp.anchors.first(), sp.anchors.last()) { + (Some(a), Some(b)) if !sp.closed && a.p.distance(b.p) > 1e-6 => vec![a.p, b.p], + _ => vec![], + } +} + +/// Whether `sp` encloses an area: closed, or open with its ends together. +fn is_loop(sp: &SubPath) -> bool { + ends(sp).is_empty() && sp.anchors.len() >= 2 +} + +/// Most grid cells one item is filed under by [`Cells`]; a larger one is tried for every point. +const SPAN: usize = 1024; + +/// The farthest cell from the grid's origin, on each axis, that [`Cells`] numbers a point in. +const CELL_LIMIT: f64 = 1_048_576.0; + +/// Most (cell, item) entries [`Cells`] holds in all; the items past it are tried for every point, as +/// large ones are. +const CELL_ENTRIES: usize = 1 << 21; + +/// Items (segments, faces, ends) by the cells of a square grid that their bounds cover, so that +/// finding the items near a point tests only those in its cells. +struct Cells { + origin: Point, + cell: f64, + cells: HashMap<(i64, i64), Vec>, + /// Items whose bounds cover more than [`SPAN`] cells, near every point. + wide: Vec, +} + +impl Cells { + /// `items` by their bounds, in cells `cell` wide or `1/divisions` of all the bounds where that is + /// wider. + fn new(items: Vec<(Rect, T)>, cell: f64, divisions: f64) -> Self { + let bounds = items.iter().map(|(b, _)| *b).filter(Rect::is_finite).reduce(|a, b| a.union(b)).unwrap_or_default(); + let cell = cell.max(bounds.width().max(bounds.height()) / divisions); + let cell = if cell.is_finite() && cell > 0.0 { cell } else { 1.0 }; + let mut grid = Cells { origin: bounds.origin(), cell, cells: HashMap::new(), wide: vec![] }; + let mut entries = 0usize; + for (b, item) in items { + let ((x0, y0), (x1, y1)) = (grid.cell_of(Point::new(b.x0, b.y0)), grid.cell_of(Point::new(b.x1, b.y1))); + let span = usize::try_from((x1 - x0 + 1).saturating_mul(y1 - y0 + 1)).unwrap_or(usize::MAX); + if span > SPAN || entries.saturating_add(span) > CELL_ENTRIES { + grid.wide.push(item); + continue; + } + entries += span; + for x in x0..=x1 { + for y in y0..=y1 { + grid.cells.entry((x, y)).or_default().push(item); + } + } + } + grid + } + + fn cell_of(&self, p: Point) -> (i64, i64) { + let at = |v: f64, o: f64| ((v - o) / self.cell).floor().clamp(-CELL_LIMIT, CELL_LIMIT) as i64; + (at(p.x, self.origin.x), at(p.y, self.origin.y)) + } + + /// The items whose bounds come within `r` of `p` (and some farther ones), each once. When `r` + /// spans more cells than hold items, the cells that hold items are read instead. + fn near(&self, p: Point, r: f64) -> Vec { + let mut out = self.wide.clone(); + let ((x0, y0), (x1, y1)) = (self.cell_of(Point::new(p.x - r, p.y - r)), self.cell_of(Point::new(p.x + r, p.y + r))); + let span = (x1 - x0 + 1).saturating_mul(y1 - y0 + 1); + if usize::try_from(span).map_or(true, |n| n > self.cells.len()) { + for (&(x, y), items) in &self.cells { + if (x0..=x1).contains(&x) && (y0..=y1).contains(&y) { + out.extend(items); + } + } + } else { + for x in x0..=x1 { + for y in y0..=y1 { + out.extend(self.cells.get(&(x, y)).into_iter().flatten()); + } + } + } + out.sort_unstable(); + out.dedup(); + out + } +} + +/// The ends of `cuts` that lie more than `tolerance` from every other fold line among `cuts` and +/// `folds`, as (index into `cuts`, end). A line's own points count when they are more than +/// `tolerance` from the end along the line, so a cut line that comes back to its own end meets it. +fn loose_ends(cuts: &[&Piece], folds: &[&Piece], tolerance: f64) -> Vec<(usize, Point)> { + let segs: Vec> = cuts.iter().chain(folds).map(|p| PathData::single(p.sp.clone()).to_bezpath().segments().collect()).collect(); + let boxes = segs.iter().enumerate().flat_map(|(j, ss)| ss.iter().enumerate().map(move |(k, s)| (s.bounding_box(), (j, k)))); + // The cells are as wide as the tolerance, or 1/4096 of the lines where that is wider. + let grid = Cells::new(boxes.collect(), tolerance, 4096.0); + let mut out = vec![]; + for (i, p) in cuts.iter().enumerate() { + let own = segs.get(i).map(Vec::as_slice).unwrap_or_default(); + // How far along the line each of its segments starts, and the line's length. + let starts: Vec = own.iter().scan(0.0, |at, s| Some(std::mem::replace(at, *at + s.arclen(1e-3)))).collect(); + let total = own.last().zip(starts.last()).map_or(0.0, |(s, at)| at + s.arclen(1e-3)); + for (k, e) in ends(&p.sp).into_iter().enumerate() { + let near = grid.near(e, tolerance).into_iter().any(|(j, s)| { + let Some(seg) = segs.get(j).and_then(|ss| ss.get(s)) else { return false }; + let b = seg.bounding_box(); + if e.x < b.x0 - tolerance || e.x > b.x1 + tolerance || e.y < b.y0 - tolerance || e.y > b.y1 + tolerance { + return false; + } + let hit = seg.nearest(e, 1e-9); + if hit.distance_sq.sqrt() > tolerance { + return false; + } + if j != i { + return true; + } + let along = starts.get(s).copied().unwrap_or(0.0) + seg.subsegment(0.0..hit.t).arclen(1e-3); + (if k == 0 { along } else { total - along }) > tolerance + }); + if !near { + out.push((i, e)); + } + } + } + out +} + +/// A point inside `path`, or the middle of its bounds for one too thin to find one in. +fn point_in(path: &PathData) -> Option { + interior_point(path).or_else(|| path.bounds().map(|b| b.center())) +} + +fn contains(bp: &BezPath, p: Point) -> bool { + bp.winding(p) != 0 +} + +/// The loops that open Cut pieces and the lines across `gaps` make end to end: each chain of them +/// whose every end meets exactly one end of another piece of the chain (within 1e-6), as (index +/// into `cuts` of its first Cut piece, closed path). Pieces that lie on no cycle are left out first; +/// ends where three of the remaining pieces or more meet join nothing. +fn chains(cuts: &[&Piece], gaps: &[[Point; 2]]) -> Vec<(usize, BezPath)> { + const NEAR: f64 = 1e-6; + // Cell numbers stay far from the ends of `i64`, so a neighbor's number does not overflow. + let cell = |v: f64| (v / NEAR).round().clamp(-1e15, 1e15) as i64; + let key = |p: Point| (cell(p.x), cell(p.y)); + // The ends by node: ends within `NEAR` of a node's first end share it. + let mut nodes: HashMap<(i64, i64), usize> = HashMap::new(); + let mut firsts: Vec = vec![]; + let mut node_of = |p: Point| { + let (kx, ky) = key(p); + for dx in -1..=1 { + for dy in -1..=1 { + if let Some(&n) = nodes.get(&(kx.saturating_add(dx), ky.saturating_add(dy))) + && firsts.get(n).is_some_and(|q| q.distance(p) <= NEAR) + { + return n; + } + } + } + firsts.push(p); + nodes.insert((kx, ky), firsts.len() - 1); + firsts.len() - 1 + }; + // The open Cut pieces (with their index into `cuts`) and the gap lines, each with its segments. + let pieces = cuts + .iter() + .enumerate() + .filter(|(_, p)| ends(&p.sp).len() == 2) + .map(|(i, p)| (Some(i), PathData::single(p.sp.clone()).to_bezpath().segments().collect())); + let lines = gaps.iter().map(|g| (None, vec![PathSeg::Line(Line::new(g[0], g[1]))])); + let items: Vec<(Option, Vec)> = pieces.chain(lines).collect(); + // (index into `items`, start node, end node) of each, and the pieces at each node. + let open: Vec<(usize, usize, usize)> = + items.iter().enumerate().filter_map(|(k, (_, segs))| Some((k, node_of(segs.first()?.start()), node_of(segs.last()?.end())))).collect(); + let mut at: HashMap> = HashMap::new(); + for (k, &(_, a, b)) in open.iter().enumerate() { + at.entry(a).or_default().push(k); + at.entry(b).or_default().push(k); + } + // A piece that lies on no cycle of pieces (a slit, a line from another one's side, a cut that + // joins two loops) is no part of a loop: such pieces are dropped, so that a slit at a loop's + // corner does not stop the loop. + let live: Vec = bridges(firsts.len(), &open).into_iter().map(|b| !b).collect(); + for ks in at.values_mut() { + ks.retain(|&k| live.get(k) == Some(&true)); + } + let mut used: Vec = live.iter().map(|l| !l).collect(); + let mut out = vec![]; + for start in 0..open.len() { + if used.get(start) != Some(&false) { + continue; + } + // Walk from the start piece's first end until the chain comes back to it, or stops. + let Some(&(_, first_node, _)) = open.get(start) else { continue }; + let (mut k, mut from, mut walk) = (start, first_node, vec![]); + let closed = loop { + let Some(&(_, a, b)) = open.get(k) else { break false }; + if used.get(k) != Some(&false) { + break false; + } + if let Some(u) = used.get_mut(k) { + *u = true; + } + let forward = a == from; + walk.push((k, forward)); + let to = if forward { b } else { a }; + if to == first_node { + break true; + } + let next = at.get(&to).filter(|ks| ks.len() == 2).and_then(|ks| ks.iter().copied().find(|&j| j != k)); + match next { + Some(j) => (k, from) = (j, to), + None => break false, + } + }; + if !closed || at.get(&first_node).is_none_or(|ks| ks.len() != 2) { + continue; + } + let mut bp = BezPath::new(); + let mut first_cut = None; + for (n, &(k, forward)) in walk.iter().enumerate() { + let Some((i, segs)) = open.get(k).and_then(|&(j, _, _)| items.get(j)) else { continue }; + first_cut = first_cut.or(*i); + let segs: Vec = if forward { segs.clone() } else { segs.iter().rev().map(|s| s.reverse()).collect() }; + for (m, s) in segs.iter().enumerate() { + if n == 0 && m == 0 { + bp.move_to(s.start()); + } + match *s { + PathSeg::Line(l) => bp.line_to(l.p1), + PathSeg::Quad(q) => bp.quad_to(q.p1, q.p2), + PathSeg::Cubic(c) => bp.curve_to(c.p1, c.p2, c.p3), + } + } + } + bp.close_path(); + if let Some(i) = first_cut { + out.push((i, bp)); + } + } + out +} + +/// Which of `edges` ((id, end node, end node), nodes below `nodes`) lie on no cycle: the bridges of +/// the graph, found depth first without recursion. +fn bridges(nodes: usize, edges: &[(usize, usize, usize)]) -> Vec { + let mut adj: Vec> = vec![vec![]; nodes]; + for (k, &(_, a, b)) in edges.iter().enumerate() { + adj.get_mut(a).into_iter().for_each(|l| l.push((b, k))); + adj.get_mut(b).into_iter().for_each(|l| l.push((a, k))); + } + let mut bridge = vec![false; edges.len()]; + let (mut disc, mut low) = (vec![usize::MAX; nodes], vec![0usize; nodes]); + let mut timer = 0usize; + for s in 0..nodes { + if disc.get(s) != Some(&usize::MAX) { + continue; + } + let mut stamp = |v: usize, disc: &mut Vec, low: &mut Vec| { + disc.get_mut(v).into_iter().for_each(|d| *d = timer); + low.get_mut(v).into_iter().for_each(|l| *l = timer); + timer += 1; + }; + stamp(s, &mut disc, &mut low); + // (node, the edge it was reached by, the next of its edges to follow) + let mut stack: Vec<(usize, Option, usize)> = vec![(s, None, 0)]; + while let Some(&(v, by, i)) = stack.last() { + if let Some(&(w, e)) = adj.get(v).and_then(|l| l.get(i)) { + if let Some(top) = stack.last_mut() { + top.2 += 1; + } + if Some(e) == by { + continue; + } + match disc.get(w).copied() { + Some(usize::MAX) => { + stamp(w, &mut disc, &mut low); + stack.push((w, Some(e), 0)); + } + Some(d) => { + if let Some(l) = low.get_mut(v) { + *l = (*l).min(d); + } + } + None => {} + } + } else { + stack.pop(); + let low_v = low.get(v).copied().unwrap_or(0); + if let Some(&(u, _, _)) = stack.last() { + if let Some(l) = low.get_mut(u) { + *l = (*l).min(low_v); + } + if disc.get(u).is_some_and(|&d| low_v > d) + && let Some(b) = by.and_then(|e| bridge.get_mut(e)) + { + *b = true; + } + } + } + } + } + bridge +} + +/// The material the Cut lines leave: the faces of their planar map, which are material, which are +/// holes, and the blanks (connected pieces with material). +struct Material { + map: Adjacency, + /// For each face of `map`: a point inside it, whether it is material, whether it is a hole. + points: Vec>, + material: Vec, + hole: Vec, + /// The pieces of `map` that are blanks, in order, and each one's outline. + blanks: Vec, + bounds: Vec, + /// For each piece of `map`, the blank (index into `blanks`) it is part of: its own, or for a + /// piece that lies in a blank's material (a window), that blank. + owner: Vec>, + /// The faces of each piece of `map`, and its edges. + faces_by_piece: Vec>, + edges_by_piece: Vec>, + /// Each face's outer boundary and its whole path (with its holes), and the faces by where they + /// are. + outer: Vec, + whole: Vec, + face_cells: Cells, + /// The blanks by where their outlines are (built once every piece is classified). + bound_cells: Cells, +} + +/// A loop among the Cut lines: its path and its area. +type Loop = (BezPath, f64); + +impl Material { + /// The material of `cuts` with the lines across `gaps`, mapped as `shapes` (the cuts, then the + /// gap lines). + fn new(cuts: &[&Piece], gaps: &[[Point; 2]], shapes: Vec) -> Option { + let map = adjacency(&shapes, DEFAULT_PRECISION)?; + let points: Vec> = map.faces.iter().map(|f| point_in(&f.path)).collect(); + let pieces = map.faces.iter().map(|f| f.piece + 1).chain(map.edges.iter().map(|e| e.piece + 1)).max().unwrap_or(0); + let mut faces_by_piece = vec![vec![]; pieces]; + for (f, face) in map.faces.iter().enumerate() { + if let Some(list) = faces_by_piece.get_mut(face.piece) { + list.push(f); + } + } + // The piece each input is part of, from the edges it lies on. + let mut piece_of_input: Vec> = vec![None; shapes.len()]; + let mut edges_by_piece = vec![vec![]; pieces]; + for (e, edge) in map.edges.iter().enumerate() { + if let Some(list) = edges_by_piece.get_mut(edge.piece) { + list.push(e); + } + for &s in &edge.sources { + if let Some(slot) = piece_of_input.get_mut(s).filter(|p| p.is_none()) { + *slot = Some(edge.piece); + } + } + } + let mut loops: Vec> = vec![vec![]; pieces]; + for (i, p) in cuts.iter().enumerate().filter(|(_, p)| is_loop(&p.sp)) { + let Some(list) = piece_of_input.get(i).copied().flatten().and_then(|piece| loops.get_mut(piece)) else { continue }; + let bp = PathData::single(SubPath::of(p.sp.anchors.clone(), true)).to_bezpath(); + let area = bp.area().abs(); + list.push((bp, area)); + } + // Loops drawn as open pieces end to end, such as a slot of four lines. + for (i, bp) in chains(cuts, gaps) { + let Some(list) = piece_of_input.get(i).copied().flatten().and_then(|piece| loops.get_mut(piece)) else { continue }; + let area = bp.area().abs(); + list.push((bp, area)); + } + // Each piece's outer boundary and a point of it. + let mut outlines: Vec)>> = vec![None; pieces]; + for o in &map.outlines { + if let Some(slot) = outlines.get_mut(o.piece).filter(|s| s.is_none()) { + *slot = Some((o.path.to_bezpath(), o.path.subpaths.first().and_then(|sp| sp.anchors.first()).map(|a| a.p))); + } + } + // Outer pieces first: the face a piece lies in belongs to a piece with a larger outline. + let mut order: Vec<(usize, f64, Option)> = + outlines.iter().enumerate().map(|(p, o)| (p, o.as_ref().map_or(0.0, |o| o.0.area().abs()), o.as_ref().and_then(|o| o.1))).collect(); + order.sort_by(|a, b| b.1.total_cmp(&a.1)); + let outer: Vec = + map.faces.iter().map(|f| f.path.subpaths.first().map(|sp| PathData::single(sp.clone()).to_bezpath()).unwrap_or_default()).collect(); + let whole: Vec = map.faces.iter().map(|f| f.path.to_bezpath()).collect(); + let face_cells = Cells::new(outer.iter().enumerate().map(|(f, bp)| (bp.bounding_box(), f)).collect(), 0.0, 256.0); + let faces = map.faces.len(); + let mut m = Material { + map, + points, + material: vec![false; faces], + hole: vec![false; faces], + blanks: vec![], + bounds: vec![], + owner: vec![None; pieces], + faces_by_piece, + edges_by_piece, + outer, + whole, + face_cells, + bound_cells: Cells::new(vec![], 0.0, 256.0), + }; + for (piece, _, first) in order { + match first.and_then(|q| m.around(piece, q)) { + // A piece in a blank's material is a hole in it, a window. + Some(f) if m.material.get(f) == Some(&true) => { + let owner = m.map.faces.get(f).and_then(|x| m.owner.get(x.piece)).copied().flatten(); + for g in m.faces_by_piece.get(piece).cloned().unwrap_or_default() { + let usable = m.points.get(g).copied().flatten().is_some(); + if let Some(h) = m.hole.get_mut(g) { + *h = usable; + } + } + if let Some(o) = m.owner.get_mut(piece) { + *o = owner; + } + } + _ => { + let own = loops.get(piece).map(Vec::as_slice).unwrap_or_default(); + let fallback = outlines.get(piece).cloned().flatten().map(|o| o.0); + m.classify(piece, own, fallback); + } + } + } + m.bound_cells = Cells::new(m.bounds.iter().enumerate().map(|(b, bp)| (bp.bounding_box(), b)).collect(), 0.0, 256.0); + Some(m) + } + + /// The face of another piece than `piece` whose outer boundary holds `q`, a point of its + /// outline, the one with the smallest outer boundary when several do. The boundaries are + /// compared, not the faces' own areas, which leave out the holes in them. + fn around(&self, piece: usize, q: Point) -> Option { + let outer_area = |f: usize| self.outer.get(f).map_or(f64::INFINITY, |bp| bp.area().abs()); + self.face_cells + .near(q, 0.0) + .into_iter() + .filter(|&f| self.map.faces.get(f).is_some_and(|x| x.piece != piece)) + .filter(|&f| self.outer.get(f).is_some_and(|bp| contains(bp, q))) + .min_by(|&a, &b| outer_area(a).total_cmp(&outer_area(b))) + } + + fn area(&self, f: usize) -> f64 { + self.map.faces.get(f).map_or(f64::INFINITY, |x| x.area) + } + + /// Which faces of `piece` are material and which are holes, by its own loops `loops`; with + /// material, the piece is a blank. A loop that holds the same faces as a larger one (a loop + /// drawn twice) counts once. Its outlines are its largest loop and each smaller loop that shares + /// no face with a larger outline (two outlines joined by a cut line); its other loops cut + /// material out. When the outlines and the loops that cut out do not cover every face (an + /// outline drawn as open lines), every loop cuts out and the blank is bounded by `fallback`, its + /// outer boundary. + fn classify(&mut self, piece: usize, loops: &[Loop], fallback: Option) { + let faces = self.faces_by_piece.get(piece).cloned().unwrap_or_default(); + let mut by_area: Vec<&Loop> = loops.iter().collect(); + by_area.sort_by(|a, b| b.1.total_cmp(&a.1)); + let points = &self.points; + let unusable = |f: usize| points.get(f).copied().flatten().is_none(); + // The piece's faces by their points, so that each loop tests only the faces near it. + let at: Vec<(Rect, usize)> = + faces.iter().enumerate().filter_map(|(k, &f)| points.get(f).copied().flatten().map(|p| (Rect::from_points(p, p), k))).collect(); + let extent = at.iter().map(|(r, _)| *r).reduce(|a, b| a.union(b)); + let near = Cells::new(at, 0.0, 256.0); + // Each loop with the faces of the piece it holds (positions in `faces`, ascending); loops + // that hold none, and loops that hold the same faces as a larger one, are left out. + let mut seen: HashSet> = HashSet::new(); + let mut own: Vec<(&BezPath, Vec)> = vec![]; + for l in by_area { + let b = l.0.bounding_box().inflate(1e-6, 1e-6); + // Only the part of the loop's bounds where faces are is looked up, a few hundred cells + // across at most. + let Some(q) = extent.map(|e| b.intersect(e)).filter(|q| q.width() >= 0.0 && q.height() >= 0.0) else { continue }; + let holds: Vec = near + .near(q.center(), q.width().max(q.height()) / 2.0) + .into_iter() + .filter(|&k| faces.get(k).and_then(|&f| points.get(f).copied().flatten()).is_some_and(|p| b.contains(p) && contains(&l.0, p))) + .collect(); + if !holds.is_empty() && seen.insert(holds.clone()) { + own.push((&l.0, holds)); + } + } + // Outlines go largest first; a loop holding a face an outline holds cuts out instead. + let (mut outlines, mut others): (Vec, Vec) = (vec![], vec![]); + let mut in_an_outline = vec![false; faces.len()]; + let mut held = vec![false; faces.len()]; + for (i, (_, holds)) in own.iter().enumerate() { + holds.iter().for_each(|&k| held.get_mut(k).into_iter().for_each(|h| *h = true)); + if holds.iter().any(|&k| in_an_outline.get(k) == Some(&true)) { + others.push(i); + } else { + holds.iter().for_each(|&k| in_an_outline.get_mut(k).into_iter().for_each(|h| *h = true)); + outlines.push(i); + } + } + let covered = faces.iter().enumerate().all(|(k, &f)| held.get(k) == Some(&true) || unusable(f)); + if !covered { + outlines.clear(); + others = (0..own.len()).collect(); + } + let mut cut = vec![false; faces.len()]; + for (_, holds) in others.iter().filter_map(|&i| own.get(i)) { + holds.iter().for_each(|&k| cut.get_mut(k).into_iter().for_each(|c| *c = true)); + } + let mut any = false; + for (k, &f) in faces.iter().enumerate() { + let in_outline = outlines.is_empty() || in_an_outline.get(k) == Some(&true); + let cut_out = cut.get(k) == Some(&true); + let material = !unusable(f) && in_outline && !cut_out; + any |= material; + if let Some(m) = self.material.get_mut(f) { + *m = material; + } + if let Some(h) = self.hole.get_mut(f) { + *h = !unusable(f) && in_outline && cut_out; + } + } + if any { + let bound = if outlines.is_empty() { + fallback + } else { + let mut all = BezPath::new(); + outlines.iter().filter_map(|&o| own.get(o)).for_each(|o| all.extend(o.0.elements().iter().copied())); + Some(all) + }; + if let Some(o) = self.owner.get_mut(piece) { + *o = Some(self.blanks.len()); + } + self.blanks.push(piece); + self.bounds.push(bound.unwrap_or_default()); + } + } + + /// The face of the Cut lines' map that holds `p`, the smallest when several do. + fn face_at(&self, p: Point) -> Option { + self.face_cells + .near(p, 0.0) + .into_iter() + .filter(|&f| self.whole.get(f).is_some_and(|bp| contains(bp, p))) + .min_by(|&a, &b| self.area(a).total_cmp(&self.area(b))) + } + + /// Whether `p` lies inside the outline of a blank. + fn in_a_blank(&self, p: Point) -> bool { + self.bound_cells.near(p, 0.0).into_iter().any(|b| self.bounds.get(b).is_some_and(|bp| contains(bp, p))) + } + + /// The blank (index into `blanks`) face `f` is part of. + fn blank_of(&self, f: usize) -> Option { + let piece = self.map.faces.get(f)?.piece; + self.owner.get(piece).copied().flatten() + } +} + +/// What a face of the full map is. +#[derive(Clone, Copy, PartialEq)] +enum Place { + /// Panel `panel` of blank `blank`. + Panel { + blank: usize, + panel: usize, + }, + /// A hole of a blank. + Hole, + Outside, +} + +/// A piece of crease between two panels of one blank. +struct HingePiece { + path: PathData, + lines: Vec, +} + +struct Context<'a> { + lines: &'a [FoldLine], + pieces: &'a [Piece], + /// The fold line of each input of the Cut lines' map, in order; the gap lines come after them. + cut_lines: &'a [usize], + material: &'a Material, + full: &'a Adjacency, + tolerance: f64, +} + +impl Context<'_> { + /// The fold line that input `i` of the full map is part of; `None` for the gap lines. + fn line_of(&self, i: usize) -> Option { + self.pieces.get(i).map(|p| p.line) + } + + fn kind_of(&self, i: usize) -> LineKind { + self.line_of(i).and_then(|l| self.lines.get(l)).map_or(LineKind::Cut, |l| l.kind) + } + + fn key(&self, line: usize) -> u64 { + self.lines.get(line).map_or(0, |l| l.key) + } + + fn keys(&self, lines: impl IntoIterator) -> Vec { + lines.into_iter().map(|l| self.key(l)).collect() + } + + fn build(&self, issues: &mut Vec) -> Vec { + let mut blanks: Vec = vec![Blank::default(); self.material.blanks.len()]; + // Hole faces that share an edge are one hole (a cut line across a window splits it in two + // faces): they are grouped, and each group's faces are united. + let m = self.material; + let is_hole = |f: usize| m.hole.get(f) == Some(&true); + let mut group: Vec = (0..m.map.faces.len()).collect(); + let root = |group: &mut Vec, mut f: usize| { + while let Some(&g) = group.get(f) { + if g == f { + break; + } + let up = group.get(g).copied().unwrap_or(g); + if let Some(slot) = group.get_mut(f) { + *slot = up; + } + f = up; + } + f + }; + for e in &m.map.edges { + if let (Some(a), Some(b)) = (e.left, e.right) + && a != b + && is_hole(a) + && is_hole(b) + { + let (ra, rb) = (root(&mut group, a), root(&mut group, b)); + if let Some(slot) = group.get_mut(ra) { + *slot = rb; + } + } + } + let mut by_group: HashMap> = HashMap::new(); + for f in (0..m.map.faces.len()).filter(|&f| is_hole(f)) { + by_group.entry(root(&mut group, f)).or_default().push(f); + } + let mut groups: Vec> = by_group.into_values().collect(); + groups.sort_unstable(); + for faces in groups { + let Some(b) = faces.first().and_then(|&f| m.blank_of(f)).and_then(|b| blanks.get_mut(b)) else { continue }; + let paths: Vec<&PathData> = faces.iter().filter_map(|&f| m.map.faces.get(f).map(|x| &x.path)).collect(); + let hole = match paths.as_slice() { + [one] => (*one).clone(), + _ => unite_all(&paths.iter().map(|p| (*p, FillRule::NonZero)).collect::>()), + }; + b.holes.push(hole); + } + let places = self.places(&mut blanks); + if blanks.iter().any(|b| b.panels.len() > MAX_PANELS) { + issues.push(Issue::new(IssueCode::TooComplex, vec![], None)); + return vec![]; + } + let pieces = self.edges(&places, issues); + let hinged = self.hinges(&mut blanks, pieces, issues); + self.creases(&places, &hinged, issues); + self.slivers(issues); + self.nested(issues); + self.loose_panels(&blanks, &places, issues); + blanks + } + + /// What each face of the full map is, adding the panels to `blanks`. + fn places(&self, blanks: &mut [Blank]) -> Vec { + self.full + .faces + .iter() + .map(|face| { + let Some(c) = point_in(&face.path).and_then(|p| self.material.face_at(p)) else { return Place::Outside }; + let Some(blank) = self.material.blank_of(c) else { return Place::Outside }; + if self.material.material.get(c) == Some(&true) { + let Some(b) = blanks.get_mut(blank) else { return Place::Outside }; + b.panels.push(Panel { outline: face.path.clone(), area: face.area }); + Place::Panel { blank, panel: b.panels.len() - 1 } + } else if self.material.hole.get(c) == Some(&true) { + Place::Hole + } else { + Place::Outside + } + }) + .collect() + } + + fn place(&self, places: &[Place], f: Option) -> Place { + f.and_then(|f| places.get(f)).copied().unwrap_or(Place::Outside) + } + + /// Overlaps, dangling creases and creases in holes, from the full map's edges → the hinge + /// pieces, by (blank, panel, panel). + fn edges(&self, places: &[Place], issues: &mut Vec) -> Vec<((usize, usize, usize), HingePiece)> { + let mut pieces = vec![]; + let mut seen: HashSet<(IssueCode, Vec)> = HashSet::new(); + let mut report = |issues: &mut Vec, code: IssueCode, keys: Vec| { + let issue = Issue::new(code, keys, None); + if seen.insert((code, issue.keys.clone())) { + issues.push(issue); + } + }; + for e in &self.full.edges { + let cut = e.sources.iter().any(|&s| self.kind_of(s) == LineKind::Cut); + let creases: Vec = e.sources.iter().filter(|&&s| self.kind_of(s) != LineKind::Cut).filter_map(|&s| self.line_of(s)).collect(); + let mut by_line: Vec = e.sources.iter().filter_map(|&s| self.line_of(s)).collect(); + by_line.sort_unstable(); + by_line.dedup(); + if cut && !creases.is_empty() { + report(issues, IssueCode::CutOverCrease, self.keys(by_line.iter().copied())); + continue; + } + // Two subpaths of one kind on the same edge, from two lines or from one line's own + // subpaths (a compound path); the gap lines are left out. + let drawn: Vec = e.sources.iter().copied().filter(|&s| self.line_of(s).is_some()).collect(); + let mut duplicates: Vec = drawn + .iter() + .filter(|&&s| drawn.iter().any(|&o| o != s && self.kind_of(o) == self.kind_of(s))) + .filter_map(|&s| self.line_of(s)) + .collect(); + duplicates.sort_unstable(); + duplicates.dedup(); + if !duplicates.is_empty() { + report(issues, IssueCode::Duplicate, self.keys(duplicates)); + } + if creases.is_empty() { + continue; + } + match (self.place(places, e.left), self.place(places, e.right)) { + (Place::Panel { blank, panel: a }, Place::Panel { blank: other, panel: b }) if blank == other && a != b => { + pieces.push(((blank, a.min(b), a.max(b)), HingePiece { path: e.path.clone(), lines: creases })); + } + (Place::Panel { .. }, Place::Panel { .. }) if e.left == e.right => { + report(issues, IssueCode::DanglingCrease, self.keys(creases)); + } + (Place::Hole, _) | (_, Place::Hole) => report(issues, IssueCode::Ambiguous, self.keys(creases)), + _ => {} + } + } + pieces + } + + /// The hinges `pieces` make, added to `blanks` → the lines with a hinge. + fn hinges(&self, blanks: &mut [Blank], mut pieces: Vec<((usize, usize, usize), HingePiece)>, issues: &mut Vec) -> Vec { + pieces.sort_by_key(|p| p.0); + let mut hinged = vec![]; + let mut start = 0; + while start < pieces.len() { + let pair = pieces.get(start).map(|p| p.0); + let end = pieces.iter().skip(start).position(|p| Some(p.0) != pair).map_or(pieces.len(), |n| start + n); + let group: Vec<&HingePiece> = pieces.get(start..end).unwrap_or_default().iter().map(|p| &p.1).collect(); + start = end; + let Some((blank, a, b)) = pair else { break }; + let lines: Vec = group.iter().flat_map(|p| p.lines.iter().copied()).collect(); + match self.hinge(&group, a, b) { + Some(h) => { + if !h.straight { + issues.push(Issue::new(IssueCode::NotStraight, h.keys.clone(), None)); + } + hinged.extend(lines); + if let Some(bl) = blanks.get_mut(blank) { + bl.hinges.push(h); + } + } + None => issues.push(Issue::new(IssueCode::NoSplit, self.keys(lines.iter().copied()), None)), + } + } + hinged.sort_unstable(); + hinged.dedup(); + hinged + } + + /// The hinge between panels `a` and `b` made of `group`, along its longest piece; `None` when + /// its pieces are shorter than the tolerance in all, or span less than it. + fn hinge(&self, group: &[&HingePiece], a: usize, b: usize) -> Option { + let chord = |p: &HingePiece| { + let sp = p.path.subpaths.first()?; + Some((sp.anchors.first()?.p, sp.anchors.last()?.p)) + }; + let longest = group.iter().filter_map(|p| Some((*p, chord(p)?))).max_by(|x, y| { + let (lx, ly) = (x.1.0.distance(x.1.1), y.1.0.distance(y.1.1)); + lx.total_cmp(&ly) + })?; + let (p0, p1) = longest.1; + let len = p0.distance(p1); + // The longest piece only sets the direction; the length check is on the whole hinge below. + if len.is_nan() || len <= 1e-9 { + return None; + } + let d = (p1 - p0) / len; + let off = |p: Point| ((p - p0).cross(d)).abs(); + let mut straight = true; + let (mut lo, mut hi) = (f64::INFINITY, f64::NEG_INFINITY); + for p in group { + for seg in p.path.to_bezpath().segments() { + for t in [0.0, 0.25, 0.5, 0.75, 1.0] { + let q = seg.eval(t); + straight &= off(q) <= self.tolerance; + let s = (q - p0).dot(d); + lo = lo.min(s); + hi = hi.max(s); + } + } + } + // The pieces' own length, not the span from the first to the last, which takes in the gaps + // between pieces that lie apart. + let length: f64 = group.iter().map(|p| p.path.to_bezpath().segments().map(|s| s.arclen(1e-3)).sum::()).sum(); + if !(lo.is_finite() && hi.is_finite()) || hi - lo < self.tolerance || length.is_nan() || length < self.tolerance { + return None; + } + let mut lines: Vec = group.iter().flat_map(|p| p.lines.iter().copied()).collect(); + lines.sort_unstable(); + lines.dedup(); + let angle = longest + .0 + .lines + .first() + .and_then(|&l| self.lines.get(l)) + .map(|l| l.angle.filter(|a| a.is_finite()).unwrap_or_else(|| l.kind.default_angle())) + .unwrap_or(90.0); + let mut keys = self.keys(lines); + keys.sort_unstable(); + keys.dedup(); + Some(Hinge { a, b, from: p0 + d * lo, to: p0 + d * hi, angle, keys, straight }) + } + + /// Creases with no hinge: outside every blank, or dividing no two panels. + fn creases(&self, places: &[Place], hinged: &[usize], issues: &mut Vec) { + let named: HashSet = + issues.iter().filter(|i| i.code != IssueCode::LooseEnd && i.code != IssueCode::Gap).flat_map(|i| i.keys.iter().copied()).collect(); + // Whether each line is drawn (has a usable subpath), and whether one of its edges touches a + // panel. + let mut drawn = vec![false; self.lines.len()]; + for p in self.pieces { + if let Some(d) = drawn.get_mut(p.line) { + *d = true; + } + } + let mut on_panel = vec![false; self.lines.len()]; + for e in &self.full.edges { + if [e.left, e.right].into_iter().any(|f| matches!(self.place(places, f), Place::Panel { .. })) { + for line in e.sources.iter().filter_map(|&s| self.line_of(s)) { + if let Some(on) = on_panel.get_mut(line) { + *on = true; + } + } + } + } + for (line, l) in self.lines.iter().enumerate() { + if l.kind == LineKind::Cut || hinged.binary_search(&line).is_ok() || named.contains(&l.key) || drawn.get(line) != Some(&true) { + continue; + } + let code = if on_panel.get(line) == Some(&true) { IssueCode::NoSplit } else { IssueCode::Outside }; + issues.push(Issue::new(code, vec![l.key], None)); + } + } + + /// Slivers of the full map inside a blank. + fn slivers(&self, issues: &mut Vec) { + for s in &self.full.slivers { + let Some(p) = point_in(s) else { continue }; + if self.material.in_a_blank(p) { + issues.push(Issue::new(IssueCode::Sliver, vec![], Some(p))); + } + } + } + + /// Blanks that lie inside a hole of another blank. + fn nested(&self, issues: &mut Vec) { + let m = self.material; + for (bi, &piece) in m.blanks.iter().enumerate() { + let faces = m.faces_by_piece.get(piece).map(Vec::as_slice).unwrap_or_default(); + let Some(p) = faces.iter().find(|&&f| m.material.get(f) == Some(&true)).and_then(|&f| m.points.get(f).copied().flatten()) else { + continue; + }; + let in_hole = + m.face_cells.near(p, 0.0).into_iter().any(|f| { + m.hole.get(f) == Some(&true) && m.blank_of(f).is_some_and(|b| b != bi) && m.outer.get(f).is_some_and(|bp| contains(bp, p)) + }); + if in_hole { + let edges = m.edges_by_piece.get(piece).map(Vec::as_slice).unwrap_or_default(); + let lines = edges.iter().filter_map(|&e| m.map.edges.get(e)).flat_map(|e| e.sources.iter().filter_map(|&s| self.cut_lines.get(s))); + issues.push(Issue::new(IssueCode::Ambiguous, self.keys(lines.copied()), Some(p))); + } + } + } + + /// Panels joined to their blank's base panel (the largest; on a tie, the one whose inside point is + /// highest on the page, then leftmost) by no chain of hinges. + fn loose_panels(&self, blanks: &[Blank], places: &[Place], issues: &mut Vec) { + // The edges beside each panel, by (blank, panel), gathered once. + let mut beside: HashMap<(usize, usize), Vec> = HashMap::new(); + for (i, e) in self.full.edges.iter().enumerate() { + for f in [e.left, e.right] { + if let Place::Panel { blank, panel } = self.place(places, f) { + let list = beside.entry((blank, panel)).or_default(); + if list.last() != Some(&i) { + list.push(i); + } + } + } + } + for (bi, b) in blanks.iter().enumerate() { + let Some(base) = base_panel(&b.panels) else { continue }; + let mut reached = vec![false; b.panels.len()]; + let mut queue = vec![base]; + if let Some(r) = reached.get_mut(base) { + *r = true; + } + while let Some(p) = queue.pop() { + for h in b.hinges.iter().filter(|h| h.a == p || h.b == p) { + let other = if h.a == p { h.b } else { h.a }; + if let Some(r) = reached.get_mut(other).filter(|r| !**r) { + *r = true; + queue.push(other); + } + } + } + for (pi, panel) in b.panels.iter().enumerate().filter(|(i, _)| reached.get(*i) == Some(&false)) { + let edges = beside.get(&(bi, pi)).map(Vec::as_slice).unwrap_or_default(); + let lines = edges.iter().filter_map(|&e| self.full.edges.get(e)); + let keys = lines.flat_map(|e| e.sources.iter().filter_map(|&s| self.line_of(s))).map(|l| self.key(l)).collect(); + issues.push(Issue::new(IssueCode::LoosePanel, keys, point_in(&panel.outline))); + } + } + } +} + +/// The base panel of `panels`: the largest by area; panels whose areas differ by less than 1e-9 of +/// the larger tie, and the tie goes to the one whose inside point is highest on the page, then +/// leftmost. +pub fn base_panel(panels: &[Panel]) -> Option { + let top = panels.iter().map(|p| p.area).fold(f64::NEG_INFINITY, f64::max); + if !top.is_finite() { + return None; + } + panels + .iter() + .enumerate() + .filter(|(_, p)| top - p.area <= 1e-9 * top.abs()) + .filter_map(|(i, p)| Some((i, point_in(&p.outline)?))) + .min_by(|a, b| a.1.y.total_cmp(&b.1.y).then(a.1.x.total_cmp(&b.1.x))) + .map(|(i, _)| i) +} + +#[cfg(test)] +mod tests; diff --git a/crates/three-d/src/fold/tests.rs b/crates/three-d/src/fold/tests.rs new file mode 100644 index 0000000000..a3f2c68d37 --- /dev/null +++ b/crates/three-d/src/fold/tests.rs @@ -0,0 +1,740 @@ +use super::*; +use proptest::prelude::*; +use vectorcraft_geom::Rect; + +const TOL: f64 = 0.1; + +fn p(x: f64, y: f64) -> Point { + Point::new(x, y) +} + +fn poly(points: &[(f64, f64)], closed: bool) -> PathData { + PathData::single(SubPath::polyline(&points.iter().map(|&(x, y)| p(x, y)).collect::>(), closed)) +} + +fn line(kind: LineKind, points: &[(f64, f64)], closed: bool, key: u64) -> FoldLine { + FoldLine { path: poly(points, closed), kind, angle: None, key } +} + +fn cut(points: &[(f64, f64)], key: u64) -> FoldLine { + line(LineKind::Cut, points, true, key) +} + +fn crease(a: (f64, f64), b: (f64, f64), key: u64) -> FoldLine { + line(LineKind::Crease, &[a, b], false, key) +} + +fn codes(issues: &[Issue]) -> Vec<&'static str> { + issues.iter().map(|i| i.code.id()).collect() +} + +fn areas(b: &Blank) -> Vec { + let mut a: Vec = b.panels.iter().map(|p| (p.area * 1000.0).round() as i64).collect(); + a.sort_unstable(); + a +} + +/// A tray: a 100 × 60 base with a 30 pt wall on each side, drawn as one closed cross, and the four +/// creases round the base (keys 10 to 13). +fn tray() -> Vec { + vec![ + cut( + &[ + (30.0, 0.0), + (130.0, 0.0), + (130.0, 30.0), + (160.0, 30.0), + (160.0, 90.0), + (130.0, 90.0), + (130.0, 120.0), + (30.0, 120.0), + (30.0, 90.0), + (0.0, 90.0), + (0.0, 30.0), + (30.0, 30.0), + ], + 1, + ), + crease((30.0, 30.0), (130.0, 30.0), 10), + crease((130.0, 30.0), (130.0, 90.0), 11), + crease((130.0, 90.0), (30.0, 90.0), 12), + crease((30.0, 90.0), (30.0, 30.0), 13), + ] +} + +/// The outline of a slotted box in the style of FEFCO 0201 (glue flap, four body panels 100, 60, +/// 100 and 60 wide and 80 high, 30 pt flaps top and bottom) with its 4 pt slots drawn as notches. +const NOTCHED: [(f64, f64); 30] = [ + (20.0, 0.0), + (118.0, 0.0), + (118.0, 30.0), + (122.0, 30.0), + (122.0, 0.0), + (178.0, 0.0), + (178.0, 30.0), + (182.0, 30.0), + (182.0, 0.0), + (278.0, 0.0), + (278.0, 30.0), + (282.0, 30.0), + (282.0, 0.0), + (340.0, 0.0), + (340.0, 140.0), + (282.0, 140.0), + (282.0, 110.0), + (278.0, 110.0), + (278.0, 140.0), + (182.0, 140.0), + (182.0, 110.0), + (178.0, 110.0), + (178.0, 140.0), + (122.0, 140.0), + (122.0, 110.0), + (118.0, 110.0), + (118.0, 140.0), + (20.0, 140.0), + (20.0, 110.0), + (0.0, 110.0), +]; + +/// The slotted box's creases: the glue flap's and the body panels' (vertical), and the flaps' +/// (horizontal, from slot to slot). +fn box_creases() -> Vec { + let mut out = vec![]; + for (k, x) in [20.0, 120.0, 180.0, 280.0].into_iter().enumerate() { + out.push(crease((x, 30.0), (x, 110.0), 100 + k as u64)); + } + for (k, (x0, x1)) in [(20.0, 118.0), (122.0, 178.0), (182.0, 278.0), (282.0, 340.0)].into_iter().enumerate() { + out.push(crease((x0, 30.0), (x1, 30.0), 110 + k as u64)); + out.push(crease((x0, 110.0), (x1, 110.0), 120 + k as u64)); + } + out +} + +fn notched_box() -> Vec { + let mut outline: Vec<(f64, f64)> = NOTCHED.to_vec(); + outline.extend([(0.0, 30.0), (20.0, 30.0)]); + let mut lines = vec![cut(&outline, 1)]; + lines.extend(box_creases()); + lines +} + +fn check(lines: &[FoldLine]) -> (Vec, Vec) { + blanks(lines, TOL) +} + +#[test] +fn a_tray_has_a_base_four_walls_and_four_hinges() { + let (b, issues) = check(&tray()); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b.len(), 1); + assert_eq!(areas(&b[0]), vec![1_800_000, 1_800_000, 3_000_000, 3_000_000, 6_000_000]); + assert_eq!(b[0].hinges.len(), 4); + for h in &b[0].hinges { + assert!(h.straight && h.angle == 90.0 && h.keys.len() == 1, "{h:?}"); + assert!((h.from.distance(h.to) - if h.keys[0] % 2 == 0 { 100.0 } else { 60.0 }).abs() < 1e-6, "{h:?}"); + } + assert_eq!(base_panel(&b[0].panels).map(|i| (b[0].panels[i].area).round()), Some(6000.0)); +} + +#[test] +fn a_slotted_box_gives_the_same_panels_however_its_slots_and_outline_are_drawn() { + let (notched, issues) = check(¬ched_box()); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(notched.len(), 1); + assert_eq!(notched[0].panels.len(), 13, "glue flap, four body panels, eight flaps"); + assert_eq!(notched[0].hinges.len(), 12); + assert!(notched[0].holes.is_empty()); + + // The slots as rectangles across a plain outline. + let mut across = + vec![cut(&[(20.0, 0.0), (340.0, 0.0), (340.0, 140.0), (20.0, 140.0), (20.0, 110.0), (0.0, 110.0), (0.0, 30.0), (20.0, 30.0)], 1)]; + for (k, x) in [120.0, 180.0, 280.0].into_iter().enumerate() { + across.push(cut(&[(x - 2.0, -5.0), (x + 2.0, -5.0), (x + 2.0, 30.0), (x - 2.0, 30.0)], 2 + k as u64)); + across.push(cut(&[(x - 2.0, 110.0), (x + 2.0, 110.0), (x + 2.0, 145.0), (x - 2.0, 145.0)], 5 + k as u64)); + } + across.extend(box_creases()); + let (b, issues) = check(&across); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b.len(), 1); + assert_eq!(areas(&b[0]), areas(¬ched[0])); + assert_eq!(b[0].hinges.len(), 12); + + // The notched outline as four open paths, end to end. + let mut outline: Vec<(f64, f64)> = NOTCHED.to_vec(); + outline.extend([(0.0, 30.0), (20.0, 30.0), (20.0, 0.0)]); + let mut open: Vec = + [0..9, 8..17, 16..25, 24..33].into_iter().enumerate().map(|(k, r)| line(LineKind::Cut, &outline[r], false, 1 + k as u64)).collect(); + open.extend(box_creases()); + let (b, issues) = check(&open); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(areas(&b[0]), areas(¬ched[0])); + assert_eq!(b[0].hinges.len(), 12); + + // Input order does not change the result. + let mut reversed = notched_box(); + reversed.reverse(); + let (b, _) = check(&reversed); + assert_eq!(areas(&b[0]), areas(¬ched[0])); +} + +#[test] +fn a_round_tuck_flap_folds_like_any_panel() { + let mut bp = BezPath::new(); + bp.move_to(p(0.0, 40.0)); + bp.line_to(p(0.0, 140.0)); + bp.line_to(p(100.0, 140.0)); + bp.line_to(p(100.0, 40.0)); + bp.curve_to(p(100.0, 10.0), p(80.0, 0.0), p(50.0, 0.0)); + bp.curve_to(p(20.0, 0.0), p(0.0, 10.0), p(0.0, 40.0)); + bp.close_path(); + let lines = vec![FoldLine { path: PathData::from_bezpath(&bp), kind: LineKind::Cut, angle: None, key: 1 }, crease((0.0, 40.0), (100.0, 40.0), 2)]; + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b[0].panels.len(), 2); + assert_eq!(b[0].hinges.len(), 1); +} + +#[test] +fn a_window_is_a_hole_in_its_panel() { + let mut lines = tray(); + lines.push(cut(&[(60.0, 45.0), (100.0, 45.0), (100.0, 75.0), (60.0, 75.0)], 2)); + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b[0].holes.len(), 1); + assert_eq!(areas(&b[0]), vec![1_800_000, 1_800_000, 3_000_000, 3_000_000, 4_800_000]); +} + +/// The tray's outline as one open path whose end stops `short` before its start. +fn tray_with_gap(short: f64) -> Vec { + let mut lines = tray(); + lines[0] = line( + LineKind::Cut, + &[ + (30.0 + short, 0.0), + (130.0, 0.0), + (130.0, 30.0), + (160.0, 30.0), + (160.0, 90.0), + (130.0, 90.0), + (130.0, 120.0), + (30.0, 120.0), + (30.0, 90.0), + (0.0, 90.0), + (0.0, 30.0), + (30.0, 30.0), + (30.0, 0.0), + ], + false, + 1, + ); + lines +} + +#[test] +fn a_gap_within_the_tolerance_is_closed_and_one_past_it_is_a_loose_end() { + let (closed, _) = check(&tray()); + let (b, issues) = check(&tray_with_gap(0.05)); + assert_eq!(codes(&issues), vec!["gap"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![1]); + assert_eq!(areas(&b[0]), areas(&closed[0])); + assert_eq!(b[0].hinges.len(), 4); + // The tolerance boundary. + let (_, issues) = blanks(&tray_with_gap(0.05), 0.06); + assert_eq!(codes(&issues), vec!["gap"]); + let (b, issues) = blanks(&tray_with_gap(0.05), 0.04); + assert!(codes(&issues).starts_with(&["open", "looseEnd", "looseEnd"]) || codes(&issues).starts_with(&["looseEnd"]), "{issues:?}"); + assert!(issues.iter().any(|i| i.code == IssueCode::LooseEnd && i.at.is_some_and(|a| a.distance(p(30.05, 0.0)) < 1e-9)), "{issues:?}"); + assert!(b.iter().all(|b| b.panels.len() < 5), "the outline does not close"); +} + +#[test] +fn no_cut_lines_or_no_enclosed_area_build_nothing() { + let (b, issues) = check(&[crease((0.0, 0.0), (10.0, 0.0), 1)]); + assert!(b.is_empty()); + assert_eq!(codes(&issues), vec!["noCut"]); + let (b, issues) = check(&[]); + assert!(b.is_empty()); + assert_eq!(codes(&issues), vec!["noCut"]); + let (b, issues) = check(&[line(LineKind::Cut, &[(0.0, 0.0), (50.0, 0.0), (50.0, 50.0)], false, 1)]); + assert!(b.is_empty()); + assert!(codes(&issues).contains(&"open") && codes(&issues).contains(&"looseEnd"), "{issues:?}"); + // A non-finite line is left out. + let mut lines = tray(); + lines.push(line(LineKind::Crease, &[(0.0, 0.0), (f64::NAN, 1.0)], false, 9)); + let (b, issues) = check(&lines); + assert!(issues.is_empty() && b[0].panels.len() == 5, "{issues:?}"); +} + +#[test] +fn a_cut_end_inside_the_blank_is_a_loose_end() { + let mut lines = tray(); + lines.push(line(LineKind::Cut, &[(80.0, 0.0), (80.0, 20.0)], false, 2)); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["looseEnd"], "{issues:?}"); + assert_eq!((issues[0].keys.clone(), issues[0].at), (vec![2], Some(p(80.0, 20.0)))); + assert_eq!(b[0].panels.len(), 5, "a cut into a wall does not divide it"); + // A slit that ends on a crease is not loose: it cuts the wall in two. + let mut lines = tray(); + lines.push(line(LineKind::Cut, &[(80.0, 0.0), (80.0, 30.0)], false, 2)); + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!((b[0].panels.len(), b[0].hinges.len()), (6, 5)); +} + +#[test] +fn a_cut_line_that_comes_back_through_its_own_end_meets_it() { + // From (80, 10) out to (90, 20), then back through (80, 10) to the outline at (70, 0): the + // start lies on the line's own second segment, so it is not loose. + let mut lines = tray(); + lines.push(line(LineKind::Cut, &[(80.0, 10.0), (90.0, 20.0), (70.0, 0.0)], false, 2)); + let (_, issues) = check(&lines); + assert!(!codes(&issues).contains(&"looseEnd"), "{issues:?}"); + // A first segment shorter than the tolerance does not make the second one meet the end. + let mut lines = tray(); + lines.push(line(LineKind::Cut, &[(90.0, 25.0), (90.05, 25.0), (80.0, 20.0), (80.0, 0.0)], false, 2)); + let (_, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["looseEnd"], "{issues:?}"); + assert_eq!(issues[0].at, Some(p(90.0, 25.0))); +} + +#[test] +fn two_outlines_joined_by_a_cut_line_are_both_material() { + let lines = vec![ + cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1), + cut(&[(150.0, 0.0), (180.0, 0.0), (180.0, 30.0), (150.0, 30.0)], 2), + line(LineKind::Cut, &[(100.0, 10.0), (150.0, 10.0)], false, 3), + ]; + let (b, issues) = check(&lines); + assert_eq!(b.len(), 1, "one connected piece"); + assert_eq!(areas(&b[0]), vec![900_000, 10_000_000], "{issues:?}"); + assert!(b[0].holes.is_empty()); + // A slot drawn across the outline is still cut out, not made material where it sticks out. + let lines = + vec![cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1), cut(&[(48.0, -10.0), (52.0, -10.0), (52.0, 20.0), (48.0, 20.0)], 2)]; + let (b, _) = check(&lines); + assert_eq!(b.len(), 1); + assert_eq!(areas(&b[0]), vec![10_000_000 - 80_000]); + // The same slot drawn as four open lines end to end, one of them backwards. + let slot = [(48.0, -10.0), (52.0, -10.0), (52.0, 20.0), (48.0, 20.0)]; + let mut lines = vec![cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1)]; + lines.push(line(LineKind::Cut, &[slot[0], slot[1]], false, 2)); + lines.push(line(LineKind::Cut, &[slot[2], slot[1]], false, 3)); + lines.push(line(LineKind::Cut, &[slot[2], slot[3]], false, 4)); + lines.push(line(LineKind::Cut, &[slot[3], slot[0]], false, 5)); + let (b, issues) = check(&lines); + assert_eq!(b.len(), 1, "{issues:?}"); + assert_eq!(areas(&b[0]), vec![10_000_000 - 80_000]); + // And with a gap within the tolerance at one corner. + lines[4] = line(LineKind::Cut, &[slot[3], (48.0, -9.95)], false, 5); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["gap"], "{issues:?}"); + assert_eq!(b.len(), 1); + assert_eq!(areas(&b[0]), vec![10_000_000 - 80_000]); + // A slot right across the blank, with no corner inside the outline and no outline corner + // inside the slot, cuts it in two. + let lines = vec![ + cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1), + cut(&[(10.0, -210.0), (20.0, -210.0), (20.0, 110.0), (10.0, 110.0)], 2), + ]; + let (b, _) = check(&lines); + assert_eq!(b.len(), 1); + assert_eq!(areas(&b[0]), vec![1_000_000, 8_000_000]); +} + +#[test] +fn an_outline_drawn_twice_keeps_its_material() { + let square = [(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)]; + let (b, issues) = check(&[cut(&square, 1), cut(&square, 2)]); + assert_eq!(codes(&issues), vec!["duplicate"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![1, 2]); + assert_eq!(b.len(), 1); + assert_eq!(areas(&b[0]), vec![10_000_000]); + // The same two squares as the subpaths of one compound path. + let mut twice = poly(&square, true); + twice.subpaths.extend(poly(&square, true).subpaths); + let (b, issues) = check(&[FoldLine { path: twice, kind: LineKind::Cut, angle: None, key: 1 }]); + assert_eq!(codes(&issues), vec!["duplicate"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![1]); + assert_eq!(areas(&b[0]), vec![10_000_000]); +} + +#[test] +fn a_large_tolerance_still_closes_nearly_touching_ends_and_short_outlines() { + // Ends 0.0005 apart, closer than 1/10,000 of the tolerance. + let nearly = line(LineKind::Cut, &[(0.0005, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0), (0.0, 0.0)], false, 1); + let (b, issues) = blanks(&[nearly], 10.0); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(areas(&b[0]), vec![10_000_000]); + // An outline shorter than the tolerance, 0.05 pt open: a gap, and no loose end. + let short = line(LineKind::Cut, &[(0.05, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0), (0.0, 0.0)], false, 1); + let (b, issues) = blanks(&[short], 10.0); + assert_eq!(codes(&issues), vec!["gap"], "{issues:?}"); + assert_eq!(areas(&b[0]), vec![1000]); +} + +#[test] +fn a_lookup_wider_than_the_occupied_cells_reads_only_those_cells() { + // Two points 1e-9 apart make cells about 2.4e-13 wide: a lookup 1e-6 around one spans some + // 10^14 cells, and finds both points by reading the two cells that hold them. + let cells = Cells::new(vec![(Rect::from_points(p(0.0, 0.0), p(0.0, 0.0)), 1), (Rect::from_points(p(1e-9, 0.0), p(1e-9, 0.0)), 2)], 0.0, 4096.0); + assert_eq!(cells.near(p(0.0, 0.0), 1e-6), vec![1, 2]); + assert_eq!(cells.near(p(5.0, 5.0), 1e-6), Vec::::new()); + // A square open by 0.0000011 pt at a 10 pt tolerance. + let square = line(LineKind::Cut, &[(0.0000011, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0), (0.0, 0.0)], false, 1); + let (b, issues) = blanks(&[square], 10.0); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b.len(), 1); +} + +#[test] +fn a_window_of_open_lines_with_a_slit_to_its_corner_is_still_a_hole() { + let outline = cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1); + let window = [(40.0, 40.0), (60.0, 40.0), (60.0, 60.0), (40.0, 60.0)]; + let slit = line(LineKind::Cut, &[(40.0, 0.0), (40.0, 40.0)], false, 2); + let (closed, issues) = check(&[outline.clone(), slit.clone(), cut(&window, 3)]); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!((closed[0].holes.len(), areas(&closed[0])), (1, vec![10_000_000 - 400_000])); + let mut lines = vec![outline, slit]; + for k in 0..4 { + lines.push(line(LineKind::Cut, &[window[k], window[(k + 1) % 4]], false, 3 + k as u64)); + } + let (open, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!((open[0].holes.len(), areas(&open[0])), (1, areas(&closed[0]))); + // The outline as four open lines too, the slit from its corner to the window's. + let corners = [(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)]; + let mut lines: Vec = (0..4).map(|k| line(LineKind::Cut, &[corners[k], corners[(k + 1) % 4]], false, 10 + k as u64)).collect(); + lines.push(line(LineKind::Cut, &[(0.0, 0.0), (40.0, 40.0)], false, 2)); + for k in 0..4 { + lines.push(line(LineKind::Cut, &[window[k], window[(k + 1) % 4]], false, 3 + k as u64)); + } + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!((b[0].holes.len(), areas(&b[0])), (1, areas(&closed[0]))); +} + +#[test] +fn a_grid_of_many_touching_outlines_is_classified_without_comparing_every_pair() { + // 100 × 100 touching squares, each its own closed outline: one piece of 10,000 panels. + let mut lines = vec![]; + for i in 0..100u64 { + for j in 0..100u64 { + let (x, y) = (10.0 * i as f64, 10.0 * j as f64); + lines.push(cut(&[(x, y), (x + 10.0, y), (x + 10.0, y + 10.0), (x, y + 10.0)], 100 * i + j)); + } + } + let (b, issues) = check(&lines); + assert!(b.is_empty()); + assert!(codes(&issues).contains(&"tooComplex"), "{issues:?}"); +} + +#[test] +fn open_cut_lines_far_from_the_origin_are_checked_without_overflow() { + let lines = [ + line(LineKind::Cut, &[(1e13, 0.0), (1e13 + 4096.0, 0.0), (1e13 + 4096.0, 4096.0)], false, 1), + line(LineKind::Cut, &[(1e13 + 4096.0, 4096.0), (1e13, 4096.0), (1e13, 0.0)], false, 2), + ]; + let (b, issues) = check(&lines); + assert!(b.len() <= 1, "{issues:?}"); +} + +#[test] +fn a_blank_in_the_hole_of_a_narrow_ring_is_a_blank_of_its_own() { + // The ring's own area (1,900) is less than the hole's (8,100), but the square lies in the hole. + let lines = vec![ + cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1), + cut(&[(5.0, 5.0), (95.0, 5.0), (95.0, 95.0), (5.0, 95.0)], 2), + cut(&[(40.0, 40.0), (60.0, 40.0), (60.0, 60.0), (40.0, 60.0)], 3), + ]; + let (b, issues) = check(&lines); + assert_eq!(b.len(), 2, "{issues:?}"); + assert_eq!(codes(&issues), vec!["ambiguous"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![3]); +} + +#[test] +fn too_many_segments_are_refused_before_the_lines_are_copied() { + // Many lines that together pass the limit by one segment. + let each: Vec<(f64, f64)> = (0..=64).map(|i| (i as f64, 0.0)).collect(); + let lines: Vec = (0..=(MAX_SEGMENTS / 64) as u64).map(|k| line(LineKind::Cut, &each, false, k)).collect(); + assert!(lines.len() * 64 > MAX_SEGMENTS); + let (b, issues) = check(&lines); + assert!(b.is_empty()); + assert_eq!(codes(&issues), vec!["tooComplex"]); +} + +#[test] +fn many_separate_blanks_each_with_a_window_are_told_apart() { + // A 50 × 40 grid of 10 pt squares 5 pt apart, each with a 4 pt window and a crease beside it. + let mut lines = vec![]; + for i in 0..50u64 { + for j in 0..40u64 { + let (x, y) = (15.0 * i as f64, 15.0 * j as f64); + let k = 10 * (40 * i + j); + lines.push(cut(&[(x, y), (x + 10.0, y), (x + 10.0, y + 10.0), (x, y + 10.0)], k)); + lines.push(cut(&[(x + 1.0, y + 1.0), (x + 5.0, y + 1.0), (x + 5.0, y + 5.0), (x + 1.0, y + 5.0)], k + 1)); + lines.push(crease((x + 7.0, y), (x + 7.0, y + 10.0), k + 2)); + } + } + let (blanks, issues) = check(&lines); + assert!(issues.is_empty(), "{:?}", issues.first()); + assert_eq!(blanks.len(), 2000); + assert!(blanks.iter().all(|b| b.panels.len() == 2 && b.hinges.len() == 1 && b.holes.len() == 1)); +} + +#[test] +fn many_separate_cut_lines_are_checked_by_the_cells_near_each_end() { + // 2,000 short slits from the top edge of a long blank, each ending loose inside it. + let mut lines = vec![cut(&[(0.0, 0.0), (4000.0, 0.0), (4000.0, 100.0), (0.0, 100.0)], 1)]; + for i in 0..2000u64 { + let x = 1.0 + 2.0 * i as f64; + lines.push(line(LineKind::Cut, &[(x, 0.0), (x, 50.0)], false, 10 + i)); + } + let (_, issues) = check(&lines); + let loose: Vec<&Issue> = issues.iter().filter(|i| i.code == IssueCode::LooseEnd).collect(); + assert_eq!(loose.len(), 2000); + assert!(loose.iter().all(|i| i.at.is_some_and(|at| (at.y - 50.0).abs() < 1e-9))); +} + +#[test] +fn too_many_segments_or_panels_are_too_complex() { + // One point more than segments. + let mut zigzag: Vec<(f64, f64)> = (0..=MAX_SEGMENTS + 1).map(|i| (i as f64 * 0.5, (i % 2) as f64)).collect(); + let (b, issues) = check(&[line(LineKind::Cut, &zigzag, false, 1)]); + assert!(b.is_empty()); + assert_eq!(codes(&issues), vec!["tooComplex"]); + zigzag.truncate(MAX_SEGMENTS + 1); + let (_, issues) = check(&[line(LineKind::Cut, &zigzag, false, 1)]); + assert!(!codes(&issues).contains(&"tooComplex"), "at the limit"); + // A grid of 16 × 16 panels is at the panel limit; 17 × 16 is past it. + let grid = |cols: usize| { + let mut lines = vec![cut(&[(0.0, 0.0), (cols as f64 * 10.0, 0.0), (cols as f64 * 10.0, 160.0), (0.0, 160.0)], 1)]; + for i in 1..cols { + lines.push(crease((i as f64 * 10.0, 0.0), (i as f64 * 10.0, 160.0), 100 + i as u64)); + } + for j in 1..16 { + lines.push(crease((0.0, j as f64 * 10.0), (cols as f64 * 10.0, j as f64 * 10.0), 200 + j as u64)); + } + lines + }; + let (b, issues) = check(&grid(16)); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b[0].panels.len(), MAX_PANELS); + let (b, issues) = check(&grid(17)); + assert!(b.is_empty()); + assert_eq!(codes(&issues), vec!["tooComplex"]); +} + +#[test] +fn lines_on_top_of_each_other_are_reported() { + let mut lines = tray(); + lines.push(crease((40.0, 0.0), (120.0, 0.0), 20)); + let (_, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["cutOverCrease"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![1, 20]); + + let mut lines = tray(); + lines.push(crease((130.0, 30.0), (30.0, 30.0), 20)); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["duplicate"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![10, 20]); + assert_eq!(b[0].hinges.len(), 4); + assert_eq!(b[0].hinges.iter().find(|h| h.keys.contains(&20)).map(|h| h.keys.clone()), Some(vec![10, 20])); +} + +#[test] +fn a_crease_that_ends_inside_a_panel_is_dangling() { + let mut lines = tray(); + lines.push(crease((80.0, 30.0), (80.0, 60.0), 20)); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["danglingCrease"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![20]); + assert_eq!(b[0].panels.len(), 5); +} + +#[test] +fn a_hinge_shorter_than_the_tolerance_divides_nothing_and_leaves_a_loose_panel() { + let lines = vec![ + cut(&[(0.0, 0.0), (50.0, 0.0), (50.0, 49.95), (100.0, 49.95), (100.0, 99.95), (50.0, 99.95), (50.0, 50.0), (0.0, 50.0)], 1), + crease((50.0, 49.95), (50.0, 50.0), 2), + ]; + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["noSplit", "loosePanel"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![2]); + assert!(b[0].hinges.is_empty()); + // The same with a hinge as long as the panels: no issue. + let lines = vec![cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 50.0), (0.0, 50.0)], 1), crease((50.0, 0.0), (50.0, 50.0), 2)]; + let (_, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); +} + +#[test] +fn hinge_pieces_far_apart_are_measured_by_their_own_length() { + // A window leaves two 0.02 pt strips joining the halves, each crossed by a crease: 0.04 pt of + // hinge, though its pieces span 100 pt. + let lines = vec![ + cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1), + cut(&[(40.0, 0.02), (60.0, 0.02), (60.0, 99.98), (40.0, 99.98)], 2), + crease((50.0, 0.0), (50.0, 0.02), 3), + crease((50.0, 99.98), (50.0, 100.0), 4), + ]; + let (b, issues) = check(&lines); + assert!(codes(&issues).contains(&"noSplit"), "{issues:?}"); + assert!(b[0].hinges.is_empty()); +} + +#[test] +fn a_window_split_by_a_cut_line_is_one_hole() { + let mut lines = + vec![cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1), cut(&[(40.0, 40.0), (60.0, 40.0), (60.0, 60.0), (40.0, 60.0)], 2)]; + lines.push(line(LineKind::Cut, &[(40.0, 50.0), (60.0, 50.0)], false, 3)); + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b[0].holes.len(), 1); + let area = vectorcraft_pathops::area(&b[0].holes[0], FillRule::NonZero); + assert!((area - 400.0).abs() < 1e-3, "{area}"); +} + +#[test] +fn a_hinge_drawn_as_short_pieces_is_measured_whole() { + // Ten 5 pt pieces make a 50 pt hinge, longer than a 10 pt tolerance though each piece is not. + let mut lines = vec![cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 50.0), (0.0, 50.0)], 1)]; + for k in 0..10u64 { + let y = 5.0 * k as f64; + lines.push(crease((50.0, y), (50.0, y + 5.0), 10 + k)); + } + let (b, issues) = blanks(&lines, 10.0); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b[0].hinges.len(), 1); + let h = &b[0].hinges[0]; + assert!((h.from.distance(h.to) - 50.0).abs() < 1e-6 && h.keys.len() == 10, "{h:?}"); +} + +#[test] +fn a_crease_outside_the_blank_is_reported() { + let mut lines = tray(); + lines.push(crease((200.0, 0.0), (250.0, 0.0), 20)); + let (_, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["outside"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![20]); +} + +#[test] +fn a_bent_crease_folds_along_its_longest_piece() { + let mut lines = tray(); + lines[1] = line(LineKind::Crease, &[(30.0, 30.0), (90.0, 30.0), (130.0, 32.0)], false, 10); + lines[0] = cut( + &[ + (30.0, 0.0), + (130.0, 0.0), + (130.0, 32.0), + (160.0, 32.0), + (160.0, 90.0), + (130.0, 90.0), + (130.0, 120.0), + (30.0, 120.0), + (30.0, 90.0), + (0.0, 90.0), + (0.0, 30.0), + (30.0, 30.0), + ], + 1, + ); + lines[2] = crease((130.0, 32.0), (130.0, 90.0), 11); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["notStraight"], "{issues:?}"); + let h = b[0].hinges.iter().find(|h| h.keys == vec![10]).unwrap(); + assert!(!h.straight); + assert!((h.from.y - 30.0).abs() < 1e-9 && (h.to.y - 30.0).abs() < 1e-9, "along the 60 pt piece: {h:?}"); + // Within the tolerance, a crease is straight. + let mut lines = tray(); + lines[1] = line(LineKind::Crease, &[(30.0, 30.0), (90.0, 30.05), (130.0, 30.0)], false, 10); + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert!(b[0].hinges.iter().all(|h| h.straight)); +} + +#[test] +fn a_slot_too_narrow_to_map_is_a_sliver() { + let mut lines = tray(); + lines.push(cut(&[(60.0, 45.0), (60.004, 45.0), (60.004, 75.0), (60.0, 75.0)], 2)); + let (_, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["sliver"], "{issues:?}"); + assert!(issues[0].at.is_some_and(|a| Rect::new(59.9, 44.0, 60.1, 76.0).contains(a))); +} + +#[test] +fn lines_in_a_hole_are_ambiguous() { + let mut window = tray(); + window.push(cut(&[(60.0, 45.0), (100.0, 45.0), (100.0, 75.0), (60.0, 75.0)], 2)); + let mut lines = window.clone(); + lines.push(crease((70.0, 45.0), (70.0, 75.0), 20)); + let (_, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["ambiguous"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![20]); + let mut lines = window; + lines.push(cut(&[(70.0, 50.0), (90.0, 50.0), (90.0, 70.0), (70.0, 70.0)], 3)); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["ambiguous"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![3]); + assert_eq!(b.len(), 2, "the square in the window is a blank of its own"); +} + +#[test] +fn partial_cuts_fold_the_other_way_and_a_line_s_own_angle_wins() { + let mut lines = tray(); + lines[1].kind = LineKind::PartialCut; + lines[2].angle = Some(45.0); + lines[3].kind = LineKind::Perforation; + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + let angle = |key: u64| b[0].hinges.iter().find(|h| h.keys == vec![key]).map(|h| h.angle); + assert_eq!((angle(10), angle(11), angle(12), angle(13)), (Some(-90.0), Some(45.0), Some(90.0), Some(90.0))); +} + +#[test] +fn every_code_has_an_id_and_a_severity() { + let ids: Vec<&str> = IssueCode::ALL.iter().map(|c| c.id()).collect(); + assert_eq!(ids.len(), 15); + let mut unique = ids.clone(); + unique.sort_unstable(); + unique.dedup(); + assert_eq!(unique.len(), 15); + let errors: Vec<&str> = IssueCode::ALL.iter().filter(|c| c.is_error()).map(|c| c.id()).collect(); + assert_eq!(errors, vec!["noCut", "open", "looseEnd", "tooComplex", "cutOverCrease"]); + let mut sorted = IssueCode::ALL; + sorted.sort(); + assert_eq!(sorted, IssueCode::ALL, "listed in issue order"); +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(48))] + /// Random fold lines never panic, and the panels and hinges they give are consistent. + #[test] + fn random_fold_lines_give_consistent_blanks( + segs in proptest::collection::vec((0u8..4, -50.0f64..50.0, -50.0f64..50.0, -50.0f64..50.0, -50.0f64..50.0), 1..10), + boxed in any::(), + ) { + let kinds = [LineKind::Cut, LineKind::Crease, LineKind::PartialCut, LineKind::Perforation]; + let mut lines: Vec = segs + .iter() + .enumerate() + .map(|(i, &(k, a, b, c, d))| line(kinds[usize::from(k)], &[(a, b), (c, d)], false, i as u64)) + .collect(); + if boxed { + lines.push(cut(&[(-40.0, -40.0), (40.0, -40.0), (40.0, 40.0), (-40.0, 40.0)], 99)); + } + let (blanks, issues) = blanks(&lines, TOL); + for b in &blanks { + prop_assert!(!b.panels.is_empty() && b.panels.len() <= MAX_PANELS); + for h in &b.hinges { + prop_assert!(h.a < h.b && h.b < b.panels.len()); + prop_assert!(h.from.is_finite() && h.to.is_finite()); + } + } + let mut sorted = issues.clone(); + sorted.sort_by_key(|i| i.code); + prop_assert_eq!(sorted, issues); + } +} diff --git a/crates/three-d/src/lib.rs b/crates/three-d/src/lib.rs index d01a8b9840..01b5c75d9f 100644 --- a/crates/three-d/src/lib.rs +++ b/crates/three-d/src/lib.rs @@ -6,6 +6,7 @@ //! intersecting profiles can have ambiguous visibility and are not solid modelling inputs. #![forbid(unsafe_code)] +pub mod fold; mod solid; mod visibility; pub use solid::{ diff --git a/crates/ui-egui/src/addons/packaging.rs b/crates/ui-egui/src/addons/packaging.rs index 1c70bef5d0..1e827a7efc 100644 --- a/crates/ui-egui/src/addons/packaging.rs +++ b/crates/ui-egui/src/addons/packaging.rs @@ -2,10 +2,15 @@ //! panel lists the fold line roles, each with its swatch's chip and how many of the selected objects //! have it (of the whole document while nothing is selected); clicking a role gives the selected //! paths that role (`addon.packaging.setRole`). Its menu's Role Swatches… picks the swatch that -//! carries a role (`addon.packaging.setRoleSwatch`). +//! carries a role (`addon.packaging.setRoleSwatch`). Its Check button, like the Check Fold Lines menu +//! item, checks the fold lines (`addon.packaging.check`) and lists the issues found under it, each +//! with a Select button; the list is kept until the document changes. + +use std::sync::{Arc, Weak}; use egui::{Align, Layout, Sense, Ui, vec2}; use serde_json::{Value, json}; +use vectorcraft_engine::doc::Document; use crate::VectorcraftApp; use crate::menus::Item; @@ -18,12 +23,16 @@ pub const ID: &str = "foldLines"; pub const SET_ROLE: &str = "addon.packaging.setRole"; /// The command that picks a role's swatch. pub const SET_ROLE_SWATCH: &str = "addon.packaging.setRoleSwatch"; +/// The command that checks the fold lines. +pub const CHECK: &str = "addon.packaging.check"; /// The roles by name, as `addon.packaging.setRole` and Role Swatches… take them. pub const ROLES: &[(&str, &str)] = &[("Cut Line", "cut"), ("Crease Line", "crease"), ("Partial Cut Line", "partialCut"), ("Perforation Line", "perforation")]; /// Where the panel keeps the last `addon.packaging.roles` answer (panel state). const STATE: &str = "fold-lines"; +/// Where the panel keeps the last check (panel state). +const CHECKED: &str = "fold-lines-check"; /// Object › Plug-ins › Packaging Tools. pub fn menu() -> Vec { @@ -35,9 +44,141 @@ pub fn menu() -> Vec { make("Make Crease Line", "crease"), make("Make Partial Cut Line", "partialCut"), make("Make Perforation Line", "perforation"), + Item::Sep, + Item::Cmd("Check Fold Lines", CHECK, Value::Null), ] } +/// One issue of a check: whether it is an error, its message (English) and the objects it names. +#[derive(Clone, Debug, PartialEq)] +pub(crate) struct Issue { + pub error: bool, + pub message: String, + pub ids: Vec, +} + +/// The document a check was made on: its id, and its content as it was then. Selecting changes +/// neither, so the issues stay listed while their Select buttons are used. The content is held +/// weakly: it is compared, never kept alive. +type DocKey = (u64, Weak); + +/// The last check of a document. +#[derive(Clone, Debug, Default)] +pub(crate) struct Checked { + pub key: Option, + pub panels: u64, + pub hinges: u64, + pub issues: Vec, +} + +impl Checked { + /// The check `r` (an `addon.packaging.check` answer) of the document `key`. + fn of(key: DocKey, r: &Value) -> Checked { + let count = |k: &str| r[k].as_u64().unwrap_or(0); + let issues: Vec = r["issues"] + .as_array() + .into_iter() + .flatten() + .map(|i| Issue { + error: i["severity"] == "error", + message: i["message"].as_str().unwrap_or_default().to_string(), + ids: i["ids"].as_array().into_iter().flatten().filter_map(Value::as_u64).collect(), + }) + .collect(); + Checked { key: Some(key), panels: count("panels"), hinges: count("hinges"), issues } + } + + /// The summary line, in English (the status bar and the panel show it translated). + fn summary(&self) -> String { + let errors = self.issues.iter().filter(|i| i.error).count(); + crate::i18n::fmt( + "Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings}", + &[ + ("panels", &self.panels.to_string()), + ("hinges", &self.hinges.to_string()), + ("errors", &errors.to_string()), + ("warnings", &(self.issues.len() - errors).to_string()), + ], + ) + } +} + +/// The active document's [`DocKey`]. +fn doc_key(app: &VectorcraftApp) -> Option { + app.session.active().map(|st| (st.uid, Arc::downgrade(&st.doc))) +} + +/// Runs `addon.packaging.check` with `p` and shows its summary in the status bar → the check, kept +/// in `ctx` for the panel. +fn run_check(app: &mut VectorcraftApp, ctx: &egui::Context, p: Value) -> Option { + let r = app.run(CHECK, p).map_err(|e| app.status(e)).ok()?; + let checked = Checked::of(doc_key(app)?, &r); + app.status(checked.summary()); + set_pstate(ctx, CHECKED, checked.clone()); + Some(checked) +} + +/// Check Fold Lines from its menu item: checks with `p`, keeps the issues for the Fold Lines panel +/// and shows the panel. +pub(crate) fn check(app: &mut VectorcraftApp, p: Value) { + let ctx = app.ui_ctx.clone().unwrap_or_default(); + if run_check(app, &ctx, p).is_some() + && let Err(e) = crate::panel_docking::reveal_panel(app, ID) + { + app.status(e); + } +} + +/// The last check of the active document, while the document has not changed since. +fn last_check(app: &VectorcraftApp, ctx: &egui::Context) -> Option { + let checked: Checked = pstate(ctx, CHECKED); + let same = match (&checked.key, doc_key(app)) { + (Some((uid, doc)), Some((now, current))) => *uid == now && doc.ptr_eq(¤t), + _ => false, + }; + same.then_some(checked) +} + +/// The Check button, then the last check's summary and issues (errors in the error color, warnings +/// in the warning color), each with a Select button; clicking an issue selects its objects too. +fn show_check(app: &mut VectorcraftApp, ui: &mut Ui) { + widgets::divider(ui); + let width = ui.available_width(); + if widgets::flat_button(ui, tl!("Check"), width).clicked() { + run_check(app, ui.ctx(), json!({})); + } + let Some(checked) = last_check(app, ui.ctx()) else { return }; + ui.add_space(4.0); + dim_label(ui, &crate::i18n::msg(&checked.summary())); + if checked.issues.is_empty() { + dim_label(ui, tl!("No issues found.")); + } + let t = crate::theme::Tokens::get(ui.ctx()); + let mut select = None; + for (n, issue) in checked.issues.iter().enumerate() { + ui.horizontal(|ui| { + let can = !issue.ids.is_empty(); + let picked = ui + .with_layout(Layout::right_to_left(Align::Center), |ui| { + let button = ui.add_enabled_ui(can, |ui| widgets::flat_button(ui, tl!("Select"), 56.0)).inner; + let text = egui::RichText::new(crate::i18n::msg(&issue.message)).color(if issue.error { t.error } else { t.warning }); + let row = + ui.with_layout(Layout::left_to_right(Align::Center), |ui| ui.add(egui::Label::new(text).sense(Sense::click()).wrap())).inner; + button.clicked() || (row.clicked() && can) + }) + .inner; + if picked { + select = Some(n); + } + }); + } + if let Some(issue) = select.and_then(|n| checked.issues.get(n)) + && let Err(e) = app.run("select.set", json!({ "ids": issue.ids })) + { + app.status(e); + } +} + /// One role row: (role id, swatch name, the swatch's paint if the document has it, count). type Row = (String, String, Option, u64); @@ -103,6 +244,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { { app.status(e); } + show_check(app, ui); } /// Role Swatches… (the dialog of `addon.packaging.setRoleSwatch`): when another role is picked, its diff --git a/crates/ui-egui/src/addons/packaging/tests.rs b/crates/ui-egui/src/addons/packaging/tests.rs index cfe9909dc8..808956e4d7 100644 --- a/crates/ui-egui/src/addons/packaging/tests.rs +++ b/crates/ui-egui/src/addons/packaging/tests.rs @@ -1,7 +1,7 @@ use serde_json::json; use vectorcraft_engine::Session; -use super::{ID, ROLES, SET_ROLE, SET_ROLE_SWATCH, show}; +use super::{CHECK, ID, ROLES, SET_ROLE, SET_ROLE_SWATCH, show}; use crate::tests_labels::painted_text; use crate::{VectorcraftApp, menus}; @@ -125,6 +125,137 @@ fn role_swatches_shows_the_swatch_of_the_role_picked() { assert_eq!(crate::dialogs::form::params(&d), json!({"role": "crease", "swatch": "Ink"}), "the dialog sends no __role"); } +/// An app with a square blank cut on its outline, a crease across it and a cut line that stops +/// inside it, nothing selected → (app, the cut line that stops). +fn blank() -> (VectorcraftApp, u64) { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + let path = |app: &mut VectorcraftApp, d: &str| app.run("path.create", json!({ "d": d })).unwrap()["id"].as_u64().unwrap(); + let outline = path(&mut app, "M50 50 L250 50 L250 250 L50 250 Z"); + let crease = path(&mut app, "M50 150 L250 150"); + let slit = path(&mut app, "M100 50 L100 100"); + app.run(SET_ROLE, json!({"role": "cut", "ids": [outline, slit]})).unwrap(); + app.run(SET_ROLE, json!({"role": "crease", "ids": [crease]})).unwrap(); + app.run("select.none", json!({})).unwrap(); + (app, slit) +} + +/// Frames of the panel in one context, the pointer clicking the middle of the element that screen +/// readers name `click` (egui finds what the pointer is over from the frame before, so the move +/// gets a frame of its own) → the text the last frame painted. +fn frames(app: &mut VectorcraftApp, ctx: &egui::Context, click: Option<&str>) -> String { + ctx.enable_accesskit(); + crate::theme::install_fonts(ctx); + // The context's clock runs on from its last frame: egui requires time to move forward. + let mut time = ctx.input(|i| i.time); + let mut frame = |app: &mut VectorcraftApp, events: Vec| { + time += 0.1; + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(320.0, 480.0)); + let input = egui::RawInput { events, time: Some(time), screen_rect: Some(screen), ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| show(app, ui)); + out.textures_delta.clear(); + out + }; + frame(app, vec![]); + let out = frame(app, vec![]); + let Some(label) = click else { return crate::tests_labels::shapes_text(&out) }; + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + // A button carries its text as its name, a label as its value. + let node = nodes.iter().find(|(_, n)| n.label() == Some(label) || n.value() == Some(label)); + let b = node.unwrap_or_else(|| panic!("nothing named {label:?}")).1.bounds().expect("bounds"); + let at = egui::pos2((b.x0 + b.x1) as f32 * 0.5, (b.y0 + b.y1) as f32 * 0.5); + let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + frame(app, vec![egui::Event::PointerMoved(at)]); + frame(app, vec![button(true)]); + let out = frame(app, vec![button(false)]); + crate::tests_labels::shapes_text(&out) +} + +#[test] +fn check_fold_lines_lists_its_issues_in_the_panel_until_the_document_changes() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let (mut app, _) = blank(); + let entries = menus::menu_entries(&app); + let item = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Packaging Tools"] && e.label == "Check Fold Lines").expect("listed"); + assert_eq!(item.command.as_deref(), Some(CHECK)); + let ctx = egui::Context::default(); + app.ui_ctx = Some(ctx.clone()); + assert!(!crate::panel_docking::showing(&app.ui, ID)); + menus::invoke(&mut app, CHECK, item.params.clone()); + assert!(crate::panel_docking::showing(&app.ui, ID), "the panel opens"); + assert_eq!(app.ui.status, "Panels: 2, creases: 1, errors: 1, warnings: 0"); + let text = frames(&mut app, &ctx, None); + assert!(text.contains("A cut line ends without meeting another cut line."), "{text}"); + assert!(text.contains("Panels: 2, creases: 1, errors: 1, warnings: 0") && text.contains("Select"), "{text}"); + // Any change to the document takes the list away. + app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 5, "height": 5})).unwrap(); + let text = frames(&mut app, &ctx, None); + assert!(!text.contains("A cut line ends"), "{text}"); +} + +#[test] +fn the_check_button_checks_and_clicking_an_issue_selects_its_lines() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let (mut app, slit) = blank(); + let ctx = egui::Context::default(); + let text = frames(&mut app, &ctx, Some("Check")); + assert!(text.contains("A cut line ends without meeting another cut line."), "{text}"); + assert!(app.session.active().unwrap().selection.is_empty()); + frames(&mut app, &ctx, Some("A cut line ends without meeting another cut line.")); + let selected: Vec = app.session.active().unwrap().selection.objects.iter().map(|id| id.0).collect(); + assert_eq!(selected, [slit]); + let text = frames(&mut app, &ctx, None); + assert!(text.contains("A cut line ends without meeting another cut line."), "selecting keeps the list: {text}"); + // A clean blank: no issues. + app.run("edit.clear", json!({})).unwrap(); + let text = frames(&mut app, &ctx, Some("Check")); + assert!(text.contains("No issues found.") && text.contains("Panels: 2, creases: 1, errors: 0, warnings: 0"), "{text}"); +} + +#[test] +fn issues_and_the_summary_show_in_the_interface_language() { + let (mut app, _) = blank(); + let ctx = egui::Context::default(); + crate::i18n::set_current(crate::i18n::Lang::from_code("de").unwrap()); + let text = frames(&mut app, &ctx, Some(crate::i18n::t("Check"))); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert!(!text.contains("A cut line ends") && !text.contains("Panels:"), "{text}"); + assert!(text.contains("Schnittlinie") && text.contains('2'), "{text}"); +} + +/// The messages `addon.packaging.check` gives its issues, one for each code (two for `noCut`). +const ISSUE_MESSAGES: [&str; 16] = [ + "No cut lines are in the selection.", + "No cut lines are in the document.", + "The cut lines do not enclose an area.", + "A cut line ends without meeting another cut line.", + "A gap between cut lines was closed.", + "The fold lines are too complex to check.", + "A cut line and a crease lie on top of each other.", + "Two lines of the same role lie on top of each other.", + "A crease ends inside a panel.", + "A crease does not divide two panels.", + "A crease lies outside the cut outline.", + "A crease that is not straight is folded along one straight line.", + "A gap between cut lines is too narrow to tell apart.", + "A cut-out area holds other fold lines.", + "A panel is not joined to the rest by a crease.", + "A fold line is on a non-printing layer.", +]; + +#[test] +fn every_issue_message_translates_in_every_complete_message_catalog() { + for code in [ + "cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "zh-hans", "zh-hant", "fi", "tr", + "ca", "nl", "da", + ] { + let lang = crate::i18n::Lang::from_code(code).unwrap(); + for m in ISSUE_MESSAGES.into_iter().chain(["Panels: 3, creases: 2, errors: 1, warnings: 0"]) { + assert_ne!(crate::i18n::message(lang, m), m, "{code}: {m}"); + } + } +} + #[test] fn the_panel_without_a_document_asks_for_one() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 71e443a399..ab9ed92de5 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -7084,4 +7084,23 @@ breakText Glyphs Глифи No objects are selected. Няма избрани обекти. Open a document to mark its fold lines. Отворете документ, за да отбележите линиите му на сгъване. Remove Fold Line Role Премахни вида на линията + Check Провери + Check Fold Lines Провери линиите на сгъване +@msg No cut lines are in the selection. В селекцията няма линии за рязане. +@msg No cut lines are in the document. В документа няма линии за рязане. +@msg The cut lines do not enclose an area. Линиите за рязане не ограждат площ. +@msg A cut line ends without meeting another cut line. Линия за рязане завършва, без да срещне друга линия за рязане. +@msg A gap between cut lines was closed. Процеп между линии за рязане беше затворен. +@msg The fold lines are too complex to check. Линиите на сгъване са твърде сложни за проверка. +@msg A cut line and a crease lie on top of each other. Линия за рязане и линия за биговане лежат една върху друга. +@msg Two lines of the same role lie on top of each other. Две линии от един и същи вид лежат една върху друга. +@msg A crease ends inside a panel. Линия за биговане завършва вътре в панел. +@msg A crease does not divide two panels. Линия за биговане не разделя два панела. +@msg A crease lies outside the cut outline. Линия за биговане лежи извън контура за рязане. +@msg A crease that is not straight is folded along one straight line. Линия за биговане, която не е права, се сгъва по една права линия. +@msg A gap between cut lines is too narrow to tell apart. Процеп между линии за рязане е твърде тесен, за да се различи. +@msg A cut-out area holds other fold lines. Изрязана област съдържа други линии на сгъване. +@msg A panel is not joined to the rest by a crease. Панел не е свързан с останалите с линия за биговане. +@msg A fold line is on a non-printing layer. Линия на сгъване е на слой, който не се печата. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, бигове: {hinges}, грешки: {errors}, предупреждения: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer трябва да е "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 883d6dd387..d6cc94f911 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -7137,4 +7137,23 @@ shape Open Otvoren No objects are selected. Nijedan objekat nije odabran. Open a document to mark its fold lines. Otvorite dokument da označite njegove linije savijanja. Remove Fold Line Role Ukloni vrstu linije + Check Provjeri + Check Fold Lines Provjeri linije savijanja +@msg No cut lines are in the selection. U odabiru nema linija rezanja. +@msg No cut lines are in the document. U dokumentu nema linija rezanja. +@msg The cut lines do not enclose an area. Linije rezanja ne zatvaraju nijednu površinu. +@msg A cut line ends without meeting another cut line. Linija rezanja završava a da ne susreće drugu liniju rezanja. +@msg A gap between cut lines was closed. Razmak između linija rezanja je zatvoren. +@msg The fold lines are too complex to check. Linije savijanja su previše složene za provjeru. +@msg A cut line and a crease lie on top of each other. Linija rezanja i linija bigovanja leže jedna preko druge. +@msg Two lines of the same role lie on top of each other. Dvije linije iste vrste leže jedna preko druge. +@msg A crease ends inside a panel. Linija bigovanja završava unutar panela. +@msg A crease does not divide two panels. Linija bigovanja ne razdvaja dva panela. +@msg A crease lies outside the cut outline. Linija bigovanja leži izvan konture rezanja. +@msg A crease that is not straight is folded along one straight line. Linija bigovanja koja nije ravna savija se duž jedne prave linije. +@msg A gap between cut lines is too narrow to tell apart. Razmak između linija rezanja je preuzak da bi se razlikovao. +@msg A cut-out area holds other fold lines. Izrezana površina sadrži druge linije savijanja. +@msg A panel is not joined to the rest by a crease. Panel nije povezan s ostatkom nijednom linijom bigovanja. +@msg A fold line is on a non-printing layer. Linija savijanja je na sloju koji se ne štampa. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneli: {panels}, bigovi: {hinges}, greške: {errors}, upozorenja: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer mora biti "singleLine", "everyLine", "standardSingleLine" ili "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index a8a63cbf55..0089095906 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7945,4 +7945,23 @@ breakText Glyphs Glifs No objects are selected. No hi ha cap objecte seleccionat. Open a document to mark its fold lines. Obre un document per marcar-ne les línies de plegat. Remove Fold Line Role Elimina el tipus de línia + Check Comprova + Check Fold Lines Comprova les línies de plegat +@msg No cut lines are in the selection. No hi ha cap línia de tall a la selecció. +@msg No cut lines are in the document. No hi ha cap línia de tall al document. +@msg The cut lines do not enclose an area. Les línies de tall no tanquen cap àrea. +@msg A cut line ends without meeting another cut line. Una línia de tall acaba sense trobar cap altra línia de tall. +@msg A gap between cut lines was closed. S’ha tancat un buit entre línies de tall. +@msg The fold lines are too complex to check. Les línies de plegat són massa complexes per comprovar-les. +@msg A cut line and a crease lie on top of each other. Una línia de tall i una d’hendit estan superposades. +@msg Two lines of the same role lie on top of each other. Dues línies del mateix tipus estan superposades. +@msg A crease ends inside a panel. Una línia d’hendit acaba dins d’un panell. +@msg A crease does not divide two panels. Una línia d’hendit no separa dos panells. +@msg A crease lies outside the cut outline. Una línia d’hendit és fora del contorn de tall. +@msg A crease that is not straight is folded along one straight line. Una línia d’hendit que no és recta es plega al llarg d’una sola línia recta. +@msg A gap between cut lines is too narrow to tell apart. Un buit entre línies de tall és massa estret per distingir-lo. +@msg A cut-out area holds other fold lines. Una àrea retallada conté altres línies de plegat. +@msg A panel is not joined to the rest by a crease. Un panell no està unit a la resta per cap línia d’hendit. +@msg A fold line is on a non-printing layer. Una línia de plegat és en una capa que no s’imprimeix. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panells: {panels}, hendits: {hinges}, errors: {errors}, avisos: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer ha de ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 569b1347ec..299aa6cedc 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -9742,3 +9742,22 @@ breakText Glyphs Glyfy No objects are selected. Nejsou vybrány žádné objekty. Open a document to mark its fold lines. Otevřete dokument, abyste označili jeho linie skladu. Remove Fold Line Role Odstranit typ linie + Check Zkontrolovat + Check Fold Lines Zkontrolovat linie skladu +@msg No cut lines are in the selection. Ve výběru nejsou žádné linie řezu. +@msg No cut lines are in the document. V dokumentu nejsou žádné linie řezu. +@msg The cut lines do not enclose an area. Linie řezu neohraničují žádnou plochu. +@msg A cut line ends without meeting another cut line. Linie řezu končí, aniž by se setkala s jinou linií řezu. +@msg A gap between cut lines was closed. Mezera mezi liniemi řezu byla uzavřena. +@msg The fold lines are too complex to check. Linie skladu jsou příliš složité na kontrolu. +@msg A cut line and a crease lie on top of each other. Linie řezu a linie bigu leží přes sebe. +@msg Two lines of the same role lie on top of each other. Dvě linie stejného typu leží přes sebe. +@msg A crease ends inside a panel. Linie bigu končí uvnitř panelu. +@msg A crease does not divide two panels. Linie bigu nerozděluje dva panely. +@msg A crease lies outside the cut outline. Linie bigu leží mimo obrys řezu. +@msg A crease that is not straight is folded along one straight line. Linie bigu, která není rovná, se ohýbá podél jedné přímky. +@msg A gap between cut lines is too narrow to tell apart. Mezera mezi liniemi řezu je příliš úzká na rozlišení. +@msg A cut-out area holds other fold lines. Vyříznutá oblast obsahuje další linie skladu. +@msg A panel is not joined to the rest by a crease. Panel není se zbytkem spojen žádnou linií bigu. +@msg A fold line is on a non-printing layer. Linie skladu je na netisknutelné vrstvě. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panely: {panels}, bigy: {hinges}, chyby: {errors}, upozornění: {warnings} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 4578e4efc1..647596237c 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -9844,4 +9844,23 @@ breakText Glyphs Glyffer No objects are selected. Ingen objekter er markeret. Open a document to mark its fold lines. Åbn et dokument for at markere dets foldelinjer. Remove Fold Line Role Fjern linjetype + Check Kontrollér + Check Fold Lines Kontrollér foldelinjer +@msg No cut lines are in the selection. Der er ingen skærelinjer i markeringen. +@msg No cut lines are in the document. Der er ingen skærelinjer i dokumentet. +@msg The cut lines do not enclose an area. Skærelinjerne omslutter ikke et område. +@msg A cut line ends without meeting another cut line. En skærelinje slutter uden at møde en anden skærelinje. +@msg A gap between cut lines was closed. Et mellemrum mellem skærelinjer blev lukket. +@msg The fold lines are too complex to check. Foldelinjerne er for komplekse til at kontrollere. +@msg A cut line and a crease lie on top of each other. En skærelinje og en rillelinje ligger oven på hinanden. +@msg Two lines of the same role lie on top of each other. To linjer af samme type ligger oven på hinanden. +@msg A crease ends inside a panel. En rillelinje slutter inde i et panel. +@msg A crease does not divide two panels. En rillelinje deler ikke to paneler. +@msg A crease lies outside the cut outline. En rillelinje ligger uden for skærekonturen. +@msg A crease that is not straight is folded along one straight line. En rillelinje, der ikke er lige, foldes langs én ret linje. +@msg A gap between cut lines is too narrow to tell apart. Et mellemrum mellem skærelinjer er for smalt til at skelne. +@msg A cut-out area holds other fold lines. Et udskåret område indeholder andre foldelinjer. +@msg A panel is not joined to the rest by a crease. Et panel er ikke forbundet med resten af en rillelinje. +@msg A fold line is on a non-printing layer. En foldelinje ligger på et lag, der ikke udskrives. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, riller: {hinges}, fejl: {errors}, advarsler: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer skal være "singleLine", "everyLine", "standardSingleLine" eller "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index c943c89dd2..4be132dc4f 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -9340,3 +9340,22 @@ breakText Glyphs Glyphen No objects are selected. Es sind keine Objekte ausgewählt. Open a document to mark its fold lines. Öffnen Sie ein Dokument, um seine Faltlinien festzulegen. Remove Fold Line Role Linienart entfernen + Check Prüfen + Check Fold Lines Faltlinien prüfen +@msg No cut lines are in the selection. Die Auswahl enthält keine Schnittlinien. +@msg No cut lines are in the document. Das Dokument enthält keine Schnittlinien. +@msg The cut lines do not enclose an area. Die Schnittlinien umschließen keine Fläche. +@msg A cut line ends without meeting another cut line. Eine Schnittlinie endet, ohne auf eine andere Schnittlinie zu treffen. +@msg A gap between cut lines was closed. Eine Lücke zwischen Schnittlinien wurde geschlossen. +@msg The fold lines are too complex to check. Die Faltlinien sind zu komplex für die Prüfung. +@msg A cut line and a crease lie on top of each other. Eine Schnittlinie und eine Rilllinie liegen übereinander. +@msg Two lines of the same role lie on top of each other. Zwei Linien derselben Linienart liegen übereinander. +@msg A crease ends inside a panel. Eine Rilllinie endet innerhalb eines Felds. +@msg A crease does not divide two panels. Eine Rilllinie trennt keine zwei Felder. +@msg A crease lies outside the cut outline. Eine Rilllinie liegt außerhalb der Schnittkontur. +@msg A crease that is not straight is folded along one straight line. Eine nicht gerade Rilllinie wird entlang einer geraden Linie gefaltet. +@msg A gap between cut lines is too narrow to tell apart. Eine Lücke zwischen Schnittlinien ist zu schmal, um sie zu unterscheiden. +@msg A cut-out area holds other fold lines. Ein ausgeschnittener Bereich enthält weitere Faltlinien. +@msg A panel is not joined to the rest by a crease. Ein Feld ist durch keine Rilllinie mit den übrigen verbunden. +@msg A fold line is on a non-printing layer. Eine Faltlinie liegt auf einer nicht druckbaren Ebene. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Felder: {panels}, Rilllinien: {hinges}, Fehler: {errors}, Warnungen: {warnings} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 906640aa0a..05c6a32103 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7919,4 +7919,23 @@ breakText Glyphs Γλύφοι No objects are selected. Δεν έχουν επιλεγεί αντικείμενα. Open a document to mark its fold lines. Ανοίξτε ένα έγγραφο για να σημειώσετε τις γραμμές δίπλωσής του. Remove Fold Line Role Αφαίρεση τύπου γραμμής + Check Έλεγχος + Check Fold Lines Έλεγχος γραμμών δίπλωσης +@msg No cut lines are in the selection. Η επιλογή δεν περιέχει γραμμές κοπής. +@msg No cut lines are in the document. Το έγγραφο δεν περιέχει γραμμές κοπής. +@msg The cut lines do not enclose an area. Οι γραμμές κοπής δεν περικλείουν καμία περιοχή. +@msg A cut line ends without meeting another cut line. Μια γραμμή κοπής τελειώνει χωρίς να συναντήσει άλλη γραμμή κοπής. +@msg A gap between cut lines was closed. Ένα κενό ανάμεσα σε γραμμές κοπής κλείστηκε. +@msg The fold lines are too complex to check. Οι γραμμές δίπλωσης είναι πολύ σύνθετες για έλεγχο. +@msg A cut line and a crease lie on top of each other. Μια γραμμή κοπής και μια γραμμή πτύχωσης βρίσκονται η μία πάνω στην άλλη. +@msg Two lines of the same role lie on top of each other. Δύο γραμμές του ίδιου τύπου βρίσκονται η μία πάνω στην άλλη. +@msg A crease ends inside a panel. Μια γραμμή πτύχωσης τελειώνει μέσα σε ένα πάνελ. +@msg A crease does not divide two panels. Μια γραμμή πτύχωσης δεν χωρίζει δύο πάνελ. +@msg A crease lies outside the cut outline. Μια γραμμή πτύχωσης βρίσκεται έξω από το περίγραμμα κοπής. +@msg A crease that is not straight is folded along one straight line. Μια γραμμή πτύχωσης που δεν είναι ευθεία διπλώνεται κατά μήκος μίας ευθείας. +@msg A gap between cut lines is too narrow to tell apart. Ένα κενό ανάμεσα σε γραμμές κοπής είναι πολύ στενό για να διακριθεί. +@msg A cut-out area holds other fold lines. Μια αποκομμένη περιοχή περιέχει άλλες γραμμές δίπλωσης. +@msg A panel is not joined to the rest by a crease. Ένα πάνελ δεν συνδέεται με τα υπόλοιπα με καμία γραμμή πτύχωσης. +@msg A fold line is on a non-printing layer. Μια γραμμή δίπλωσης βρίσκεται σε επίπεδο που δεν εκτυπώνεται. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Πάνελ: {panels}, πτυχώσεις: {hinges}, σφάλματα: {errors}, προειδοποιήσεις: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" το composer πρέπει να είναι "singleLine", "everyLine", "standardSingleLine" ή "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 9239c93a73..12e483f369 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7906,4 +7906,23 @@ breakText Glyphs Glifos No objects are selected. No hay objetos seleccionados. Open a document to mark its fold lines. Abre un documento para marcar sus líneas de plegado. Remove Fold Line Role Quitar tipo de línea + Check Comprobar + Check Fold Lines Comprobar líneas de plegado +@msg No cut lines are in the selection. No hay líneas de corte en la selección. +@msg No cut lines are in the document. No hay líneas de corte en el documento. +@msg The cut lines do not enclose an area. Las líneas de corte no encierran ningún área. +@msg A cut line ends without meeting another cut line. Una línea de corte termina sin llegar a otra línea de corte. +@msg A gap between cut lines was closed. Se cerró un hueco entre líneas de corte. +@msg The fold lines are too complex to check. Las líneas de plegado son demasiado complejas para comprobarlas. +@msg A cut line and a crease lie on top of each other. Una línea de corte y una de hendido están superpuestas. +@msg Two lines of the same role lie on top of each other. Dos líneas del mismo tipo están superpuestas. +@msg A crease ends inside a panel. Una línea de hendido termina dentro de un panel. +@msg A crease does not divide two panels. Una línea de hendido no separa dos paneles. +@msg A crease lies outside the cut outline. Una línea de hendido está fuera del contorno de corte. +@msg A crease that is not straight is folded along one straight line. Una línea de hendido que no es recta se pliega a lo largo de una sola línea recta. +@msg A gap between cut lines is too narrow to tell apart. Un hueco entre líneas de corte es demasiado estrecho para distinguirlo. +@msg A cut-out area holds other fold lines. Un área recortada contiene otras líneas de plegado. +@msg A panel is not joined to the rest by a crease. Un panel no está unido al resto por ninguna línea de hendido. +@msg A fold line is on a non-printing layer. Una línea de plegado está en una capa que no se imprime. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneles: {panels}, hendidos: {hinges}, errores: {errors}, advertencias: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer debe ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 423703e5c1..db6163e7e3 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -8002,4 +8002,23 @@ breakText Glyphs Merkit No objects are selected. Objekteja ei ole valittu. Open a document to mark its fold lines. Avaa asiakirja, niin voit merkitä sen taittoviivat. Remove Fold Line Role Poista viivatyyppi + Check Tarkista + Check Fold Lines Tarkista taittoviivat +@msg No cut lines are in the selection. Valinnassa ei ole leikkausviivoja. +@msg No cut lines are in the document. Asiakirjassa ei ole leikkausviivoja. +@msg The cut lines do not enclose an area. Leikkausviivat eivät rajaa aluetta. +@msg A cut line ends without meeting another cut line. Leikkausviiva päättyy kohtaamatta toista leikkausviivaa. +@msg A gap between cut lines was closed. Leikkausviivojen välinen rako suljettiin. +@msg The fold lines are too complex to check. Taittoviivat ovat liian monimutkaisia tarkistettaviksi. +@msg A cut line and a crease lie on top of each other. Leikkausviiva ja nuuttausviiva ovat päällekkäin. +@msg Two lines of the same role lie on top of each other. Kaksi samantyyppistä viivaa on päällekkäin. +@msg A crease ends inside a panel. Nuuttausviiva päättyy paneelin sisään. +@msg A crease does not divide two panels. Nuuttausviiva ei jaa kahta paneelia. +@msg A crease lies outside the cut outline. Nuuttausviiva on leikkausääriviivan ulkopuolella. +@msg A crease that is not straight is folded along one straight line. Nuuttausviiva, joka ei ole suora, taitetaan yhtä suoraa viivaa pitkin. +@msg A gap between cut lines is too narrow to tell apart. Leikkausviivojen välinen rako on liian kapea erotettavaksi. +@msg A cut-out area holds other fold lines. Leikattu alue sisältää muita taittoviivoja. +@msg A panel is not joined to the rest by a crease. Paneelia ei ole liitetty muihin millään nuuttausviivalla. +@msg A fold line is on a non-printing layer. Taittoviiva on tasolla, jota ei tulosteta. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneelit: {panels}, nuuttaukset: {hinges}, virheet: {errors}, varoitukset: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer on oltava "singleLine", "everyLine", "standardSingleLine" tai "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 8af602785b..7ae0eab9c6 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -9727,4 +9727,23 @@ breakText Glyphs Glyphes No objects are selected. Aucun objet n’est sélectionné. Open a document to mark its fold lines. Ouvrez un document pour marquer ses lignes de pliage. Remove Fold Line Role Supprimer le type de ligne + Check Vérifier + Check Fold Lines Vérifier les lignes de pliage +@msg No cut lines are in the selection. La sélection ne contient aucune ligne de découpe. +@msg No cut lines are in the document. Le document ne contient aucune ligne de découpe. +@msg The cut lines do not enclose an area. Les lignes de découpe n’entourent aucune zone. +@msg A cut line ends without meeting another cut line. Une ligne de découpe se termine sans rejoindre une autre ligne de découpe. +@msg A gap between cut lines was closed. Un écart entre des lignes de découpe a été fermé. +@msg The fold lines are too complex to check. Les lignes de pliage sont trop complexes pour être vérifiées. +@msg A cut line and a crease lie on top of each other. Une ligne de découpe et une ligne de rainage se superposent. +@msg Two lines of the same role lie on top of each other. Deux lignes du même type se superposent. +@msg A crease ends inside a panel. Une ligne de rainage se termine à l’intérieur d’un panneau. +@msg A crease does not divide two panels. Une ligne de rainage ne sépare pas deux panneaux. +@msg A crease lies outside the cut outline. Une ligne de rainage se trouve hors du contour de découpe. +@msg A crease that is not straight is folded along one straight line. Une ligne de rainage qui n’est pas droite est pliée le long d’une seule ligne droite. +@msg A gap between cut lines is too narrow to tell apart. Un écart entre des lignes de découpe est trop étroit pour être distingué. +@msg A cut-out area holds other fold lines. Une zone découpée contient d’autres lignes de pliage. +@msg A panel is not joined to the rest by a crease. Un panneau n’est relié au reste par aucune ligne de rainage. +@msg A fold line is on a non-printing layer. Une ligne de pliage se trouve sur un calque non imprimable. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} {panels} panneau(x), {hinges} rainage(s), {errors} erreur(s), {warnings} avertissement(s) @msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels, c’est trop grand pour le GIF (65535 pixels par côté au plus) : réduisez la résolution diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 4eed343e3d..d7b10bf7c0 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4846,6 +4846,25 @@ swatch [Registration] [રજિસ્ટ્રેશન] No objects are selected. કોઈ ઑબ્જેક્ટ પસંદ કરેલ નથી. Open a document to mark its fold lines. તેની ફોલ્ડ લાઇન્સ ચિહ્નિત કરવા દસ્તાવેજ ખોલો. Remove Fold Line Role લાઇન પ્રકાર દૂર કરો + Check ચેક કરો + Check Fold Lines ફોલ્ડ લાઇન્સ ચેક કરો +@msg No cut lines are in the selection. પસંદગીમાં કોઈ કટ લાઇન નથી. +@msg No cut lines are in the document. ડૉક્યુમેન્ટમાં કોઈ કટ લાઇન નથી. +@msg The cut lines do not enclose an area. કટ લાઇન્સ કોઈ વિસ્તાર ઘેરતી નથી. +@msg A cut line ends without meeting another cut line. એક કટ લાઇન બીજી કટ લાઇનને મળ્યા વિના પૂરી થાય છે. +@msg A gap between cut lines was closed. કટ લાઇન્સ વચ્ચેનો ગેપ બંધ કરવામાં આવ્યો. +@msg The fold lines are too complex to check. ફોલ્ડ લાઇન્સ ચેક કરવા માટે ખૂબ જટિલ છે. +@msg A cut line and a crease lie on top of each other. એક કટ લાઇન અને એક ક્રીઝ લાઇન એકબીજા પર છે. +@msg Two lines of the same role lie on top of each other. એક જ પ્રકારની બે લાઇન્સ એકબીજા પર છે. +@msg A crease ends inside a panel. એક ક્રીઝ લાઇન પેનલની અંદર પૂરી થાય છે. +@msg A crease does not divide two panels. એક ક્રીઝ લાઇન બે પેનલને અલગ કરતી નથી. +@msg A crease lies outside the cut outline. એક ક્રીઝ લાઇન કટ આઉટલાઇનની બહાર છે. +@msg A crease that is not straight is folded along one straight line. સીધી ન હોય તેવી ક્રીઝ લાઇન એક સીધી લાઇન પર ફોલ્ડ થાય છે. +@msg A gap between cut lines is too narrow to tell apart. કટ લાઇન્સ વચ્ચેનો ગેપ ઓળખવા માટે ખૂબ સાંકડો છે. +@msg A cut-out area holds other fold lines. એક કટ-આઉટ વિસ્તારમાં બીજી ફોલ્ડ લાઇન્સ છે. +@msg A panel is not joined to the rest by a crease. એક પેનલ કોઈ ક્રીઝ લાઇનથી બાકીના સાથે જોડાયેલી નથી. +@msg A fold line is on a non-printing layer. એક ફોલ્ડ લાઇન નોન-પ્રિન્ટિંગ લેયર પર છે. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} પેનલ: {panels}, ક્રીઝ: {hinges}, ભૂલો: {errors}, ચેતવણીઓ: {warnings} Middle Eastern & South Asian Single-line Composer સિંગલ-લાઇન કમ્પોઝર (મધ્ય પૂર્વ અને દક્ષિણ એશિયા) Middle Eastern & South Asian Every-line Composer એવરી-લાઇન કમ્પોઝર (મધ્ય પૂર્વ અને દક્ષિણ એશિયા) Standard Single-line Composer સ્ટાન્ડર્ડ સિંગલ-લાઇન કમ્પોઝર diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index de33cdbd92..f632881023 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -9347,3 +9347,22 @@ theme Appearance अपीयरेंस No objects are selected. कोई ऑब्जेक्ट सिलेक्ट नहीं है। Open a document to mark its fold lines. फ़ोल्ड लाइनें मार्क करने के लिए कोई डॉक्यूमेंट ओपन करें। Remove Fold Line Role लाइन प्रकार हटाएँ + Check चेक करें + Check Fold Lines फ़ोल्ड लाइनें चेक करें +@msg No cut lines are in the selection. सिलेक्शन में कोई कट लाइन नहीं है। +@msg No cut lines are in the document. डॉक्यूमेंट में कोई कट लाइन नहीं है। +@msg The cut lines do not enclose an area. कट लाइनें कोई एरिया नहीं घेरतीं। +@msg A cut line ends without meeting another cut line. एक कट लाइन किसी दूसरी कट लाइन से मिले बिना खत्म हो जाती है। +@msg A gap between cut lines was closed. कट लाइनों के बीच का गैप बंद कर दिया गया। +@msg The fold lines are too complex to check. फ़ोल्ड लाइनें चेक करने के लिए बहुत जटिल हैं। +@msg A cut line and a crease lie on top of each other. एक कट लाइन और एक क्रीज़ लाइन एक-दूसरे के ऊपर हैं। +@msg Two lines of the same role lie on top of each other. एक ही प्रकार की दो लाइनें एक-दूसरे के ऊपर हैं। +@msg A crease ends inside a panel. एक क्रीज़ लाइन किसी पैनल के अंदर खत्म होती है। +@msg A crease does not divide two panels. एक क्रीज़ लाइन दो पैनलों को अलग नहीं करती। +@msg A crease lies outside the cut outline. एक क्रीज़ लाइन कट आउटलाइन के बाहर है। +@msg A crease that is not straight is folded along one straight line. जो क्रीज़ लाइन सीधी नहीं है, वह एक सीधी लाइन पर फ़ोल्ड होती है। +@msg A gap between cut lines is too narrow to tell apart. कट लाइनों के बीच का गैप पहचानने के लिए बहुत पतला है। +@msg A cut-out area holds other fold lines. एक कट-आउट एरिया में दूसरी फ़ोल्ड लाइनें हैं। +@msg A panel is not joined to the rest by a crease. कोई पैनल किसी क्रीज़ लाइन से बाकी से जुड़ा नहीं है। +@msg A fold line is on a non-printing layer. एक फ़ोल्ड लाइन नॉन-प्रिंटिंग लेयर पर है। +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} पैनल: {panels}, क्रीज़: {hinges}, एरर: {errors}, वॉर्निंग: {warnings} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index f869e7d07b..5ecfe58e72 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -9730,3 +9730,22 @@ breakText Glyphs Glifák No objects are selected. Nincs kijelölt objektum. Open a document to mark its fold lines. Nyiss meg egy dokumentumot a hajtásvonalai megjelöléséhez. Remove Fold Line Role Vonaltípus eltávolítása + Check Ellenőrzés + Check Fold Lines Hajtásvonalak ellenőrzése +@msg No cut lines are in the selection. A kijelölésben nincs vágóvonal. +@msg No cut lines are in the document. A dokumentumban nincs vágóvonal. +@msg The cut lines do not enclose an area. A vágóvonalak nem zárnak közre területet. +@msg A cut line ends without meeting another cut line. Egy vágóvonal úgy ér véget, hogy nem találkozik másik vágóvonallal. +@msg A gap between cut lines was closed. A vágóvonalak közötti rés le lett zárva. +@msg The fold lines are too complex to check. A hajtásvonalak túl összetettek az ellenőrzéshez. +@msg A cut line and a crease lie on top of each other. Egy vágóvonal és egy bigvonal egymáson fekszik. +@msg Two lines of the same role lie on top of each other. Két azonos típusú vonal egymáson fekszik. +@msg A crease ends inside a panel. Egy bigvonal egy panelen belül ér véget. +@msg A crease does not divide two panels. Egy bigvonal nem választ el két panelt. +@msg A crease lies outside the cut outline. Egy bigvonal a vágási körvonalon kívül van. +@msg A crease that is not straight is folded along one straight line. Egy nem egyenes bigvonal egyetlen egyenes mentén hajlik. +@msg A gap between cut lines is too narrow to tell apart. A vágóvonalak közötti rés túl keskeny a megkülönböztetéshez. +@msg A cut-out area holds other fold lines. Egy kivágott terület további hajtásvonalakat tartalmaz. +@msg A panel is not joined to the rest by a crease. Egy panelt egyetlen bigvonal sem köt a többihez. +@msg A fold line is on a non-printing layer. Egy hajtásvonal nem nyomtatható rétegen van. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panelek: {panels}, bigek: {hinges}, hibák: {errors}, figyelmeztetések: {warnings} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index c5f865e69b..cd2ad82864 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -7099,4 +7099,23 @@ breakText Glyphs Glif No objects are selected. Tidak ada objek yang dipilih. Open a document to mark its fold lines. Buka dokumen untuk menandai garis lipatnya. Remove Fold Line Role Hapus jenis garis + Check Periksa + Check Fold Lines Periksa garis lipat +@msg No cut lines are in the selection. Tidak ada garis potong dalam seleksi. +@msg No cut lines are in the document. Tidak ada garis potong dalam dokumen. +@msg The cut lines do not enclose an area. Garis potong tidak melingkupi area apa pun. +@msg A cut line ends without meeting another cut line. Sebuah garis potong berakhir tanpa bertemu garis potong lain. +@msg A gap between cut lines was closed. Celah di antara garis potong telah ditutup. +@msg The fold lines are too complex to check. Garis lipat terlalu rumit untuk diperiksa. +@msg A cut line and a crease lie on top of each other. Sebuah garis potong dan sebuah garis lekuk bertumpuk. +@msg Two lines of the same role lie on top of each other. Dua garis dengan jenis yang sama bertumpuk. +@msg A crease ends inside a panel. Sebuah garis lekuk berakhir di dalam panel. +@msg A crease does not divide two panels. Sebuah garis lekuk tidak membagi dua panel. +@msg A crease lies outside the cut outline. Sebuah garis lekuk berada di luar kontur potong. +@msg A crease that is not straight is folded along one straight line. Garis lekuk yang tidak lurus dilipat di sepanjang satu garis lurus. +@msg A gap between cut lines is too narrow to tell apart. Celah di antara garis potong terlalu sempit untuk dibedakan. +@msg A cut-out area holds other fold lines. Area yang dipotong berisi garis lipat lain. +@msg A panel is not joined to the rest by a crease. Sebuah panel tidak tersambung ke bagian lain oleh garis lekuk apa pun. +@msg A fold line is on a non-printing layer. Sebuah garis lipat berada di lapisan yang tidak dicetak. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panel: {panels}, lekuk: {hinges}, galat: {errors}, peringatan: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer harus "singleLine", "everyLine", "standardSingleLine", atau "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 08cefdbed7..b34cf145a7 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -9374,3 +9374,22 @@ breakText Glyphs Glifi No objects are selected. Nessun oggetto selezionato. Open a document to mark its fold lines. Apri un documento per segnarne le linee di piega. Remove Fold Line Role Rimuovi tipo di linea + Check Verifica + Check Fold Lines Verifica linee di piega +@msg No cut lines are in the selection. Nella selezione non ci sono linee di taglio. +@msg No cut lines are in the document. Nel documento non ci sono linee di taglio. +@msg The cut lines do not enclose an area. Le linee di taglio non racchiudono alcuna area. +@msg A cut line ends without meeting another cut line. Una linea di taglio termina senza incontrare un’altra linea di taglio. +@msg A gap between cut lines was closed. È stato chiuso uno spazio tra linee di taglio. +@msg The fold lines are too complex to check. Le linee di piega sono troppo complesse da verificare. +@msg A cut line and a crease lie on top of each other. Una linea di taglio e una di cordonatura sono sovrapposte. +@msg Two lines of the same role lie on top of each other. Due linee dello stesso tipo sono sovrapposte. +@msg A crease ends inside a panel. Una linea di cordonatura termina all’interno di un pannello. +@msg A crease does not divide two panels. Una linea di cordonatura non divide due pannelli. +@msg A crease lies outside the cut outline. Una linea di cordonatura si trova fuori dal contorno di taglio. +@msg A crease that is not straight is folded along one straight line. Una linea di cordonatura non diritta viene piegata lungo un’unica linea retta. +@msg A gap between cut lines is too narrow to tell apart. Uno spazio tra linee di taglio è troppo stretto per essere distinto. +@msg A cut-out area holds other fold lines. Un’area ritagliata contiene altre linee di piega. +@msg A panel is not joined to the rest by a crease. Un pannello non è unito al resto da alcuna linea di cordonatura. +@msg A fold line is on a non-printing layer. Una linea di piega si trova su un livello non stampabile. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Pannelli: {panels}, cordonature: {hinges}, errori: {errors}, avvisi: {warnings} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 59c7628f40..a224dec9f0 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -9441,3 +9441,22 @@ breakText Glyphs 字形 No objects are selected. オブジェクトが選択されていません。 Open a document to mark its fold lines. ドキュメントを開くと折り線を設定できます。 Remove Fold Line Role 線種を解除 + Check チェック + Check Fold Lines 折り線をチェック +@msg No cut lines are in the selection. 選択範囲にカット線がありません。 +@msg No cut lines are in the document. ドキュメントにカット線がありません。 +@msg The cut lines do not enclose an area. カット線が領域を囲んでいません。 +@msg A cut line ends without meeting another cut line. カット線が他のカット線と接しないまま終わっています。 +@msg A gap between cut lines was closed. カット線間の隙間を閉じました。 +@msg The fold lines are too complex to check. 折り線が複雑すぎるためチェックできません。 +@msg A cut line and a crease lie on top of each other. カット線と筋入れ線が重なっています。 +@msg Two lines of the same role lie on top of each other. 同じ種類の線が 2 本重なっています。 +@msg A crease ends inside a panel. 筋入れ線がパネルの内側で終わっています。 +@msg A crease does not divide two panels. 筋入れ線が 2 つのパネルを分けていません。 +@msg A crease lies outside the cut outline. 筋入れ線がカットの輪郭の外側にあります。 +@msg A crease that is not straight is folded along one straight line. まっすぐでない筋入れ線は 1 本の直線に沿って折られます。 +@msg A gap between cut lines is too narrow to tell apart. カット線間の隙間が狭すぎて区別できません。 +@msg A cut-out area holds other fold lines. 切り抜かれた領域に他の折り線があります。 +@msg A panel is not joined to the rest by a crease. パネルがどの筋入れ線でも他とつながっていません。 +@msg A fold line is on a non-printing layer. 折り線が印刷しないレイヤーにあります。 +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} パネル: {panels}、筋入れ: {hinges}、エラー: {errors}、警告: {warnings} diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 9393433cdb..406a43c301 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -10010,4 +10010,23 @@ font-script Japanese იაპონური No objects are selected. ობიექტები არ არის მონიშნული. Open a document to mark its fold lines. გახსენით დოკუმენტი მისი მოკეცვის ხაზების მოსანიშნად. Remove Fold Line Role ხაზის ტიპის მოხსნა + Check შემოწმება + Check Fold Lines მოკეცვის ხაზების შემოწმება +@msg No cut lines are in the selection. მონიშვნაში ჭრის ხაზები არ არის. +@msg No cut lines are in the document. დოკუმენტში ჭრის ხაზები არ არის. +@msg The cut lines do not enclose an area. ჭრის ხაზები არცერთ არეს არ შემოფარგლავს. +@msg A cut line ends without meeting another cut line. ჭრის ხაზი მთავრდება ისე, რომ სხვა ჭრის ხაზს არ ხვდება. +@msg A gap between cut lines was closed. ჭრის ხაზებს შორის ღრეჩო დაიხურა. +@msg The fold lines are too complex to check. მოკეცვის ხაზები შესამოწმებლად ზედმეტად რთულია. +@msg A cut line and a crease lie on top of each other. ჭრის ხაზი და ბიგის ხაზი ერთმანეთზე დევს. +@msg Two lines of the same role lie on top of each other. ერთი ტიპის ორი ხაზი ერთმანეთზე დევს. +@msg A crease ends inside a panel. ბიგის ხაზი პანელის შიგნით მთავრდება. +@msg A crease does not divide two panels. ბიგის ხაზი ორ პანელს არ ყოფს. +@msg A crease lies outside the cut outline. ბიგის ხაზი ჭრის კონტურის გარეთაა. +@msg A crease that is not straight is folded along one straight line. ბიგის ხაზი, რომელიც სწორი არ არის, ერთი სწორი ხაზის გასწვრივ იკეცება. +@msg A gap between cut lines is too narrow to tell apart. ჭრის ხაზებს შორის ღრეჩო ზედმეტად ვიწროა გასარჩევად. +@msg A cut-out area holds other fold lines. ამოჭრილი არე სხვა მოკეცვის ხაზებს შეიცავს. +@msg A panel is not joined to the rest by a crease. პანელი დანარჩენს არცერთი ბიგის ხაზით არ უერთდება. +@msg A fold line is on a non-printing layer. მოკეცვის ხაზი არასაბეჭდ შრეზეა. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} პანელები: {panels}, ბიგები: {hinges}, შეცდომები: {errors}, გაფრთხილებები: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer უნდა იყოს "singleLine", "everyLine", "standardSingleLine" ან "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 49d5e10dc1..219bd8aa76 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -9337,3 +9337,22 @@ breakText Glyphs 글리프 No objects are selected. 선택한 개체가 없습니다. Open a document to mark its fold lines. 접는 선을 지정하려면 문서를 여세요. Remove Fold Line Role 선 종류 제거 + Check 검사 + Check Fold Lines 접는 선 검사 +@msg No cut lines are in the selection. 선택 영역에 재단선이 없습니다. +@msg No cut lines are in the document. 문서에 재단선이 없습니다. +@msg The cut lines do not enclose an area. 재단선이 영역을 둘러싸지 않습니다. +@msg A cut line ends without meeting another cut line. 재단선이 다른 재단선과 만나지 않고 끝납니다. +@msg A gap between cut lines was closed. 재단선 사이의 틈을 닫았습니다. +@msg The fold lines are too complex to check. 접는 선이 너무 복잡해서 검사할 수 없습니다. +@msg A cut line and a crease lie on top of each other. 재단선과 오시선이 겹쳐 있습니다. +@msg Two lines of the same role lie on top of each other. 같은 종류의 선 두 개가 겹쳐 있습니다. +@msg A crease ends inside a panel. 오시선이 패널 안에서 끝납니다. +@msg A crease does not divide two panels. 오시선이 두 패널을 나누지 않습니다. +@msg A crease lies outside the cut outline. 오시선이 재단 윤곽선 밖에 있습니다. +@msg A crease that is not straight is folded along one straight line. 곧지 않은 오시선은 하나의 직선을 따라 접힙니다. +@msg A gap between cut lines is too narrow to tell apart. 재단선 사이의 틈이 너무 좁아 구별할 수 없습니다. +@msg A cut-out area holds other fold lines. 잘라 낸 영역에 다른 접는 선이 있습니다. +@msg A panel is not joined to the rest by a crease. 패널이 어떤 오시선으로도 나머지와 연결되어 있지 않습니다. +@msg A fold line is on a non-printing layer. 접는 선이 인쇄되지 않는 레이어에 있습니다. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} 패널: {panels}, 오시: {hinges}, 오류: {errors}, 경고: {warnings} diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index f071ebd0e2..62c2566f13 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9775,3 +9775,22 @@ breakText Glyphs Glyphs No objects are selected. Er zijn geen objecten geselecteerd. Open a document to mark its fold lines. Open een document om de vouwlijnen te markeren. Remove Fold Line Role Lijnsoort verwijderen + Check Controleren + Check Fold Lines Vouwlijnen controleren +@msg No cut lines are in the selection. De selectie bevat geen snijlijnen. +@msg No cut lines are in the document. Het document bevat geen snijlijnen. +@msg The cut lines do not enclose an area. De snijlijnen sluiten geen gebied in. +@msg A cut line ends without meeting another cut line. Een snijlijn eindigt zonder een andere snijlijn te raken. +@msg A gap between cut lines was closed. Een opening tussen snijlijnen is gesloten. +@msg The fold lines are too complex to check. De vouwlijnen zijn te complex om te controleren. +@msg A cut line and a crease lie on top of each other. Een snijlijn en een rillijn liggen over elkaar. +@msg Two lines of the same role lie on top of each other. Twee lijnen van dezelfde soort liggen over elkaar. +@msg A crease ends inside a panel. Een rillijn eindigt binnen een paneel. +@msg A crease does not divide two panels. Een rillijn verdeelt geen twee panelen. +@msg A crease lies outside the cut outline. Een rillijn ligt buiten de snijcontour. +@msg A crease that is not straight is folded along one straight line. Een rillijn die niet recht is, wordt langs één rechte lijn gevouwen. +@msg A gap between cut lines is too narrow to tell apart. Een opening tussen snijlijnen is te smal om te onderscheiden. +@msg A cut-out area holds other fold lines. Een uitgesneden gebied bevat andere vouwlijnen. +@msg A panel is not joined to the rest by a crease. Een paneel is door geen rillijn met de rest verbonden. +@msg A fold line is on a non-printing layer. Een vouwlijn staat op een laag die niet wordt afgedrukt. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panelen: {panels}, rillijnen: {hinges}, fouten: {errors}, waarschuwingen: {warnings} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 2477c73abd..587884f787 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -9595,3 +9595,22 @@ breakText Glyphs Glify No objects are selected. Nie zaznaczono żadnych obiektów. Open a document to mark its fold lines. Otwórz dokument, aby oznaczyć jego linie zgięcia. Remove Fold Line Role Usuń rodzaj linii + Check Sprawdź + Check Fold Lines Sprawdź linie zgięcia +@msg No cut lines are in the selection. W zaznaczeniu nie ma linii cięcia. +@msg No cut lines are in the document. W dokumencie nie ma linii cięcia. +@msg The cut lines do not enclose an area. Linie cięcia nie obejmują żadnego obszaru. +@msg A cut line ends without meeting another cut line. Linia cięcia kończy się, nie stykając się z inną linią cięcia. +@msg A gap between cut lines was closed. Zamknięto przerwę między liniami cięcia. +@msg The fold lines are too complex to check. Linie zgięcia są zbyt złożone, aby je sprawdzić. +@msg A cut line and a crease lie on top of each other. Linia cięcia i linia bigowania leżą na sobie. +@msg Two lines of the same role lie on top of each other. Dwie linie tego samego rodzaju leżą na sobie. +@msg A crease ends inside a panel. Linia bigowania kończy się wewnątrz panelu. +@msg A crease does not divide two panels. Linia bigowania nie rozdziela dwóch paneli. +@msg A crease lies outside the cut outline. Linia bigowania leży poza konturem cięcia. +@msg A crease that is not straight is folded along one straight line. Linia bigowania, która nie jest prosta, jest zginana wzdłuż jednej linii prostej. +@msg A gap between cut lines is too narrow to tell apart. Przerwa między liniami cięcia jest zbyt wąska, aby ją rozróżnić. +@msg A cut-out area holds other fold lines. Wycięty obszar zawiera inne linie zgięcia. +@msg A panel is not joined to the rest by a crease. Panel nie jest połączony z resztą żadną linią bigowania. +@msg A fold line is on a non-printing layer. Linia zgięcia znajduje się na warstwie niedrukowanej. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panele: {panels}, bigi: {hinges}, błędy: {errors}, ostrzeżenia: {warnings} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 333351b9af..4e1f704ec8 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -9813,3 +9813,22 @@ swatch Yellow Green Verde-amarelado No objects are selected. Nenhum objeto selecionado. Open a document to mark its fold lines. Abra um documento para marcar suas linhas de dobra. Remove Fold Line Role Remover Tipo de Linha + Check Verificar + Check Fold Lines Verificar Linhas de Dobra +@msg No cut lines are in the selection. Não há linhas de corte na seleção. +@msg No cut lines are in the document. Não há linhas de corte no documento. +@msg The cut lines do not enclose an area. As linhas de corte não delimitam nenhuma área. +@msg A cut line ends without meeting another cut line. Uma linha de corte termina sem encontrar outra linha de corte. +@msg A gap between cut lines was closed. Uma lacuna entre linhas de corte foi fechada. +@msg The fold lines are too complex to check. As linhas de dobra são complexas demais para verificar. +@msg A cut line and a crease lie on top of each other. Uma linha de corte e uma de vinco estão sobrepostas. +@msg Two lines of the same role lie on top of each other. Duas linhas do mesmo tipo estão sobrepostas. +@msg A crease ends inside a panel. Uma linha de vinco termina dentro de um painel. +@msg A crease does not divide two panels. Uma linha de vinco não divide dois painéis. +@msg A crease lies outside the cut outline. Uma linha de vinco está fora do contorno de corte. +@msg A crease that is not straight is folded along one straight line. Uma linha de vinco que não é reta é dobrada ao longo de uma única linha reta. +@msg A gap between cut lines is too narrow to tell apart. Uma lacuna entre linhas de corte é estreita demais para ser distinguida. +@msg A cut-out area holds other fold lines. Uma área recortada contém outras linhas de dobra. +@msg A panel is not joined to the rest by a crease. Um painel não está unido ao restante por nenhuma linha de vinco. +@msg A fold line is on a non-printing layer. Uma linha de dobra está em uma camada não imprimível. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Painéis: {panels}, vincos: {hinges}, erros: {errors}, avisos: {warnings} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ae33aa0d55..2c6dec01d4 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -9834,5 +9834,24 @@ shape Open Открытый No objects are selected. Объекты не выделены. Open a document to mark its fold lines. Откройте документ, чтобы отметить его линии сгиба. Remove Fold Line Role Убрать тип линии + Check Проверить + Check Fold Lines Проверить линии сгиба +@msg No cut lines are in the selection. В выделении нет линий реза. +@msg No cut lines are in the document. В документе нет линий реза. +@msg The cut lines do not enclose an area. Линии реза не ограничивают никакую область. +@msg A cut line ends without meeting another cut line. Линия реза заканчивается, не встречая другую линию реза. +@msg A gap between cut lines was closed. Зазор между линиями реза закрыт. +@msg The fold lines are too complex to check. Линии сгиба слишком сложны для проверки. +@msg A cut line and a crease lie on top of each other. Линия реза и линия биговки лежат друг на друге. +@msg Two lines of the same role lie on top of each other. Две линии одного типа лежат друг на друге. +@msg A crease ends inside a panel. Линия биговки заканчивается внутри панели. +@msg A crease does not divide two panels. Линия биговки не разделяет две панели. +@msg A crease lies outside the cut outline. Линия биговки лежит за пределами контура реза. +@msg A crease that is not straight is folded along one straight line. Непрямая линия биговки сгибается по одной прямой. +@msg A gap between cut lines is too narrow to tell apart. Зазор между линиями реза слишком узок, чтобы его различить. +@msg A cut-out area holds other fold lines. Вырезанная область содержит другие линии сгиба. +@msg A panel is not joined to the rest by a crease. Панель не соединена с остальными ни одной линией биговки. +@msg A fold line is on a non-printing layer. Линия сгиба находится на непечатаемом слое. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, биговки: {hinges}, ошибки: {errors}, предупреждения: {warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} пикселей — слишком большой размер для PSD (не более {MAX_SIDE} пикселей по стороне): уменьшите разрешение @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer должен быть "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 1bd4fd0692..c0ac175345 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -9425,4 +9425,23 @@ digits Hindi Hindi No objects are selected. Inga objekt är markerade. Open a document to mark its fold lines. Öppna ett dokument för att markera dess falslinjer. Remove Fold Line Role Ta bort linjetyp + Check Kontrollera + Check Fold Lines Kontrollera falslinjer +@msg No cut lines are in the selection. Det finns inga skärlinjer i markeringen. +@msg No cut lines are in the document. Det finns inga skärlinjer i dokumentet. +@msg The cut lines do not enclose an area. Skärlinjerna omsluter inget område. +@msg A cut line ends without meeting another cut line. En skärlinje slutar utan att möta en annan skärlinje. +@msg A gap between cut lines was closed. Ett mellanrum mellan skärlinjer stängdes. +@msg The fold lines are too complex to check. Falslinjerna är för komplexa för att kontrollera. +@msg A cut line and a crease lie on top of each other. En skärlinje och en biglinje ligger ovanpå varandra. +@msg Two lines of the same role lie on top of each other. Två linjer av samma typ ligger ovanpå varandra. +@msg A crease ends inside a panel. En biglinje slutar inuti en panel. +@msg A crease does not divide two panels. En biglinje delar inte två paneler. +@msg A crease lies outside the cut outline. En biglinje ligger utanför skärkonturen. +@msg A crease that is not straight is folded along one straight line. En biglinje som inte är rak falsas längs en rak linje. +@msg A gap between cut lines is too narrow to tell apart. Ett mellanrum mellan skärlinjer är för smalt för att skilja ut. +@msg A cut-out area holds other fold lines. Ett utskuret område innehåller andra falslinjer. +@msg A panel is not joined to the rest by a crease. En panel är inte förbunden med resten av någon biglinje. +@msg A fold line is on a non-printing layer. En falslinje ligger på ett lager som inte skrivs ut. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, bigningar: {hinges}, fel: {errors}, varningar: {warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixlar är för stort för PSD (högst {MAX_SIDE} pixlar per sida): sänk upplösningen diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index a2a38c679a..6dded8c1d7 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9696,3 +9696,22 @@ breakText Glyphs Glifler No objects are selected. Hiçbir nesne seçili değil. Open a document to mark its fold lines. Katlama çizgilerini işaretlemek için bir belgeyi açın. Remove Fold Line Role Çizgi Türünü Kaldır + Check Denetle + Check Fold Lines Katlama Çizgilerini Denetle +@msg No cut lines are in the selection. Seçimde kesim çizgisi yok. +@msg No cut lines are in the document. Belgede kesim çizgisi yok. +@msg The cut lines do not enclose an area. Kesim çizgileri bir alanı çevrelemiyor. +@msg A cut line ends without meeting another cut line. Bir kesim çizgisi başka bir kesim çizgisiyle buluşmadan bitiyor. +@msg A gap between cut lines was closed. Kesim çizgileri arasındaki bir boşluk kapatıldı. +@msg The fold lines are too complex to check. Katlama çizgileri denetlenemeyecek kadar karmaşık. +@msg A cut line and a crease lie on top of each other. Bir kesim çizgisi ile bir pilyaj çizgisi üst üste. +@msg Two lines of the same role lie on top of each other. Aynı türden iki çizgi üst üste. +@msg A crease ends inside a panel. Bir pilyaj çizgisi bir panelin içinde bitiyor. +@msg A crease does not divide two panels. Bir pilyaj çizgisi iki paneli ayırmıyor. +@msg A crease lies outside the cut outline. Bir pilyaj çizgisi kesim konturunun dışında. +@msg A crease that is not straight is folded along one straight line. Düz olmayan bir pilyaj çizgisi tek bir düz çizgi boyunca katlanır. +@msg A gap between cut lines is too narrow to tell apart. Kesim çizgileri arasındaki bir boşluk ayırt edilemeyecek kadar dar. +@msg A cut-out area holds other fold lines. Kesilip çıkarılmış bir alan başka katlama çizgileri içeriyor. +@msg A panel is not joined to the rest by a crease. Bir panel geri kalanlara hiçbir pilyaj çizgisiyle bağlı değil. +@msg A fold line is on a non-printing layer. Bir katlama çizgisi yazdırılmayan bir katmanda. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneller: {panels}, pilyajlar: {hinges}, hatalar: {errors}, uyarılar: {warnings} diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 17c673885d..84eb22f968 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -9349,3 +9349,22 @@ breakText Glyphs Гліфи No objects are selected. Об’єкти не виділено. Open a document to mark its fold lines. Відкрийте документ, щоб позначити його лінії згину. Remove Fold Line Role Прибрати тип лінії + Check Перевірити + Check Fold Lines Перевірити лінії згину +@msg No cut lines are in the selection. У виділенні немає ліній різу. +@msg No cut lines are in the document. У документі немає ліній різу. +@msg The cut lines do not enclose an area. Лінії різу не обмежують жодної області. +@msg A cut line ends without meeting another cut line. Лінія різу закінчується, не зустрівши іншої лінії різу. +@msg A gap between cut lines was closed. Зазор між лініями різу закрито. +@msg The fold lines are too complex to check. Лінії згину надто складні для перевірки. +@msg A cut line and a crease lie on top of each other. Лінія різу та лінія біговки лежать одна на одній. +@msg Two lines of the same role lie on top of each other. Дві лінії одного типу лежать одна на одній. +@msg A crease ends inside a panel. Лінія біговки закінчується всередині панелі. +@msg A crease does not divide two panels. Лінія біговки не розділяє двох панелей. +@msg A crease lies outside the cut outline. Лінія біговки лежить поза контуром різу. +@msg A crease that is not straight is folded along one straight line. Непряма лінія біговки згинається вздовж однієї прямої. +@msg A gap between cut lines is too narrow to tell apart. Зазор між лініями різу надто вузький, щоб його розрізнити. +@msg A cut-out area holds other fold lines. Вирізана область містить інші лінії згину. +@msg A panel is not joined to the rest by a crease. Панель не з’єднана з рештою жодною лінією біговки. +@msg A fold line is on a non-printing layer. Лінія згину лежить на шарі, що не друкується. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Панелі: {panels}, біговки: {hinges}, помилки: {errors}, попередження: {warnings} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index da89525314..00ac3f7289 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7459,6 +7459,25 @@ breakText Glyphs Glyph No objects are selected. Không có đối tượng nào được chọn. Open a document to mark its fold lines. Mở tài liệu để đánh dấu các đường gấp của nó. Remove Fold Line Role Bỏ loại đường + Check Kiểm tra + Check Fold Lines Kiểm tra đường gấp +@msg No cut lines are in the selection. Vùng chọn không có đường cắt nào. +@msg No cut lines are in the document. Tài liệu không có đường cắt nào. +@msg The cut lines do not enclose an area. Các đường cắt không bao quanh vùng nào. +@msg A cut line ends without meeting another cut line. Một đường cắt kết thúc mà không gặp đường cắt khác. +@msg A gap between cut lines was closed. Đã đóng một khe hở giữa các đường cắt. +@msg The fold lines are too complex to check. Các đường gấp quá phức tạp để kiểm tra. +@msg A cut line and a crease lie on top of each other. Một đường cắt và một đường cấn nằm chồng lên nhau. +@msg Two lines of the same role lie on top of each other. Hai đường cùng loại nằm chồng lên nhau. +@msg A crease ends inside a panel. Một đường cấn kết thúc bên trong một mặt. +@msg A crease does not divide two panels. Một đường cấn không chia tách hai mặt. +@msg A crease lies outside the cut outline. Một đường cấn nằm ngoài đường viền cắt. +@msg A crease that is not straight is folded along one straight line. Đường cấn không thẳng được gấp theo một đường thẳng. +@msg A gap between cut lines is too narrow to tell apart. Khe hở giữa các đường cắt quá hẹp để phân biệt. +@msg A cut-out area holds other fold lines. Một vùng bị cắt bỏ chứa các đường gấp khác. +@msg A panel is not joined to the rest by a crease. Một mặt không được nối với phần còn lại bằng đường cấn nào. +@msg A fold line is on a non-printing layer. Một đường gấp nằm trên lớp không in. +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Mặt: {panels}, đường cấn: {hinges}, lỗi: {errors}, cảnh báo: {warnings} # Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. @msg 3D effects require finite coordinates within 100 million points Hiệu ứng 3D yêu cầu tọa độ hữu hạn trong phạm vi 100 triệu điểm diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 5f612cb0d4..40f821ffe4 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -9580,4 +9580,23 @@ breakText Glyphs 字形 No objects are selected. 未选择任何对象。 Open a document to mark its fold lines. 打开文档以标记其折线。 Remove Fold Line Role 移除线条类型 + Check 检查 + Check Fold Lines 检查折线 +@msg No cut lines are in the selection. 所选内容中没有切割线。 +@msg No cut lines are in the document. 文档中没有切割线。 +@msg The cut lines do not enclose an area. 切割线未围成任何区域。 +@msg A cut line ends without meeting another cut line. 一条切割线未与其他切割线相接就结束了。 +@msg A gap between cut lines was closed. 已闭合切割线之间的间隙。 +@msg The fold lines are too complex to check. 折线过于复杂,无法检查。 +@msg A cut line and a crease lie on top of each other. 一条切割线与一条压痕线重叠。 +@msg Two lines of the same role lie on top of each other. 两条同类线条重叠。 +@msg A crease ends inside a panel. 一条压痕线在面板内部结束。 +@msg A crease does not divide two panels. 一条压痕线没有分隔两个面板。 +@msg A crease lies outside the cut outline. 一条压痕线位于切割轮廓之外。 +@msg A crease that is not straight is folded along one straight line. 不直的压痕线沿一条直线折叠。 +@msg A gap between cut lines is too narrow to tell apart. 切割线之间的间隙太窄,无法区分。 +@msg A cut-out area holds other fold lines. 一个镂空区域包含其他折线。 +@msg A panel is not joined to the rest by a crease. 一个面板没有通过任何压痕线与其余部分相连。 +@msg A fold line is on a non-printing layer. 一条折线位于不打印的图层上。 +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},压痕:{hinges},错误:{errors},警告:{warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} 像素对 PSD 而言过大 (每边最多 {MAX_SIDE} 像素):请降低分辨率 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index e0b5a13ee2..434723a718 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -9390,4 +9390,23 @@ breakText Glyphs 字符 No objects are selected. 未選取任何物件。 Open a document to mark its fold lines. 開啟文件以標記其摺線。 Remove Fold Line Role 移除線條類型 + Check 檢查 + Check Fold Lines 檢查摺線 +@msg No cut lines are in the selection. 選取範圍中沒有切割線。 +@msg No cut lines are in the document. 文件中沒有切割線。 +@msg The cut lines do not enclose an area. 切割線未圍成任何區域。 +@msg A cut line ends without meeting another cut line. 一條切割線未與其他切割線相接就結束了。 +@msg A gap between cut lines was closed. 已封閉切割線之間的間隙。 +@msg The fold lines are too complex to check. 摺線過於複雜,無法檢查。 +@msg A cut line and a crease lie on top of each other. 一條切割線與一條壓痕線重疊。 +@msg Two lines of the same role lie on top of each other. 兩條同類線條重疊。 +@msg A crease ends inside a panel. 一條壓痕線在面板內部結束。 +@msg A crease does not divide two panels. 一條壓痕線沒有分隔兩個面板。 +@msg A crease lies outside the cut outline. 一條壓痕線位於切割輪廓之外。 +@msg A crease that is not straight is folded along one straight line. 不直的壓痕線沿一條直線摺疊。 +@msg A gap between cut lines is too narrow to tell apart. 切割線之間的間隙太窄,無法區分。 +@msg A cut-out area holds other fold lines. 一個鏤空區域包含其他摺線。 +@msg A panel is not joined to the rest by a crease. 一個面板沒有透過任何壓痕線與其餘部分相連。 +@msg A fold line is on a non-printing layer. 一條摺線位於不列印的圖層上。 +@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},壓痕:{hinges},錯誤:{errors},警告:{warnings} @msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} 會列印在超過 {MAX_TILES} 個拼貼上:請縮小 diff --git a/crates/ui-egui/src/menus/invoke.rs b/crates/ui-egui/src/menus/invoke.rs index 3e48476a1a..845ea7102a 100644 --- a/crates/ui-egui/src/menus/invoke.rs +++ b/crates/ui-egui/src/menus/invoke.rs @@ -195,6 +195,11 @@ pub fn invoke(app: &mut VectorcraftApp, id: &str, p: Value) { } return; } + // Check Fold Lines shows its summary and lists its issues in the Fold Lines panel. + if id == crate::addons::packaging::CHECK { + crate::addons::packaging::check(app, p); + return; + } // A Paste the user gives decodes a bitmap off the UI thread ([`crate::placing::adopt_for_paste`]). app.placing.for_user = id.starts_with("edit.paste"); let r = app.run(id, p); diff --git a/docs/mcp.md b/docs/mcp.md index c7aa202d3f..e552ec49b7 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -13033,9 +13033,10 @@ there is no step. → `{symbols: [name…], ids: [instance id…], skipped: [{la ## Packaging Tools add-on Packaging Tools is a built-in add-on for the dielines of boxes and other folded packaging. Its commands are -`addon.packaging.setRole`, `addon.packaging.roles` and `addon.packaging.setRoleSwatch`. In the desktop app, Object › -Plug-ins › Packaging Tools › Fold Lines opens the Fold Lines panel, and Make Cut Line, Make Crease Line, Make Partial Cut -Line and Make Perforation Line run `addon.packaging.setRole` on the selection. +`addon.packaging.setRole`, `addon.packaging.roles`, `addon.packaging.setRoleSwatch` and `addon.packaging.check`. In the +desktop app, Object › Plug-ins › Packaging Tools › Fold Lines opens the Fold Lines panel, Make Cut Line, Make Crease Line, +Make Partial Cut Line and Make Perforation Line run `addon.packaging.setRole` on the selection, and Check Fold Lines runs +`addon.packaging.check`. ### Fold line roles @@ -13082,6 +13083,55 @@ panel's menu opens it as Role Swatches…. {"name":"run_command","arguments":{"command":"addon.packaging.setRole","params":{"role":"crease"}}} ``` +### Check Fold Lines + +`addon.packaging.check` (`{ids?, select?: false, tolerance?: 0.1}`) finds the blanks, panels and hinges that the fold +lines make and lists what is wrong with them. It checks the fold lines among the objects (the selection by default), +through groups and clip groups, or every fold line of the document that is shown while nothing is selected and `ids` is +left out. `tolerance` is in points, from 0.01 to 10; a value outside that range, or one that is not a number or a length +such as `"2 mm"`, is an error. The command does not change the document and records no undo step. + +- Cut lines bound the material. Each connected piece of cut lines that encloses material is one blank. Its outline is its + largest closed cut line, and a closed cut line inside the outline is a hole, so a slot drawn as a rectangle across the + outline leaves the same material as a notch drawn in it. Open cut lines that meet end to end count as one closed cut + line, so an outline or a slot drawn as several open cut lines works as well. +- Crease, Partial Cut and Perforation lines divide a blank into panels. The pieces of them that lie between the same two + panels form one hinge. +- The end of a cut line that comes within `tolerance` of another cut line is joined to it with a short line, and the + check reports the gap. + +The issues come in this order. `noCut`, `open`, `looseEnd`, `tooComplex` and `cutOverCrease` are errors; the others are +warnings. + +| Code | Reported when | +|---|---| +| `noCut` | No cut line is among the objects. | +| `open` | The cut lines enclose no area. | +| `looseEnd` | An end of a cut line meets no other fold line within `tolerance`, and no gap is closed at it. `at` is the end. | +| `gap` | An end of a cut line lies within `tolerance` of another cut line without touching it; the panels are built with the gap closed. `at` is the end. | +| `tooComplex` | The lines have more than 65,536 segments, or a blank has more than 256 panels. | +| `cutOverCrease` | A cut line and a crease, partial cut or perforation lie on top of each other. | +| `duplicate` | Two lines of the same role, or two subpaths of one line, lie on top of each other. | +| `danglingCrease` | A crease ends inside a panel. | +| `noSplit` | A crease divides no two panels. | +| `outside` | A crease lies outside every blank. | +| `notStraight` | The pieces of a hinge are not on one straight line within `tolerance`; it folds along the line through its longest piece. | +| `sliver` | A gap between lines inside a blank is narrower than 0.01 pt. | +| `ambiguous` | A hole holds creases, or a blank lies inside another blank's hole. | +| `loosePanel` | A panel is joined to its blank's largest panel by no chain of hinges. | +| `nonPrinting` | A fold line is on a layer that does not print. | + +Result: `{ok, blanks, panels, hinges, holes, issues: [{severity, code, message, ids, at?}], scope}`. `ok` is true when +no issue is an error. `message` is in English, and the Fold Lines panel shows it in the interface language. `ids` names +the objects each issue is about. With `select: true`, those objects become the selection; when no issue names an +object, the selection stays as it is. The Fold Lines panel's Check button runs the same check, shows a summary line +(panels, creases, errors and warnings) and lists the issues; clicking an issue or its Select button selects its objects. +The list is shown until the document changes. + +```json +{"name":"run_command","arguments":{"command":"addon.packaging.check","params":{"tolerance":0.5,"select":true}}} +``` + ## Image Tools add-on Image Tools is a built-in add-on for placed images: its commands are `addon.image.removeBackground`, From f54a3faa39a7118c2380a40eef9478db2c9062ae Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 03:24:48 -0800 Subject: [PATCH 2/2] Packaging Tools: Check Fold Lines reports overshooting and stacked fold lines - A crease that runs past the cut outline by the tolerance or more is reported as outside, though its hinge is still built. - Two lines that fold, of any role, on top of each other are reported as duplicate; a line drawn twice is still checked for where it lies. - Hidden lines are left out in every scope, members of a selected group included. - The ids scope gets its own noCut message. - The notStraight, ambiguous and summary texts say what the check finds: the summary counts hinges, not creases. - The fold angle fields, which nothing in this change reads, are removed. - A window drawn as open cut lines stays a hole when a cut line crosses it or when slits join it to an outline of open lines, so that three lines meet at a corner. Cut lines drawn whole that cross a cell leave it material. - A slot drawn across the outline is a notch, not a hole, as when the notch is drawn in the outline; a crease in it lies outside the blank. - notStraight measures each hinge piece at its farthest point from the hinge line instead of at five samples. - Cut lines drawn on top of each other so many times that the gap search would look at more than 16,777,216 pairs are reported as tooComplex before the search. --- .../engine/src/cmd/addons/packaging/check.rs | 19 +- .../src/cmd/addons/packaging/check/tests.rs | 15 + crates/three-d/src/fold.rs | 353 ++++++++++++++---- crates/three-d/src/fold/tests.rs | 192 +++++++++- crates/three-d/src/lib.rs | 2 + crates/ui-egui/src/addons/packaging.rs | 2 +- crates/ui-egui/src/addons/packaging/tests.rs | 24 +- crates/ui-egui/src/i18n/bg.tsv | 11 +- crates/ui-egui/src/i18n/bs.tsv | 11 +- crates/ui-egui/src/i18n/ca.tsv | 11 +- crates/ui-egui/src/i18n/cs.tsv | 11 +- crates/ui-egui/src/i18n/da.tsv | 11 +- crates/ui-egui/src/i18n/de.tsv | 11 +- crates/ui-egui/src/i18n/el.tsv | 11 +- crates/ui-egui/src/i18n/es.tsv | 11 +- crates/ui-egui/src/i18n/fi.tsv | 11 +- crates/ui-egui/src/i18n/fr.tsv | 11 +- crates/ui-egui/src/i18n/gu.tsv | 11 +- crates/ui-egui/src/i18n/hi.tsv | 11 +- crates/ui-egui/src/i18n/hu.tsv | 11 +- crates/ui-egui/src/i18n/id.tsv | 11 +- crates/ui-egui/src/i18n/it.tsv | 11 +- crates/ui-egui/src/i18n/ja.tsv | 11 +- crates/ui-egui/src/i18n/ka.tsv | 11 +- crates/ui-egui/src/i18n/ko.tsv | 11 +- crates/ui-egui/src/i18n/nl.tsv | 11 +- crates/ui-egui/src/i18n/pl.tsv | 11 +- crates/ui-egui/src/i18n/pt-br.tsv | 11 +- crates/ui-egui/src/i18n/ru.tsv | 11 +- crates/ui-egui/src/i18n/sv.tsv | 11 +- crates/ui-egui/src/i18n/tr.tsv | 11 +- crates/ui-egui/src/i18n/uk.tsv | 11 +- crates/ui-egui/src/i18n/vi.tsv | 11 +- crates/ui-egui/src/i18n/zh-hans.tsv | 11 +- crates/ui-egui/src/i18n/zh-hant.tsv | 11 +- docs/mcp.md | 14 +- 36 files changed, 681 insertions(+), 248 deletions(-) diff --git a/crates/engine/src/cmd/addons/packaging/check.rs b/crates/engine/src/cmd/addons/packaging/check.rs index 59f195d4df..da8f7f25dd 100644 --- a/crates/engine/src/cmd/addons/packaging/check.rs +++ b/crates/engine/src/cmd/addons/packaging/check.rs @@ -22,7 +22,7 @@ pub fn specs() -> Vec { "Check Fold Lines", ["Object", "Plug-ins", "Packaging Tools"], None, - "{ids?: [id…] (default: the selection), select?: bool (false), tolerance?: pt 0.01..10 (0.1)} check the fold lines (addon.packaging.roles) among the objects (through groups and clip groups), or, while nothing is selected and ids is left out, every fold line of the document that is shown. Cut lines bound the blanks: each connected piece of them that encloses material is one blank, its outline is its largest closed cut line, and a closed cut line inside it is a hole, so a slot drawn as a rectangle across the outline leaves the same material as a notch drawn in it; open cut lines that meet end to end count as one closed cut line. Crease, Partial Cut and Perforation lines divide a blank into panels; the pieces of them between two panels are that pair's hinge. A cut line end that comes within tolerance of another cut line is joined to it. Issues, in this order: noCut, open, looseEnd (errors), gap (a warning: the gap is closed), tooComplex (an error: more than 65,536 segments or 256 panels in a blank), cutOverCrease (an error), duplicate, danglingCrease, noSplit, outside, notStraight (it folds along the line through its longest piece), sliver, ambiguous, loosePanel (joined to the largest panel by no chain of hinges), nonPrinting (warnings). With select, the objects the issues name become the selection, unless no issue names one. Changes nothing in the document → {ok (no error), blanks, panels, hinges, holes, issues: [{severity: error|warning, code, message (English), ids, at?: [x, y]}], scope: ids|selection|document}", + "{ids?: [id…] (default: the selection), select?: bool (false), tolerance?: pt 0.01..10 (0.1)} check the fold lines (addon.packaging.roles) among the objects (through groups and clip groups), or, while nothing is selected and ids is left out, every fold line of the document; hidden lines are left out, also in a selected group. Cut lines bound the blanks: each connected piece of them that encloses material is one blank, its outline is its largest closed cut line, and a closed cut line inside it is a hole, so a slot drawn as a rectangle across the outline leaves the same material as a notch drawn in it; open cut lines that meet end to end count as one closed cut line. Crease, Partial Cut and Perforation lines divide a blank into panels; the pieces of them between two panels are that pair's hinge. A cut line end that comes within tolerance of another cut line is joined to it. Issues, in this order: noCut, open, looseEnd (errors), gap (a warning: the gap is closed), tooComplex (an error: more than 65,536 segments or 256 panels in a blank), cutOverCrease (an error), duplicate (two cut lines, or two lines that fold of any role), danglingCrease, noSplit, outside (wholly, or in part for tolerance or more), notStraight (a hinge's pieces are not on one straight line), sliver, ambiguous, loosePanel (joined to the largest panel by no chain of hinges), nonPrinting (warnings). With select, the objects the issues name become the selection, unless no issue names one. Changes nothing in the document → {ok (no error), blanks, panels, hinges, holes, issues: [{severity: error|warning, code, message (English), ids, at?: [x, y]}], scope: ids|selection|document}", has_doc, check )] @@ -32,19 +32,20 @@ pub fn specs() -> Vec { fn message(code: IssueCode, scope: &str) -> &'static str { match code { IssueCode::NoCut if scope == "document" => "No cut lines are in the document.", + IssueCode::NoCut if scope == "ids" => "No cut lines are among the given objects.", IssueCode::NoCut => "No cut lines are in the selection.", IssueCode::Open => "The cut lines do not enclose an area.", IssueCode::LooseEnd => "A cut line ends without meeting another cut line.", IssueCode::Gap => "A gap between cut lines was closed.", IssueCode::TooComplex => "The fold lines are too complex to check.", IssueCode::CutOverCrease => "A cut line and a crease lie on top of each other.", - IssueCode::Duplicate => "Two lines of the same role lie on top of each other.", + IssueCode::Duplicate => "Two fold lines lie on top of each other.", IssueCode::DanglingCrease => "A crease ends inside a panel.", IssueCode::NoSplit => "A crease does not divide two panels.", - IssueCode::Outside => "A crease lies outside the cut outline.", - IssueCode::NotStraight => "A crease that is not straight is folded along one straight line.", + IssueCode::Outside => "A crease lies outside the cut outline, wholly or in part.", + IssueCode::NotStraight => "The pieces of a hinge are not on one straight line.", IssueCode::Sliver => "A gap between cut lines is too narrow to tell apart.", - IssueCode::Ambiguous => "A cut-out area holds other fold lines.", + IssueCode::Ambiguous => "A cut-out area holds other fold lines or another blank.", IssueCode::LoosePanel => "A panel is not joined to the rest by a crease.", IssueCode::NonPrinting => "A fold line is on a non-printing layer.", } @@ -110,9 +111,11 @@ fn check(s: &mut Session, p: &Value) -> Result { let given = p.get("ids").is_some_and(|v| !v.is_null()); let roots = checked_ids_or_selection(s, p, CHECK)?; let d = &s.doc()?.doc; + // Hidden lines are left out in every scope, members of a selected group included. + let shown = |ids: Vec| ids.into_iter().filter(|id| d.is_visible(*id)).collect::>(); let (scope, targets) = match (given, roots.is_empty()) { - (true, _) => ("ids", role_targets(d, &roots, false).0), - (false, false) => ("selection", role_targets(d, &roots, false).0), + (true, _) => ("ids", shown(role_targets(d, &roots, false).0)), + (false, false) => ("selection", shown(role_targets(d, &roots, false).0)), (false, true) => ("document", shown_targets(d)), }; let table = RoleTable::of(d); @@ -131,7 +134,7 @@ fn check(s: &mut Session, p: &Value) -> Result { non_printing.push(id.0); } segments = segments.saturating_add(path.subpaths.iter().map(|sp| sp.segment_count()).sum()); - lines.push(FoldLine { path, kind: kind(role), angle: None, key: id.0 }); + lines.push(FoldLine { path, kind: kind(role), key: id.0 }); } let (found, mut issues) = blanks(&lines, tolerance); if !non_printing.is_empty() { diff --git a/crates/engine/src/cmd/addons/packaging/check/tests.rs b/crates/engine/src/cmd/addons/packaging/check/tests.rs index 427656fc29..9940761dea 100644 --- a/crates/engine/src/cmd/addons/packaging/check/tests.rs +++ b/crates/engine/src/cmd/addons/packaging/check/tests.rs @@ -62,6 +62,9 @@ fn the_selection_or_ids_limit_the_check_to_their_lines() { assert_eq!(r["issues"][0]["message"], "No cut lines are in the selection."); let r = check(&mut s, json!({ "ids": [outline] })); assert_eq!((r["scope"].as_str(), r["ok"].as_bool(), r["panels"].as_u64()), (Some("ids"), Some(true), Some(1)), "{r}"); + let r = check(&mut s, json!({ "ids": [creases[1]] })); + assert_eq!((r["scope"].as_str(), codes(&r)), (Some("ids"), vec!["noCut"])); + assert_eq!(r["issues"][0]["message"], "No cut lines are among the given objects."); // No fold lines at all in the document. let mut s = session(); let r = check(&mut s, json!({})); @@ -135,6 +138,18 @@ fn hidden_lines_are_left_out_and_lines_on_a_non_printing_layer_are_noted() { s.execute("select.none", &json!({})).unwrap(); let r = check(&mut s, json!({})); assert_eq!((r["panels"].as_u64(), r["hinges"].as_u64()), (Some(4), Some(3)), "{r}"); + // The same in a selected group, and with the group named by `ids`: the hidden member is left + // out too. + let mut s = session(); + let (outline, creases) = tray(&mut s); + s.execute("select.set", &json!({ "ids": [outline, creases[0], creases[1], creases[2], creases[3]] })).unwrap(); + let group = s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap(); + s.execute("layer.setProps", &json!({ "ids": [creases[0]], "visible": false })).unwrap(); + s.execute("select.set", &json!({ "ids": [group] })).unwrap(); + for p in [json!({}), json!({ "ids": [group] })] { + let r = check(&mut s, p); + assert_eq!((r["panels"].as_u64(), r["hinges"].as_u64()), (Some(4), Some(3)), "{r}"); + } // A cut line on a layer that does not print. let mut s = session(); s.execute("layer.new", &json!({ "printable": false })).unwrap(); diff --git a/crates/three-d/src/fold.rs b/crates/three-d/src/fold.rs index c68f8aa6ca..2dbff773f9 100644 --- a/crates/three-d/src/fold.rs +++ b/crates/three-d/src/fold.rs @@ -12,7 +12,7 @@ use std::collections::{HashMap, HashSet}; use vectorcraft_geom::kurbo::{Line, ParamCurveArclen, ParamCurveNearest, PathSeg}; -use vectorcraft_geom::{BezPath, FillRule, ParamCurve, PathData, Point, Rect, Shape as _, SubPath}; +use vectorcraft_geom::{Affine, BezPath, FillRule, ParamCurve, PathData, Point, Rect, Shape as _, SubPath}; use vectorcraft_pathops::{Adjacency, DEFAULT_PRECISION, SHAPE_BUILDER_MAX_SEGMENTS, Shape, adjacency, find_gaps, interior_point, unite_all}; /// Most panels one blank may have. Its hinges are the edges of a planar graph on its panels, so there @@ -34,26 +34,11 @@ pub enum LineKind { Perforation, } -impl LineKind { - /// The angle a line of this kind folds at when it has none of its own, in degrees: Crease and - /// Perforation 90, Partial Cut -90 (VectorCraft's own values); a positive angle folds away from - /// the printed side. A Cut line does not fold: 0. - pub fn default_angle(self) -> f64 { - match self { - LineKind::Cut => 0.0, - LineKind::Crease | LineKind::Perforation => 90.0, - LineKind::PartialCut => -90.0, - } - } -} - -/// A fold line: the path (document coordinates), its kind, its own fold angle in degrees if it has -/// one, and a key the issues name it by. +/// A fold line: the path (document coordinates), its kind, and a key the issues name it by. #[derive(Clone, Debug)] pub struct FoldLine { pub path: PathData, pub kind: LineKind, - pub angle: Option, pub key: u64, } @@ -72,17 +57,16 @@ pub struct Panel { pub area: f64, } -/// The fold between panels `a` and `b` (indices into the blank's panels, `a` < `b`), about the -/// straight line from `from` to `to`, at `angle` degrees, made of the lines `keys`. `straight` is -/// false when its pieces are not on one straight line within the tolerance; it then folds about the -/// line through its longest piece. +/// The hinge between panels `a` and `b` (indices into the blank's panels, `a` < `b`): the straight +/// line from `from` to `to`, made of the lines `keys`. `straight` is false when its pieces are not on +/// one straight line within the tolerance; `from` and `to` are then on the line through its longest +/// piece. #[derive(Clone, Debug)] pub struct Hinge { pub a: usize, pub b: usize, pub from: Point, pub to: Point, - pub angle: f64, pub keys: Vec, pub straight: bool, } @@ -105,13 +89,14 @@ pub enum IssueCode { TooComplex, /// A Cut line and a crease lie on top of each other. CutOverCrease, - /// Two lines of the same kind lie on top of each other. + /// Two Cut lines, or two of the lines that fold (of the same kind or not), lie on top of each + /// other. Duplicate, /// A crease ends inside a panel. DanglingCrease, /// A crease divides no two panels. NoSplit, - /// A crease lies outside every blank. + /// A crease lies outside every blank, wholly, or in part for the tolerance or more. Outside, /// A hinge's pieces are not on one straight line. NotStraight, @@ -221,6 +206,9 @@ pub fn blanks(lines: &[FoldLine], tolerance: f64) -> (Vec, Vec) { return (vec![], vec![Issue::new(IssueCode::NoCut, vec![], None)]); } let folds: Vec<&Piece> = pieces.iter().filter(|p| kind(p) != LineKind::Cut).collect(); + if !gap_work_fits(&cuts, tolerance) { + return (vec![], vec![Issue::new(IssueCode::TooComplex, vec![], None)]); + } let cut_shapes: Vec = cuts.iter().map(|p| shape(p.sp.clone())).collect(); let gaps = find_gaps(&cut_shapes, tolerance); // `find_gaps` takes ends closer than 1/10,000 of the tolerance as joined, which the map may not @@ -271,6 +259,33 @@ pub fn blanks(lines: &[FoldLine], tolerance: f64) -> (Vec, Vec) { (built, sorted(issues)) } +/// Most (open end, Cut segment) pairs within the tolerance of each other that the gap search may +/// look at. +const MAX_GAP_CANDIDATES: usize = 1 << 24; + +/// Whether the gap search over `cuts` stays within [`MAX_GAP_CANDIDATES`]: it looks at the Cut +/// segments within `tolerance` of each open end, and lines drawn on top of each other many times +/// over make that work grow with the square of their number. The count stops at the limit. +fn gap_work_fits(cuts: &[&Piece], tolerance: f64) -> bool { + let boxes: Vec<(Rect, usize)> = cuts + .iter() + .flat_map(|p| { + PathData::single(p.sp.clone()).to_bezpath().segments().map(|s| s.bounding_box().inflate(tolerance, tolerance)).collect::>() + }) + .enumerate() + .map(|(i, b)| (b, i)) + .collect(); + let grid = Cells::new(boxes, 2.0 * tolerance, 4096.0); + let mut work = 0usize; + for e in cuts.iter().flat_map(|p| ends(&p.sp)) { + work = work.saturating_add(grid.near(e, 0.0).len()); + if work > MAX_GAP_CANDIDATES { + return false; + } + } + true +} + fn sorted(mut issues: Vec) -> Vec { issues.sort_by_key(|i| i.code); issues @@ -429,8 +444,9 @@ fn contains(bp: &BezPath, p: Point) -> bool { /// The loops that open Cut pieces and the lines across `gaps` make end to end: each chain of them /// whose every end meets exactly one end of another piece of the chain (within 1e-6), as (index -/// into `cuts` of its first Cut piece, closed path). Pieces that lie on no cycle are left out first; -/// ends where three of the remaining pieces or more meet join nothing. +/// into `cuts` of its first Cut piece, closed path). Pieces that lie on no cycle are left out first. +/// A connected set of the remaining pieces with an end where three or more meet gives the outlines +/// of the faces it encloses instead. fn chains(cuts: &[&Piece], gaps: &[[Point; 2]]) -> Vec<(usize, BezPath)> { const NEAR: f64 = 1e-6; // Cell numbers stay far from the ends of `i64`, so a neighbor's number does not overflow. @@ -477,8 +493,49 @@ fn chains(cuts: &[&Piece], gaps: &[[Point; 2]]) -> Vec<(usize, BezPath)> { for ks in at.values_mut() { ks.retain(|&k| live.get(k) == Some(&true)); } + // The connected pieces of what is left, by node. In a piece where some node joins more than two + // pieces (a window with a cut across it), the loop is the outline of the faces the piece + // encloses; the other pieces are walked end to end below. + let mut group: Vec = (0..firsts.len()).collect(); + for (k, &(_, a, b)) in open.iter().enumerate() { + if live.get(k) == Some(&true) { + let (ra, rb) = (root_of(&mut group, a), root_of(&mut group, b)); + if let Some(slot) = group.get_mut(ra) { + *slot = rb; + } + } + } + let mut branched: HashSet = HashSet::new(); + for (&n, ks) in &at { + if !ks.is_empty() && ks.len() != 2 { + branched.insert(root_of(&mut group, n)); + } + } let mut used: Vec = live.iter().map(|l| !l).collect(); let mut out = vec![]; + let mut joined: HashMap> = HashMap::new(); + for (k, &(_, a, _)) in open.iter().enumerate() { + let r = root_of(&mut group, a); + if used.get(k) == Some(&false) && branched.contains(&r) { + joined.entry(r).or_default().push(k); + if let Some(u) = used.get_mut(k) { + *u = true; + } + } + } + let mut joined: Vec> = joined.into_values().collect(); + joined.sort_unstable(); + for ks in joined { + let Some(first_cut) = ks.iter().filter_map(|&k| open.get(k).and_then(|&(j, _, _)| items.get(j)).and_then(|(i, _)| *i)).min() else { + continue; + }; + let shapes: Vec = ks + .iter() + .filter_map(|&k| open.get(k).and_then(|&(j, _, _)| items.get(j))) + .map(|(_, segs)| Shape::new(PathData::from_bezpath(&BezPath::from_path_segments(segs.iter().copied())), FillRule::NonZero, 0)) + .collect(); + out.extend(enclosed_loops(&shapes).into_iter().map(|bp| (first_cut, bp))); + } for start in 0..open.len() { if used.get(start) != Some(&false) { continue; @@ -534,6 +591,95 @@ fn chains(cuts: &[&Piece], gaps: &[[Point; 2]]) -> Vec<(usize, BezPath)> { out } +/// The loops of a connected set of open Cut pieces `shapes` where some end joins three pieces or +/// more: the outline of all the faces they enclose, and for each group of faces that meet only other +/// faces and are bounded by pieces that meet end to end (a window joined to an outline by two slits, +/// not the middle cell of cut lines that cross), the group's outline, as the pieces of a chain that +/// closes count as one closed Cut line. +fn enclosed_loops(shapes: &[Shape]) -> Vec { + let Some(map) = adjacency(shapes, DEFAULT_PRECISION) else { return vec![] }; + let mut inner = vec![true; map.faces.len()]; + for e in &map.edges { + for (a, b) in [(e.left, e.right), (e.right, e.left)] { + if b.is_none() + && let Some(slot) = a.and_then(|f| inner.get_mut(f)) + { + *slot = false; + } + } + } + let mut group: Vec = (0..map.faces.len()).collect(); + for e in &map.edges { + if let (Some(a), Some(b)) = (e.left, e.right) + && a != b + && inner.get(a) == Some(&true) + && inner.get(b) == Some(&true) + { + let (ra, rb) = (root_of(&mut group, a), root_of(&mut group, b)); + if let Some(slot) = group.get_mut(ra) { + *slot = rb; + } + } + } + let mut sets: HashMap> = HashMap::new(); + for f in (0..map.faces.len()).filter(|&f| inner.get(f) == Some(&true)) { + sets.entry(root_of(&mut group, f)).or_default().push(f); + } + // A group is a loop when its boundary edges come from pieces that lie on that boundary alone, + // that is, pieces that meet end to end round it; pieces of lines that cross it go on past it. + let mut edges_of: HashMap> = HashMap::new(); + for (i, e) in map.edges.iter().enumerate() { + for &s in &e.sources { + edges_of.entry(s).or_default().push(i); + } + } + let side = |g: &mut Vec, f: Option| f.filter(|&f| inner.get(f) == Some(&true)).map(|f| root_of(g, f)); + let mut boundary: HashMap> = HashMap::new(); + for (i, e) in map.edges.iter().enumerate() { + let (l, r) = (side(&mut group, e.left), side(&mut group, e.right)); + if l != r { + for root in [l, r].into_iter().flatten() { + boundary.entry(root).or_default().insert(i); + } + } + } + let whole = |root: &usize| { + boundary.get(root).is_some_and(|edges| { + edges + .iter() + .filter_map(|&i| map.edges.get(i)) + .flat_map(|e| &e.sources) + .all(|s| edges_of.get(s).is_some_and(|all| all.iter().all(|i| edges.contains(i)))) + }) + }; + let mut sets: Vec<(usize, Vec)> = sets.into_iter().filter(|(root, _)| whole(root)).collect(); + sets.push((usize::MAX, (0..map.faces.len()).collect())); + sets.sort_unstable(); + let mut out = vec![]; + for (_, set) in sets { + let faces: Vec<(&PathData, FillRule)> = set.iter().filter_map(|&f| map.faces.get(f)).map(|f| (&f.path, FillRule::NonZero)).collect(); + if !faces.is_empty() { + out.extend(unite_all(&faces).subpaths.into_iter().map(|sp| PathData::single(sp).to_bezpath())); + } + } + out +} + +/// The node that stands for `v`'s set in `group` (a disjoint-set forest), halving the path on the way. +fn root_of(group: &mut [usize], mut v: usize) -> usize { + while let Some(&up) = group.get(v) { + if up == v { + break; + } + let next = group.get(up).copied().unwrap_or(up); + if let Some(slot) = group.get_mut(v) { + *slot = next; + } + v = next; + } + v +} + /// Which of `edges` ((id, end node, end node), nodes below `nodes`) lie on no cycle: the bridges of /// the graph, found depth first without recursion. fn bridges(nodes: usize, edges: &[(usize, usize, usize)]) -> Vec { @@ -809,6 +955,7 @@ impl Material { *h = !unusable(f) && in_outline && cut_out; } } + self.open_notches(piece, fallback.as_ref()); if any { let bound = if outlines.is_empty() { fallback @@ -825,6 +972,45 @@ impl Material { } } + /// Faces of `piece` cut out that meet the outside, directly or through other faces cut out, are + /// a notch, not a hole: they stop being holes. The outside is a usable face that is neither + /// material nor a hole (the part of a slot beyond the outline), or the side with no face of an + /// edge on the piece's outer boundary `outline` (elsewhere a side with no face is a sliver). + fn open_notches(&mut self, piece: usize, outline: Option<&BezPath>) { + let edges = self.edges_by_piece.get(piece).cloned().unwrap_or_default(); + let hole = |s: &Self, f: Option| f.is_some_and(|f| s.hole.get(f) == Some(&true)); + let open = |s: &Self, f: Option| { + f.is_some_and(|f| s.hole.get(f) != Some(&true) && s.material.get(f) != Some(&true) && s.points.get(f).copied().flatten().is_some()) + }; + // Whether `edge` lies on the piece's outer boundary `outline` (its middle within 1e-6 of + // it): its side with no face is then the outside, not a sliver. + let on_outline = |edge: &vectorcraft_pathops::MapEdge| { + let Some(outline) = outline else { return false }; + let segs: Vec = edge.path.to_bezpath().segments().collect(); + let Some(mid) = segs.get(segs.len() / 2).map(|s| s.eval(0.5)) else { return false }; + outline.segments().any(|s| s.nearest(mid, 1e-9).distance_sq <= 1e-12) + }; + let mut next: HashMap> = HashMap::new(); + let mut queue = vec![]; + for edge in edges.iter().filter_map(|&e| self.map.edges.get(e)) { + for (a, b) in [(edge.left, edge.right), (edge.right, edge.left)] { + let Some(f) = a.filter(|_| a != b && hole(self, a)) else { continue }; + if open(self, b) || (b.is_none() && on_outline(edge)) { + queue.push(f); + } else if let Some(g) = b.filter(|_| hole(self, b)) { + next.entry(f).or_default().push(g); + } + } + } + while let Some(f) = queue.pop() { + match self.hole.get_mut(f) { + Some(h) if *h => *h = false, + _ => continue, + } + queue.extend(next.get(&f).into_iter().flatten().copied()); + } + } + /// The face of the Cut lines' map that holds `p`, the smallest when several do. fn face_at(&self, p: Point) -> Option { self.face_cells @@ -865,6 +1051,9 @@ struct HingePiece { lines: Vec, } +/// A hinge piece by the (blank, panel, panel) it lies between. +type PlacedPiece = ((usize, usize, usize), HingePiece); + struct Context<'a> { lines: &'a [FoldLine], pieces: &'a [Piece], @@ -945,9 +1134,9 @@ impl Context<'_> { issues.push(Issue::new(IssueCode::TooComplex, vec![], None)); return vec![]; } - let pieces = self.edges(&places, issues); + let (pieces, outside) = self.edges(&places, issues); let hinged = self.hinges(&mut blanks, pieces, issues); - self.creases(&places, &hinged, issues); + self.creases(&places, &hinged, &outside, issues); self.slivers(issues); self.nested(issues); self.loose_panels(&blanks, &places, issues); @@ -980,9 +1169,10 @@ impl Context<'_> { } /// Overlaps, dangling creases and creases in holes, from the full map's edges → the hinge - /// pieces, by (blank, panel, panel). - fn edges(&self, places: &[Place], issues: &mut Vec) -> Vec<((usize, usize, usize), HingePiece)> { + /// pieces, by (blank, panel, panel), and how long each line runs outside every blank. + fn edges(&self, places: &[Place], issues: &mut Vec) -> (Vec, Vec) { let mut pieces = vec![]; + let mut outside = vec![0.0; self.lines.len()]; let mut seen: HashSet<(IssueCode, Vec)> = HashSet::new(); let mut report = |issues: &mut Vec, code: IssueCode, keys: Vec| { let issue = Issue::new(code, keys, None); @@ -1000,17 +1190,16 @@ impl Context<'_> { report(issues, IssueCode::CutOverCrease, self.keys(by_line.iter().copied())); continue; } - // Two subpaths of one kind on the same edge, from two lines or from one line's own - // subpaths (a compound path); the gap lines are left out. - let drawn: Vec = e.sources.iter().copied().filter(|&s| self.line_of(s).is_some()).collect(); - let mut duplicates: Vec = drawn - .iter() - .filter(|&&s| drawn.iter().any(|&o| o != s && self.kind_of(o) == self.kind_of(s))) - .filter_map(|&s| self.line_of(s)) - .collect(); - duplicates.sort_unstable(); - duplicates.dedup(); - if !duplicates.is_empty() { + // Two subpaths on the same edge, from two lines or from one line's own subpaths (a + // compound path); the gap lines are left out. Past the check above they are all Cut lines + // or all lines that fold. + let mut drawn: Vec = e.sources.iter().copied().filter(|&s| self.line_of(s).is_some()).collect(); + drawn.sort_unstable(); + drawn.dedup(); + if drawn.len() >= 2 { + let mut duplicates: Vec = drawn.iter().filter_map(|&s| self.line_of(s)).collect(); + duplicates.sort_unstable(); + duplicates.dedup(); report(issues, IssueCode::Duplicate, self.keys(duplicates)); } if creases.is_empty() { @@ -1024,14 +1213,34 @@ impl Context<'_> { report(issues, IssueCode::DanglingCrease, self.keys(creases)); } (Place::Hole, _) | (_, Place::Hole) => report(issues, IssueCode::Ambiguous, self.keys(creases)), - _ => {} + _ => { + // A side with no face can also be a sliver inside a blank: the edge counts when + // its middle lies in a face of the Cut lines that is neither material nor a hole + // (a notch), or in no face and outside every blank. + let segs: Vec = e.path.to_bezpath().segments().collect(); + let Some(mid) = segs.get(segs.len() / 2).map(|s| s.eval(0.5)) else { continue }; + let m = self.material; + let away = match m.face_at(mid) { + Some(f) => m.material.get(f) != Some(&true) && m.hole.get(f) != Some(&true), + None => !m.in_a_blank(mid), + }; + if !away { + continue; + } + let length: f64 = segs.iter().map(|s| s.arclen(1e-3)).sum(); + for &line in &creases { + if let Some(o) = outside.get_mut(line) { + *o += length; + } + } + } } } - pieces + (pieces, outside) } /// The hinges `pieces` make, added to `blanks` → the lines with a hinge. - fn hinges(&self, blanks: &mut [Blank], mut pieces: Vec<((usize, usize, usize), HingePiece)>, issues: &mut Vec) -> Vec { + fn hinges(&self, blanks: &mut [Blank], mut pieces: Vec, issues: &mut Vec) -> Vec { pieces.sort_by_key(|p| p.0); let mut hinged = vec![]; let mut start = 0; @@ -1067,29 +1276,24 @@ impl Context<'_> { let sp = p.path.subpaths.first()?; Some((sp.anchors.first()?.p, sp.anchors.last()?.p)) }; - let longest = group.iter().filter_map(|p| Some((*p, chord(p)?))).max_by(|x, y| { - let (lx, ly) = (x.1.0.distance(x.1.1), y.1.0.distance(y.1.1)); - lx.total_cmp(&ly) - })?; - let (p0, p1) = longest.1; + let (p0, p1) = group.iter().filter_map(|p| chord(p)).max_by(|x, y| x.0.distance(x.1).total_cmp(&y.0.distance(y.1)))?; let len = p0.distance(p1); // The longest piece only sets the direction; the length check is on the whole hinge below. if len.is_nan() || len <= 1e-9 { return None; } let d = (p1 - p0) / len; - let off = |p: Point| ((p - p0).cross(d)).abs(); + // Each segment turned so the line through `p0` along `d` is the x axis: the exact bounds + // give how far it strays from the line (y) and its extent along it (x). + let turn = Affine::rotate(-d.y.atan2(d.x)) * Affine::translate(-p0.to_vec2()); let mut straight = true; let (mut lo, mut hi) = (f64::INFINITY, f64::NEG_INFINITY); for p in group { for seg in p.path.to_bezpath().segments() { - for t in [0.0, 0.25, 0.5, 0.75, 1.0] { - let q = seg.eval(t); - straight &= off(q) <= self.tolerance; - let s = (q - p0).dot(d); - lo = lo.min(s); - hi = hi.max(s); - } + let b = (turn * seg).bounding_box(); + straight &= b.y0.abs() <= self.tolerance && b.y1.abs() <= self.tolerance; + lo = lo.min(b.x0); + hi = hi.max(b.x1); } } // The pieces' own length, not the span from the first to the last, which takes in the gaps @@ -1101,23 +1305,21 @@ impl Context<'_> { let mut lines: Vec = group.iter().flat_map(|p| p.lines.iter().copied()).collect(); lines.sort_unstable(); lines.dedup(); - let angle = longest - .0 - .lines - .first() - .and_then(|&l| self.lines.get(l)) - .map(|l| l.angle.filter(|a| a.is_finite()).unwrap_or_else(|| l.kind.default_angle())) - .unwrap_or(90.0); let mut keys = self.keys(lines); keys.sort_unstable(); keys.dedup(); - Some(Hinge { a, b, from: p0 + d * lo, to: p0 + d * hi, angle, keys, straight }) + Some(Hinge { a, b, from: p0 + d * lo, to: p0 + d * hi, keys, straight }) } - /// Creases with no hinge: outside every blank, or dividing no two panels. - fn creases(&self, places: &[Place], hinged: &[usize], issues: &mut Vec) { - let named: HashSet = - issues.iter().filter(|i| i.code != IssueCode::LooseEnd && i.code != IssueCode::Gap).flat_map(|i| i.keys.iter().copied()).collect(); + /// Creases with no hinge: outside every blank, or dividing no two panels; and creases beside a + /// panel that run `outside` every blank (by line) for the tolerance or more. + fn creases(&self, places: &[Place], hinged: &[usize], outside: &[f64], issues: &mut Vec) { + // A line drawn twice is still checked for where it lies. + let named: HashSet = issues + .iter() + .filter(|i| !matches!(i.code, IssueCode::LooseEnd | IssueCode::Gap | IssueCode::Duplicate)) + .flat_map(|i| i.keys.iter().copied()) + .collect(); // Whether each line is drawn (has a usable subpath), and whether one of its edges touches a // panel. let mut drawn = vec![false; self.lines.len()]; @@ -1137,11 +1339,16 @@ impl Context<'_> { } } for (line, l) in self.lines.iter().enumerate() { - if l.kind == LineKind::Cut || hinged.binary_search(&line).is_ok() || named.contains(&l.key) || drawn.get(line) != Some(&true) { + if l.kind == LineKind::Cut || drawn.get(line) != Some(&true) { continue; } - let code = if on_panel.get(line) == Some(&true) { IssueCode::NoSplit } else { IssueCode::Outside }; - issues.push(Issue::new(code, vec![l.key], None)); + let beside = on_panel.get(line) == Some(&true); + if hinged.binary_search(&line).is_err() && !named.contains(&l.key) { + issues.push(Issue::new(if beside { IssueCode::NoSplit } else { IssueCode::Outside }, vec![l.key], None)); + } + if beside && outside.get(line).is_some_and(|&o| o >= self.tolerance) { + issues.push(Issue::new(IssueCode::Outside, vec![l.key], None)); + } } } @@ -1219,7 +1426,7 @@ impl Context<'_> { /// The base panel of `panels`: the largest by area; panels whose areas differ by less than 1e-9 of /// the larger tie, and the tie goes to the one whose inside point is highest on the page, then /// leftmost. -pub fn base_panel(panels: &[Panel]) -> Option { +fn base_panel(panels: &[Panel]) -> Option { let top = panels.iter().map(|p| p.area).fold(f64::NEG_INFINITY, f64::max); if !top.is_finite() { return None; diff --git a/crates/three-d/src/fold/tests.rs b/crates/three-d/src/fold/tests.rs index a3f2c68d37..ef014300c0 100644 --- a/crates/three-d/src/fold/tests.rs +++ b/crates/three-d/src/fold/tests.rs @@ -13,7 +13,7 @@ fn poly(points: &[(f64, f64)], closed: bool) -> PathData { } fn line(kind: LineKind, points: &[(f64, f64)], closed: bool, key: u64) -> FoldLine { - FoldLine { path: poly(points, closed), kind, angle: None, key } + FoldLine { path: poly(points, closed), kind, key } } fn cut(points: &[(f64, f64)], key: u64) -> FoldLine { @@ -131,7 +131,7 @@ fn a_tray_has_a_base_four_walls_and_four_hinges() { assert_eq!(areas(&b[0]), vec![1_800_000, 1_800_000, 3_000_000, 3_000_000, 6_000_000]); assert_eq!(b[0].hinges.len(), 4); for h in &b[0].hinges { - assert!(h.straight && h.angle == 90.0 && h.keys.len() == 1, "{h:?}"); + assert!(h.straight && h.keys.len() == 1, "{h:?}"); assert!((h.from.distance(h.to) - if h.keys[0] % 2 == 0 { 100.0 } else { 60.0 }).abs() < 1e-6, "{h:?}"); } assert_eq!(base_panel(&b[0].panels).map(|i| (b[0].panels[i].area).round()), Some(6000.0)); @@ -188,7 +188,7 @@ fn a_round_tuck_flap_folds_like_any_panel() { bp.curve_to(p(100.0, 10.0), p(80.0, 0.0), p(50.0, 0.0)); bp.curve_to(p(20.0, 0.0), p(0.0, 10.0), p(0.0, 40.0)); bp.close_path(); - let lines = vec![FoldLine { path: PathData::from_bezpath(&bp), kind: LineKind::Cut, angle: None, key: 1 }, crease((0.0, 40.0), (100.0, 40.0), 2)]; + let lines = vec![FoldLine { path: PathData::from_bezpath(&bp), kind: LineKind::Cut, key: 1 }, crease((0.0, 40.0), (100.0, 40.0), 2)]; let (b, issues) = check(&lines); assert!(issues.is_empty(), "{issues:?}"); assert_eq!(b[0].panels.len(), 2); @@ -353,7 +353,7 @@ fn an_outline_drawn_twice_keeps_its_material() { // The same two squares as the subpaths of one compound path. let mut twice = poly(&square, true); twice.subpaths.extend(poly(&square, true).subpaths); - let (b, issues) = check(&[FoldLine { path: twice, kind: LineKind::Cut, angle: None, key: 1 }]); + let (b, issues) = check(&[FoldLine { path: twice, kind: LineKind::Cut, key: 1 }]); assert_eq!(codes(&issues), vec!["duplicate"], "{issues:?}"); assert_eq!(issues[0].keys, vec![1]); assert_eq!(areas(&b[0]), vec![10_000_000]); @@ -412,6 +412,150 @@ fn a_window_of_open_lines_with_a_slit_to_its_corner_is_still_a_hole() { let (b, issues) = check(&lines); assert!(issues.is_empty(), "{issues:?}"); assert_eq!((b[0].holes.len(), areas(&b[0])), (1, areas(&closed[0]))); + // A cut across the window of open lines, so that three lines meet at two of its corners. + let mut lines = vec![cut(&corners, 1), line(LineKind::Cut, &[(40.0, 0.0), (40.0, 40.0)], false, 2)]; + for k in 0..4 { + lines.push(line(LineKind::Cut, &[window[k], window[(k + 1) % 4]], false, 3 + k as u64)); + } + lines.push(line(LineKind::Cut, &[(40.0, 40.0), (60.0, 60.0)], false, 20)); + let (b, issues) = check(&lines); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!((b[0].holes.len(), areas(&b[0])), (1, areas(&closed[0]))); + // The outline and the window both as open lines, joined by two slits: the same as when both are + // closed. + let slits = [line(LineKind::Cut, &[(0.0, 0.0), (40.0, 40.0)], false, 30), line(LineKind::Cut, &[(100.0, 100.0), (60.0, 60.0)], false, 31)]; + let (want, want_issues) = check(&[cut(&corners, 1), cut(&window, 3), slits[0].clone(), slits[1].clone()]); + let mut lines: Vec = (0..4).map(|k| line(LineKind::Cut, &[corners[k], corners[(k + 1) % 4]], false, 10 + k as u64)).collect(); + for k in 0..4 { + lines.push(line(LineKind::Cut, &[window[k], window[(k + 1) % 4]], false, 3 + k as u64)); + } + lines.extend(slits); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), codes(&want_issues), "{issues:?}"); + assert_eq!((b[0].holes.len(), areas(&b[0])), (want[0].holes.len(), areas(&want[0]))); + assert_eq!(want[0].holes.len(), 1); +} + +#[test] +fn a_slot_drawn_across_the_outline_is_a_notch_not_a_hole() { + let outline = || cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1); + let (b, issues) = check(&[outline(), cut(&[(48.0, -10.0), (52.0, -10.0), (52.0, 20.0), (48.0, 20.0)], 2)]); + assert!(issues.is_empty(), "{issues:?}"); + assert!(b[0].holes.is_empty(), "{:?}", b[0].holes); + let notched = cut(&[(0.0, 0.0), (48.0, 0.0), (48.0, 20.0), (52.0, 20.0), (52.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)], 1); + assert_eq!(areas(&b[0]), areas(&check(std::slice::from_ref(¬ched)).0[0])); + // A crease in the notch lies outside the blank, and one that runs on into it from a panel too. + let slot = || cut(&[(48.0, -10.0), (52.0, -10.0), (52.0, 20.0), (48.0, 20.0)], 2); + let (_, issues) = check(&[outline(), slot(), crease((49.0, 5.0), (51.0, 5.0), 3)]); + assert_eq!(codes(&issues), vec!["outside"], "{issues:?}"); + let (_, issues) = check(&[outline(), slot(), crease((50.0, 5.0), (50.0, 100.0), 3)]); + let (_, want) = check(&[notched, crease((50.0, 5.0), (50.0, 100.0), 3)]); + assert_eq!(codes(&issues), codes(&want), "{issues:?}"); + assert!(codes(&issues).contains(&"outside"), "{issues:?}"); + // A cutout whose top side lies on the outline opens onto the outside directly. + let flush = || cut(&[(48.0, 0.0), (52.0, 0.0), (52.0, 20.0), (48.0, 20.0)], 2); + let (b, issues) = check(&[outline(), flush()]); + assert!(b[0].holes.is_empty() && !codes(&issues).contains(&"ambiguous"), "{:?} {issues:?}", b[0].holes); + let (_, issues) = check(&[outline(), flush(), crease((49.0, 5.0), (51.0, 5.0), 3)]); + assert!(codes(&issues).contains(&"outside") && !codes(&issues).contains(&"ambiguous"), "{issues:?}"); + // A window joined to the outline by a slit stays a hole when a cut across it leaves a sliver. + let window = || cut(&[(40.0, 40.0), (60.0, 40.0), (60.0, 60.0), (40.0, 60.0)], 4); + let slit = || line(LineKind::Cut, &[(40.0, 0.0), (40.0, 40.0)], false, 5); + let (b, _) = check(&[outline(), window(), slit(), line(LineKind::Cut, &[(40.0, 40.004), (60.0, 40.004)], false, 6)]); + assert_eq!(b[0].holes.len(), 1, "{:?}", b[0].holes); + // And a window 0.004 pt below the outline, joined to it at both corners, leaving a sliver. + let near = cut(&[(40.0, 0.004), (60.0, 0.004), (60.0, 20.0), (40.0, 20.0)], 4); + let joins = [line(LineKind::Cut, &[(40.0, 0.0), (40.0, 0.004)], false, 5), line(LineKind::Cut, &[(60.0, 0.0), (60.0, 0.004)], false, 6)]; + let (b, _) = check(&[outline(), near, joins[0].clone(), joins[1].clone()]); + assert_eq!(b[0].holes.len(), 1, "{:?}", b[0].holes); +} + +#[test] +fn many_small_outlines_of_open_lines_fit_the_gap_search() { + // 784 unit squares 3 pt apart, each four open lines, at a tolerance of 0.5 pt. + let mut lines = vec![]; + for i in 0..28u64 { + for j in 0..28u64 { + let (x, y) = (3.0 * i as f64, 3.0 * j as f64); + let c = [(x, y), (x + 1.0, y), (x + 1.0, y + 1.0), (x, y + 1.0)]; + for k in 0..4 { + lines.push(line(LineKind::Cut, &[c[k], c[(k + 1) % 4]], false, 4 * (28 * i + j) + k as u64)); + } + } + } + let (b, issues) = blanks(&lines, 0.5); + assert!(!codes(&issues).contains(&"tooComplex"), "{issues:?}"); + assert_eq!(b.len(), 784); +} + +#[test] +fn thousands_of_cut_lines_on_top_of_each_other_are_too_complex_before_the_gap_search() { + let lines: Vec = (0..3000u64).map(|k| line(LineKind::Cut, &[(0.0, 0.0), (100.0, 0.0)], false, k)).collect(); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["tooComplex"], "{issues:?}"); + assert!(b.is_empty()); +} + +#[test] +fn cut_lines_that_cross_an_outline_of_open_lines_leave_every_cell_material() { + // A 90 pt square whose sides are open lines ending every 30 pt, and four cut lines right across + // it: nine pieces of material, as with a closed outline. + let mut lines = vec![]; + for k in 0..3 { + let (a, b) = (30.0 * k as f64, 30.0 * (k + 1) as f64); + for (i, seg) in [[(a, 0.0), (b, 0.0)], [(90.0, a), (90.0, b)], [(b, 90.0), (a, 90.0)], [(0.0, b), (0.0, a)]].iter().enumerate() { + lines.push(line(LineKind::Cut, seg, false, 10 + 4 * k as u64 + i as u64)); + } + } + let across = [[(30.0, 0.0), (30.0, 90.0)], [(60.0, 0.0), (60.0, 90.0)], [(0.0, 30.0), (90.0, 30.0)], [(0.0, 60.0), (90.0, 60.0)]]; + for (i, seg) in across.iter().enumerate() { + lines.push(line(LineKind::Cut, seg, false, 30 + i as u64)); + } + let mut closed = vec![cut(&[(0.0, 0.0), (90.0, 0.0), (90.0, 90.0), (0.0, 90.0)], 1)]; + closed.extend(lines.iter().skip(12).cloned()); + let (want, want_issues) = check(&closed); + let (b, issues) = check(&lines); + assert_eq!(codes(&issues), codes(&want_issues), "{issues:?}"); + let pieces = |b: &[Blank]| b.iter().map(|x| (x.panels.len(), x.holes.len())).collect::>(); + assert_eq!(pieces(&b), pieces(&want)); + assert_eq!(b.iter().map(|x| x.panels.len()).sum::(), 9); + // With the crossing lines drawn in 30 pt pieces, the four pieces round the middle cell meet end + // to end and count as one closed cut line, whether the outline is closed or drawn in pieces. + let mut split = vec![]; + for (i, seg) in across.iter().enumerate() { + let (a, b) = (seg[0], seg[1]); + for k in 0..3 { + let at = |t: f64| (a.0 + (b.0 - a.0) * t, a.1 + (b.1 - a.1) * t); + split.push(line(LineKind::Cut, &[at(k as f64 / 3.0), at((k + 1) as f64 / 3.0)], false, 40 + 3 * i as u64 + k as u64)); + } + } + let mut closed = vec![cut(&[(0.0, 0.0), (90.0, 0.0), (90.0, 90.0), (0.0, 90.0)], 1)]; + closed.extend(split.iter().cloned()); + let (want, want_issues) = check(&closed); + let mut open: Vec = lines.iter().take(12).cloned().collect(); + open.extend(split); + let (b, issues) = check(&open); + assert_eq!(codes(&issues), codes(&want_issues), "{issues:?}"); + assert_eq!(pieces(&b), pieces(&want)); +} + +#[test] +fn a_curved_crease_is_measured_at_its_farthest_point_from_its_line() { + // A crease from corner to corner of a square: its curve strays about 10.1 pt from the diagonal, + // where samples at quarters of it see 9.8 pt. + let off = 35.0 / 2f64.sqrt(); + let mut bp = BezPath::new(); + bp.move_to(p(0.0, 0.0)); + bp.curve_to(p(10000.0 / 3.0 - off, 10000.0 / 3.0 + off), p(20000.0 / 3.0 + off, 20000.0 / 3.0 - off), p(10000.0, 10000.0)); + let lines = vec![ + cut(&[(0.0, 0.0), (10000.0, 0.0), (10000.0, 10000.0), (0.0, 10000.0)], 1), + FoldLine { path: PathData::from_bezpath(&bp), kind: LineKind::Crease, key: 2 }, + ]; + let (b, issues) = blanks(&lines, 10.0); + assert_eq!(codes(&issues), vec!["notStraight"], "{issues:?}"); + assert_eq!(b[0].hinges.len(), 1); + let (_, issues) = blanks(&lines, 10.5); + assert!(issues.is_empty(), "{issues:?}"); } #[test] @@ -541,6 +685,38 @@ fn lines_on_top_of_each_other_are_reported() { assert_eq!(issues[0].keys, vec![10, 20]); assert_eq!(b[0].hinges.len(), 4); assert_eq!(b[0].hinges.iter().find(|h| h.keys.contains(&20)).map(|h| h.keys.clone()), Some(vec![10, 20])); + + // A perforation over a crease, lines of two kinds that fold. + let mut lines = tray(); + lines.push(line(LineKind::Perforation, &[(130.0, 30.0), (30.0, 30.0)], false, 20)); + let (_, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["duplicate"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![10, 20]); + + // A crease drawn twice outside the blank is reported where it lies as well. + let mut lines = tray(); + lines.push(crease((200.0, 0.0), (250.0, 0.0), 20)); + lines.push(crease((250.0, 0.0), (200.0, 0.0), 21)); + let (_, issues) = check(&lines); + assert_eq!(codes(&issues), vec!["duplicate", "outside", "outside"], "{issues:?}"); + assert_eq!((issues[1].keys.clone(), issues[2].keys.clone()), (vec![20], vec![21])); +} + +#[test] +fn a_crease_that_runs_past_the_outline_is_reported() { + let outline = || cut(&[(0.0, 0.0), (100.0, 0.0), (100.0, 50.0), (0.0, 50.0)], 1); + // 5 pt past the outline at each end: the hinge is built, and the line is reported. + let (b, issues) = check(&[outline(), crease((50.0, -5.0), (50.0, 55.0), 2)]); + assert_eq!(codes(&issues), vec!["outside"], "{issues:?}"); + assert_eq!(issues[0].keys, vec![2]); + assert_eq!(b[0].hinges.len(), 1); + // Past it by less than the tolerance: no issue. + let (b, issues) = check(&[outline(), crease((50.0, -0.05), (50.0, 50.0), 2)]); + assert!(issues.is_empty(), "{issues:?}"); + assert_eq!(b[0].hinges.len(), 1); + // A crease drawn round a sliver inside the blank does not run outside it. + let (_, issues) = check(&[outline(), line(LineKind::Crease, &[(50.0, 10.0), (50.004, 10.0), (50.004, 40.0), (50.0, 40.0)], true, 2)]); + assert!(!codes(&issues).contains(&"outside"), "{issues:?}"); } #[test] @@ -682,15 +858,15 @@ fn lines_in_a_hole_are_ambiguous() { } #[test] -fn partial_cuts_fold_the_other_way_and_a_line_s_own_angle_wins() { +fn partial_cuts_and_perforations_make_hinges_as_creases_do() { let mut lines = tray(); lines[1].kind = LineKind::PartialCut; - lines[2].angle = Some(45.0); lines[3].kind = LineKind::Perforation; let (b, issues) = check(&lines); assert!(issues.is_empty(), "{issues:?}"); - let angle = |key: u64| b[0].hinges.iter().find(|h| h.keys == vec![key]).map(|h| h.angle); - assert_eq!((angle(10), angle(11), angle(12), angle(13)), (Some(-90.0), Some(45.0), Some(90.0), Some(90.0))); + let mut keys: Vec> = b[0].hinges.iter().map(|h| h.keys.clone()).collect(); + keys.sort_unstable(); + assert_eq!(keys, vec![vec![10], vec![11], vec![12], vec![13]]); } #[test] diff --git a/crates/three-d/src/lib.rs b/crates/three-d/src/lib.rs index 01b5c75d9f..f232d265e9 100644 --- a/crates/three-d/src/lib.rs +++ b/crates/three-d/src/lib.rs @@ -4,6 +4,8 @@ //! Open profiles optionally close their circular ends with caps, and a partial sweep its cut sides. Faces are projected and sorted back to front, //! then flat or smoothly shaded with vector gradients. This preview uses a painter's algorithm, not a depth buffer: //! intersecting profiles can have ambiguous visibility and are not solid modelling inputs. +//! +//! [`fold`] finds the panels and hinges of a flat packaging blank from its fold lines. #![forbid(unsafe_code)] pub mod fold; diff --git a/crates/ui-egui/src/addons/packaging.rs b/crates/ui-egui/src/addons/packaging.rs index 1e827a7efc..54f233d945 100644 --- a/crates/ui-egui/src/addons/packaging.rs +++ b/crates/ui-egui/src/addons/packaging.rs @@ -92,7 +92,7 @@ impl Checked { fn summary(&self) -> String { let errors = self.issues.iter().filter(|i| i.error).count(); crate::i18n::fmt( - "Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings}", + "Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings}", &[ ("panels", &self.panels.to_string()), ("hinges", &self.hinges.to_string()), diff --git a/crates/ui-egui/src/addons/packaging/tests.rs b/crates/ui-egui/src/addons/packaging/tests.rs index 808956e4d7..93fbb2b8d2 100644 --- a/crates/ui-egui/src/addons/packaging/tests.rs +++ b/crates/ui-egui/src/addons/packaging/tests.rs @@ -183,10 +183,10 @@ fn check_fold_lines_lists_its_issues_in_the_panel_until_the_document_changes() { assert!(!crate::panel_docking::showing(&app.ui, ID)); menus::invoke(&mut app, CHECK, item.params.clone()); assert!(crate::panel_docking::showing(&app.ui, ID), "the panel opens"); - assert_eq!(app.ui.status, "Panels: 2, creases: 1, errors: 1, warnings: 0"); + assert_eq!(app.ui.status, "Panels: 2, hinges: 1, errors: 1, warnings: 0"); let text = frames(&mut app, &ctx, None); assert!(text.contains("A cut line ends without meeting another cut line."), "{text}"); - assert!(text.contains("Panels: 2, creases: 1, errors: 1, warnings: 0") && text.contains("Select"), "{text}"); + assert!(text.contains("Panels: 2, hinges: 1, errors: 1, warnings: 0") && text.contains("Select"), "{text}"); // Any change to the document takes the list away. app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 5, "height": 5})).unwrap(); let text = frames(&mut app, &ctx, None); @@ -209,7 +209,7 @@ fn the_check_button_checks_and_clicking_an_issue_selects_its_lines() { // A clean blank: no issues. app.run("edit.clear", json!({})).unwrap(); let text = frames(&mut app, &ctx, Some("Check")); - assert!(text.contains("No issues found.") && text.contains("Panels: 2, creases: 1, errors: 0, warnings: 0"), "{text}"); + assert!(text.contains("No issues found.") && text.contains("Panels: 2, hinges: 1, errors: 0, warnings: 0"), "{text}"); } #[test] @@ -220,25 +220,27 @@ fn issues_and_the_summary_show_in_the_interface_language() { let text = frames(&mut app, &ctx, Some(crate::i18n::t("Check"))); crate::i18n::set_current(crate::i18n::Lang::EN); assert!(!text.contains("A cut line ends") && !text.contains("Panels:"), "{text}"); - assert!(text.contains("Schnittlinie") && text.contains('2'), "{text}"); + assert!(text.contains("Eine Schnittlinie endet, ohne auf eine andere Schnittlinie zu treffen."), "{text}"); + assert!(text.contains("Felder: 2, Scharniere: 1, Fehler: 1, Warnungen: 0"), "{text}"); } -/// The messages `addon.packaging.check` gives its issues, one for each code (two for `noCut`). -const ISSUE_MESSAGES: [&str; 16] = [ +/// The messages `addon.packaging.check` gives its issues, one for each code (three for `noCut`). +const ISSUE_MESSAGES: [&str; 17] = [ "No cut lines are in the selection.", "No cut lines are in the document.", + "No cut lines are among the given objects.", "The cut lines do not enclose an area.", "A cut line ends without meeting another cut line.", "A gap between cut lines was closed.", "The fold lines are too complex to check.", "A cut line and a crease lie on top of each other.", - "Two lines of the same role lie on top of each other.", + "Two fold lines lie on top of each other.", "A crease ends inside a panel.", "A crease does not divide two panels.", - "A crease lies outside the cut outline.", - "A crease that is not straight is folded along one straight line.", + "A crease lies outside the cut outline, wholly or in part.", + "The pieces of a hinge are not on one straight line.", "A gap between cut lines is too narrow to tell apart.", - "A cut-out area holds other fold lines.", + "A cut-out area holds other fold lines or another blank.", "A panel is not joined to the rest by a crease.", "A fold line is on a non-printing layer.", ]; @@ -250,7 +252,7 @@ fn every_issue_message_translates_in_every_complete_message_catalog() { "ca", "nl", "da", ] { let lang = crate::i18n::Lang::from_code(code).unwrap(); - for m in ISSUE_MESSAGES.into_iter().chain(["Panels: 3, creases: 2, errors: 1, warnings: 0"]) { + for m in ISSUE_MESSAGES.into_iter().chain(["Panels: 3, hinges: 2, errors: 1, warnings: 0"]) { assert_ne!(crate::i18n::message(lang, m), m, "{code}: {m}"); } } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index ab9ed92de5..7beb9f89eb 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -7093,14 +7093,15 @@ breakText Glyphs Глифи @msg A gap between cut lines was closed. Процеп между линии за рязане беше затворен. @msg The fold lines are too complex to check. Линиите на сгъване са твърде сложни за проверка. @msg A cut line and a crease lie on top of each other. Линия за рязане и линия за биговане лежат една върху друга. -@msg Two lines of the same role lie on top of each other. Две линии от един и същи вид лежат една върху друга. +@msg No cut lines are among the given objects. Сред дадените обекти няма линии за рязане. +@msg Two fold lines lie on top of each other. Две линии на сгъване лежат една върху друга. @msg A crease ends inside a panel. Линия за биговане завършва вътре в панел. @msg A crease does not divide two panels. Линия за биговане не разделя два панела. -@msg A crease lies outside the cut outline. Линия за биговане лежи извън контура за рязане. -@msg A crease that is not straight is folded along one straight line. Линия за биговане, която не е права, се сгъва по една права линия. +@msg A crease lies outside the cut outline, wholly or in part. Линия за биговане лежи изцяло или отчасти извън контура за рязане. +@msg The pieces of a hinge are not on one straight line. Частите на една панта не лежат на една права линия. @msg A gap between cut lines is too narrow to tell apart. Процеп между линии за рязане е твърде тесен, за да се различи. -@msg A cut-out area holds other fold lines. Изрязана област съдържа други линии на сгъване. +@msg A cut-out area holds other fold lines or another blank. Изрязана област съдържа други линии на сгъване или друг разкрой. @msg A panel is not joined to the rest by a crease. Панел не е свързан с останалите с линия за биговане. @msg A fold line is on a non-printing layer. Линия на сгъване е на слой, който не се печата. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, бигове: {hinges}, грешки: {errors}, предупреждения: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, панти: {hinges}, грешки: {errors}, предупреждения: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer трябва да е "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index d6cc94f911..22c2d3b7c7 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -7146,14 +7146,15 @@ shape Open Otvoren @msg A gap between cut lines was closed. Razmak između linija rezanja je zatvoren. @msg The fold lines are too complex to check. Linije savijanja su previše složene za provjeru. @msg A cut line and a crease lie on top of each other. Linija rezanja i linija bigovanja leže jedna preko druge. -@msg Two lines of the same role lie on top of each other. Dvije linije iste vrste leže jedna preko druge. +@msg No cut lines are among the given objects. Među zadanim objektima nema linija rezanja. +@msg Two fold lines lie on top of each other. Dvije linije savijanja leže jedna preko druge. @msg A crease ends inside a panel. Linija bigovanja završava unutar panela. @msg A crease does not divide two panels. Linija bigovanja ne razdvaja dva panela. -@msg A crease lies outside the cut outline. Linija bigovanja leži izvan konture rezanja. -@msg A crease that is not straight is folded along one straight line. Linija bigovanja koja nije ravna savija se duž jedne prave linije. +@msg A crease lies outside the cut outline, wholly or in part. Linija bigovanja leži potpuno ili djelimično izvan konture rezanja. +@msg The pieces of a hinge are not on one straight line. Dijelovi jedne šarke ne leže na jednoj pravoj liniji. @msg A gap between cut lines is too narrow to tell apart. Razmak između linija rezanja je preuzak da bi se razlikovao. -@msg A cut-out area holds other fold lines. Izrezana površina sadrži druge linije savijanja. +@msg A cut-out area holds other fold lines or another blank. Izrezana površina sadrži druge linije savijanja ili drugi kroj. @msg A panel is not joined to the rest by a crease. Panel nije povezan s ostatkom nijednom linijom bigovanja. @msg A fold line is on a non-printing layer. Linija savijanja je na sloju koji se ne štampa. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneli: {panels}, bigovi: {hinges}, greške: {errors}, upozorenja: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneli: {panels}, šarke: {hinges}, greške: {errors}, upozorenja: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer mora biti "singleLine", "everyLine", "standardSingleLine" ili "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 0089095906..683dcc0d93 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7954,14 +7954,15 @@ breakText Glyphs Glifs @msg A gap between cut lines was closed. S’ha tancat un buit entre línies de tall. @msg The fold lines are too complex to check. Les línies de plegat són massa complexes per comprovar-les. @msg A cut line and a crease lie on top of each other. Una línia de tall i una d’hendit estan superposades. -@msg Two lines of the same role lie on top of each other. Dues línies del mateix tipus estan superposades. +@msg No cut lines are among the given objects. No hi ha cap línia de tall entre els objectes indicats. +@msg Two fold lines lie on top of each other. Dues línies de plegat estan superposades. @msg A crease ends inside a panel. Una línia d’hendit acaba dins d’un panell. @msg A crease does not divide two panels. Una línia d’hendit no separa dos panells. -@msg A crease lies outside the cut outline. Una línia d’hendit és fora del contorn de tall. -@msg A crease that is not straight is folded along one straight line. Una línia d’hendit que no és recta es plega al llarg d’una sola línia recta. +@msg A crease lies outside the cut outline, wholly or in part. Una línia d’hendit és fora del contorn de tall, del tot o en part. +@msg The pieces of a hinge are not on one straight line. Els trams d’una frontissa no són en una sola línia recta. @msg A gap between cut lines is too narrow to tell apart. Un buit entre línies de tall és massa estret per distingir-lo. -@msg A cut-out area holds other fold lines. Una àrea retallada conté altres línies de plegat. +@msg A cut-out area holds other fold lines or another blank. Una àrea retallada conté altres línies de plegat o un altre troquelat. @msg A panel is not joined to the rest by a crease. Un panell no està unit a la resta per cap línia d’hendit. @msg A fold line is on a non-printing layer. Una línia de plegat és en una capa que no s’imprimeix. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panells: {panels}, hendits: {hinges}, errors: {errors}, avisos: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panells: {panels}, frontisses: {hinges}, errors: {errors}, avisos: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer ha de ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 299aa6cedc..69e387e26c 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -9751,13 +9751,14 @@ breakText Glyphs Glyfy @msg A gap between cut lines was closed. Mezera mezi liniemi řezu byla uzavřena. @msg The fold lines are too complex to check. Linie skladu jsou příliš složité na kontrolu. @msg A cut line and a crease lie on top of each other. Linie řezu a linie bigu leží přes sebe. -@msg Two lines of the same role lie on top of each other. Dvě linie stejného typu leží přes sebe. +@msg No cut lines are among the given objects. Mezi zadanými objekty nejsou žádné linie řezu. +@msg Two fold lines lie on top of each other. Dvě linie skladu leží přes sebe. @msg A crease ends inside a panel. Linie bigu končí uvnitř panelu. @msg A crease does not divide two panels. Linie bigu nerozděluje dva panely. -@msg A crease lies outside the cut outline. Linie bigu leží mimo obrys řezu. -@msg A crease that is not straight is folded along one straight line. Linie bigu, která není rovná, se ohýbá podél jedné přímky. +@msg A crease lies outside the cut outline, wholly or in part. Linie bigu leží zcela nebo zčásti mimo obrys řezu. +@msg The pieces of a hinge are not on one straight line. Části jednoho pantu neleží na jedné přímce. @msg A gap between cut lines is too narrow to tell apart. Mezera mezi liniemi řezu je příliš úzká na rozlišení. -@msg A cut-out area holds other fold lines. Vyříznutá oblast obsahuje další linie skladu. +@msg A cut-out area holds other fold lines or another blank. Vyříznutá oblast obsahuje další linie skladu nebo jiný přířez. @msg A panel is not joined to the rest by a crease. Panel není se zbytkem spojen žádnou linií bigu. @msg A fold line is on a non-printing layer. Linie skladu je na netisknutelné vrstvě. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panely: {panels}, bigy: {hinges}, chyby: {errors}, upozornění: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panely: {panels}, panty: {hinges}, chyby: {errors}, upozornění: {warnings} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 647596237c..395a2d01c4 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -9853,14 +9853,15 @@ breakText Glyphs Glyffer @msg A gap between cut lines was closed. Et mellemrum mellem skærelinjer blev lukket. @msg The fold lines are too complex to check. Foldelinjerne er for komplekse til at kontrollere. @msg A cut line and a crease lie on top of each other. En skærelinje og en rillelinje ligger oven på hinanden. -@msg Two lines of the same role lie on top of each other. To linjer af samme type ligger oven på hinanden. +@msg No cut lines are among the given objects. Der er ingen skærelinjer blandt de angivne objekter. +@msg Two fold lines lie on top of each other. To foldelinjer ligger oven på hinanden. @msg A crease ends inside a panel. En rillelinje slutter inde i et panel. @msg A crease does not divide two panels. En rillelinje deler ikke to paneler. -@msg A crease lies outside the cut outline. En rillelinje ligger uden for skærekonturen. -@msg A crease that is not straight is folded along one straight line. En rillelinje, der ikke er lige, foldes langs én ret linje. +@msg A crease lies outside the cut outline, wholly or in part. En rillelinje ligger helt eller delvist uden for skærekonturen. +@msg The pieces of a hinge are not on one straight line. Delene af et hængsel ligger ikke på én ret linje. @msg A gap between cut lines is too narrow to tell apart. Et mellemrum mellem skærelinjer er for smalt til at skelne. -@msg A cut-out area holds other fold lines. Et udskåret område indeholder andre foldelinjer. +@msg A cut-out area holds other fold lines or another blank. Et udskåret område indeholder andre foldelinjer eller et andet emne. @msg A panel is not joined to the rest by a crease. Et panel er ikke forbundet med resten af en rillelinje. @msg A fold line is on a non-printing layer. En foldelinje ligger på et lag, der ikke udskrives. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, riller: {hinges}, fejl: {errors}, advarsler: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, hængsler: {hinges}, fejl: {errors}, advarsler: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer skal være "singleLine", "everyLine", "standardSingleLine" eller "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 4be132dc4f..f9df67b2bc 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -9349,13 +9349,14 @@ breakText Glyphs Glyphen @msg A gap between cut lines was closed. Eine Lücke zwischen Schnittlinien wurde geschlossen. @msg The fold lines are too complex to check. Die Faltlinien sind zu komplex für die Prüfung. @msg A cut line and a crease lie on top of each other. Eine Schnittlinie und eine Rilllinie liegen übereinander. -@msg Two lines of the same role lie on top of each other. Zwei Linien derselben Linienart liegen übereinander. +@msg No cut lines are among the given objects. Die angegebenen Objekte enthalten keine Schnittlinien. +@msg Two fold lines lie on top of each other. Zwei Faltlinien liegen übereinander. @msg A crease ends inside a panel. Eine Rilllinie endet innerhalb eines Felds. @msg A crease does not divide two panels. Eine Rilllinie trennt keine zwei Felder. -@msg A crease lies outside the cut outline. Eine Rilllinie liegt außerhalb der Schnittkontur. -@msg A crease that is not straight is folded along one straight line. Eine nicht gerade Rilllinie wird entlang einer geraden Linie gefaltet. +@msg A crease lies outside the cut outline, wholly or in part. Eine Rilllinie liegt ganz oder teilweise außerhalb der Schnittkontur. +@msg The pieces of a hinge are not on one straight line. Die Teile eines Scharniers liegen nicht auf einer geraden Linie. @msg A gap between cut lines is too narrow to tell apart. Eine Lücke zwischen Schnittlinien ist zu schmal, um sie zu unterscheiden. -@msg A cut-out area holds other fold lines. Ein ausgeschnittener Bereich enthält weitere Faltlinien. +@msg A cut-out area holds other fold lines or another blank. Ein ausgeschnittener Bereich enthält weitere Faltlinien oder einen anderen Zuschnitt. @msg A panel is not joined to the rest by a crease. Ein Feld ist durch keine Rilllinie mit den übrigen verbunden. @msg A fold line is on a non-printing layer. Eine Faltlinie liegt auf einer nicht druckbaren Ebene. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Felder: {panels}, Rilllinien: {hinges}, Fehler: {errors}, Warnungen: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Felder: {panels}, Scharniere: {hinges}, Fehler: {errors}, Warnungen: {warnings} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 05c6a32103..b27f4b5867 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7928,14 +7928,15 @@ breakText Glyphs Γλύφοι @msg A gap between cut lines was closed. Ένα κενό ανάμεσα σε γραμμές κοπής κλείστηκε. @msg The fold lines are too complex to check. Οι γραμμές δίπλωσης είναι πολύ σύνθετες για έλεγχο. @msg A cut line and a crease lie on top of each other. Μια γραμμή κοπής και μια γραμμή πτύχωσης βρίσκονται η μία πάνω στην άλλη. -@msg Two lines of the same role lie on top of each other. Δύο γραμμές του ίδιου τύπου βρίσκονται η μία πάνω στην άλλη. +@msg No cut lines are among the given objects. Τα δοσμένα αντικείμενα δεν περιέχουν γραμμές κοπής. +@msg Two fold lines lie on top of each other. Δύο γραμμές δίπλωσης βρίσκονται η μία πάνω στην άλλη. @msg A crease ends inside a panel. Μια γραμμή πτύχωσης τελειώνει μέσα σε ένα πάνελ. @msg A crease does not divide two panels. Μια γραμμή πτύχωσης δεν χωρίζει δύο πάνελ. -@msg A crease lies outside the cut outline. Μια γραμμή πτύχωσης βρίσκεται έξω από το περίγραμμα κοπής. -@msg A crease that is not straight is folded along one straight line. Μια γραμμή πτύχωσης που δεν είναι ευθεία διπλώνεται κατά μήκος μίας ευθείας. +@msg A crease lies outside the cut outline, wholly or in part. Μια γραμμή πτύχωσης βρίσκεται εν όλω ή εν μέρει έξω από το περίγραμμα κοπής. +@msg The pieces of a hinge are not on one straight line. Τα τμήματα ενός μεντεσέ δεν βρίσκονται σε μία ευθεία. @msg A gap between cut lines is too narrow to tell apart. Ένα κενό ανάμεσα σε γραμμές κοπής είναι πολύ στενό για να διακριθεί. -@msg A cut-out area holds other fold lines. Μια αποκομμένη περιοχή περιέχει άλλες γραμμές δίπλωσης. +@msg A cut-out area holds other fold lines or another blank. Μια αποκομμένη περιοχή περιέχει άλλες γραμμές δίπλωσης ή άλλο ανάπτυγμα. @msg A panel is not joined to the rest by a crease. Ένα πάνελ δεν συνδέεται με τα υπόλοιπα με καμία γραμμή πτύχωσης. @msg A fold line is on a non-printing layer. Μια γραμμή δίπλωσης βρίσκεται σε επίπεδο που δεν εκτυπώνεται. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Πάνελ: {panels}, πτυχώσεις: {hinges}, σφάλματα: {errors}, προειδοποιήσεις: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Πάνελ: {panels}, μεντεσέδες: {hinges}, σφάλματα: {errors}, προειδοποιήσεις: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" το composer πρέπει να είναι "singleLine", "everyLine", "standardSingleLine" ή "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 12e483f369..f2f1b14574 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7915,14 +7915,15 @@ breakText Glyphs Glifos @msg A gap between cut lines was closed. Se cerró un hueco entre líneas de corte. @msg The fold lines are too complex to check. Las líneas de plegado son demasiado complejas para comprobarlas. @msg A cut line and a crease lie on top of each other. Una línea de corte y una de hendido están superpuestas. -@msg Two lines of the same role lie on top of each other. Dos líneas del mismo tipo están superpuestas. +@msg No cut lines are among the given objects. No hay líneas de corte entre los objetos indicados. +@msg Two fold lines lie on top of each other. Dos líneas de plegado están superpuestas. @msg A crease ends inside a panel. Una línea de hendido termina dentro de un panel. @msg A crease does not divide two panels. Una línea de hendido no separa dos paneles. -@msg A crease lies outside the cut outline. Una línea de hendido está fuera del contorno de corte. -@msg A crease that is not straight is folded along one straight line. Una línea de hendido que no es recta se pliega a lo largo de una sola línea recta. +@msg A crease lies outside the cut outline, wholly or in part. Una línea de hendido está fuera del contorno de corte, total o parcialmente. +@msg The pieces of a hinge are not on one straight line. Los tramos de una bisagra no están en una sola línea recta. @msg A gap between cut lines is too narrow to tell apart. Un hueco entre líneas de corte es demasiado estrecho para distinguirlo. -@msg A cut-out area holds other fold lines. Un área recortada contiene otras líneas de plegado. +@msg A cut-out area holds other fold lines or another blank. Un área recortada contiene otras líneas de plegado u otro troquelado. @msg A panel is not joined to the rest by a crease. Un panel no está unido al resto por ninguna línea de hendido. @msg A fold line is on a non-printing layer. Una línea de plegado está en una capa que no se imprime. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneles: {panels}, hendidos: {hinges}, errores: {errors}, advertencias: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneles: {panels}, bisagras: {hinges}, errores: {errors}, advertencias: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer debe ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index db6163e7e3..7350f840e6 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -8011,14 +8011,15 @@ breakText Glyphs Merkit @msg A gap between cut lines was closed. Leikkausviivojen välinen rako suljettiin. @msg The fold lines are too complex to check. Taittoviivat ovat liian monimutkaisia tarkistettaviksi. @msg A cut line and a crease lie on top of each other. Leikkausviiva ja nuuttausviiva ovat päällekkäin. -@msg Two lines of the same role lie on top of each other. Kaksi samantyyppistä viivaa on päällekkäin. +@msg No cut lines are among the given objects. Annetuissa objekteissa ei ole leikkausviivoja. +@msg Two fold lines lie on top of each other. Kaksi taittoviivaa on päällekkäin. @msg A crease ends inside a panel. Nuuttausviiva päättyy paneelin sisään. @msg A crease does not divide two panels. Nuuttausviiva ei jaa kahta paneelia. -@msg A crease lies outside the cut outline. Nuuttausviiva on leikkausääriviivan ulkopuolella. -@msg A crease that is not straight is folded along one straight line. Nuuttausviiva, joka ei ole suora, taitetaan yhtä suoraa viivaa pitkin. +@msg A crease lies outside the cut outline, wholly or in part. Nuuttausviiva on kokonaan tai osittain leikkausääriviivan ulkopuolella. +@msg The pieces of a hinge are not on one straight line. Saranan osat eivät ole yhdellä suoralla. @msg A gap between cut lines is too narrow to tell apart. Leikkausviivojen välinen rako on liian kapea erotettavaksi. -@msg A cut-out area holds other fold lines. Leikattu alue sisältää muita taittoviivoja. +@msg A cut-out area holds other fold lines or another blank. Leikattu alue sisältää muita taittoviivoja tai toisen aihion. @msg A panel is not joined to the rest by a crease. Paneelia ei ole liitetty muihin millään nuuttausviivalla. @msg A fold line is on a non-printing layer. Taittoviiva on tasolla, jota ei tulosteta. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneelit: {panels}, nuuttaukset: {hinges}, virheet: {errors}, varoitukset: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneelit: {panels}, saranat: {hinges}, virheet: {errors}, varoitukset: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer on oltava "singleLine", "everyLine", "standardSingleLine" tai "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 7ae0eab9c6..d720f44899 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -9736,14 +9736,15 @@ breakText Glyphs Glyphes @msg A gap between cut lines was closed. Un écart entre des lignes de découpe a été fermé. @msg The fold lines are too complex to check. Les lignes de pliage sont trop complexes pour être vérifiées. @msg A cut line and a crease lie on top of each other. Une ligne de découpe et une ligne de rainage se superposent. -@msg Two lines of the same role lie on top of each other. Deux lignes du même type se superposent. +@msg No cut lines are among the given objects. Les objets indiqués ne contiennent aucune ligne de découpe. +@msg Two fold lines lie on top of each other. Deux lignes de pliage se superposent. @msg A crease ends inside a panel. Une ligne de rainage se termine à l’intérieur d’un panneau. @msg A crease does not divide two panels. Une ligne de rainage ne sépare pas deux panneaux. -@msg A crease lies outside the cut outline. Une ligne de rainage se trouve hors du contour de découpe. -@msg A crease that is not straight is folded along one straight line. Une ligne de rainage qui n’est pas droite est pliée le long d’une seule ligne droite. +@msg A crease lies outside the cut outline, wholly or in part. Une ligne de rainage se trouve en tout ou en partie hors du contour de découpe. +@msg The pieces of a hinge are not on one straight line. Les morceaux d’une charnière ne sont pas sur une seule ligne droite. @msg A gap between cut lines is too narrow to tell apart. Un écart entre des lignes de découpe est trop étroit pour être distingué. -@msg A cut-out area holds other fold lines. Une zone découpée contient d’autres lignes de pliage. +@msg A cut-out area holds other fold lines or another blank. Une zone découpée contient d’autres lignes de pliage ou un autre flan. @msg A panel is not joined to the rest by a crease. Un panneau n’est relié au reste par aucune ligne de rainage. @msg A fold line is on a non-printing layer. Une ligne de pliage se trouve sur un calque non imprimable. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} {panels} panneau(x), {hinges} rainage(s), {errors} erreur(s), {warnings} avertissement(s) +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} {panels} panneau(x), {hinges} charnière(s), {errors} erreur(s), {warnings} avertissement(s) @msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels, c’est trop grand pour le GIF (65535 pixels par côté au plus) : réduisez la résolution diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index d7b10bf7c0..ee792315ff 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4855,16 +4855,17 @@ swatch [Registration] [રજિસ્ટ્રેશન] @msg A gap between cut lines was closed. કટ લાઇન્સ વચ્ચેનો ગેપ બંધ કરવામાં આવ્યો. @msg The fold lines are too complex to check. ફોલ્ડ લાઇન્સ ચેક કરવા માટે ખૂબ જટિલ છે. @msg A cut line and a crease lie on top of each other. એક કટ લાઇન અને એક ક્રીઝ લાઇન એકબીજા પર છે. -@msg Two lines of the same role lie on top of each other. એક જ પ્રકારની બે લાઇન્સ એકબીજા પર છે. +@msg No cut lines are among the given objects. આપેલા ઑબ્જેક્ટ્સમાં કોઈ કટ લાઇન નથી. +@msg Two fold lines lie on top of each other. બે ફોલ્ડ લાઇન્સ એકબીજા પર છે. @msg A crease ends inside a panel. એક ક્રીઝ લાઇન પેનલની અંદર પૂરી થાય છે. @msg A crease does not divide two panels. એક ક્રીઝ લાઇન બે પેનલને અલગ કરતી નથી. -@msg A crease lies outside the cut outline. એક ક્રીઝ લાઇન કટ આઉટલાઇનની બહાર છે. -@msg A crease that is not straight is folded along one straight line. સીધી ન હોય તેવી ક્રીઝ લાઇન એક સીધી લાઇન પર ફોલ્ડ થાય છે. +@msg A crease lies outside the cut outline, wholly or in part. એક ક્રીઝ લાઇન પૂરેપૂરી અથવા આંશિક રીતે કટ આઉટલાઇનની બહાર છે. +@msg The pieces of a hinge are not on one straight line. એક હિન્જના ભાગો એક સીધી લાઇન પર નથી. @msg A gap between cut lines is too narrow to tell apart. કટ લાઇન્સ વચ્ચેનો ગેપ ઓળખવા માટે ખૂબ સાંકડો છે. -@msg A cut-out area holds other fold lines. એક કટ-આઉટ વિસ્તારમાં બીજી ફોલ્ડ લાઇન્સ છે. +@msg A cut-out area holds other fold lines or another blank. એક કટ-આઉટ વિસ્તારમાં બીજી ફોલ્ડ લાઇન્સ અથવા બીજું બ્લેન્ક છે. @msg A panel is not joined to the rest by a crease. એક પેનલ કોઈ ક્રીઝ લાઇનથી બાકીના સાથે જોડાયેલી નથી. @msg A fold line is on a non-printing layer. એક ફોલ્ડ લાઇન નોન-પ્રિન્ટિંગ લેયર પર છે. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} પેનલ: {panels}, ક્રીઝ: {hinges}, ભૂલો: {errors}, ચેતવણીઓ: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} પેનલ: {panels}, હિન્જ: {hinges}, ભૂલો: {errors}, ચેતવણીઓ: {warnings} Middle Eastern & South Asian Single-line Composer સિંગલ-લાઇન કમ્પોઝર (મધ્ય પૂર્વ અને દક્ષિણ એશિયા) Middle Eastern & South Asian Every-line Composer એવરી-લાઇન કમ્પોઝર (મધ્ય પૂર્વ અને દક્ષિણ એશિયા) Standard Single-line Composer સ્ટાન્ડર્ડ સિંગલ-લાઇન કમ્પોઝર diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index f632881023..7398511e77 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -9356,13 +9356,14 @@ theme Appearance अपीयरेंस @msg A gap between cut lines was closed. कट लाइनों के बीच का गैप बंद कर दिया गया। @msg The fold lines are too complex to check. फ़ोल्ड लाइनें चेक करने के लिए बहुत जटिल हैं। @msg A cut line and a crease lie on top of each other. एक कट लाइन और एक क्रीज़ लाइन एक-दूसरे के ऊपर हैं। -@msg Two lines of the same role lie on top of each other. एक ही प्रकार की दो लाइनें एक-दूसरे के ऊपर हैं। +@msg No cut lines are among the given objects. दिए गए ऑब्जेक्ट में कोई कट लाइन नहीं है। +@msg Two fold lines lie on top of each other. दो फ़ोल्ड लाइनें एक-दूसरे के ऊपर हैं। @msg A crease ends inside a panel. एक क्रीज़ लाइन किसी पैनल के अंदर खत्म होती है। @msg A crease does not divide two panels. एक क्रीज़ लाइन दो पैनलों को अलग नहीं करती। -@msg A crease lies outside the cut outline. एक क्रीज़ लाइन कट आउटलाइन के बाहर है। -@msg A crease that is not straight is folded along one straight line. जो क्रीज़ लाइन सीधी नहीं है, वह एक सीधी लाइन पर फ़ोल्ड होती है। +@msg A crease lies outside the cut outline, wholly or in part. एक क्रीज़ लाइन पूरी तरह या आंशिक रूप से कट आउटलाइन के बाहर है। +@msg The pieces of a hinge are not on one straight line. एक हिंज के हिस्से एक सीधी लाइन पर नहीं हैं। @msg A gap between cut lines is too narrow to tell apart. कट लाइनों के बीच का गैप पहचानने के लिए बहुत पतला है। -@msg A cut-out area holds other fold lines. एक कट-आउट एरिया में दूसरी फ़ोल्ड लाइनें हैं। +@msg A cut-out area holds other fold lines or another blank. एक कट-आउट एरिया में दूसरी फ़ोल्ड लाइनें या दूसरा ब्लैंक है। @msg A panel is not joined to the rest by a crease. कोई पैनल किसी क्रीज़ लाइन से बाकी से जुड़ा नहीं है। @msg A fold line is on a non-printing layer. एक फ़ोल्ड लाइन नॉन-प्रिंटिंग लेयर पर है। -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} पैनल: {panels}, क्रीज़: {hinges}, एरर: {errors}, वॉर्निंग: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} पैनल: {panels}, हिंज: {hinges}, एरर: {errors}, वॉर्निंग: {warnings} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 5ecfe58e72..97cac8096b 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -9739,13 +9739,14 @@ breakText Glyphs Glifák @msg A gap between cut lines was closed. A vágóvonalak közötti rés le lett zárva. @msg The fold lines are too complex to check. A hajtásvonalak túl összetettek az ellenőrzéshez. @msg A cut line and a crease lie on top of each other. Egy vágóvonal és egy bigvonal egymáson fekszik. -@msg Two lines of the same role lie on top of each other. Két azonos típusú vonal egymáson fekszik. +@msg No cut lines are among the given objects. A megadott objektumok között nincs vágóvonal. +@msg Two fold lines lie on top of each other. Két hajtásvonal egymáson fekszik. @msg A crease ends inside a panel. Egy bigvonal egy panelen belül ér véget. @msg A crease does not divide two panels. Egy bigvonal nem választ el két panelt. -@msg A crease lies outside the cut outline. Egy bigvonal a vágási körvonalon kívül van. -@msg A crease that is not straight is folded along one straight line. Egy nem egyenes bigvonal egyetlen egyenes mentén hajlik. +@msg A crease lies outside the cut outline, wholly or in part. Egy bigvonal teljesen vagy részben a vágási körvonalon kívül van. +@msg The pieces of a hinge are not on one straight line. Egy zsanér részei nem egy egyenesen vannak. @msg A gap between cut lines is too narrow to tell apart. A vágóvonalak közötti rés túl keskeny a megkülönböztetéshez. -@msg A cut-out area holds other fold lines. Egy kivágott terület további hajtásvonalakat tartalmaz. +@msg A cut-out area holds other fold lines or another blank. Egy kivágott terület további hajtásvonalakat vagy egy másik kiterítéket tartalmaz. @msg A panel is not joined to the rest by a crease. Egy panelt egyetlen bigvonal sem köt a többihez. @msg A fold line is on a non-printing layer. Egy hajtásvonal nem nyomtatható rétegen van. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panelek: {panels}, bigek: {hinges}, hibák: {errors}, figyelmeztetések: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panelek: {panels}, zsanérok: {hinges}, hibák: {errors}, figyelmeztetések: {warnings} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index cd2ad82864..5e7d456bc2 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -7108,14 +7108,15 @@ breakText Glyphs Glif @msg A gap between cut lines was closed. Celah di antara garis potong telah ditutup. @msg The fold lines are too complex to check. Garis lipat terlalu rumit untuk diperiksa. @msg A cut line and a crease lie on top of each other. Sebuah garis potong dan sebuah garis lekuk bertumpuk. -@msg Two lines of the same role lie on top of each other. Dua garis dengan jenis yang sama bertumpuk. +@msg No cut lines are among the given objects. Tidak ada garis potong di antara objek yang diberikan. +@msg Two fold lines lie on top of each other. Dua garis lipat bertumpuk. @msg A crease ends inside a panel. Sebuah garis lekuk berakhir di dalam panel. @msg A crease does not divide two panels. Sebuah garis lekuk tidak membagi dua panel. -@msg A crease lies outside the cut outline. Sebuah garis lekuk berada di luar kontur potong. -@msg A crease that is not straight is folded along one straight line. Garis lekuk yang tidak lurus dilipat di sepanjang satu garis lurus. +@msg A crease lies outside the cut outline, wholly or in part. Sebuah garis lekuk berada seluruhnya atau sebagian di luar kontur potong. +@msg The pieces of a hinge are not on one straight line. Bagian-bagian sebuah engsel tidak berada pada satu garis lurus. @msg A gap between cut lines is too narrow to tell apart. Celah di antara garis potong terlalu sempit untuk dibedakan. -@msg A cut-out area holds other fold lines. Area yang dipotong berisi garis lipat lain. +@msg A cut-out area holds other fold lines or another blank. Area yang dipotong berisi garis lipat lain atau bentangan lain. @msg A panel is not joined to the rest by a crease. Sebuah panel tidak tersambung ke bagian lain oleh garis lekuk apa pun. @msg A fold line is on a non-printing layer. Sebuah garis lipat berada di lapisan yang tidak dicetak. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panel: {panels}, lekuk: {hinges}, galat: {errors}, peringatan: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panel: {panels}, engsel: {hinges}, galat: {errors}, peringatan: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer harus "singleLine", "everyLine", "standardSingleLine", atau "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index b34cf145a7..366a9f6940 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -9383,13 +9383,14 @@ breakText Glyphs Glifi @msg A gap between cut lines was closed. È stato chiuso uno spazio tra linee di taglio. @msg The fold lines are too complex to check. Le linee di piega sono troppo complesse da verificare. @msg A cut line and a crease lie on top of each other. Una linea di taglio e una di cordonatura sono sovrapposte. -@msg Two lines of the same role lie on top of each other. Due linee dello stesso tipo sono sovrapposte. +@msg No cut lines are among the given objects. Tra gli oggetti indicati non ci sono linee di taglio. +@msg Two fold lines lie on top of each other. Due linee di piega sono sovrapposte. @msg A crease ends inside a panel. Una linea di cordonatura termina all’interno di un pannello. @msg A crease does not divide two panels. Una linea di cordonatura non divide due pannelli. -@msg A crease lies outside the cut outline. Una linea di cordonatura si trova fuori dal contorno di taglio. -@msg A crease that is not straight is folded along one straight line. Una linea di cordonatura non diritta viene piegata lungo un’unica linea retta. +@msg A crease lies outside the cut outline, wholly or in part. Una linea di cordonatura si trova del tutto o in parte fuori dal contorno di taglio. +@msg The pieces of a hinge are not on one straight line. I tratti di una cerniera non sono su un’unica linea retta. @msg A gap between cut lines is too narrow to tell apart. Uno spazio tra linee di taglio è troppo stretto per essere distinto. -@msg A cut-out area holds other fold lines. Un’area ritagliata contiene altre linee di piega. +@msg A cut-out area holds other fold lines or another blank. Un’area ritagliata contiene altre linee di piega o un altro fustellato. @msg A panel is not joined to the rest by a crease. Un pannello non è unito al resto da alcuna linea di cordonatura. @msg A fold line is on a non-printing layer. Una linea di piega si trova su un livello non stampabile. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Pannelli: {panels}, cordonature: {hinges}, errori: {errors}, avvisi: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Pannelli: {panels}, cerniere: {hinges}, errori: {errors}, avvisi: {warnings} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index a224dec9f0..70dc053e36 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -9450,13 +9450,14 @@ breakText Glyphs 字形 @msg A gap between cut lines was closed. カット線間の隙間を閉じました。 @msg The fold lines are too complex to check. 折り線が複雑すぎるためチェックできません。 @msg A cut line and a crease lie on top of each other. カット線と筋入れ線が重なっています。 -@msg Two lines of the same role lie on top of each other. 同じ種類の線が 2 本重なっています。 +@msg No cut lines are among the given objects. 指定したオブジェクトにカット線がありません。 +@msg Two fold lines lie on top of each other. 折り線が 2 本重なっています。 @msg A crease ends inside a panel. 筋入れ線がパネルの内側で終わっています。 @msg A crease does not divide two panels. 筋入れ線が 2 つのパネルを分けていません。 -@msg A crease lies outside the cut outline. 筋入れ線がカットの輪郭の外側にあります。 -@msg A crease that is not straight is folded along one straight line. まっすぐでない筋入れ線は 1 本の直線に沿って折られます。 +@msg A crease lies outside the cut outline, wholly or in part. 筋入れ線の全体または一部がカットの輪郭の外側にあります。 +@msg The pieces of a hinge are not on one straight line. ヒンジの各部分が 1 本の直線上にありません。 @msg A gap between cut lines is too narrow to tell apart. カット線間の隙間が狭すぎて区別できません。 -@msg A cut-out area holds other fold lines. 切り抜かれた領域に他の折り線があります。 +@msg A cut-out area holds other fold lines or another blank. 切り抜かれた領域に他の折り線または別の展開図があります。 @msg A panel is not joined to the rest by a crease. パネルがどの筋入れ線でも他とつながっていません。 @msg A fold line is on a non-printing layer. 折り線が印刷しないレイヤーにあります。 -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} パネル: {panels}、筋入れ: {hinges}、エラー: {errors}、警告: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} パネル: {panels}、ヒンジ: {hinges}、エラー: {errors}、警告: {warnings} diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 406a43c301..70016438d2 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -10019,14 +10019,15 @@ font-script Japanese იაპონური @msg A gap between cut lines was closed. ჭრის ხაზებს შორის ღრეჩო დაიხურა. @msg The fold lines are too complex to check. მოკეცვის ხაზები შესამოწმებლად ზედმეტად რთულია. @msg A cut line and a crease lie on top of each other. ჭრის ხაზი და ბიგის ხაზი ერთმანეთზე დევს. -@msg Two lines of the same role lie on top of each other. ერთი ტიპის ორი ხაზი ერთმანეთზე დევს. +@msg No cut lines are among the given objects. მითითებულ ობიექტებში ჭრის ხაზები არ არის. +@msg Two fold lines lie on top of each other. მოკეცვის ორი ხაზი ერთმანეთზე დევს. @msg A crease ends inside a panel. ბიგის ხაზი პანელის შიგნით მთავრდება. @msg A crease does not divide two panels. ბიგის ხაზი ორ პანელს არ ყოფს. -@msg A crease lies outside the cut outline. ბიგის ხაზი ჭრის კონტურის გარეთაა. -@msg A crease that is not straight is folded along one straight line. ბიგის ხაზი, რომელიც სწორი არ არის, ერთი სწორი ხაზის გასწვრივ იკეცება. +@msg A crease lies outside the cut outline, wholly or in part. ბიგის ხაზი მთლიანად ან ნაწილობრივ ჭრის კონტურის გარეთაა. +@msg The pieces of a hinge are not on one straight line. ანჯამის ნაწილები ერთ სწორ ხაზზე არ დევს. @msg A gap between cut lines is too narrow to tell apart. ჭრის ხაზებს შორის ღრეჩო ზედმეტად ვიწროა გასარჩევად. -@msg A cut-out area holds other fold lines. ამოჭრილი არე სხვა მოკეცვის ხაზებს შეიცავს. +@msg A cut-out area holds other fold lines or another blank. ამოჭრილი არე სხვა მოკეცვის ხაზებს ან სხვა ნამზადს შეიცავს. @msg A panel is not joined to the rest by a crease. პანელი დანარჩენს არცერთი ბიგის ხაზით არ უერთდება. @msg A fold line is on a non-printing layer. მოკეცვის ხაზი არასაბეჭდ შრეზეა. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} პანელები: {panels}, ბიგები: {hinges}, შეცდომები: {errors}, გაფრთხილებები: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} პანელები: {panels}, ანჯამები: {hinges}, შეცდომები: {errors}, გაფრთხილებები: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer უნდა იყოს "singleLine", "everyLine", "standardSingleLine" ან "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 219bd8aa76..7b2822cb49 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -9346,13 +9346,14 @@ breakText Glyphs 글리프 @msg A gap between cut lines was closed. 재단선 사이의 틈을 닫았습니다. @msg The fold lines are too complex to check. 접는 선이 너무 복잡해서 검사할 수 없습니다. @msg A cut line and a crease lie on top of each other. 재단선과 오시선이 겹쳐 있습니다. -@msg Two lines of the same role lie on top of each other. 같은 종류의 선 두 개가 겹쳐 있습니다. +@msg No cut lines are among the given objects. 지정한 개체에 재단선이 없습니다. +@msg Two fold lines lie on top of each other. 접는 선 두 개가 겹쳐 있습니다. @msg A crease ends inside a panel. 오시선이 패널 안에서 끝납니다. @msg A crease does not divide two panels. 오시선이 두 패널을 나누지 않습니다. -@msg A crease lies outside the cut outline. 오시선이 재단 윤곽선 밖에 있습니다. -@msg A crease that is not straight is folded along one straight line. 곧지 않은 오시선은 하나의 직선을 따라 접힙니다. +@msg A crease lies outside the cut outline, wholly or in part. 오시선의 전체 또는 일부가 재단 윤곽선 밖에 있습니다. +@msg The pieces of a hinge are not on one straight line. 힌지의 조각들이 한 직선 위에 있지 않습니다. @msg A gap between cut lines is too narrow to tell apart. 재단선 사이의 틈이 너무 좁아 구별할 수 없습니다. -@msg A cut-out area holds other fold lines. 잘라 낸 영역에 다른 접는 선이 있습니다. +@msg A cut-out area holds other fold lines or another blank. 잘라 낸 영역에 다른 접는 선이나 다른 전개도가 있습니다. @msg A panel is not joined to the rest by a crease. 패널이 어떤 오시선으로도 나머지와 연결되어 있지 않습니다. @msg A fold line is on a non-printing layer. 접는 선이 인쇄되지 않는 레이어에 있습니다. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} 패널: {panels}, 오시: {hinges}, 오류: {errors}, 경고: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} 패널: {panels}, 힌지: {hinges}, 오류: {errors}, 경고: {warnings} diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 62c2566f13..4d8b5b3170 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9784,13 +9784,14 @@ breakText Glyphs Glyphs @msg A gap between cut lines was closed. Een opening tussen snijlijnen is gesloten. @msg The fold lines are too complex to check. De vouwlijnen zijn te complex om te controleren. @msg A cut line and a crease lie on top of each other. Een snijlijn en een rillijn liggen over elkaar. -@msg Two lines of the same role lie on top of each other. Twee lijnen van dezelfde soort liggen over elkaar. +@msg No cut lines are among the given objects. De opgegeven objecten bevatten geen snijlijnen. +@msg Two fold lines lie on top of each other. Twee vouwlijnen liggen over elkaar. @msg A crease ends inside a panel. Een rillijn eindigt binnen een paneel. @msg A crease does not divide two panels. Een rillijn verdeelt geen twee panelen. -@msg A crease lies outside the cut outline. Een rillijn ligt buiten de snijcontour. -@msg A crease that is not straight is folded along one straight line. Een rillijn die niet recht is, wordt langs één rechte lijn gevouwen. +@msg A crease lies outside the cut outline, wholly or in part. Een rillijn ligt geheel of gedeeltelijk buiten de snijcontour. +@msg The pieces of a hinge are not on one straight line. De delen van een scharnier liggen niet op één rechte lijn. @msg A gap between cut lines is too narrow to tell apart. Een opening tussen snijlijnen is te smal om te onderscheiden. -@msg A cut-out area holds other fold lines. Een uitgesneden gebied bevat andere vouwlijnen. +@msg A cut-out area holds other fold lines or another blank. Een uitgesneden gebied bevat andere vouwlijnen of een andere uitslag. @msg A panel is not joined to the rest by a crease. Een paneel is door geen rillijn met de rest verbonden. @msg A fold line is on a non-printing layer. Een vouwlijn staat op een laag die niet wordt afgedrukt. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panelen: {panels}, rillijnen: {hinges}, fouten: {errors}, waarschuwingen: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panelen: {panels}, scharnieren: {hinges}, fouten: {errors}, waarschuwingen: {warnings} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 587884f787..22fd391c14 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -9604,13 +9604,14 @@ breakText Glyphs Glify @msg A gap between cut lines was closed. Zamknięto przerwę między liniami cięcia. @msg The fold lines are too complex to check. Linie zgięcia są zbyt złożone, aby je sprawdzić. @msg A cut line and a crease lie on top of each other. Linia cięcia i linia bigowania leżą na sobie. -@msg Two lines of the same role lie on top of each other. Dwie linie tego samego rodzaju leżą na sobie. +@msg No cut lines are among the given objects. Wśród podanych obiektów nie ma linii cięcia. +@msg Two fold lines lie on top of each other. Dwie linie zgięcia leżą na sobie. @msg A crease ends inside a panel. Linia bigowania kończy się wewnątrz panelu. @msg A crease does not divide two panels. Linia bigowania nie rozdziela dwóch paneli. -@msg A crease lies outside the cut outline. Linia bigowania leży poza konturem cięcia. -@msg A crease that is not straight is folded along one straight line. Linia bigowania, która nie jest prosta, jest zginana wzdłuż jednej linii prostej. +@msg A crease lies outside the cut outline, wholly or in part. Linia bigowania leży całkowicie lub częściowo poza konturem cięcia. +@msg The pieces of a hinge are not on one straight line. Części zawiasu nie leżą na jednej linii prostej. @msg A gap between cut lines is too narrow to tell apart. Przerwa między liniami cięcia jest zbyt wąska, aby ją rozróżnić. -@msg A cut-out area holds other fold lines. Wycięty obszar zawiera inne linie zgięcia. +@msg A cut-out area holds other fold lines or another blank. Wycięty obszar zawiera inne linie zgięcia lub inny wykrój. @msg A panel is not joined to the rest by a crease. Panel nie jest połączony z resztą żadną linią bigowania. @msg A fold line is on a non-printing layer. Linia zgięcia znajduje się na warstwie niedrukowanej. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Panele: {panels}, bigi: {hinges}, błędy: {errors}, ostrzeżenia: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panele: {panels}, zawiasy: {hinges}, błędy: {errors}, ostrzeżenia: {warnings} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 4e1f704ec8..3802eda3d0 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -9822,13 +9822,14 @@ swatch Yellow Green Verde-amarelado @msg A gap between cut lines was closed. Uma lacuna entre linhas de corte foi fechada. @msg The fold lines are too complex to check. As linhas de dobra são complexas demais para verificar. @msg A cut line and a crease lie on top of each other. Uma linha de corte e uma de vinco estão sobrepostas. -@msg Two lines of the same role lie on top of each other. Duas linhas do mesmo tipo estão sobrepostas. +@msg No cut lines are among the given objects. Não há linhas de corte entre os objetos indicados. +@msg Two fold lines lie on top of each other. Duas linhas de dobra estão sobrepostas. @msg A crease ends inside a panel. Uma linha de vinco termina dentro de um painel. @msg A crease does not divide two panels. Uma linha de vinco não divide dois painéis. -@msg A crease lies outside the cut outline. Uma linha de vinco está fora do contorno de corte. -@msg A crease that is not straight is folded along one straight line. Uma linha de vinco que não é reta é dobrada ao longo de uma única linha reta. +@msg A crease lies outside the cut outline, wholly or in part. Uma linha de vinco está total ou parcialmente fora do contorno de corte. +@msg The pieces of a hinge are not on one straight line. As partes de uma dobradiça não estão em uma única linha reta. @msg A gap between cut lines is too narrow to tell apart. Uma lacuna entre linhas de corte é estreita demais para ser distinguida. -@msg A cut-out area holds other fold lines. Uma área recortada contém outras linhas de dobra. +@msg A cut-out area holds other fold lines or another blank. Uma área recortada contém outras linhas de dobra ou outra planificação. @msg A panel is not joined to the rest by a crease. Um painel não está unido ao restante por nenhuma linha de vinco. @msg A fold line is on a non-printing layer. Uma linha de dobra está em uma camada não imprimível. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Painéis: {panels}, vincos: {hinges}, erros: {errors}, avisos: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Painéis: {panels}, dobradiças: {hinges}, erros: {errors}, avisos: {warnings} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 2c6dec01d4..dae5c2fb75 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -9843,15 +9843,16 @@ shape Open Открытый @msg A gap between cut lines was closed. Зазор между линиями реза закрыт. @msg The fold lines are too complex to check. Линии сгиба слишком сложны для проверки. @msg A cut line and a crease lie on top of each other. Линия реза и линия биговки лежат друг на друге. -@msg Two lines of the same role lie on top of each other. Две линии одного типа лежат друг на друге. +@msg No cut lines are among the given objects. Среди указанных объектов нет линий реза. +@msg Two fold lines lie on top of each other. Две линии сгиба лежат друг на друге. @msg A crease ends inside a panel. Линия биговки заканчивается внутри панели. @msg A crease does not divide two panels. Линия биговки не разделяет две панели. -@msg A crease lies outside the cut outline. Линия биговки лежит за пределами контура реза. -@msg A crease that is not straight is folded along one straight line. Непрямая линия биговки сгибается по одной прямой. +@msg A crease lies outside the cut outline, wholly or in part. Линия биговки целиком или частично лежит за пределами контура реза. +@msg The pieces of a hinge are not on one straight line. Части шарнира не лежат на одной прямой. @msg A gap between cut lines is too narrow to tell apart. Зазор между линиями реза слишком узок, чтобы его различить. -@msg A cut-out area holds other fold lines. Вырезанная область содержит другие линии сгиба. +@msg A cut-out area holds other fold lines or another blank. Вырезанная область содержит другие линии сгиба или другую развёртку. @msg A panel is not joined to the rest by a crease. Панель не соединена с остальными ни одной линией биговки. @msg A fold line is on a non-printing layer. Линия сгиба находится на непечатаемом слое. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, биговки: {hinges}, ошибки: {errors}, предупреждения: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, шарниры: {hinges}, ошибки: {errors}, предупреждения: {warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} пикселей — слишком большой размер для PSD (не более {MAX_SIDE} пикселей по стороне): уменьшите разрешение @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer должен быть "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index c0ac175345..dd66fc3bee 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -9434,14 +9434,15 @@ digits Hindi Hindi @msg A gap between cut lines was closed. Ett mellanrum mellan skärlinjer stängdes. @msg The fold lines are too complex to check. Falslinjerna är för komplexa för att kontrollera. @msg A cut line and a crease lie on top of each other. En skärlinje och en biglinje ligger ovanpå varandra. -@msg Two lines of the same role lie on top of each other. Två linjer av samma typ ligger ovanpå varandra. +@msg No cut lines are among the given objects. Det finns inga skärlinjer bland de angivna objekten. +@msg Two fold lines lie on top of each other. Två falslinjer ligger ovanpå varandra. @msg A crease ends inside a panel. En biglinje slutar inuti en panel. @msg A crease does not divide two panels. En biglinje delar inte två paneler. -@msg A crease lies outside the cut outline. En biglinje ligger utanför skärkonturen. -@msg A crease that is not straight is folded along one straight line. En biglinje som inte är rak falsas längs en rak linje. +@msg A crease lies outside the cut outline, wholly or in part. En biglinje ligger helt eller delvis utanför skärkonturen. +@msg The pieces of a hinge are not on one straight line. Delarna av ett gångjärn ligger inte på en rak linje. @msg A gap between cut lines is too narrow to tell apart. Ett mellanrum mellan skärlinjer är för smalt för att skilja ut. -@msg A cut-out area holds other fold lines. Ett utskuret område innehåller andra falslinjer. +@msg A cut-out area holds other fold lines or another blank. Ett utskuret område innehåller andra falslinjer eller ett annat ämne. @msg A panel is not joined to the rest by a crease. En panel är inte förbunden med resten av någon biglinje. @msg A fold line is on a non-printing layer. En falslinje ligger på ett lager som inte skrivs ut. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, bigningar: {hinges}, fel: {errors}, varningar: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, gångjärn: {hinges}, fel: {errors}, varningar: {warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixlar är för stort för PSD (högst {MAX_SIDE} pixlar per sida): sänk upplösningen diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 6dded8c1d7..72c2146903 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9705,13 +9705,14 @@ breakText Glyphs Glifler @msg A gap between cut lines was closed. Kesim çizgileri arasındaki bir boşluk kapatıldı. @msg The fold lines are too complex to check. Katlama çizgileri denetlenemeyecek kadar karmaşık. @msg A cut line and a crease lie on top of each other. Bir kesim çizgisi ile bir pilyaj çizgisi üst üste. -@msg Two lines of the same role lie on top of each other. Aynı türden iki çizgi üst üste. +@msg No cut lines are among the given objects. Belirtilen nesneler arasında kesim çizgisi yok. +@msg Two fold lines lie on top of each other. İki katlama çizgisi üst üste. @msg A crease ends inside a panel. Bir pilyaj çizgisi bir panelin içinde bitiyor. @msg A crease does not divide two panels. Bir pilyaj çizgisi iki paneli ayırmıyor. -@msg A crease lies outside the cut outline. Bir pilyaj çizgisi kesim konturunun dışında. -@msg A crease that is not straight is folded along one straight line. Düz olmayan bir pilyaj çizgisi tek bir düz çizgi boyunca katlanır. +@msg A crease lies outside the cut outline, wholly or in part. Bir pilyaj çizgisi tamamen veya kısmen kesim konturunun dışında. +@msg The pieces of a hinge are not on one straight line. Bir menteşenin parçaları tek bir düz çizgi üzerinde değil. @msg A gap between cut lines is too narrow to tell apart. Kesim çizgileri arasındaki bir boşluk ayırt edilemeyecek kadar dar. -@msg A cut-out area holds other fold lines. Kesilip çıkarılmış bir alan başka katlama çizgileri içeriyor. +@msg A cut-out area holds other fold lines or another blank. Kesilip çıkarılmış bir alan başka katlama çizgileri veya başka bir açınım içeriyor. @msg A panel is not joined to the rest by a crease. Bir panel geri kalanlara hiçbir pilyaj çizgisiyle bağlı değil. @msg A fold line is on a non-printing layer. Bir katlama çizgisi yazdırılmayan bir katmanda. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Paneller: {panels}, pilyajlar: {hinges}, hatalar: {errors}, uyarılar: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneller: {panels}, menteşeler: {hinges}, hatalar: {errors}, uyarılar: {warnings} diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 84eb22f968..912ae3ac65 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -9358,13 +9358,14 @@ breakText Glyphs Гліфи @msg A gap between cut lines was closed. Зазор між лініями різу закрито. @msg The fold lines are too complex to check. Лінії згину надто складні для перевірки. @msg A cut line and a crease lie on top of each other. Лінія різу та лінія біговки лежать одна на одній. -@msg Two lines of the same role lie on top of each other. Дві лінії одного типу лежать одна на одній. +@msg No cut lines are among the given objects. Серед указаних об’єктів немає ліній різу. +@msg Two fold lines lie on top of each other. Дві лінії згину лежать одна на одній. @msg A crease ends inside a panel. Лінія біговки закінчується всередині панелі. @msg A crease does not divide two panels. Лінія біговки не розділяє двох панелей. -@msg A crease lies outside the cut outline. Лінія біговки лежить поза контуром різу. -@msg A crease that is not straight is folded along one straight line. Непряма лінія біговки згинається вздовж однієї прямої. +@msg A crease lies outside the cut outline, wholly or in part. Лінія біговки повністю або частково лежить поза контуром різу. +@msg The pieces of a hinge are not on one straight line. Частини шарніра не лежать на одній прямій. @msg A gap between cut lines is too narrow to tell apart. Зазор між лініями різу надто вузький, щоб його розрізнити. -@msg A cut-out area holds other fold lines. Вирізана область містить інші лінії згину. +@msg A cut-out area holds other fold lines or another blank. Вирізана область містить інші лінії згину або іншу розгортку. @msg A panel is not joined to the rest by a crease. Панель не з’єднана з рештою жодною лінією біговки. @msg A fold line is on a non-printing layer. Лінія згину лежить на шарі, що не друкується. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Панелі: {panels}, біговки: {hinges}, помилки: {errors}, попередження: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Панелі: {panels}, шарніри: {hinges}, помилки: {errors}, попередження: {warnings} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 00ac3f7289..8edb621949 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7468,16 +7468,17 @@ breakText Glyphs Glyph @msg A gap between cut lines was closed. Đã đóng một khe hở giữa các đường cắt. @msg The fold lines are too complex to check. Các đường gấp quá phức tạp để kiểm tra. @msg A cut line and a crease lie on top of each other. Một đường cắt và một đường cấn nằm chồng lên nhau. -@msg Two lines of the same role lie on top of each other. Hai đường cùng loại nằm chồng lên nhau. +@msg No cut lines are among the given objects. Các đối tượng đã chỉ định không có đường cắt nào. +@msg Two fold lines lie on top of each other. Hai đường gấp nằm chồng lên nhau. @msg A crease ends inside a panel. Một đường cấn kết thúc bên trong một mặt. @msg A crease does not divide two panels. Một đường cấn không chia tách hai mặt. -@msg A crease lies outside the cut outline. Một đường cấn nằm ngoài đường viền cắt. -@msg A crease that is not straight is folded along one straight line. Đường cấn không thẳng được gấp theo một đường thẳng. +@msg A crease lies outside the cut outline, wholly or in part. Một đường cấn nằm hoàn toàn hoặc một phần ngoài đường viền cắt. +@msg The pieces of a hinge are not on one straight line. Các đoạn của một bản lề không nằm trên một đường thẳng. @msg A gap between cut lines is too narrow to tell apart. Khe hở giữa các đường cắt quá hẹp để phân biệt. -@msg A cut-out area holds other fold lines. Một vùng bị cắt bỏ chứa các đường gấp khác. +@msg A cut-out area holds other fold lines or another blank. Một vùng bị cắt bỏ chứa các đường gấp khác hoặc một khuôn trải khác. @msg A panel is not joined to the rest by a crease. Một mặt không được nối với phần còn lại bằng đường cấn nào. @msg A fold line is on a non-printing layer. Một đường gấp nằm trên lớp không in. -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} Mặt: {panels}, đường cấn: {hinges}, lỗi: {errors}, cảnh báo: {warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Mặt: {panels}, bản lề: {hinges}, lỗi: {errors}, cảnh báo: {warnings} # Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. @msg 3D effects require finite coordinates within 100 million points Hiệu ứng 3D yêu cầu tọa độ hữu hạn trong phạm vi 100 triệu điểm diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 40f821ffe4..c6b454a593 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -9589,14 +9589,15 @@ breakText Glyphs 字形 @msg A gap between cut lines was closed. 已闭合切割线之间的间隙。 @msg The fold lines are too complex to check. 折线过于复杂,无法检查。 @msg A cut line and a crease lie on top of each other. 一条切割线与一条压痕线重叠。 -@msg Two lines of the same role lie on top of each other. 两条同类线条重叠。 +@msg No cut lines are among the given objects. 指定的对象中没有切割线。 +@msg Two fold lines lie on top of each other. 两条折线重叠。 @msg A crease ends inside a panel. 一条压痕线在面板内部结束。 @msg A crease does not divide two panels. 一条压痕线没有分隔两个面板。 -@msg A crease lies outside the cut outline. 一条压痕线位于切割轮廓之外。 -@msg A crease that is not straight is folded along one straight line. 不直的压痕线沿一条直线折叠。 +@msg A crease lies outside the cut outline, wholly or in part. 一条压痕线全部或部分位于切割轮廓之外。 +@msg The pieces of a hinge are not on one straight line. 铰链的各段不在一条直线上。 @msg A gap between cut lines is too narrow to tell apart. 切割线之间的间隙太窄,无法区分。 -@msg A cut-out area holds other fold lines. 一个镂空区域包含其他折线。 +@msg A cut-out area holds other fold lines or another blank. 一个镂空区域包含其他折线或另一个展开图。 @msg A panel is not joined to the rest by a crease. 一个面板没有通过任何压痕线与其余部分相连。 @msg A fold line is on a non-printing layer. 一条折线位于不打印的图层上。 -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},压痕:{hinges},错误:{errors},警告:{warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},铰链:{hinges},错误:{errors},警告:{warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} 像素对 PSD 而言过大 (每边最多 {MAX_SIDE} 像素):请降低分辨率 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 434723a718..576eea439e 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -9399,14 +9399,15 @@ breakText Glyphs 字符 @msg A gap between cut lines was closed. 已封閉切割線之間的間隙。 @msg The fold lines are too complex to check. 摺線過於複雜,無法檢查。 @msg A cut line and a crease lie on top of each other. 一條切割線與一條壓痕線重疊。 -@msg Two lines of the same role lie on top of each other. 兩條同類線條重疊。 +@msg No cut lines are among the given objects. 指定的物件中沒有切割線。 +@msg Two fold lines lie on top of each other. 兩條摺線重疊。 @msg A crease ends inside a panel. 一條壓痕線在面板內部結束。 @msg A crease does not divide two panels. 一條壓痕線沒有分隔兩個面板。 -@msg A crease lies outside the cut outline. 一條壓痕線位於切割輪廓之外。 -@msg A crease that is not straight is folded along one straight line. 不直的壓痕線沿一條直線摺疊。 +@msg A crease lies outside the cut outline, wholly or in part. 一條壓痕線全部或部分位於切割輪廓之外。 +@msg The pieces of a hinge are not on one straight line. 鉸鏈的各段不在一條直線上。 @msg A gap between cut lines is too narrow to tell apart. 切割線之間的間隙太窄,無法區分。 -@msg A cut-out area holds other fold lines. 一個鏤空區域包含其他摺線。 +@msg A cut-out area holds other fold lines or another blank. 一個鏤空區域包含其他摺線或另一個展開圖。 @msg A panel is not joined to the rest by a crease. 一個面板沒有透過任何壓痕線與其餘部分相連。 @msg A fold line is on a non-printing layer. 一條摺線位於不列印的圖層上。 -@msg Panels: {panels}, creases: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},壓痕:{hinges},錯誤:{errors},警告:{warnings} +@msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},鉸鏈:{hinges},錯誤:{errors},警告:{warnings} @msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} 會列印在超過 {MAX_TILES} 個拼貼上:請縮小 diff --git a/docs/mcp.md b/docs/mcp.md index e552ec49b7..97e4907ea6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -13087,8 +13087,8 @@ panel's menu opens it as Role Swatches…. `addon.packaging.check` (`{ids?, select?: false, tolerance?: 0.1}`) finds the blanks, panels and hinges that the fold lines make and lists what is wrong with them. It checks the fold lines among the objects (the selection by default), -through groups and clip groups, or every fold line of the document that is shown while nothing is selected and `ids` is -left out. `tolerance` is in points, from 0.01 to 10; a value outside that range, or one that is not a number or a length +through groups and clip groups, or every fold line of the document while nothing is selected and `ids` is left out. +Hidden lines are left out in every case, also inside a selected group. `tolerance` is in points, from 0.01 to 10; a value outside that range, or one that is not a number or a length such as `"2 mm"`, is an error. The command does not change the document and records no undo step. - Cut lines bound the material. Each connected piece of cut lines that encloses material is one blank. Its outline is its @@ -13105,17 +13105,17 @@ warnings. | Code | Reported when | |---|---| -| `noCut` | No cut line is among the objects. | +| `noCut` | No cut line is among the objects. The message names the selection, the objects `ids` gives, or the document. | | `open` | The cut lines enclose no area. | | `looseEnd` | An end of a cut line meets no other fold line within `tolerance`, and no gap is closed at it. `at` is the end. | | `gap` | An end of a cut line lies within `tolerance` of another cut line without touching it; the panels are built with the gap closed. `at` is the end. | | `tooComplex` | The lines have more than 65,536 segments, or a blank has more than 256 panels. | | `cutOverCrease` | A cut line and a crease, partial cut or perforation lie on top of each other. | -| `duplicate` | Two lines of the same role, or two subpaths of one line, lie on top of each other. | +| `duplicate` | Two cut lines, two crease, partial cut or perforation lines (of the same role or not), or two subpaths of one line, lie on top of each other. | | `danglingCrease` | A crease ends inside a panel. | | `noSplit` | A crease divides no two panels. | -| `outside` | A crease lies outside every blank. | -| `notStraight` | The pieces of a hinge are not on one straight line within `tolerance`; it folds along the line through its longest piece. | +| `outside` | A crease lies outside every blank, or runs outside it for `tolerance` or more. | +| `notStraight` | The pieces of a hinge are not on one straight line within `tolerance`. | | `sliver` | A gap between lines inside a blank is narrower than 0.01 pt. | | `ambiguous` | A hole holds creases, or a blank lies inside another blank's hole. | | `loosePanel` | A panel is joined to its blank's largest panel by no chain of hinges. | @@ -13125,7 +13125,7 @@ Result: `{ok, blanks, panels, hinges, holes, issues: [{severity, code, message, no issue is an error. `message` is in English, and the Fold Lines panel shows it in the interface language. `ids` names the objects each issue is about. With `select: true`, those objects become the selection; when no issue names an object, the selection stays as it is. The Fold Lines panel's Check button runs the same check, shows a summary line -(panels, creases, errors and warnings) and lists the issues; clicking an issue or its Select button selects its objects. +(panels, hinges, errors and warnings) and lists the issues; clicking an issue or its Select button selects its objects. The list is shown until the document changes. ```json