diff --git a/.claude/skills/orca-translations/SKILL.md b/.claude/skills/orca-translations/SKILL.md index ea2932fb27..ef0eae504d 100644 --- a/.claude/skills/orca-translations/SKILL.md +++ b/.claude/skills/orca-translations/SKILL.md @@ -1,6 +1,6 @@ --- name: orca-translations -description: Use when updating, filling, reviewing or fixing OrcaSlicer translations in localization/i18n — running scripts/run_gettext --full, translating empty or new msgids in the .po catalogs, AI translation passes and their "# AI Translated" / "# Needs human review" comments, plural forms, msgctxt homonyms, and keeping catalogs consistent with the localization glossary (OrcaSlicer_WIKI localization_glossary.tsv), including adding new glossary terms. Also use for msgfmt or run_gettext failures, placeholder or line-break mismatches, and reviewing a translation PR against the glossary. +description: Use when updating, filling, reviewing or fixing OrcaSlicer translations in localization/i18n — running scripts/run_gettext --full, translating empty or new msgids in the .po catalogs, AI translation passes and their "# AI Translated" / "# Needs human review" comments, plural forms, msgctxt homonyms, and keeping catalogs consistent with the localization glossary (OrcaSlicer_WIKI developer_reference/glossary), including adding new glossary terms. Also use for msgfmt or run_gettext failures, placeholder or line-break mismatches, and reviewing a translation PR against the glossary. --- # OrcaSlicer translations @@ -9,7 +9,7 @@ The UI strings live in gettext catalogs: `localization/i18n/OrcaSlicer.pot` is t `localization/i18n//OrcaSlicer_.po` holds each language. The `en` catalog is empty on purpose, so skip it. Recurring terms are fixed by the [localization glossary](https://github.com/OrcaSlicer/OrcaSlicer_WIKI/blob/main/developer_reference/localization_glossary.md), -whose source is `developer_reference/localization_glossary.tsv` in the **OrcaSlicer_WIKI** repository. +whose source is the per-language files in `developer_reference/glossary/` (`terms.tsv`, `languages.txt` and one `.tsv`) in the **OrcaSlicer_WIKI** repository. A translation pass therefore touches two repositories: the catalogs here, and the glossary there. All catalog editing goes through [`scripts/po_tool.py`](scripts/po_tool.py) (standard library only). @@ -153,7 +153,7 @@ Report: - anything left empty, and why; - the glossary rows added or filled. -The catalogs (and `OrcaSlicer.pot`) and the glossary (`localization_glossary.tsv` and `.md`) are +The catalogs (and `OrcaSlicer.pot`) and the glossary (`developer_reference/glossary/*.tsv` and `localization_glossary.md`) are separate changes in separate repositories. The wiki change should land with, or before, the catalog change. Commit or open PRs only when asked. @@ -210,7 +210,7 @@ with the translators, followed by the catalogs. When this skill and the checkouts disagree, the checkouts win: - `scripts/run_gettext.sh` / `.bat` for extraction and merging; - `localization/i18n/list.txt` for the scanned sources; -- the wiki's `localization_guide.md` and `localization_glossary.md` / `.tsv` for the rules and terms; +- the wiki's `localization_guide.md` and `localization_glossary.md` and `glossary/*.tsv` for the rules and terms; - `AGENTS.md` (Localization & translations) for the repository's conventions. ## Editing this skill diff --git a/.claude/skills/orca-translations/scripts/po_tool.py b/.claude/skills/orca-translations/scripts/po_tool.py index 218eaf3db7..e8ca2e5b7a 100644 --- a/.claude/skills/orca-translations/scripts/po_tool.py +++ b/.claude/skills/orca-translations/scripts/po_tool.py @@ -28,13 +28,14 @@ import sys import tempfile import time import unicodedata +import urllib.error import urllib.request from pathlib import Path REPO = Path(__file__).resolve().parents[4] I18N = REPO / "localization" / "i18n" SKIP_LANGS = {"en"} # the English catalog is intentionally empty -GLOSSARY_TSV = Path("developer_reference") / "localization_glossary.tsv" +GLOSSARY_DIR = Path("developer_reference") / "glossary" # terms.tsv, languages.txt and one .tsv per language GLOSSARY_MD = Path("developer_reference") / "localization_glossary.md" MISSING = {"", "—"} RAW_URL = "https://raw.githubusercontent.com/OrcaSlicer/OrcaSlicer_WIKI/main/" @@ -252,30 +253,40 @@ def all_langs(): def find_wiki(arg): for cand in [arg, os.environ.get("ORCA_WIKI_DIR"), REPO.parent / "OrcaSlicer_WIKI", REPO.parent / "OrcaSlicer.wiki"]: - if cand and (Path(cand) / GLOSSARY_TSV).exists(): + if cand and (Path(cand) / GLOSSARY_DIR / "terms.tsv").exists(): return Path(cand) return None -def _download(rel): - cache = Path(tempfile.gettempdir()) / ("orca_glossary_" + rel.name) +def _download(rel, required=True): + cache = Path(tempfile.gettempdir()) / "orca_glossary" / rel if not cache.exists() or time.time() - cache.stat().st_mtime > 3600: - with urllib.request.urlopen(RAW_URL + rel.as_posix(), timeout=30) as r: - cache.write_bytes(r.read()) + try: + with urllib.request.urlopen(RAW_URL + rel.as_posix(), timeout=30) as r: + data = r.read() + except urllib.error.HTTPError: + if required: + raise + return None + cache.parent.mkdir(parents=True, exist_ok=True) + cache.write_bytes(data) return cache class Glossary: - def __init__(self, wiki_arg=None, quiet=False): + """The glossary: rows of [English, Description, ].""" + + def __init__(self, wiki_arg=None, quiet=False, langs=None): self.wiki = find_wiki(wiki_arg) + self.langs = langs # only these languages' files are read (and downloaded); None means all if self.wiki: - self.tsv, self.md = self.wiki / GLOSSARY_TSV, self.wiki / GLOSSARY_MD + self.dir, self.md = self.wiki / GLOSSARY_DIR, self.wiki / GLOSSARY_MD if not quiet: self.report_clone_state() else: if not quiet: print("note: no OrcaSlicer_WIKI clone found; using the published glossary read-only", file=sys.stderr) - self.tsv, self.md = _download(GLOSSARY_TSV), _download(GLOSSARY_MD) + self.dir, self.md = _download(GLOSSARY_DIR / "terms.tsv").parent, _download(GLOSSARY_MD) self.load() def report_clone_state(self): @@ -290,11 +301,23 @@ class Glossary: if behind and behind != "0": print(f"note: the wiki clone is {behind} commits behind origin/main (as of its last fetch)", file=sys.stderr) + def _read(self, name, required=True): + path = self.dir / name if self.wiki else _download(GLOSSARY_DIR / name, required) + return path.read_text(encoding="utf-8-sig").splitlines() if path and path.exists() else None + def load(self): - rows = [l.split("\t") for l in self.tsv.read_text(encoding="utf-8-sig").splitlines() if l.strip()] - self.header = rows[0] - # "—" marks a language with no established rendering yet - self.rows = [[c if c.strip() not in MISSING else "" for c in r] + [""] * (len(rows[0]) - len(r)) for r in rows[1:]] + terms = [l.split(" ") for l in self._read("terms.tsv")[1:] if l.strip()] + langs = [l.strip() for l in self._read("languages.txt") if l.strip()] + langs = [l for l in langs if self.langs is None or l in self.langs] + self.header = ["English", "Description"] + langs + self.rows = [[r[0], r[1] if len(r) > 1 else ""] + [""] * len(langs) for r in terms] + index = {r[0]: r for r in self.rows} + for col, lang in enumerate(langs, start=2): + for line in (self._read(f"{lang}.tsv", required=False) or [])[1:]: + cells = line.split(" ") + # "—" marks a language with no established rendering yet + if len(cells) > 2 and cells[0] in index and cells[2].strip() not in MISSING: + index[cells[0]][col] = cells[2].strip() self.matchers = [] for row in self.rows: base = re.sub(r"\s*\([^)]*\)\s*$", "", row[0]).strip() @@ -494,7 +517,7 @@ def similar_entries(c, e, pool, cutoff=0.72): def cmd_pending(a): c = Catalog(catalog_path(a.lang)) - g = Glossary(a.wiki) + g = Glossary(a.wiki, langs=[a.lang]) todo = [e for e in c.active() if needs_translation(e, c.nplurals, a.include_fuzzy)] batch = todo[a.offset:a.offset + a.limit] if a.limit else todo[a.offset:] pool = [(x.msgid, x.msgstrs()[0], x.obsolete) for x in c.entries @@ -533,7 +556,7 @@ def cmd_pending(a): def cmd_apply(a): c = Catalog(catalog_path(a.lang)) - g = None if a.no_glossary else Glossary(a.wiki, quiet=True) + g = None if a.no_glossary else Glossary(a.wiki, quiet=True, langs=[a.lang]) data = json.loads(Path(a.input).read_text(encoding="utf-8")) items = data["entries"] if isinstance(data, dict) else data idx = c.index() @@ -588,7 +611,7 @@ def find_msgfmt(): def cmd_check(a): - g = None if a.no_glossary else Glossary(a.wiki, quiet=True) + g = None if a.no_glossary else Glossary(a.wiki, quiet=True, langs=a.lang or None) msgfmt = find_msgfmt() status = 0 for lang in a.lang or all_langs(): @@ -646,7 +669,7 @@ def cmd_lookup(a): def cmd_glossary(a): - g = Glossary(a.wiki) + g = Glossary(a.wiki, langs=[a.lang]) col = g.column(a.lang) if col is None: print(f"'{a.lang}' has no glossary column yet; add one with glossary-set --set {a.lang}=...") @@ -733,6 +756,17 @@ def cmd_candidates(a): print(f"{cnt:7} {langs:6} {text}{' [label]' if k in labels else ''} e.g. {ex[:70]}{'…' if len(ex) > 70 else ''}") +def _edit_tsv(path, edit): + """Apply edit(lines) to a glossary TSV, keeping its BOM and line endings.""" + data = path.read_bytes() + bom = data.startswith(b"\xef\xbb\xbf") + text = data.decode("utf-8-sig") + nl = "\r\n" if "\r\n" in text else "\n" + lines = text.splitlines() + edit(lines) + path.write_bytes((b"\xef\xbb\xbf" if bom else b"") + (nl.join(lines) + nl).encode("utf-8")) + + def cmd_glossary_set(a): wiki = find_wiki(a.wiki) if not wiki: @@ -741,8 +775,21 @@ def cmd_glossary_set(a): f" {a.term}: " + ", ".join(a.set) + "\n" "Clone https://github.com/OrcaSlicer/OrcaSlicer_WIKI next to this repository, or pass --wiki.", file=sys.stderr) return 2 - tsv = wiki / GLOSSARY_TSV - lock = tsv.with_suffix(".lock") + gdir = wiki / GLOSSARY_DIR + gen = wiki / "generate_glossary.py" + if not gen.exists(): + sys.exit(f"{gen} not found") + run_gen = lambda *args: subprocess.run([sys.executable, str(gen), *args], cwd=wiki, capture_output=True, text=True) + langs = [l.strip() for l in (gdir / "languages.txt").read_text(encoding="utf-8-sig").splitlines() if l.strip()] + values = {} + for s in a.set: + lang, _, val = s.partition("=") + if lang not in langs: + sys.exit(f"no glossary language '{lang}' (add it to {GLOSSARY_DIR.as_posix()}/languages.txt)") + if "\t" in val or "\n" in val: + sys.exit("values cannot contain tabs or line breaks") + values[lang] = val.strip() + lock = gdir / ".lock" for _ in range(100): try: fd = os.open(lock, os.O_CREAT | os.O_EXCL) @@ -752,50 +799,51 @@ def cmd_glossary_set(a): else: sys.exit(f"could not lock {lock}; remove it if no other run is active") try: - data = tsv.read_bytes() - bom = data.startswith(b"\xef\xbb\xbf") - text = data.decode("utf-8-sig") - nl = "\r\n" if "\r\n" in text else "\n" - lines = text.splitlines() - header = lines[0].split("\t") - values = {} - for s in a.set: - lang, _, val = s.partition("=") - if lang not in header: - sys.exit(f"no glossary column '{lang}'") - if "\t" in val or "\n" in val: - sys.exit("values cannot contain tabs or line breaks") - values[header.index(lang)] = val.strip() - row_i = next((i for i, l in enumerate(lines[1:], 1) if l.split("\t")[0] == a.term), None) - new = row_i is None - if new: - if not a.description: - sys.exit("a new term needs --description (one sentence saying what it is)") - row = [a.term, a.description] + [""] * (len(header) - 2) - lines.append("") - row_i = len(lines) - 1 - else: - row = lines[row_i].split("\t") - row += [""] * (len(header) - len(row)) - if a.description: - row[1] = a.description - conflicts = [f"{header[i]}: '{row[i]}' -> '{v}'" for i, v in values.items() if row[i].strip() not in MISSING and row[i] != v] + terms = (gdir / "terms.tsv").read_text(encoding="utf-8-sig").splitlines() + new = not any(l.split("\t")[0] == a.term for l in terms[1:]) + if new and not a.description: + sys.exit("a new term needs --description (one sentence saying what it is)") + # an established translation is only replaced on request + conflicts = [] + for lang, v in values.items(): + for line in (gdir / f"{lang}.tsv").read_text(encoding="utf-8-sig").splitlines()[1:]: + cells = line.split("\t") + if cells[0] == a.term and len(cells) > 2 and cells[2].strip() not in MISSING and cells[2] != v: + conflicts.append(f"{lang}: '{cells[2]}' -> '{v}'") if conflicts and not a.replace: sys.exit("established translations differ (pass --replace, and update the catalogs to match):\n " + "\n ".join(conflicts)) - for i, v in values.items(): - row[i] = v - lines[row_i] = "\t".join(row) - tsv.write_bytes((b"\xef\xbb\xbf" if bom else b"") + (nl.join(lines) + nl).encode("utf-8")) + + def edit_terms(lines): + for i, l in enumerate(lines): + if i and l.split("\t")[0] == a.term: + if a.description: + lines[i] = f"{a.term}\t{a.description}" + return + lines.append(f"{a.term}\t{a.description}") + if new or a.description: + _edit_tsv(gdir / "terms.tsv", edit_terms) + r = run_gen("--sync") # copies the term and description into every language file + if r.returncode: + sys.exit((r.stdout + r.stderr).strip()) + + def setter(lang, v): + def edit(lines): + for i, l in enumerate(lines): + cells = l.split("\t") + if i and cells[0] == a.term: + lines[i] = "\t".join(cells[:2] + [v]) + return + sys.exit(f"{lang}.tsv has no row for '{a.term}'") + return edit + for lang, v in values.items(): + _edit_tsv(gdir / f"{lang}.tsv", setter(lang, v)) finally: os.close(fd) os.unlink(lock) print(f"glossary: {'added' if new else 'updated'} '{a.term}'") - gen = wiki / "generate_glossary.py" - if gen.exists(): - r = subprocess.run([sys.executable, str(gen), "--update"], cwd=wiki, capture_output=True, text=True) - print((r.stdout + r.stderr).strip()) - return r.returncode - return 0 + r = run_gen("--update") + print((r.stdout + r.stderr).strip()) + return r.returncode def main(): diff --git a/.claude/skills/orca-wxwidgets/references/mouse-keyboard-focus.md b/.claude/skills/orca-wxwidgets/references/mouse-keyboard-focus.md index 48646134d8..679d69cb30 100644 --- a/.claude/skills/orca-wxwidgets/references/mouse-keyboard-focus.md +++ b/.claude/skills/orca-wxwidgets/references/mouse-keyboard-focus.md @@ -867,6 +867,8 @@ append_shortcut_item(export_menu, Shortcut::ExportSlicedFile, true, _L("Export p itself; never keep a raw pointer (`interface/wx/tipwin.h:20-110`). - `wxRichToolTip` is not a window: each `ShowFor()` creates a new one, and the native MSW version only applies to text controls (`interface/wx/richtooltip.h:70-192`). +- On Wayland, a GTK tooltip of a widget inside a shown popup maps as a grabbing `xdg_popup` and takes the + keyboard focus from the toplevel, which reports a deactivation → `references/popups-menus.md` §9. | Static [source] | MSW | GTK | macOS | |---|---|---|---| diff --git a/.claude/skills/orca-wxwidgets/references/platforms.md b/.claude/skills/orca-wxwidgets/references/platforms.md index 673f58357f..882a7dc59c 100644 --- a/.claude/skills/orca-wxwidgets/references/platforms.md +++ b/.claude/skills/orca-wxwidgets/references/platforms.md @@ -372,7 +372,9 @@ form a chain of parents. Window icons come from the `.desktop` file. The full li `references/mouse-keyboard-focus.md`; - GL blending must keep destination alpha at 1 (d8369e5f75); - GL post-init must retry until the surface is committed (d2c24fdabb) → - `references/webview-gl-aui-media.md`. + `references/webview-gl-aui-media.md`; +- a shown GTK tooltip is the topmost `xdg_popup`, so it must be hidden before a popup maps + (`PopupWindow::Show`) → `references/popups-menus.md` §9. ### XWayland (GTK3 X11 backend inside a Wayland session) @@ -409,7 +411,8 @@ start there when looking for prior art. The sites below are exemplars, cited by (`focus_left_popup(...)`) instead of hit-testing `wxGetMousePosition()`. - `PopupWindow::Create`: on GTK it binds the top-level `wxEVT_ACTIVATE` to `topWindowActiavate` → `DismissAndNotify()`, gated by the virtual `ShouldDismissOnTopWindowDeactivate()`, which `DropDown` - overrides for Wayland popup chains. On `__WXOSX__` with `wxPU_CONTAINS_CONTROLS`, + overrides for Wayland popup chains. `PopupWindow::Show` (GTK) hides visible GTK tooltips before mapping + on Wayland. On `__WXOSX__` with `wxPU_CONTAINS_CONTROLS`, `PopupWindow::OnMouseEvent2` hit-tests children, re-dispatches mouse events and synthesises enter/leave. - `SidePopup::Popup` (`Widgets/SideMenuPopup.cpp`): on `__APPLE__` the menu is anchored flush against @@ -633,7 +636,7 @@ headers. Rows marked [source] or "protocol" come from the implementation or from | `wxBitmap(const wxCursor&)` | creates an invalid bitmap | `interface/wx/bitmap.h:393-395` | — | | OpenGL | only EGL; `PreferGLX()` has no effect. Without EGL in the build, wxGTK's `wxGLCanvas` shows a fatal message and refuses to work [source: `src/gtk/glcanvas.cpp` `IsAvailable`]. The EGL surface is a subsurface over the canvas, ready only after map and a frame callback [source: `src/unix/glegl.cpp`] | `interface/wx/glcanvas.h:1094-1095` | `CLI::run` forces X11 when wx lacks EGL; overlays are drawn in GL/ImGui, never as wx children over the canvas → `references/webview-gl-aui-media.md` | | AUI | the doc note "live resize is always used … for wxOSX and wxGTK3 when using Wayland" is obsolete: "As of wxWidgets 3.3.0 this function always returns false", and `wxAUI_MGR_LIVE_RESIZE` is in the default flags. Floating panes need global positions | `interface/wx/aui/framemanager.h:336-345` | `Plater::priv::priv` clears `wxAUI_MGR_ALLOW_FLOATING`; `sanitize_window_layout_for_wayland` strips floating state from the saved layout → `references/webview-gl-aui-media.md` §wxAuiManager | -| Popups | a GTK popup is an `xdg_popup` only for COMBO/DROPDOWN/POPUP_MENU hints, so wx creates popups with `GDK_WINDOW_TYPE_HINT_COMBO` [source]. A chained popup's parent must be the mapped popup, and mapping it with a grab deactivates the toplevel (Orca's comments in `DropDown::mouseMove`, `DropDown::ShouldDismissOnTopWindowDeactivate`) | `src/gtk/popupwin.cpp:110-114` | `DropDown` transient-for chain, `ShouldDismissOnTopWindowDeactivate` → `references/popups-menus.md` | +| Popups | a GTK popup is an `xdg_popup` only for COMBO/DROPDOWN/POPUP_MENU hints, so wx creates popups with `GDK_WINDOW_TYPE_HINT_COMBO` [source]. A chained popup's parent must be the mapped popup, and mapping it with a grab deactivates the toplevel (Orca's comments in `DropDown::mouseMove`, `DropDown::ShouldDismissOnTopWindowDeactivate`). A GTK tooltip of a widget in a shown popup maps as that popup's grabbing child and deactivates the toplevel the same way | `src/gtk/popupwin.cpp:110-114` | `DropDown` transient-for chain, `ShouldDismissOnTopWindowDeactivate`, the tooltip check in `PopupWindow::topWindowActiavate` → `references/popups-menus.md` | | Fractional scale | arrives as an integer GDK scale | `docs/doxygen/overviews/high_dpi.md:348-351` | → `references/dpi-bitmaps-fonts.md` | | Window decorations | some desktop environments draw a title bar on undecorated windows anyway | — | [Undecorated windows](#wayland-undecorated-top-level-windows-splash) | | `wxWebViewChromium` | X11 only | `interface/wx/webview_chromium.h:133-146` | not built (`wxUSE_WEBVIEW_CHROMIUM` OFF) | diff --git a/.claude/skills/orca-wxwidgets/references/popups-menus.md b/.claude/skills/orca-wxwidgets/references/popups-menus.md index 1ad6a09271..d165ceff0a 100644 --- a/.claude/skills/orca-wxwidgets/references/popups-menus.md +++ b/.claude/skills/orca-wxwidgets/references/popups-menus.md @@ -73,6 +73,14 @@ Contents: [Rules](#rules) · [1. Choosing the window kind](#1-choosing-the-windo 27. Build `MenuFactory` menus once. Pass `parent` to `append_menu_item` only for items that persist. (§16) 28. macOS: bind `wxID_EXIT` on `OSXGetAppleMenu()` to `Close()`, only insert into the Apple menu, and always `Skip()` a frame's `wxEVT_ACTIVATE`. (§15) +29. On Wayland, a popup that can open while a GTK tooltip is shown hides every visible tooltip window before + it maps. `PopupWindow::Show` does it for every Orca popup; a popup outside `PopupWindow` opened from a + widget with a GTK tooltip must do it itself. Only a popup that cannot map while a GTK tooltip is visible, + such as one opened from the GL canvas (whose tooltips are ImGui), needs nothing. (§9) +30. On Wayland, a hook that dismisses a popup when its toplevel deactivates ignores the deactivation while a GTK + tooltip of a widget in that popup, or in a popup opened from it, is on screen: the tooltip has taken the + keyboard while the user is still on the popup. `PopupWindow::topWindowActiavate` does it for every Orca popup; + a popup outside `PopupWindow` with such a hook must do it itself. (§9) ## 1. Choosing the window kind @@ -390,6 +398,10 @@ compensates for (§6). on older GTK and GTK2. On hide: `gdk_seat_ungrab` + `gtk_grab_remove` (`popupcmn.cpp:335-403`). `gdk_seat_ungrab` releases the *seat's* grab, whichever popup took it, so hiding a sub-popup also drops the parent popup's pointer grab. +- The window is mapped before the grab is taken (`wxPopupWindow::Show` at `popupcmn.cpp:370`, the grab from + 375). Under Wayland the popup itself therefore maps as an `xdg_popup` without an explicit grab, while GDK + records the grab seat on its window, and a popup mapped later as its transient child (a sub-dropdown, a GTK + tooltip of a widget inside it) inherits that seat and maps with `xdg_popup.grab` (§9). - An outside press arrives at the grab widget. `gtk_popup_button_press` sends `wxEVT_KILL_FOCUS` to the popup and **consumes the click** (`return TRUE`, `src/gtk/popupwin.cpp:28-58`). Presses older than the popup's creation time are ignored (33-34). @@ -439,6 +451,9 @@ class PopupWindow : public wxPopupTransientWindow { public: PopupWindow(wxWindow* parent, int style = wxBORDER_NONE); bool Create(wxWindow* parent, int flags = wxBORDER_NONE); +#ifdef __WXGTK__ + bool Show(bool show = true) override; // hides GTK tooltips first on Wayland (§9) +#endif #ifdef __WXMSW__ void BindUnfocusEvent(); // opt-in #endif @@ -451,7 +466,7 @@ What it adds per platform: | Port | Behaviour | |---|---| -| GTK | `Create` binds `wxEVT_ACTIVATE` on `GetTopParent(parent)`. `topWindowActiavate` calls `event.Skip()`, then `DismissAndNotify()` if the toplevel deactivated, the popup is shown and `ShouldDismissOnTopWindowDeactivate()` returns true. This supplies the app/toplevel deactivation dismissal that stock wxGTK lacks. | +| GTK | `Create` binds `wxEVT_ACTIVATE` on `GetTopParent(parent)`. `topWindowActiavate` calls `event.Skip()`, then `DismissAndNotify()` if the toplevel deactivated, the popup is shown, `ShouldDismissOnTopWindowDeactivate()` returns true and, under Wayland, no GTK tooltip of the popup's own is on screen (§9). This supplies the app/toplevel deactivation dismissal that stock wxGTK lacks. Under Wayland, `Show(true)` on a hidden popup first hides every visible GTK tooltip window (§9). | | MSW | Nothing automatic. `BindUnfocusEvent()` binds the toplevel's `wxEVT_ACTIVATE`/`wxEVT_ICONIZE`/`wxEVT_SHOW` to `Dismiss()` (no `OnDismiss`). It is for default-style popups: they are desktop children that Windows does not hide with the frame, and stock wx closes them on deactivation or minimizing only if a focus message reaches a wx window (§4, §5). `topWindowActivate` does **not** `Skip()`, so while the popup lives it swallows the frame's `wxEVT_ACTIVATE`, and with it `wxTopLevelWindowMSW::OnActivate`'s focus save and restore (`src/msw/toplevel.cpp:1326-1360`). | | macOS | Only with `wxPU_CONTAINS_CONTROLS`: `OnMouseEvent2`, bound on the popup for `LEFT_DOWN/UP/DCLICK`, `MOTION` and `MOUSEWHEEL`, hit-tests the children (static `HitTest`) and re-dispatches the event to the deepest child under the cursor with `ProcessEventLocally`. On `MOTION` it synthesizes `ENTER`/`LEAVE` for the hovered target. This compensates for the capture rerouting in §5. | @@ -721,6 +736,85 @@ fights the grab and focus model (§10). Two more [source] facts: `DropDown::Popup`, applied when `!mainDropDown && m_widget`). - **Rule:** Don't open a grabbing popup on hover on Linux if the opener must stay clickable. Cite: `MainFrame` slice-button hover handlers (`#ifndef __linux__`). +- **Rule:** On Wayland, hide every visible GTK tooltip window right before mapping a popup that can open + while one is shown. + **Why:** A GTK3 tooltip is a `GTK_WINDOW_POPUP` with the `tooltip` type hint, placed with + `gdk_window_move_to_rect` (`gtktooltip.c:974-983`), so GDK Wayland maps it as an `xdg_popup` of the + hovered widget's toplevel (`should_map_as_popup`, `gdkwindow-wayland.c:3198-3199`). GDK refuses to map a + popup whose parent is not the last popup it mapped, warning "Tried to map a popup with a non-top most + parent" (`gdkwindow-wayland.c:3040-3046`), and the window stays invisible while wx believes it is shown. + GTK hides the tooltip on a button or key press, but only after the event has been propagated to the + widgets (`gtkmain.c:1949-1961`, `_gtk_tooltip_handle_event`). A dropdown opened from the click is therefore + mapped while the opener's tooltip is still up, and the click that opens it after the tooltip delay does + nothing. The same holds for a sub-dropdown opened on hover while the main dropdown shows an item tooltip. + GTK hides the current tooltip the same way before mapping its own menus (`gtk_menu_popup_internal`, + `gtkmenu.c:1837`), but through the private `_gtk_tooltip_hide_in_display` (`gtktooltip.c:1297`); apps have + no public call, so hide the window: `gtk_widget_hide` unmaps the `xdg_popup` at once, and GtkTooltip treats + the tooltip as no longer visible (`GTK_TOOLTIP_VISIBLE`, `gtktooltip.c:135`). Its own hide on the press + then returns early, before it times out browse mode (`gtk_tooltip_hide_tooltip`, `gtktooltip.c:1078`, + 1092), so the next tooltip shows after the 60 ms browse delay instead of 500 ms. A tooltip GTK tries to + show while a popup is open fails to map with the same warning and stays hidden, unless its widget is in + the topmost popup (a dropdown's own item tooltip maps as that popup's child); that happens with or without + this step and is harmless. X11 has no popup stacking rule, so the step is gated on + `is_running_on_wayland()`. (Line numbers are GTK 3.24.52.) + ```cpp + // Wrong: map the popup with the opener's tooltip still on top + drop.Popup(&drop); + // Right (wxGTK, Wayland): PopupWindow::Show does this before every map + GList* toplevels = gtk_window_list_toplevels(); + for (GList* l = toplevels; l; l = l->next) + if (gtk_window_get_type_hint(GTK_WINDOW(l->data)) == GDK_WINDOW_TYPE_HINT_TOOLTIP && gtk_widget_get_visible(GTK_WIDGET(l->data))) + gtk_widget_hide(GTK_WIDGET(l->data)); + g_list_free(toplevels); + ``` + Cite: `PopupWindow::Show` (#16595). + +- **Rule:** On Wayland, don't dismiss a shown popup on a toplevel deactivation while a GTK tooltip of one of its + widgets is on screen. + **Why:** GTK makes a tooltip transient for the toplevel of the widget it describes (`gtktooltip.c:974`), which + for a widget inside a popup, or the popup itself (`DropDown` sets its item tooltips on itself), is the popup's + own `GtkWindow`. The popup's window holds the seat grab (§5), and `find_grab_input_seat` walks the transient + parents to it (`gdkwindow-wayland.c:3142-3147`), so GDK maps the tooltip with an explicit `xdg_popup.grab` + (3100); the walk passes through every popup in a chain, so a tooltip in a popup opened from inside another + popup grabs too. The compositor gives the keyboard to the topmost grabbing popup: KWin sends `wl_keyboard.leave` + for the main window and `enter` for the tooltip (observed with `WAYLAND_DEBUG=client`). wxGTK turns the + toplevel's focus-out into `wxEVT_ACTIVATE(false)` (`src/gtk/toplevel.cpp:192-205`), so a deactivation hook closes + the popup as the tooltip appears, and GDK warns "Tried to unmap the parent of a popup" + (`gdkwindow-wayland.c:3429`) because the tooltip is still mapped as its child. The focus returns to the toplevel + when the tooltip hides. Ask GDK whether the tooltip is mapped (`gdk_window_is_visible`): when the compositor + dismisses a tooltip, `xdg_popup_done` hides only its `GdkWindow` (`gdkwindow-wayland.c:2289`, + `gdkwindow.c:5684-5690`), and `gtk_widget_get_visible` stays TRUE until GTK hides the tooltip itself. Alt+Tab with + a tooltip showing still closes the popup (observed): the Alt press reaches the app, which hides the tooltip after + handling the key (`gtkmain.c:1949-1961`). X11 tooltips never take the focus, so the check is gated on + `is_running_on_wayland()`. (Line numbers are GTK 3.24.52.) + **Limit:** wxGTK sends `wxEVT_ACTIVATE(false)` only while it holds an active frame and then clears it + (`g_activeFrame`, `src/gtk/toplevel.cpp:196-202`), so a deactivation ignored this way is never repeated. If the + app loses the focus while the tooltip holds it, without Orca seeing a key or the pointer leave first (another + app's window taking the focus, a gesture), the popup stays open until the user returns, and the first click + closes it (observed with a dialog from another app). Closing that gap means waiting for the compositor to + reactivate the toplevel, which takes a timer or a blocking round trip. + ```cpp + // Wrong: every toplevel deactivation dismisses, including the one the popup's own tooltip causes + if (!event.GetActive() && IsShown() && ShouldDismissOnTopWindowDeactivate()) + DismissAndNotify(); + // Right (wxGTK): Wayland only, skip it while a tooltip of this popup or of a popup opened from it is mapped + static bool own_tooltip_mapped(GtkWindow *popup) + { + bool mapped = false; + for_each_tooltip_window([popup, &mapped](GtkWindow *win) { // GDK_WINDOW_TYPE_HINT_TOOLTIP toplevels + GdkWindow *gdk_win = gtk_widget_get_window(GTK_WIDGET(win)); + if (!gdk_win || !gdk_window_is_visible(gdk_win)) + return; + for (GtkWindow *w = gtk_window_get_transient_for(win); w && !mapped; w = gtk_window_get_transient_for(w)) + mapped = w == popup; + }); + return mapped; + } + if (!event.GetActive() && IsShown() && ShouldDismissOnTopWindowDeactivate() && + !(Slic3r::GUI::is_running_on_wayland() && own_tooltip_mapped(GTK_WINDOW(m_widget)))) + DismissAndNotify(); + ``` + Cite: `PopupWindow::topWindowActiavate` (#16800). ## 10. Frameless dialog instead of a popup diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index ff07d1efb7..1918c009db 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -19,6 +19,8 @@ on: - 'build_linux.sh' - 'build_win.bat' - 'scripts/test_build_win.ps1' + - 'scripts/check_exception_throw_info.ps1' + - 'scripts/test_check_exception_throw_info.ps1' - 'build_release_macos.sh' - 'scripts/build_preset_cache.*' - 'scripts/flatpak/**' @@ -41,6 +43,8 @@ on: - 'build_linux.sh' - 'build_win.bat' - 'scripts/test_build_win.ps1' + - 'scripts/check_exception_throw_info.ps1' + - 'scripts/test_check_exception_throw_info.ps1' - 'build_release_macos.sh' - 'scripts/build_preset_cache.*' - 'scripts/flatpak/**' @@ -84,6 +88,10 @@ jobs: shell: powershell run: .\scripts\test_build_win.ps1 + - name: Run the exception throw info check tests + shell: powershell + run: .\scripts\test_check_exception_throw_info.ps1 + build_linux: strategy: fail-fast: false diff --git a/.github/workflows/build_orca.yml b/.github/workflows/build_orca.yml index 60456ad171..8880009c19 100644 --- a/.github/workflows/build_orca.yml +++ b/.github/workflows/build_orca.yml @@ -65,15 +65,6 @@ jobs: shell: bash run: | leg="${{ runner.os }}-${{ inputs.arch || 'amd64' }}${{ runner.os == 'Windows' && format('-{0}', inputs.compiler) || '' }}" - # clang-cl refuses a precompiled header from another cl.exe build and ccache - # does not hash that build, so each one gets its own cache. The build number - # is read from cl.exe itself; the toolset directory keeps its name across patches. - if [ "${{ runner.os }}" = Windows ]; then - vswhere='/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe' - toolset=$(tr -d '\r\n' < "$("$vswhere" -latest -products '*' -find 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt' | tr -d '\r')") - cl=$("$vswhere" -latest -products '*' -find 'VC\Tools\MSVC\'"$toolset"'\**\cl.exe' | tr -d '\r' | head -1) - leg="$leg-vc$("$cl" 2>&1 | grep -o -E 'Version [0-9.]+' | cut -d' ' -f2)" - fi echo "CCACHE_LEG=$leg" >> "$GITHUB_ENV" echo "CCACHE_ENTRY=ccache-$leg-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_ENV" @@ -273,8 +264,9 @@ jobs: KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} CERTIFICATE_ID: ${{ secrets.MACOS_CERTIFICATE_ID }} run: | - # Load the `retry` helper (retries flaky commands such as `hdiutil create`). + # Load the `retry` and `create_dmg` helpers. source ${{ github.workspace }}/scripts/retry.sh + source ${{ github.workspace }}/scripts/create_dmg.sh CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH @@ -328,7 +320,7 @@ jobs: rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications - retry hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer" ${{ github.workspace }}/build/universal/OrcaSlicer_dmg OrcaSlicer_Mac_universal_${{ env.ver }}.dmg codesign --deep --force --verbose --options runtime --timestamp --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_universal_${{ env.ver }}.dmg # Create separate OrcaSlicer_profile_validator DMG if the app exists @@ -337,7 +329,7 @@ jobs: rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications - retry hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer Profile Validator" ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg codesign --deep --force --verbose --options runtime --timestamp --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE_ID" OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg fi @@ -355,13 +347,14 @@ jobs: if: github.ref != 'refs/heads/main' && runner.os == 'macOS' && inputs.macos-combine-only working-directory: ${{ github.workspace }} run: | - # Load the `retry` helper (retries flaky commands such as `hdiutil create`). + # Load the `retry` and `create_dmg` helpers. source ${{ github.workspace }}/scripts/retry.sh + source ${{ github.workspace }}/scripts/create_dmg.sh mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications - retry hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer" ${{ github.workspace }}/build/universal/OrcaSlicer_dmg OrcaSlicer_Mac_universal_${{ env.ver }}.dmg # Create separate OrcaSlicer_profile_validator DMG if the app exists if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then @@ -369,7 +362,7 @@ jobs: rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/* cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/ ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications - retry hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg + create_dmg "OrcaSlicer Profile Validator" ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg fi # Delete the per-arch bundles only after signing/DMG creation succeeded, so a @@ -552,6 +545,13 @@ jobs: name: OrcaSlicer_profile_validator_Windows_${{ env.ver }} path: ${{ github.workspace }}/build/src/Release/OrcaSlicer_profile_validator.exe + - name: Check exception throw info Win + if: runner.os == 'Windows' && inputs.compiler == 'clang' + working-directory: ${{ github.workspace }} + # After the uploads, so a failure still leaves the build and its PDB to inspect, and before any deploy. + shell: pwsh + run: scripts\check_exception_throw_info.ps1 -BuildDir $env:BUILD_DIR + - name: Deploy Windows release portable if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && runner.os == 'Windows' && !vars.SELF_HOSTED uses: ./.github/actions/deploy-nightly diff --git a/.github/workflows/pr-label-bot.yml b/.github/workflows/pr-label-bot.yml index f323d0e400..2fa6c2598d 100644 --- a/.github/workflows/pr-label-bot.yml +++ b/.github/workflows/pr-label-bot.yml @@ -50,6 +50,12 @@ jobs: 'documentation' ]; const pr = context.payload.pull_request; + // First-time contributors also get a link to the contributing guide + const greeting = ['FIRST_TIME_CONTRIBUTOR', 'FIRST_TIMER'].includes(pr.author_association) + ? `Hi @${pr.user.login}, thanks for contributing to OrcaSlicer! ` + + `[How to Contribute](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute) explains what reviewers need from a PR.\n\n` + + `You can` + : `Hi @${pr.user.login}, you can`; const labelsList = `${allowedLabels .slice(0, -1) .map((label) => `\`${label}\``) @@ -72,7 +78,7 @@ jobs: repo: context.repo.repo, issue_number: pr.number, body: - `Hi @${pr.user.login}, you can manage the labels for this PR by \`/bot add-label\` and \`/bot remove-label\`\n\n` + + `${greeting} manage the labels for this PR by \`/bot add-label\` and \`/bot remove-label\`.\n\n` + `Allowed labels are:\n${labelsList}\n\n` + `Examples:\n${examplesText}` }); diff --git a/AGENTS.md b/AGENTS.md index 8dc4cf601e..99c888ee89 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -58,6 +58,10 @@ ctest --test-dir ./tests/fff_print -C Release - Profile/format changes need version migration handling - Dependencies built separately in `deps/build/`, then linked to main app +## Pull requests + +Before opening a pull request or posting on GitHub, read [CONTRIBUTING.md](CONTRIBUTING.md), including its "If you are an AI agent" section. + ## Code review focus areas - Changes must not cause regressions in existing functionality, defaults, profiles, or project compatibility. @@ -91,7 +95,7 @@ See `.claude/skills/orca-translations/references/source-audit.md` for the full c ### Terminology - Use the [Localization glossary](https://github.com/OrcaSlicer/OrcaSlicer_WIKI/blob/main/developer_reference/localization_glossary.md) as the source of truth for recurring terms, so the same English term is always rendered the same way within a language, and terms that must stay in English (brand/product names, acronyms, materials, file formats, G-code tokens, macros/variables/identifiers) are not translated. -- If a term's established translation changes, update both the affected `.po` files and the glossary (`localization_glossary.tsv`, then regenerate) so they stay in sync. +- If a term's established translation changes, update both the affected `.po` files and the glossary (`developer_reference/glossary/.tsv` in the wiki, then regenerate) so they stay in sync. - Translate the *meaning*, not the words. Check what the string actually controls before translating it — English reuses one word for different things. `Flow ratio` (multiplier), `Flow Rate` (throughput) and `Flow Dynamics` (pressure compensation) are three different terms; `extruder` may mean the toolhead, the feeder motor, or the nozzle depending on the string. - Reuse one template per recurring message shape (`Failed to connect to …`, `Are you sure you want to …?`), even where the English wording varies. diff --git a/CMakeLists.txt b/CMakeLists.txt index 06ea0dbd6f..62798ebfc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,6 +321,14 @@ if (IS_CROSS_COMPILE) set(BUILD_TESTS OFF CACHE BOOL "" FORCE) endif () +# With a precompiled header, clang-cl can omit an exception type's copy constructor from its throw info, +# so copies of the exception share and double-free their data: https://github.com/llvm/llvm-project/issues/53486 +if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + message(STATUS "clang-cl: building without the precompiled header (llvm/llvm-project#53486)") + set_property(CACHE SLIC3R_PCH PROPERTY HELPSTRING "Use precompiled headers (ignored with clang-cl, llvm/llvm-project#53486)") + set(SLIC3R_PCH OFF) +endif () + # Print out the SLIC3R_* cache options get_cmake_property(_cache_vars CACHE_VARIABLES) list (SORT _cache_vars) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..7639ce8f3e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,105 @@ +# Contributing to OrcaSlicer + +Thanks for wanting to help! OrcaSlicer is built by volunteers. + +Review is the slowest part of getting a PR merged. A small group of reviewers works through hundreds of open PRs in their spare time. If a PR has what they need, it is reviewed sooner and is more likely to be merged. [How to Contribute](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute) on the wiki has the details for each kind of PR. + +For questions about using OrcaSlicer, please ask on [Discord](https://discord.gg/P4VE9UY9gJ) or in [Discussions](https://github.com/OrcaSlicer/OrcaSlicer/discussions), not in an issue or PR. + +Opening an issue? See [Opening an Issue](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#opening-an-issue). + +## The short version + +- Search open PRs and issues before you start. Someone may already be working on it. +- Keep each PR to one topic. Put changes that belong together in one PR, and unrelated changes in separate PRs. Focused PRs are reviewed and merged much faster. +- Don't open many PRs at once. If you already have several open, wait until some are merged. +- Explain why the change is needed, and show how you tested it. Add an automated test when the code can be tested. +- AI tools are welcome. You are still responsible for the change, so test it and make sure you understand it. +- Keep your PR up to date and reply to review comments. + +## Write a description reviewers can use + +Use the [PR template](.github/pull_request_template.md), and keep its "How to Download Pull Requests Artifacts" link as the last line. Testers use that link. In the template, answer these questions: + +- **What does this change, and why is it needed?** If it fixes an issue, write `Fixes #1234` in the description, so GitHub closes the issue when the PR is merged. If it fixes only part of an issue, mention `#1234` without `Fixes`, so the issue stays open. +- **Are there related PRs or issues?** If another PR touches the same code or bug, explain how yours is different. +- **How did you test it?** Give the OS, the printer profile and the steps. Attach a project file if the result depends on a model or settings. Name any automated tests you added. The best test fails without your change and passes with it. See [tests/AGENTS.md](tests/AGENTS.md) for where a test goes. +- **What could you not test?** For example another OS, or a printer you don't own. + +Use short, plain sentences, because many reviewers read English as a second language. Your own English is fine, and so is a translation tool. + +## What each kind of PR needs + +| Kind of PR | Label | Reviewers need to see | +|---|---|---| +| [Bug fix](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#bug-fixes) | `bug-fix`, `crash` | The cause, before and after, a test if possible | +| [Security fix](SECURITY.md) | `SECURITY` | A private report to the maintainers first | +| [New feature or setting](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#new-features-and-settings) | `enhancement`, `QoL` | Why users need it, that it is off by default, real results | +| [Performance](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#performance) | `optimization` | Measurements, and proof the output did not change | +| [Refactor](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#refactors) | `optimization` | That behavior and output did not change | +| [GUI change](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#gui-changes) | `UI/UX` | Screenshots before and after, on each platform you tested | +| [Printer profile](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#printer-profiles) | `profile` | The validator passing, the version bump, real print results | +| [Translation](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#translations) | `Localization` | Glossary terms used, placeholders unchanged | +| [Build, CI or dependencies](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#build-ci-and-dependencies) | `build`, `dependencies` | Which platforms you built on | +| [Tests](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#tests) | `test` | That the test fails when the behavior breaks | +| [Documentation](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#documentation) | `documentation` | That it matches the current code | + +## Rules that are easy to miss + +- **Don't reformat existing code or make unrelated edits.** `.clang-format` is for new files. In existing files, match the code around your change. +- **Include what you use.** Because of the precompiled header, a local build can succeed with a missing include. Run `scripts/run_clang_tidy.sh` (or `.ps1`) before you push. +- **New behavior is off by default.** When the new option is off, existing output must not change. +- **Keep old projects and profiles working.** Never change what an existing setting means. Add a new key, and convert old values in `handle_legacy`. +- **Write each UI message as one translatable string** with placeholders, never as joined fragments. See "Writing translatable strings in the source" in [AGENTS.md](AGENTS.md). +- **Only edit `msgstr` in translations.** Keep every placeholder and `\n` exactly as in the `msgid`. +- **Bump the vendor version when you change profiles.** Change `version` in `resources/profiles/.json` for every vendor you change, and run `scripts/check_profile.sh` (or `.bat`). + +The code style and the full list of what reviewers check are in [AGENTS.md](AGENTS.md). + +## Using AI tools + +AI tools are welcome here, and many contributors and maintainers use them. Reviewers can only spend time on PRs that a person has already tested. + +- **You are responsible for the change.** Before you ask for review, build the change, run it, and confirm that it works. Be ready to explain each change and why it is needed. +- **Keep it short and true.** AI tools tend to write long descriptions, and sometimes describe tests that never ran. Remove generated code that isn't needed, too. A short description of what you actually did helps more. +- **Read what you post.** Please don't paste a review comment into an AI tool and post its answer without checking it. +- **Don't let an agent open PRs or post comments on its own.** Read everything before it is posted. +- **Use the repository's skills.** `.claude/skills/` (also reachable as `.agents/skills/`) has instructions for AI tools on parts of OrcaSlicer. The top of each skill's `SKILL.md` describes when to use it. Some tools load them automatically. With others, point the tool to the skill that matches your change. + +### If you are an AI agent + +If you are an AI agent working for a contributor, please follow these steps: + +1. Show the contributor this guide before you open a PR or post a comment. +2. Search open PRs for the same change before you start. +3. If the contributor already has several open PRs, wait until some are merged before you open another. +4. Before you change code, check `.claude/skills/` for a skill that matches the change, and follow it. +5. If the code can be tested, add an automated test, and check that it fails without the change and passes with it. +6. Ask the contributor to test the change by hand. For a bug fix, they should build the code without the change and reproduce the bug. Then they should build the branch and check that the bug is gone. +7. Write the PR description in the [PR template](.github/pull_request_template.md). A body passed with `gh pr create --body` replaces the template, so start from the template's text. +8. If you couldn't build or run something, say so in the PR. + +## After you open the PR + +- **Add labels.** A bot will comment with instructions. Reply with the labels from the table above, for example `/bot add-label bug-fix, UI/UX`. +- **Leave "Allow edits by maintainers" turned on**, so a reviewer can push small fixes directly. +- **Mark the PR ready for review when it's finished.** Draft PRs are not merged. +- **Push new commits to the same PR.** Please don't open a new PR for the same change. +- **Don't force-push once a reviewer has commented.** Add new commits instead, so reviewers can see what changed since they last looked. To fix merge conflicts, merge `main` into your branch. PRs are usually squash-merged, so extra commits are fine. +- **Reply to every review comment**, including automated ones. You don't have to agree, but please say why. + +Reviewers are volunteers, and a first response can take a while. If you already have several PRs open, please wait until some are merged before you open more. Review comments on one PR often apply to the others too. While you wait, there are [other ways to help](https://www.orcaslicer.com/wiki/developer_reference/how_to_contribute#other-ways-to-help). + +## If your PR is closed + +There are more PRs than reviewers can handle, so we may close a PR that doesn't meet this guide. For example, it may have no explanation of how it was tested, duplicate another PR, or look generated and untested. When we close a PR, we'll say why in a comment. + +You're welcome to open a new PR once the change meets this guide. Please link the old PR in the description, so reviewers can see the earlier discussion. Thank you for the time you put into it. + +## Security issues + +Please don't report security problems in a public issue. See [SECURITY.md](SECURITY.md). + +## Thank you + +Thanks again for helping. We're glad you're here. diff --git a/build_linux.sh b/build_linux.sh index cf07d7e9df..b4c03e52ec 100755 --- a/build_linux.sh +++ b/build_linux.sh @@ -473,8 +473,8 @@ fi # cmake 4.x compatibility workaround export CMAKE_POLICY_VERSION_MINIMUM=3.5 -DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '"') -DISTRIBUTION_LIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d '"') +DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d "'\"") +DISTRIBUTION_LIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d "'\"") # Check for direct distribution match to Ubuntu/Debian if [ "${DISTRIBUTION}" == "ubuntu" ] || [ "${DISTRIBUTION}" == "linuxmint" ] ; then DISTRIBUTION="debian" diff --git a/build_release_macos.sh b/build_release_macos.sh index cdc5dbbe3c..c5fd2b9a7c 100755 --- a/build_release_macos.sh +++ b/build_release_macos.sh @@ -47,26 +47,46 @@ while getopts ":dpa:snt:xbc:i:j:Tuh" opt; do u ) export BUILD_TARGET="universal" ;; - h ) echo "Usage: ./build_release_macos.sh [-d]" + h ) echo "Usage: ./build_release_macos.sh [-d] [-- CMAKE_ARGS...]" echo " -d: Build deps only" echo " -a: Set ARCHITECTURE (arm64 or x86_64 or universal)" echo " -s: Build slicer only" echo " -u: Build universal app only (requires existing arm64 and x86_64 app bundles)" echo " -n: Nightly build" echo " -t: Specify minimum version of the target platform, default is 12.0" - echo " -x: Use Ninja Multi-Config CMake generator, default is Xcode" + echo " -x: Use Ninja Multi-Config CMake generator, default is Xcode (requires ninja; install with 'brew install ninja')" echo " -b: Build without reconfiguring CMake" echo " -c: Set CMake build configuration, default is Release" echo " -i: Add a prefix to ignore during CMake dependency discovery (repeatable), defaults to /opt/local:/usr/local:/opt/homebrew" echo " -j: Set the number of parallel build jobs (CMAKE_BUILD_PARALLEL_LEVEL)" echo " -T: Build and run tests (set ORCA_TESTS_BUILD_ONLY=1 to build without running)" + echo " -- CMAKE_ARGS...: pass everything after '--' to the cmake configure step of the deps (-d) and slicer (-s) builds," + echo " e.g. -DDESTDIR= for the deps, -DCMAKE_PREFIX_PATH=/usr/local -DSLIC3R_PCH=OFF for the slicer, --fresh." + echo " They come last on the cmake command line. Use absolute paths: cmake runs in the build directory." exit 0 ;; + : ) + echo "Option -${OPTARG} requires an argument, aborting." + exit 1 + ;; * ) + echo "Unknown option -${OPTARG}, aborting. CMake arguments must follow '--'." + exit 1 ;; esac done +# getopts stops at '--'; whatever follows is handed to cmake unchanged. +if [[ ${OPTIND} -le $# ]] ; then + separator_index=$((OPTIND-1)) + if [[ "${!separator_index}" != "--" ]] ; then + echo "Unexpected argument '${!OPTIND}': cmake arguments must follow '--', aborting." + exit 1 + fi +fi +shift $((OPTIND-1)) +EXTRA_CMAKE_ARGS=("$@") + # Set defaults if [ -z "$ARCH" ]; then @@ -102,6 +122,12 @@ if [ -z "$CMAKE_IGNORE_PREFIX_PATH" ]; then export CMAKE_IGNORE_PREFIX_PATH="/opt/local:/usr/local:/opt/homebrew" fi +if [[ "$SLICER_CMAKE_GENERATOR" == Ninja* || "$DEPS_CMAKE_GENERATOR" == Ninja* ]] && ! command -v ninja >/dev/null 2>&1; then + echo "Error: Ninja is required when using the -x generator option." + echo "Install it with Homebrew: brew install ninja" + exit 1 +fi + CMAKE_VERSION=$(cmake --version | head -1 | sed 's/[^0-9]*\([0-9]*\).*/\1/') if [ "$CMAKE_VERSION" -ge 4 ] 2>/dev/null; then export CMAKE_POLICY_VERSION_MINIMUM=3.10 @@ -211,7 +237,8 @@ function build_deps() { -DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \ -DCMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH}" \ "${CMAKE_CCACHE_ARGS[@]}" \ - ${CMAKE_POLICY_COMPAT} + ${CMAKE_POLICY_COMPAT} \ + "${EXTRA_CMAKE_ARGS[@]}" fi cmake --build . --config "$BUILD_CONFIG" --target deps ) @@ -314,7 +341,8 @@ function build_slicer() { -DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \ -DCMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH}" \ "${CMAKE_CCACHE_ARGS[@]}" \ - ${CMAKE_POLICY_COMPAT} + ${CMAKE_POLICY_COMPAT} \ + "${EXTRA_CMAKE_ARGS[@]}" fi cmake --build . --config "$BUILD_CONFIG" --target "$SLICER_BUILD_TARGET" ) diff --git a/build_win.bat b/build_win.bat index dc19df06bc..8af3581abf 100644 --- a/build_win.bat +++ b/build_win.bat @@ -53,7 +53,7 @@ call :add_section "Build configuration" call :add_arg config string "" config "release, debug, relwithdebinfo or minsizerel (default: release)" call :add_arg target_arch string "" arch "x64 or arm64 (default: the host architecture)" call :add_arg slicer_asan bool a asan "Build the slicer with ASAN enabled" -call :add_arg no_pch bool "" no-pch "Build without the precompiled header, implied by --cache" +call :add_arg no_pch bool "" no-pch "Build without the precompiled header, implied by -l and --cache" call :add_section "Toolchain" call :add_arg use_clang_cl bool l clang-cl "Use clang-cl as the compiler" @@ -388,6 +388,9 @@ if "%use_ninja%" == "ON" if "%use_msbuild%" == "ON" ( exit /b 1 ) +REM CMakeLists turns the precompiled header off for clang-cl (llvm/llvm-project#53486). +if "%use_clang_cl%" == "ON" set "no_pch=ON" + set "generator=!vs_gen_%vs_version%!" if "%use_ninja%" == "ON" ( set "generator=Ninja Multi-Config" @@ -543,7 +546,7 @@ REM real path rather than one glued onto the repository root. for %%p in ("!build_dir!") do set "build_full=%%~fp" echo Configuration: %build_type%, %arch% if not "%clang_exe%" == "" echo Compiler: %clang_exe% -if "%no_pch%" == "ON" echo Precompiled header: off +if "%build_slicer%" == "ON" if "%no_pch%" == "ON" echo Precompiled header: off if not "%cache_args%" == "" echo Compiler cache: %cache_exe% set "SIG_FLAG=" @@ -716,8 +719,8 @@ if "%build_slicer%" == "ON" ( set "slicer_args=!slicer_args! -DSLIC3R_ASAN=ON" ) - REM A later -DSLIC3R_PCH=ON in ORCA_SLICER_CMAKE_ARGS still wins, because - REM CMake takes the last definition on the command line. + REM Under cl, a later -DSLIC3R_PCH=ON in ORCA_SLICER_CMAKE_ARGS still wins, + REM because CMake takes the last definition on the command line. if "%no_pch%" == "ON" ( set "slicer_args=!slicer_args! -DSLIC3R_PCH=OFF" ) diff --git a/deps/GMP/GMP.cmake b/deps/GMP/GMP.cmake index b3ba181753..4f2beedb4f 100644 --- a/deps/GMP/GMP.cmake +++ b/deps/GMP/GMP.cmake @@ -59,9 +59,13 @@ else () set(_cross_compile_arg --host=${TOOLCHAIN_PREFIX}) endif () + # 6.3.0 is the first release whose arm64 assembly avoids x18, which macOS + # reserves and zeroes on every return to user space; 6.2.1 crashes on Apple + # silicon whenever CGAL falls back to exact arithmetic. ExternalProject_Add(dep_GMP - URL https://github.com/SoftFever/OrcaSlicer_deps/releases/download/gmp-6.2.1/gmp-6.2.1.tar.bz2 - URL_HASH SHA256=eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c + URL https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz + https://github.com/SoftFever/OrcaSlicer_deps/releases/download/gmp-6.3.0/gmp-6.3.0.tar.xz + URL_HASH SHA256=a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898 DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/GMP PATCH_COMMAND git apply ${GMP_DIRECTORY_FLAG} --verbose ${CMAKE_CURRENT_LIST_DIR}/0001-GMP_GCC15.patch BUILD_IN_SOURCE ON diff --git a/deps/OpenCV/OpenCV.cmake b/deps/OpenCV/OpenCV.cmake index 0290b3f47a..d465e6129d 100644 --- a/deps/OpenCV/OpenCV.cmake +++ b/deps/OpenCV/OpenCV.cmake @@ -26,6 +26,7 @@ orcaslicer_add_cmake_project(OpenCV URL https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz URL_HASH SHA256=1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277 PATCH_COMMAND git apply ${OpenCV_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-vs.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch + DEPENDS ${JPEG_PKG} CMAKE_ARGS -DBUILD_SHARED_LIBS=0 -DBUILD_PERE_TESTS=OFF @@ -34,7 +35,8 @@ orcaslicer_add_cmake_project(OpenCV -DBUILD_EXAMPLES=OFF -DBUILD_JASPER=OFF -DBUILD_JAVA=OFF - -DBUILD_JPEG=ON + # Share Orca's libjpeg to avoid conflicting codec symbols in the application. + -DBUILD_JPEG=OFF -DBUILD_APPS_LIST=version -DBUILD_opencv_apps=OFF -DBUILD_opencv_java=OFF @@ -67,7 +69,8 @@ orcaslicer_add_cmake_project(OpenCV -DWITH_OPENJPEG=OFF -DWITH_QUIRC=OFF -DWITH_VTK=OFF - -DWITH_JPEG=OFF + # Textured GLB/OBJ imports decode embedded and external JPEGs with cv::imdecode. + -DWITH_JPEG=ON -DWITH_WEBP=OFF -DWITH_TIFF=OFF -DBUILD_TIFF=OFF diff --git a/deps/wxWidgets/0001-macos-use-srgb-colour-components.patch b/deps/wxWidgets/0001-macos-use-srgb-colour-components.patch deleted file mode 100644 index decbee0ad9..0000000000 --- a/deps/wxWidgets/0001-macos-use-srgb-colour-components.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/src/osx/cocoa/colour.mm b/src/osx/cocoa/colour.mm -index 31515d146f..86b33e94a2 100644 ---- a/src/osx/cocoa/colour.mm -+++ b/src/osx/cocoa/colour.mm -@@ -125,3 +125,3 @@ - wxOSXEffectiveAppearanceSetter helper; -- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] ) -+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] ) - return [colRGBA redComponent]; -@@ -134,3 +134,3 @@ - wxOSXEffectiveAppearanceSetter helper; -- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] ) -+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] ) - return [colRGBA greenComponent]; -@@ -143,3 +143,3 @@ - wxOSXEffectiveAppearanceSetter helper; -- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] ) -+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] ) - return [colRGBA blueComponent]; -@@ -152,3 +152,3 @@ - wxOSXEffectiveAppearanceSetter helper; -- if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] ) -+ if ( NSColor* colRGBA = [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] ) - return [colRGBA alphaComponent]; -@@ -160,3 +160,3 @@ - { -- return [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] != nil; -+ return [m_nsColour colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] != nil; - } diff --git a/deps/wxWidgets/wxWidgets.cmake b/deps/wxWidgets/wxWidgets.cmake index e57e82f3e9..7939b3d442 100644 --- a/deps/wxWidgets/wxWidgets.cmake +++ b/deps/wxWidgets/wxWidgets.cmake @@ -21,25 +21,23 @@ else () set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF") endif () -set(_wx_patch_command "") -if (APPLE) - set(_wx_patch_command - ${GIT_EXECUTABLE} checkout -f -- src/osx/cocoa/colour.mm - COMMAND ${GIT_EXECUTABLE} apply --verbose - ${CMAKE_CURRENT_LIST_DIR}/0001-macos-use-srgb-colour-components.patch - ) +# With a precompiled header, clang-cl can omit an exception type's copy constructor from its throw info, +# so copies of the exception share and double-free their data: https://github.com/llvm/llvm-project/issues/53486 +if (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(_wx_precomp OFF) +else () + set(_wx_precomp ON) endif () orcaslicer_add_cmake_project( wxWidgets - GIT_REPOSITORY "https://github.com/SoftFever/Orca-deps-wxWidgets" - GIT_TAG v3.3.2 + GIT_REPOSITORY "https://github.com/OrcaSlicer/Orca-deps-wxWidgets" + GIT_TAG 5b7e8c0cde6b975d63613188d2ac6c1ab8769fbc GIT_SHALLOW ON GIT_SUBMODULES 3rdparty/catch 3rdparty/pcre 3rdparty/libwebp - PATCH_COMMAND ${_wx_patch_command} DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${JPEG_PKG} CMAKE_ARGS - -DwxBUILD_PRECOMP=ON + -DwxBUILD_PRECOMP=${_wx_precomp} ${_wx_toolkit} "-DCMAKE_DEBUG_POSTFIX:STRING=${_wx_debug_postfix}" -DwxBUILD_DEBUG_LEVEL=0 diff --git a/deps_src/libnest2d/include/libnest2d/nester.hpp b/deps_src/libnest2d/include/libnest2d/nester.hpp index 13281c389b..f1852478d2 100644 --- a/deps_src/libnest2d/include/libnest2d/nester.hpp +++ b/deps_src/libnest2d/include/libnest2d/nester.hpp @@ -78,6 +78,12 @@ public: std::vector extrude_ids; int filament_temp_type = -1; // -1 means unset. otherwise should be {0,1,2} double height{ 0 }; + double z_min{ 0 }; + double z_max{ 0 }; + bool has_z_range{ false }; + bool is_bed_exclusion{ false }; + std::vector bed_exclusion_extruder_ids; + int bed_exclusion_extruder_id{ -1 }; double print_temp{ 0 }; double bed_temp{ 0 }; double vitrify_temp{ 0 }; // vitrify temperature diff --git a/deps_src/libnest2d/include/libnest2d/placers/nfpplacer.hpp b/deps_src/libnest2d/include/libnest2d/placers/nfpplacer.hpp index ba015b0faa..f41e9ade61 100644 --- a/deps_src/libnest2d/include/libnest2d/placers/nfpplacer.hpp +++ b/deps_src/libnest2d/include/libnest2d/placers/nfpplacer.hpp @@ -123,6 +123,10 @@ struct NfpPConfig { std::function on_preload; + // Return false when a packed item does not constrain this candidate. + // By default every pair participates in the 2D collision calculation. + std::function&, const _Item&)> should_check_collision; + //BBS: sort function for selector std::function& i1, _Item& i2)> sortfunc; //BBS: excluded region for V4 bed @@ -579,7 +583,14 @@ private: { using namespace nfp; - Shapes nfps(items_.size()); + std::vector collision_items; + collision_items.reserve(items_.size()); + for (Item &item : items_) { + if (!config_.should_check_collision || config_.should_check_collision(trsh, item)) + collision_items.emplace_back(&item); + } + + Shapes nfps(collision_items.size()); // ///////////////////////////////////////////////////////////////////// // TODO: this is a workaround and should be solved in Item with mutexes @@ -590,21 +601,21 @@ private: trsh.rightmostTopVertex(); trsh.leftmostBottomVertex(); - for(Item& itm : items_) { - itm.transformedShape(); - itm.referenceVertex(); - itm.rightmostTopVertex(); - itm.leftmostBottomVertex(); + for (Item *item : collision_items) { + item->transformedShape(); + item->referenceVertex(); + item->rightmostTopVertex(); + item->leftmostBottomVertex(); } // ///////////////////////////////////////////////////////////////////// - __parallel::enumerate(items_.begin(), items_.end(), - [&nfps, &trsh](const Item& sh, size_t n) + __parallel::enumerate(collision_items.begin(), collision_items.end(), + [&nfps, &trsh](Item *const &sh, size_t n) { - auto& fixedp = sh.transformedShape(); + auto& fixedp = sh->transformedShape(); auto& orbp = trsh.transformedShape(); auto subnfp_r = noFitPolygon(fixedp, orbp); - correctNfpPosition(subnfp_r, sh, trsh); + correctNfpPosition(subnfp_r, *sh, trsh); nfps[n] = subnfp_r.first; }); diff --git a/deps_src/semver/semver.c b/deps_src/semver/semver.c index 8611bd7b7f..b23c110edc 100644 --- a/deps_src/semver/semver.c +++ b/deps_src/semver/semver.c @@ -224,12 +224,14 @@ compare_prerelease (char *x, char *y) { if (x == NULL && y) return 1; // Orca: Special handling for 'dev' + // Nightly builds stay on x.y.z-dev after the alpha and beta are tagged, so 'dev' + // ranks above every other prerelease and below the release. if (strcmp(x, "dev") == 0 && strcmp(y, "dev") == 0) return 0; if (strcmp(x, "dev") == 0 && strcmp(y, "dev") != 0) - return -1; - if (strcmp(x, "dev") != 0 && strcmp(y, "dev") == 0) return 1; + if (strcmp(x, "dev") != 0 && strcmp(y, "dev") == 0) + return -1; lastx = x; lasty = y; diff --git a/docs/HLSD/adaptive-tpms-infill.md b/docs/HLSD/adaptive-infill.md similarity index 96% rename from docs/HLSD/adaptive-tpms-infill.md rename to docs/HLSD/adaptive-infill.md index 5fc578f7e2..30eb364753 100644 --- a/docs/HLSD/adaptive-tpms-infill.md +++ b/docs/HLSD/adaptive-infill.md @@ -1,8 +1,8 @@ -# Adaptive TPMS infill — High Level Design +# Adaptive infill — High Level Design ## Purpose and scope -`tpms_adaptive` grades the sparse infill of the Gyroid, TPMS-D and TPMS-FK +`adaptive_infill_mode` grades the sparse infill of the Gyroid, TPMS-D and TPMS-FK patterns inside the object: the cells grow continuously from the surface towards the center of the object. `distance_warp`, `smooth_blend` and `stepped_shells` follow the distance to the nearest surface, including the top @@ -10,8 +10,8 @@ and bottom, like concentric shells; `lobes` follows the whole 3D shape towards the center of each lobe of the object; `normal_z`, `normal_y` and `normal_x` follow each section of the object normal to that axis, so the grading does not change along the axis, as suits a profile extruded along it. -`sparse_infill_density` is the density at the surface, `tpms_interior_density` -the density at the center, and `tpms_adaptive_gradient` picks how the density +`sparse_infill_density` is the density at the surface, `adaptive_infill_interior_density` +the density at the center, and `adaptive_infill_gradient` picks how the density goes from one to the other. Only internal sparse infill is graded; the Gyroid Z-buckling optimization does not apply to it. @@ -22,9 +22,9 @@ split into shells or blended between densities. ## Radial field -`TpmsRadialField` gives every point of an object the center of its lobe and a +`AdaptiveInfillField` gives every point of an object the center of its lobe and a radial coordinate: 0 at the center, 1 at the surface along the ray from the -center. `PrintObject::prepare_tpms_radial_fields()` builds it in +center. `PrintObject::prepare_adaptive_infill_fields()` builds it in `bridge_over_infill()`, next to the adaptive cubic octree, because the anchoring infill generated there has to match the printed infill. A field is built for every mode a region uses, and is shared by the regions using that mode: the @@ -202,7 +202,7 @@ built for them. ## Constraints -- With `tpms_adaptive` disabled, or for other patterns, the fill parameters are reset +- With `adaptive_infill_mode` disabled, or for other patterns, the fill parameters are reset to their defaults, so they neither change the infill nor split fill batches. - `Layer::get_sparse_infill_max_void_area()` uses the sparser of the two densities, as the voids at the center are that large. diff --git a/docs/HLSD/exclusion-volumes.md b/docs/HLSD/exclusion-volumes.md new file mode 100644 index 0000000000..1b68c256d5 --- /dev/null +++ b/docs/HLSD/exclusion-volumes.md @@ -0,0 +1,69 @@ +# Bed exclusions and toolhead collision volumes + +## Purpose and configuration + +Bed exclusions have two distinct meanings. A material keep-out prevents model +placement without prohibiting deliberate machine travel, such as entering a +filament cutter. A toolhead collision volume represents an obstacle that travel +and extrusion must avoid. Keeping separate settings preserves existing printer +profiles, project files and command-line usage without enabling new motion +constraints implicitly. + +- `bed_exclude_area` remains a points-array polygon and a shared, bed-fixed + material/placement keep-out. +- `bed_exclude_volumes` contains collision-volume polygons, with optional + `ZMIN..ZMAX;` prefixes and `|` separators. A polygon without a Z prefix applies + over the printable height. +- `bed_exclude_volume_mode` selects shared volumes, toolhead-relative volumes + derived from nozzle XY offsets, or individually configured extruder volumes. +- `extruder_bed_exclude_volumes` stores the individual definitions. These are + selected by physical extruder, not simply by filament slot. + +Material keep-outs and collision volumes are additive. Nozzle offsets apply only +to collision volumes in toolhead-relative mode. The existing bed area never moves +or disappears when collision volumes are configured. + +On belt printers, the region resolver projects material keep-outs onto the +tilted bed surface before placement and tower validation. Collision volumes +remain in model coordinates; the bed-surface projection is not applied to them. + +The printer settings expose the bed area as a normal editable field with Orca's +standard reset controls. Collision volumes appear directly below it in Printable +space, as a separate field. A bed-area polygon can be manually copied into this +field to define a full-height collision volume. Pasted volume syntax in the +area field requires confirmation before it is added to the volume settings; +declining or invalid input leaves the stored area intact. + +## Geometry and slicing + +The region resolver retains the distinction between material keep-outs and +collision volumes, and supplies nozzle-specific regions to placement, arrangement, +generated geometry and motion consumers. An object is checked conservatively +against the collision volumes for every nozzle it uses, over its complete geometry +rather than only a painted portion. Shared support geometry likewise uses a +conservative union of the relevant nozzle and instance exclusions. + +Collision-volume footprints are selected by their overlap with the applicable Z +slab. Brim and supported support-generation paths subtract these footprints before +extrusion generation. The travel router attempts to avoid active collision +volumes; the final G-code checker validates emitted motion independently. + +The checker cannot infer movements inside opaque firmware macros. Homing leaves +the affected coordinates unknown until explicit coordinates establish them. +Skirts and draft shields are not rebuilt around obstacles, extrusion is not +rerouted, and the circular XY sweep of spiral Z-hop is not available to the travel +router when it plans the primary travel. The final checker can warn about these +violations; that warning is not an automatic repair or a guarantee of safe output. + +## Preview + +Ground footprints remain visible. Nozzle-specific collision volumes have thin +nozzle-coloured borders; shared volumes and single-nozzle configurations do not +imply ownership by a particular filament. Automatic 3D previews are limited to +nearby object height to avoid obscuring the workspace. + +**View → Show all collision volumes** displays each volume over its complete +resolved Z range, including on an empty bed. Its default shortcut is Ctrl+Shift+K +(Command+Shift+K on macOS), configurable through Orca's shortcut settings. The +application remembers this display preference independently of printer presets; +it changes neither collision checking nor slicing results. diff --git a/docs/HLSD/filament_id.md b/docs/HLSD/filament_id.md index 122dfb6fdb..555a5d6ad5 100644 --- a/docs/HLSD/filament_id.md +++ b/docs/HLSD/filament_id.md @@ -350,8 +350,11 @@ identity default and translates nothing. `NetworkAgent` forwards both to the liv comparison sites below reach them through `wxGetApp().getAgent()` and leave an id untranslated while no agent is live. Whole documents are Bambu's business alone: `BBLPrinterAgent::to_orca_payload` and `from_orca_payload` rewrite every string under -`tray_info_idx`, `filament_id` or `filamentId` at any depth; text that does not parse, or carries -none of those keys, comes back unchanged. The map is loaded once, lazily; a missing or malformed +`tray_info_idx`, `filament_id`, `filamentId`, `cate` or `fila_id` at any depth; text that does not +parse, or carries none of those keys, comes back unchanged. The last two are the H2C nozzle rack's: +`cate` in the auto nozzle mapping request, `fila_id` in the rack status. A new Bambu message that +carries a filament id under another key needs that key added to `filament_id_keys`, or the id +crosses the boundary untranslated. The map is loaded once, lazily; a missing or malformed file degrades to identity with a log line rather than failing. | Boundary | Where it translates | diff --git a/docs/HLSD/infill-corner-smoothing.md b/docs/HLSD/infill-corner-smoothing.md new file mode 100644 index 0000000000..d7a7f05d2e --- /dev/null +++ b/docs/HLSD/infill-corner-smoothing.md @@ -0,0 +1,68 @@ +# Infill corner smoothing — High Level Design + +## Purpose and scope + +`sparse_infill_smooth_factor` rounds the corners of the sparse infill paths of +the patterns `is_smoothable_infill_pattern()` lists, so the toolhead does not +slow to near a stop in every corner. `FillCornerSmoothing` does the rounding for +every pattern; the fills only call it on their paths before clipping and before +`multiline_fill()` copies them. + +The design is shaped by how firmware plans speed. Klipper, Marlin 2 with +junction deviation and OrcaSlicer's estimator limit the speed at the junction of +two moves by how much the path turns there, and by the length of the moves for +the centripetal part. A curve is printed as straight moves, so its speed depends +on how it is cut into moves as much as on its shape, and the cut decides the size +of the G-code. + +## The curve + +Each corner is replaced by a curve that runs from `reach` before it along the +incoming leg to `reach` after it along the outgoing one, `reach` being the factor +times half of the shorter leg, so the curves of two corners never overlap. + +The curve is a quintic Bézier curve whose first three control points on each leg +are equally spaced, 0.3 of the reach apart, which makes its curvature zero at the +legs: the toolhead eases into the turn. A circular arc takes fewer vertices within +the resolution and prints slower, and a septic curve, whose rate of curvature is +also zero at the legs, prints no faster than the quintic one and takes longer to +slice. Tuning the spacing to the turn angle lowers the peak curvature of sharp +turns but made no measurable difference to print time. + +## The vertices + +A corner is printed as the polygon of the curve's tangents taken at equal steps +of direction: every vertex turns by the same angle, which spends each vertex +where the planner needs it. Uniform steps of the curve parameter put vertices +where the curve is nearly straight and leave the sharpest turn in the middle. + +The number of vertices follows the G-code resolution (`resolution`), as the rest +of the G-code does: it is the fewest that keep the polygon within the resolution +of its curve. The arc of the curve's peak curvature gives the first count, which +the flatter parts of the curve may raise. The count is never so high that a +vertex stands out of the chord of its neighbours by less than the resolution, as +`LayerRegion::simplify_*` simplifies the infill to it afterwards and would drop +that vertex again. + +The vertices depend on the geometry and the resolution only, not on the printer. +A finer resolution splits a corner into more and gentler turns, which a planner +takes faster, for a larger G-code file. + +A corner of a given turn and vertex count is the same shape at any reach and +resolution, scaled. Each thread builds a shape once at unit reach and all its +`CornerSmoother`s share it, as some fills start a smoother for every path, every +layer starts its own, some patterns (Octagram Spiral) change the reach at every +corner, and searching the tangents of the curve is what slicing spends its time +on. + +## Constraints + +- At 100% every corner gets the largest curve its legs allow: the factor sets + the shape of the corners, not their speed. A large curve split into few + vertices can print slower than the sharp corner, as every vertex is a slowdown + and the short moves between them leave no room to accelerate. +- With the factor at 0 the paths are unchanged, and the fills keep their order of + operations, so that rounding to the integer grid does not move a point. +- The plane-path fills (Hilbert Curve, Octagram Spiral) produce their path point + by point in units of the line distance, so `CornerSmoother` takes points one + at a time, with the resolution in the same units. diff --git a/docs/HLSD/keyboard-shortcuts.md b/docs/HLSD/keyboard-shortcuts.md index cf48a13c8d..18b8cf8578 100644 --- a/docs/HLSD/keyboard-shortcuts.md +++ b/docs/HLSD/keyboard-shortcuts.md @@ -56,9 +56,34 @@ combo boxes), so it opens the dial from the canvases and the tab strip only. `MainFrame::handle_global_shortcut` skips a chord that `KeyChord::edits_text()` reports while a text field has the focus (a wx text entry, spin control, web view or ImGui InputText), and skips every chord while an ImGui modal is open, as a wx modal dialog -would. `ImGuiWrapper::owns_key()` reads the active InputText and the popup stack -directly, since `WantCaptureKeyboard` lags a frame, and is called only when the focus is on -a visible canvas from `OpenGLManager::create_wxglcanvas()`. +would. `ImGuiWrapper::owns_key()` reads the text input request and the popup stack of the +last drawn frame, since `WantCaptureKeyboard` and `WantTextInput` only catch up when the +next frame starts, and is called only when the focus is on a visible canvas from +`OpenGLManager::create_wxglcanvas()`. + +The `Plater`, `Preview` and `Painting` shortcuts act on the 3D view, so they run only while +the 3D view has the keyboard. `GLCanvas3D` feeds every key event to ImGui and asks +`ImGuiWrapper::claim_key_event()` whether to act on it as well. While an ImGui popup (a +dropdown, a menu or a modal) is open or an ImGui InputText is active, ImGui claims every key, +as a focused sidebar text field or an open native dropdown keeps every key from the canvas. +Esc then closes the topmost dropdown or menu, since this ImGui closes popups on Esc only +through keyboard navigation, which is off; a modal handles Esc itself. A second Esc reaches +the canvas once nothing claims it. A slider or button held with the mouse also claims every +key until it is released, since a shortcut that switches the view or closes the tool would +leave the drag behind. One side handles a key from its key-down to its release. Its +repeats, its char event and its release follow the key-down's decision even when a field or +modal opens or closes in between, so a key never both runs a shortcut and types, and a +keyboard move of the selection always sees the release of the key that started it. + +Key-ups go to whatever window has the focus, so a shortcut that opens a dialog, such as +Ctrl+P, takes the release of its modifier with it. When the canvas loses the focus it sends +itself a key-up for each Shift, Ctrl or Alt still held, which ends a gizmo's Shift mode and +clears ImGui's own copy of the modifier, and then drops its record of held keys. +`ImGuiWrapper::update_mouse_data()` also takes ImGui's modifiers from each mouse event, which +carries the real state, since a stale Ctrl would turn every slider click into a Ctrl+click +and open the slider's text box. The macOS +Edit menu, whose key equivalents run before the canvas sees the key, follows the same rule +as the canvas. ## Which event a chord matches diff --git a/docs/HLSD/polygon-clipping.md b/docs/HLSD/polygon-clipping.md index 60bf97d515..00a1e2863b 100644 --- a/docs/HLSD/polygon-clipping.md +++ b/docs/HLSD/polygon-clipping.md @@ -62,6 +62,23 @@ Clipper2 behaves differently by default, the wrapper adjusts it. clip do not leave slivers. - Open polylines are clipped with the non-zero rule and keep their direction. +### Tiled booleans + +The sweep slows down with the number of edges crossing a scan line, so a layer +cut into thousands of pieces makes every whole-layer boolean expensive. +`diff_ex_by_piece()` and `intersection_ex_by_piece()` take a subject of +non-overlapping `ExPolygons`, group them into tiles with +`ClipperUtils::tile_expolygons()`, and run each tile in parallel against only +the clip polygons near it, cut to the tile's box. Below 128 pieces there is a +single tile, and they are the plain `diff_ex()` / `intersection_ex()`. + +The result covers the same area as the plain call. Without the safety offset +the rings are the same. With it, each tile unites only the clip polygons near +it, so a clip edge that the whole-layer union splits where it crosses a distant +clip polygon stays whole, and a crossing with the subject can round 1 unit +differently. The tiles' results are concatenated in tile order, so the order of +the output `ExPolygons` differs from the plain call. + ### Offsets - Before offsetting, input vertices closer than diff --git a/docs/HLSD/preset-plugin-api.md b/docs/HLSD/preset-plugin-api.md new file mode 100644 index 0000000000..4cc481eb12 --- /dev/null +++ b/docs/HLSD/preset-plugin-api.md @@ -0,0 +1,252 @@ +# Preset Plugin API — High Level Design + +## Purpose and scope + +The preset plugin API lets Python plugins update the presets OrcaSlicer is using, +so users do not have to perform every routine setting change by hand. It covers +process, printer, and filament presets. All three use one staged update lifecycle; +the way a target is selected is specific to the preset type. + +The API edits Orca's managed edited preset, not a detached copy or a saved preset +behind the UI's back. It does not save to disk. Saving, discarding, and transferring +unsaved edits remain under Orca's existing preset workflow. + +The API does not create or delete presets or provide off-tab editing. For filament, +choosing a different `preset_name` as the update target also selects that preset for +the requested slot, following the normal UI flow. A standalone slot-assignment or +preset-fork operation is outside this API's contract. + +## Preset and slot model + +Each preset collection maintains a managed edited copy for its selected preset. +Settings tabs apply changes to that copy and own the normal dirty-state, validation, +save/discard/transfer, and downstream refresh behavior. Plugin updates must use the +same path so that the settings tab, dirty indicators, and effective print +configuration observe a consistent state. + +Filament selection adds a slot-to-preset mapping. `PresetBundle::filaments` is the +catalog, while `PresetBundle::filament_presets` maps each slot to a preset name. +Several slots may refer to the same preset. A filament update edits that shared +preset, so all slots referring to it are affected. Slot numbers exposed by the API +are 1-based, matching the UI. + +## API shape + +Each preset API exposes `begin_update()`, which selects and binds one target, and +returns a transaction. The transaction stages setting changes using `set()` and +applies them only on explicit `commit()`. + +```python +# Filament is targeted by its 1-based slot. Omitting preset_name keeps the +# preset currently assigned to the slot; providing it selects that preset for +# the slot before staging updates. +tx = orca.host.preset.filament.begin_update( + slot_number=2, + preset_name="Generic PLA" +) +tx.set("filament_flow_ratio", "0.98") +tx.set("filament_retract_length", "0.8") +result = tx.commit() + +# Process and printer default to their active presets. A caller can request a +# different preset that is selectable in the corresponding UI dropdown. +tx = orca.host.preset.process.begin_update( + preset_name="0.20mm Standard" +) +tx.set("layer_height", "0.2") +tx.commit() +``` + +The example is the API contract, and the Python bridge provides it. `begin_update()` +is synchronous: it blocks the background Script worker until the target selection and +any unsaved-edit dialog settle, then returns the bound transaction. Orca's UI thread +stays responsive because the Script capability runs on its own worker. `set()` and +`commit()` run synchronously on that same worker. The Script worker and its optional +coroutine loop are described in +[python-plugin-async-bridge.md](python-plugin-async-bridge.md). + +### Target resolution + +- **Filament:** `slot_number` identifies the slot. If `preset_name` is omitted, + the transaction targets the preset currently assigned to that slot. If supplied, + it requests that preset for the slot and selects it through the normal UI flow; + the name must be among the presets offered by that slot's dropdown, with one + exception: the preset currently assigned to the slot stays targetable even when the + slot's dropdown hides it (for example an incompatible-but-selected preset). Selecting + a different preset changes the slot-to-preset mapping. In both cases the transaction + edits the shared preset, not an isolated slot override. +- **Process and printer:** omitting `preset_name` targets the currently active + preset. Supplying `preset_name` requests the preset by the name shown in its + dropdown. It must be one of the choices the dropdown currently offers, rather + than merely any preset present in the collection. This is particularly important + for process presets, whose selectable choices can depend on the current context. +- A transaction targets exactly one preset. Multi-preset transactions are not + supported: applying them would require switching among targets while the + application has only one managed edited copy per collection. + +Targets are resolved through Orca's normal preset-selection model. The API should +not accept raw preset pointers or filesystem paths as target identities. A missing, +unavailable, or ambiguous target fails explicitly instead of silently selecting a +different preset. + +## Selection and user interaction + +`begin_update()` resolves its target through shared binding helpers +(`bind_preset_target` for process/printer, `bind_filament_target` for filament) and +performs the selection only when the requested target differs from the active target; +otherwise it returns a transaction without switching. The helpers use Orca's normal +preset selection flow, `Tab::select_preset()`, including updating a filament slot +assignment when requested. If the normal selection flow requires user input, it opens +the relevant existing dialog(s), including unsaved-edit choices such as save, discard, +or transfer. The call remains blocked on the Script worker until those interactions +finish; it returns the bound transaction, or raises on a cancellation, without +applying staged settings. A canceled selection does not change the requested target or +filament slot assignment, but it does not roll back decisions the user already accepted +in an earlier dialog. The helpers then confirm that the requested preset actually +became the edited preset; a successful selection request alone is not sufficient. There +is no separate `switch_preset` plugin API. + +If the requested target is already active, `begin_update()` returns without a +selection prompt, apart from the UI-thread dispatch needed to bind the transaction. +If a different preset is requested, Orca selects it through the normal UI flow. For +filament, this also updates the requested slot's assignment when `preset_name` +differs from its current assignment. When the current preset has unsaved changes, +the Script worker stays blocked until the user chooses among Orca's existing options, +such as transfer, discard, or cancel. + +The API never suppresses that warning, chooses an option for the user, or switches +away from dirty edits silently. Cancel aborts the operation before any staged target +changes are applied. Process and printer updates follow this rule too when the +plugin requests a different `preset_name`; they normally return immediately when +the active preset is the target. + +## Staging and commit semantics + +`set(key, value)` stages a serialized config value and does not mutate the preset. +The transaction is the boundary for a related group of changes, avoiding +intermediate partially-updated states. `commit()` runs synchronously on the background +Script worker. At commit, the API validates keys and values against the target preset +type and applies the batch through `Tab::apply_preset_config_values`, the existing tab +and settings-group update path. Existing setting-specific validation, correction, and +callbacks remain authoritative; plugin updates do not create a parallel setter with +different behavior. + +A successful commit updates dirty state and downstream configuration/Plater state +once for the batch. The edited preset remains unsaved; persistence continues through +Orca's normal save action. A validation or commit failure restores the edited preset's +config to its pre-batch state and recomputes the state derived from it (compatibility +marks, the preset selector, dependent tabs, the Plater and the printer agent), so no +staged setting is left partially applied. That guarantee is limited to the edited +preset and its config-derived state: an `on_change` callback is a GUI method, not a pure +function of the config, so the transaction does not reverse a preset or slot selection +made while resolving the target, a dialog decision the user already accepted, an undo +snapshot, a dependent preset's rewritten config, or anything already sent to a device. +Exact all-or-nothing across those external effects is not achievable while the +authoritative GUI callbacks run; the boundary is documented on +`Tab::apply_preset_config_values`. A filament slot assignment made as part of target +selection is likewise not a staged setting: after the user accepts the selection flow it +may remain changed even if a later commit fails, and the API does not switch back or +reverse the user's selection or any accepted transfer/discard decision for the previous +preset. + +## Outcomes and consistency + +The API distinguishes target resolution failures, invalid setting/value, user +cancellation, stale filament-slot mapping, and commit failure. A result identifies +the target preset, whether preset selection changed, and (for filament) whether the +slot assignment changed and which slots share the edited preset. A canceled +selection applies neither the requested slot assignment nor staged target changes; +a failed commit applies none of the staged target settings. + +Filament slot assignments can change between `begin_update()` and `commit()`. The API +detects that and rejects a stale operation instead of silently editing the new +slot assignment. It must not hold raw preset pointers across reloads. Conflicting +duplicate writes to one setting in a transaction are rejected rather than resolved +by incidental call order. + +The existing one-setting filament call, +`orca.host.preset.filament.update(slot_number, key, value)`, remains available as a +compatibility shorthand. It shares the staged API's target resolution, selection, +validation, and commit path, and it is synchronous like `begin_update()`: both block +the background Script worker while any selection dialog settles. + +## Design principles + +- **Reduce routine interaction, preserve agency.** Clean switches should be + seamless; unsaved user work must still receive the normal warning and decision. +- **One source of truth.** UI and plugins share the managed edited copy and setting + update path, including validation and callbacks. +- **The UI workflow is authoritative.** The API must enter through the same + selection and setting-change workflows as the UI, not reproduce their logic or + write config values directly. This keeps existing and future side effects active: + `on_change` handling for mutually exclusive, invalid, or out-of-range settings; + compatibility and dependent-preset updates; and printer-agent changes when the + selected printer changes. +- **Explicit target and explicit commit.** Plugins know which preset they edit and + when staged changes become visible. +- **No hidden persistence.** Plugin edits remain unsaved until the user saves them + through Orca. +- **Shared means shared.** Editing a filament preset through one slot affects every + slot assigned to it. Choosing another preset for a slot is explicit in + `preset_name`; slot-specific divergence would require a separate fork operation. +- **Consistent lifecycle, type-specific targeting.** Process, printer, and + filament share transaction and error semantics while respecting their existing + selection models. + +## Implementation in the current codebase + +The transaction API is implemented. The current plugin surface exposes `begin_update()`, +`PresetTransaction` with `set()`/`commit()`, and the per-setting `update()` compatibility +shorthand. For filament, `update_filament_slot()` resolves the preset already assigned +to a slot, selects it through `Tab::select_preset()`, and applies one setting through +`Tab::apply_preset_config_values()`; it does not change the slot assignment. + +`begin_update()` and `update()` are synchronous blocking calls +(`begin_preset_update` / `begin_filament_update`). They marshal the target binding to +the UI thread and block the background Script worker until the selection settles, so +the wait never blocks the UI thread. They are valid only on that worker, never from the +UI thread or a slicing pipeline hook. + +`Tab::select_preset()` is the basis for switching to process, printer, or filament +presets and for invoking the normal unsaved-edit flow. The flow is type-specific: a +process selection can trigger compatibility handling for filaments, and a printer +selection can involve technology changes and dependent preset compatibility. It may +therefore show more than one dialog. Cancellation of a later step does not necessarily +undo decisions the user already accepted in an earlier dialog. Target resolution +preserves those side effects and then verifies the resulting edited target. + +Filament `preset_name` is an additional integration on top of `Tab::select_preset()`: +selecting a different name for a slot also updates the slot-to-preset mapping and its +dependent UI/configuration state, mirroring the filament branch of the Plater's normal +selection path (`PresetBundle::set_filament_preset()` plus the project/selection refresh, +the dynamic filament list, the conditional support-filament flushing recalc, the slot +combo refresh and its AMS sync badge). A mixed-color virtual slot is not targetable. + +Process and printer dropdown choices are constrained by visibility and compatibility, +and compatibility may depend on the active context. Target resolution checks the tab +dropdown's actual items before the selection flow, so a target the user cannot pick +fails without raising that flow's unsaved-edit prompt; a name two entries carry is +rejected as ambiguous. A filament `preset_name` resolves against the requested slot's +own sidebar selector rather than the tab's, so that slot's compatibility filter is the +one that applies. A name the slot's dropdown does not show is rejected unless it names +that slot's current assignment (a hidden or incompatible-but-selected preset), which +stays targetable. + +`commit()` applies its batch through `Tab::apply_preset_config_values`, which parses and +validates the whole batch before touching the edited preset and restores the edited +preset and its config-derived state on failure (see "Staging and commit semantics" for +the limit of that rollback). Since `begin_update()` performs target selection before the +caller stages values, invalid staged values can still follow a user-visible selection +prompt; that is a consequence of this API shape and remains explicit in its behavior. + +## Integration boundary + +The plugin API coordinates target resolution, preset selection, staged values, and +the settings commit path. It does not own or duplicate preset dirty-state logic, +selection prompts, setting validation, or persistence. Target changes flow through +the same UI selection path so dependent behavior—such as selecting the printer +agent—still runs. Setting changes flow through the same UI change path so `on_change` +and related validation/correction behavior still runs. The integration bridges UI +prompts to the Python operation through the blocking `begin_update()` and reuses +the normal Plater slot-selection behavior for explicit filament targets, and commits a +batch without losing existing per-setting behavior. diff --git a/docs/HLSD/python-plugin-async-bridge.md b/docs/HLSD/python-plugin-async-bridge.md new file mode 100644 index 0000000000..63a22a498a --- /dev/null +++ b/docs/HLSD/python-plugin-async-bridge.md @@ -0,0 +1,351 @@ +# Python plugin async bridge — High Level Design + +## Purpose and scope + +The embedded Python plugin runtime runs most capability calls synchronously: a C++ call site acquires +the GIL and the capability's Python method runs to completion on the calling thread. The staged preset +update (`begin_update()` in [preset-plugin-api.md](preset-plugin-api.md)) is also synchronous, but +its target selection can open unsaved-edit dialogs. It therefore blocks the Script worker, not the UI +thread, and returns only when the selection settles. + +This document describes the Script capability's background execution path, including the optional +per-invocation asyncio loop for an `async def execute`, and the blocking UI marshalling that host calls +use from that worker. The bridge is deliberately narrow: only the Script capability gains a +background/async execution path. Every other capability — including the SlicingPipeline hooks — stays +synchronous on its caller's thread. + +## Execution baseline + +### How a capability call runs + +A capability instance is a Python object owned through `Slic3r::PluginInstanceHandle` +(`src/slic3r/plugin/PythonPluginBridge.cpp`) and handed to the rest of the program as a +`std::shared_ptr`. Its identity (`name()`, `type()`, +`audit_plugin_key()`) is resolved once at materialization and cached in C++ +(`PluginCapabilityInterface` in `src/slic3r/plugin/PythonPluginInterface.hpp`). + +Every C++→Python call crosses a trampoline method. `PyPluginCommonTrampoline` and +`PyPluginInterfaceTrampoline` (`src/slic3r/plugin/PyPluginTrampoline.hpp`), and the per-type subclass +`PyScriptPluginCapabilityTrampoline` +(`src/slic3r/plugin/pluginTypes/script/ScriptPluginCapabilityTrampoline.hpp`), wrap the call in the +`ORCA_PY_OVERRIDE_AUDITED` macro. For one synchronous call that macro, in order: + +1. constructs a `PluginCapabilityInterface::RefCounter`, which `increment()`s the capability's + reference count for the call's duration; +2. constructs a `PythonGILState`, which first acquires a `PythonRuntimeLease` and then + `PyGILState_Ensure()`; +3. opens a `ScopedPluginAuditContext(audit_plugin_key(), name())`; +4. dispatches into Python via `PYBIND11_OVERRIDE`/`PYBIND11_OVERRIDE_PURE`; + +and unwinds those guards when the call returns. + +`PythonGILState` and `PythonRuntimeLease` live in `src/slic3r/plugin/PythonInterpreter.hpp`. A lease is +a `shared_lock` on `PythonInterpreter::m_runtime_mutex`; `PythonInterpreter::shutdown()` takes the +exclusive side, so a thread that holds a lease can safely touch Python objects, and interpreter +finalization cannot run underneath it. `ScopedPluginAuditContext` +(`src/slic3r/plugin/PluginAuditManager.hpp`) stores the previous thread-local plugin/capability pair +and scoped filesystem roots, sets this call's, and restores them on destruction; the audit hook then +attributes every filesystem/socket/process event to the plugin currently executing on that thread. + +### The Script capability + +`Slic3r::ScriptPluginCapability` (`src/slic3r/plugin/pluginTypes/script/ScriptPluginCapability.hpp`) +declares one pure virtual method, `ExecutionResult execute()`. The async runtime invokes it through +`invoke_script_execute` (`src/slic3r/plugin/PyPluginTrampoline.hpp`), which replicates the audited +trampoline call (ref counter, audit scope, traceback-preserving rethrow) but returns a +`ScriptExecuteInvocation` instead of forcing a cast: + +- a plain `def execute` runs to completion in `invoke_script_execute` and yields + `ScriptExecuteInvocation::result`; +- an `async def execute` (or any override that returns a coroutine, detected with + `inspect.iscoroutine`) yields the coroutine object in `ScriptExecuteInvocation::awaitable` without + running it, so the runtime can drive it. + +`ScriptExecuteInvocation` is defined in `PyPluginTrampoline.hpp`; `py_is_coroutine` is the detection +helper. + +### UI marshalling + +`PluginHostUi::run_on_ui_thread` (`src/slic3r/plugin/host/PluginHostUi.cpp`) forwards to the +file-local `run_on_ui_blocking`: + +- if the caller is already on the wx main thread, it runs the callable inline after a + `py::gil_scoped_release`; +- otherwise it sets up a `std::promise`/`std::future`, releases the GIL, posts the callable with + `GUI::wxGetApp().CallAfter`, and blocks on `future.get()`. + +That is a blocking handoff: the caller's stack is parked on a thread while the UI thread runs the +callable. It is the correct primitive for the synchronous `update()`/`commit()` path and for +`reload_local_bundle`/`list_bundle_ids`, but it cannot be used by an operation that must suspend. + +### Slicing hooks + +`Print::set_slicing_pipeline_hook_fn` is installed by `src/slic3r/plugin/PluginHooks.cpp`. The hook +runs on the slicing worker thread and dispatches to `SlicingPipelinePluginCapability::execute(ctx)` +per capability, acquiring a `PythonGILState` per capability. `SlicingPipelineContext` +(`SlicingPipelinePluginCapability.hpp`) holds raw pointers into the live slicing graph +(`ctx.print`, `ctx.object`) that are valid only for the duration of `execute(ctx)`. The UI thread can +be blocked waiting on the slicing worker (`BackgroundSlicingProcess::stop()` parks it), so a +marshalled UI call from a hook can deadlock; `PluginHostSlicing.cpp`, `SlicingPipelinePluginCapability.hpp` +and `PluginHostUi.hpp` all document this. + +## Script-only async execution + +### Per-invocation worker and loop + +`ScriptAsyncRuntime` (declared in `src/slic3r/plugin/PluginManager.hpp`, implemented in +`PluginManager.cpp`) drives every Script invocation off the caller's thread. Its `start()` creates a +`Run` and launches a detached worker thread that runs `Impl::run_invocation`. There is one worker +thread per invocation, so no invocation ever blocks the UI thread and no invocation is queued behind +another plugin's. + +`run_invocation` runs detection and execution on the worker: + +- it re-checks `cancel_requested` before anything (a cancellation that arrived before the run + started is honored without running the plugin); +- it calls `invoke_script_execute`; a plain `def execute` result is used directly, and an `async def` + coroutine is driven on a loop created for that invocation: + `asyncio.new_event_loop()` → `asyncio.set_event_loop(loop)` → `loop.create_task(coroutine)` → + `loop.run_until_complete(task)` → `loop.close()`, then `asyncio.set_event_loop(None)`. + +The loop is per invocation, not global, and no loop outlives its invocation. The loop for the +calling thread is published in the thread-local `tl_script_loop` and exposed through +`ScriptAsyncRuntime::current_loop()` (GIL held). A host call such as `begin_update()` does not suspend +the loop: it blocks the worker thread while the UI settles, then returns a value the coroutine uses +directly. + +`PluginManager::launch_script_capability` is the entry point: it resolves the capability, hands it to +`ScriptAsyncRuntime::start`, and sets `ScriptLaunchResult::launched_async`. The completion callback +runs on the GUI thread (or inline when there is no wx app), and `launch_script_capability` records a +run error through `set_plugin_error` before invoking the caller's `ScriptCompletionFn`. +`PluginManager::run_script_capability` is kept as a compatibility wrapper: it waits for the +completion callback, pumping `wxYield()` when it is itself on the GUI thread, and returns the +`ExecutionResult`. + +### Capability, runtime, GIL and audit lifetime across a suspension + +For the whole invocation — including an `async def` suspended at an `await` — `run_invocation` holds: + +- a `PluginCapabilityInterface::RefCounter` per invocation and a `shared_ptr` to the capability in the + `Run`, so the capability and its module stay alive across awaits and unload cannot drop them; +- a `PythonRuntimeLease` (acquired before the GIL). `PythonInterpreter::shutdown()` cannot finalize + the interpreter while any invocation worker holds a lease; +- the GIL, acquired with `pybind11::gil_scoped_acquire` on the worker; +- a `ScopedPluginAuditContext(audit_plugin_key(), name())`, so filesystem/socket/process events + raised by the coroutine are attributed to the plugin. + +The capability reference is released inside the GIL scope (`run->capability.reset()`), because +dropping the pybind holder from a non-Python thread would `DECREF` without the GIL. The loop is +closed and `tl_script_loop` cleared before the worker exits. + +A consequence of running Script on a non-main thread: the audit permission prompt is fail-closed off +the main thread. `request_permission` in `src/slic3r/plugin/PluginAuditManager.cpp` posts the dialog +with `CallAfter` and denies the current event, persisting the grant when the user accepts, so a +Script sees a denial on the first attempt and can succeed on a later one. This matches the existing +behavior for the plugin-load worker and the slicing worker. + +### Blocking UI continuation + +`PluginHostUi::run_on_ui_thread` (in `src/slic3r/plugin/host/PluginHostUi.cpp`) is the primitive host +calls use from the Script worker. It forwards to `run_on_ui_blocking`: + +- if the caller is already on the wx main thread, it runs the callable inline after a + `py::gil_scoped_release`; +- otherwise it sets up a `std::promise`/`std::future`, releases the GIL, posts the callable with + `GUI::wxGetApp().CallAfter`, and blocks on `future.get()`. + +Because the Script capability owns a worker thread, blocking there does not freeze the UI. The same +primitive is used by `begin_update()`, `set()`/`commit()`, `reload_local_bundle()` and +`list_bundle_ids()`. + +### Synchronous `begin_update()` + +`begin_preset_update` and `begin_filament_update` (`src/slic3r/plugin/host/PluginHostPresets.cpp`) run +on the Script worker with the GIL held and block it: + +1. the binding enters through `PluginHostUi::run_on_ui_thread`, which fails with a `RuntimeError` + before posting when there is no wx application; +2. the UI thread runs the target binding with the GIL released — `bind_preset_target` for + process/printer, `bind_filament_target` for filament — including `Tab::select_preset()` and any + unsaved-edit prompt; +3. the worker resumes with the name-based `PresetTransaction`, and nothing is staged until the + caller's later `set()`/`commit()`. + +An unavailable target is rejected before selection and changes no preset. A selection the user +declines raises `RuntimeError` and creates no transaction; decisions already accepted in an earlier +dialog are not rolled back. No GUI or preset pointer outlives the call: the transaction holds only +copied category/name/slot values. + +`set()` stages a serialized value without mutating the preset, and `commit()` applies the batch +through `Tab::apply_preset_config_values` on the UI thread. Both are synchronous and, per their +bindings, valid only on the background Script worker. + +### Cancellation + +`ScriptAsyncRuntime::cancel_plugin(plugin_key)` sets `cancel_requested` on every active run for the +plugin and, when a loop is live (`has_loop`), cancels the task with +`loop.call_soon_threadsafe(task.cancel)` while holding the GIL. A synchronous `def execute` +invocation has no loop, so only the flag is set (checked before the run starts). + +A task cancellation cannot interrupt a blocking `begin_update()` native call: the worker is inside +that call, so the loop does not run the scheduled `task.cancel()` until the selection settles and the +call returns. The transaction is therefore delivered, and any accepted UI selection stands; the +cancellation is observed at the coroutine's next suspension point. A user-declined selection is an +ordinary `RuntimeError`, not `asyncio.CancelledError`. + +A plugin's own `asyncio.CancelledError` is treated as a cancellation only when `cancel_requested` was +set; otherwise it stays a genuine error (see `run_invocation`), so a plugin that cancels its own task +does not masquerade as an unload cancellation. + +### Unload and shutdown drain + +Unloading or shutting down must guarantee that no plugin Python code runs after its module is +unloaded, and that a blocking UI selection cannot mutate presets after teardown. + +- `PluginManager::cancel_and_wait_for_capabilities` calls `on_cancelled()` first (so the plugin can + observe state while the run is intact), then `ScriptAsyncRuntime::cancel_plugin`, then drains. + The drain is **unbounded while a Script invocation worker is outstanding** — its loop-exit + condition is `all_released && !invocation_active`. `has_active_run()` distinguishes a run that was + cancelled before it started from one whose worker is still live, and a worker blocked in + `begin_update()` keeps the run active until its UI callback returns. On the GUI thread the drain + pumps `wxYield()` so a modal selection can settle instead of being starved by the blocking wait. + Only the non-Script path keeps the historical bounded 2-second grace: when no invocation is active, + the drain stops waiting for capability references at the grace deadline and logs any remaining + ones. +- `PluginManager::shutdown` detaches the libslic3r hooks (`plugin_hooks::uninstall`), stops new + loads, waits for in-flight loads, unloads every plugin (draining the async runs above), then calls + `ScriptAsyncRuntime::instance().shutdown()`, which refuses new runs and waits without a deadline + for every invocation worker to finish — nothing is torn down by force. `ScriptAsyncRuntime::reset()` + re-arms the runtime so a later `initialize()` in the same process can start runs again. + +Cancellation triggered by unload or shutdown is a separate, expected completion, not a plugin +failure. `run_invocation` marks a run whose `cancel_requested` was set as `completion.cancelled` and +clears any error, whatever the coroutine body did. `launch_script_capability` records a plugin error +only when `!completion.cancelled && !completion.error.empty()`; `run_script_capability` reports an +empty error for a cancelled completion; and the two GUI launchers treat `cancelled` as neither error +nor success (the speed dial stays silent, the Plugins dialog updates no status). A plugin's own +`CancelledError` is not counted as this expected termination unless `cancel_requested` is set, so a +self-cancelled plugin still records its failure. + +## Supported and unsupported capabilities + +| Capability | Async support | Reason | +| --- | --- | --- | +| Script | `def execute` and `async def execute` both run on the per-invocation worker | The runtime owns the worker and, for a coroutine, a per-invocation loop; nothing about a Script invocation borrows C++ state. | +| SlicingPipeline | Synchronous only | `execute(ctx)` borrows `Print`/`PrintObject` for the callback's duration, and the UI thread can be blocked on the slicing worker. `PluginHooks.cpp` rejects an async override: `cap->execute()` casts its Python result to `ExecutionResult`, and a coroutine object cannot be cast, so it surfaces as a `SlicingError` rather than being scheduled. | +| PrinterConnection, Pages, Analysis, Importer, Exporter, Visualization, ResourceTexture | Unchanged | Not part of this bridge; they keep their existing synchronous contract. | + +## Deadlock constraints + +- **Never block the UI thread on plugin work.** Every Script launch path goes through + `launch_script_capability`; the speed-dial `ActionRegistry` action and the Plugins dialog launcher + return immediately and report the outcome later (see Examples). +- **Never call `orca.host.ui.*` from a slicing hook.** The slicing worker runs while the UI thread + can be parked on it. +- **Marshal host UI work from the Script worker only.** `PluginHostUi::run_on_ui_thread` blocks the + calling worker while the UI thread runs the callback; calling it from the UI thread itself would + deadlock the marshalling path. +- **No pointer crosses a call boundary.** `begin_update()` returns copied category/name/slot values; + the `SlicingPipelineContext` graph is valid only within one synchronous `execute(ctx)`. + +## File and symbol map + +Script execution runtime: + +- `src/slic3r/plugin/PluginManager.hpp` / `.cpp` — `ScriptAsyncRuntime` (`instance`, `start`, + `cancel_plugin`, `has_active_run`, `shutdown`, `reset`, `current_loop`), `ScriptCompletion`, + `ScriptCompletionFn`, `ScriptLaunchResult`, `launch_script_capability`, `run_script_capability`. +- `src/slic3r/plugin/PyPluginTrampoline.hpp` — `invoke_script_execute`, `ScriptExecuteInvocation`, + `py_is_coroutine`. +- `src/slic3r/plugin/pluginTypes/script/ScriptPluginCapability.hpp` / `ScriptPluginCapabilityTrampoline.hpp` + — `ScriptPluginCapability::execute`, `PyScriptPluginCapabilityTrampoline`. + +Lifetime and GIL primitives: + +- `src/slic3r/plugin/PythonInterpreter.hpp` — `PythonInterpreter`, `PythonRuntimeLease`, + `PythonGILState`. +- `src/slic3r/plugin/PythonPluginInterface.hpp` — `PluginCapabilityInterface`, `RefCounter`, + `increment`/`decrement`/`ref_count`. +- `src/slic3r/plugin/PluginAuditManager.hpp` / `.cpp` — `ScopedPluginAuditContext`, + `request_filesystem_read_permissions`, `request_permission` (fail-closed off the main thread). + +UI marshalling: + +- `src/slic3r/plugin/host/PluginHostUi.hpp` / `.cpp` — `PluginHostUi::run_on_ui_thread`, the + file-local `run_on_ui_blocking`, and `close_windows_for_plugin`. +- `GUI::wxGetApp().CallAfter` — the post-to-UI-thread primitive. + +Preset targets: + +- `src/slic3r/plugin/host/PluginHostPresets.cpp` — `PresetEditor`, `PresetTransaction`, + `bind_preset_target`, `bind_filament_target`, `begin_preset_update`, `begin_filament_update`, + `SelectionCancelled`, `resolve_combo_preset`/`resolve_preset_in_combo`. +- `src/slic3r/GUI/Tab.hpp` / `.cpp` — `Tab::select_preset`, `Tab::apply_preset_config_values`, + `Tab::commit_preset_config_value`. + +Launch paths: + +- `src/slic3r/GUI/ActionRegistry.cpp` — `PluginScriptAction::run`, `notify_script_outcome`. +- `src/slic3r/GUI/PluginsDialog.cpp` — `PluginsDialog::run_script_plugin_capability`. + +Slicing (synchronous only): + +- `src/slic3r/plugin/PluginHooks.cpp` — `install_slicing_pipeline_hook`. +- `src/slic3r/plugin/pluginTypes/slicingPipeline/SlicingPipelinePluginCapability.hpp` — + `SlicingPipelineContext`, `execute`. + +Unload/shutdown: + +- `src/slic3r/plugin/PluginManager.cpp` — `unload_plugin`, `unload_all_plugins`, + `cancel_and_wait_for_capabilities`, `shutdown`. + +## Examples + +An `async def execute` that updates a preset. `execute` runs on the background Script worker with its +own asyncio loop; `begin_update()` blocks that worker until any selection / unsaved-edit dialog is +answered, without blocking the UI thread; `set()`/`commit()` then run synchronously on the same +worker. This is the shape used by `sandboxes/orca_preset_transaction_demo.py`: + +```python +import asyncio + +import orca + + +class AutoTune(orca.script.ScriptPluginCapabilityBase): + def get_name(self): + return "Auto tune" + + async def execute(self): + # begin_update() blocks this worker until the user answers any + # selection / unsaved-edit dialog. The UI thread stays responsive. + tx = orca.host.preset.process.begin_update(preset_name="0.20mm Standard") + tx.set("layer_height", "0.2") + tx.commit() + return orca.ExecutionResult.success("process preset updated") +``` + +The window-driven demo shows the same pattern where the plugin's own UI must hand work to the worker: +`on_message` fires on the UI thread and only enqueues onto the worker loop with +`loop.call_soon_threadsafe`; `execute` consumes that queue and calls `begin_update()` per command. + +Sequence for one `begin_update(...)`: + +```text +Script worker (owned, per invocation) UI thread + loop.run_until_complete(task) + begin_update() ───────────────────────► CallAfter(run_on_ui_blocking) + (blocked; not suspended) bind_*_target → + Tab::select_preset() … dialog + settles + promise set; worker resumes with PresetTransaction + set(); commit() (UI thread for the batch) + coroutine resumes at its next await + execute() returns ExecutionResult +``` + +A plain `def execute` needs no loop and runs to completion on the same worker; both kinds are +launched with `launch_script_capability`, so the caller (UI thread) never blocks. A launch failure is +reported inline; a started run reports its outcome through the completion callback — the speed dial +shows "started" and pushes a completion notification, and the Plugins dialog updates its status when +`finish` runs. diff --git a/docs/HLSD/seam-alignment.md b/docs/HLSD/seam-alignment.md new file mode 100644 index 0000000000..8dfbda1a2f --- /dev/null +++ b/docs/HLSD/seam-alignment.md @@ -0,0 +1,280 @@ +# Seam alignment on the loop — High Level Design + +## Purpose and scope + +SeamPlacer selects candidates, connects neighboring layers into strings, fits each string and +places the resulting seam on its own contour. Painted ranges are reconstructed separately for +green enforcers and red blockers. These stages do not alter candidate ranking. +String construction and fitting apply to Aligned, Aligned Back and Back (`spRear`). +Nearest and Random bypass this stage, but share the paint reconstruction rules. + +## Concepts + +- **Candidate (C).** The seam candidate chosen for a perimeter in a string. Candidates are the + polygon vertices plus points inserted near paint (see Painted ranges), so the chosen candidate + can move in discrete steps from layer to layer. +- **Fitted point (F).** The value of the string's fitted curve at the layer height. It need not + lie on the loop: where the loop size changes quickly between layers, as near the bottom of a + sphere, it lies up to a few millimeters off it. +- **Measured angle.** `local_ccw_angle` of a candidate. It is measured at polygon vertices on arms + at least one nozzle diameter long; inserted points have angle 0. +- **Blend.** `target = t·C + (1 − t)·F`. The angle weight `t = min(1, (|angle C| / 55°)^3)` pulls + the seam onto sharp corners; at 55° and above the seam is the candidate itself. +- **Enforced run.** The maximal sequence of consecutive Enforced candidates of the perimeter that + contains C, or the whole loop when every candidate is Enforced. With exact painted ranges it + follows its geometric bounds and surface proximity; otherwise it approximates the painted area with the candidate spacing. + +## Painted ranges + +The paint is a set of small triangles on the model surface. Its **contour** is the set of their +edges that belong to one painted triangle only, taken from the painted triangles with their T-joints +split (`get_facets_strict`), so that edges inside the painted area pair up. Each contour edge keeps +the direction from it into the paint. The contour is built once per object and stored in an AABB +tree. + +Green and red paint use separate instances of the same contour and interval reconstruction. +An interval bounds paint membership but does not establish it: every classified candidate must +also lie within one line width of a triangle of the corresponding paint. A contour can leave the +painted surface between projected endpoints, especially at concavities and nearby surface folds. +The same proximity check used by the fallback prevents such a detour from acquiring synthetic +paint; exact interval bounds still exclude the fringe beyond the projected ends. +Red ranges classify candidates as Blocked, including the boundary itself (1 µm membership +tolerance), overriding green paint at an overlap. Inserted samples include both red ends, a +range midpoint, a gap midpoint and permitted guard samples up to 2 µm outside the red ends. +The guard distance is reduced to one quarter of a shorter gap; gaps at or below the membership +tolerance can remain closed. Candidate marks closer than 1 µm merge. +These adjacent permitted samples limit fitted and optimized movement to the geometric red +edge, with the small outward guard, rather than to a distant original gray vertex. Red ranges add +no penalty and do not change candidate ranking. Precise Seam modifiers apply after paint +classification and take priority over it. + +Random placement samples an outgoing edge of its selected candidate. On loops with exact +green ranges, an Enforced candidate followed by a non-Enforced candidate contributes no outgoing +edge length: the endpoint belongs to the paint, but the following segment leaves the permitted run. +This also respects weak modifiers that retype part of a painted run as Blocked or Neutral. +On loops with exact red ranges, a permitted candidate followed by a Blocked candidate contributes no outgoing +edge length, so Random cannot sample toward the closed red boundary. A zero-length selected +edge keeps the candidate position. +The cumulative-length selection stops at the last viable edge and clamps its +remaining distance to that edge, preventing float rounding from overrunning the +candidate list or the permitted segment. + +Exact green and red ends bound the seam center position without expanding the painted range +along the contour by the line width. A seam can therefore reach a red edge with no line-width +clearance. Paint can be extended to request a larger clearance; the boundary does not +guarantee that the finite-width extrusion or a seam blemish stays entirely outside red paint. + +If boundary crossings cannot be paired, the corresponding color falls back to the line-width +proximity classification, including its possible fringe beyond the paint edge. The fallback is +independent for each color and loop. For red this includes paint not crossing the layer, +ambiguous contours and a completely red surface without boundary crossings. In the all-blocked case +best-effort placement still produces a seam; red paint does not suppress extrusion. +An exact red reconstruction does not suppress proximity-based green oversampling when green +boundaries remain uncertain. + +On a layer, the contour edges crossing the slicing plane give the exact ends of the painted band. +Each crossing within the line width of the loop is moved to its closest loop point; the direction +into the paint, against the loop direction there, tells whether paint lies ahead or behind. At a +vertex the loop direction is the mean of the two edges, skipping edges shorter than 1 µm such as +the repeated closing point and the shared ends of extrusion paths, so the result does not depend on +where the loop starts. Along the loop, ends where paint begins and ends must alternate; each +pair bounds a **painted range**. Such a loop has **exact ends**: + +- a vertex is Enforced if it lies in a range (within 1 µm); +- points are inserted at the range ends, at the range middle and every 0.2 mm from the range begin, + and one in the middle of each gap between ranges, so that ranges with no vertex between them stay + separate patches; +- the central candidate of the longest patch is the middle of its range, unless the patch has a + sharp corner, which keeps priority. + +Before generating candidates, a fully painted closed surface is treated like an unpainted surface: +it imposes no choice of seam position. A loop on a partly painted object can also be normalized when +there are no exact range ends, no active Precise Seam modifier, no non-green facet bounding box in +the loop's XY box expanded by line width and its Z slab of the same reach, and every entire loop edge +is proven within paint reach. Neutral and blocked facets both prevent this local proof. Segment +coverage uses the triangle inequality at its midpoint and at most eight bisections; failure retains +the ordinary conservative paint treatment. This is a sufficient test, not a claim to recognize every +fully covered contour near unrelated surfaces. + +A normalized loop keeps the original candidates, without paint oversampling, Enforced status, +central enforcer, extra fitting or positional weights, painted-corner blending or paint fixation. Sharp-angle and Precise Seam rules remain authoritative. Whole-surface painting and no +painting therefore feed identical candidates into alignment. + +Otherwise, which includes paint not crossing the layer (a dot between layers, the top and bottom of +a band), ends that do not alternate and a contour running along the +loop, a point is Enforced if paint lies within the line width of it, and edges near paint get points +every 0.2 mm from their start vertex. Such a run reaches past the paint by up to the line width, +depending on the vertices, and its central candidate is the middle one by count; on a smooth band +both shift the seam off the middle of the paint. + +## Seam strings + +A string starts at a seam and is extended upward layer by layer while the next layer has a seam +within reach. After the upward search ends, the downward search begins at the layer immediately +below the start. This keeps a matching neighboring seam in the same aligned string. + +## Geometric contour continuation + +Seam strings resolve the next layer's boundary before comparing seam preferences. +Each perimeter retains whether it bounds material or a hole, its layer-local index, +and immutable candidate geometry. Occupancy does not participate in correspondence: the radius search skips occupied +members of the permitted set without expanding it to unrelated walls. + +Each layer builds an AABB tree of contour bounds once. Nearby-contour queries, +fast bounds matching, material containment and boundary proximity use this index +before applying their exact predicates. Query results are sorted by the +original contour index, preserving deterministic tie-breaking. Index construction +checks cancellation between layers. The index avoids scanning unrelated contours +for each seed; overlapping global bounds can still require many exact checks. + +Only closed extrusion loops provide a reliable boundary role. Open paths and +collection fallbacks retain unknown geometry rather than deriving a physical role +from an artificial closing edge. An unknown source, or an unknown path whose +bounding box intersects the local query box in either layer, leaves the radius +search unrestricted. This conservative box test also covers the material probes; +it may disable the filter even when the path's segments are farther away. +Reverse confirmation applies only to candidates that pass the applicable distance +and normal checks, plus material checks on the local path outside the noise band. +Unknown geometry encountered around such a candidate's foot during reverse confirmation +also leaves the entire radius search unrestricted, rather than discarding only +that candidate. A reliable reverse rejection still excludes the candidate. +Unknown paths outside these query boxes do not disable reliable correspondence. + +Bounding-box extents within one nozzle diameter plus a quarter-diameter reserve +identify a potential fast match of the same boundary type. Acceptance also requires +a closest segment within one eighth of the source line width, consistent air-facing +normals, no competing near-coincident local boundary, and a reverse set containing +the source. Thus the inexpensive path certifies only a near-coincident wall, rather +than treating global bounds and the full search radius as sufficient evidence. + +The fallback uses the caller's KD search radius, normally four seed-line widths, +for nearby boundaries of either type. With unchanged boundary type it finds the +nearest segment whose air-facing normal is compatible with the source, so the +opposite side of a thin contour cannot hide its facing side. Across a type change +the closest patch itself must agree; choosing another side can confuse translated annuli. +An open exterior wall can become a hole when a slit closes; boundary type alone +cannot reject that physical continuation. It checks air-facing +normals within 60 degrees and samples the connector between closest boundary points. +Away from boundary noise, the connector must lie in material of exactly one adjacent +layer, representing a swept wall rather than a crossing through shared material or +air. Three samples are a bounded heuristic, not a topological proof. + +Each local candidate must map back to a set containing the source boundary. A candidate +is discarded only if another has both a distance advantage of at least a quarter of +the source line width and a normal-angle advantage of at least five degrees. Equal or +conflicting criteria retain multiple candidates; seam preferences choose within +this set. Air-facing normals and material checks distinguish wall sides without imposing +an invariant exterior/hole label across topology changes. They are geometric gates, +not numerical preference weights. + +If no geometric candidate survives, the radius search is left unrestricted. Continuation +then follows seam preferences alone and can switch walls where geometry cannot resolve +the case. A nonempty geometric set is never +expanded because its contours are occupied or fail later seam preference checks. + +Correspondence queries are cached per source vertex, direction and search radius +for alternative string starts. Geometry construction and the seed loop check +cancellation to keep large multi-island objects interruptible. Correspondence does not alter candidate +preference weights or their tolerance. + +## Final position + +For each member of a string: + +1. **Sharp candidate** (`t = 1`): the seam is C. This is the cheapest check and comes first. +2. **Painted corner pull** (Enforced C only): `t = max(t, 0.4·k)` with the corner influence + `k ∈ [0, 1]` below. Retaining the pull near measured corners protects corners; fading it on + smooth contours reduces transmission of discrete candidate steps into the seam. If C's own angle + reaches `A1`, `k = 1` without a search. +3. **Place on the loop.** The target is mapped onto the loop, within the allowed arc around C. + +### Corner influence + +`k` is the largest contribution `a_j · w_j` among candidates `j` of the same perimeter within `R1` +of C along the loop, `d_j` being the distance along the loop: + +- `a_j` rises smoothly from 0 at a measured angle of `A0` to 1 at `A1`, so weak bends count partly + and smooth contours not at all; +- `w_j` is 1 up to `R0` and falls smoothly to 0 at `R1`, so a corner entering or leaving the + neighborhood does not switch `t` abruptly. + +`R0` is the larger of the perimeter's line width and the largest configured nozzle diameter: the +measured angle of a vertex reflects geometry within at least one nozzle diameter, so a candidate +inserted next to a corner usually still sees that corner. Within `R0` of a corner of at least +`A1`, `t` and the target are the same as with a fixed minimum of 0.4. + +### Placing the target on the loop + +The target is generally off the loop. Its closest loop point is a polygon vertex over a whole range +of target positions, so it snaps to vertices and steps between layers when the vertices differ from +layer to layer. + +Instead the loop gets a continuous normal field. Each vertex has the normalized sum of the normals +of its two edges, taken to the nearest points at a different position, so that duplicated points +(shared ends of extrusion paths, a repeated closing point) get one normal. Along an edge the normal +blends linearly between its vertex normals. A **solution** is a loop point whose normal line passes +through the target; on each edge this is a quadratic equation in the edge parameter. + +The seam is the solution closest to the target over the whole loop. If it lies outside the allowed +arc, the seam is the end of that arc closer to the solution, so a solution leaving the arc stays at +the end it leaves through. Without any solution, which takes a degenerate loop, the seam is C. + +The search walks outward from C on both sides, the shorter walked side first. An edge farther from +the target than the best solution so far is skipped without solving. + +Properties: + +- On a regular polygon every normal line passes through the center. For a target other than the + center, the closest solution is the nearer of the two intersections of the loop with the line + through the center and the target, wherever the vertices are; the seam equals it when it lies + inside the allowed arc. With an even number of vertices the two intersections are symmetric about + the center, so the nearer one is on the ray from the center through the target. +- When the closest solution is unique and lies inside the allowed arc, the result depends on the + target and that arc only, not on which candidate inside the arc was chosen. A candidate step + therefore does not pass into the seam directly. At an exact distance tie, the first solution found + from C is kept. +- A selected solution varies continuously while its root branch remains nondegenerate, and so does + the seam when the solution leaves or enters the allowed arc. The seam may jump when the closest + solution changes (two solutions equally close, or the closest one disappearing together with + another where the target crosses the curve of centers of the normal field), or when a solution + outside the arc becomes equally close to both arc ends. Changes of the candidate types between + layers change the allowed arc. + +### Allowed arc + +- For an Enforced C on a loop with exact ends: the Enforced run itself, which ends at the paint. +- For another Enforced C: the Enforced run, extended past each open end by the oversampling distance + (0.2 mm) but never into a Blocked candidate. The run ends sit on candidates and move in sampling + steps between layers, and Rear tends to choose the candidate right at an end; without the + extension a target just past an end would copy those steps into the seam. +- For another C: the part of the loop between the Blocked candidates around it. +- For a Blocked C, or a loop with no limiting candidate: the whole loop. + +## Numerical constants + +| Constant | Value | Meaning | +| --- | --- | --- | +| Blend minimum near corners | 0.4 | Pull toward C on a painted corner | +| `A0`, `A1` | 15°, 30° | Measured angle where corner contribution starts and becomes full | +| `R0` | max(line width, largest nozzle diameter); 0.5 mm if both are zero | Full corner protection along the loop | +| `R1` | 2·`R0` | Corner influence ends | +| Run extension | 0.2 mm (`enforcer_oversampling_distance`); 0 with exact ends | How far the seam may go past an end of the Enforced run | +| Painted range tolerance | 1 µm (`enforced_end_tolerance`) | Loop positions this close are one point | +| Range end reach | line width | How far from the loop a contour crossing may lie | +| Coverage proof depth | 8 bisections per edge | Finite conservative proof for complete paint on a partly painted object | +| Solver threshold | 1e-12 | Absolute threshold on the equation coefficients that tells degenerate equations apart; not a distance tolerance | + +## Constraints + +Strong Precise Seam coordinates remain immutable. Angles of at least 55 degrees retain the +selected candidate. Ambiguous paint boundaries use the proximity fallback; an entirely +blocked perimeter still needs a printed seam. Mesh topology and candidate sampling can change +which first-approximation string is selected. Painting a verified complete perimeter introduces +no artificial center preference. + +## Implementation and verification + +`SeamPlacer.cpp` implements paint reconstruction, candidate selection, string traversal, fitting +and contour placement. `test_seam_placer.cpp` covers geometry, paint, string traversal and strong +Precise Seam invariants. `tests/libslic3r/test_seam_contour.cpp` independently checks +geometric correspondence, ambiguity and search-radius behavior. diff --git a/docs/HLSD/translucent-filaments.md b/docs/HLSD/translucent-filaments.md new file mode 100644 index 0000000000..a72d058221 --- /dev/null +++ b/docs/HLSD/translucent-filaments.md @@ -0,0 +1,159 @@ +# Translucent filaments + +## Purpose + +A filament color can carry an opacity (`#RRGGBBAA`, see [color-picker.md](color-picker.md)). Prepare +draws the parts of such a filament see-through, and Preview their toolpaths, so the inside of a +translucent part and whatever lies behind it show through. Both tabs aim at the same look: the +opacity of the plastic the view ray crosses, matte without realistic view and glossy with it. + +## Where the opacity applies + +- Only the views that color toolpaths by filament: Filament, Summary and Tool. The other views + color by feature or by a value, and stay opaque. +- Only extrusions. Travels, wipes and option markers stay opaque, and so do the layers that hold a + pause or a custom G-code, which these views draw grey. +- A filament keeps its color down to 10% opacity, the floor `adjust_color_for_rendering()` gives it in + Prepare too, so that a fully clear filament is still drawn. A near-black filament is lifted to a grey + that rises with its transparency: a dark translucent surface shows nothing through itself, so without + the lift its layers blend into one flat black. +- The "Translucent filaments" preference (`preview_translucent_filaments`, on by default) turns all + of it off: every filament is then drawn opaque, the legend swatches included. It applies to the + loaded preview at once, through `Viewer::set_translucent_filaments()`. +- The legend swatches carry the same opacity, drawn over the white and grey checkerboard of the + sidebar's clear filament swatch so that they read on the dark legend. +- The opacity is that of 0.4 mm of the filament. Each translucent segment raises it to the length + of the view ray through the centre of its diamond section, `1 - (1 - a)^(path / 0.4)`, so thin + layers stacked under the camera add up as one thick layer would, and a wall seen side on keeps + about the filament's opacity whatever the layer height. + +## Data + +`libvgcode::convert_filament_colors()` decodes the filament color strings into a +`libvgcode::PaletteWithAlpha`. libvgcode keeps one RGBA8 color per vertex, in a `GL_RGBA8` texture +buffer, or in RGBA8 2D textures on OpenGL ES. The color depends on the view type, while the alpha +comes from the filament alone. The viewer also notes whether any vertex is translucent. + +## Rendering + +A segment takes the alpha of its first vertex. While any vertex is translucent, +`update_enabled_entities()` sorts the enabled segments by opacity, the opaque ones first, keeping +the print order within each group; on OpenGL ES, each texture of the list is sorted on its own. +Each pass draws its own group, from an offset into the list. Without a translucent vertex, the list +is not sorted and the second pass is skipped, so the first draws exactly what it drew before. + +1. The opaque segments, with depth writes. +2. The option markers. +3. The translucent segments, in premultiplied color blended with `GL_ONE, GL_ONE_MINUS_SRC_ALPHA`, + depth tested but without depth writes. Opaque toolpaths and objects hide the translucent ones + behind them, and a translucent segment hides nothing. Drawing the markers first keeps those + inside a translucent part behind its surface, instead of on top of it. + +`Viewer::render()` draws the first two; `Viewer::render_translucent()` draws the third, which +`GLCanvas3D::_render_gcode_translucent()` calls after the SSAO pass. Drawn that late, the pass turns the +depth test on itself, as the passes before it may leave it off. The occlusion that pass reads +from depth would otherwise shade a translucent surface as the surface behind it, as it would the +centre of mass marker. FXAA still comes after. The sequential view markers and the IDEX/IQEX +toolhead boxes, which `GCodeViewer::render_scene()` draws after the toolpaths, are translucent but +write depth, so while there are translucent toolpaths they wait for them, in +`GCodeViewer::render_translucent_toolpaths()`. Drawn before, they would hide the translucent toolpaths +behind them, and the print would show a hole around the tool position. + +A translucent segment takes its diffuse light in its own color, scaled by its opacity. In +realistic view, whatever its other options, with its "Glossy toolpaths" setting on, every segment, +opaque or translucent, takes instead of the tinted highlight of the default shading an untinted one +computed per fragment, not scaled by the opacity, so that the filaments look alike and a clear one +keeps its gloss instead of fading into the background. `GLCanvas3D::_render_gcode()` switches it +with `Viewer::set_gloss()`. Without realistic view, or with the setting off, a translucent filament +is matte and an opaque one keeps the default shading. The +highlight takes the normal of the rounded extrusion a segment stands for, an ellipse of its height +and width around its centre line, rather than that of its facets: it then runs smoothly across a +joint, where the facets of two segments would catch it apart, and it fades out towards the tip of a +path end, whose normal runs along the extrusion. There +is no Fresnel term: an extrusion seen end-on would turn into a bright opaque stripe. + +Each segment reaches half a line width past its ends, to fill the outside of a turn or round off a +path end, so two segments of a path overlap at their joint. Depth hides that between opaque ones, +but blending would draw the joint twice, and the highlight of realistic view shows the caps sticking +out of an opaque one. A translucent segment, and a glossy one, is therefore cut in the fragment +shader at the bisector plane of each joint of its path, keeping 0.02 mm past it: the +faces each segment turns to the camera do not quite meet without their caps. A vertex where two +segments of a path meet carries 0.5 on top of its layer in the w of its position, which the shaders +otherwise read as an int. That includes the joints across the vertex repeated in place that starts +a new path wherever the flow, acceleration or jerk changes (`starts_path()` in +`LibVGCodeWrapper.cpp`), which real G-code has at most of its joints: the shader then takes the +neighbour one vertex further, and the caps the angle of the joint, which the vertex data leaves at 0 +there. + +The translucent segments are not sorted by depth. The opaque pass draws the last printed segments +first when looking down, to cut overdraw. The direct translucent pass, which only some cases fall +back to (see below), draws them the other way round, so the farthest layers blend first. + +## Order independent blending + +Blended in print order, the order shows even with a single translucent color, since its surfaces are +shaded apart. A layer's infill, printed after its walls, blends over the walls in front of it: seen +from the side, the dark bridge under a deck draws a sawtooth over the hull's outer wall, as if a piece +of it were missing. So on desktop OpenGL the translucent segments blend order independently, in +`ViewerImpl::render_translucent_segments()`. The nearest +translucent surface of each pixel is drawn over a weighted blended order independent transparency +(McGuire and Bavoil, 2013) of the others. The mean alone would not do: the walls of a painted object +lie a fraction of a millimetre apart, so its depth weights barely differ, and the more opaque and more +numerous surfaces of one filament would hide the other filament's outer wall in front of them. + +1. The depth of the scene drawn so far is copied into a texture. The fragment shader discards a + translucent fragment behind it, as there is no depth buffer to test against. +2. The translucent segments are drawn once into an `R32F` target cleared to 1, keeping with `GL_MIN` + the `gl_FragCoord.z` of the nearest. The segments shaders draw it built with `DEPTH_ONLY`, the same + geometry and joint cut without the shading and its varyings, so the nearest fragment of the next + pass finds its own depth there exactly. +3. They are drawn again. The nearest fragment of a pixel goes, premultiplied, to an `RGBA16F` target + of its own. Every other one adds its premultiplied color, times a weight, to an `RGBA16F` target, + and `-log(1 - alpha)` to an `R16F` target, with `GL_ONE, GL_ONE`. The weight is the opacity times + `max((1 - z)^3, 0.01)`, z being the depth across the extrusions' bounding box, so nearer surfaces + count more. Its ceiling keeps thousands of stacked surfaces within half float range, and its floor + keeps far ones out of the subnormals. A translucent segment's opacity stays below 1, else the + shader would take it for an opaque one and add it unweighted. +4. A full screen pass draws the nearest surface over the weighted mean color of the others, with + their coverage `1 - exp(-sum)`, over the scene. + +Swapping the drawing order changes the result by at most 2 levels out of 255, against up to 246 in +the direct pass. The targets are single-sampled whatever the canvas, about 26 bytes per pixel. +Multisampled ones would take twice the time and four times the memory for edges FXAA can smooth, and +against a single-sampled depth pass an edge sample could miss its nearest depth and count twice. +OpenGL ES, whose float targets are optional, takes the direct pass, as does a multisampled framebuffer +object, whose depth cannot be copied into a texture. + +## Cost and side effects + +Without depth writes, every translucent surface on screen is shaded, so the cost of the second +pass grows with the number of translucent surfaces stacked on screen. Order independent blending +draws the translucent segments twice and writes 18 bytes of float data per pixel instead of 4, between +a tenth and two fifths more than the direct pass. + +In realistic view, a translucent segment casts into a share of the shadow map texels as large as +its opacity, in an ordered 4x4 pattern that the 5x5 filter of the receivers reads as a lighter +shadow. The pattern shifts with the segment, so layers stacked along the light add up: a 1 mm +translucent box at 35% casts a shadow about 60% as dark as an opaque one, a 10 mm box nearly a full +one. + +## Prepare + +Prepare draws a part as a closed mesh, which would show a single surface at the filament's opacity, +far fainter and darker than the print of that part in Preview. The object shaders therefore shade a +visible model part whose filament color is translucent as the view ray crossing two shells of the +part, the front and the back one, of two 0.45 mm walls each, with the opacity rule of Preview: +`1 - (1 - a)^(1.8 / 0.4 / cos)`, cos being that of the angle between the view and the normal, +floored at 0.25. A filament at 35% is then about 86% opaque face on, and nearly opaque at the +silhouette, where the ray grazes the walls. See `translucent_filament_color()` in `gouraud.fs` and +`phong.fs`. + +Such a part is drawn in premultiplied color, blended with `GL_ONE, GL_ONE_MINUS_SRC_ALPHA`, so that +in realistic view its highlight is not dimmed by its opacity; without realistic view it takes no +highlight. `GLVolumeCollection::render()` switches this per volume, and only with a shader that has +the `translucent_filament` uniform, the GLSL 1.40 ones: with the GLSL 1.10 and ES shaders, such a +part blends as a plain transparent volume. Modifiers, negative volumes and opaque parts are drawn as +they were. + +The wireframe overlay draws translucent filament parts too, with blending off, so their lines stay +solid. diff --git a/docs/HLSD/travel-optimization.md b/docs/HLSD/travel-optimization.md new file mode 100644 index 0000000000..79774f7ff9 --- /dev/null +++ b/docs/HLSD/travel-optimization.md @@ -0,0 +1,216 @@ +# Travel optimization — High Level Design + +## Purpose and scope + +Inside an island, the infill paths of each region are chained into one print +order by a greedy pass that joins the closest free path ends first. That pass +leaves its longest joins for last, and they often cross the whole island. Two +things shorten the travel between infill paths: + +- the fill generators join their lines into as few paths as they can, since + every separate path needs a travel to it; +- the G-code export refines the greedy chain with a local search that shortens + the straight-line travel between the paths; +- a fill that keeps its order prints each piece of its gap fill where it passes + by, since the G-code export cannot reorder it. + +The refinement covers every chain that `chain_and_reorder_extrusion_entities()` +builds from a start point: the infill and ironing of `GCode::extrude_infill()` +and the support of `GCode::extrude_support()`, as well as the order of objects +and islands under `print_order` Default. It changes only the order and the +direction of the paths, not the paths or the walls. Neither part has a setting. + +## The chain + +`ObjectByExtruder::Island::Region::append()` flattens every sortable fill +collection into its paths, so the paths of all the fills of a region in one +island are chained together. A collection that must keep its order (`no_sort`: +monotonic, concentric, a forced fill order, the flow calibration) stays a single +entry that cannot be reversed. Paths that must keep their direction cannot be +reversed either: Grid's, since it alternates their direction between layers for +strength, and those of a fill with a forced order. A loop starts and ends at the +same point, so reversing it changes nothing. + +`extrude_infill()` chains each region from the current nozzle position with +`chain_and_reorder_extrusion_entities()`, and chains the paths inside a nested +sortable collection the same way; `extrude_support()` chains the support paths +of a layer so too, unless they keep their order. The overload without a start +point, used to chain collections while slicing, keeps the greedy chain. The +order the fill generators give their paths does not reach the G-code for a +sortable fill, which is chained again. + +## Connecting the lines + +Most patterns cut their lines at the infill boundary, and `Fill::connect_infill()` +joins pairs of line ends that are neighbors on a boundary contour by the arc of +wall between them, shortest arcs first, as long as neither end is joined yet and +the join closes no loop. An arc is joined when it is shorter than +`infill_anchor_max`, or than two anchors and a line width if that is longer: +two ends further apart each get an anchor toward the other, and where those +would meet, the join prints about as much wall as one path instead of two. + +Regular patterns leave many arcs of the same length, and the order among them +decides the pairing. In an arbitrary order the pairs along one wall can fall out +of step, such as lines 1–2 and 3–4, then 6–7 and 8–9, which leaves the end of +line 5 loose, and every loose end starts or ends a separate path. So the arcs +are also sorted in steps of half the line spacing and, within a step, along each +contour forwards and backwards, which pairs the ends of a wall in one phase. +Each order is replayed on the flags and a union-find of the lines, without +building any path, and the one that joins the most lines is used; a tie keeps +the shortest-first order. + +The replay includes the last pass, which joins any two open ends that are +neighbors on a contour. With multiline infill the main pass leaves the copies of +one line to that pass, so that each copy reaches a wall of its own. Two +neighboring groups cut at both walls can then be joined at either wall by arcs +of the same length: at one, their open ends stay next to their own copies, which +the last pass joins, so each line prints out and back; at the other, the copies +end up in separate paths printed apart. + +A line end left unpaired gets an anchor, a piece of the wall at most +`infill_anchor` long. It runs toward the nearest open end of another path, +looking up to 64 ends along the contour, since the next path usually starts +there; without one it takes the side with more free wall. With multiline infill +an anchor toward a copy of the same line stops short of the copy rather than +printing over it. A copy is a neighboring end less than the group width +(`multiline` spacings) across the line, at any wall angle, while the next group +lies a whole line spacing away. Meeting the wall at an angle θ, the copy covers +half a width over sin θ of the wall on each side of its end, so the anchor stops +that far and half its own width before it, or is left out; the end still counts +as anchored, so the last pass pairs the other ends as before. + +Last, `Fill::fill_surface_extrusion()` joins the sparse infill lines whose ends +are at most two line spacings apart with a straight piece. With the anchors off +(`infill_anchor_max` 0) nothing above runs and this is the only joining; with +them on, it takes what the steps above leave next to each other, such as two +anchors that stop just short of each other or a short piece cut off by a corner. +A gap that short leaves no room to print anything in between, and as a travel it +is the one hop a reordering can trade for a longer travel that retracts. +Multiline copies leave the most such ends: one spacing apart across the line, +their ends where it meets a wall at an angle θ are one spacing over sin θ apart +along it, so two spacings reach walls met at 30° and steeper. + +Ends that meet are joined first, then the gaps between the leading ends of their +lines, along each line's overall direction, then the rest, shortest first within +each, without closing a loop or crossing a line or another join. Taking the +leading ends first joins every pair of copies at the same side, which leaves +their open ends next to each other; by length alone, neighboring pairs were +joined at different walls and the travel between them crossed the island. Lines +that cannot reverse, such as Grid's, only join the end of one to the start of the +next, and fills that keep their order are left alone. + +## Gap fill in a fill that keeps its order + +`Fill::_create_gap_fill()` adds the gap fill of a solid surface, where +`gap_fill_target` asks for it, after the lines of the fill. The chain mixes it +in with the lines of a sortable fill like any other path. A fill that keeps its +order, such as monotonic, would print all of its lines and then come back for +every piece of gap fill, most of which lies at the walls where the lines end. + +So each piece, in turn, goes between the two extrusions of the fill where it +adds the least travel, flipped when that is shorter. A closed piece counts from +its point nearest the nozzle, where `GCode::extrude_loop()` starts it. The two +ends of the fill cost nothing, since the travel to and from them depends on what +is printed before and after. The fill's own extrusions keep their order and +direction, so a monotonic fill stays monotonic. When the result travels no less +than the gap fill printed after the lines in its own order, that order is kept. + +## The search + +A chain of up to eight paths is found exactly, by dynamic programming over the +subsets of paths: a state is the paths visited so far, the last one and its +direction, about four thousand states for eight paths. The shared greedy +chaining, `chain_segments_greedy_constrained_reversals_()`, does the same for two +to four segments, which also orders up to four islands of a layer and the loops +of a perimeter collection exactly. Either way the first path is no longer +always the one nearest the start; with a free end, a path near the start can be +worth leaving for last. + +Objects (`print_order` Default) and the tour of islands across objects are +visited in the same order on every layer, so `chain_points_with_postprocessing()` +orders them as a closed tour rather than an open chain. Up to ten points the +shortest tour is found exactly by the same dynamic programming with the first +point fixed; with a start point the tour then begins at the point nearest it. +Larger sets take the greedy chain and alternate 2-opt, or-opt and crossing +removal; or-opt moves runs of up to three points next to one of the eight points +nearest an end of the run, found on the same grid as the chain's candidates. + +For longer chains, the search refines the greedy chain. On an island cut into many short pieces, +such as infill without anchors, that chain can sweep away from the nozzle and +come back for the rest with one long jump, which no local move below removes. +So a nearest-next chain, going from the nozzle to the nearest free path end each +time, is built too; when it is already shorter than the refined greedy chain, it +is refined and used instead. Elsewhere it costs one grid query per path. + +`improve_chain_by_local_search()` sees the chain as a sequence of segments with +an entry and an exit point each. Its cost is the straight distance from the +nozzle to the first entry plus the distance from every exit to the next entry; +the end of the chain is free. It applies three kinds of moves: + +- 2-opt reverses a run of segments, which flips each of them and replaces the + two links at the ends of the run. +- Or-opt moves a run of up to three segments between two others, flipped or + not. +- A run of any length that starts or ends next to the nozzle moves to the front. + Local search can settle on a chain that starts with a block of paths far from + the nozzle while the paths next to it sit in the middle, and moving that block + takes more than three segments at once. + +A move that would flip a segment that cannot be reversed is skipped, so such +segments are only reordered. + +A move is tried only if every link it creates joins an end point to one of the +32 end points nearest to it, which covers every move on a chain of up to 17 +segments, as most islands are; with 8 candidates the search missed most of the +gain on grid-like patterns such as Triangles. The candidates come from a uniform +grid of about two end points per cell, searched in rings of cells around the +query. `KDTreeIndirect` visits its subtrees in a fixed order rather than the +nearer one first, so a query for 32 points walks most of the tree, and on long +chains finding the candidates would cost more than the search itself. + +The candidates of an end point are tried nearest first, and only while they are +closer to it than the link the move would replace there. A 2-opt move that pays +off creates a link shorter than the one it replaces at one of its two ends, so +this misses no 2-opt move. An or-opt move is tried only while its new link is +shorter than what taking the run out saves, which skips a few or-opt moves that +would still pay off but cuts the search on long chains to a fraction. + +The search works through a queue of segments and applies the first move that +shortens the chain around the segment it examines. After a move, only the +segments next to a changed link are queued again. A new link can also make room +for a run elsewhere that no segment next to it would try, so when the queue +empties after any move, every segment is queued once more, and the search ends +when such a sweep finds no move. + +Every move shortens the chain by more than `SCALED_EPSILON`, so the result is +never longer than the greedy or the nearest-next chain and the search ends; a +cap of 50 moves per segment only bounds its time. The search has no randomness +and visits the segments in a fixed order, so the same input always gives the +same G-code. + +## Cost + +Finding the candidates of an end point visits a few cells, and the nearest-next +chain makes one such query per path, which only grows where the paths around the +nozzle are used up and the chain jumps. Examining a segment tries at most a few +hundred candidate links, usually only the nearest few, plus a scan of the chain +for the move to the front when it is the first segment, and a move rewrites only +the range of the chain it changes, so the search stays close to linear in the +number of segments. Most islands hold a few to a few dozen paths; the cost shows +on infill cut into thousands of pieces per island, such as dense infill with the +anchors off. The straight joins only look at the line segments near a candidate +join for crossings. + +## Limitations + +The search minimizes straight-line distance. It does not know which travels +leave the infill area and retract under `reduce_infill_retraction`, nor the +detours of `reduce_crossing_wall`, and a travel's time is not proportional to +its length: a short travel is bound by acceleration, so its time grows about +with the square root of its length. A chain that is shorter in total but trades +very short travels for longer ones, or for ones past `retraction_minimum_travel`, +can occasionally take a little longer to print. + +The end of the chain is free: it is not steered toward the next island or the +start of the next layer. The regions of an island are chained one after the +other, in region order, each from where the previous one ended. diff --git a/localization/i18n/OrcaSlicer.pot b/localization/i18n/OrcaSlicer.pot index cfd850774d..a98d6c4a6c 100644 --- a/localization/i18n/OrcaSlicer.pot +++ b/localization/i18n/OrcaSlicer.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -5320,6 +5320,9 @@ msgstr "" msgid "This parameter expects a valid template." msgstr "" +msgid "Invalid collision volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |." +msgstr "" + msgid "Invalid pattern. Use N, N#K, or a comma-separated list with optional #K per entry. Examples: 5, 5#2, 1,7,9, 5,9#2,18." msgstr "" @@ -6049,7 +6052,7 @@ msgstr "" msgid "Size:" msgstr "" -#, possible-boost-format +#, possible-c-format, possible-boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "" @@ -6518,6 +6521,12 @@ msgstr "" msgid "Show object labels in 3D scene." msgstr "" +msgid "Show all collision volumes" +msgstr "" + +msgid "Show the full height of every configured collision volume, including on an empty bed." +msgstr "" + msgid "Show &Overhang" msgstr "" @@ -11049,6 +11058,12 @@ msgstr "" msgid "Click to reset all settings to the last saved preset." msgstr "" +msgid "This definition contains collision-volume syntax. Add it to the toolhead collision volumes for G-code checking and travel avoidance? The existing excluded bed area will be preserved." +msgstr "" + +msgid "Add collision volumes" +msgstr "" + msgid "Prime tower is required for nozzle changing. There may be flaws on the model without prime tower. Are you sure you want to disable prime tower?" msgstr "" @@ -12318,7 +12333,7 @@ msgstr "" msgid "Left mouse" msgstr "" -msgid "Available anywhere in the window, even while typing in a text field." +msgid "Available anywhere in the window." msgstr "" msgid "Run favorite 1 to 10" @@ -12415,9 +12430,6 @@ msgstr "" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "" -msgid "Global shortcuts also apply while typing." -msgstr "" - msgid "A key that types a character cannot be a global shortcut." msgstr "" @@ -12711,6 +12723,17 @@ msgid "" "Is the disk full?" msgstr "" +#, possible-boost-format +msgid "A G-code move intersects a collision volume for extruder %1%. This may cause a printer collision." +msgstr "" + +msgid "A G-code move intersects a collision volume. This may cause a printer collision." +msgstr "" + +#, possible-boost-format +msgid "The intersecting move is at G-code line %1%. Its Z position is unknown after homing, so Orca checked it against every height." +msgstr "" + #. TRN %1% is the temporary file path, %2% the output file path, %3% the system error message. #, possible-boost-format msgid "" @@ -12977,6 +13000,14 @@ msgstr "" msgid "%1% is too close to exclusion area. There may be collisions when printing." msgstr "" +#, possible-boost-format +msgid "%1% intersects collision volumes for every available extruder." +msgstr "" + +#, possible-boost-format +msgid "%1% intersects a collision volume for extruder %2%." +msgstr "" + #, possible-boost-format msgid "%1% is too close to others, and collisions may be caused." msgstr "" @@ -13306,7 +13337,34 @@ msgstr "" msgid "Excluded bed area" msgstr "" -msgid "Unprintable area in XY plane. For example, X1 Series printers use the front left corner to cut filament during filament change. The area is expressed as polygon by points in following format: \"XxY, XxY, ...\"" +msgid "Unprintable area in XY plane. For example, X1 Series printers use the front left corner to cut filament during filament change. The area is expressed as a polygon in the format \"XxY, XxY, ...\". It constrains material and model placement, but allows machine travel. Configure toolhead collision volumes separately for G-code checking and travel avoidance." +msgstr "" + +msgid "Toolhead collision volumes" +msgstr "" + +msgid "Collision volumes used for model and generated-material exclusion, G-code checking, and travel avoidance. Use \"XxY, XxY, ...\" for a full-height polygon or \"ZMIN..ZMAX;XxY, XxY, ...\" for a Z-limited volume. Separate multiple volumes with \"|\". These volumes are additional to the excluded bed area. Automatic arrangement conservatively uses the bounding box of a non-convex volume." +msgstr "" + +msgid "Collision volume behavior" +msgstr "" + +msgid "Choose whether all nozzles use the same collision volumes, derive toolhead-relative volumes from each nozzle's XY offset, or configure independent volumes for every extruder. In individual mode, select each extruder on the Extruder page to configure its volumes." +msgstr "" + +msgid "Shared" +msgstr "" + +msgid "Toolhead-relative (nozzle offsets)" +msgstr "" + +msgid "Individual per extruder" +msgstr "" + +msgid "Extruder collision volumes" +msgstr "" + +msgid "Collision volumes used only by this extruder in individual mode. Use the same polygon and optional Z-range format as the shared collision volumes. Leave empty for no collision volumes on this extruder. Automatic arrangement conservatively uses the bounding box of a non-convex volume." msgstr "" msgid "Bed custom texture" @@ -18219,6 +18277,15 @@ msgstr "" msgid "invalid value " msgstr "" +msgid "Invalid collision volume definition." +msgstr "" + +msgid "A nozzle offset is required for every extruder when toolhead-relative collision volumes are enabled." +msgstr "" + +msgid "Invalid per-extruder collision volume definition." +msgstr "" + msgid "Invalid value when spiral vase mode is enabled: " msgstr "" @@ -26501,17 +26568,18 @@ msgstr "" msgid "Basic Colors" msgstr "" +#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. msgid "Orca Palette" msgstr "" -#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. +#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "RAL Classic" msgstr "" -#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "Gradients" msgstr "" +msgctxt "Color picker" msgid "Solid" msgstr "" @@ -26886,7 +26954,7 @@ msgstr "" msgid "Medium violet red" msgstr "" -msgid "PaleV violet red" +msgid "Pale violet red" msgstr "" msgid "Deep pink" @@ -27048,7 +27116,7 @@ msgstr "" msgid "Shallow sky" msgstr "" -msgid "Electric bel" +msgid "Electric blue" msgstr "" msgid "Dolphin" @@ -27117,7 +27185,7 @@ msgstr "" msgid "Maize yellow" msgstr "" -msgid "Dalmatian yellow" +msgid "Daffodil yellow" msgstr "" msgid "Brown beige" @@ -27378,7 +27446,7 @@ msgstr "" msgid "Turquoise blue" msgstr "" -msgid "Capsanthin violet" +msgid "Capri blue" msgstr "" msgid "Ocean blue" @@ -27492,7 +27560,7 @@ msgstr "" msgid "Silver grey" msgstr "" -msgid "Olivestone" +msgid "Olive grey" msgstr "" msgid "Moss grey" @@ -28080,10 +28148,19 @@ msgstr "" msgid "Built-in" msgstr "" +msgid "My textures" +msgstr "" + msgid "No textures found." msgstr "" -msgid "My textures" +msgid "Texture libraries" +msgstr "" + +msgid "Explore more texture libraries" +msgstr "" + +msgid "Opens OrcaCloud in the Home page to browse for plugins." msgstr "" msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -30136,6 +30213,9 @@ msgstr "" msgid "Slicing Pipeline" msgstr "" +msgid "Resource Texture" +msgstr "" + msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "" @@ -30251,6 +30331,24 @@ msgstr "" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "" +msgid "Resource texture directory is not set" +msgstr "" + +msgid "Resource texture directory could not be resolved" +msgstr "" + +msgid "Resource texture path is not a directory" +msgstr "" + +msgid "Plugin folder could not be resolved" +msgstr "" + +msgid "Resource texture directory is outside the plugin folder" +msgstr "" + +msgid "Resource texture directory could not be read" +msgstr "" + #, possible-boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" msgstr "" diff --git a/localization/i18n/ca/OrcaSlicer_ca.po b/localization/i18n/ca/OrcaSlicer_ca.po index 47a29ce82f..72efab0527 100644 --- a/localization/i18n/ca/OrcaSlicer_ca.po +++ b/localization/i18n/ca/OrcaSlicer_ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2025-03-15 10:55+0100\n" "Last-Translator: \n" "Language-Team: \n" @@ -819,18 +819,22 @@ msgstr "Selecció" msgid "Plate" msgstr "Safata" +# AI Translated +# Needs human review: Glossary has no Catalan rendering; Distribuir chosen as the counterpart of Alinear (command that spaces objects evenly). msgid "Distribute" -msgstr "" +msgstr "Distribuir" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Sistema de coordenades utilitzat per a les accions de transformació." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Referència per a l'alineació" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Seleccioneu almenys 3 peces o objectes" # AI Translated msgid "Align left" @@ -883,8 +887,9 @@ msgstr "Distribuir dalt-baix" msgid "Drop" msgstr "Deixar anar" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Moveu la selecció al llarg de Z perquè el seu punt més baix toqui el llit." # AI Translated msgid "Absolute" @@ -2127,17 +2132,21 @@ msgstr "Entrant al gizmo d'Ensamblatge" msgid "Leaving Assembly gizmo" msgstr "Sortint del gizmo d'Ensamblatge" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Les peces d'un objecte tallat no es poden moure" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "L'alineació amb la placa només està disponible en X i Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Desactiveu la Caiguda automàtica dels objectes seleccionats per moure'ls en Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Tots els objectes seleccionats han d'estar a la mateixa placa" msgid "Shift+" msgstr "Màj+" @@ -6599,8 +6608,10 @@ msgstr "Eixos" msgid "Gridlines" msgstr "Línies de la graella" +# AI Translated +# Needs human review: Glossary has no Catalan rendering for Focus mode (hides the UI to concentrate on the 3D canvas); check the wording. msgid "Focus mode" -msgstr "" +msgstr "Mode de concentració" msgid "Labels" msgstr "Etiquetes" @@ -6662,7 +6673,7 @@ msgid "Size:" msgstr "Mida:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "S'han trobat conflictes de rutes de G-code a la capa %d, Z = %.2lfmm. Si us plau, separeu els objectes conflictius més lluny ( %s <-> %s )." @@ -11040,11 +11051,13 @@ msgstr "Mostrar els perfils no compatibles" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Mostra els perfils incompatibles o no compatibles a les llistes desplegables d'impressora i de filament. Aquests perfils no es poden seleccionar." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Exportar estadístiques amb el G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Si està activat, en exportar un fitxer de G-code també s'escriuen les seves estadístiques en JSON al costat, com a .statistics.json, i un fitxer 3MF laminat exportat les conté a dins: temps d'impressió, totals de filament i per tipus de línia, i el mateix per capa i per objecte." # AI Translated msgid "Experimental Features" @@ -11909,6 +11922,10 @@ msgstr "No s'ha pogut pujar el fitxer a l'emmagatzematge de la impressora. Torne msgid "Send Failed" msgstr "L'enviament ha fallat" +# AI Translated +msgid "No available printers" +msgstr "No hi ha impressores disponibles" + msgid "The name length exceeds the limit." msgstr "La longitud del nom supera el límit." @@ -13770,8 +13787,8 @@ msgid "Left mouse" msgstr "Botó esquerre del ratolí" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Disponible a qualsevol lloc de la finestra, fins i tot mentre s'escriu en un camp de text." +msgid "Available anywhere in the window." +msgstr "Disponible a qualsevol lloc de la finestra." # AI Translated msgid "Run favorite 1 to 10" @@ -13884,10 +13901,6 @@ msgstr "La drecera %s està assignada a %s. Voleu reassignar-la a %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "La drecera predeterminada %s està assignada a %s. Voleu reassignar-la a %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Les dreceres globals també s'apliquen mentre s'escriu." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Una tecla que escriu un caràcter no pot ser una drecera global." @@ -14341,9 +14354,10 @@ msgstr "el modificador \"%1%\" de \"%2%\" (%3% en total) no ha tingut cap efecte msgid "Seam placement may differ from expected." msgstr "La posició de la costura pot ser diferent de l'esperada." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "No s'han pogut escriure les estadístiques del G-code a %1%." msgid "Internal Bridge" msgstr "Pont Interior" @@ -17796,6 +17810,14 @@ msgstr "Excloure objectes" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Activeu aquesta opció per afegir l'ordre EXCLUDE OBJECT al G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Tolerància del contorn" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Desviació màxima del contorn de l'objecte escrit a EXCLUDE_OBJECT_DEFINE respecte del contorn original. Els valors més grans donen menys punts, cosa que ajuda el firmware que es bloqueja en analitzar G-code amb molts objectes. 0 conserva tots els punts." + msgid "Verbose G-code" msgstr "G-code detallat" @@ -21063,11 +21085,13 @@ msgstr "Directori de sortida" msgid "This is the output directory for exported files." msgstr "Directori de sortida dels fitxers exportats." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Exportar estadístiques" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Escriu les estadístiques de cada placa laminada en JSON, com a plate_N.statistics.json al costat del seu G-code al directori de sortida i dins del 3MF de --export-3mf: temps d'impressió, totals de filament i per tipus de línia, i el mateix per capa i per objecte." msgid "Debug level" msgstr "Nivell de depuració" @@ -31003,1231 +31027,1646 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "La llista de filaments actual no conté %s. Després de la descomposició es crearà automàticament un filament de projecte que necessita el filament mixt." msgstr[1] "La llista de filaments actual no conté %s. Després de la descomposició es crearan automàticament els filaments de projecte que necessita el filament mixt." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Selector de color" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Colors bàsics" +# AI Translated #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Paleta Orca" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Clàssic" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Gradients" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Sòlid" +# AI Translated +# Needs human review: Glossary has no Catalan cell for Gradient; kept Gradient, matching the existing Gradient lineal/radial, while the mixed filament gradient uses Degradat. msgid "Gradient" -msgstr "" +msgstr "Gradient" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Inici del gradient" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Final del gradient" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Color del gradient" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Afegir color" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Eliminar color" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Saturació" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Color original" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Desar el color actual" +# AI Translated +# Needs human review: Glossary has no Catalan cell for Palette; Paleta chosen. msgid "Palettes" -msgstr "" +msgstr "Paletes" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Cercar colors" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Filtrar colors" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "No hi ha colors coincidents" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Color hexadecimal" # AI Translated msgid "Opacity" msgstr "Opacitat" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Percentatge d'opacitat" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Desar color" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Introduïu un color hexadecimal complet" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "La selecció multicolor actual es conserva fins que trieu un color diferent." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "S'admeten fins a %d colors." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Carmesí" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Vermell taronja" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Tomàquet" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Taronja" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Taronja fosc" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Or" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Fusta robusta" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Bisque" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Rosa boirós" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Groc clar" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Xifó de llimona" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beix" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Groc vara d'or clar" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Vara d'or pàl·lida" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Caqui" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Caqui fosc" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Préssec clar" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mocassí" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Nata de papaia" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Ametlla pelada" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Blanc antic" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Blanc navajo" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Blat" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Vara d'or" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Xocolata" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Perú" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Maó refractari" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Sienna" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Marró sella" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Marró" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Marró rosat" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Salmó" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Salmó clar" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Salmó fosc" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Marró sorra" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Corall" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Corall clar" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Vermell indi" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Vermell fosc" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Grana" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Verd groguenc" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Groc verdós" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Verd gespa" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Verd llima" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Verd primavera" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Verd primavera mitjà" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Llima" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Verd bosc" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Verd fosc" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Oliva apagat" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliva" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Verd oliva fosc" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Verd pàl·lid" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Verd clar" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Verd mar mitjà" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Verd mar" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Verd mar fosc" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Blau cadet" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Aiguamarina mitjana" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turquesa" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Turquesa mitjana" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Turquesa fosca" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Turquesa pàl·lida" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aigua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Cian clar" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Crema de menta" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Rosada de mel" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Aiguamarina" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Verd mar clar" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Cian fosc" +# AI Translated +# Needs human review: CSS teal (dark blue-green); check that Verd blavós fosc reads as a color name next to Blau verdós and Verd blavós. msgid "Teal" -msgstr "" +msgstr "Verd blavós fosc" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Gris pissarra fosc" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Gris pissarra clar" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Gris pissarra" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Blau cel intens" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Blau Dodger" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Blau cel" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Blau cel clar" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Blau clar" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Blau talc" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Blau acer clar" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Blau acer" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Blau blauet" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Blau reial" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Blau mitjà" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Blau mitjanit" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Blau fosc" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Blau marí" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Blau pissarra" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Blau pissarra fosc" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Blau pissarra mitjà" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Violeta blavós" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indi" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Violeta fosc" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Orquídia fosca" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Orquídia mitjana" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orquídia" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Violeta" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Porpra mitjà" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Porpra" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Porpra Rebecca" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Vermell violeta mitjà" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Vermell violeta pàl·lid" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Rosa intens" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Rosa viu" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Rosa clar" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rosa" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Pruna" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Card" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fúcsia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Magenta fosc" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Lli" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Punta antiga" +# AI Translated +# Needs human review: CSS color 'seashell'; the Shell glossary match is a false positive. msgid "Sea shell" -msgstr "" +msgstr "Petxina" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Ivori" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Blanc floral" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lavanda rosada" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Blanc fantasma" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Blau Alice" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lavanda" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Blanc fum" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Negre" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Foc de corall" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Anemone de mar" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Abisme profund" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Vermell llamàntol" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Argila sorrenca" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Fusta de deriva" +# AI Translated +# Needs human review: Plant name (Hippophae); check the Catalan name and whether a color-only name reads better. msgid "Sea buckthorn" -msgstr "" +msgstr "Arç marí" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Escull de capvespre" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Corall tigre" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Corall rosa" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Resplendor de petxina" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Sorra" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Alga daurada" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Duna assolellada" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Nàutil ambre" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Llimona de mar" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Estrella de mar pàl·lida" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Marea viva" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Alga llima" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Herba marina" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Plàncton neó" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Bosc d'algues" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Onada esmeralda" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Ombra de balena" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Tortuga marina" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Llacuna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Corrent tropical" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Fossa de mitjanit" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Alga fosca" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Onatge de cristall" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Badia turquesa" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Cel sobre l'escull" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Cel somer" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Blau elèctric" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Dofí" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Profunditats de l'oceà" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Balena" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Abisme indi" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Eriçó de mar" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Corall lavanda" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Marea violeta" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Orquídia abissal" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Medusa neó" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Corall fúcsia" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Medusa rosa" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Escuma" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Blanc petxina" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Gris còdol" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Núvol de tempesta" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Negre tinta" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Beix verdós" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Groc sorra" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Groc de senyalització" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Groc daurat" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Groc mel" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Groc blat de moro" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Groc narcís" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Beix marronós" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Groc llimona" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Blanc ostra" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Ivori clar" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Groc de zinc" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Beix grisós" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Groc oliva" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Groc colza" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Groc trànsit" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Groc ocre" +# AI Translated +# Needs human review: Source name looks like a RAL variant; check the rendering. msgid "Traffic orange yellow" -msgstr "" +msgstr "Groc taronja trànsit" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curri" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Groc meló" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Groc ginesta" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Groc dàlia" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Groc pastel" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Beix perla" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Or perla" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Groc sol" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Taronja groguenc" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Taronja intens" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Vermelló" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Taronja perla" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Taronja pur" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Taronja lluminós" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Taronja lluminós brillant" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Taronja vermellós brillant" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Taronja trànsit" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Taronja de senyalització" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Taronja salmó" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Rosa perla" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Taronja coure" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Marró de senyalització" +# AI Translated +# Needs human review: RAL color name as given in the source; check the rendering. msgid "Fir orange" -msgstr "" +msgstr "Taronja avet" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Vermell de senyalització" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Vermell lluminós" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Vermell carmí" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Vermell carmí perla" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Vermell pur" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Vermell intens lluminós" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Vermell grosella" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Vermell rubí perla" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Vermell foc" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Vermell rubí" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Vermell porpra" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Vermell vi" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Vermell negrós" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Vermell òxid" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Vermell marronós" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Vermell pi" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Vermell tomàquet" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Rosa antic" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Vermell corall" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rosat" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Vermell maduixa" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Vermell trànsit" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Rosa salmó" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Rosa lluminós" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Vermell brillant lluminós" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Vermell gerd" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Vermell orient" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Rubí perla" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Porpra vermellós" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Violeta vermellós" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Violeta bruc" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Violeta bordeus" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Caoba" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Porpra grisós" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Violeta de senyalització" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Verd avet" +# AI Translated +# Needs human review: RAL color named after Sabine; check the rendering. msgid "Sabine grey" -msgstr "" +msgstr "Gris sabí" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Violeta perla" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Móra perla" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Blau verdós" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Blau ultramar" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Blau safir" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Blau negrós" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Blau de senyalització" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Blau brillant" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Blau grisós" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Blau atzur" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Blau genciana" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Blau cobalt" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Blau colom" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Blau trànsit" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Blau turquesa" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Blau Capri" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Blau oceà" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Blau aigua" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Blau nit" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Blau llunyà" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Blau pastel" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Blau genciana perla" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Blau mitjanit perla" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Verd pàtina" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Verd esmeralda" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Verd fulla" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Verd oliva" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Verd blavós" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Verd molsa" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Oliva grisós" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Verd pi" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Marró pi" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Verd herba" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Verd reseda" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Verd marronós" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Verd canya" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Verd negrós" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Verd turquesa" +# AI Translated msgid "May green" -msgstr "" +msgstr "Verd maig" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Verd òxid de crom" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Verd trànsit" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Verd falguera" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Verd òpal" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Verd menta" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Verd bronze" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Verd perla" +# AI Translated msgid "Sax turquoise" -msgstr "" +msgstr "Turquesa saxe" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Turquesa perla" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Jade perla" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Verd pur" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Verd lluminós" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Gris esquirol" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Gris plata" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Gris oliva" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Gris molsa" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Gris de senyalització" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Gris ratolí" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Gris beix" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Gris caqui" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Gris verdós" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Gris lona" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Gris ferro" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Gris basalt" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Gris marronós" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Gris pissarra" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Gris antracita" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Gris clar" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Gris ombra" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Gris formigó" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Gris grafit" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Gris granit" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Gris pedra" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Gris còdol" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Gris ciment" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Gris groguenc" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Gris platí" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Gris pols" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Gris àgata" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Gris quars" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Gris finestra" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Gris trànsit A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Gris trànsit B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Gris seda" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegris 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegris 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegris 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Gris ratolí perla" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Marró verdós" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Marró ocre" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Marró argila" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Marró coure" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Marró xocolata" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Marró oliva" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Marró nou" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Marró vermellós" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Marró sèpia" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Marró castanya" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Marró caoba" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Marró grisós" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Coure perla" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Marró beix" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Marró moca perla" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Marró terra" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Marró perla" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Crema" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Blanc grisós" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Blanc de senyalització" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Negre de senyalització" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Negre atzabeja" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Alumini blanc" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Alumini gris" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Blanc pur" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Negre grafit" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Blanc trànsit" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Negre trànsit" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Blanc papir" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Gris clar perla" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metall: Plata" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metall: Llautó" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metall: Or" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metall: Coure" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metall: Bronze" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Natura: Perla" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Natura: Arc de Sant Martí" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Natura: Cel clar" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Natura: Posta de sol" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Fusta: Fosca" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Fusta: Mitjana" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Fusta: Clara" # AI Translated msgid "Alternate nozzles:" @@ -32703,13 +33142,25 @@ msgstr "Treure de Les meves textures" msgid "Built-in" msgstr "Integrades" +# AI Translated +msgid "My textures" +msgstr "Les meves textures" + # AI Translated msgid "No textures found." msgstr "No s'ha trobat cap textura." # AI Translated -msgid "My textures" -msgstr "Les meves textures" +msgid "Texture libraries" +msgstr "Biblioteques de textures" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Explorar més biblioteques de textures" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Obre OrcaCloud a la pàgina d'inici per cercar connectors." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33112,11 +33563,13 @@ msgstr "Mapat segons la disposició UV del propi model, que ja és la col·locac msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Amplada d'una còpia de la textura sobre el model. Un valor més petit repeteix el patró més sovint i en fa el detall més fi; amb Tessel·lat desactivat, és la mida de la còpia única." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Més gran" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Més petit" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33192,11 +33645,13 @@ msgstr "Colors mixtos" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "El nombre màxim de filaments mixtos que pot afegir una fixació. Es trien a partir dels colors de la textura, i només es creen els que la fixació fa servir realment." +# AI Translated msgid "Few" -msgstr "" +msgstr "Pocs" +# AI Translated msgid "Many" -msgstr "" +msgstr "Molts" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33552,11 +34007,13 @@ msgstr "Remallat" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Mida de triangle amb què es reconstrueix tot el model, en mil·límetres. El desplaçament funciona millor sobre una malla uniforme; això és el que en crea una a partir d'una importació irregular." +# AI Translated msgid "Before" -msgstr "" +msgstr "Abans" +# AI Translated msgid "After" -msgstr "" +msgstr "Després" # AI Translated msgid "Keep sharp edges" @@ -35417,6 +35874,10 @@ msgstr "Script" msgid "Slicing Pipeline" msgstr "Flux de laminat" +# AI Translated +msgid "Resource Texture" +msgstr "Textura de recurs" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "La interfície de configuració del connector era buida. Es mostra l'editor predeterminat." @@ -35564,6 +36025,30 @@ msgstr "El directori del connector conté fitxers d'entrada .py i .whl" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "El directori del connector no conté cap fitxer d'entrada .py ni .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "No s'ha definit el directori de textures de recurs" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "No s'ha pogut resoldre el directori de textures de recurs" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "La ruta de textures de recurs no és un directori" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "No s'ha pogut resoldre la carpeta del connector" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "El directori de textures de recurs és fora de la carpeta del connector" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "No s'ha pogut llegir el directori de textures de recurs" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36511,6 +36996,27 @@ msgstr "" "Evitar la deformació( warping )\n" "Sabíeu que quan imprimiu materials propensos a deformar-se, com ara l'ABS, augmentar adequadament la temperatura del llit pot reduir la probabilitat de deformació?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Groc dàlmata" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Violeta capsantina" + +# AI Translated +# Needs human review: RAL color name; check the rendering. +#~ msgid "Olivestone" +#~ msgstr "Pedra d'oliva" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Disponible a qualsevol lloc de la finestra, fins i tot mentre s'escriu en un camp de text." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Les dreceres globals també s'apliquen mentre s'escriu." + #~ msgid "Please choose the filament color" #~ msgstr "Trieu el color del filament" diff --git a/localization/i18n/cs/OrcaSlicer_cs.po b/localization/i18n/cs/OrcaSlicer_cs.po index 682b3da229..6b6e2c91b4 100644 --- a/localization/i18n/cs/OrcaSlicer_cs.po +++ b/localization/i18n/cs/OrcaSlicer_cs.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: Jakub Hencl\n" "Language-Team: \n" @@ -791,18 +791,21 @@ msgstr "Výběr" msgid "Plate" msgstr "Deska" +# AI Translated msgid "Distribute" -msgstr "" +msgstr "Rozmístit" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Souřadný systém použitý pro transformační akce." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Reference zarovnání" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Vyberte alespoň 3 díly nebo objekty" # AI Translated msgid "Align left" @@ -855,8 +858,9 @@ msgstr "Rozmístit nahoře-dole" msgid "Drop" msgstr "Pustit" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Posune výběr podél osy Z tak, aby se jeho nejnižší bod dotýkal podložky." # AI Translated msgid "Absolute" @@ -2103,17 +2107,22 @@ msgstr "Vstup do nástroje Sestava" msgid "Leaving Assembly gizmo" msgstr "Opustit nástroj Sestava" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Díly rozřezaného objektu nelze přesouvat" +# AI Translated +# Needs human review: 'Plate' here is the build plate (align to the bed), so 'podložka' was used. msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Zarovnání k podložce je možné pouze v osách X a Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Vypněte automatické položení pro vybrané objekty, abyste je mohli posouvat v ose Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Všechny vybrané objekty musí být na stejné desce" msgid "Shift+" msgstr "Shift+" @@ -6580,8 +6589,9 @@ msgstr "Osy" msgid "Gridlines" msgstr "Mřížka" +# AI Translated msgid "Focus mode" -msgstr "" +msgstr "Režim soustředění" msgid "Labels" msgstr "Popisky" @@ -6643,7 +6653,7 @@ msgid "Size:" msgstr "Velikost:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Byly nalezeny konflikty drah G-code ve vrstvě %d, Z = %.2lf mm. Oddělte prosím konfliktní objekty více od sebe (%s <-> %s)." @@ -11021,11 +11031,14 @@ msgstr "Zobrazit nepodporované předvolby" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Zobrazovat nekompatibilní/nepodporované předvolby v rozevíracích seznamech tiskáren a filamentů. Tyto předvolby nelze vybrat." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Exportovat statistiky spolu s G-code" +# AI Translated +# Needs human review: 'feature totals' = totals per extrusion feature type; check the wording. msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Je-li zapnuto, export souboru G-code zapíše jeho statistiky také jako JSON vedle něj, jako .statistics.json, a exportovaný slicovaný soubor 3MF je obsahuje uvnitř: čas tisku, součty filamentu a typů čar a totéž po vrstvách a po objektech." # AI Translated msgid "Experimental Features" @@ -11892,6 +11905,10 @@ msgstr "Nahrání souboru do úložiště tiskárny selhalo. Zkuste to prosím z msgid "Send Failed" msgstr "Odeslání selhalo" +# AI Translated +msgid "No available printers" +msgstr "Žádné dostupné tiskárny" + msgid "The name length exceeds the limit." msgstr "Délka názvu překračuje limit." @@ -13792,8 +13809,8 @@ msgid "Left mouse" msgstr "Levé tlačítko myši" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Dostupné kdekoli v okně, i při psaní do textového pole." +msgid "Available anywhere in the window." +msgstr "Dostupné kdekoli v okně." # AI Translated msgid "Run favorite 1 to 10" @@ -13905,10 +13922,6 @@ msgstr "Zkratka %s je přiřazena k %s. Přiřadit ji místo toho k %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Výchozí zkratka %s je přiřazena k %s. Přiřadit ji místo toho k %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Globální zkratky platí i při psaní." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Klávesa, která píše znak, nemůže být globální zkratkou." @@ -14362,9 +14375,10 @@ msgstr "modifikátor „%1%“ objektu „%2%“ (celkem %3%) neměl na šev ž msgid "Seam placement may differ from expected." msgstr "Umístění švu se může lišit od očekávaného." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Statistiky G-code se nepodařilo zapsat do %1%." msgid "Internal Bridge" msgstr "Vnitřní most" @@ -17781,6 +17795,14 @@ msgstr "Vyloučit objekty" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Povolte tuto volbu pro přidání příkazu EXCLUDE OBJECT do G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Tolerance obrysu" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Maximální odchylka obrysu objektu zapsaného do EXCLUDE_OBJECT_DEFINE od původního obrysu. Vyšší hodnoty dávají méně bodů, což pomáhá firmwaru, který se při zpracování G-code s mnoha objekty zasekává. 0 zachová každý bod." + msgid "Verbose G-code" msgstr "Podrobný G-code" @@ -21022,11 +21044,14 @@ msgstr "Výstupní adresář" msgid "This is the output directory for exported files." msgstr "Výstupní adresář pro exportované soubory." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Exportovat statistiky" +# AI Translated +# Needs human review: 'feature totals' = totals per extrusion feature type; check the wording. msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Zapíše statistiky každé slicované desky jako JSON, jako plate_N.statistics.json vedle jejího G-code ve výstupním adresáři a uvnitř 3MF z --export-3mf: čas tisku, součty filamentu a typů čar a totéž po vrstvách a po objektech." msgid "Debug level" msgstr "Úroveň ladění" @@ -31045,1231 +31070,1647 @@ msgstr[0] "Aktuální seznam filamentů neobsahuje %s. Filament projektu, který msgstr[1] "Aktuální seznam filamentů neobsahuje %s. Filamenty projektu, které míchaný filament vyžaduje, budou po rozkladu vytvořeny automaticky." msgstr[2] "Aktuální seznam filamentů neobsahuje %s. Filamenty projektu, které míchaný filament vyžaduje, budou po rozkladu vytvořeny automaticky." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Výběr barvy" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Základní barvy" +# AI Translated #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Paleta Orca" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Classic" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Gradienty" +# AI Translated +# Needs human review: Color picker tab: single solid color as opposed to a gradient; check it reads right next to 'Gradients'. +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Jednobarevné" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Gradient" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Začátek gradientu" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Konec gradientu" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Barva gradientu" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Přidat barvu" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Odebrat barvu" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Sytost" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Původní barva" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Uložit aktuální barvu" +# AI Translated msgid "Palettes" -msgstr "" +msgstr "Palety" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Hledat barvy" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Filtrovat barvy" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Žádné odpovídající barvy" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Barva hex" # AI Translated msgid "Opacity" msgstr "Neprůhlednost" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Neprůhlednost v procentech" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Uložit barvu" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Zadejte úplnou hexadecimální barvu" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Aktuální výběr více barev zůstane zachován, dokud nevyberete jinou barvu." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Podporováno je nejvýše %d barev." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmínová" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Oranžovočervená" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Rajčatová" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Oranžová" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Tmavě oranžová" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Zlatá" +# AI Translated +# Needs human review: CSS color name; 'Dřevitá' is a free rendering. msgid "Burly wood" -msgstr "" +msgstr "Dřevitá" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Krémově růžová" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Mlžná růžová" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Světle žlutá" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Citronový šifón" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Béžová" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Světle zlatobýlově žlutá" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Bledě zlatobýlová" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Khaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Tmavě khaki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Broskvový krém" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mokasínová" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papájový krém" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Bledá mandlová" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antická bílá" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navajská bílá" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Pšeničná" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Zlatobýlová" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Čokoládová" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Cihlová" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Sedlová hnědá" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Hnědá" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Růžovohnědá" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Lososová" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Světle lososová" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Tmavě lososová" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Písčitě hnědá" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Korálová" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Světle korálová" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Indická červená" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Tmavě červená" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Kaštanová" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Zelenožlutá" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Žlutozelená" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Trávníková zelená" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Limetkově zelená" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Jarní zelená" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Středně jarní zelená" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Limetková" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Lesní zelená" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Tmavě zelená" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Armádní olivová" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Olivová" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Tmavě olivově zelená" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Bledě zelená" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Světle zelená" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Středně mořská zelená" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Mořská zelená" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Tmavě mořská zelená" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Kadetská modrá" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Středně akvamarínová" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Tyrkysová" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Středně tyrkysová" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Tmavě tyrkysová" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Bledě tyrkysová" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Světle azurová" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Mátový krém" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Medová rosa" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Akvamarínová" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Světle mořská zelená" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Tmavě azurová" +# AI Translated +# Needs human review: CSS color kept in English because no distinct Czech name exists apart from 'Modrozelená' (Blue green); check. msgid "Teal" -msgstr "" +msgstr "Teal" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Tmavě břidlicově šedá" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Světle břidlicově šedá" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Břidlicově šedá" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Sytě nebesky modrá" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodgerská modrá" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Nebesky modrá" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Světle nebesky modrá" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Světle modrá" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Pudrově modrá" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Světle ocelově modrá" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Ocelově modrá" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Chrpově modrá" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Královská modrá" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Středně modrá" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Půlnočně modrá" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Tmavě modrá" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Námořnická modrá" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Břidlicově modrá" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Tmavě břidlicově modrá" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Středně břidlicově modrá" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Modrofialová" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indigo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Tmavě fialová" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Tmavě orchidejová" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Středně orchidejová" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orchidejová" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Fialová" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Středně purpurová" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Purpurová" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebeccina purpurová" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Středně fialovočervená" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Bledě fialovočervená" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Sytě růžová" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Pronikavě růžová" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Světle růžová" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Růžová" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Švestková" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Bodláková" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuchsiová" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Tmavě magentová" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Lněná" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Stará krajka" +# AI Translated +# Needs human review: CSS color Seashell; the glossary Shell term does not apply (false match). msgid "Sea shell" -msgstr "" +msgstr "Mušlová" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Slonovinová" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Květinová bílá" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Levandulově růžová" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Přízračně bílá" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Aliciina modrá" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Levandulová" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Kouřově bílá" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Černá" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Korálový oheň" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Mořská sasanka" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Hluboká propast" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Humří červená" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Písčitá hlína" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Naplavené dřevo" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Rakytník" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Útes při západu slunce" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tygří korál" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Růžový korál" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Záře mušle" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Písek" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Zlatá chaluha" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Duna ve slunci" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Jantarový nautilus" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Mořský citron" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Bledá hvězdice" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Jarní příliv" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Limetkové řasy" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Mořská tráva" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neonový plankton" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Les chaluh" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Smaragdová vlna" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Stín velryby" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Mořská želva" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Laguna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Tropický proud" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Půlnoční příkop" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Tmavá chaluha" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Křišťálový příboj" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Tyrkysová zátoka" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Obloha nad útesem" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Mělká obloha" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektrická modrá" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfín" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Hlubiny oceánu" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Velryba" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indigová propast" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Mořský ježek" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Levandulový korál" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Fialový příliv" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Hlubokomořská orchidej" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neonová medúza" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuchsiový korál" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Růžová medúza" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Pěna" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Mušlově bílá" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Oblázkově šedá" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Bouřkový mrak" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Inkoustově černá" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Zelenobéžová" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Písková žlutá" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Signální žlutá" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Zlatožlutá" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Medově žlutá" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Kukuřičně žlutá" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Narcisově žlutá" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Hnědobéžová" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Citronově žlutá" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Ústřicově bílá" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Světle slonovinová" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Zinkově žlutá" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Šedobéžová" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Olivově žlutá" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Řepkově žlutá" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Dopravní žlutá" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Okrově žlutá" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Dopravní oranžovožlutá" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Kari" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Melounově žlutá" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Janovcově žlutá" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Jiřinkově žlutá" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pastelově žlutá" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Perleťově béžová" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Perleťově zlatá" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Slunečně žlutá" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Žlutooranžová" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Sytě oranžová" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Rumělková" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Perleťově oranžová" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Čistě oranžová" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Zářivě oranžová" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Zářivě jasně oranžová" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Jasně červenooranžová" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Dopravní oranžová" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Signální oranžová" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Lososově oranžová" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Perleťově růžová" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Měděně oranžová" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Signální hnědá" +# AI Translated +# Needs human review: RAL color name, probably a typo of the source; rendering follows the English literally. msgid "Fir orange" -msgstr "" +msgstr "Jedlově oranžová" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Signální červená" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Zářivě červená" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karmínově červená" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Perleťově karmínově červená" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Čistě červená" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Zářivě sytě červená" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Rybízově červená" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Perleťově rubínově červená" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Ohnivě červená" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rubínově červená" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Purpurově červená" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Vínově červená" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Černočervená" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oxidově červená" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Hnědočervená" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Borovicově červená" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Rajčatově červená" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Starorůžová" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Korálově červená" +# AI Translated +# Needs human review: RAL color name; 'Rosé' is kept as a loan word. msgid "Rose" -msgstr "" +msgstr "Rosé" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Jahodově červená" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Dopravní červená" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Lososově růžová" +# AI Translated +# Needs human review: RAL color name; 'Rosé' is kept as a loan word. msgid "Luminous rose" -msgstr "" +msgstr "Zářivě rosé" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Zářivě jasně červená" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Malinově červená" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Orientální červená" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Perleťový rubín" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Červenopurpurová" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Červenofialová" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Vřesově fialová" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordeaux fialová" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Mahagonová" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Šedopurpurová" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Signální fialová" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Jedlově zelená" +# AI Translated +# Needs human review: RAL color name; check. msgid "Sabine grey" -msgstr "" +msgstr "Sabinská šedá" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Perleťově fialová" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Perleťově ostružinová" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Zelenomodrá" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarínově modrá" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Safírově modrá" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Černomodrá" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Signální modrá" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Brilantní modrá" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Šedomodrá" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azurově modrá" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Hořcově modrá" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobaltově modrá" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Holubí modrá" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Dopravní modrá" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Tyrkysově modrá" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Capri modrá" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Oceánově modrá" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Vodově modrá" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Noční modrá" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Vzdálená modrá" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pastelově modrá" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Perleťově hořcově modrá" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Perleťově půlnočně modrá" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patinově zelená" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Smaragdově zelená" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Listově zelená" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Olivově zelená" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Modrozelená" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Mechově zelená" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Šedoolivová" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Borovicově zelená" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Borovicově hnědá" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Trávově zelená" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Rezedově zelená" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Hnědozelená" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Rákosově zelená" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Černozelená" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Tyrkysově zelená" +# AI Translated msgid "May green" -msgstr "" +msgstr "Májově zelená" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Chromoxidově zelená" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Dopravní zelená" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Kapradinově zelená" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opálově zelená" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Mátově zelená" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Bronzově zelená" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Perleťově zelená" +# AI Translated +# Needs human review: RAL color name; 'Sax' may be Saxon or sax blue; check. msgid "Sax turquoise" -msgstr "" +msgstr "Saská tyrkysová" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Perleťově tyrkysová" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Perleťově nefritová" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Čistě zelená" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Zářivě zelená" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Veverčí šedá" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Stříbrně šedá" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Olivově šedá" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Mechově šedá" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Signální šedá" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Myší šedá" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Béžovošedá" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Khaki šedá" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Zelenošedá" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Plachtová šedá" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Železně šedá" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Čedičově šedá" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Hnědošedá" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Břidlicově šedá" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antracitově šedá" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Světle šedá" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umbrově šedá" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Betonově šedá" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafitově šedá" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Žulově šedá" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Kamenně šedá" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Oblázkově šedá" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Cementově šedá" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Žlutošedá" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platinově šedá" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Prašně šedá" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Achátově šedá" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Křemenně šedá" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Okenní šedá" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Dopravní šedá A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Dopravní šedá B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Hedvábně šedá" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telešedá 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telešedá 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telešedá 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Perleťově myší šedá" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Zelenohnědá" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Okrově hnědá" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Jílově hnědá" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Měděně hnědá" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Čokoládově hnědá" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Olivově hnědá" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Ořechově hnědá" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Červenohnědá" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sépiově hnědá" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Kaštanově hnědá" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Mahagonově hnědá" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Šedohnědá" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Perleťově měděná" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Béžovohnědá" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Perleťově mokka hnědá" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Zemitě hnědá" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Perleťově hnědá" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Krémová" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Šedobílá" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Signální bílá" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Signální černá" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Sytě černá" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Bílý hliník" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Šedý hliník" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Čistě bílá" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Grafitově černá" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Dopravní bílá" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Dopravní černá" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papyrově bílá" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Perleťově světle šedá" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Kov: Stříbro" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Kov: Mosaz" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Kov: Zlato" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Kov: Měď" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Kov: Bronz" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Příroda: Perleť" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Příroda: Duha" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Příroda: Jasná obloha" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Příroda: Západ slunce" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Dřevo: Tmavé" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Dřevo: Střední" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Dřevo: Světlé" # AI Translated msgid "Alternate nozzles:" @@ -32747,13 +33188,25 @@ msgstr "Odebrat z Mých textur" msgid "Built-in" msgstr "Vestavěné" +# AI Translated +msgid "My textures" +msgstr "Moje textury" + # AI Translated msgid "No textures found." msgstr "Nebyly nalezeny žádné textury." # AI Translated -msgid "My textures" -msgstr "Moje textury" +msgid "Texture libraries" +msgstr "Knihovny textur" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Prozkoumat další knihovny textur" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Otevře OrcaCloud na domovské stránce a umožní procházet pluginy." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33156,11 +33609,13 @@ msgstr "Mapováno podle vlastního rozložení UV modelu, které už je umístě msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Jak široká je jedna kopie textury na modelu. Menší hodnota opakuje vzor častěji a zjemňuje jeho detaily; při vypnutém Dláždění je to velikost jediné kopie." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Větší" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Menší" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33236,11 +33691,15 @@ msgstr "Míchané barvy" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Nejvyšší počet míchaných filamentů, které může zapečení přidat. Vybírají se z barev textury a vytvoří se pouze ty, které zapečení skutečně použije." +# AI Translated +# Needs human review: Label on the mixed-colors tip image (few vs many colors); check it reads right. msgid "Few" -msgstr "" +msgstr "Málo" +# AI Translated +# Needs human review: Label on the mixed-colors tip image (few vs many colors); check it reads right. msgid "Many" -msgstr "" +msgstr "Mnoho" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33601,11 +34060,13 @@ msgstr "Přesíťování" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Velikost trojúhelníků, se kterou se celý model znovu sestaví, v milimetrech. Reliéf funguje nejlépe na rovnoměrné síti; tímto ji vytvoříte z nerovnoměrného importu." +# AI Translated msgid "Before" -msgstr "" +msgstr "Před" +# AI Translated msgid "After" -msgstr "" +msgstr "Po" # AI Translated msgid "Keep sharp edges" @@ -35498,6 +35959,10 @@ msgstr "Skript" msgid "Slicing Pipeline" msgstr "Proces slicování" +# AI Translated +msgid "Resource Texture" +msgstr "Textura zdroje" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Konfigurační rozhraní pluginu bylo prázdné. Zobrazuje se výchozí editor." @@ -35645,6 +36110,30 @@ msgstr "Adresář pluginu obsahuje vstupní soubory .py i .whl" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Adresář pluginu neobsahuje vstupní soubor .py ani .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Adresář textury zdroje není nastaven" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Adresář textury zdroje se nepodařilo určit" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Cesta textury zdroje není adresář" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Složku pluginu se nepodařilo určit" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Adresář textury zdroje je mimo složku pluginu" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Adresář textury zdroje se nepodařilo přečíst" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36593,6 +37082,27 @@ msgstr "" "Zamezte kroucení\n" "Víte, že při tisku materiálů náchylných ke kroucení, jako je ABS, může vhodné zvýšení teploty vyhřívané desky snížit pravděpodobnost kroucení?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Dalmatská žlutá" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Kapsantinově fialová" + +# AI Translated +# Needs human review: RAL color name written as one word in the source; check. +#~ msgid "Olivestone" +#~ msgstr "Olivový kámen" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Dostupné kdekoli v okně, i při psaní do textového pole." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Globální zkratky platí i při psaní." + # AI Translated #~ msgid "Please choose the filament color" #~ msgstr "Vyberte prosím barvu filamentu" diff --git a/localization/i18n/de/OrcaSlicer_de.po b/localization/i18n/de/OrcaSlicer_de.po index 9b375ba41d..47f2917e80 100644 --- a/localization/i18n/de/OrcaSlicer_de.po +++ b/localization/i18n/de/OrcaSlicer_de.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: Heiko Liebscher \n" "Language-Team: \n" @@ -769,18 +769,22 @@ msgstr "Auswahl" msgid "Plate" msgstr "Platte" +# AI Translated +# Needs human review: Glossary has no German term yet; Verteilen matches the existing Ausrichten/Verteilen. msgid "Distribute" -msgstr "" +msgstr "Verteilen" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Koordinatensystem, das für Transformationsaktionen verwendet wird." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Referenz für die Ausrichtung" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Mindestens 3 Teile oder Objekte auswählen" # AI Translated msgid "Align left" @@ -833,8 +837,9 @@ msgstr "Oben-unten verteilen" msgid "Drop" msgstr "Ablegen" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Die Auswahl entlang Z verschieben, sodass ihr tiefster Punkt das Druckbett berührt." # AI Translated msgid "Absolute" @@ -2058,17 +2063,21 @@ msgstr "Assembly Gizmo benutzen" msgid "Leaving Assembly gizmo" msgstr "Assembly Gizmo verlassen" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Teile eines geschnittenen Objekts können nicht verschoben werden" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Die Ausrichtung an der Platte ist nur in X und Y verfügbar" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Automatisches Ablegen für die ausgewählten Objekte ausschalten, um sie in Z zu verschieben" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Alle ausgewählten Objekte müssen auf derselben Platte liegen" msgid "Shift+" msgstr "Umschalt+" @@ -6462,8 +6471,10 @@ msgstr "Achsen" msgid "Gridlines" msgstr "Rasterlinien" +# AI Translated +# Needs human review: Glossary has no German term for Focus mode yet; Fokusmodus chosen. msgid "Focus mode" -msgstr "" +msgstr "Fokusmodus" msgid "Labels" msgstr "Beschriftungen" @@ -6524,7 +6535,7 @@ msgstr "Volumen:" msgid "Size:" msgstr "Größe:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Konflikte von G-Code-Pfaden wurden bei Layer %d, Z = %.2lf mm gefunden.Bitte trennen Sie die konfliktbehafteten Objekte weiter voneinander (%s <-> %s)." @@ -10836,11 +10847,13 @@ msgstr "Nicht unterstützte Profile anzeigen" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Zeigt inkompatible/nicht unterstützte Profile in den Dropdown-Listen für Drucker und Filament an. Diese Profile können nicht ausgewählt werden." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Statistiken mit dem G-Code exportieren" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Wenn aktiviert, werden beim Exportieren einer G-Code-Datei auch deren Statistiken als JSON daneben geschrieben, als .statistics.json, und eine exportierte geslicte 3MF-Datei enthält sie intern: Druckzeit, Filament- und Linientyp-Summen sowie dieselben Werte pro Schicht und pro Objekt." msgid "Experimental Features" msgstr "Experimentelle Funktionen" @@ -11697,6 +11710,10 @@ msgstr "Die Datei konnte nicht in den Speicher des Druckers hochgeladen werden. msgid "Send Failed" msgstr "Senden fehlgeschlagen" +# AI Translated +msgid "No available printers" +msgstr "Keine verfügbaren Drucker" + msgid "The name length exceeds the limit." msgstr "Die Namenslänge überschreitet das Limit." @@ -13523,8 +13540,8 @@ msgid "Left mouse" msgstr "Linke Maustaste" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Überall im Fenster verfügbar, auch während der Eingabe in ein Textfeld." +msgid "Available anywhere in the window." +msgstr "Überall im Fenster verfügbar." # AI Translated msgid "Run favorite 1 to 10" @@ -13636,10 +13653,6 @@ msgstr "%s ist %s zugewiesen. Stattdessen %s zuweisen?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Das Standardkürzel %s ist %s zugewiesen. Stattdessen %s zuweisen?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Globale Tastenkürzel gelten auch während der Texteingabe." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Eine Taste, die ein Zeichen eingibt, kann kein globales Tastenkürzel sein." @@ -14083,9 +14096,10 @@ msgstr "Modifizierer „%1%“ von „%2%“ (%3% insgesamt) hatte keine Auswirk msgid "Seam placement may differ from expected." msgstr "Die Nahtplatzierung kann von der erwarteten abweichen." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Die G-Code-Statistiken konnten nicht nach %1% geschrieben werden." msgid "Internal Bridge" msgstr "Interne Brücke" @@ -17443,6 +17457,14 @@ msgstr "Objekte ausschließen" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Aktivieren Sie diese Option, um den Befehl EXCLUDE OBJECT im G-Code hinzuzufügen." +# AI Translated +msgid "Outline tolerance" +msgstr "Umrisstoleranz" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Maximale Abweichung des in EXCLUDE_OBJECT_DEFINE geschriebenen Objektumrisses vom ursprünglichen Umriss. Größere Werte ergeben weniger Punkte, was Firmware hilft, die beim Verarbeiten von G-Code mit vielen Objekten hängen bleibt. 0 behält jeden Punkt." + msgid "Verbose G-code" msgstr "ausführlicher G-Code" @@ -20628,11 +20650,13 @@ msgstr "Ausgabeverzeichnis" msgid "This is the output directory for exported files." msgstr "Ausgabeverzeichnis für die exportierten Dateien." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Statistiken exportieren" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Schreibt die Statistiken jeder gesliceten Platte als JSON, als plate_N.statistics.json neben ihrem G-Code im Ausgabeverzeichnis und in der 3MF von --export-3mf: Druckzeit, Filament- und Linientyp-Summen sowie dieselben Werte pro Schicht und pro Objekt." msgid "Debug level" msgstr "Fehlersuchstufe" @@ -30391,1231 +30415,1648 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "Die aktuelle Filamentliste enthält %s nicht. Ein vom Mischfilament benötigtes Projektfilament wird nach der Zerlegung automatisch erstellt." msgstr[1] "Die aktuelle Filamentliste enthält %s nicht. Vom Mischfilament benötigte Projektfilamente werden nach der Zerlegung automatisch erstellt." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Farbwähler" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Grundfarben" +# AI Translated +# Needs human review: Glossary has no German term for Palette yet; Palette chosen. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca-Palette" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Classic" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Verläufe" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Einfarbig" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Verlauf" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Verlaufsanfang" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Verlaufsende" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Verlaufsfarbe" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Farbe hinzufügen" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Farbe entfernen" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Sättigung" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Ursprüngliche Farbe" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Aktuelle Farbe speichern" +# AI Translated +# Needs human review: Glossary has no German term for Palette yet; Palette/Paletten chosen. msgid "Palettes" -msgstr "" +msgstr "Paletten" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Farben suchen" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Farben filtern" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Keine passenden Farben" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Hex-Farbe" # AI Translated msgid "Opacity" msgstr "Deckkraft" +# AI Translated +# Needs human review: Label of the opacity percent input in the color picker; check it reads right next to the field. msgid "Opacity percent" -msgstr "" +msgstr "Deckkraft in Prozent" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Farbe speichern" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Eine vollständige Hexadezimalfarbe eingeben" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Die aktuelle Mehrfarbenauswahl bleibt erhalten, bis eine andere Farbe gewählt wird." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Bis zu %d Farben werden unterstützt." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmesin" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Orangerot" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Tomate" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Orange" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Dunkelorange" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Gold" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Holzbraun" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Biskuit" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Nebelrosa" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Hellgelb" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Zitronenchiffon" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beige" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Hellgoldrutengelb" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Blasse Goldrute" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Khaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Dunkelkhaki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Pfirsichhauch" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mokassin" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papayacreme" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Geschälte Mandel" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antikweiß" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navajoweiß" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Weizen" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Goldrute" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Schokolade" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Ziegelrot" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Sattelbraun" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Braun" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Rosabraun" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Lachs" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Helles Lachs" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Dunkles Lachs" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Sandbraun" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Koralle" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Helle Koralle" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Indischrot" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Dunkelrot" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Kastanienrot" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Grüngelb" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Gelbgrün" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Rasengrün" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Limettengrün" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Frühlingsgrün" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Mittel-Frühlingsgrün" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Limette" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Waldgrün" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Dunkelgrün" +# AI Translated +# Needs human review: CSS olive drab has no common German name; Mattoliv chosen. msgid "Olive drab" -msgstr "" +msgstr "Mattoliv" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliv" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Dunkelolivgrün" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Blassgrün" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Hellgrün" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Mittel-Meergrün" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Meergrün" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Dunkelmeergrün" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Kadettenblau" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Mittel-Aquamarin" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Türkis" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Mitteltürkis" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Dunkeltürkis" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Blasstürkis" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Hellcyan" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Minzcreme" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Honigmelone" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Aquamarin" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Hellmeergrün" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Dunkelcyan" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Petrol" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Dunkelschiefergrau" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Hellschiefergrau" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Schiefergrau" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Tiefhimmelblau" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodgerblau" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Himmelblau" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Hellhimmelblau" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Hellblau" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Puderblau" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Hellstahlblau" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Stahlblau" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Kornblumenblau" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Königsblau" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Mittelblau" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Mitternachtsblau" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Dunkelblau" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Marineblau" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Schieferblau" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Dunkelschieferblau" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Mittelschieferblau" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Blauviolett" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indigo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Dunkelviolett" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Dunkelorchidee" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Mittelorchidee" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orchidee" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Violett" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Mittelpurpur" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Purpur" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebecca-Purpur" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Mittelviolettrot" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Blassviolettrot" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Tiefrosa" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Knallrosa" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Hellrosa" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rosa" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Pflaume" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Distel" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuchsia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Dunkelmagenta" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Leinen" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Altspitze" +# AI Translated +# Needs human review: Color name (CSS seashell), not the print Shell; glossary Shell warning is a false match. msgid "Sea shell" -msgstr "" +msgstr "Muschel" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Elfenbein" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Blütenweiß" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lavendelrosa" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Geisterweiß" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Aliceblau" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lavendel" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Rauchweiß" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Schwarz" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Korallenfeuer" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Seeanemone" +# AI Translated +# Needs human review: Ocean-themed color name; check the German rendering. msgid "Deep abyss" -msgstr "" +msgstr "Tiefer Abgrund" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Hummerrot" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Sandton" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Treibholz" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Sanddorn" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Sonnenuntergangsriff" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tigerkoralle" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Rosakoralle" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Muschelglanz" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Sand" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Goldkelp" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Sonnenbeschienene Düne" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Bernstein-Nautilus" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Seezitrone" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Blasser Seestern" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Springflut" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Limettenalge" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Seegras" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neonplankton" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Kelpwald" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Smaragdwelle" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Walschatten" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Meeresschildkröte" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Lagune" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Tropenströmung" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Mitternachtsgraben" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Dunkelkelp" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Kristallbrandung" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Türkisbucht" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Himmel über dem Riff" +# AI Translated +# Needs human review: Ocean-themed color name; check the German rendering. msgid "Shallow sky" -msgstr "" +msgstr "Flachwasserhimmel" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektroblau" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfin" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Meerestiefen" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Wal" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indigoabgrund" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Seeigel" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Lavendelkoralle" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Violette Flut" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Tiefsee-Orchidee" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neonqualle" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuchsiakoralle" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Rosa Qualle" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Schaum" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Muschelweiß" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Kieselgrau" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Gewitterwolke" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Tintenschwarz" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Grünbeige" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Sandgelb" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Signalgelb" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Goldgelb" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Honiggelb" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Maisgelb" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Narzissengelb" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Braunbeige" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Zitronengelb" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Perlweiß" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Hellelfenbein" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Zinkgelb" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Graubeige" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Olivgelb" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Rapsgelb" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Verkehrsgelb" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Ockergelb" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Verkehrsorangegelb" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Melonengelb" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Ginstergelb" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Dahliengelb" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pastellgelb" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Perlbeige" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Perlgold" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Sonnengelb" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Gelborange" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Tieforange" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Zinnoberrot" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Perlorange" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Reinorange" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Leuchtorange" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Leuchthellorange" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Hellrotorange" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Verkehrsorange" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Signalorange" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Lachsorange" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Perlrosa" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Kupferorange" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Signalbraun" +# AI Translated +# Needs human review: Unusual name (fir = Tanne); check the German colour name. msgid "Fir orange" -msgstr "" +msgstr "Tannenorange" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Signalrot" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Leuchtrot" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karminrot" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Perlkarminrot" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Reinrot" +# AI Translated +# Needs human review: Nonstandard RAL name; Leuchttiefrot is a literal rendering. msgid "Luminous deep red" -msgstr "" +msgstr "Leuchttiefrot" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Johannisbeerrot" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Perlrubinrot" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Feuerrot" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rubinrot" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Purpurrot" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Weinrot" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Schwarzrot" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oxidrot" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Braunrot" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Kiefernrot" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Tomatenrot" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Altrosa" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Korallenrot" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rosé" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Erdbeerrot" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Verkehrsrot" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Lachsrosa" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Leuchtrosa" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Leuchthellrot" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Himbeerrot" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Orientrot" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Perlrubin" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Rotpurpur" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Rotviolett" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Erikaviolett" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordeauxviolett" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Mahagoni" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Graupurpur" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Signalviolett" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Tannengrün" +# AI Translated msgid "Sabine grey" -msgstr "" +msgstr "Sabinegrau" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Perlviolett" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Perlbrombeer" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Grünblau" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarinblau" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Saphirblau" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Schwarzblau" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Signalblau" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Brillantblau" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Graublau" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azurblau" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Enzianblau" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobaltblau" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Taubenblau" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Verkehrsblau" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Türkisblau" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Capriblau" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Ozeanblau" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Wasserblau" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Nachtblau" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Fernblau" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pastellblau" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Perlenzianblau" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Perl-Mitternachtsblau" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patinagrün" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Smaragdgrün" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Laubgrün" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Olivgrün" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Blaugrün" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Moosgrün" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Grauoliv" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Kieferngrün" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Kiefernbraun" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Grasgrün" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Resedagrün" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Braungrün" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Schilfgrün" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Schwarzgrün" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Türkisgrün" +# AI Translated msgid "May green" -msgstr "" +msgstr "Maigrün" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Chromoxidgrün" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Verkehrsgrün" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Farngrün" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opalgrün" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Minzgrün" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Bronzegrün" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Perlgrün" +# AI Translated +# Needs human review: Unclear RAL-style name (Sax = Saxe blue?); check the German colour name. msgid "Sax turquoise" -msgstr "" +msgstr "Sax-Türkis" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Perltürkis" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Perljade" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Reingrün" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Leuchtgrün" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Eichhörnchengrau" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Silbergrau" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Olivgrau" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Moosgrau" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Signalgrau" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Mausgrau" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Beigegrau" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Khakigrau" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Grüngrau" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Zeltgrau" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Eisengrau" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Basaltgrau" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Braungrau" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Schiefergrau" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Anthrazitgrau" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Hellgrau" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umbragrau" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Betongrau" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Graphitgrau" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Granitgrau" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Steingrau" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Kieselgrau" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Zementgrau" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Gelbgrau" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platingrau" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Staubgrau" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Achatgrau" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Quarzgrau" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Fenstergrau" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Verkehrsgrau A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Verkehrsgrau B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Seidengrau" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegrau 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegrau 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegrau 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Perlmausgrau" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Grünbraun" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Ockerbraun" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Lehmbraun" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Kupferbraun" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Schokoladenbraun" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Olivbraun" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Nussbraun" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Rotbraun" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sepiabraun" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Kastanienbraun" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Mahagonibraun" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Graubraun" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Perlkupfer" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Beigebraun" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Perlmokkabraun" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Erdbraun" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Perlbraun" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Creme" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Grauweiß" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Signalweiß" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Signalschwarz" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Tiefschwarz" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Weißaluminium" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Graualuminium" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Reinweiß" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Graphitschwarz" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Verkehrsweiß" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Verkehrsschwarz" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papyrusweiß" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Perlhellgrau" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metall: Silber" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metall: Messing" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metall: Gold" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metall: Kupfer" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metall: Bronze" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Natur: Perle" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Natur: Regenbogen" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Natur: Klarer Himmel" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Natur: Sonnenuntergang" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Holz: Dunkel" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Holz: Mittel" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Holz: Hell" # AI Translated msgid "Alternate nozzles:" @@ -32091,13 +32532,25 @@ msgstr "Aus „Meine Texturen“ entfernen" msgid "Built-in" msgstr "Integriert" +# AI Translated +msgid "My textures" +msgstr "Meine Texturen" + # AI Translated msgid "No textures found." msgstr "Keine Texturen gefunden." # AI Translated -msgid "My textures" -msgstr "Meine Texturen" +msgid "Texture libraries" +msgstr "Texturbibliotheken" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Weitere Texturbibliotheken entdecken" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Öffnet OrcaCloud auf der Startseite, um nach Plugins zu suchen." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -32500,11 +32953,13 @@ msgstr "Abgebildet über das eigene UV-Layout des Modells, das bereits die Platz msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Wie breit eine Kopie der Textur auf dem Modell ist. Kleinere Werte wiederholen das Muster häufiger und machen seine Details feiner; bei deaktiviertem „Kacheln“ ist dies die Größe der einzelnen Kopie." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Größer" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Kleiner" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -32580,11 +33035,14 @@ msgstr "Mischfarben" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Die maximale Anzahl an Mischfilamenten, die beim Einbrennen hinzugefügt werden darf. Sie werden aus den Farben der Textur ausgewählt, und nur diejenigen, die das Einbrennen tatsächlich verwendet, werden erstellt." +# AI Translated +# Needs human review: Caption under an illustration in the texture displacement mixed-colors option; check it reads right as a pair with Many. msgid "Few" -msgstr "" +msgstr "Wenige" +# AI Translated msgid "Many" -msgstr "" +msgstr "Viele" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -32940,11 +33398,13 @@ msgstr "Neuvernetzung" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Dreiecksgröße, mit der das ganze Modell neu aufgebaut wird, in Millimetern. Die Verschiebung funktioniert am besten auf einem gleichmäßigen Netz; so entsteht eines aus einem ungleichmäßigen Import." +# AI Translated msgid "Before" -msgstr "" +msgstr "Vorher" +# AI Translated msgid "After" -msgstr "" +msgstr "Nachher" # AI Translated msgid "Keep sharp edges" @@ -34799,6 +35259,10 @@ msgstr "Skript" msgid "Slicing Pipeline" msgstr "Slicing-Pipeline" +# AI Translated +msgid "Resource Texture" +msgstr "Ressourcentextur" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Die Konfigurationsoberfläche des Plugins war leer. Der Standardeditor wird angezeigt." @@ -34946,6 +35410,30 @@ msgstr "Das Plugin-Verzeichnis enthält sowohl .py- als auch .whl-Einstiegsdatei msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Das Plugin-Verzeichnis enthält keine .py- oder .whl-Einstiegsdatei" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Das Verzeichnis der Ressourcentextur ist nicht festgelegt" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Das Verzeichnis der Ressourcentextur konnte nicht aufgelöst werden" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Der Pfad der Ressourcentextur ist kein Verzeichnis" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Der Plugin-Ordner konnte nicht aufgelöst werden" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Das Verzeichnis der Ressourcentextur liegt außerhalb des Plugin-Ordners" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Das Verzeichnis der Ressourcentextur konnte nicht gelesen werden" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -35894,6 +36382,29 @@ msgstr "" "Verwerfungen vermeiden\n" "Wussten Sie, dass beim Drucken von Materialien, die zu Verwerfungen neigen, wie z.B. ABS, durch eine entsprechende Erhöhung der Heizbetttemperatur die Wahrscheinlichkeit von Verwerfungen verringert werden kann?" +# AI Translated +# Needs human review: Likely RAL 1007 daffodil yellow (Narzissengelb); source name is nonstandard. +#~ msgid "Dalmatian yellow" +#~ msgstr "Narzissengelb" + +# AI Translated +# Needs human review: Source likely a typo for RAL 5019 Capri blue (sits between Turquoise blue and Ocean blue); translated as Capriblau. +#~ msgid "Capsanthin violet" +#~ msgstr "Capriblau" + +# AI Translated +# Needs human review: Source likely a typo for RAL 7002 Olive grey; translated as Olivgrau. +#~ msgid "Olivestone" +#~ msgstr "Olivgrau" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Überall im Fenster verfügbar, auch während der Eingabe in ein Textfeld." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Globale Tastenkürzel gelten auch während der Texteingabe." + #~ msgid "Please choose the filament color" #~ msgstr "Bitte wählen Sie die Filamentfarbe" diff --git a/localization/i18n/en/OrcaSlicer_en.po b/localization/i18n/en/OrcaSlicer_en.po index 4b74f97b4c..7152dd5f56 100644 --- a/localization/i18n/en/OrcaSlicer_en.po +++ b/localization/i18n/en/OrcaSlicer_en.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2026-06-17 15:44-0300\n" "Last-Translator: Alexandre Folle de Menezes\n" "Language-Team: \n" @@ -6045,7 +6045,7 @@ msgstr "" msgid "Size:" msgstr "" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "" @@ -10653,6 +10653,9 @@ msgstr "" msgid "Send Failed" msgstr "" +msgid "No available printers" +msgstr "" + msgid "The name length exceeds the limit." msgstr "" @@ -12311,7 +12314,7 @@ msgstr "" msgid "Left mouse" msgstr "" -msgid "Available anywhere in the window, even while typing in a text field." +msgid "Available anywhere in the window." msgstr "" msgid "Run favorite 1 to 10" @@ -12408,9 +12411,6 @@ msgstr "" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "" -msgid "Global shortcuts also apply while typing." -msgstr "" - msgid "A key that types a character cannot be a global shortcut." msgstr "" @@ -15641,6 +15641,12 @@ msgstr "" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "" +msgid "Outline tolerance" +msgstr "" + +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "" + msgid "Verbose G-code" msgstr "" @@ -26488,17 +26494,18 @@ msgstr "" msgid "Basic Colors" msgstr "" +#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. msgid "Orca Palette" msgstr "" -#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. +#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "RAL Classic" msgstr "" -#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "Gradients" msgstr "" +msgctxt "Color picker" msgid "Solid" msgstr "" @@ -26873,7 +26880,7 @@ msgstr "" msgid "Medium violet red" msgstr "" -msgid "PaleV violet red" +msgid "Pale violet red" msgstr "" msgid "Deep pink" @@ -27035,7 +27042,7 @@ msgstr "" msgid "Shallow sky" msgstr "" -msgid "Electric bel" +msgid "Electric blue" msgstr "" msgid "Dolphin" @@ -27104,7 +27111,7 @@ msgstr "" msgid "Maize yellow" msgstr "" -msgid "Dalmatian yellow" +msgid "Daffodil yellow" msgstr "" msgid "Brown beige" @@ -27365,7 +27372,7 @@ msgstr "" msgid "Turquoise blue" msgstr "" -msgid "Capsanthin violet" +msgid "Capri blue" msgstr "" msgid "Ocean blue" @@ -27479,7 +27486,7 @@ msgstr "" msgid "Silver grey" msgstr "" -msgid "Olivestone" +msgid "Olive grey" msgstr "" msgid "Moss grey" @@ -28067,10 +28074,19 @@ msgstr "" msgid "Built-in" msgstr "" +msgid "My textures" +msgstr "" + msgid "No textures found." msgstr "" -msgid "My textures" +msgid "Texture libraries" +msgstr "" + +msgid "Explore more texture libraries" +msgstr "" + +msgid "Opens OrcaCloud in the Home page to browse for plugins." msgstr "" msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -30123,6 +30139,9 @@ msgstr "" msgid "Slicing Pipeline" msgstr "" +msgid "Resource Texture" +msgstr "" + msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "" @@ -30238,6 +30257,24 @@ msgstr "" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "" +msgid "Resource texture directory is not set" +msgstr "" + +msgid "Resource texture directory could not be resolved" +msgstr "" + +msgid "Resource texture path is not a directory" +msgstr "" + +msgid "Plugin folder could not be resolved" +msgstr "" + +msgid "Resource texture directory is outside the plugin folder" +msgstr "" + +msgid "Resource texture directory could not be read" +msgstr "" + #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" msgstr "" diff --git a/localization/i18n/es/OrcaSlicer_es.po b/localization/i18n/es/OrcaSlicer_es.po index 106bbd7d36..85c4ebe695 100644 --- a/localization/i18n/es/OrcaSlicer_es.po +++ b/localization/i18n/es/OrcaSlicer_es.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: Ian A. Bassi <>\n" "Language-Team: \n" @@ -722,17 +722,21 @@ msgstr "Selección" msgid "Plate" msgstr "Cama" +# AI Translated +# Needs human review: Distribute has no glossary rendering yet; check the term. msgid "Distribute" -msgstr "" +msgstr "Distribuir" msgid "Coordinate system used for transform actions." msgstr "Sistema de coordenadas utilizado para las acciones de transformación." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Referencia de alineación" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Selecciona al menos 3 piezas u objetos" # AI Translated msgid "Align left" @@ -785,8 +789,9 @@ msgstr "Distribuir arriba-abajo" msgid "Drop" msgstr "Soltar" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Mueve la selección a lo largo de Z para que su punto más bajo toque la cama." msgid "Absolute" msgstr "Absoluto" @@ -2003,17 +2008,21 @@ msgstr "Entrando al mecanismo de ensamblaje" msgid "Leaving Assembly gizmo" msgstr "Saliendo del mecanismo de ensamblaje" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Las piezas de un objeto cortado no se pueden mover" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "La alineación con la cama solo está disponible en X e Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Desactiva Dejar caer automáticamente en los objetos seleccionados para moverlos en Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Todos los objetos seleccionados deben estar en la misma cama" msgid "Shift+" msgstr "Shift+" @@ -6316,8 +6325,10 @@ msgstr "Ejes" msgid "Gridlines" msgstr "Cuadrícula" +# AI Translated +# Needs human review: Name of a view mode hiding the surrounding UI; glossary cell is empty, check the term. msgid "Focus mode" -msgstr "" +msgstr "Modo de enfoque" msgid "Labels" msgstr "Etiquetas" @@ -6378,7 +6389,7 @@ msgstr "Volumen:" msgid "Size:" msgstr "Tamaño:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Se han encontrado conflictos de rutas G-Code en la capa %d, Z = %.2lfmm. Por favor, separe más los objetos en conflicto (%s <-> %s)." @@ -10602,11 +10613,13 @@ msgstr "Mostrar ajustes preestablecidos no compatibles" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Mostrar los ajustes preestablecidos incompatibles o no compatibles en los menús desplegables de impresoras y filamentos. Estos ajustes preestablecidos no se pueden seleccionar." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Exportar estadísticas con el G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Si se activa, al exportar un archivo G-code también se escriben sus estadísticas como JSON junto a él, como .statistics.json, y un archivo 3MF laminado exportado las contiene en su interior: tiempo de impresión, totales de filamento y por tipo de línea, y lo mismo por capa y por objeto." msgid "Experimental Features" msgstr "Funciones experimentales" @@ -11434,6 +11447,10 @@ msgstr "No se ha podido cargar el archivo en el almacenamiento de la impresora. msgid "Send Failed" msgstr "Envío fallido" +# AI Translated +msgid "No available printers" +msgstr "No hay impresoras disponibles" + msgid "The name length exceeds the limit." msgstr "La longitud del nombre supera el límite." @@ -13221,8 +13238,8 @@ msgid "Left mouse" msgstr "Botón izquierdo" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Disponible en cualquier parte de la ventana, incluso mientras se escribe en un campo de texto." +msgid "Available anywhere in the window." +msgstr "Disponible en cualquier parte de la ventana." # AI Translated msgid "Run favorite 1 to 10" @@ -13332,10 +13349,6 @@ msgstr "%s está asignado a %s. ¿Reasignarlo a %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "El %s predeterminado está asignado a %s. ¿Reasignarlo a %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Los atajos globales también se aplican mientras se escribe." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Una tecla que escribe un carácter no puede ser un atajo global." @@ -13775,9 +13788,10 @@ msgstr "el modificador \"%1%\" de \"%2%\" (%3% en total) no tuvo efecto en la co msgid "Seam placement may differ from expected." msgstr "La ubicación de la costura puede diferir de la esperada." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "No se pudieron escribir las estadísticas del G-code en %1%." msgid "Internal Bridge" msgstr "Puente Interior" @@ -17077,6 +17091,14 @@ msgstr "Excluir objetos" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Activar esta opción para añadir el comando EXCLUDE OBJECT en el G-Code." +# AI Translated +msgid "Outline tolerance" +msgstr "Tolerancia del contorno" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Desviación máxima del contorno del objeto escrito en EXCLUDE_OBJECT_DEFINE respecto al contorno original. Los valores más altos dan menos puntos, lo que ayuda al firmware que se bloquea al analizar G-code con muchos objetos. 0 conserva todos los puntos." + msgid "Verbose G-code" msgstr "G-Code detallado" @@ -20230,11 +20252,13 @@ msgstr "Directorio de salida" msgid "This is the output directory for exported files." msgstr "Directorio de salida para los archivos exportados." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Exportar estadísticas" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Escribe las estadísticas de cada cama laminada como JSON, como plate_N.statistics.json junto a su G-code en el directorio de salida y dentro del 3MF de --export-3mf: tiempo de impresión, totales de filamento y por tipo de línea, y lo mismo por capa y por objeto." msgid "Debug level" msgstr "Nivel de depuración" @@ -29930,1231 +29954,1648 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "La lista de filamentos actual no contiene %s. Tras la descomposición se creará automáticamente un filamento de proyecto necesario para el filamento mixto." msgstr[1] "La lista de filamentos actual no contiene %s. Tras la descomposición se crearán automáticamente los filamentos de proyecto necesarios para el filamento mixto." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Selector de color" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Colores básicos" +# AI Translated +# Needs human review: Palette has no glossary rendering yet; check the term. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Paleta Orca" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Classic" + +# AI Translated +# Needs human review: Gradient has no glossary rendering in this language; used the catalog's color-gradient term. msgid "Gradients" -msgstr "" +msgstr "Gradientes" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Sólido" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Gradiente" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Inicio del gradiente" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Fin del gradiente" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Color del gradiente" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Añadir color" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Eliminar color" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Saturación" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Color original" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Guardar color actual" +# AI Translated +# Needs human review: Palette has no glossary rendering yet; check the term. msgid "Palettes" -msgstr "" +msgstr "Paletas" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Buscar colores" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Filtrar colores" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "No hay colores coincidentes" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Color hexadecimal" # AI Translated msgid "Opacity" msgstr "Opacidad" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Porcentaje de opacidad" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Guardar color" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Introduce un color hexadecimal completo" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "La selección multicolor actual se mantiene hasta que elijas otro color." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Se admiten hasta %d colores." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Carmesí" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Rojo anaranjado" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Tomate" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Naranja" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Naranja oscuro" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Oro" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Madera clara" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Bizcocho" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Rosa brumoso" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Amarillo claro" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Gasa de limón" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beige" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Amarillo vara de oro claro" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Vara de oro pálido" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Caqui" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Caqui oscuro" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Melocotón suave" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mocasín" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Crema de papaya" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Almendra pelada" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Blanco antiguo" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Blanco navajo" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Trigo" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Vara de oro" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Chocolate" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Perú" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Ladrillo refractario" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Marrón cuero" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Marrón" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Marrón rosado" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Salmón" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Salmón claro" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Salmón oscuro" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Marrón arenoso" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Coral" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Coral claro" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Rojo indio" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Rojo oscuro" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Granate" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Verde amarillento" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Amarillo verdoso" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Verde césped" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Verde lima" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Verde primavera" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Verde primavera medio" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Lima" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Verde bosque" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Verde oscuro" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Verde oliva mate" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliva" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Verde oliva oscuro" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Verde pálido" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Verde claro" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Verde mar medio" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Verde mar" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Verde mar oscuro" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Azul cadete" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Aguamarina medio" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turquesa" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Turquesa medio" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Turquesa oscuro" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Turquesa pálido" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Agua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Cian claro" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Crema de menta" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Rocío de miel" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Aguamarina" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Verde mar claro" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Cian oscuro" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Verde azulado" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Gris pizarra oscuro" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Gris pizarra claro" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Gris pizarra" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Azul cielo intenso" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Azul Dodger" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Azul cielo" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Azul cielo claro" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Azul claro" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Azul polvo" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Azul acero claro" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Azul acero" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Azul aciano" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Azul real" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Azul medio" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Azul medianoche" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Azul oscuro" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Azul marino" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Azul pizarra" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Azul pizarra oscuro" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Azul pizarra medio" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Azul violeta" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Índigo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Violeta oscuro" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Orquídea oscura" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Orquídea media" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orquídea" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Violeta" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Púrpura medio" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Púrpura" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Púrpura Rebecca" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Rojo violeta medio" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Rojo violeta pálido" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Rosa intenso" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Rosa fuerte" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Rosa claro" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rosa" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Ciruela" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Cardo" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fucsia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Magenta oscuro" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Lino" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Encaje antiguo" +# AI Translated +# Needs human review: CSS color Seashell (a shell in the seafood sense); glossary Shell warning is a false match. msgid "Sea shell" -msgstr "" +msgstr "Concha marina" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Marfil" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Blanco floral" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Rubor de lavanda" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Blanco fantasma" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Azul Alicia" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lavanda" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Humo blanco" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Negro" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Fuego de coral" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Anémona de mar" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Abismo profundo" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Rojo langosta" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Arcilla arenosa" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Madera a la deriva" +# AI Translated +# Needs human review: Ocean-themed color name; check the plant name. msgid "Sea buckthorn" -msgstr "" +msgstr "Espino amarillo" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Arrecife al atardecer" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Coral tigre" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Coral rosa" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Resplandor de concha" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Arena" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Alga dorada" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Duna iluminada" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Nautilo ámbar" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Limón de mar" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Estrella de mar pálida" +# AI Translated +# Needs human review: Ocean-themed color name; check the sense (tide vs spring season). msgid "Spring tide" -msgstr "" +msgstr "Marea viva" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Alga lima" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Hierba marina" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Plancton neón" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Bosque de algas" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Ola esmeralda" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Sombra de ballena" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Tortuga marina" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Laguna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Corriente tropical" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Fosa de medianoche" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Alga oscura" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Oleaje cristalino" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Bahía turquesa" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Cielo sobre el arrecife" +# AI Translated +# Needs human review: Ocean-themed color name; check it reads as a pale sky blue. msgid "Shallow sky" -msgstr "" +msgstr "Cielo somero" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Azul eléctrico" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfín" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Profundidades oceánicas" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Ballena" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Abismo índigo" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Erizo de mar" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Coral lavanda" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Marea violeta" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Orquídea de aguas profundas" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Medusa neón" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Coral fucsia" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Medusa rosa" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Espuma" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Blanco concha" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Gris guijarro" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Nube de tormenta" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Negro tinta" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Beige verdoso" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Amarillo arena" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Amarillo señales" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Amarillo dorado" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Amarillo miel" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Amarillo maíz" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Amarillo narciso" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Beige amarronado" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Amarillo limón" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Blanco ostra" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Marfil claro" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Amarillo zinc" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Beige grisáceo" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Amarillo oliva" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Amarillo colza" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Amarillo tráfico" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Amarillo ocre" +# AI Translated +# Needs human review: RAL name; unusual source name, translated by its parts. msgid "Traffic orange yellow" -msgstr "" +msgstr "Amarillo anaranjado tráfico" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Amarillo melón" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Amarillo retama" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Amarillo dalia" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Amarillo pastel" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Beige perlado" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Oro perlado" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Amarillo sol" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Naranja amarillento" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Naranja intenso" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Bermellón" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Naranja perlado" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Naranja puro" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Naranja brillante" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Naranja claro brillante" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Rojo anaranjado claro" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Naranja tráfico" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Naranja señales" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Naranja salmón" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Rosa perlado" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Naranja cobre" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Marrón señales" +# AI Translated +# Needs human review: RAL name; 'Fir orange' looks odd in the source, translated literally. msgid "Fir orange" -msgstr "" +msgstr "Naranja abeto" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Rojo señales" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Rojo brillante" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Rojo carmín" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Rojo carmín perlado" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Rojo puro" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Rojo intenso brillante" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Rojo grosella" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Rojo rubí perlado" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Rojo fuego" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rojo rubí" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Rojo púrpura" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Rojo vino" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Rojo negruzco" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Rojo óxido" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Rojo amarronado" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Rojo pino" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Rojo tomate" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Rosa antiguo" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Rojo coral" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rosa" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Rojo fresa" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Rojo tráfico" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Rosa salmón" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Rosa brillante" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Rojo claro brillante" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Rojo frambuesa" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Rojo oriente" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Rubí perlado" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Púrpura rojizo" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Violeta rojizo" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Violeta brezo" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Violeta burdeos" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Caoba" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Púrpura grisáceo" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Violeta señales" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Verde abeto" +# AI Translated msgid "Sabine grey" -msgstr "" +msgstr "Gris sabino" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Violeta perlado" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Mora perlada" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Azul verdoso" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Azul ultramar" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Azul zafiro" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Azul negruzco" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Azul señales" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Azul brillante" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Azul grisáceo" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azul azur" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Azul genciana" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Azul cobalto" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Azul paloma" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Azul tráfico" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Azul turquesa" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Azul Capri" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Azul océano" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Azul agua" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Azul noche" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Azul lejano" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Azul pastel" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Azul genciana perlado" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Azul medianoche perlado" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Verde pátina" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Verde esmeralda" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Verde hoja" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Verde oliva" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Verde azulado" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Verde musgo" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Oliva grisáceo" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Verde pino" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Marrón pino" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Verde hierba" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Verde reseda" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Verde amarronado" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Verde caña" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Verde negruzco" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Verde turquesa" +# AI Translated msgid "May green" -msgstr "" +msgstr "Verde mayo" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Verde óxido de cromo" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Verde tráfico" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Verde helecho" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Verde ópalo" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Verde menta" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Verde bronce" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Verde perlado" +# AI Translated +# Needs human review: RAL name (Saxe blue-like turquoise); check the rendering. msgid "Sax turquoise" -msgstr "" +msgstr "Turquesa sajón" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Turquesa perlado" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Jade perlado" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Verde puro" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Verde brillante" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Gris ardilla" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Gris plata" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Gris oliva" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Gris musgo" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Gris señales" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Gris ratón" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Gris beige" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Gris caqui" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Gris verdoso" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Gris lona" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Gris hierro" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Gris basalto" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Gris amarronado" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Gris pizarra" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Gris antracita" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Gris claro" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Gris sombra" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Gris hormigón" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Gris grafito" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Gris granito" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Gris piedra" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Gris guijarro" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Gris cemento" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Gris amarillento" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Gris platino" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Gris polvo" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Gris ágata" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Gris cuarzo" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Gris ventana" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Gris tráfico A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Gris tráfico B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Gris seda" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegris 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegris 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegris 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Gris ratón perlado" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Marrón verdoso" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Marrón ocre" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Marrón arcilla" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Marrón cobre" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Marrón chocolate" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Marrón oliva" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Marrón nuez" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Marrón rojizo" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Marrón sepia" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Marrón castaño" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Marrón caoba" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Marrón grisáceo" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Cobre perlado" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Marrón beige" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Marrón moca perlado" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Marrón tierra" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Marrón perlado" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Crema" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Blanco grisáceo" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Blanco señales" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Negro señales" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Negro azabache" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Aluminio blanco" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Aluminio gris" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Blanco puro" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Negro grafito" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Blanco tráfico" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Negro tráfico" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Blanco papiro" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Gris claro perlado" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metal: Plata" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metal: Latón" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metal: Oro" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metal: Cobre" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metal: Bronce" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Naturaleza: Perla" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Naturaleza: Arcoíris" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Naturaleza: Cielo despejado" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Naturaleza: Atardecer" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Madera: Oscura" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Madera: Media" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Madera: Clara" # AI Translated msgid "Alternate nozzles:" @@ -31630,13 +32071,25 @@ msgstr "Quitar de Mis texturas" msgid "Built-in" msgstr "Integradas" +# AI Translated +msgid "My textures" +msgstr "Mis texturas" + # AI Translated msgid "No textures found." msgstr "No se encontraron texturas." # AI Translated -msgid "My textures" -msgstr "Mis texturas" +msgid "Texture libraries" +msgstr "Bibliotecas de texturas" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Explorar más bibliotecas de texturas" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Abre OrcaCloud en la página de inicio para explorar plugins." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -32039,11 +32492,15 @@ msgstr "Se mapea según la disposición UV del propio modelo, que ya es la ubica msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Ancho de una copia de la textura sobre el modelo. Un valor menor repite el patrón más a menudo y hace su detalle más fino; con Mosaico desactivado, es el tamaño de la copia única." +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Larger" -msgstr "" +msgstr "Más grande" +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Smaller" -msgstr "" +msgstr "Más pequeño" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -32119,11 +32576,15 @@ msgstr "Colores mezclados" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "El número máximo de filamentos mixtos que puede añadir un empotrado. Se eligen a partir de los colores de la textura y solo se crean los que el empotrado usa realmente." +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Few" -msgstr "" +msgstr "Pocos" +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Many" -msgstr "" +msgstr "Muchos" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -32479,11 +32940,15 @@ msgstr "Remallado" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Tamaño de triángulo con el que se reconstruye todo el modelo, en milímetros. El desplazamiento funciona mejor en una malla uniforme; esto es lo que la crea a partir de una importación irregular." +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Before" -msgstr "" +msgstr "Antes" +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "After" -msgstr "" +msgstr "Después" # AI Translated msgid "Keep sharp edges" @@ -34337,6 +34802,10 @@ msgstr "Script" msgid "Slicing Pipeline" msgstr "Flujo de laminado" +# AI Translated +msgid "Resource Texture" +msgstr "Textura de recursos" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "La interfaz de configuración del plugin estaba vacía. Se muestra el editor predeterminado." @@ -34484,6 +34953,30 @@ msgstr "El directorio del plugin contiene archivos de entrada .py y .whl a la ve msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "El directorio del plugin no contiene ningún archivo de entrada .py ni .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "El directorio de texturas de recursos no está establecido" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "No se pudo resolver el directorio de texturas de recursos" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "La ruta de texturas de recursos no es un directorio" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "No se pudo resolver la carpeta del plugin" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "El directorio de texturas de recursos está fuera de la carpeta del plugin" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "No se pudo leer el directorio de texturas de recursos" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -35429,6 +35922,27 @@ msgstr "" "Evita la deformación\n" "¿Sabías que al imprimir materiales propensos a la deformación como el ABS, aumentar adecuadamente la temperatura de la cama térmica puede reducir la probabilidad de deformaciones?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Amarillo Dalmacia" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Violeta capsantina" + +# AI Translated +# Needs human review: RAL grey name, single coined word; translated literally. +#~ msgid "Olivestone" +#~ msgstr "Piedra oliva" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Disponible en cualquier parte de la ventana, incluso mientras se escribe en un campo de texto." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Los atajos globales también se aplican mientras se escribe." + #~ msgid "Please choose the filament color" #~ msgstr "Por favor, elija el color del filamento" diff --git a/localization/i18n/eu/OrcaSlicer_eu.po b/localization/i18n/eu/OrcaSlicer_eu.po index 940aa34a07..dc53326e7a 100644 --- a/localization/i18n/eu/OrcaSlicer_eu.po +++ b/localization/i18n/eu/OrcaSlicer_eu.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" -"PO-Revision-Date: 2026-07-20 13:33+0200\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" +"PO-Revision-Date: 2026-10-19 18:56+0200\n" "Last-Translator: Manu Goiogana \n" "Language-Team: \n" "Language: eu\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.9\n" +"X-Generator: Poedit 3.10\n" # AI Translated msgid "Main Extruder" @@ -32,15 +32,15 @@ msgstr "estrusore nagusia" # AI Translated msgid "Auxiliary Extruder" -msgstr "Estrusore lagungarria" +msgstr "Estrusore laguntzailea" # AI Translated msgid "Auxiliary extruder" -msgstr "Estrusore lagungarria" +msgstr "Estrusore laguntzailea" # AI Translated msgid "auxiliary extruder" -msgstr "estrusore lagungarria" +msgstr "estrusore laguntzailea" msgid "Left Extruder" msgstr "Ezkerreko estrusorea" @@ -74,15 +74,15 @@ msgstr "pita nagusia" # AI Translated msgid "Auxiliary Nozzle" -msgstr "Pita lagungarria" +msgstr "Pita laguntzailea" # AI Translated msgid "Auxiliary nozzle" -msgstr "Pita lagungarria" +msgstr "Pita laguntzailea" # AI Translated msgid "auxiliary nozzle" -msgstr "pita lagungarria" +msgstr "pita laguntzailea" msgid "Left Nozzle" msgstr "Ezkerreko pita" @@ -117,15 +117,15 @@ msgstr "hotend nagusia" # AI Translated msgid "Auxiliary Hotend" -msgstr "Hotend lagungarria" +msgstr "Hotend laguntzailea" # AI Translated msgid "Auxiliary hotend" -msgstr "Hotend lagungarria" +msgstr "Hotend laguntzailea" # AI Translated msgid "auxiliary hotend" -msgstr "hotend lagungarria" +msgstr "hotend laguntzailea" # AI Translated msgid "Left Hotend" @@ -157,7 +157,7 @@ msgstr "nagusia" # AI Translated msgid "auxiliary" -msgstr "lagungarria" +msgstr "laguntzailea" # AI Translated msgid "Main" @@ -165,7 +165,7 @@ msgstr "Nagusia" # AI Translated msgid "Auxiliary" -msgstr "Lagungarria" +msgstr "Laguntzailea" msgid "left" msgstr "ezkerra" @@ -754,17 +754,21 @@ msgstr "Hautaketa" msgid "Plate" msgstr "Plaka" +# AI Translated +# Needs human review: Glossary has no Basque rendering; Banatu chosen (command that spaces objects evenly, counterpart of Lerrokatu). msgid "Distribute" -msgstr "" +msgstr "Banatu" msgid "Coordinate system used for transform actions." msgstr "Eraldatze-ekintzetan erabilitako koordenatu-sistema." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Lerrokatzeko erreferentzia" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Hautatu gutxienez 3 pieza edo objektu" # AI Translated msgid "Align left" @@ -772,7 +776,7 @@ msgstr "Lerrokatu ezkerrean" # AI Translated msgid "Align left-right center" -msgstr "Lerrokatu erdian ezker-eskuin norabidean" +msgstr "Lerrokatu erdian X norabidean" # AI Translated msgid "Align right" @@ -785,7 +789,7 @@ msgstr "Lerrokatu aurrean" # AI Translated # Needs human review: Object menu item that aligns object centers on the plate's front-back (Y) axis; check that the 'aurre-atze' compound reads naturally. msgid "Align front-back center" -msgstr "Lerrokatu erdian aurre-atze norabidean" +msgstr "Lerrokatu erdian Y norabidean" # AI Translated msgid "Align back" @@ -798,7 +802,7 @@ msgstr "Lerrokatu behean" # AI Translated # Needs human review: Object menu item that aligns object centers on the vertical (Z) axis; check that the 'goi-behe' compound reads naturally. msgid "Align top-bottom center" -msgstr "Lerrokatu erdian goi-behe norabidean" +msgstr "Lerrokatu erdian Z norabidean" # AI Translated msgid "Align top" @@ -806,23 +810,24 @@ msgstr "Lerrokatu goian" # AI Translated msgid "Distribute left-right" -msgstr "Banatu ezker-eskuin norabidean" +msgstr "Berdinbanatu X norabidean" # AI Translated # Needs human review: Object menu item that spaces objects evenly along the plate's front-back (Y) axis; check that the 'aurre-atze' compound reads naturally. msgid "Distribute front-back" -msgstr "Banatu aurre-atze norabidean" +msgstr "Berdinbanatu Y norabidean" # AI Translated # Needs human review: Object menu item that spaces objects evenly along the vertical (Z) axis; check that the 'goi-behe' compound reads naturally. msgid "Distribute top-bottom" -msgstr "Banatu goi-behe norabidean" +msgstr "Berdinbanatu Z norabidean" msgid "Drop" msgstr "Askatu" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Mugitu hautaketa Z ardatzean, bere punturik baxuenak ohea ukitu dezan." msgid "Absolute" msgstr "Absolutua" @@ -2044,17 +2049,21 @@ msgstr "Muntaketa tresnan sartzen" msgid "Leaving Assembly gizmo" msgstr "Muntaketa tresnatik irteten" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Ebakitako objektu baten piezak ezin dira mugitu" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Plakarekin lerrokatzea X eta Y ardatzetan bakarrik dago erabilgarri" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Desgaitu hautatutako objektuen 'Automatikoki jaitsi' aukera, Z ardatzean mugitzeko" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Hautatutako objektu guztiak plaka berean egon behar dute" msgid "Shift+" msgstr "Shift+" @@ -6373,8 +6382,10 @@ msgstr "Ardatzak" msgid "Gridlines" msgstr "Sareta-lerroak" +# AI Translated +# Needs human review: Glossary has no Basque rendering for Focus mode (hides the UI to concentrate on the 3D canvas); check the wording. msgid "Focus mode" -msgstr "" +msgstr "Kontzentrazio modua" msgid "Labels" msgstr "Etiketak" @@ -6435,7 +6446,7 @@ msgstr "Bolumena:" msgid "Size:" msgstr "Tamaina:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "G-code ibilbideen gatazkak aurkitu dira %d geruzan, Z = %.2lf mm. Urrundu gehiago gatazkan dauden objektuak (%s <-> %s)." @@ -10692,11 +10703,13 @@ msgstr "Erakutsi onartzen ez diren aurrezarpenak" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Erakutsi bateraezinak edo onartu gabeak diren aurrezarpenak inprimagailuaren eta filamentuaren goitibeherako zerrendetan. Aurrezarpen hauek ezin dira hautatu." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Esportatu estatistikak G-codearekin" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Gaituta badago, G-code fitxategi bat esportatzean haren estatistikak ere JSON gisa idazten dira alboan, .statistics.json izenarekin, eta esportatutako 3MF xerratu fitxategiak barruan gordetzen ditu: inprimatze-denbora, filamentuaren eta lerro-motaren araberako guztiak, eta gauza bera geruza bakoitzeko eta objektu bakoitzeko." msgid "Experimental Features" msgstr "Ezaugarri esperimentalak" @@ -11541,6 +11554,10 @@ msgstr "Huts egin du fitxategia inprimagailuaren biltegira igotzean. Saiatu berr msgid "Send Failed" msgstr "Bidalketak huts egin du" +# AI Translated +msgid "No available printers" +msgstr "Ez dago inprimagailurik erabilgarri" + msgid "The name length exceeds the limit." msgstr "Izenaren luzerak muga gainditzen du." @@ -12069,7 +12086,7 @@ msgid "It can't be deleted or modified." msgstr "Ezin da ezabatu edo aldatu." msgid "Any modifications should be saved as a new preset inherited from this one." -msgstr "Aldaketa guztiak honetatik herentzian hartutako aurrezarpen berri gisa gorde behar dira.." +msgstr "Aldaketa guztiak honetatik herentzian hartutako aurrezarpen berri gisa gorde behar lirateke." msgid "To do that please specify a new name for the preset." msgstr "Horretarako, zehaztu aurrezarpenaren izen berri bat." @@ -13180,11 +13197,11 @@ msgstr "Pertsonalizatua" # AI Translated msgid "Welcome to Orca Slicer" -msgstr "Ongi etorri Orca Slicer-era" +msgstr "Ongi etorri OrcaSlicer-era" # AI Translated msgid "Orca Slicer will be set up in several steps. Let's start!" -msgstr "Orca Slicer hainbat urratsetan konfiguratuko da. Has gaitezen!" +msgstr "OrcaSlicer hainbat urratsetan konfiguratuko da. Has gaitezen!" # AI Translated msgid "Get Started" @@ -13358,8 +13375,8 @@ msgid "Left mouse" msgstr "Saguaren ezkerreko botoia" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Leihoko edozein tokitan erabilgarri, baita testu-eremu batean idazten ari zarenean ere." +msgid "Available anywhere in the window." +msgstr "Leihoko edozein lekutan erabilgarri." # AI Translated msgid "Run favorite 1 to 10" @@ -13471,10 +13488,6 @@ msgstr "%s %s ekintzari esleituta dago. %s ekintzari berriro esleitu?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "%s lehenetsia %s ekintzari esleituta dago. %s ekintzari berriro esleitu?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Lasterbide globalak idazten ari zarenean ere aplikatzen dira." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Karaktere bat idazten duen tekla bat ezin da lasterbide globala izan." @@ -13522,7 +13535,7 @@ msgstr "Sareko pluginaren eguneratzea" # AI Translated msgid "Click OK to update the Network plug-in now. If a file is in use, the update will be applied the next time Orca Slicer launches." -msgstr "Egin klik Ados botoian Sareko plugina orain eguneratzeko. Fitxategiren bat erabiltzen ari bada, eguneraketa Orca Slicer hurrengoan abiaraztean aplikatuko da." +msgstr "Egin klik Ados botoian Sareko plugina orain eguneratzeko. Fitxategiren bat erabiltzen ari bada, eguneraketa OrcaSlicer hurrengoan abiaraztean aplikatuko da." # AI Translated msgid "A new Network plug-in is available. Do you want to install it?" @@ -13915,9 +13928,10 @@ msgstr "\"%2%\" objektuaren \"%1%\" aldatzaileak (%3% guztira) ez du eraginik iz msgid "Seam placement may differ from expected." msgstr "Josturaren kokapena espero zena ez bezalakoa izan daiteke." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Ezin izan dira G-codearen estatistikak idatzi hemen: %1%." msgid "Internal Bridge" msgstr "Barruko zubia" @@ -14903,7 +14917,7 @@ msgid "" "If set to 0, the line width will match the Internal solid infill width, or the nozzle diameter for thick bridges." msgstr "" "Zubiaren lerro-zabalera. % gisa adierazten bada, pitaren diametroaren arabera kalkulatuko da.\n" -"Zubien dentsitate handiagoarekin edo zubien fluxu-ratio handiagoarekin erabiltzea gomendatzen da.\n" +"Zubiaren dentsitate handiagoarekin edo zubiaren fluxu-ratio handiagoarekin erabiltzea gomendatzen da.\n" "\n" "Gehieneko balioa %100 edo pitaren diametroa da.\n" "0 ezartzen bada, lerro-zabalera barruko betegarri solidoaren zabalerarekin bat etorriko da, edo pitaren diametroarekin zubi lodietan." @@ -17126,7 +17140,7 @@ msgid "Best auto arranging position in range [0,1] w.r.t. bed shape." msgstr "Ohearen formarekiko [0,1] tartean automatikoki antolatzeko posizio onena." msgid "Enable this option if machine has auxiliary part cooling fan. G-code command: M106 P2 S(0-255)." -msgstr "Gaitu aukera hau makinak piezaren hozterako haizagailu lagungarria badu. G-code komandoa: M106 P2 S(0-255)." +msgstr "Gaitu aukera hau makinak piezaren hozterako haizagailu laguntzailea badu. G-code komandoa: M106 P2 S(0-255)." msgid "Fan direction" msgstr "Haizagailuaren norabidea" @@ -17232,7 +17246,7 @@ msgstr "Saltatu G-code-aren konfigurazio-blokea" # AI Translated msgid "Do not write the CONFIG_BLOCK (slicer configuration key/value pairs) into the G-code file. This can help with printers whose firmware crashes when parsing these comment lines (e.g. Anycubic go-klipper). Note: the G-code file will no longer contain slicer settings, so importing it back into OrcaSlicer will not restore the configuration." -msgstr "Ez idatzi CONFIG_BLOCK (xerragailuaren konfigurazioko gako/balio bikoteak) G-code fitxategian. Lagungarria izan daiteke firmwareak iruzkin-lerro horiek prozesatzean huts egiten duen inprimagailuetan (adib. Anycubic go-klipper). Oharra: G-code fitxategiak ez ditu jada xerragailuaren ezarpenak edukiko; beraz, OrcaSlicer-era berriro inportatzeak ez du konfigurazioa berreskuratuko." +msgstr "Ez idatzi CONFIG_BLOCK (xerratzailearen konfigurazioko gako/balio bikoteak) G-code fitxategian. Lagungarria izan daiteke firmwareak iruzkin-lerro horiek prozesatzean huts egiten duen inprimagailuetan (adib. Anycubic go-klipper). Oharra: G-code fitxategiak ez ditu jada xerratzailearen ezarpenak edukiko; beraz, OrcaSlicer-era berriro inportatzeak ez du konfigurazioa berreskuratuko." msgid "Pellet Modded Printer" msgstr "Pelletekin moldatutako inprimagailua" @@ -17258,6 +17272,14 @@ msgstr "Baztertu objektuak" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Gaitu aukera hau G-codean EXCLUDE OBJECT komandoa gehitzeko." +# AI Translated +msgid "Outline tolerance" +msgstr "Ingeradaren tolerantzia" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "EXCLUDE_OBJECT_DEFINE-n idatzitako objektuaren ingeradak jatorrizko ingeradarekiko duen gehieneko desbideratzea. Balio handiagoek puntu gutxiago ematen dituzte, eta horrek objektu askoko G-codea aztertzean blokeatzen diren firmwareei laguntzen die. 0 balioak puntu guztiak mantentzen ditu." + msgid "Verbose G-code" msgstr "G-code xehea" @@ -18003,7 +18025,7 @@ msgid "" "Speed of auxiliary part cooling fan. Auxiliary fan will run at this speed during printing except the first several layers which is defined by no cooling layers.\n" "Please enable auxiliary_fan in printer settings to use this feature. G-code command: M106 P2 S(0-255)" msgstr "" -"Piezaren hozte-haizagailu lagungarriaren abiadura. Haizagailu lagungarria abiadura honetan ibiliko da inprimatzean, hozterik gabeko geruzek definitutako lehen geruzetan izan ezik.\n" +"Piezaren hozte-haizagailu laguntzailearen abiadura. Haizagailu laguntzailea abiadura honetan ibiliko da inprimatzean, hozterik gabeko geruzek definitutako lehen geruzetan izan ezik.\n" "Gaitu auxiliary_fan inprimagailuaren ezarpenetan ezaugarri hau erabiltzeko. G-code komandoa: M106 P2 S(0-255)" msgid "For the first" @@ -20431,11 +20453,13 @@ msgstr "Irteerako direktorioa" msgid "This is the output directory for exported files." msgstr "Hau da esportatutako fitxategien irteerako direktorioa." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Esportatu estatistikak" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Idatzi xerratutako plaka bakoitzaren estatistikak JSON gisa, plate_N.statistics.json izenarekin irteera-direktorioan bere G-codearen ondoan eta --export-3mf aukerak sortutako 3MFaren barruan: inprimatze-denbora, filamentuaren eta lerro-motaren araberako guztiak, eta gauza bera geruza bakoitzeko eta objektu bakoitzeko." msgid "Debug level" msgstr "Arazketa-maila" @@ -25254,7 +25278,7 @@ msgstr "Sortu lehenik ebakitzeko gorputz solido bat" # AI Translated msgid "Cut — needs a solid body to slice" -msgstr "Ebaki — gorputz solido bat behar du zatitzeko" +msgstr "Ebaki — gorputz solido bat behar du xerratzeko" # AI Translated msgid "Color — set the selected body's display color" @@ -30045,7 +30069,7 @@ msgstr "Modeloaren irudiak" # AI Translated msgid "Auxiliaries" -msgstr "Lagungarriak" +msgstr "Laguntzaileak" # AI Translated msgid "Belt Purge Tower" @@ -30144,1231 +30168,1651 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "Uneko filamentu-zerrendan ez dago %s. Filamentu nahasiak behar duen proiektuko filamentu bat automatikoki sortuko da deskonposatu ondoren." msgstr[1] "Uneko filamentu-zerrendan ez dago %s. Filamentu nahasiak behar dituen proiektuko filamentuak automatikoki sortuko dira deskonposatu ondoren." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Kolore-hautatzailea" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Oinarrizko koloreak" +# AI Translated #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca paleta" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL klasikoa" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Gradienteak" +# AI Translated +# Needs human review: Single solid color as opposed to a gradient (color picker tab); Uniformea chosen to avoid the solid-infill sense, check the wording. +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Uniformea" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Gradientea" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Gradientearen hasiera" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Gradientearen amaiera" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Gradientearen kolorea" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Gehitu kolorea" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Kendu kolorea" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Saturazioa" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Jatorrizko kolorea" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Gorde uneko kolorea" +# AI Translated +# Needs human review: Glossary has no Basque cell for Palette; Paleta chosen. msgid "Palettes" -msgstr "" +msgstr "Paletak" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Bilatu koloreak" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Iragazi koloreak" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Ez dago bat datorren kolorerik" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Kolore hexadezimala" # AI Translated msgid "Opacity" msgstr "Opakutasuna" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Opakutasun-ehunekoa" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Gorde kolorea" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Idatzi kolore hexadezimal osoa" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Uneko kolore anitzeko hautapena mantendu egiten da beste kolore bat aukeratu arte." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Gehienez %d kolore onartzen dira." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmesia" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Laranja-gorria" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Tomatea" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Laranja" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Laranja iluna" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Urrea" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Zur sendoa" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Bisque" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Arrosa lainotsua" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Hori argia" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Limoi-xifoia" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beixa" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Urre-makila hori argia" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Urre-makila zurbila" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Kakia" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Kaki iluna" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Mertxika-bolia" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mokasina" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papaia-krema" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Almendra zurituta" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Zuri antzinakoa" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navajo zuria" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Garia" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Urre-makila" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Txokolatea" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Su-adreilua" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Zela-marroia" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Marroia" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Marroi arrosatua" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Izokina" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Izokin argia" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Izokin iluna" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Hare-marroia" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Korala" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Koral argia" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Gorri indiarra" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Gorri iluna" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Granatea" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Berde horixka" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Hori berdexka" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Zelai-berdea" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Lima-berdea" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Udaberri-berdea" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Udaberri-berde ertaina" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Lima" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Baso-berdea" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Berde iluna" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Oliba apala" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliba-berdea" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Oliba-berde iluna" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Berde zurbila" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Berde argia" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Itsaso-berde ertaina" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Itsaso-berdea" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Itsaso-berde iluna" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Kadete-urdina" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Akuamarina ertaina" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turkesa" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Turkesa ertaina" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Turkesa iluna" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Turkesa zurbila" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Akua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Ziano argia" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Menta-krema" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Ezti-ihintza" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Akuamarina" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Itsaso-berde argia" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Ziano iluna" +# AI Translated +# Needs human review: CSS teal (dark blue-green); check that Berde-urdin iluna reads as a color name next to Urdin berdexka and Berde urdinxka. msgid "Teal" -msgstr "" +msgstr "Berde-urdin iluna" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Pizarra-gris iluna" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Pizarra-gris argia" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Pizarra-grisa" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Zeru-urdin sakona" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodger urdina" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Zeru-urdina" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Zeru-urdin argia" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Urdin argia" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Hauts-urdina" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Altzairu-urdin argia" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Altzairu-urdina" +# AI Translated +# Needs human review: Flower name not known in Basque; rendered as Lore-urdina (flower blue), check for a proper name. msgid "Cornflower blue" -msgstr "" +msgstr "Urdin bizia" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Urdin erreala" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Urdin ertaina" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Gauerdi-urdina" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Urdin iluna" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Itsas-urdina" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Pizarra-urdina" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Pizarra-urdin iluna" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Pizarra-urdin ertaina" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Urdin-bioleta" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indigoa" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Bioleta iluna" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Orkidea iluna" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Orkidea ertaina" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orkidea" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Bioleta" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "More ertaina" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Morea" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebecca morea" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Bioleta-gorri ertaina" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Bioleta-gorri zurbila" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Arrosa sakona" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Arrosa bizia" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Arrosa argia" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Arrosa" +# AI Translated +# Needs human review: Rendered as Aran-morea (plum purple); check the color name. msgid "Plum" -msgstr "" +msgstr "Aran-morea" +# AI Translated +# Needs human review: Rendered as Kardu-morea (thistle purple); check the color name. msgid "Thistle" -msgstr "" +msgstr "Kardu-morea" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuksia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Magenta iluna" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Lihoa" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Dantela zaharra" +# AI Translated +# Needs human review: CSS color 'seashell'; the Shell glossary match is a false positive. msgid "Sea shell" -msgstr "" +msgstr "Itsaso-maskorra" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Eborea" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Lore-zuria" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Izpiliku arrosatua" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Mamu-zuria" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Alice urdina" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Izpilikua" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Ke-zuria" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Beltza" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Koral-sua" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Itsas anemona" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Amildegi sakona" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Otarrain-gorria" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Buztin hareatsua" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Uhin-egurra" +# AI Translated +# Needs human review: Plant name (Hippophae); check the Basque name and whether a color-only name reads better. msgid "Sea buckthorn" -msgstr "" +msgstr "Elorri horia" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Ilunabarreko arrezifea" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tigre-korala" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Koral arrosa" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Maskor-dirdira" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Harea" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Alga urrea" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Eguzkitako duna" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Anbar-nautilusa" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Itsas limoia" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Itsas-izar zurbila" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Marea bizia" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Lima-alga" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Itsas-belarra" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neon-planktona" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Alga-basoa" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Esmeralda-olatua" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Balearen itzala" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Itsas dortoka" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Laguna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Korronte tropikala" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Gauerdiko itsas-sakonuna" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Alga iluna" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Kristal-olatua" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Badia turkesa" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Arrezife gaineko zerua" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Zeru azalekoa" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Urdin elektrikoa" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Izurdea" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Ozeanoaren sakonerak" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Balea" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indigo-amildegia" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Itsas trikua" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Izpiliku-korala" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Marea bioleta" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Itsaso sakoneko orkidea" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neon-medusa" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuksia-korala" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Medusa arrosa" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Aparra" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Maskor-zuria" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Koxkor-grisa" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Ekaitz-hodeia" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Tinta-beltza" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Beixa berdexka" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Hare-horia" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Seinale-horia" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Urre-horia" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Ezti-horia" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Arto-horia" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Nartziso-horia" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Beixa marroixka" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Limoi-horia" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Ostra-zuria" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Ebore argia" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Zink-horia" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Beixa grisaxka" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Oliba-horia" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Koltza-horia" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Trafiko-horia" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Okre-horia" +# AI Translated +# Needs human review: Source name looks like a RAL variant; check the rendering. msgid "Traffic orange yellow" -msgstr "" +msgstr "Trafikoko laranja-horixka" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Meloi-horia" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Isats-horia" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Dalia-horia" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Hori pastela" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Perla-beixa" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Perla-urrea" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Eguzki-horia" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Hori-laranja" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Laranja sakona" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Bermilioia" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Perla-laranja" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Laranja hutsa" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Laranja argitsua" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Laranja argitsu distiratsua" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Gorri-laranja distiratsua" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Trafiko-laranja" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Seinale-laranja" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Izokin-laranja" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Perla-arrosa" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Kobre-laranja" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Seinale-marroia" +# AI Translated +# Needs human review: RAL color name as given in the source; check the rendering. msgid "Fir orange" -msgstr "" +msgstr "Izei-laranja" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Seinale-gorria" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Gorri argitsua" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karmin-gorria" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Perla-karmin-gorria" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Gorri hutsa" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Gorri sakon argitsua" +# AI Translated +# Needs human review: Fruit name; Mahats-gorria is approximate, check. msgid "Currant red" -msgstr "" +msgstr "Mahats-gorria" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Perla-rubi-gorria" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Su-gorria" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rubi-gorria" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "More-gorria" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Ardo-gorria" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Gorri beltzaxka" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oxido-gorria" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Gorri marroixka" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Pinu-gorria" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Tomate-gorria" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Arrosa antzinakoa" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Koral-gorria" +# AI Translated +# Needs human review: Same word as Pink (Arrosa); check whether a distinct name is wanted. msgid "Rose" -msgstr "" +msgstr "Arrosa" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Marrubi-gorria" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Trafiko-gorria" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Izokin-arrosa" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Arrosa argitsua" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Gorri argitsu distiratsua" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Mugurdi-gorria" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Ekialdeko gorria" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Perla-rubia" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "More gorrixka" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Bioleta gorrixka" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Txilar-bioleta" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordele-bioleta" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Kaoba" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "More grisaxka" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Seinale-bioleta" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Izei-berdea" +# AI Translated +# Needs human review: RAL color named after Sabine; check the rendering. msgid "Sabine grey" -msgstr "" +msgstr "Sabine grisa" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Perla-bioleta" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Perla-masusta" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Berde urdinxka" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramar urdina" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Zafiro-urdina" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Urdin beltzaxka" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Seinale-urdina" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Urdin distiratsua" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Urdin grisaxka" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azur-urdina" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Gentziana-urdina" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobalto-urdina" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Uso-urdina" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Trafiko-urdina" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Turkesa-urdina" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Capri-urdina" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Ozeano-urdina" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Ur-urdina" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Gau-urdina" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Urdin urruna" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Urdin pastela" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Perla-gentziana-urdina" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Perla-gauerdi-urdina" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patina-berdea" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Esmeralda-berdea" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Hosto-berdea" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Oliba-berdea" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Urdin berdexka" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Goroldio-berdea" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Oliba grisaxka" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Pinu-berdea" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Pinu-marroia" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Belar-berdea" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Reseda-berdea" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Berde marroixka" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Lezka-berdea" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Berde beltzaxka" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Turkesa-berdea" +# AI Translated msgid "May green" -msgstr "" +msgstr "Maiatz-berdea" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Kromo oxido-berdea" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Trafiko-berdea" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Garo-berdea" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opalo-berdea" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Menta-berdea" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Brontze-berdea" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Perla-berdea" +# AI Translated msgid "Sax turquoise" -msgstr "" +msgstr "Saxe-turkesa" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Perla-turkesa" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Perla-jadea" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Berde hutsa" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Berde argitsua" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Katagorri-grisa" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Zilar-grisa" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Oliba-grisa" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Goroldio-grisa" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Seinale-grisa" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Sagu-grisa" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Gris beixa" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Kaki-grisa" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Gris berdexka" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Mihise-grisa" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Burdin-grisa" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Basalto-grisa" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Gris marroixka" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Pizarra-grisa" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antrazita-grisa" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Gris argia" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umbra-grisa" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Hormigoi-grisa" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafito-grisa" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Granito-grisa" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Harri-grisa" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Koxkor-grisa" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Zementu-grisa" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Gris horixka" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platino-grisa" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Hauts-grisa" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Agata-grisa" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Kuartzo-grisa" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Leiho-grisa" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Trafiko-grisa A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Trafiko-grisa B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Zeta-grisa" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegris 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegris 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegris 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Perla-sagu-grisa" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Marroi berdexka" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Okre-marroia" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Buztin-marroia" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Kobre-marroia" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Txokolate-marroia" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Oliba-marroia" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Intxaur-marroia" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Marroi gorrixka" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sepia-marroia" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Gaztaina-marroia" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Kaoba-marroia" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Marroi grisaxka" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Perla-kobrea" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Beixa-marroia" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Perla-moka-marroia" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Lur-marroia" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Perla-marroia" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Krema" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Zuri grisaxka" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Seinale-zuria" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Seinale-beltza" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Gagatz-beltza" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Aluminio zuria" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Aluminio grisa" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Zuri hutsa" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Grafito-beltza" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Trafiko-zuria" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Trafiko-beltza" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papiro-zuria" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Perla-gris argia" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metala: Zilarra" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metala: Letoia" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metala: Urrea" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metala: Kobrea" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metala: Brontzea" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Natura: Perla" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Natura: Ortzadarra" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Natura: Zeru garbia" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Natura: Ilunabarra" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Egurra: Iluna" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Egurra: Ertaina" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Egurra: Argia" # AI Translated msgid "Alternate nozzles:" @@ -31844,17 +32288,29 @@ msgstr "Kendu Nire testuretatik" msgid "Built-in" msgstr "Integratuak" -# AI Translated -msgid "No textures found." -msgstr "Ez da testurarik aurkitu." - # AI Translated msgid "My textures" msgstr "Nire testurak" +# AI Translated +msgid "No textures found." +msgstr "Ez da testurarik aurkitu." + +# AI Translated +msgid "Texture libraries" +msgstr "Testura-liburutegiak" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Arakatu testura-liburutegi gehiago" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "OrcaCloud irekitzen du Hasiera orrian, pluginak arakatzeko." + # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." -msgstr "Inportatu zure irudi propioa altuera-mapa gisa. Xerragailuak finkatzeko erabiltzen duen formatura bihurtzen da eta zure testura-karpeta pertsonalean gordetzen da, OrcaSlicer-ekin datozen testuretatik bereizita." +msgstr "Inportatu zure irudi propioa altuera-mapa gisa. Xerratzaileak finkatzeko erabiltzen duen formatura bihurtzen da eta zure testura-karpeta pertsonalean gordetzen da, OrcaSlicer-ekin datozen testuretatik bereizita." # AI Translated msgid "PNG, JPG or BMP - converted to a height map on import. Hover one of yours to remove it." @@ -32253,11 +32709,13 @@ msgstr "Modeloaren UV diseinuak berak mapatzen du, eta hori da jada kokapena - t msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Testuraren kopia batek modeloan duen zabalera. Txikiagoak patroia maizago errepikatzen du eta xehetasuna finagoa egiten du; Lauzatu desaktibatuta dagoenean, kopia bakarraren tamaina da." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Handiagoa" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Txikiagoa" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -32333,11 +32791,13 @@ msgstr "Kolore nahasiak" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Finkatze batek gehi ditzakeen filamentu nahasien gehieneko kopurua. Testuraren koloreetatik aukeratzen dira, eta finkatzeak benetan erabiltzen dituenak soilik sortzen dira." +# AI Translated msgid "Few" -msgstr "" +msgstr "Gutxi" +# AI Translated msgid "Many" -msgstr "" +msgstr "Asko" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -32693,11 +33153,13 @@ msgstr "Birsaretzea" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Modelo osoa berreraikitzeko erabiltzen den triangelu-tamaina, milimetrotan. Desplazamenduak sare uniforme batean funtzionatzen du ondoen; honek bihurtzen du inportazio irregular bat sare uniforme." +# AI Translated msgid "Before" -msgstr "" +msgstr "Aurretik" +# AI Translated msgid "After" -msgstr "" +msgstr "Ondoren" # AI Translated msgid "Keep sharp edges" @@ -32804,7 +33266,7 @@ msgstr "Garbitu triangelu meheak" # AI Translated msgid "Collapse the thin triangles refinement inherits from the model's own tessellation, before displacement samples them. A sliver's three corners land on three unrelated parts of the texture, which is what makes the relief look jagged." -msgstr "Desegin fintzeak modeloaren teselaziotik heredatzen dituen triangelu meheak, desplazamenduak laginak hartu aurretik. Triangelu mehe baten hiru erpinak testuraren hiru zati desberdinetan erortzen dira, eta horregatik ikusten da erliebea zerratua." +msgstr "Desplazamendu-laginketa gertatu baino lehen, kendu errefinamenduak modeloaren jatorrizko teselaziotik jasotzen dituen triangelu meheak. Triangelu mehe baten hiru erpinak testuraren hiru zati desberdinetan erortzen dira, eta horregatik ikusten da erliebea zerratua." # AI Translated msgid "On: the resolution follows the size of the model and the budget is left at its default. Untick to set both yourself - worth doing for a texture much finer or much coarser than the part it sits on." @@ -34575,6 +35037,10 @@ msgstr "Scripta" msgid "Slicing Pipeline" msgstr "Xerratze-kanalizazioa" +# AI Translated +msgid "Resource Texture" +msgstr "Baliabide-testura" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Pluginaren konfigurazio-interfazea hutsik zegoen. Editore lehenetsia erakusten." @@ -34722,6 +35188,30 @@ msgstr "Pluginaren direktorioak .py eta .whl sarrera-fitxategiak ditu" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Pluginaren direktorioak ez du .py edo .whl sarrera-fitxategirik" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Baliabide-testuren direktorioa ez dago ezarrita" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Ezin izan da baliabide-testuren direktorioa ebatzi" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Baliabide-testuren bidea ez da direktorio bat" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Ezin izan da pluginaren karpeta ebatzi" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Baliabide-testuren direktorioa pluginaren karpetatik kanpo dago" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Ezin izan da baliabide-testuren direktorioa irakurri" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -35578,8 +36068,7 @@ msgstr "" "Banatu inprimaketak plaketan\n" "Ba al zenekien pieza asko dituen modelo bat inprimatzeko prest dauden plaka banatan bana dezakezula? Horrek pieza guztien jarraipena egitea erraztuko du." -#: resources/data/hints.ini: [hint:Speed up your print with Adaptive Layer -#: Height] +#: resources/data/hints.ini: [hint:Speed up your print with Adaptive Layer Height] msgid "" "Speed up your print with Adaptive Layer Height\n" "Did you know that you can print a model even faster by using the Adaptive Layer Height option? Check it out!" @@ -35651,8 +36140,7 @@ msgstr "" "Hobetu erresistentzia\n" "Ba al zenekien horma-begizta gehiago eta dentsitate baxuko betegarriaren dentsitate handiagoa erabil ditzakezula modeloaren erresistentzia hobetzeko?" -#: resources/data/hints.ini: [hint:When do you need to print with the printer -#: door opened] +#: resources/data/hints.ini: [hint:When do you need to print with the printer door opened] msgid "" "When do you need to print with the printer door opened?\n" "Did you know that opening the printer door can reduce the probability of extruder/hotend clogging when printing lower temperature filament with a higher enclosure temperature? There is more info about this in the Wiki." @@ -35668,6 +36156,27 @@ msgstr "" "Saihestu okertzea\n" "Ba al zenekien ABS bezalako okertzeko joera duten materialak inprimatzean ohe beroaren tenperatura egoki igotzeak okertzeko probabilitatea murriztu dezakeela?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Dalmaziar horia" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Kapsantina-bioleta" + +# AI Translated +# Needs human review: RAL color name; check the rendering. +#~ msgid "Olivestone" +#~ msgstr "Oliba-harria" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Leihoko edozein tokitan erabilgarri, baita testu-eremu batean idazten ari zarenean ere." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Lasterbide globalak idazten ari zarenean ere aplikatzen dira." + #~ msgid "Please choose the filament color" #~ msgstr "Hautatu filamentuen kolorea" diff --git a/localization/i18n/fr/OrcaSlicer_fr.po b/localization/i18n/fr/OrcaSlicer_fr.po index e06e8aeb72..92b9b18041 100644 --- a/localization/i18n/fr/OrcaSlicer_fr.po +++ b/localization/i18n/fr/OrcaSlicer_fr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: Guislain Cyril, Thomas Lété\n" @@ -311,7 +311,7 @@ msgid "Tungsten Carbide" msgstr "Carbure de tungstène" msgid "The toolhead and hotend rack may move. Please keep your hands away from the chamber." -msgstr "La tête d'outil et le rack hotend peuvent se déplacer. Veuillez garder vos mains hors de la chambre." +msgstr "La tête d'outil et le rack hotend peuvent se déplacer. Veuillez garder vos mains hors du caisson." msgid "Warning" msgstr "Avertissement" @@ -329,7 +329,7 @@ msgid "Reading the hotends, please wait." msgstr "Lecture des hotends, veuillez patienter." msgid "During the hotend upgrade, the toolhead will move. Don't reach into the chamber." -msgstr "Pendant la mise à niveau du hotend, la tête d’outil va se déplacer. Ne mettez pas vos mains dans la chambre." +msgstr "Pendant la mise à niveau du hotend, la tête d’outil va se déplacer. Ne mettez pas vos mains dans le caisson." msgid "Update" msgstr "Mise à jour" @@ -1146,13 +1146,13 @@ msgid "Delete connector" msgstr "Supprimer le connecteur" msgid "Entering Cut gizmo" -msgstr "Entrée dans l’outil Couper" +msgstr "Entrée dans le gizmo Couper" msgid "Leaving Cut gizmo" -msgstr "Quitter l’outil Couper" +msgstr "Sortie du gizmo Couper" msgid "Cut gizmo editing" -msgstr "Modification de la découpe" +msgstr "Édition dans le gizmo Couper" msgid "Mesh name" msgstr "Nom du maillage" @@ -1254,10 +1254,10 @@ msgid "Embossed text" msgstr "Texte en relief" msgid "Enter emboss gizmo" -msgstr "Entrer dans l’outil d’embossage" +msgstr "Entrer dans le gizmo d’embossage" msgid "Leave emboss gizmo" -msgstr "Quitter l’outil d’embossage" +msgstr "Quitter le gizmo d’embossage" msgid "Embossing actions" msgstr "Actions d’embossage" @@ -1669,10 +1669,10 @@ msgid "SVG move" msgstr "Déplacement du SVG" msgid "Enter SVG gizmo" -msgstr "Ouvrir l’outil SVG" +msgstr "Ouvrir le gizmo SVG" msgid "Leave SVG gizmo" -msgstr "Quitter l’outil SVG" +msgstr "Quitter le gizmo SVG" msgid "SVG actions" msgstr "Actions SVG" @@ -2011,10 +2011,10 @@ msgid "Flip by Face 2" msgstr "Retournement par la Face 2" msgid "Entering Measure gizmo" -msgstr "Entrée dans l’outil Mesurer" +msgstr "Entrée dans le gizmo Mesurer" msgid "Leaving Measure gizmo" -msgstr "Quitter l’outil Mesurer" +msgstr "Sortie du gizmo Mesurer" # AI Translated msgctxt "Assembly tool" @@ -2070,7 +2070,7 @@ msgstr "L’alignement sur la plaque n’est disponible qu’en X et Y" # AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "Désactivez la dépose automatique des objets sélectionnés pour les déplacer en Z" +msgstr "Désactivez le dépôt automatique des objets sélectionnés pour les déplacer en Z" # AI Translated msgid "All selected objects must be on the same plate" @@ -3813,7 +3813,7 @@ msgid "Init" msgstr "Initialisation" msgid "Chamber" -msgstr "Chambre" +msgstr "Caisson" msgid "Innerloop" msgstr "Boucle interne" @@ -6472,7 +6472,7 @@ msgstr "Volume :" msgid "Size:" msgstr "Taille :" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Des conflits de chemins G-code ont été trouvés au niveau de la couche %d, z = %.2lfmm. Veuillez séparer davantage les objets en conflit (%s <-> %s)." @@ -8428,11 +8428,11 @@ msgstr "Identifie le type et la position de la plaque de construction sur le pla # AI Translated msgid "Purifies the chamber air as the print finishes, based on the selected mode." -msgstr "Purifie l'air de la chambre à la fin de l'impression, selon le mode sélectionné." +msgstr "Purifie l'air du caisson à la fin de l'impression, selon le mode sélectionné." # AI Translated msgid "Purifies the chamber air through internal circulation as each print finishes." -msgstr "Purifie l'air de la chambre par circulation interne à la fin de chaque impression." +msgstr "Purifie l'air du caisson par circulation interne à la fin de chaque impression." # AI Translated msgid "Automatically match the corresponding switch strategy for leak-prone filaments (disable blob detection) and regular filaments (enable blob detection)." @@ -11562,6 +11562,10 @@ msgstr "Échec du téléversement du fichier vers le stockage de l’imprimante. msgid "Send Failed" msgstr "Échec de l’envoi" +# AI Translated +msgid "No available printers" +msgstr "Aucune imprimante disponible" + msgid "The name length exceeds the limit." msgstr "La longueur du nom dépasse la limite." @@ -12062,8 +12066,8 @@ msgid "" "When recording timelapse without toolhead, it is recommended to add a \"Timelapse Wipe Tower\" \n" "by right-click the empty position of build plate and choose \"Add Primitive\"->\"Timelapse Wipe Tower\"." msgstr "" -"Lorsque vous enregistrez un timelapse sans tête d’outil, il est recommandé d’ajouter une \"Tour d’essuyage timelapse\".\n" -"en faisant un clic droit sur un emplacement vide sur le plateau et en choisissant \"Ajouter Primitive\"-> \"Tour d’essuyage timelapse\"." +"Lorsque vous enregistrez un timelapse sans tête d’outil, il est recommandé d’ajouter une \"Tour d’amorçage timelapse\".\n" +"en faisant un clic droit sur un emplacement vide sur le plateau et en choisissant \"Ajouter Primitive\"-> \"Tour d’amorçage timelapse\"." msgid "A copy of the current system preset will be created, which will be detached from the system preset." msgstr "Une copie du préréglage actuel du système est créée et détachée du préréglage du système." @@ -12362,7 +12366,7 @@ msgid "Filament end G-code" msgstr "G-code de fin de filament" msgid "Wipe tower parameters" -msgstr "Paramètres de la tour d’essuyage" +msgstr "Paramètres de la tour d’amorçage" msgid "Multi Filament" msgstr "Multi-filament" @@ -12511,7 +12515,7 @@ msgid "Nozzle diameter" msgstr "Diamètre de la buse" msgid "Wipe tower" -msgstr "Tour d’essuyage" +msgstr "Tour d’amorçage" # AI Translated msgid "Belt purge tower" @@ -13380,8 +13384,8 @@ msgid "Left mouse" msgstr "Clic gauche" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Disponible partout dans la fenêtre, même pendant la saisie dans un champ de texte." +msgid "Available anywhere in the window." +msgstr "Disponible partout dans la fenêtre." # AI Translated msgid "Run favorite 1 to 10" @@ -13486,9 +13490,6 @@ msgstr "%s est attribué à %s. Le réattribuer à %s ?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "La valeur par défaut %s est attribuée à %s. La réattribuer à %s ?" -msgid "Global shortcuts also apply while typing." -msgstr "Les raccourcis globaux s'appliquent aussi pendant la saisie." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Une touche qui saisit un caractère ne peut pas être un raccourci global." @@ -13762,7 +13763,7 @@ msgstr "Ouvrir un fichier G-code :" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "Wipe tower generation failed, possibly due to empty first layer." -msgstr "Échec de la génération de la tour d’essuyage, peut-être à cause d’une première couche vide." +msgstr "Échec de la génération de la tour d’amorçage, peut-être à cause d’une première couche vide." msgid "One object has an empty first layer and can't be printed. Please Cut the bottom or enable supports." msgstr "Un objet a une couche initiale vide et ne peut pas être imprimé. Veuillez couper le bas ou activer les supports." @@ -14287,16 +14288,16 @@ msgstr "La hauteur de couche variable n’est pas prise en charge avec les suppo # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "The wipe tower filament cannot be a mixed filament." -msgstr "Le filament de la tour d’essuyage ne peut pas être un filament mixte." +msgstr "Le filament de la tour d’amorçage ne peut pas être un filament mixte." msgid "Different nozzle diameters and different filament diameters may not work well when the prime tower is enabled. It's very experimental, so please proceed with caution." msgstr "Différents diamètres de buses et de filaments peuvent ne pas fonctionner correctement lorsque la tour d’amorçage est activée. Il s’agit d’un projet très expérimental, il convient donc de procéder avec prudence." msgid "The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1)." -msgstr "La tour d’essuyage n’est actuellement prise en charge qu’avec l’adressage relatif des extrudeurs (use_relative_e_distances=1)." +msgstr "La tour d’amorçage n’est actuellement prise en charge qu’avec l’adressage relatif des extrudeurs (use_relative_e_distances=1)." msgid "Ooze prevention is only supported with the wipe tower when 'single_extruder_multi_material' is off." -msgstr "La prévention du suintement n’est possible qu’avec la tour d’essuyage lorsque l’option ‘single_extruder_multi_material’ est désactivée." +msgstr "La prévention du suintement n’est possible qu’avec la tour d’amorçage lorsque l’option ‘single_extruder_multi_material’ est désactivée." msgid "The prime tower is currently only supported for the Marlin, RepRap/Sprinter, RepRapFirmware and Repetier G-code flavors." msgstr "La tour d’amorçage n’est actuellement prise en charge que pour les versions Marlin, RepRap/Sprinter, RepRapFirmware et Repetier G-code." @@ -16237,7 +16238,7 @@ msgid "Loading speed" msgstr "Vitesse de chargement" msgid "Speed used for loading the filament on the wipe tower." -msgstr "Vitesse utilisée pour charger le filament sur la tour d’essuyage." +msgstr "Vitesse utilisée pour charger le filament sur la tour d’amorçage." msgid "Loading speed at the start" msgstr "Vitesse de chargement au démarrage" @@ -16249,7 +16250,7 @@ msgid "Unloading speed" msgstr "Vitesse de déchargement" msgid "Speed used for unloading the filament on the wipe tower (does not affect initial part of unloading just after ramming)." -msgstr "Vitesse utilisée pour le déchargement du filament sur la tour d’essuyage (n’affecte pas la partie initiale de retrait juste après le pilonnage)." +msgstr "Vitesse utilisée pour le déchargement du filament sur la tour d’amorçage (n’affecte pas la partie initiale de retrait juste après le pilonnage)." msgid "Unloading speed at the start" msgstr "Vitesse de déchargement au démarrage" @@ -16288,13 +16289,13 @@ msgid "Cooling moves are gradually accelerating beginning at this speed." msgstr "Les mouvements de refroidissement s’accélèrent progressivement à partir de cette vitesse." msgid "Minimal purge on wipe tower" -msgstr "Purge minimale sur la tour d’essuyage" +msgstr "Purge minimale sur la tour d’amorçage" msgid "After a tool change, the exact position of the newly loaded filament inside the nozzle may not be known, and the filament pressure is likely not yet stable. Before purging the print head into an infill or a sacrificial object, Orca Slicer will always prime this amount of material into the wipe tower to produce successive infill or sacrificial object extrusions reliably." -msgstr "Après un changement d’outil, la position exacte du filament nouvellement chargé à l’intérieur de la buse peut ne pas être connue et la pression du filament n’est probablement pas encore stable. Avant de purger la tête d’impression dans un remplissage ou un objet, Orca Slicer amorcera toujours cette quantité de matériau dans la tour d’essuyage pour purger dans les remplissages ou objets de manière fiable." +msgstr "Après un changement d’outil, la position exacte du filament nouvellement chargé à l’intérieur de la buse peut ne pas être connue et la pression du filament n’est probablement pas encore stable. Avant de purger la tête d’impression dans un remplissage ou un objet, Orca Slicer amorcera toujours cette quantité de matériau dans la tour d’amorçage pour purger dans les remplissages ou objets de manière fiable." msgid "Wipe tower cooling" -msgstr "Refroidissement de la tour d’essuyage" +msgstr "Refroidissement de la tour d’amorçage" msgid "Temperature drop before entering filament tower" msgstr "Baisse de température avant l’entrée dans la tour de filament" @@ -16348,7 +16349,7 @@ msgid "Enable ramming for multi-tool setups" msgstr "Activer le pilonnage pour les configurations multi-outils" msgid "Perform ramming when using multi-tool printer (i.e. when the 'Single Extruder Multimaterial' in Printer Settings is unchecked). When checked, a small amount of filament is rapidly extruded on the wipe tower just before the tool change. This option is only used when the wipe tower is enabled." -msgstr "Effectuez un pilonnage lorsque vous utilisez une imprimante multi-outils (c’est-à-dire lorsque l’option ‘Multi-matériau à extrudeur unique’ dans les paramètres de l’imprimante n’est pas cochée). Une fois vérifié, une petite quantité de filament est rapidement extrudée sur la tour d’essuyage juste avant le changement d’outil. Cette option n’est utilisée que lorsque la tour d’essuyage est activée." +msgstr "Effectuez un pilonnage lorsque vous utilisez une imprimante multi-outils (c’est-à-dire lorsque l’option ‘Multi-matériau à extrudeur unique’ dans les paramètres de l’imprimante n’est pas cochée). Une fois vérifié, une petite quantité de filament est rapidement extrudée sur la tour d’amorçage juste avant le changement d’outil. Cette option n’est utilisée que lorsque la tour d’amorçage est activée." msgid "Multi-tool ramming volume" msgstr "Volume du pilonnage multi-outils" @@ -17286,6 +17287,14 @@ msgstr "Exclure des objets" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Activer cette option pour ajouter la commande EXCLUDE OBJECT dans le G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Tolérance du contour" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Écart maximal entre le contour de l’objet écrit dans EXCLUDE_OBJECT_DEFINE et le contour d’origine. Des valeurs plus grandes donnent moins de points, ce qui aide les firmwares qui se bloquent à l’analyse d’un G-code contenant de nombreux objets. 0 conserve tous les points." + msgid "Verbose G-code" msgstr "G-code commenté" @@ -18818,7 +18827,7 @@ msgstr "Timelapse au point le plus éloigné" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "When enabled, the timelapse snapshot is taken at the farthest point from camera instead of traveling to the wipe tower or excess chute. Only effective in traditional timelapse mode on non-I3 printers." -msgstr "Lorsque cette option est activée, l’instantané du timelapse est pris au point le plus éloigné de la caméra au lieu de se déplacer vers la tour d’essuyage ou la goulotte d’évacuation. Efficace uniquement en mode timelapse traditionnel sur les imprimantes non-I3." +msgstr "Lorsque cette option est activée, l’instantané du timelapse est pris au point le plus éloigné de la caméra au lieu de se déplacer vers la tour d’amorçage ou la goulotte d’évacuation. Efficace uniquement en mode timelapse traditionnel sur les imprimantes non-I3." msgid "Temperature variation" msgstr "Variation de température" @@ -18991,10 +19000,10 @@ msgid "Enable this option to omit the custom Change filament G-code only at the msgstr "Activez cette option pour omettre le G-code de changement de filament personnalisé uniquement au début de l’impression. La commande de changement d’outil (par exemple, T0) sera ignorée tout au long de l’impression. Ceci est utile pour l’impression manuelle multi-matériaux, où nous utilisons M600/PAUSE pour déclencher l’action de changement manuel de filament." msgid "Wipe tower type" -msgstr "Type de tour de purge" +msgstr "Type de tour d'amorçage" msgid "Choose the wipe tower implementation for multi-material prints. Type 1 is recommended for Bambu and Qidi printers with a filament cutter. Type 2 offers better compatibility with multi-tool and MMU printers and provide overall better compatibility." -msgstr "Choisir l'implémentation de la tour de purge pour les impressions multi-matériaux. Le Type 1 est recommandé pour les imprimantes Bambu et Qidi avec un coupeur de filament. Le Type 2 offre une meilleure compatibilité avec les imprimantes multi-outils et MMU et une meilleure compatibilité globale." +msgstr "Choisir l'implémentation de la tour d'amorçage pour les impressions multi-matériaux. Le Type 1 est recommandé pour les imprimantes Bambu et Qidi avec un coupeur de filament. Le Type 2 offre une meilleure compatibilité avec les imprimantes multi-outils et MMU et une meilleure compatibilité globale." msgid "Type 1" msgstr "Type 1" @@ -19012,20 +19021,20 @@ msgid "Enable filament ramming" msgstr "Activer le bourrage de filament" msgid "Tool change on wipe tower" -msgstr "Changement d’outil sur la tour d’essuyage" +msgstr "Changement d’outil sur la tour d’amorçage" msgid "Force the toolhead to travel to the wipe tower before issuing the tool change command (Tx). Only relevant for multi-extruder (multi-toolhead) printers using a Type 2 wipe tower. By default Orca skips the travel on multi-toolhead machines because the firmware handles the head swap, which can result in the Tx command being issued above the printed part. Enable this option if you want the tool change to always be issued above the wipe tower instead." -msgstr "Force la tête d’outil à se déplacer vers la tour d’essuyage avant d’émettre la commande de changement d’outil (Tx). Pertinent uniquement pour les imprimantes multi-extrudeurs (à têtes d’outil multiples) utilisant une tour d’essuyage de type 2. Par défaut, Orca omet ce déplacement sur les machines à têtes d’outil multiples car le firmware gère le changement de tête, ce qui peut entraîner l’émission de la commande Tx au-dessus de la pièce imprimée. Activez cette option si vous préférez que le changement d’outil soit toujours émis au-dessus de la tour d’essuyage." +msgstr "Force la tête d’outil à se déplacer vers la tour d’amorçage avant d’émettre la commande de changement d’outil (Tx). Pertinent uniquement pour les imprimantes multi-extrudeurs (à têtes d’outil multiples) utilisant une tour d’amorçage de type 2. Par défaut, Orca omet ce déplacement sur les machines à têtes d’outil multiples car le firmware gère le changement de tête, ce qui peut entraîner l’émission de la commande Tx au-dessus de la pièce imprimée. Activez cette option si vous préférez que le changement d’outil soit toujours émis au-dessus de la tour d’amorçage." # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "Wait for temperature on wipe tower" -msgstr "Attendre la température sur la tour d’essuyage" +msgstr "Attendre la température sur la tour d’amorçage" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "Pick up the new tool without waiting for it to reach printing temperature, travel to the wipe tower, and wait for the temperature there, right before purging. Ooze from the heat-up lands on the tower instead of the model, and the travel overlaps with the heating. Only relevant for multi-extruder (multi-toolhead) printers using a Type 2 wipe tower. The firmware or tool change macro must not wait for the temperature itself. When disabled, the temperature wait is issued right after the tool change command." -msgstr "Prend le nouvel outil sans attendre qu’il atteigne la température d’impression, se déplace vers la tour d’essuyage et y attend la température, juste avant la purge. Le suintement dû à la chauffe se dépose sur la tour plutôt que sur le modèle, et le déplacement se superpose à la chauffe. Uniquement pertinent pour les imprimantes multi-extrudeurs (multi-têtes) utilisant une tour d’essuyage de type 2. Le firmware ou la macro de changement d’outil ne doivent pas attendre la température eux-mêmes. Lorsque cette option est désactivée, l’attente de température est émise juste après la commande de changement d’outil." +msgstr "Prend le nouvel outil sans attendre qu’il atteigne la température d’impression, se déplace vers la tour d’amorçage et y attend la température, juste avant la purge. Le suintement dû à la chauffe se dépose sur la tour plutôt que sur le modèle, et le déplacement se superpose à la chauffe. Uniquement pertinent pour les imprimantes multi-extrudeurs (multi-têtes) utilisant une tour d’amorçage de type 2. Le firmware ou la macro de changement d’outil ne doivent pas attendre la température eux-mêmes. Lorsque cette option est désactivée, l’attente de température est émise juste après la commande de changement d’outil." msgid "No sparse layers (beta)" msgstr "Pas de couches éparses (beta)" @@ -19033,7 +19042,7 @@ msgstr "Pas de couches éparses (beta)" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "If enabled, the wipe tower will not be printed on layers with no tool changes. On layers with a tool change, extruder will travel downward to print the wipe tower, so the tower ends up below the model and the toolhead has to reach down to it. Layouts where that would collide with an already printed object are rejected. Has no effect with smooth timelapse or clumping detection, which need a tower on every layer." -msgstr "Si cette option est activée, la tour d’essuyage n’est pas imprimée sur les couches sans changement d’outil. Sur les couches comportant un changement d’outil, l’extrudeur descend pour imprimer la tour d’essuyage : la tour se retrouve donc sous le modèle et la tête d’outil doit descendre jusqu’à elle. Les dispositions où cela entrerait en collision avec un objet déjà imprimé sont rejetées. Sans effet avec le timelapse fluide ou la détection d’agglomération de la buse, qui nécessitent une tour à chaque couche." +msgstr "Si cette option est activée, la tour d’amorçage n’est pas imprimée sur les couches sans changement d’outil. Sur les couches comportant un changement d’outil, l’extrudeur descend pour imprimer la tour d’amorçage : la tour se retrouve donc sous le modèle et la tête d’outil doit descendre jusqu’à elle. Les dispositions où cela entrerait en collision avec un objet déjà imprimé sont rejetées. Sans effet avec le timelapse fluide ou la détection d’agglomération de la buse, qui nécessitent une tour à chaque couche." # AI Translated msgid "Combine sparse layers" @@ -19519,7 +19528,7 @@ msgstr "Activer la tour de purge du tapis" # AI Translated # Needs human review: Glossary cell for Prime tower / Wipe tower is unsettled (⚠); used the catalog's Tour d’essuyage / Tour d’amorçage msgid "Belt-printer replacement for the wipe/prime tower. When enabled on a belt printer, a purge prism is automatically generated next to the printed parts and filament-change purging is routed into it (the classic wipe tower cannot be used on belt printers because its G-code bypasses the belt transform). Only available on belt printers." -msgstr "Remplacement de la tour d’essuyage/d’amorçage pour les imprimantes à tapis. Lorsque cette option est activée sur une imprimante à tapis, un prisme de purge est généré automatiquement à côté des pièces imprimées et la purge lors des changements de filament y est dirigée (la tour d’essuyage classique ne peut pas être utilisée sur les imprimantes à tapis, car son G-code contourne la transformation du tapis). Disponible uniquement sur les imprimantes à tapis." +msgstr "Remplacement de la tour d’amorçage pour les imprimantes à tapis. Lorsque cette option est activée sur une imprimante à tapis, un prisme de purge est généré automatiquement à côté des pièces imprimées et la purge lors des changements de filament y est dirigée (la tour d’amorçage classique ne peut pas être utilisée sur les imprimantes à tapis, car son G-code contourne la transformation du tapis). Disponible uniquement sur les imprimantes à tapis." # AI Translated msgid "Belt purge tower width" @@ -19528,7 +19537,7 @@ msgstr "Largeur de la tour de purge du tapis" # AI Translated # Needs human review: Glossary cell for Prime tower / Wipe tower is unsettled (⚠); used the catalog's Tour d’essuyage for 'wipe tower' msgid "Width (machine X, across the belt) of the purge prism that is automatically generated on belt printers when the belt purge tower is enabled and multiple filaments are used. Filament-change purging is routed into this prism's extrusions instead of a classic wipe tower. Its height is computed automatically from the worst-case purge volume per layer: a wider prism results in a shorter one." -msgstr "Largeur (X machine, en travers du tapis) du prisme de purge généré automatiquement sur les imprimantes à tapis lorsque la tour de purge du tapis est activée et que plusieurs filaments sont utilisés. La purge lors des changements de filament est dirigée vers les extrusions de ce prisme au lieu d'une tour d’essuyage classique. Sa hauteur est calculée automatiquement à partir du volume de purge le plus défavorable par couche : un prisme plus large sera moins haut." +msgstr "Largeur (X machine, en travers du tapis) du prisme de purge généré automatiquement sur les imprimantes à tapis lorsque la tour de purge du tapis est activée et que plusieurs filaments sont utilisés. La purge lors des changements de filament est dirigée vers les extrusions de ce prisme au lieu d'une tour d’amorçage classique. Sa hauteur est calculée automatiquement à partir du volume de purge le plus défavorable par couche : un prisme plus large sera moins haut." msgid "Tree support branch angle" msgstr "Angle de branche support arborescent" @@ -19778,7 +19787,7 @@ msgid "Enable mixed color sublayer splitting. When enabled, layers containing mi msgstr "Active la division en sous-couches de couleur mixte. Lorsqu’elle est activée, les couches contenant des filaments de couleur mixte sont divisées en sous-couches afin d’obtenir des effets de mélange de couleurs." msgid "The wiping tower can be used to clean up residue on the nozzle and stabilize the chamber pressure inside the nozzle in order to avoid appearance defects when printing objects." -msgstr "La tour de purge peut être utilisée pour nettoyer les résidus sur la buse et stabiliser la pression du caisson à l'intérieur de la buse afin d'éviter les défauts d'apparence lors de l'impression d'objets." +msgstr "La tour d'amorçage peut être utilisée pour nettoyer les résidus sur la buse et stabiliser la pression du caisson à l'intérieur de la buse afin d'éviter les défauts d'apparence lors de l'impression d'objets." msgid "Internal ribs" msgstr "Nervures internes" @@ -19816,7 +19825,7 @@ msgstr "Mode de volume d'amorçage" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "Selects how the wipe-tower prime and flush volumes are computed on multi-extruder printers." -msgstr "Sélectionne la manière dont les volumes d’amorçage et de purge de la tour d’essuyage sont calculés sur les imprimantes multi-extrudeurs." +msgstr "Sélectionne la manière dont les volumes d’amorçage et de purge de la tour d’amorçage sont calculés sur les imprimantes multi-extrudeurs." # AI Translated msgid "Saving" @@ -19830,10 +19839,10 @@ msgid "This is the width of prime towers." msgstr "Largeur de la tour d’amorçage" msgid "Wipe tower rotation angle" -msgstr "Angle de rotation de la tour d’essuyage" +msgstr "Angle de rotation de la tour d’amorçage" msgid "Wipe tower rotation angle with respect to X axis." -msgstr "Angle de rotation de la tour d’essuyage par rapport à l’axe X." +msgstr "Angle de rotation de la tour d’amorçage par rapport à l’axe X." msgid "Brim width of prime tower, negative number means auto calculated width based on the height of prime tower." msgstr "Largeur de la bordure de la tour d'amorçage, un nombre négatif signifie une largeur calculée automatiquement en fonction de la hauteur de la tour d'amorçage." @@ -19842,10 +19851,10 @@ msgid "Stabilization cone apex angle" msgstr "Angle au sommet du cône de stabilisation" msgid "Angle at the apex of the cone that is used to stabilize the wipe tower. Larger angle means wider base." -msgstr "Angle au sommet du cône utilisé pour stabiliser la tour d’essuyage. Un angle plus grand signifie une base plus large." +msgstr "Angle au sommet du cône utilisé pour stabiliser la tour d’amorçage. Un angle plus grand signifie une base plus large." msgid "Maximum wipe tower print speed" -msgstr "Vitesse maximale d’impression de la tour d’essuyage" +msgstr "Vitesse maximale d’impression de la tour d’amorçage" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. @@ -19860,15 +19869,15 @@ msgid "" "\n" "For the wipe tower external perimeters the internal perimeter speed is used, also limited by this setting." msgstr "" -"Vitesse d’impression maximale lors de la purge dans la tour d’essuyage et de l’impression des couches éparses de la tour d’essuyage. Lors de la purge, si la vitesse de remplissage ou la vitesse calculée à partir de la vitesse volumétrique maximale du filament est inférieure, c’est la plus faible qui sera utilisée.\n" +"Vitesse d’impression maximale lors de la purge dans la tour d’amorçage et de l’impression des couches éparses de la tour d’amorçage. Lors de la purge, si la vitesse de remplissage ou la vitesse calculée à partir de la vitesse volumétrique maximale du filament est inférieure, c’est la plus faible qui sera utilisée.\n" "\n" "Lors de l’impression des couches éparses, si la vitesse de remplissage ou la vitesse calculée à partir de la vitesse volumétrique maximale du filament est inférieure, c’est la plus faible qui sera utilisée.\n" "\n" -"L’augmentation de cette vitesse peut affecter la stabilité de la tour et accroître la force avec laquelle la buse heurte les éventuels amas qui se sont formés sur la tour d’essuyage.\n" +"L’augmentation de cette vitesse peut affecter la stabilité de la tour et accroître la force avec laquelle la buse heurte les éventuels amas qui se sont formés sur la tour d’amorçage.\n" "\n" "Avant d’augmenter ce paramètre au-delà de la valeur par défaut de 90 mm/s, assurez-vous que votre imprimante peut réaliser des ponts de façon fiable à des vitesses plus élevées et que le suintement lors des changements d’outil est bien maîtrisé.\n" "\n" -"Pour les périmètres externes de la tour d’essuyage, c’est la vitesse du périmètre interne qui est utilisée, également limitée par ce paramètre." +"Pour les périmètres externes de la tour d’amorçage, c’est la vitesse du périmètre interne qui est utilisée, également limitée par ce paramètre." msgid "Wall type" msgstr "Type de paroi" @@ -19881,9 +19890,9 @@ msgid "" "2. Cone: A cone with a fillet at the bottom to help stabilize the wipe tower.\n" "3. Rib: The default wall type, which adds four ribs to the tower wall for enhanced stability." msgstr "" -"Type de paroi extérieure de la tour d’essuyage.\n" +"Type de paroi extérieure de la tour d’amorçage.\n" "1. Rectangle : Un rectangle avec une largeur et une hauteur fixes.\n" -"2. Cône : Un cône avec un congé en bas pour aider à stabiliser la tour d’essuyage.\n" +"2. Cône : Un cône avec un congé en bas pour aider à stabiliser la tour d’amorçage.\n" "3. Nervure : Le type de paroi par défaut, qui ajoute quatre nervures à la paroi de la tour pour une stabilité améliorée." msgid "Rectangle" @@ -19911,13 +19920,13 @@ msgid "The wall of prime tower will fillet." msgstr "La paroi de la tour d'amorçage aura un congé." msgid "The extruder to use when printing perimeter of the wipe tower. Set to 0 to use the one that is available (non-soluble would be preferred)." -msgstr "L’extrudeur à utiliser lors de l’impression du périmètre de la tour d’essuyage. Réglez sur 0 pour utiliser celui qui est disponible (un non-soluble serait préféré)." +msgstr "L’extrudeur à utiliser lors de l’impression du périmètre de la tour d’amorçage. Réglez sur 0 pour utiliser celui qui est disponible (un non-soluble serait préféré)." msgid "Purging volumes - load/unload volumes" msgstr "Volumes de purge - Volume de Chargement/Déchargement" msgid "This vector saves required volumes to change from/to each tool used on the wipe tower. These values are used to simplify creation of the full purging volumes below." -msgstr "Ce vecteur enregistre les volumes requis pour passer de/vers chaque outil utilisé sur la tour d’essuyage. Ces valeurs sont utilisées pour simplifier la création des volumes de purge complets ci-dessous." +msgstr "Ce vecteur enregistre les volumes requis pour passer de/vers chaque outil utilisé sur la tour d’amorçage. Ces valeurs sont utilisées pour simplifier la création des volumes de purge complets ci-dessous." msgid "Skip points" msgstr "Sauter des points" @@ -19967,10 +19976,10 @@ msgid "Maximal distance between supports on sparse infill sections." msgstr "Distance maximale entre les supports sur les sections de remplissage." msgid "Wipe tower purge lines spacing" -msgstr "Espacement des lignes de purge de la tour d’essuyage" +msgstr "Espacement des lignes de purge de la tour d’amorçage" msgid "Spacing of purge lines on the wipe tower." -msgstr "Espacement des lignes de purge sur la tour d’essuyage." +msgstr "Espacement des lignes de purge sur la tour d’amorçage." msgid "Extra flow for purging" msgstr "Débit supplémentaire pour purger" @@ -19978,7 +19987,7 @@ msgstr "Débit supplémentaire pour purger" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "Extra flow used for the purging lines on the wipe tower. This makes the purging lines thicker than they normally would be. The spacing is adjusted automatically." -msgstr "Débit supplémentaire utilisé pour les lignes de purge de la tour d’essuyage. Cela rend les lignes de purge plus épaisses qu’elles ne le seraient normalement. L’espacement est ajusté automatiquement." +msgstr "Débit supplémentaire utilisé pour les lignes de purge de la tour d’amorçage. Cela rend les lignes de purge plus épaisses qu’elles ne le seraient normalement. L’espacement est ajusté automatiquement." msgid "Idle temperature" msgstr "Température au repos" @@ -20053,7 +20062,7 @@ msgid "Use relative E distances" msgstr "Utiliser l’extrusion relative" msgid "Relative extrusion is recommended when using \"label_objects\" option. Some extruders work better with this option unchecked (absolute extrusion mode). Wipe tower is only compatible with relative mode. It is recommended on most printers. Default is checked." -msgstr "L’extrusion relative est recommandée lors de l’utilisation de l’option « label_objects ». Certains extrudeurs fonctionnent mieux avec cette option non verrouillée (mode d’extrusion absolu). La tour d’essuyage n’est compatible qu’avec le mode relatif. Il est recommandé sur la plupart des imprimantes. L’option par défaut est cochée" +msgstr "L’extrusion relative est recommandée lors de l’utilisation de l’option « label_objects ». Certains extrudeurs fonctionnent mieux avec cette option non verrouillée (mode d’extrusion absolu). La tour d’amorçage n’est compatible qu’avec le mode relatif. Il est recommandé sur la plupart des imprimantes. L’option par défaut est cochée" msgid "The classic wall generator produces walls with constant extrusion width and for very thin areas, gap-fill is used. The Arachne engine produces walls with variable extrusion width." msgstr "Le générateur de paroi classique produit des parois avec une largeur d’extrusion constante et, pour les zones très fines, il utilise le remplissage d’espace. Le moteur Arachne produit des parois avec une largeur d’extrusion variable." @@ -20615,10 +20624,10 @@ msgid "Specific for sequential printing. Zero-based index of currently printed o msgstr "Spécifique à l’impression séquentielle. Index commençant à zéro de l’objet en cours d’impression." msgid "Has wipe tower" -msgstr "Possède une tour d’essuyage" +msgstr "Possède une tour d’amorçage" msgid "Whether or not wipe tower is being generated in the print." -msgstr "Indique si la tour d’essuyage est générée ou non dans l’impression." +msgstr "Indique si la tour d’amorçage est générée ou non dans l’impression." msgid "Initial extruder" msgstr "Extrudeur initial" @@ -20755,16 +20764,16 @@ msgid "Total cost of all material used in the print. Calculated from filament_co msgstr "Coût total de tous les matériaux utilisés dans l'impression. Calculé à partir de la valeur filament_cost dans les paramètres de filament." msgid "Total wipe tower cost" -msgstr "Coût total de la tour de purge" +msgstr "Coût total de la tour d'amorçage" msgid "Total cost of the material wasted on the wipe tower. Calculated from filament_cost value in Filament Settings." -msgstr "Coût total du matériau gaspillé sur la tour de purge. Calculé à partir de la valeur filament_cost dans les paramètres de filament." +msgstr "Coût total du matériau gaspillé sur la tour d'amorçage. Calculé à partir de la valeur filament_cost dans les paramètres de filament." msgid "Wipe tower volume" -msgstr "Volume de la tour de purge" +msgstr "Volume de la tour d'amorçage" msgid "Total filament volume extruded on the wipe tower." -msgstr "Volume total de filament extrudé sur la tour de purge." +msgstr "Volume total de filament extrudé sur la tour d'amorçage." msgid "Used filament" msgstr "Filament utilisé" @@ -20881,7 +20890,7 @@ msgstr "Taille du plateau d’impression" # AI Translated # Needs human review: Unsettled glossary term (⚠) "Prime tower / Wipe tower": this entry uses "tour d’essuyage"; align it once the term is settled. msgid "First layer center without wipe tower" -msgstr "Centre de la première couche sans tour d’essuyage" +msgstr "Centre de la première couche sans tour d’amorçage" # AI Translated msgid "Height of the first layer." @@ -29922,20 +29931,21 @@ msgid "Basic Colors" msgstr "Couleurs de base" # AI Translated +#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. msgid "Orca Palette" msgstr "Palette Orca" # AI Translated -#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. +#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "RAL Classic" msgstr "RAL Classic" # AI Translated -#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "Gradients" msgstr "Dégradés" # AI Translated +msgctxt "Color picker" msgid "Solid" msgstr "Uni" @@ -30437,8 +30447,7 @@ msgid "Medium violet red" msgstr "Rouge violacé moyen" # AI Translated -# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier -msgid "PaleV violet red" +msgid "Pale violet red" msgstr "Rouge violacé pâle" # AI Translated @@ -30654,8 +30663,7 @@ msgid "Shallow sky" msgstr "Ciel de lagune" # AI Translated -# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier -msgid "Electric bel" +msgid "Electric blue" msgstr "Bleu électrique" # AI Translated @@ -30747,8 +30755,8 @@ msgid "Maize yellow" msgstr "Jaune maïs" # AI Translated -msgid "Dalmatian yellow" -msgstr "Jaune dalmatien" +msgid "Daffodil yellow" +msgstr "Jaune jonquille" # AI Translated msgid "Brown beige" @@ -31095,9 +31103,8 @@ msgid "Turquoise blue" msgstr "Bleu turquoise" # AI Translated -# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier -msgid "Capsanthin violet" -msgstr "Violet capsanthine" +msgid "Capri blue" +msgstr "Bleu Capri" # AI Translated msgid "Ocean blue" @@ -31249,9 +31256,8 @@ msgid "Silver grey" msgstr "Gris argent" # AI Translated -# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier -msgid "Olivestone" -msgstr "Pierre d’olive" +msgid "Olive grey" +msgstr "Gris olive" # AI Translated msgid "Moss grey" @@ -32027,13 +32033,25 @@ msgstr "Retirer de Mes textures" msgid "Built-in" msgstr "Prédéfinies" +# AI Translated +msgid "My textures" +msgstr "Mes textures" + # AI Translated msgid "No textures found." msgstr "Aucune texture trouvée." # AI Translated -msgid "My textures" -msgstr "Mes textures" +msgid "Texture libraries" +msgstr "Bibliothèques de textures" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Explorer d’autres bibliothèques de textures" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Ouvre OrcaCloud dans la page d’accueil pour parcourir les plugins." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -34742,6 +34760,10 @@ msgstr "Script" msgid "Slicing Pipeline" msgstr "Pipeline de découpage" +# AI Translated +msgid "Resource Texture" +msgstr "Texture de ressource" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "L’interface de configuration du plugin était vide. Affichage de l’éditeur par défaut." @@ -34889,6 +34911,30 @@ msgstr "Le répertoire du plugin contient à la fois des fichiers d’entrée .p msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Le répertoire du plugin ne contient aucun fichier d’entrée .py ou .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Le répertoire des textures de ressource n’est pas défini" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Le répertoire des textures de ressource n’a pas pu être résolu" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Le chemin des textures de ressource n’est pas un répertoire" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Le dossier du plugin n’a pas pu être résolu" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Le répertoire des textures de ressource se trouve en dehors du dossier du plugin" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Le répertoire des textures de ressource n’a pas pu être lu" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -35835,6 +35881,41 @@ msgstr "" "Éviter la déformation\n" "Saviez-vous que lors de l’impression de matériaux susceptibles de se déformer, tels que l’ABS, une augmentation appropriée de la température du plateau chauffant peut réduire la probabilité de déformation?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Jaune dalmatien" + +# AI Translated +# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier +#~ msgid "Capsanthin violet" +#~ msgstr "Violet capsanthine" + +# AI Translated +# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier +#~ msgid "Olivestone" +#~ msgstr "Pierre d’olive" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Disponible partout dans la fenêtre, même pendant la saisie dans un champ de texte." + +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Les raccourcis globaux s'appliquent aussi pendant la saisie." + +# AI Translated +#~ msgid "Solid" +#~ msgstr "Uni" + +# AI Translated +# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier +#~ msgid "PaleV violet red" +#~ msgstr "Rouge violacé pâle" + +# AI Translated +# Needs human review: Nom de couleur inhabituel ou source possiblement erronée : vérifier +#~ msgid "Electric bel" +#~ msgstr "Bleu électrique" + #~ msgid "Please choose the filament color" #~ msgstr "Veuillez choisir la couleur du filament" diff --git a/localization/i18n/hu/OrcaSlicer_hu.po b/localization/i18n/hu/OrcaSlicer_hu.po index aedd11a0a8..29e1b662cf 100644 --- a/localization/i18n/hu/OrcaSlicer_hu.po +++ b/localization/i18n/hu/OrcaSlicer_hu.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -779,18 +779,23 @@ msgstr "Kijelölés" msgid "Plate" msgstr "Tálca" +# AI Translated +# Needs human review: Glossary cell empty for hu; reused the catalog's 'Elosztás' (Distribute left-right etc.) msgid "Distribute" -msgstr "" +msgstr "Elosztás" # AI Translated msgid "Coordinate system used for transform actions." msgstr "A transzformációs műveletekhez használt koordináta-rendszer." +# AI Translated +# Needs human review: Tooltip in the object manipulation panel; check it reads right next to the align buttons msgid "Reference for alignment" -msgstr "" +msgstr "Igazítás referenciája" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Válassz ki legalább 3 tárgyat vagy objektumot" # AI Translated msgid "Align left" @@ -844,8 +849,9 @@ msgstr "Elosztás fel-le irányban" msgid "Drop" msgstr "Lehelyezés" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "A kijelölés mozgatása Z mentén úgy, hogy a legalacsonyabb pontja érintse az asztalt." # AI Translated msgid "Absolute" @@ -2081,17 +2087,21 @@ msgstr "Belépés az összeállítás gizmóba" msgid "Leaving Assembly gizmo" msgstr "Kilépés az összeállítás gizmóból" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "A vágott objektum tárgyai nem mozgathatók" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "A tálcához igazítás csak X és Y irányban érhető el" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Kapcsold ki a kijelölt objektumok automatikus leejtését, hogy Z irányban mozgathasd őket" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Az összes kijelölt objektumnak ugyanazon a tálcán kell lennie" msgid "Shift+" msgstr "Shift+" @@ -6533,8 +6543,10 @@ msgstr "Tengelyek" msgid "Gridlines" msgstr "Rácsvonalak" +# AI Translated +# Needs human review: Glossary cell empty for hu; check the term for this view mode msgid "Focus mode" -msgstr "" +msgstr "Fókuszmód" msgid "Labels" msgstr "Címkék" @@ -6596,7 +6608,7 @@ msgid "Size:" msgstr "Méret:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "G-code útvonalütközés található a(z) %d. rétegen, Z = %.2lfmm. Helyezd távolabb egymástól az ütköző objektumokat (%s <-> %s)." @@ -10947,11 +10959,13 @@ msgstr "Nem támogatott beállítások megjelenítése" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Megjeleníti a nem kompatibilis vagy nem támogatott beállításokat a nyomtató- és filamentlegördülő listákban. Ezek a beállítások nem választhatók ki." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Statisztika exportálása G-code-dal" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Ha be van kapcsolva, a G-code fájl exportálásakor annak statisztikája is JSON-ként kiíródik mellé .statistics.json néven, az exportált szeletelt 3MF fájl pedig belül tartalmazza: a nyomtatási időt, a filament- és vonaltípus-összesítőket, valamint ugyanezeket rétegenként és objektumonként." # AI Translated msgid "Experimental Features" @@ -11819,6 +11833,10 @@ msgstr "Nem sikerült feltölteni a fájlt a nyomtató tárhelyére. Próbáld msgid "Send Failed" msgstr "Sikertelen küldés" +# AI Translated +msgid "No available printers" +msgstr "Nincs elérhető nyomtató" + msgid "The name length exceeds the limit." msgstr "A név hossza meghaladja a korlátot." @@ -13688,8 +13706,8 @@ msgid "Left mouse" msgstr "Bal egérgomb" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Az ablakban bárhol elérhető, szövegmezőbe gépelés közben is." +msgid "Available anywhere in the window." +msgstr "Az ablak bármely pontján elérhető." # AI Translated msgid "Run favorite 1 to 10" @@ -13801,10 +13819,6 @@ msgstr "A(z) %s ehhez van rendelve: %s. Átrendeled ehhez: %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Az alapértelmezett %s ehhez van rendelve: %s. Átrendeled ehhez: %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "A globális gyorsbillentyűk gépelés közben is működnek." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Karaktert beíró billentyű nem lehet globális gyorsbillentyű." @@ -14259,9 +14273,10 @@ msgstr "a(z) \"%2%\" \"%1%\" módosítója (összesen %3%) nem volt hatással a msgid "Seam placement may differ from expected." msgstr "A varrat elhelyezése eltérhet a várttól." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Nem sikerült a G-code statisztikát a(z) %1% helyre írni." msgid "Internal Bridge" msgstr "Belső híd" @@ -17679,6 +17694,14 @@ msgstr "Tárgyak kizárása" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Engedélyezd ezt az opciót, hogy EXCLUDE OBJECT parancs kerüljön a G-code-ba." +# AI Translated +msgid "Outline tolerance" +msgstr "Körvonal tűrése" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Az EXCLUDE_OBJECT_DEFINE-ba írt objektumkörvonal legnagyobb megengedett eltérése az eredeti körvonaltól. Nagyobb értékeknél kevesebb pont keletkezik, ami segít azokon a firmware-eken, amelyek sok objektumot tartalmazó G-code feldolgozásakor megakadnak. A 0 minden pontot megtart." + # AI Translated msgid "Verbose G-code" msgstr "Bővebb G-code" @@ -20918,11 +20941,13 @@ msgstr "Kimeneti mappa" msgid "This is the output directory for exported files." msgstr "Az exportált fájlok kimeneti mappája." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Statisztika exportálása" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Minden szeletelt tálca statisztikáját JSON-ként írja ki: plate_N.statistics.json néven a G-code mellé a kimeneti mappába, valamint az --export-3mf által írt 3MF fájlba: nyomtatási idő, filament- és vonaltípus-összesítők, valamint ugyanezek rétegenként és objektumonként." msgid "Debug level" msgstr "Hibakeresés szintje" @@ -30840,1231 +30865,1645 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "A jelenlegi filamentlista nem tartalmazza ezt: %s. A kevert filamenthez szükséges projektfilament a szétbontás után automatikusan létrejön." msgstr[1] "A jelenlegi filamentlista nem tartalmazza ezt: %s. A kevert filamenthez szükséges projektfilamentek a szétbontás után automatikusan létrejönnek." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Színválasztó" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Alapszínek" +# AI Translated +# Needs human review: Glossary cell for Palette empty for hu; 'paletta' used #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca paletta" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Klasszikus" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Színátmenetek" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Egyszínű" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Színátmenet" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Színátmenet kezdete" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Színátmenet vége" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Színátmenet színe" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Szín hozzáadása" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Szín eltávolítása" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Telítettség" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Eredeti szín" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Jelenlegi szín mentése" +# AI Translated +# Needs human review: Glossary cell for Palette empty for hu; 'paletta' used msgid "Palettes" -msgstr "" +msgstr "Paletták" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Színek keresése" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Színek szűrése" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Nincs egyező szín" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Hex szín" # AI Translated msgid "Opacity" msgstr "Átlátszatlanság" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Átlátszatlanság (%)" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Szín mentése" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Adj meg egy teljes hexadecimális színkódot" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "A jelenlegi többszínű kijelölés megmarad, amíg másik színt nem választasz." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Legfeljebb %d szín támogatott." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmazsin" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Narancsvörös" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Paradicsom" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Narancs" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Sötét narancs" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Arany" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Fabarna" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Biszkvit" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Ködös rózsa" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Világossárga" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Citromhab" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Bézs" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Világos aranyvesszősárga" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Halvány aranyvessző" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Khaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Sötét khaki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Barackhab" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mokaszin" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papayakrém" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Hámozott mandula" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antik fehér" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navajo fehér" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Búza" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Aranyvessző" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Csokoládé" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Téglavörös" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Nyeregbarna" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Barna" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Rózsás barna" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Lazac" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Világos lazac" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Sötét lazac" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Homokbarna" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Korall" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Világos korall" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Indiánvörös" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Sötétvörös" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Bordó" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Zöldessárga" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Sárgászöld" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Gyepzöld" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Limezöld" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Tavaszi zöld" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Közepes tavaszi zöld" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Lime" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Erdőzöld" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Sötétzöld" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Tompa olívazöld" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Olíva" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Sötét olívazöld" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Halványzöld" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Világoszöld" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Közepes tengerzöld" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Tengerzöld" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Sötét tengerzöld" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Kadétkék" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Közepes akvamarin" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Türkiz" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Közepes türkiz" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Sötét türkiz" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Halvány türkiz" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Világos cián" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Mentakrém" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Mézharmat" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Akvamarin" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Világos tengerzöld" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Sötét cián" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Pávakék" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Sötét palaszürke" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Világos palaszürke" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Palaszürke" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Mély égkék" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodger-kék" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Égkék" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Világos égkék" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Világoskék" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Púderkék" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Világos acélkék" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Acélkék" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Búzavirágkék" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Királykék" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Közepes kék" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Éjkék" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Sötétkék" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Tengerészkék" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Palakék" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Sötét palakék" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Közepes palakék" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Kékibolya" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indigó" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Sötét ibolya" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Sötét orchidea" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Közepes orchidea" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orchidea" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Ibolya" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Közepes lila" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Lila" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebecca-lila" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Közepes ibolyavörös" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Halvány ibolyavörös" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Mély rózsaszín" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Élénk rózsaszín" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Világos rózsaszín" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rózsaszín" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Szilva" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Bogáncs" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fukszia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Sötét magenta" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Vászon" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Régi csipke" +# AI Translated +# Needs human review: CSS color 'seashell'; Shell glossary warning is a false match (not the print shell) msgid "Sea shell" -msgstr "" +msgstr "Kagyló" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Elefántcsont" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Virágfehér" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Levendulapír" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Szellemfehér" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Alice-kék" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Levendula" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Füstfehér" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Fekete" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Korallparázs" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Tengerirózsa" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Mély szakadék" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Homárvörös" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Homokos agyag" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Uszadékfa" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Homoktövis" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Naplementés zátony" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tigriskorall" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Rózsaszín korall" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Kagylófény" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Homok" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Arany moszat" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Napsütötte dűne" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Borostyán nautilus" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Tengeri citrom" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Halvány tengericsillag" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Tavaszi dagály" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Limezöld alga" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Tengeri fű" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neon plankton" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Moszaterdő" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Smaragd hullám" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Bálnaárnyék" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Tengeri teknős" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Lagúna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Trópusi áramlat" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Éjféli árok" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Sötét moszat" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Kristályhullám" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Türkiz öböl" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Zátony feletti ég" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Sekélyvízi ég" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektromos kék" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfin" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Óceánmélység" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Bálna" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indigó szakadék" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Tengeri sün" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Levendula korall" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Ibolya dagály" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Mélytengeri orchidea" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neon medúza" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fukszia korall" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Rózsaszín medúza" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Hab" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Kagylófehér" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Kavicsszürke" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Viharfelhő" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Tintafekete" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Zöldesbézs" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Homoksárga" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Jelzősárga" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Aranysárga" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Mézsárga" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Kukoricasárga" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Nárciszsárga" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Barnabézs" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Citromsárga" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Osztrigafehér" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Világos elefántcsont" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Cinksárga" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Szürkebézs" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Olívasárga" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Repcesárga" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Forgalmi sárga" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Okkersárga" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Forgalmi narancssárga" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Dinnyesárga" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Rekettyesárga" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Dáliasárga" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pasztellsárga" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Gyöngybézs" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Gyöngyarany" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Napsárga" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Sárgásnarancs" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Mély narancs" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Cinóber" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Gyöngynarancs" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Tiszta narancs" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Világító narancs" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Világító élénk narancs" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Élénk vörösnarancs" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Forgalmi narancs" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Jelzőnarancs" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Lazacnarancs" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Gyöngyrózsaszín" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Réznarancs" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Jelzőbarna" +# AI Translated +# Needs human review: RAL 2018 name; 'Fir' rendered as jegenyefenyő; check against the Hungarian RAL chart msgid "Fir orange" -msgstr "" +msgstr "Jegenyefenyő-narancs" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Jelzővörös" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Világító vörös" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karminvörös" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Gyöngykarminvörös" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Tiszta vörös" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Világító mélyvörös" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Ribizlivörös" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Gyöngyrubinvörös" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Tűzvörös" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rubinvörös" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Lilásvörös" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Borvörös" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Feketésvörös" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oxidvörös" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Barnásvörös" +# AI Translated +# Needs human review: RAL 3012 name; check against the Hungarian RAL chart msgid "Pine red" -msgstr "" +msgstr "Fenyővörös" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Paradicsomvörös" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Antik rózsaszín" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Korallvörös" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rózsa" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Epervörös" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Forgalmi vörös" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Lazacrózsaszín" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Világító rózsa" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Világító élénkvörös" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Málnavörös" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Keleti vörös" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Gyöngyrubin" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Vöröslila" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Vörösibolya" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Hangaibolya" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordóibolya" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Mahagóni" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Szürkéslila" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Jelzőibolya" +# AI Translated +# Needs human review: Used for both RAL 4009 and 6009 (source reuses one msgid); check against the Hungarian RAL chart msgid "Fir green" -msgstr "" +msgstr "Jegenyefenyő-zöld" +# AI Translated +# Needs human review: RAL 4010 name (a violet-grey); unclear source term, check against the Hungarian RAL chart msgid "Sabine grey" -msgstr "" +msgstr "Szabin szürke" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Gyöngyibolya" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Gyöngyszeder" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Zöldeskék" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarinkék" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Zafírkék" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Feketéskék" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Jelzőkék" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Ragyogó kék" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Szürkéskék" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azúrkék" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Enciánkék" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobaltkék" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Galambkék" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Forgalmi kék" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Türkizkék" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Caprikék" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Óceánkék" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Vízkék" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Éjszakai kék" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Távoli kék" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pasztellkék" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Gyöngyenciánkék" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Gyöngyéjkék" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patinazöld" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Smaragdzöld" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Levélzöld" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Olívazöld" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Kékeszöld" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Mohazöld" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Szürkeolíva" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Fenyőzöld" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Fenyőbarna" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Fűzöld" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Rezedazöld" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Barnászöld" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Nádzöld" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Feketészöld" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Türkizzöld" +# AI Translated msgid "May green" -msgstr "" +msgstr "Májusi zöld" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Krómoxidzöld" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Forgalmi zöld" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Páfránzöld" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opálzöld" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Mentazöld" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Bronzzöld" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Gyöngyzöld" +# AI Translated msgid "Sax turquoise" -msgstr "" +msgstr "Szász türkiz" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Gyöngytürkiz" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Gyöngyjáde" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Tiszta zöld" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Világító zöld" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Mókusszürke" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Ezüstszürke" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Olívaszürke" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Mohaszürke" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Jelzőszürke" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Egérszürke" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Bézsszürke" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Khakiszürke" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Zöldesszürke" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Ponyvaszürke" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Vasszürke" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Bazaltszürke" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Barnásszürke" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Palaszürke" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antracitszürke" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Világosszürke" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umbraszürke" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Betonszürke" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafitszürke" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Gránitszürke" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Kőszürke" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Kavicsszürke" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Cementszürke" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Sárgásszürke" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platinaszürke" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Porszürke" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Achátszürke" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Kvarcszürke" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Ablakszürke" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Forgalmi szürke A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Forgalmi szürke B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Selyemszürke" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Távközlési szürke 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Távközlési szürke 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Távközlési szürke 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Gyöngyegérszürke" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Zöldesbarna" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Okkerbarna" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Agyagbarna" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Rézbarna" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Csokoládébarna" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Olívabarna" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Dióbarna" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Vörösesbarna" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Szépiabarna" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Gesztenyebarna" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Mahagónibarna" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Szürkésbarna" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Gyöngyréz" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Bézsbarna" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Gyöngymokkabarna" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Földbarna" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Gyöngybarna" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Krém" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Szürkésfehér" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Jelzőfehér" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Jelzőfekete" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Koromfekete" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Fehér alumínium" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Szürke alumínium" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Tiszta fehér" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Grafitfekete" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Forgalmi fehér" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Forgalmi fekete" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papiruszfehér" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Gyöngyvilágosszürke" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Fém: Ezüst" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Fém: Sárgaréz" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Fém: Arany" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Fém: Réz" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Fém: Bronz" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Természet: Gyöngy" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Természet: Szivárvány" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Természet: Derült ég" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Természet: Naplemente" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Fa: Sötét" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Fa: Közepes" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Fa: Világos" # AI Translated msgid "Alternate nozzles:" @@ -32541,13 +32980,25 @@ msgstr "Eltávolítás a Saját textúrák közül" msgid "Built-in" msgstr "Beépített" +# AI Translated +msgid "My textures" +msgstr "Saját textúrák" + # AI Translated msgid "No textures found." msgstr "Nem található textúra." # AI Translated -msgid "My textures" -msgstr "Saját textúrák" +msgid "Texture libraries" +msgstr "Textúratárak" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "További textúratárak felfedezése" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Megnyitja az OrcaCloudot a Kezdőlapon a bővítmények böngészéséhez." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -32950,11 +33401,15 @@ msgstr "A modell saját UV-elrendezése szerint leképezve, ami már maga az elh msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "A textúra egy példányának szélessége a modellen. Kisebb értéknél a minta gyakrabban ismétlődik, és a részletei finomabbak; kikapcsolt Csempézésnél ez az egyetlen példány mérete." +# AI Translated +# Needs human review: Caption under a tile-size picture in the Texture displacement gizmo; check it fits msgid "Larger" -msgstr "" +msgstr "Nagyobb" +# AI Translated +# Needs human review: Caption under a tile-size picture in the Texture displacement gizmo; check it fits msgid "Smaller" -msgstr "" +msgstr "Kisebb" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33030,11 +33485,15 @@ msgstr "Kevert színek" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "A beégetés által legfeljebb hozzáadható kevert filamentek száma. A textúra színeiből választódnak ki, és csak azok jönnek létre, amelyeket a beégetés ténylegesen használ." +# AI Translated +# Needs human review: Caption under a mixed-colors picture in the Texture displacement gizmo; check it fits msgid "Few" -msgstr "" +msgstr "Kevés" +# AI Translated +# Needs human review: Caption under a mixed-colors picture in the Texture displacement gizmo; check it fits msgid "Many" -msgstr "" +msgstr "Sok" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33390,11 +33849,15 @@ msgstr "Újrahálózás" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Háromszögméret, amellyel a teljes modell újraépül, milliméterben. A domborítás egyenletes hálón működik a legjobban; ez készít ilyet egy egyenetlen importált modellből." +# AI Translated +# Needs human review: Caption under the remesh before/after picture; check it fits msgid "Before" -msgstr "" +msgstr "Előtte" +# AI Translated +# Needs human review: Caption under the remesh before/after picture; check it fits msgid "After" -msgstr "" +msgstr "Utána" # AI Translated msgid "Keep sharp edges" @@ -35272,6 +35735,10 @@ msgstr "Szkript" msgid "Slicing Pipeline" msgstr "Szeletelési folyamat" +# AI Translated +msgid "Resource Texture" +msgstr "Erőforrás-textúra" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "A bővítmény konfigurációs felülete üres volt. Az alapértelmezett szerkesztő jelenik meg." @@ -35419,6 +35886,30 @@ msgstr "A bővítmény könyvtára .py és .whl belépési fájlt is tartalmaz" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "A bővítmény könyvtára nem tartalmaz .py vagy .whl belépési fájlt" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Az erőforrás-textúra mappája nincs megadva" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Az erőforrás-textúra mappáját nem sikerült feloldani" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Az erőforrás-textúra útvonala nem mappa" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "A bővítmény mappáját nem sikerült feloldani" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Az erőforrás-textúra mappája a bővítmény mappáján kívül van" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Az erőforrás-textúra mappáját nem sikerült beolvasni" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36367,6 +36858,27 @@ msgstr "" "Kunkorodás elkerülése\n" "Tudtad, hogy a kunkorodásra hajlamos anyagok (például ABS) nyomtatásakor az asztal hőmérsékletének növelése csökkentheti a kunkorodás valószínűségét?" +# AI Translated +# Needs human review: Source likely a typo for RAL 1007 Daffodil yellow; translated as daffodil +#~ msgid "Dalmatian yellow" +#~ msgstr "Nárciszsárga" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Kapszantinibolya" + +# AI Translated +#~ msgid "Olivestone" +#~ msgstr "Olívakő" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Az ablakban bárhol elérhető, szövegmezőbe gépelés közben is." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "A globális gyorsbillentyűk gépelés közben is működnek." + #~ msgid "Please choose the filament color" #~ msgstr "Kérlek, válaszd ki a filament színét" diff --git a/localization/i18n/it/OrcaSlicer_it.po b/localization/i18n/it/OrcaSlicer_it.po index 3816ab158f..8fe101ae71 100644 --- a/localization/i18n/it/OrcaSlicer_it.po +++ b/localization/i18n/it/OrcaSlicer_it.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -784,18 +784,22 @@ msgstr "Selezione" msgid "Plate" msgstr "Piatto" +# AI Translated +# Needs human review: Distribute has no glossary rendering yet; check the term. msgid "Distribute" -msgstr "" +msgstr "Distribuisci" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Sistema di coordinate utilizzato per le azioni di trasformazione." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Riferimento per l'allineamento" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Seleziona almeno 3 parti o oggetti" # AI Translated msgid "Align left" @@ -848,8 +852,9 @@ msgstr "Distribuisci alto-basso" msgid "Drop" msgstr "Lascia" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Sposta la selezione lungo Z in modo che il suo punto più basso tocchi il piatto." # AI Translated msgid "Absolute" @@ -2090,17 +2095,21 @@ msgstr "Attivazione strumento Assemblaggio" msgid "Leaving Assembly gizmo" msgstr "Uscita dallo strumento Assemblaggio" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Le parti di un oggetto tagliato non possono essere spostate" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "L'allineamento al piatto è disponibile solo in X e Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Disattiva il Rilascio automatico per gli oggetti selezionati per spostarli in Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Tutti gli oggetti selezionati devono trovarsi sullo stesso piatto" msgid "Shift+" msgstr "Maiusc+" @@ -6507,8 +6516,10 @@ msgstr "Assi" msgid "Gridlines" msgstr "Linee griglia" +# AI Translated +# Needs human review: Name of a view mode hiding the surrounding UI; glossary cell is empty, check the term. msgid "Focus mode" -msgstr "" +msgstr "Modalità focus" msgid "Labels" msgstr "Etichette" @@ -6570,7 +6581,7 @@ msgstr "Volume:" msgid "Size:" msgstr "Dimensione:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Sono stati trovati conflitti di percorsi nel G-code sullo strato %d, Z = %.2lfmm. Si prega di separare gli oggetti in conflitto (%s <-> %s)." @@ -10918,11 +10929,13 @@ msgstr "Mostra i profili non supportati" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Mostra i profili incompatibili/non supportati negli elenchi a discesa di stampante e filamento. Questi profili non possono essere selezionati." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Esporta statistiche con il G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Se attivato, l'esportazione di un file G-code scrive anche le sue statistiche come JSON accanto ad esso, come .statistics.json, e un file 3MF elaborato esportato le contiene al suo interno: tempo di stampa, totali di filamento e per tipo linea, e gli stessi dati per strato e per oggetto." # AI Translated msgid "Experimental Features" @@ -11785,6 +11798,10 @@ msgstr "Caricamento del file nella memoria della stampante non riuscito. Riprova msgid "Send Failed" msgstr "Invio non riuscito" +# AI Translated +msgid "No available printers" +msgstr "Nessuna stampante disponibile" + msgid "The name length exceeds the limit." msgstr "La lunghezza del nome supera il limite." @@ -13616,8 +13633,8 @@ msgid "Left mouse" msgstr "Tasto sinistro mouse" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Disponibile ovunque nella finestra, anche durante la digitazione in un campo di testo." +msgid "Available anywhere in the window." +msgstr "Disponibile in qualsiasi punto della finestra." # AI Translated msgid "Run favorite 1 to 10" @@ -13729,10 +13746,6 @@ msgstr "%s è assegnato a %s. Riassegnarlo a %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Il tasto predefinito %s è assegnato a %s. Riassegnarlo a %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Le scorciatoie globali valgono anche durante la digitazione." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Un tasto che digita un carattere non può essere una scorciatoia globale." @@ -14181,9 +14194,10 @@ msgstr "il modificatore \"%1%\" di \"%2%\" (%3% in totale) non ha avuto effetto msgid "Seam placement may differ from expected." msgstr "Il posizionamento della cucitura potrebbe differire da quanto previsto." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Impossibile scrivere le statistiche del G-code in %1%." msgid "Internal Bridge" msgstr "Ponte interno" @@ -17575,6 +17589,14 @@ msgstr "Escludi oggetti" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Abilita questa opzione per aggiungere il comando EXCLUDE OBJECT nel G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Tolleranza del contorno" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Deviazione massima del contorno dell'oggetto scritto in EXCLUDE_OBJECT_DEFINE rispetto al contorno originale. Valori più alti producono meno punti, il che aiuta il firmware che si blocca durante l'analisi di G-code con molti oggetti. 0 mantiene tutti i punti." + msgid "Verbose G-code" msgstr "G-code verboso" @@ -20784,11 +20806,13 @@ msgstr "Cartella di destinazione" msgid "This is the output directory for exported files." msgstr "Questa è la cartella di destinazione per i file esportati." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Esporta statistiche" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Scrive le statistiche di ogni piatto elaborato come JSON, come plate_N.statistics.json accanto al suo G-code nella directory di output e all'interno del 3MF di --export-3mf: tempo di stampa, totali di filamento e per tipo linea, e gli stessi dati per strato e per oggetto." msgid "Debug level" msgstr "Livello di debug" @@ -30696,1231 +30720,1648 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "L'elenco filamenti attuale non contiene %s. Dopo la scomposizione verrà creato automaticamente un filamento del progetto richiesto dal filamento misto." msgstr[1] "L'elenco filamenti attuale non contiene %s. Dopo la scomposizione verranno creati automaticamente i filamenti del progetto richiesti dal filamento misto." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Selettore colore" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Colori di base" +# AI Translated +# Needs human review: Palette has no glossary rendering yet; check the term. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Tavolozza Orca" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Classic" + +# AI Translated +# Needs human review: Gradient has no glossary rendering in this language; used the catalog's color-gradient term. msgid "Gradients" -msgstr "" +msgstr "Gradienti" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Tinta unita" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Gradiente" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Inizio del gradiente" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Fine del gradiente" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Colore del gradiente" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Aggiungi colore" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Rimuovi colore" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Saturazione" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Colore originale" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Salva colore attuale" +# AI Translated +# Needs human review: Palette has no glossary rendering yet; check the term. msgid "Palettes" -msgstr "" +msgstr "Tavolozze" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Cerca colori" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Filtra colori" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Nessun colore corrispondente" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Colore esadecimale" # AI Translated msgid "Opacity" msgstr "Opacità" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Percentuale di opacità" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Salva colore" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Inserisci un colore esadecimale completo" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "La selezione multicolore attuale viene mantenuta finché non scegli un altro colore." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Sono supportati fino a %d colori." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Cremisi" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Rosso arancione" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Pomodoro" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Arancione" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Arancione scuro" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Oro" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Legno chiaro" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Biscotto" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Rosa nebbia" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Giallo chiaro" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Chiffon limone" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beige" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Giallo verga d'oro chiaro" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Verga d'oro pallido" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Cachi" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Cachi scuro" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Pesca tenue" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mocassino" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Crema di papaya" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Mandorla sbollentata" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Bianco antico" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Bianco navajo" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Grano" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Verga d'oro" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Cioccolato" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Perù" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Mattone refrattario" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Terra di Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Marrone cuoio" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Marrone" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Marrone rosato" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Salmone" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Salmone chiaro" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Salmone scuro" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Marrone sabbia" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Corallo" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Corallo chiaro" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Rosso indiano" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Rosso scuro" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Bordeaux" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Verde giallastro" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Giallo verdastro" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Verde prato" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Verde lime" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Verde primavera" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Verde primavera medio" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Lime" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Verde foresta" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Verde scuro" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Verde oliva opaco" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliva" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Verde oliva scuro" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Verde pallido" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Verde chiaro" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Verde mare medio" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Verde mare" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Verde mare scuro" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Blu cadetto" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Acquamarina medio" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turchese" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Turchese medio" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Turchese scuro" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Turchese pallido" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Acqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Ciano chiaro" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Crema di menta" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Rugiada di miele" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Acquamarina" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Verde mare chiaro" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Ciano scuro" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Verde petrolio" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Grigio ardesia scuro" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Grigio ardesia chiaro" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Grigio ardesia" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Celeste intenso" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Blu Dodger" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Celeste" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Celeste chiaro" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Blu chiaro" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Blu polvere" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Blu acciaio chiaro" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Blu acciaio" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Blu fiordaliso" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Blu reale" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Blu medio" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Blu mezzanotte" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Blu scuro" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Blu navy" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Blu ardesia" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Blu ardesia scuro" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Blu ardesia medio" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Blu violaceo" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indaco" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Violetto scuro" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Orchidea scura" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Orchidea media" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orchidea" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Violetto" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Porpora medio" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Porpora" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Porpora Rebecca" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Rosso violetto medio" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Rosso violetto pallido" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Rosa intenso" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Rosa acceso" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Rosa chiaro" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rosa" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Prugna" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Cardo" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fucsia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Magenta scuro" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Lino" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Pizzo antico" +# AI Translated +# Needs human review: CSS color Seashell (a sea shell); glossary Shell warning is a false match. msgid "Sea shell" -msgstr "" +msgstr "Conchiglia" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Avorio" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Bianco floreale" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lavanda rosata" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Bianco fantasma" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Blu Alice" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lavanda" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Fumo bianco" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Nero" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Fuoco di corallo" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Anemone di mare" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Abisso profondo" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Rosso aragosta" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Argilla sabbiosa" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Legno di mare" +# AI Translated +# Needs human review: Ocean-themed color name; check the plant name. msgid "Sea buckthorn" -msgstr "" +msgstr "Olivello spinoso" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Barriera al tramonto" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Corallo tigre" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Corallo rosa" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Bagliore di conchiglia" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Sabbia" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Kelp dorato" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Duna al sole" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Nautilus ambra" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Limone di mare" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Stella marina pallida" +# AI Translated +# Needs human review: Ocean-themed color name; check the sense (tide vs spring season). msgid "Spring tide" -msgstr "" +msgstr "Marea di primavera" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Alga lime" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Erba marina" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Plancton neon" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Foresta di kelp" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Onda smeraldo" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Ombra di balena" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Tartaruga marina" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Laguna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Corrente tropicale" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Fossa di mezzanotte" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Kelp scuro" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Risacca cristallina" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Baia turchese" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Cielo sopra la barriera" +# AI Translated +# Needs human review: Ocean-themed color name; check it reads as a pale sky blue. msgid "Shallow sky" -msgstr "" +msgstr "Cielo di acque basse" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Blu elettrico" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfino" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Profondità oceaniche" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Balena" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Abisso indaco" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Riccio di mare" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Corallo lavanda" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Marea violetta" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Orchidea di mare profondo" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Medusa neon" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Corallo fucsia" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Medusa rosa" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Schiuma" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Bianco conchiglia" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Grigio ciottolo" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Nuvola temporalesca" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Nero inchiostro" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Beige verdastro" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Giallo sabbia" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Giallo segnale" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Giallo oro" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Giallo miele" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Giallo mais" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Giallo narciso" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Beige brunastro" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Giallo limone" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Bianco ostrica" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Avorio chiaro" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Giallo zinco" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Beige grigiastro" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Giallo oliva" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Giallo colza" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Giallo traffico" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Giallo ocra" +# AI Translated +# Needs human review: RAL name; unusual source name, translated by its parts. msgid "Traffic orange yellow" -msgstr "" +msgstr "Giallo arancione traffico" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Giallo melone" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Giallo ginestra" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Giallo dalia" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Giallo pastello" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Beige perlato" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Oro perlato" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Giallo sole" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Arancione giallastro" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Arancione intenso" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Vermiglio" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Arancione perlato" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Arancione puro" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Arancione luminoso" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Arancione chiaro luminoso" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Rosso arancione chiaro" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Arancione traffico" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Arancione segnale" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Arancione salmone" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Rosa perlato" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Arancione rame" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Marrone segnale" +# AI Translated +# Needs human review: RAL name; 'Fir orange' looks odd in the source, translated literally. msgid "Fir orange" -msgstr "" +msgstr "Arancione abete" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Rosso segnale" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Rosso luminoso" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Rosso carminio" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Rosso carminio perlato" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Rosso puro" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Rosso intenso luminoso" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Rosso ribes" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Rosso rubino perlato" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Rosso fuoco" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rosso rubino" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Rosso porpora" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Rosso vino" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Rosso nerastro" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Rosso ossido" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Rosso brunastro" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Rosso pino" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Rosso pomodoro" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Rosa antico" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Rosso corallo" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rosa" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Rosso fragola" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Rosso traffico" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Rosa salmone" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Rosa luminoso" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Rosso chiaro luminoso" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Rosso lampone" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Rosso orientale" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Rubino perlato" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Porpora rossastro" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Violetto rossastro" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Violetto erica" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Violetto bordeaux" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Mogano" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Porpora grigiastro" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Violetto segnale" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Verde abete" +# AI Translated msgid "Sabine grey" -msgstr "" +msgstr "Grigio sabino" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Violetto perlato" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Mora perlata" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Blu verdastro" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Blu oltremare" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Blu zaffiro" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Blu nerastro" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Blu segnale" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Blu brillante" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Blu grigiastro" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Blu azzurro" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Blu genziana" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Blu cobalto" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Blu colombo" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Blu traffico" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Blu turchese" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Blu Capri" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Blu oceano" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Blu acqua" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Blu notte" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Blu lontano" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Blu pastello" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Blu genziana perlato" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Blu mezzanotte perlato" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Verde patina" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Verde smeraldo" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Verde foglia" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Verde oliva" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Verde bluastro" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Verde muschio" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Oliva grigiastro" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Verde pino" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Marrone pino" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Verde erba" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Verde reseda" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Verde brunastro" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Verde canna" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Verde nerastro" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Verde turchese" +# AI Translated msgid "May green" -msgstr "" +msgstr "Verde maggio" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Verde ossido di cromo" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Verde traffico" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Verde felce" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Verde opale" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Verde menta" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Verde bronzo" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Verde perlato" +# AI Translated +# Needs human review: RAL name (Saxe blue-like turquoise); check the rendering. msgid "Sax turquoise" -msgstr "" +msgstr "Turchese sassone" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Turchese perlato" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Giada perlata" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Verde puro" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Verde luminoso" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Grigio scoiattolo" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Grigio argento" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Grigio oliva" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Grigio muschio" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Grigio segnale" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Grigio topo" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Grigio beige" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Grigio cachi" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Grigio verdastro" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Grigio telone" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Grigio ferro" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Grigio basalto" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Grigio brunastro" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Grigio ardesia" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Grigio antracite" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Grigio chiaro" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Grigio terra d'ombra" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Grigio calcestruzzo" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grigio grafite" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Grigio granito" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Grigio pietra" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Grigio ciottolo" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Grigio cemento" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Grigio giallastro" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Grigio platino" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Grigio polvere" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Grigio agata" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Grigio quarzo" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Grigio finestra" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Grigio traffico A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Grigio traffico B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Grigio seta" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegrigio 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegrigio 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegrigio 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Grigio topo perlato" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Marrone verdastro" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Marrone ocra" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Marrone argilla" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Marrone rame" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Marrone cioccolato" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Marrone oliva" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Marrone noce" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Marrone rossastro" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Marrone seppia" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Marrone castagna" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Marrone mogano" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Marrone grigiastro" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Rame perlato" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Marrone beige" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Marrone moka perlato" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Marrone terra" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Marrone perlato" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Crema" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Bianco grigiastro" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Bianco segnale" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Nero segnale" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Nero corvino" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Alluminio bianco" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Alluminio grigio" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Bianco puro" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Nero grafite" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Bianco traffico" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Nero traffico" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Bianco papiro" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Grigio chiaro perlato" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metallo: Argento" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metallo: Ottone" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metallo: Oro" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metallo: Rame" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metallo: Bronzo" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Natura: Perla" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Natura: Arcobaleno" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Natura: Cielo sereno" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Natura: Tramonto" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Legno: Scuro" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Legno: Medio" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Legno: Chiaro" # AI Translated msgid "Alternate nozzles:" @@ -32396,13 +32837,25 @@ msgstr "Rimuovi da Le mie trame" msgid "Built-in" msgstr "Predefinite" +# AI Translated +msgid "My textures" +msgstr "Le mie trame" + # AI Translated msgid "No textures found." msgstr "Nessuna trama trovata." # AI Translated -msgid "My textures" -msgstr "Le mie trame" +msgid "Texture libraries" +msgstr "Librerie di trame" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Esplora altre librerie di trame" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Apre OrcaCloud nella pagina iniziale per esplorare i plugin." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -32805,11 +33258,15 @@ msgstr "Mappata in base al layout UV del modello stesso, che è già il posizion msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Larghezza di una copia della trama sul modello. Valori più piccoli ripetono il motivo più spesso e ne rendono i dettagli più fini; con Tassellatura disattivata, è la dimensione della singola copia." +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Larger" -msgstr "" +msgstr "Più grande" +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Smaller" -msgstr "" +msgstr "Più piccolo" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -32885,11 +33342,15 @@ msgstr "Colori misti" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Numero massimo di filamenti misti che l'integrazione può aggiungere. Vengono scelti tra i colori della trama, e vengono creati solo quelli effettivamente usati dall'integrazione." +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Few" -msgstr "" +msgstr "Pochi" +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Many" -msgstr "" +msgstr "Molti" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33245,11 +33706,15 @@ msgstr "Ricostruzione della mesh" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Dimensione dei triangoli con cui viene ricostruito l'intero modello, in millimetri. Il rilievo funziona meglio su una mesh uniforme; questo valore permette di ottenerla da un modello importato irregolare." +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "Before" -msgstr "" +msgstr "Prima" +# AI Translated +# Needs human review: Short label, role only visible in the app; check it reads right on its control. msgid "After" -msgstr "" +msgstr "Dopo" # AI Translated msgid "Keep sharp edges" @@ -35100,6 +35565,10 @@ msgstr "Script" msgid "Slicing Pipeline" msgstr "Pipeline di slicing" +# AI Translated +msgid "Resource Texture" +msgstr "Trama di risorsa" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "L'interfaccia di configurazione del plugin era vuota. Viene mostrato l'editor predefinito." @@ -35247,6 +35716,30 @@ msgstr "La cartella del plugin contiene sia file di ingresso .py che .whl" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "La cartella del plugin non contiene un file di ingresso .py o .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "La cartella della trama di risorsa non è impostata" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Impossibile risolvere la cartella della trama di risorsa" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Il percorso della trama di risorsa non è una cartella" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Impossibile risolvere la cartella del plugin" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "La cartella della trama di risorsa si trova fuori dalla cartella del plugin" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Impossibile leggere la cartella della trama di risorsa" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36196,6 +36689,27 @@ msgstr "" "Evita le deformazioni\n" "Sapevi che quando si stampano materiali soggetti a deformazioni come l'ABS, aumentare in modo appropriato la temperatura del piano riscaldato può ridurre la probabilità di deformazione?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Giallo dalmata" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Violetto capsantina" + +# AI Translated +# Needs human review: RAL grey name, single coined word; translated literally. +#~ msgid "Olivestone" +#~ msgstr "Pietra oliva" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Disponibile ovunque nella finestra, anche durante la digitazione in un campo di testo." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Le scorciatoie globali valgono anche durante la digitazione." + #~ msgid "Please choose the filament color" #~ msgstr "Scegliere il colore del filamento" diff --git a/localization/i18n/ja/OrcaSlicer_ja.po b/localization/i18n/ja/OrcaSlicer_ja.po index ae1b9d8ee5..2601a61eba 100644 --- a/localization/i18n/ja/OrcaSlicer_ja.po +++ b/localization/i18n/ja/OrcaSlicer_ja.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -780,18 +780,21 @@ msgstr "選択" msgid "Plate" msgstr "プレート" +# AI Translated msgid "Distribute" -msgstr "" +msgstr "均等配置" # AI Translated msgid "Coordinate system used for transform actions." msgstr "変換操作に使用する座標系です。" +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "整列の基準" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "パーツまたはオブジェクトを3つ以上選択してください" # AI Translated msgid "Align left" @@ -844,8 +847,9 @@ msgstr "上下に均等配置" msgid "Drop" msgstr "ドロップ" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "最下点がベッドに接するように、選択をZ方向に移動します。" # AI Translated msgid "Absolute" @@ -2074,17 +2078,21 @@ msgstr "組み立てギズモを開始" msgid "Leaving Assembly gizmo" msgstr "組み立てギズモを終了" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "切断されたオブジェクトのパーツは移動できません" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "プレートへの整列はXとYのみ可能です" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Z方向に移動するには、選択したオブジェクトの自動ドロップをオフにしてください" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "選択したオブジェクトはすべて同じプレート上にある必要があります" msgid "Shift+" msgstr "Shift+" @@ -6520,8 +6528,10 @@ msgstr "軸" msgid "Gridlines" msgstr "グリッドライン" +# AI Translated +# Needs human review: Mode name that hides the surrounding UI to focus on the 3D canvas; glossary has no entry, check the wording. msgid "Focus mode" -msgstr "" +msgstr "フォーカスモード" msgid "Labels" msgstr "ラベル" @@ -6582,7 +6592,7 @@ msgstr "ボリューム" msgid "Size:" msgstr "サイズ:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "レイヤー%d、Z = %.2lfmmでG-codeパスの衝突が検出されました。衝突するオブジェクトをもっと離してください(%s <-> %s)。" @@ -10930,11 +10940,14 @@ msgstr "非対応のプリセットを表示" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "プリンターとフィラメントのドロップダウンリストに、互換性のない/非対応のプリセットを表示します。これらのプリセットは選択できません。" +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "G-codeと一緒に統計をエクスポート" +# AI Translated +# Needs human review: "feature" here is the G-code feature (line) type, not the Design-tab Feature; rendered as line type, check. msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "有効にすると、G-codeファイルのエクスポート時にその統計もJSON形式で .statistics.json として隣に書き出され、エクスポートしたスライス済み3MFファイルにも統計が含まれます。内容は、印刷時間、フィラメントと線種ごとの合計、および積層ごと・オブジェクトごとの同じ項目です。" # AI Translated msgid "Experimental Features" @@ -11796,6 +11809,10 @@ msgstr "プリンターのストレージへのファイルのアップロード msgid "Send Failed" msgstr "送信失敗" +# AI Translated +msgid "No available printers" +msgstr "利用可能なプリンターがありません" + msgid "The name length exceeds the limit." msgstr "名前の長さが制限を超えています。" @@ -13651,8 +13668,8 @@ msgid "Left mouse" msgstr "マウス左ボタン" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "テキストフィールドへの入力中も含め、ウィンドウ内のどこでも使用できます。" +msgid "Available anywhere in the window." +msgstr "ウィンドウ内のどこでも使用できます。" # AI Translated msgid "Run favorite 1 to 10" @@ -13764,10 +13781,6 @@ msgstr "%sは%sに割り当てられています。%sに再割り当てします msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "デフォルトの%sは%sに割り当てられています。%sに再割り当てしますか?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "グローバルショートカットは文字入力中も有効です。" - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "文字を入力するキーはグローバルショートカットにできません。" @@ -14221,9 +14234,10 @@ msgstr "「%2%」のモディファイア「%1%」(合計%3%個) は継ぎ目に msgid "Seam placement may differ from expected." msgstr "継ぎ目の位置が想定と異なる可能性があります。" +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "G-codeの統計を %1% に書き込めませんでした。" msgid "Internal Bridge" msgstr "内部ブリッジ" @@ -17798,6 +17812,14 @@ msgstr "オブジェクトを除外" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "G-codeにEXCLUDE OBJECTコマンドを追加するには、このオプションを有効にします。" +# AI Translated +msgid "Outline tolerance" +msgstr "アウトライン許容差" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "EXCLUDE_OBJECT_DEFINE に書き込まれるオブジェクトのアウトラインと元のアウトラインとの最大偏差です。値を大きくすると点の数が減り、オブジェクトの多いG-codeの解析中に停止するファームウェアで効果があります。0にするとすべての点を保持します。" + # AI Translated msgid "Verbose G-code" msgstr "コメント付きG-code" @@ -21267,11 +21289,14 @@ msgstr "出力先フォルダ" msgid "This is the output directory for exported files." msgstr "エクスポートの出力先フォルダです。" +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "統計をエクスポート" +# AI Translated +# Needs human review: "feature" here is the G-code feature (line) type, not the Design-tab Feature; rendered as line type, check. msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "スライスした各プレートの統計をJSON形式で、出力ディレクトリ内のG-codeの隣に plate_N.statistics.json として書き出し、--export-3mf で出力する3MFにも含めます。内容は、印刷時間、フィラメントと線種ごとの合計、および積層ごと・オブジェクトごとの同じ項目です。" msgid "Debug level" msgstr "デバッグ レベル" @@ -31234,1231 +31259,1644 @@ msgid "The current filament list does not contain %s. A project filament require msgid_plural "The current filament list does not contain %s. Project filaments required by the mixed filament will be created automatically after decomposition." msgstr[0] "現在のフィラメントリストに%sが含まれていません。混合フィラメントに必要なプロジェクトフィラメントは、分解後に自動的に作成されます。" +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "カラーピッカー" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "基本色" +# AI Translated +# Needs human review: Glossary has no Palette entry; rendered as a named color collection. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca パレット" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL クラシック" + +# AI Translated +# Needs human review: Name of the gradient color set tab in the color picker; check it reads right as a tab label. msgid "Gradients" -msgstr "" +msgstr "グラデーション" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "単色" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "グラデーション" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "グラデーション開始" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "グラデーション終了" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "グラデーションの色" +# AI Translated msgid "Add color" -msgstr "" +msgstr "色を追加" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "色を削除" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "彩度" +# AI Translated msgid "Original color" -msgstr "" +msgstr "元の色" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "現在の色を保存" +# AI Translated msgid "Palettes" -msgstr "" +msgstr "パレット" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "色を検索" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "色をフィルター" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "一致する色がありません" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "16進カラー" # AI Translated msgid "Opacity" msgstr "不透明度" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "不透明度 (%)" +# AI Translated msgid "Save color" -msgstr "" +msgstr "色を保存" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "16進カラーコードを最後まで入力してください" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "別の色を選択するまで、現在のマルチカラー選択が保持されます。" +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "最大 %d 色に対応しています。" +# AI Translated msgid "Crimson" -msgstr "" +msgstr "クリムゾン" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "オレンジレッド" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "トマト" +# AI Translated msgid "Orange" -msgstr "" +msgstr "オレンジ" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "ダークオレンジ" +# AI Translated msgid "Gold" -msgstr "" +msgstr "ゴールド" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "バーリーウッド" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "ビスク" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "ミスティローズ" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "ライトイエロー" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "レモンシフォン" +# AI Translated msgid "Beige" -msgstr "" +msgstr "ベージュ" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "ライトゴールデンロッドイエロー" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "ペールゴールデンロッド" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "カーキ" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "ダークカーキ" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "ピーチパフ" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "モカシン" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "パパイヤホイップ" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "ブランチドアーモンド" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "アンティークホワイト" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "ナバホホワイト" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "ウィート" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "ゴールデンロッド" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "チョコレート" +# AI Translated msgid "Peru" -msgstr "" +msgstr "ペルー" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "ファイアブリック" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "シエナ" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "サドルブラウン" +# AI Translated msgid "Brown" -msgstr "" +msgstr "ブラウン" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "ロージーブラウン" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "サーモン" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "ライトサーモン" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "ダークサーモン" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "サンディブラウン" +# AI Translated msgid "Coral" -msgstr "" +msgstr "コーラル" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "ライトコーラル" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "インディアンレッド" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "ダークレッド" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "マルーン" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "グリーンイエロー" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "イエローグリーン" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "シャルトルーズ" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "ローングリーン" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "ライムグリーン" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "スプリンググリーン" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "ミディアムスプリンググリーン" +# AI Translated msgid "Lime" -msgstr "" +msgstr "ライム" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "フォレストグリーン" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "ダークグリーン" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "オリーブドラブ" +# AI Translated msgid "Olive" -msgstr "" +msgstr "オリーブ" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "ダークオリーブグリーン" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "ペールグリーン" +# AI Translated msgid "Light green" -msgstr "" +msgstr "ライトグリーン" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "ミディアムシーグリーン" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "シーグリーン" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "ダークシーグリーン" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "カデットブルー" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "ミディアムアクアマリン" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "ターコイズ" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "ミディアムターコイズ" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "ダークターコイズ" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "ペールターコイズ" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "アクア" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "ライトシアン" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "ミントクリーム" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "ハニーデュー" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "アクアマリン" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "ライトシーグリーン" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "ダークシアン" +# AI Translated msgid "Teal" -msgstr "" +msgstr "ティール" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "ダークスレートグレー" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "ライトスレートグレー" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "スレートグレー" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "ディープスカイブルー" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "ドジャーブルー" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "スカイブルー" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "ライトスカイブルー" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "ライトブルー" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "パウダーブルー" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "ライトスチールブルー" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "スチールブルー" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "コーンフラワーブルー" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "ロイヤルブルー" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "ミディアムブルー" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "ミッドナイトブルー" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "ダークブルー" +# AI Translated msgid "Navy" -msgstr "" +msgstr "ネイビー" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "スレートブルー" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "ダークスレートブルー" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "ミディアムスレートブルー" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "ブルーバイオレット" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "インディゴ" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "ダークバイオレット" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "ダークオーキッド" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "ミディアムオーキッド" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "オーキッド" +# AI Translated msgid "Violet" -msgstr "" +msgstr "バイオレット" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "ミディアムパープル" +# AI Translated msgid "Purple" -msgstr "" +msgstr "パープル" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "レベッカパープル" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "ミディアムバイオレットレッド" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "ペールバイオレットレッド" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "ディープピンク" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "ホットピンク" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "ライトピンク" +# AI Translated msgid "Pink" -msgstr "" +msgstr "ピンク" +# AI Translated msgid "Plum" -msgstr "" +msgstr "プラム" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "シスル" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "フクシア" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "ダークマゼンタ" +# AI Translated msgid "Linen" -msgstr "" +msgstr "リネン" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "オールドレース" +# AI Translated msgid "Sea shell" -msgstr "" +msgstr "シーシェル" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "アイボリー" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "フローラルホワイト" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "ラベンダーブラッシュ" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "ゴーストホワイト" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "アリスブルー" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "ラベンダー" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "ホワイトスモーク" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "ゲインズボロ" +# AI Translated msgid "Black" -msgstr "" +msgstr "ブラック" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "コーラルファイア" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "シーアネモネ" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "ディープアビス" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "ロブスターレッド" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "サンディクレイ" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "ドリフトウッド" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "シーバックソーン" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "サンセットリーフ" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "タイガーコーラル" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "ピンクコーラル" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "シーシェルグロウ" +# AI Translated msgid "Sand" -msgstr "" +msgstr "サンド" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "ゴールデンケルプ" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "サンリットデューン" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "アンバーノーチラス" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "シーレモン" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "ペールスターフィッシュ" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "スプリングタイド" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "ライムアルジー" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "シーグラス" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "ネオンプランクトン" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "ケルプフォレスト" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "エメラルドウェーブ" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "ホエールシャドウ" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "シータートル" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "ラグーン" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "トロピカルカレント" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "ミッドナイトトレンチ" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "ダークケルプ" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "クリスタルサーフ" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "ターコイズベイ" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "スカイオーバーリーフ" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "シャロースカイ" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "エレクトリックブルー" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "ドルフィン" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "オーシャンデプス" +# AI Translated msgid "Whale" -msgstr "" +msgstr "ホエール" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "インディゴアビス" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "シーアーチン" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "ラベンダーコーラル" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "バイオレットタイド" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "ディープシーオーキッド" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "ネオンジェリー" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "フクシアコーラル" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "ピンクジェリーフィッシュ" +# AI Translated msgid "Foam" -msgstr "" +msgstr "フォーム" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "シーシェルホワイト" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "ペブルグレー" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "ストームクラウド" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "インクブラック" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "グリーンベージュ" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "サンドイエロー" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "シグナルイエロー" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "ゴールデンイエロー" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "ハニーイエロー" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "メイズイエロー" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "ダフォディルイエロー" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "ブラウンベージュ" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "レモンイエロー" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "オイスターホワイト" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "ライトアイボリー" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "ジンクイエロー" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "グレーベージュ" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "オリーブイエロー" +# AI Translated +# Needs human review: RAL name (rapeseed); check the plant name reads naturally as a color. msgid "Rape yellow" -msgstr "" +msgstr "ナタネイエロー" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "トラフィックイエロー" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "オーカーイエロー" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "トラフィックオレンジイエロー" +# AI Translated msgid "Curry" -msgstr "" +msgstr "カレー" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "メロンイエロー" +# AI Translated +# Needs human review: RAL name (broom, the plant); check the rendering. msgid "Broom yellow" -msgstr "" +msgstr "エニシダイエロー" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "ダリアイエロー" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "パステルイエロー" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "パールベージュ" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "パールゴールド" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "サンイエロー" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "イエローオレンジ" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "ディープオレンジ" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "バーミリオン" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "パールオレンジ" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "ピュアオレンジ" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "ルミナスオレンジ" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "ルミナスブライトオレンジ" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "ブライトレッドオレンジ" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "トラフィックオレンジ" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "シグナルオレンジ" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "サーモンオレンジ" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "パールピンク" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "カッパーオレンジ" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "シグナルブラウン" +# AI Translated +# Needs human review: Source name is odd (RAL has Fir green); fir rendered as the tree. msgid "Fir orange" -msgstr "" +msgstr "モミオレンジ" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "シグナルレッド" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "ルミナスレッド" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "カーマインレッド" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "パールカーマインレッド" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "ピュアレッド" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "ルミナスディープレッド" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "カラントレッド" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "パールルビーレッド" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "ファイアレッド" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "ルビーレッド" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "パープルレッド" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "ワインレッド" +# AI Translated msgid "Black red" -msgstr "" +msgstr "ブラックレッド" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "オキサイドレッド" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "ブラウンレッド" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "パインレッド" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "トマトレッド" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "アンティークピンク" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "コーラルレッド" +# AI Translated msgid "Rose" -msgstr "" +msgstr "ローズ" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "ストロベリーレッド" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "トラフィックレッド" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "サーモンピンク" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "ルミナスローズ" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "ルミナスブライトレッド" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "ラズベリーレッド" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "オリエントレッド" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "パールルビー" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "レッドパープル" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "レッドバイオレット" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "ヘザーバイオレット" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "ボルドーバイオレット" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "マホガニー" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "グレーパープル" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "シグナルバイオレット" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "モミグリーン" +# AI Translated +# Needs human review: Source name unclear (Sabine); transliterated. msgid "Sabine grey" -msgstr "" +msgstr "サビーヌグレー" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "パールバイオレット" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "パールブラックベリー" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "グリーンブルー" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "ウルトラマリンブルー" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "サファイアブルー" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "ブラックブルー" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "シグナルブルー" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "ブリリアントブルー" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "グレーブルー" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "アズールブルー" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "ゲンチアナブルー" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "コバルトブルー" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "ピジョンブルー" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "トラフィックブルー" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "ターコイズブルー" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "カプリブルー" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "オーシャンブルー" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "ウォーターブルー" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "ナイトブルー" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "ディスタントブルー" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "パステルブルー" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "パールゲンチアナブルー" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "パールミッドナイトブルー" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "パティナグリーン" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "エメラルドグリーン" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "リーフグリーン" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "オリーブグリーン" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "ブルーグリーン" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "モスグリーン" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "グレーオリーブ" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "パイングリーン" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "パインブラウン" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "グラスグリーン" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "レセダグリーン" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "ブラウングリーン" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "リードグリーン" +# AI Translated msgid "Black green" -msgstr "" +msgstr "ブラックグリーン" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "ターコイズグリーン" +# AI Translated msgid "May green" -msgstr "" +msgstr "メイグリーン" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "クロムオキサイドグリーン" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "トラフィックグリーン" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "ファーングリーン" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "オパールグリーン" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "ミントグリーン" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "ブロンズグリーン" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "パールグリーン" +# AI Translated msgid "Sax turquoise" -msgstr "" +msgstr "サックスターコイズ" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "パールターコイズ" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "パールジェイド" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "ピュアグリーン" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "ルミナスグリーン" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "スクワレルグレー" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "シルバーグレー" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "オリーブグレー" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "モスグレー" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "シグナルグレー" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "マウスグレー" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "ベージュグレー" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "カーキグレー" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "グリーングレー" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "ターポリングレー" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "アイアングレー" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "バサルトグレー" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "ブラウングレー" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "スレートグレー" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "アンスラサイトグレー" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "ライトグレー" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "アンバーグレー" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "コンクリートグレー" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "グラファイトグレー" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "グラナイトグレー" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "ストーングレー" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "ペブルグレー" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "セメントグレー" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "イエローグレー" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "プラチナグレー" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "ダスティグレー" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "アゲートグレー" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "クォーツグレー" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "ウィンドウグレー" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "トラフィックグレーA" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "トラフィックグレーB" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "シルクグレー" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "テレグレー1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "テレグレー2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "テレグレー4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "パールマウスグレー" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "グリーンブラウン" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "オーカーブラウン" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "クレイブラウン" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "カッパーブラウン" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "チョコレートブラウン" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "オリーブブラウン" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "ナッツブラウン" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "レッドブラウン" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "セピアブラウン" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "チェスナットブラウン" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "マホガニーブラウン" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "グレーブラウン" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "パールカッパー" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "ベージュブラウン" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "パールモカブラウン" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "アースブラウン" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "パールブラウン" +# AI Translated msgid "Cream" -msgstr "" +msgstr "クリーム" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "グレーホワイト" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "シグナルホワイト" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "シグナルブラック" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "ジェットブラック" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "ホワイトアルミニウム" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "グレーアルミニウム" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "ピュアホワイト" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "グラファイトブラック" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "トラフィックホワイト" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "トラフィックブラック" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "パピルスホワイト" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "パールライトグレー" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "メタル: シルバー" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "メタル: ブラス" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "メタル: ゴールド" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "メタル: カッパー" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "メタル: ブロンズ" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "ネイチャー: パール" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "ネイチャー: レインボー" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "ネイチャー: クリアスカイ" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "ネイチャー: サンセット" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "ウッド: ダーク" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "ウッド: ミディアム" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "ウッド: ライト" # AI Translated msgid "Alternate nozzles:" @@ -32933,13 +33371,25 @@ msgstr "マイテクスチャから削除" msgid "Built-in" msgstr "内蔵" +# AI Translated +msgid "My textures" +msgstr "マイテクスチャ" + # AI Translated msgid "No textures found." msgstr "テクスチャが見つかりません。" # AI Translated -msgid "My textures" -msgstr "マイテクスチャ" +msgid "Texture libraries" +msgstr "テクスチャライブラリ" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "さらにテクスチャライブラリを探す" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "ホームページで OrcaCloud を開き、プラグインを探します。" # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33342,11 +33792,15 @@ msgstr "モデル自身のUVレイアウトでマッピングされます。こ msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "モデル上でのテクスチャ1枚分の幅です。小さくするとパターンの繰り返しが増え、ディテールが細かくなります。「タイル」がオフの場合は、1枚だけ配置されるテクスチャのサイズになります。" +# AI Translated +# Needs human review: Image caption in the tile-size tip (larger tiles); check wording. msgid "Larger" -msgstr "" +msgstr "大きい" +# AI Translated +# Needs human review: Image caption in the tile-size tip (smaller tiles); check wording. msgid "Smaller" -msgstr "" +msgstr "小さい" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33422,11 +33876,15 @@ msgstr "混合色" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "焼付けで追加できる混合フィラメントの最大数です。テクスチャの色から選ばれ、焼付けで実際に使用されるものだけが作成されます。" +# AI Translated +# Needs human review: Image caption comparing few vs many mixed colors; check wording. msgid "Few" -msgstr "" +msgstr "少ない" +# AI Translated +# Needs human review: Image caption comparing few vs many mixed colors; check wording. msgid "Many" -msgstr "" +msgstr "多い" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33777,11 +34235,15 @@ msgstr "リメッシュ" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "モデル全体を再構築する際の三角形のサイズ (mm) です。変位は均一なメッシュで最もよく機能します。不均一なインポートモデルから均一なメッシュを作るための設定です。" +# AI Translated +# Needs human review: Image caption of the remesh comparison (before/after remeshing); check wording. msgid "Before" -msgstr "" +msgstr "適用前" +# AI Translated +# Needs human review: Image caption of the remesh comparison (before/after remeshing); check wording. msgid "After" -msgstr "" +msgstr "適用後" # AI Translated msgid "Keep sharp edges" @@ -35629,6 +36091,10 @@ msgstr "スクリプト" msgid "Slicing Pipeline" msgstr "スライスパイプライン" +# AI Translated +msgid "Resource Texture" +msgstr "リソーステクスチャ" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "プラグインの設定UIが空でした。デフォルトのエディターを表示します。" @@ -35776,6 +36242,30 @@ msgstr "プラグインのディレクトリに.pyと.whlの両方のエント msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "プラグインのディレクトリに.pyまたは.whlのエントリファイルがありません" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "リソーステクスチャのディレクトリが設定されていません" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "リソーステクスチャのディレクトリを特定できませんでした" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "リソーステクスチャのパスがディレクトリではありません" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "プラグインフォルダーを特定できませんでした" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "リソーステクスチャのディレクトリがプラグインフォルダーの外にあります" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "リソーステクスチャのディレクトリを読み取れませんでした" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36734,6 +37224,26 @@ msgstr "" "反りを避ける\n" "ABSのような反りやすい素材を印刷する場合、ヒートベッドの温度を適切に上げることで、反りが発生する確率を下げることができることをご存知ですか?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "ダルメシアンイエロー" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "カプサンチンバイオレット" + +# AI Translated +#~ msgid "Olivestone" +#~ msgstr "オリーブストーン" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "テキストフィールドへの入力中も含め、ウィンドウ内のどこでも使用できます。" + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "グローバルショートカットは文字入力中も有効です。" + #~ msgid "Please choose the filament color" #~ msgstr "フィラメントの色を選択してください" diff --git a/localization/i18n/ko/OrcaSlicer_ko.po b/localization/i18n/ko/OrcaSlicer_ko.po index 96b91c533c..fe7341daad 100644 --- a/localization/i18n/ko/OrcaSlicer_ko.po +++ b/localization/i18n/ko/OrcaSlicer_ko.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2025-06-02 17:12+0900\n" "Last-Translator: crwusiz \n" "Language-Team: \n" @@ -786,18 +786,21 @@ msgstr "선택" msgid "Plate" msgstr "플레이트" +# AI Translated msgid "Distribute" -msgstr "" +msgstr "분배" # AI Translated msgid "Coordinate system used for transform actions." msgstr "변형 작업에 사용되는 좌표계입니다." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "정렬 기준" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "부품 또는 객체를 3개 이상 선택하세요" # AI Translated msgid "Align left" @@ -850,8 +853,9 @@ msgstr "상하 균등 분배" msgid "Drop" msgstr "내리기" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "선택 항목의 가장 낮은 지점이 베드에 닿도록 Z축 방향으로 이동합니다." # AI Translated msgid "Absolute" @@ -2088,17 +2092,21 @@ msgstr "조립 변형도구 진입" msgid "Leaving Assembly gizmo" msgstr "조립 변형도구 나가기" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "절단된 객체의 부품은 이동할 수 없습니다" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "플레이트에 정렬은 X와 Y에서만 사용할 수 있습니다" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Z축으로 이동하려면 선택한 객체의 자동 내려놓기를 끄세요" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "선택한 객체는 모두 같은 플레이트에 있어야 합니다" msgid "Shift+" msgstr "Shift+" @@ -6559,8 +6567,10 @@ msgstr "축" msgid "Gridlines" msgstr "그리드 라인" +# AI Translated +# Needs human review: Mode name that hides the surrounding UI to focus on the 3D canvas; glossary has no entry, check the wording. msgid "Focus mode" -msgstr "" +msgstr "집중 모드" msgid "Labels" msgstr "레이블" @@ -6622,7 +6632,7 @@ msgid "Size:" msgstr "크기:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "레이어 %d, Z = %.2lf mm에서 G-code 경로 충돌이 발견되었습니다. 충돌하는 객체를 더 멀리 분리하세요 (%s <-> %s)." @@ -11072,11 +11082,14 @@ msgstr "지원되지 않는 사전 설정 표시" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "프린터 및 필라멘트 드롭다운 목록에 호환되지 않거나 지원되지 않는 사전 설정을 표시합니다. 이러한 사전 설정은 선택할 수 없습니다." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "G-code와 함께 통계 내보내기" +# AI Translated +# Needs human review: "feature" here is the G-code feature (line) type, not the Design-tab Feature; rendered as line type, check. msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "활성화하면 G-code 파일을 내보낼 때 해당 통계도 JSON 형식의 .statistics.json으로 옆에 함께 기록되고, 내보낸 슬라이스된 3MF 파일에는 통계가 내부에 포함됩니다. 내용은 출력 시간, 필라멘트 및 선 유형별 합계와 레이어별, 객체별 동일 항목입니다." # AI Translated msgid "Experimental Features" @@ -11946,6 +11959,10 @@ msgstr "프린터 저장소에 파일을 업로드하지 못했습니다. 다시 msgid "Send Failed" msgstr "전송 실패" +# AI Translated +msgid "No available printers" +msgstr "사용 가능한 프린터가 없습니다" + msgid "The name length exceeds the limit." msgstr "이름 길이가 제한을 초과합니다." @@ -13842,8 +13859,8 @@ msgid "Left mouse" msgstr "마우스 왼쪽 버튼" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "텍스트 필드에 입력하는 중에도 창 어디에서나 사용할 수 있습니다." +msgid "Available anywhere in the window." +msgstr "창 어디에서나 사용할 수 있습니다." # AI Translated msgid "Run favorite 1 to 10" @@ -13956,10 +13973,6 @@ msgstr "%s은(는) %s에 할당되어 있습니다. %s에 다시 할당하시겠 msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "기본 %s은(는) %s에 할당되어 있습니다. %s에 다시 할당하시겠습니까?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "전역 단축키는 텍스트를 입력하는 중에도 적용됩니다." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "문자를 입력하는 키는 전역 단축키가 될 수 없습니다." @@ -14416,9 +14429,10 @@ msgstr "\"%2%\"의 수정자 \"%1%\"(총 %3%개)이(가) 재봉선에 영향을 msgid "Seam placement may differ from expected." msgstr "재봉선 위치가 예상과 다를 수 있습니다." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "G-code 통계를 %1%에 쓰지 못했습니다." msgid "Internal Bridge" msgstr "내부 브릿지" @@ -17928,6 +17942,14 @@ msgstr "객체 제외" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "G-code에 객체 제외 명령을 추가하려면 이 옵션을 활성화하세요." +# AI Translated +msgid "Outline tolerance" +msgstr "외곽선 공차" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "EXCLUDE_OBJECT_DEFINE에 기록되는 객체 외곽선과 원래 외곽선 사이의 최대 편차입니다. 값이 클수록 점의 수가 줄어들어, 객체가 많은 G-code를 파싱하는 동안 멈추는 펌웨어에 도움이 됩니다. 0이면 모든 점을 유지합니다." + # AI Translated msgid "Verbose G-code" msgstr "상세한 G-code" @@ -21256,11 +21278,14 @@ msgstr "출력 디렉토리" msgid "This is the output directory for exported files." msgstr "내보내기 파일의 출력 디렉토리입니다." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "통계 내보내기" +# AI Translated +# Needs human review: "feature" here is the G-code feature (line) type, not the Design-tab Feature; rendered as line type, check. msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "슬라이스한 각 플레이트의 통계를 JSON 형식으로, 출력 디렉터리의 G-code 옆에 plate_N.statistics.json으로 기록하고 --export-3mf로 내보내는 3MF 내부에도 포함합니다. 내용은 출력 시간, 필라멘트 및 선 유형별 합계와 레이어별, 객체별 동일 항목입니다." msgid "Debug level" msgstr "디버그 수준" @@ -31225,1231 +31250,1645 @@ msgid "The current filament list does not contain %s. A project filament require msgid_plural "The current filament list does not contain %s. Project filaments required by the mixed filament will be created automatically after decomposition." msgstr[0] "현재 필라멘트 목록에 %s이(가) 없습니다. 분해 후 혼합 필라멘트에 필요한 프로젝트 필라멘트가 자동으로 생성됩니다." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "색상 선택기" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "기본 색상" +# AI Translated +# Needs human review: Glossary has no Palette entry; rendered as a named color collection. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca 팔레트" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL 클래식" + +# AI Translated +# Needs human review: Name of the gradient color set tab in the color picker; check it reads right as a tab label. msgid "Gradients" -msgstr "" +msgstr "그라데이션" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "단색" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "그라데이션" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "그라데이션 시작" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "그라데이션 끝" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "그라데이션 색상" +# AI Translated msgid "Add color" -msgstr "" +msgstr "색상 추가" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "색상 제거" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "채도" +# AI Translated msgid "Original color" -msgstr "" +msgstr "원래 색상" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "현재 색상 저장" +# AI Translated msgid "Palettes" -msgstr "" +msgstr "팔레트" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "색상 검색" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "색상 필터" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "일치하는 색상이 없습니다" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "16진수 색상" # AI Translated msgid "Opacity" msgstr "불투명도" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "불투명도(%)" +# AI Translated msgid "Save color" -msgstr "" +msgstr "색상 저장" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "전체 16진수 색상 값을 입력하세요" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "다른 색상을 선택할 때까지 현재 다중 색상 선택이 유지됩니다." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "최대 %d개 색상을 지원합니다." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "크림슨" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "오렌지 레드" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "토마토" +# AI Translated msgid "Orange" -msgstr "" +msgstr "오렌지" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "다크 오렌지" +# AI Translated msgid "Gold" -msgstr "" +msgstr "골드" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "벌리우드" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "비스크" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "미스티 로즈" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "라이트 옐로" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "레몬 시폰" +# AI Translated msgid "Beige" -msgstr "" +msgstr "베이지" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "라이트 골든로드 옐로" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "페일 골든로드" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "카키" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "다크 카키" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "피치 퍼프" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "모카신" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "파파야 휩" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "블랜치드 아몬드" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "앤티크 화이트" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "나바호 화이트" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "휘트" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "골든로드" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "초콜릿" +# AI Translated msgid "Peru" -msgstr "" +msgstr "페루" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "파이어브릭" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "시에나" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "새들 브라운" +# AI Translated msgid "Brown" -msgstr "" +msgstr "브라운" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "로지 브라운" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "살몬" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "라이트 살몬" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "다크 살몬" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "샌디 브라운" +# AI Translated msgid "Coral" -msgstr "" +msgstr "코랄" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "라이트 코랄" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "인디언 레드" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "다크 레드" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "마룬" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "그린 옐로" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "옐로 그린" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "샤르트뢰즈" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "론 그린" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "라임 그린" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "스프링 그린" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "미디엄 스프링 그린" +# AI Translated msgid "Lime" -msgstr "" +msgstr "라임" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "포레스트 그린" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "다크 그린" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "올리브 드랩" +# AI Translated msgid "Olive" -msgstr "" +msgstr "올리브" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "다크 올리브 그린" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "페일 그린" +# AI Translated msgid "Light green" -msgstr "" +msgstr "라이트 그린" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "미디엄 시 그린" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "시 그린" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "다크 시 그린" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "카뎃 블루" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "미디엄 아쿠아마린" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "터콰이즈" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "미디엄 터콰이즈" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "다크 터콰이즈" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "페일 터콰이즈" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "아쿠아" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "라이트 시안" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "민트 크림" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "허니듀" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "아쿠아마린" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "라이트 시 그린" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "다크 시안" +# AI Translated msgid "Teal" -msgstr "" +msgstr "틸" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "다크 슬레이트 그레이" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "라이트 슬레이트 그레이" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "슬레이트 그레이" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "딥 스카이 블루" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "다저 블루" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "스카이 블루" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "라이트 스카이 블루" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "라이트 블루" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "파우더 블루" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "라이트 스틸 블루" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "스틸 블루" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "콘플라워 블루" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "로열 블루" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "미디엄 블루" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "미드나이트 블루" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "다크 블루" +# AI Translated msgid "Navy" -msgstr "" +msgstr "네이비" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "슬레이트 블루" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "다크 슬레이트 블루" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "미디엄 슬레이트 블루" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "블루 바이올렛" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "인디고" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "다크 바이올렛" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "다크 오키드" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "미디엄 오키드" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "오키드" +# AI Translated msgid "Violet" -msgstr "" +msgstr "바이올렛" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "미디엄 퍼플" +# AI Translated msgid "Purple" -msgstr "" +msgstr "퍼플" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "레베카 퍼플" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "미디엄 바이올렛 레드" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "페일 바이올렛 레드" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "딥 핑크" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "핫 핑크" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "라이트 핑크" +# AI Translated msgid "Pink" -msgstr "" +msgstr "핑크" +# AI Translated msgid "Plum" -msgstr "" +msgstr "플럼" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "시슬" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "푸크시아" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "다크 마젠타" +# AI Translated msgid "Linen" -msgstr "" +msgstr "리넨" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "올드 레이스" +# AI Translated msgid "Sea shell" -msgstr "" +msgstr "시 쉘" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "아이보리" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "플로럴 화이트" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "라벤더 블러시" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "고스트 화이트" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "앨리스 블루" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "라벤더" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "화이트 스모크" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "게인즈버러" +# AI Translated msgid "Black" -msgstr "" +msgstr "블랙" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "코랄 파이어" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "시 아네모네" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "딥 어비스" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "랍스터 레드" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "샌디 클레이" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "드리프트우드" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "시 벅손" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "선셋 리프" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "타이거 코랄" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "핑크 코랄" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "시쉘 글로" +# AI Translated msgid "Sand" -msgstr "" +msgstr "샌드" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "골든 켈프" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "선릿 듄" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "앰버 노틸러스" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "시 레몬" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "페일 스타피시" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "스프링 타이드" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "라임 앨지" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "시 그래스" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "네온 플랑크톤" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "켈프 포레스트" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "에메랄드 웨이브" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "웨일 섀도" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "시 터틀" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "라군" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "트로피컬 커런트" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "미드나이트 트렌치" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "다크 켈프" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "크리스털 서프" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "터콰이즈 베이" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "스카이 오버 리프" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "섈로 스카이" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "일렉트릭 블루" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "돌핀" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "오션 뎁스" +# AI Translated msgid "Whale" -msgstr "" +msgstr "웨일" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "인디고 어비스" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "시 어친" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "라벤더 코랄" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "바이올렛 타이드" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "딥 시 오키드" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "네온 젤리" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "푸크시아 코랄" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "핑크 젤리피시" +# AI Translated msgid "Foam" -msgstr "" +msgstr "폼" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "시쉘 화이트" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "페블 그레이" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "스톰 클라우드" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "잉크 블랙" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "그린 베이지" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "샌드 옐로" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "시그널 옐로" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "골든 옐로" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "허니 옐로" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "메이즈 옐로" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +# Needs human review: Check the Korean name for daffodil: 수선화 (narcissus) is used; a transliteration such as 대포딜 is the alternative. +msgid "Daffodil yellow" +msgstr "수선화 옐로" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "브라운 베이지" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "레몬 옐로" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "오이스터 화이트" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "라이트 아이보리" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "징크 옐로" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "그레이 베이지" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "올리브 옐로" +# AI Translated +# Needs human review: RAL name (rapeseed); check the plant name reads naturally as a color. msgid "Rape yellow" -msgstr "" +msgstr "유채꽃 옐로" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "트래픽 옐로" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "오커 옐로" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "트래픽 오렌지 옐로" +# AI Translated msgid "Curry" -msgstr "" +msgstr "커리" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "멜론 옐로" +# AI Translated +# Needs human review: RAL name (broom, the plant); check the rendering. msgid "Broom yellow" -msgstr "" +msgstr "브룸 옐로" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "달리아 옐로" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "파스텔 옐로" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "펄 베이지" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "펄 골드" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "선 옐로" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "옐로 오렌지" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "딥 오렌지" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "버밀리언" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "펄 오렌지" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "퓨어 오렌지" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "루미너스 오렌지" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "루미너스 브라이트 오렌지" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "브라이트 레드 오렌지" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "트래픽 오렌지" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "시그널 오렌지" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "살몬 오렌지" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "펄 핑크" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "코퍼 오렌지" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "시그널 브라운" +# AI Translated +# Needs human review: Source name is odd (RAL has Fir green); fir rendered as the tree. msgid "Fir orange" -msgstr "" +msgstr "전나무 오렌지" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "시그널 레드" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "루미너스 레드" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "카민 레드" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "펄 카민 레드" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "퓨어 레드" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "루미너스 딥 레드" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "커런트 레드" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "펄 루비 레드" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "파이어 레드" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "루비 레드" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "퍼플 레드" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "와인 레드" +# AI Translated msgid "Black red" -msgstr "" +msgstr "블랙 레드" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "옥사이드 레드" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "브라운 레드" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "파인 레드" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "토마토 레드" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "앤티크 핑크" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "코랄 레드" +# AI Translated msgid "Rose" -msgstr "" +msgstr "로즈" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "스트로베리 레드" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "트래픽 레드" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "살몬 핑크" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "루미너스 로즈" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "루미너스 브라이트 레드" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "라즈베리 레드" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "오리엔트 레드" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "펄 루비" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "레드 퍼플" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "레드 바이올렛" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "헤더 바이올렛" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "보르도 바이올렛" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "마호가니" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "그레이 퍼플" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "시그널 바이올렛" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "전나무 그린" +# AI Translated +# Needs human review: Source name unclear (Sabine); transliterated. msgid "Sabine grey" -msgstr "" +msgstr "사빈 그레이" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "펄 바이올렛" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "펄 블랙베리" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "그린 블루" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "울트라마린 블루" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "사파이어 블루" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "블랙 블루" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "시그널 블루" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "브릴리언트 블루" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "그레이 블루" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "애저 블루" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "젠티안 블루" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "코발트 블루" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "피존 블루" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "트래픽 블루" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "터콰이즈 블루" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "카프리 블루" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "오션 블루" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "워터 블루" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "나이트 블루" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "디스턴트 블루" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "파스텔 블루" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "펄 젠티안 블루" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "펄 미드나이트 블루" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "파티나 그린" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "에메랄드 그린" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "리프 그린" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "올리브 그린" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "블루 그린" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "모스 그린" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "그레이 올리브" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "파인 그린" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "파인 브라운" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "그래스 그린" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "레세다 그린" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "브라운 그린" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "리드 그린" +# AI Translated msgid "Black green" -msgstr "" +msgstr "블랙 그린" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "터콰이즈 그린" +# AI Translated msgid "May green" -msgstr "" +msgstr "메이 그린" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "크롬 옥사이드 그린" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "트래픽 그린" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "펀 그린" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "오팔 그린" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "민트 그린" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "브론즈 그린" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "펄 그린" +# AI Translated msgid "Sax turquoise" -msgstr "" +msgstr "삭스 터콰이즈" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "펄 터콰이즈" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "펄 제이드" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "퓨어 그린" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "루미너스 그린" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "스쿼럴 그레이" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "실버 그레이" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "올리브 그레이" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "모스 그레이" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "시그널 그레이" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "마우스 그레이" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "베이지 그레이" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "카키 그레이" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "그린 그레이" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "타폴린 그레이" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "아이언 그레이" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "바솔트 그레이" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "브라운 그레이" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "슬레이트 그레이" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "앤트러사이트 그레이" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "라이트 그레이" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "엄버 그레이" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "콘크리트 그레이" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "그래파이트 그레이" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "그래나이트 그레이" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "스톤 그레이" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "페블 그레이" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "시멘트 그레이" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "옐로 그레이" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "플래티넘 그레이" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "더스티 그레이" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "아게이트 그레이" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "쿼츠 그레이" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "윈도 그레이" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "트래픽 그레이 A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "트래픽 그레이 B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "실크 그레이" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "텔레그레이 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "텔레그레이 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "텔레그레이 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "펄 마우스 그레이" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "그린 브라운" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "오커 브라운" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "클레이 브라운" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "코퍼 브라운" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "초콜릿 브라운" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "올리브 브라운" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "너트 브라운" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "레드 브라운" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "세피아 브라운" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "체스트넛 브라운" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "마호가니 브라운" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "그레이 브라운" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "펄 코퍼" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "베이지 브라운" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "펄 모카 브라운" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "어스 브라운" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "펄 브라운" +# AI Translated msgid "Cream" -msgstr "" +msgstr "크림" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "그레이 화이트" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "시그널 화이트" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "시그널 블랙" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "제트 블랙" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "화이트 알루미늄" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "그레이 알루미늄" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "퓨어 화이트" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "그래파이트 블랙" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "트래픽 화이트" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "트래픽 블랙" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "파피루스 화이트" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "펄 라이트 그레이" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "메탈: 실버" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "메탈: 브라스" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "메탈: 골드" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "메탈: 코퍼" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "메탈: 브론즈" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "네이처: 펄" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "네이처: 레인보우" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "네이처: 클리어 스카이" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "네이처: 선셋" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "우드: 다크" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "우드: 미디엄" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "우드: 라이트" # AI Translated msgid "Alternate nozzles:" @@ -32924,13 +33363,25 @@ msgstr "내 텍스처에서 제거" msgid "Built-in" msgstr "기본 제공" +# AI Translated +msgid "My textures" +msgstr "내 텍스처" + # AI Translated msgid "No textures found." msgstr "텍스처가 없습니다." # AI Translated -msgid "My textures" -msgstr "내 텍스처" +msgid "Texture libraries" +msgstr "텍스처 라이브러리" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "더 많은 텍스처 라이브러리 둘러보기" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "홈 페이지에서 OrcaCloud를 열어 플러그인을 찾아봅니다." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33333,11 +33784,15 @@ msgstr "모델 자체의 UV 레이아웃으로 매핑됩니다. 이 레이아웃 msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "모델 위에서 텍스처 한 장의 폭입니다. 작을수록 패턴이 더 자주 반복되고 디테일이 더 세밀해집니다. 타일이 꺼져 있으면 단일 텍스처의 크기입니다." +# AI Translated +# Needs human review: Image caption in the tile-size tip (larger tiles); check wording. msgid "Larger" -msgstr "" +msgstr "더 크게" +# AI Translated +# Needs human review: Image caption in the tile-size tip (smaller tiles); check wording. msgid "Smaller" -msgstr "" +msgstr "더 작게" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33413,11 +33868,15 @@ msgstr "혼합 색상" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "굽기에서 추가할 수 있는 혼합 필라멘트의 최대 개수입니다. 텍스처의 색상에서 선택되며, 굽기에서 실제로 사용하는 것만 생성됩니다." +# AI Translated +# Needs human review: Image caption comparing few vs many mixed colors; check wording. msgid "Few" -msgstr "" +msgstr "적음" +# AI Translated +# Needs human review: Image caption comparing few vs many mixed colors; check wording. msgid "Many" -msgstr "" +msgstr "많음" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33768,11 +34227,15 @@ msgstr "리메시" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "모델 전체를 다시 만들 때 사용할 삼각형 크기(밀리미터)입니다. 변위는 고른 메시에서 가장 잘 작동하며, 이 설정으로 고르지 않은 가져온 메시를 고르게 만듭니다." +# AI Translated +# Needs human review: Image caption of the remesh comparison (before/after remeshing); check wording. msgid "Before" -msgstr "" +msgstr "적용 전" +# AI Translated +# Needs human review: Image caption of the remesh comparison (before/after remeshing); check wording. msgid "After" -msgstr "" +msgstr "적용 후" # AI Translated msgid "Keep sharp edges" @@ -35616,6 +36079,10 @@ msgstr "스크립트" msgid "Slicing Pipeline" msgstr "슬라이스 파이프라인" +# AI Translated +msgid "Resource Texture" +msgstr "리소스 텍스처" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "플러그인의 구성 UI가 비어 있습니다. 기본 편집기를 표시합니다." @@ -35763,6 +36230,30 @@ msgstr "플러그인 디렉터리에 .py 및 .whl 진입 파일이 모두 있습 msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "플러그인 디렉터리에 .py 또는 .whl 진입 파일이 없습니다" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "리소스 텍스처 디렉터리가 설정되지 않았습니다" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "리소스 텍스처 디렉터리를 확인할 수 없습니다" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "리소스 텍스처 경로가 디렉터리가 아닙니다" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "플러그인 폴더를 확인할 수 없습니다" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "리소스 텍스처 디렉터리가 플러그인 폴더 밖에 있습니다" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "리소스 텍스처 디렉터리를 읽을 수 없습니다" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36714,6 +37205,26 @@ msgstr "" "뒤틀림 방지\n" "ABS와 같이 뒤틀림이 발생하기 쉬운 소재를 출력할 때, 히트베드 온도를 적절하게 높이면 뒤틀림 가능성을 줄일 수 있다는 사실을 알고 계셨나요?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "달마시안 옐로" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "캡산틴 바이올렛" + +# AI Translated +#~ msgid "Olivestone" +#~ msgstr "올리브스톤" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "텍스트 필드에 입력하는 중에도 창 어디에서나 사용할 수 있습니다." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "전역 단축키는 텍스트를 입력하는 중에도 적용됩니다." + #~ msgid "Please choose the filament color" #~ msgstr "필라멘트 색상을 선택하세요" diff --git a/localization/i18n/lt/OrcaSlicer_lt.po b/localization/i18n/lt/OrcaSlicer_lt.po index 80e57150d7..cd577e7064 100644 --- a/localization/i18n/lt/OrcaSlicer_lt.po +++ b/localization/i18n/lt/OrcaSlicer_lt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2026-07-02 14:13+0300\n" "Last-Translator: Gintaras Kučinskas \n" "Language-Team: \n" @@ -798,17 +798,22 @@ msgstr "Pasirinkimas" msgid "Plate" msgstr "Spausdinimo plokštė" +# AI Translated +# Needs human review: Glossary cell empty for lt; reused the catalog's 'Paskirstyti' (Distribute left-right etc.) msgid "Distribute" -msgstr "" +msgstr "Paskirstyti" msgid "Coordinate system used for transform actions." msgstr "Transformavimo veiksmams naudojama koordinačių sistema." +# AI Translated +# Needs human review: Tooltip in the object manipulation panel; check it reads right next to the align buttons msgid "Reference for alignment" -msgstr "" +msgstr "Sulygiavimo atskaita" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Pasirinkite bent 3 dalis arba objektus" # AI Translated msgid "Align left" @@ -861,8 +866,9 @@ msgstr "Paskirstyti viršaus-apačios kryptimi" msgid "Drop" msgstr "Nuleisti" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Perkelti pasirinkimą išilgai Z ašies taip, kad žemiausias jo taškas liestų pagrindą." msgid "Absolute" msgstr "Absoliutus" @@ -2092,17 +2098,21 @@ msgstr "Įjungiamas surinkimo manipuliatorius" msgid "Leaving Assembly gizmo" msgstr "Išjungiamas surinkimo manipuliatorius" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Perpjauto objekto dalių perkelti negalima" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Sulygiuoti pagal plokštę galima tik X ir Y kryptimis" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Išjunkite pasirinktų objektų automatinį nuleidimą, kad galėtumėte juos perkelti Z kryptimi" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Visi pasirinkti objektai turi būti ant tos pačios plokštės" msgid "Shift+" msgstr "Shift+" @@ -6536,8 +6546,10 @@ msgstr "Ašys" msgid "Gridlines" msgstr "Tinklelio linijos" +# AI Translated +# Needs human review: Glossary cell empty for lt; check the term for this view mode msgid "Focus mode" -msgstr "" +msgstr "Fokuso režimas" msgid "Labels" msgstr "Etiketės (Užrašai)" @@ -6599,7 +6611,7 @@ msgid "Size:" msgstr "Dydis:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Rasta G-code trajektorijų konfliktų %d sluoksnyje, Z = %.2lfmm. Prašome labiau atskirti konfliktuojančius objektus (%s <-> %s)." @@ -10936,11 +10948,14 @@ msgstr "Rodyti nepalaikomus profilius" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Rodyti nesuderinamus / nepalaikomus profilius spausdintuvų ir gijų išskleidžiamuosiuose sąrašuose. Šių profilių pasirinkti negalima." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Eksportuoti statistiką kartu su G-code" +# AI Translated +# Needs human review: 'feature' here is a print feature type (outer wall, infill...), not the Design-tab feature; check the wording msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Jei įjungta, eksportuojant G-code failą šalia jo kaip .statistics.json įrašoma ir jo statistika JSON formatu, o eksportuotas susluoksniuotas 3MF failas ją turi savyje: spausdinimo laiką, gijos ir linijos tipo sumas bei tuos pačius duomenis pagal sluoksnį ir pagal objektą." msgid "Experimental Features" msgstr "Eksperimentinis" @@ -11797,6 +11812,10 @@ msgstr "Nepavyko įkelti failo į spausdintuvo atmintį. Bandykite dar kartą." msgid "Send Failed" msgstr "Siuntimas nepavyko" +# AI Translated +msgid "No available printers" +msgstr "Nėra galimų spausdintuvų" + msgid "The name length exceeds the limit." msgstr "Pavadinimas viršijo leistiną dydį." @@ -13643,8 +13662,8 @@ msgid "Left mouse" msgstr "Kairysis pelės mygtukas" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Veikia bet kurioje lango vietoje, net rašant teksto lauke." +msgid "Available anywhere in the window." +msgstr "Veikia bet kurioje lango vietoje." # AI Translated msgid "Run favorite 1 to 10" @@ -13756,10 +13775,6 @@ msgstr "%s jau priskirtas: %s. Priskirti jį veiksmui „%s“?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Numatytasis %s jau priskirtas: %s. Priskirti jį veiksmui „%s“?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Visuotiniai spartieji klavišai veikia ir rašant tekstą." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Klavišas, kuris įveda simbolį, negali būti visuotinis spartusis klavišas." @@ -14212,9 +14227,10 @@ msgstr "objekto „%2%“ modifikatorius „%1%“ (iš viso %3%) neturėjo įta msgid "Seam placement may differ from expected." msgstr "Siūlės vieta gali skirtis nuo numatytos." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Nepavyko įrašyti G-code statistikos į %1%." msgid "Internal Bridge" msgstr "Vidinis tiltas" @@ -17605,6 +17621,14 @@ msgstr "Išskirti objektus" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Įjunkite šią parinktį, kad į G-code būtų pridėta komanda EXCLUDE OBJECT." +# AI Translated +msgid "Outline tolerance" +msgstr "Kontūro tolerancija" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Didžiausias į EXCLUDE_OBJECT_DEFINE įrašomo objekto kontūro nuokrypis nuo pradinio kontūro. Didesnės reikšmės sukuria mažiau taškų, o tai padeda programinei aparatinei įrangai, kuri strigsta apdorodama G-code su daug objektų. 0 išsaugo visus taškus." + # AI Translated msgid "Verbose G-code" msgstr "Išsamus G-code (Verbose)" @@ -20826,11 +20850,14 @@ msgstr "Išvesties katalogas" msgid "This is the output directory for exported files." msgstr "Tai yra eksportuotų failų išvesties aplankas." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Eksportuoti statistiką" +# AI Translated +# Needs human review: 'feature' here is a print feature type (outer wall, infill...), not the Design-tab feature; check the wording msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Kiekvienos susluoksniuotos plokštės statistiką įrašo JSON formatu: kaip plate_N.statistics.json šalia jos G-code išvesties kataloge ir į 3MF, sukurtą su --export-3mf: spausdinimo laikas, gijos ir linijos tipo sumos bei tie patys duomenys pagal sluoksnį ir pagal objektą." msgid "Debug level" msgstr "Derinimo lygis" @@ -30639,1231 +30666,1646 @@ msgstr[0] "Dabartiniame gijų sąraše nėra %s. Po išskaidymo automatiškai bu msgstr[1] "Dabartiniame gijų sąraše nėra %s. Po išskaidymo automatiškai bus sukurtos mišriai gijai reikalingos projekto gijos." msgstr[2] "Dabartiniame gijų sąraše nėra %s. Po išskaidymo automatiškai bus sukurtos mišriai gijai reikalingos projekto gijos." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Spalvų parinkiklis" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Pagrindinės spalvos" +# AI Translated +# Needs human review: Glossary cell for Palette empty for lt; 'paletė' used #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "„Orca“ paletė" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL klasikinė" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Gradientai" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Vienspalvė" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Gradientas" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Gradiento pradžia" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Gradiento pabaiga" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Gradiento spalva" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Pridėti spalvą" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Pašalinti spalvą" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Sodrumas" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Pradinė spalva" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Išsaugoti dabartinę spalvą" +# AI Translated +# Needs human review: Glossary cell for Palette empty for lt; 'paletė' used msgid "Palettes" -msgstr "" +msgstr "Paletės" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Ieškoti spalvų" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Filtruoti spalvas" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Nėra atitinkančių spalvų" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Šešioliktainė spalva" # AI Translated msgid "Opacity" msgstr "Nepermatomumas" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Nepermatomumas (%)" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Išsaugoti spalvą" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Įveskite pilną šešioliktainį spalvos kodą" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Dabartinis kelių spalvų pasirinkimas išsaugomas, kol pasirinksite kitą spalvą." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Palaikoma iki %d spalvų." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmazinas" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Oranžiškai raudona" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Pomidoras" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Oranžinė" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Tamsiai oranžinė" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Auksinė" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Medžio ruda" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Biskvitas" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Rūkuota rožinė" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Šviesiai geltona" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Citrininis šifonas" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Bėžinė" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Šviesiai rykštenio geltona" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Blyški rykštenio geltona" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Chaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Tamsiai chaki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Švelniai persikinė" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mokasinas" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papajų kremas" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Balintas migdolas" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antikinė balta" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navaho balta" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Kviečių" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Rykštenio geltona" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Šokoladinė" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Plytų raudona" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Balno ruda" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Ruda" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Rausvai ruda" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Lašišinė" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Šviesiai lašišinė" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Tamsiai lašišinė" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Smėlio ruda" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Koralinė" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Šviesiai koralinė" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Indiškai raudona" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Tamsiai raudona" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Kaštoninė" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Žalsvai geltona" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Gelsvai žalia" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Šartrezas" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Vejos žalia" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Laimo žalia" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Pavasario žalia" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Vidutinė pavasario žalia" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Laimo" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Miško žalia" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Tamsiai žalia" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Prislopinta alyvuogių" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Alyvuogių" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Tamsiai alyvuogių žalia" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Blyškiai žalia" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Šviesiai žalia" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Vidutinė jūros žalia" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Jūros žalia" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Tamsiai jūros žalia" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Kadeto mėlyna" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Vidutinė akvamarino" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turkio" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Vidutinė turkio" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Tamsiai turkio" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Blyškiai turkio" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Akva" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Šviesiai ciano" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Mėtinis kremas" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Medaus melionas" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Akvamarinas" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Šviesiai jūros žalia" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Tamsiai ciano" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Žalsvai žydra" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Tamsiai skalūno pilka" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Šviesiai skalūno pilka" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Skalūno pilka" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Sodri dangaus mėlyna" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodžerių mėlyna" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Dangaus mėlyna" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Šviesiai dangaus mėlyna" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Šviesiai mėlyna" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Pudros mėlyna" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Šviesiai plieno mėlyna" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Plieno mėlyna" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Rugiagėlių mėlyna" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Karališka mėlyna" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Vidutinė mėlyna" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Vidurnakčio mėlyna" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Tamsiai mėlyna" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Jūrų laivyno mėlyna" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Skalūno mėlyna" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Tamsiai skalūno mėlyna" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Vidutinė skalūno mėlyna" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Mėlynai violetinė" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indigo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Tamsiai violetinė" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Tamsi orchidėja" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Vidutinė orchidėja" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orchidėja" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Violetinė" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Vidutinė purpurinė" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Purpurinė" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebekos purpurinė" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Vidutinė violetinė raudona" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Blyškiai violetinė raudona" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Sodri rožinė" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Ryškiai rožinė" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Šviesiai rožinė" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rožinė" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Slyvų" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Usnių" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuksija" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Tamsiai magenta" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Lino" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Seni nėriniai" +# AI Translated +# Needs human review: CSS color 'seashell'; Shell glossary warning is a false match (not the print shell) msgid "Sea shell" -msgstr "" +msgstr "Kriauklė" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Dramblio kaulo" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Gėlių balta" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Levandų rausva" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Šmėklos balta" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Alisos mėlyna" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Levandų" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Dūmų balta" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Juoda" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Koralų ugnis" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Jūros anemonė" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Gili bedugnė" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Omaro raudona" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Smėlingas molis" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Jūros išplauta mediena" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Šaltalankis" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Saulėlydžio rifas" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tigrinis koralas" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Rožinis koralas" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Kriauklės žara" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Smėlis" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Auksinis rudadumblis" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Saulės nutviesta kopa" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Gintaro nautilas" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Jūros citrina" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Blyški jūrų žvaigždė" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Pavasario potvynis" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Laimo dumbliai" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Jūros žolė" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neoninis planktonas" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Rudadumblių miškas" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Smaragdo banga" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Banginio šešėlis" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Jūros vėžlys" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Lagūna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Tropinė srovė" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Vidurnakčio įduba" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Tamsus rudadumblis" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Krištolinė banga" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Turkio įlanka" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Dangus virš rifo" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Seklumos dangus" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektrinė mėlyna" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfinas" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Vandenyno gelmės" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Banginis" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indigo bedugnė" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Jūros ežys" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Levandų koralas" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Violetinis potvynis" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Giliavandenė orchidėja" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neoninė medūza" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuksijos koralas" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Rožinė medūza" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Putos" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Kriauklės balta" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Akmenukų pilka" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Audros debesis" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Rašalo juoda" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Žalsvai bėžinė" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Smėlio geltona" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Signalinė geltona" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Auksinė geltona" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Medaus geltona" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Kukurūzų geltona" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Narcizų geltona" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Rusvai bėžinė" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Citrinų geltona" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Austrės balta" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Šviesi dramblio kaulo" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Cinko geltona" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Pilkšvai bėžinė" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Alyvuogių geltona" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Rapsų geltona" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Eismo geltona" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Ochros geltona" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Eismo oranžiškai geltona" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Kario" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Melionų geltona" +# AI Translated +# Needs human review: RAL 1032 'broom' (genista/Cytisus); check the Lithuanian plant name msgid "Broom yellow" -msgstr "" +msgstr "Šluotos geltona" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Jurginų geltona" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pastelinė geltona" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Perlinė bėžinė" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Perlinė auksinė" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Saulės geltona" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Gelsvai oranžinė" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Sodri oranžinė" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Cinobro" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Perlinė oranžinė" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Gryna oranžinė" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Švytinti oranžinė" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Švytinti ryškiai oranžinė" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Ryški raudonai oranžinė" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Eismo oranžinė" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Signalinė oranžinė" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Lašišos oranžinė" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Perlinė rožinė" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Vario oranžinė" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Signalinė ruda" +# AI Translated +# Needs human review: RAL 2018 name; 'Fir' rendered as kėnis; check against the Lithuanian RAL chart msgid "Fir orange" -msgstr "" +msgstr "Kėnio oranžinė" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Signalinė raudona" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Švytinti raudona" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karmino raudona" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Perlinė karmino raudona" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Gryna raudona" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Švytinti sodriai raudona" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Serbentų raudona" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Perlinė rubino raudona" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Ugnies raudona" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rubino raudona" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Purpurinė raudona" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Vyno raudona" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Juodai raudona" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oksido raudona" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Rusvai raudona" +# AI Translated +# Needs human review: RAL 3012 name; check against the Lithuanian RAL chart msgid "Pine red" -msgstr "" +msgstr "Pušies raudona" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Pomidorinė raudona" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Antikinė rožinė" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Koralų raudona" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rožė" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Braškių raudona" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Eismo raudona" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Lašišos rožinė" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Švytinti rožinė" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Švytinti ryškiai raudona" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Aviečių raudona" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Rytų raudona" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Perlinis rubinas" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Raudonai purpurinė" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Raudonai violetinė" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Viržių violetinė" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordo violetinė" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Raudonmedis" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Pilkšvai purpurinė" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Signalinė violetinė" +# AI Translated +# Needs human review: Used for both RAL 4009 and 6009 (source reuses one msgid); check against the Lithuanian RAL chart msgid "Fir green" -msgstr "" +msgstr "Kėnio žalia" +# AI Translated +# Needs human review: RAL 4010 name (a violet-grey); unclear source term, check against the Lithuanian RAL chart msgid "Sabine grey" -msgstr "" +msgstr "Sabinų pilka" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Perlinė violetinė" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Perlinė gervuogių" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Žalsvai mėlyna" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarino mėlyna" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Safyro mėlyna" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Juodai mėlyna" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Signalinė mėlyna" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Žėrinti mėlyna" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Pilkšvai mėlyna" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Žydra" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Gencijonų mėlyna" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobalto mėlyna" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Karvelių mėlyna" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Eismo mėlyna" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Turkio mėlyna" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Kaprio mėlyna" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Vandenyno mėlyna" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Vandens mėlyna" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Nakties mėlyna" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Tolimoji mėlyna" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pastelinė mėlyna" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Perlinė gencijonų mėlyna" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Perlinė vidurnakčio mėlyna" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patinos žalia" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Smaragdo žalia" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Lapų žalia" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Alyvuogių žalia" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Melsvai žalia" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Samanų žalia" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Pilkšvai alyvuogių" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Pušies žalia" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Pušies ruda" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Žolės žalia" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Rezedos žalia" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Rusvai žalia" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Nendrių žalia" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Juodai žalia" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Turkio žalia" +# AI Translated msgid "May green" -msgstr "" +msgstr "Gegužės žalia" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Chromo oksido žalia" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Eismo žalia" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Paparčių žalia" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opalo žalia" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Mėtų žalia" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Bronzos žalia" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Perlinė žalia" +# AI Translated msgid "Sax turquoise" -msgstr "" +msgstr "Saksų turkio" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Perlinė turkio" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Perlinis nefritas" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Gryna žalia" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Švytinti žalia" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Voverės pilka" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Sidabrinė pilka" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Alyvuogių pilka" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Samanų pilka" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Signalinė pilka" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Pelės pilka" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Bėžinė pilka" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Chaki pilka" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Žalsvai pilka" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Brezento pilka" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Geležies pilka" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Bazalto pilka" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Rusvai pilka" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Skalūno pilka" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antracito pilka" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Šviesiai pilka" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umbros pilka" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Betono pilka" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafito pilka" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Granito pilka" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Akmens pilka" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Akmenukų pilka" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Cemento pilka" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Gelsvai pilka" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platinos pilka" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Dulkėta pilka" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Agato pilka" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Kvarco pilka" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Lango pilka" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Eismo pilka A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Eismo pilka B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Šilko pilka" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telepilka 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telepilka 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telepilka 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Perlinė pelės pilka" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Žalsvai ruda" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Ochros ruda" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Molio ruda" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Vario ruda" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Šokolado ruda" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Alyvuogių ruda" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Riešutų ruda" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Raudonai ruda" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sepijos ruda" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Kaštonų ruda" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Raudonmedžio ruda" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Pilkšvai ruda" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Perlinis varis" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Bėžinė ruda" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Perlinė mokos ruda" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Žemės ruda" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Perlinė ruda" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Kreminė" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Pilkšvai balta" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Signalinė balta" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Signalinė juoda" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Gagato juoda" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Balta aliuminio" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Pilka aliuminio" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Gryna balta" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Grafito juoda" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Eismo balta" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Eismo juoda" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papiruso balta" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Perlinė šviesiai pilka" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metalas: Sidabras" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metalas: Žalvaris" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metalas: Auksas" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metalas: Varis" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metalas: Bronza" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Gamta: Perlas" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Gamta: Vaivorykštė" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Gamta: Giedras dangus" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Gamta: Saulėlydis" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Mediena: Tamsi" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Mediena: Vidutinė" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Mediena: Šviesi" # AI Translated msgid "Alternate nozzles:" @@ -32341,13 +32783,25 @@ msgstr "Pašalinti iš „Mano tekstūros“" msgid "Built-in" msgstr "Integruotos" +# AI Translated +msgid "My textures" +msgstr "Mano tekstūros" + # AI Translated msgid "No textures found." msgstr "Tekstūrų nerasta." # AI Translated -msgid "My textures" -msgstr "Mano tekstūros" +msgid "Texture libraries" +msgstr "Tekstūrų bibliotekos" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Naršyti daugiau tekstūrų bibliotekų" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Atidaro „OrcaCloud“ pradžios puslapyje, kad galėtumėte naršyti papildinius." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -32750,11 +33204,15 @@ msgstr "Tekstūra dedama pagal paties modelio UV išdėstymą, kuris jau nustato msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Kokio pločio yra viena tekstūros kopija ant modelio. Mažesnė reikšmė dažniau kartoja raštą ir smulkina jo detales; išjungus „Plytelės“, tai vienintelės kopijos dydis." +# AI Translated +# Needs human review: Caption under a tile-size picture in the Texture displacement gizmo; check gender/fit msgid "Larger" -msgstr "" +msgstr "Didesnis" +# AI Translated +# Needs human review: Caption under a tile-size picture in the Texture displacement gizmo; check gender/fit msgid "Smaller" -msgstr "" +msgstr "Mažesnis" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -32830,11 +33288,15 @@ msgstr "Mišrios spalvos" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Didžiausias mišrių gijų skaičius, kurį gali pridėti įkepimas. Jos parenkamos iš tekstūros spalvų, ir sukuriamos tik tos, kurias įkepimas iš tikrųjų naudoja." +# AI Translated +# Needs human review: Caption under a mixed-colors picture in the Texture displacement gizmo; check it fits msgid "Few" -msgstr "" +msgstr "Mažai" +# AI Translated +# Needs human review: Caption under a mixed-colors picture in the Texture displacement gizmo; check it fits msgid "Many" -msgstr "" +msgstr "Daug" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33195,11 +33657,15 @@ msgstr "Pertinklinimas" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Trikampių dydis, kuriuo perkuriamas visas modelis, milimetrais. Reljefas geriausiai formuojamas ant tolygaus tinklelio; būtent ši parinktis iš netolygaus importuoto modelio padaro tolygų." +# AI Translated +# Needs human review: Caption under the remesh before/after picture; check it fits msgid "Before" -msgstr "" +msgstr "Prieš" +# AI Translated +# Needs human review: Caption under the remesh before/after picture; check it fits msgid "After" -msgstr "" +msgstr "Po" # AI Translated msgid "Keep sharp edges" @@ -35087,6 +35553,10 @@ msgstr "Scenarijus" msgid "Slicing Pipeline" msgstr "Sluoksniavimo grandinė" +# AI Translated +msgid "Resource Texture" +msgstr "Išteklių tekstūra" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Papildinio konfigūracijos sąsaja tuščia. Rodomas numatytasis redaktorius." @@ -35234,6 +35704,30 @@ msgstr "Papildinio kataloge yra ir .py, ir .whl įėjimo failai" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Papildinio kataloge nėra .py ar .whl įėjimo failo" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Išteklių tekstūros katalogas nenustatytas" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Nepavyko nustatyti išteklių tekstūros katalogo" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Išteklių tekstūros kelias nėra katalogas" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Nepavyko nustatyti papildinio aplanko" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Išteklių tekstūros katalogas yra už papildinio aplanko ribų" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Nepavyko nuskaityti išteklių tekstūros katalogo" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36184,6 +36678,28 @@ msgstr "" "Venkite deformacijų (warping)\n" "Ar žinojote, kad spausdinant medžiagas, kurios yra linkusios trauktis ir riestis (pvz., ABS), tinkamas kaitinamojo pagrindo temperatūros padidinimas gali sumažinti deformacijų (warping) tikimybę?" +# AI Translated +# Needs human review: Source likely a typo for RAL 1007 Daffodil yellow; translated as daffodil +#~ msgid "Dalmatian yellow" +#~ msgstr "Narcizų geltona" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Kapsantino violetinė" + +# AI Translated +# Needs human review: RAL 7002 name (olive grey); unclear source term, check against the Lithuanian RAL chart +#~ msgid "Olivestone" +#~ msgstr "Alyvuogių akmuo" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Veikia bet kurioje lango vietoje, net rašant teksto lauke." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Visuotiniai spartieji klavišai veikia ir rašant tekstą." + #~ msgid "Please choose the filament color" #~ msgstr "Pasirinkite gijos spalvą" diff --git a/localization/i18n/nl/OrcaSlicer_nl.po b/localization/i18n/nl/OrcaSlicer_nl.po index d4d4a9ee45..1bce6a3f3f 100644 --- a/localization/i18n/nl/OrcaSlicer_nl.po +++ b/localization/i18n/nl/OrcaSlicer_nl.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -810,18 +810,22 @@ msgstr "Selectie" msgid "Plate" msgstr "Printbed" +# AI Translated +# Needs human review: Glossary has no Dutch term yet; Verdelen matches the existing Uitlijnen/Verdelen. msgid "Distribute" -msgstr "" +msgstr "Verdelen" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Coördinatensysteem dat wordt gebruikt voor transformatiebewerkingen." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Referentie voor uitlijning" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Selecteer minstens 3 onderdelen of objecten" # AI Translated msgid "Align left" @@ -874,8 +878,9 @@ msgstr "Boven-onder verdelen" msgid "Drop" msgstr "Neerzetten" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Verplaats de selectie langs Z zodat het laagste punt het printbed raakt." # AI Translated msgid "Absolute" @@ -2257,17 +2262,21 @@ msgstr "Samenstelgizmo starten" msgid "Leaving Assembly gizmo" msgstr "Samenstelgizmo verlaten" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Onderdelen van een gesneden object kunnen niet worden verplaatst" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Uitlijnen op het printbed is alleen mogelijk in X en Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Schakel Automatisch laten vallen uit voor de geselecteerde objecten om ze in Z te verplaatsen" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Alle geselecteerde objecten moeten op hetzelfde printbed staan" msgid "Shift+" msgstr "Shift+" @@ -7030,8 +7039,10 @@ msgstr "Assen" msgid "Gridlines" msgstr "Rasterlijnen" +# AI Translated +# Needs human review: Glossary has no Dutch term for Focus mode yet; Focusmodus chosen. msgid "Focus mode" -msgstr "" +msgstr "Focusmodus" # AI Translated msgid "Labels" @@ -7095,7 +7106,7 @@ msgid "Size:" msgstr "Maat:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Er zijn conflicten tussen G-code-paden gevonden op laag %d, Z = %.2lfmm. Plaats de conflicterende objecten verder uit elkaar (%s <-> %s)." @@ -11752,11 +11763,13 @@ msgstr "Niet-ondersteunde voorinstellingen tonen" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Toon incompatibele/niet-ondersteunde voorinstellingen in de keuzelijsten voor printer en filament. Deze voorinstellingen kunnen niet worden geselecteerd." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Statistieken exporteren met de G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Indien ingeschakeld schrijft het exporteren van een G-codebestand ook de bijbehorende statistieken als JSON ernaast, als .statistics.json, en een geëxporteerd gesliced 3MF-bestand bevat ze intern: printtijd, totalen voor filament en lijntypen, en dezelfde gegevens per laag en per object." # AI Translated msgid "Experimental Features" @@ -12650,6 +12663,10 @@ msgstr "Uploaden van het bestand naar de opslag van de printer is mislukt. Probe msgid "Send Failed" msgstr "Verzenden mislukt" +# AI Translated +msgid "No available printers" +msgstr "Geen beschikbare printers" + # AI Translated msgid "The name length exceeds the limit." msgstr "De naam is langer dan toegestaan." @@ -14644,8 +14661,8 @@ msgid "Left mouse" msgstr "Linkermuisknop" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Overal in het venster beschikbaar, zelfs tijdens het typen in een tekstveld." +msgid "Available anywhere in the window." +msgstr "Overal in het venster beschikbaar." # AI Translated msgid "Run favorite 1 to 10" @@ -14758,10 +14775,6 @@ msgstr "%s is toegewezen aan %s. Opnieuw toewijzen aan %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "De standaardsneltoets %s is toegewezen aan %s. Opnieuw toewijzen aan %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Globale sneltoetsen werken ook tijdens het typen." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Een toets die een teken typt, kan geen globale sneltoets zijn." @@ -15241,9 +15254,10 @@ msgstr "aanpasser \"%1%\" van \"%2%\" (%3% in totaal) had geen effect op de naad msgid "Seam placement may differ from expected." msgstr "De plaatsing van de naad kan afwijken van wat verwacht wordt." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "De G-codestatistieken konden niet naar %1% worden geschreven." # AI Translated msgid "Internal Bridge" @@ -18985,6 +18999,14 @@ msgstr "Objecten uitsluiten" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Schakel deze optie in om de opdracht EXCLUDE OBJECT aan de G-code toe te voegen." +# AI Translated +msgid "Outline tolerance" +msgstr "Omtrektolerantie" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Maximale afwijking van de objectomtrek die naar EXCLUDE_OBJECT_DEFINE wordt geschreven ten opzichte van de oorspronkelijke omtrek. Hogere waarden geven minder punten, wat helpt bij firmware die vastloopt bij het verwerken van G-code met veel objecten. 0 behoudt elk punt." + msgid "Verbose G-code" msgstr "Opmerkingen in G-code" @@ -22565,11 +22587,13 @@ msgstr "Uitvoermap" msgid "This is the output directory for exported files." msgstr "Dit is de map waarin de geëxporteerde bestanden worden opgeslagen" +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Statistieken exporteren" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Schrijft de statistieken van elk printbed na het slicen als JSON, als plate_N.statistics.json naast de G-code in de uitvoermap en in de 3MF van --export-3mf: printtijd, totalen voor filament en lijntypen, en dezelfde gegevens per laag en per object." msgid "Debug level" msgstr "Debuggen level" @@ -32838,1231 +32862,1651 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "De huidige filamentlijst bevat geen %s. Een projectfilament dat het gemengde filament nodig heeft, wordt na de ontleding automatisch aangemaakt." msgstr[1] "De huidige filamentlijst bevat geen %s. Projectfilamenten die het gemengde filament nodig heeft, worden na de ontleding automatisch aangemaakt." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Kleurkiezer" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Basiskleuren" +# AI Translated +# Needs human review: Glossary has no Dutch term for Palette yet; Palet chosen. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca-palet" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Classic" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Verlopen" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Effen" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Verloop" +# AI Translated +# Needs human review: Color picker label for the start of a gradient; check it reads right next to the field. msgid "Gradient start" -msgstr "" +msgstr "Begin van verloop" +# AI Translated +# Needs human review: Color picker label for the end of a gradient; check it reads right next to the field. msgid "Gradient end" -msgstr "" +msgstr "Einde van verloop" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Verloopkleur" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Kleur toevoegen" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Kleur verwijderen" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Verzadiging" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Oorspronkelijke kleur" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Huidige kleur opslaan" +# AI Translated +# Needs human review: Glossary has no Dutch term for Palette yet; Palet/Paletten chosen. msgid "Palettes" -msgstr "" +msgstr "Paletten" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Kleuren zoeken" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Kleuren filteren" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Geen overeenkomende kleuren" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Hexkleur" # AI Translated msgid "Opacity" msgstr "Dekking" +# AI Translated +# Needs human review: Label of the opacity percent input in the color picker; check it reads right next to the field. msgid "Opacity percent" -msgstr "" +msgstr "Dekking in procent" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Kleur opslaan" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Voer een volledige hexadecimale kleur in" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "De huidige meerkleurenselectie blijft behouden tot een andere kleur wordt gekozen." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Maximaal %d kleuren worden ondersteund." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmozijnrood" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Oranjerood" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Tomaat" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Oranje" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Donkeroranje" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Goud" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Houtbruin" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Bisque" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Nevelroze" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Lichtgeel" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Citroenchiffon" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beige" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Lichtguldenroedegeel" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Bleke guldenroede" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Kaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Donkerkaki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Perzikroom" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mocassin" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papajaroom" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Gepelde amandel" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antiekwit" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navajowit" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Tarwe" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Guldenroede" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Chocolade" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Baksteenrood" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Sienna" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Zadelbruin" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Bruin" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Rozebruin" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Zalm" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Lichte zalm" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Donkere zalm" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Zandbruin" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Koraal" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Licht koraal" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Indisch rood" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Donkerrood" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Kastanjerood" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Groengeel" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Geelgroen" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Gazongroen" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Limoengroen" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Lentegroen" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Midden-lentegroen" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Limoen" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Bosgroen" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Donkergroen" +# AI Translated +# Needs human review: CSS olive drab has no common Dutch name; Matolijf chosen. msgid "Olive drab" -msgstr "" +msgstr "Matolijf" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Olijf" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Donkerolijfgroen" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Bleekgroen" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Lichtgroen" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Midden-zeegroen" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Zeegroen" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Donkerzeegroen" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Cadetblauw" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Midden-aquamarijn" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turkoois" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Midden-turkoois" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Donkerturkoois" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Bleekturkoois" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Lichtcyaan" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Muntroom" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Honingdauw" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Aquamarijn" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Lichtzeegroen" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Donkercyaan" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Petrol" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Donkerleigrijs" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Lichtleigrijs" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Leigrijs" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Diephemelsblauw" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodgerblauw" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Hemelsblauw" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Lichthemelsblauw" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Lichtblauw" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Poederblauw" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Lichtstaalblauw" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Staalblauw" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Korenbloemblauw" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Koningsblauw" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Middenblauw" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Middernachtblauw" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Donkerblauw" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Marineblauw" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Leiblauw" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Donkerleiblauw" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Midden-leiblauw" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Blauwviolet" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indigo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Donkerviolet" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Donkere orchidee" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Midden-orchidee" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orchidee" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Violet" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Midden-purper" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Purper" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebecca-purper" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Midden-violetrood" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Bleek violetrood" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Dieproze" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Knalroze" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Lichtroze" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Roze" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Pruim" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Distel" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuchsia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Donkermagenta" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Linnen" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Oud kant" +# AI Translated +# Needs human review: Color name (CSS seashell), not the print Shell; glossary Shell warning is a false match. msgid "Sea shell" -msgstr "" +msgstr "Schelp" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Ivoor" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Bloemenwit" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lavendelroze" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Spookwit" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Alice-blauw" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lavendel" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Rookwit" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Zwart" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Koraalvuur" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Zeeanemoon" +# AI Translated +# Needs human review: Ocean-themed color name; check the Dutch rendering. msgid "Deep abyss" -msgstr "" +msgstr "Diepe afgrond" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Kreeftrood" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Zandklei" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Drijfhout" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Duindoorn" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Rif bij zonsondergang" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tijgerkoraal" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Rozekoraal" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Schelpgloed" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Zand" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Gouden kelp" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Zonovergoten duin" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Barnsteen-nautilus" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Zeecitroen" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Bleke zeester" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Springtij" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Limoenalg" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Zeegras" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neonplankton" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Kelpbos" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Smaragdgolf" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Walvisschaduw" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Zeeschildpad" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Lagune" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Tropische stroming" +# AI Translated +# Needs human review: Ocean-themed color name; check the Dutch rendering. msgid "Midnight trench" -msgstr "" +msgstr "Middernachtgeul" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Donkere kelp" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Kristalbranding" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Turkooisbaai" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Lucht boven het rif" +# AI Translated +# Needs human review: Ocean-themed color name; check the Dutch rendering. msgid "Shallow sky" -msgstr "" +msgstr "Ondiepe hemel" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektrisch blauw" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Dolfijn" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Oceaandiepten" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Walvis" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indigoafgrond" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Zee-egel" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Lavendelkoraal" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Violet getij" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Diepzeeorchidee" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neonkwal" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuchsiakoraal" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Roze kwal" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Schuim" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Schelpwit" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Kiezelgrijs" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Onweerswolk" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Inktzwart" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Groenbeige" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Zandgeel" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Signaalgeel" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Goudgeel" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Honinggeel" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Maisgeel" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Narcisgeel" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Bruinbeige" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Citroengeel" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Parelwit" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Licht ivoor" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Zinkgeel" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Grijsbeige" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Olijfgeel" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Koolzaadgeel" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Verkeersgeel" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Okergeel" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Verkeersoranjegeel" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Meloengeel" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Bremgeel" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Dahliageel" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pastelgeel" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Parelbeige" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Parelgoud" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Zonnegeel" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Geeloranje" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Dieporanje" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Vermiljoen" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Pareloranje" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Zuiver oranje" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Lichtgevend oranje" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Lichtgevend helderoranje" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Helder roodoranje" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Verkeersoranje" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Signaaloranje" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Zalmoranje" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Parelroze" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Koperoranje" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Signaalbruin" +# AI Translated +# Needs human review: Unusual name (fir = spar); check the Dutch colour name. msgid "Fir orange" -msgstr "" +msgstr "Sparrenoranje" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Signaalrood" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Lichtgevend rood" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karmijnrood" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Parelkarmijnrood" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Zuiver rood" +# AI Translated +# Needs human review: Nonstandard RAL name; literal rendering. msgid "Luminous deep red" -msgstr "" +msgstr "Lichtgevend dieprood" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Aalbesrood" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Parelrobijnrood" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Vuurrood" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Robijnrood" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Purperrood" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Wijnrood" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Zwartrood" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oxiderood" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Bruinrood" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Dennenrood" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Tomaatrood" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Oudroze" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Koraalrood" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rosé" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Aardbeirood" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Verkeersrood" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Zalmroze" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Lichtgevend roze" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Lichtgevend helderrood" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Frambozenrood" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Oriëntrood" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Parelrobijn" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Roodpurper" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Roodviolet" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Heideviolet" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordeauxviolet" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Mahonie" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Grijspurper" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Signaalviolet" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Sparrengroen" +# AI Translated msgid "Sabine grey" -msgstr "" +msgstr "Sabijnengrijs" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Parelviolet" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Parelbraam" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Groenblauw" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarijnblauw" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Saffierblauw" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Zwartblauw" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Signaalblauw" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Briljantblauw" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Grijsblauw" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azuurblauw" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Gentiaanblauw" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobaltblauw" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Duifblauw" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Verkeersblauw" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Turkooisblauw" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Capriblauw" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Oceaanblauw" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Waterblauw" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Nachtblauw" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Verblauw" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pastelblauw" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Parelgentiaanblauw" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Parel-middernachtblauw" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patinagroen" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Smaragdgroen" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Loofgroen" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Olijfgroen" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Blauwgroen" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Mosgroen" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Grijsolijf" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Dennengroen" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Dennenbruin" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Grasgroen" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Resedagroen" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Bruingroen" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Rietgroen" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Zwartgroen" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Turkooisgroen" +# AI Translated msgid "May green" -msgstr "" +msgstr "Meigroen" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Chroomoxidegroen" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Verkeersgroen" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Varengroen" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opaalgroen" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Muntgroen" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Bronsgroen" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Parelgroen" +# AI Translated +# Needs human review: Unclear RAL-style name (Sax = Saxe blue?); check the Dutch colour name. msgid "Sax turquoise" -msgstr "" +msgstr "Sax-turkoois" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Parelturkoois" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Pareljade" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Zuiver groen" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Lichtgevend groen" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Eekhoorngrijs" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Zilvergrijs" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Olijfgrijs" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Mosgrijs" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Signaalgrijs" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Muisgrijs" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Beigegrijs" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Kakigrijs" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Groengrijs" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Dekzeilgrijs" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "IJzergrijs" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Basaltgrijs" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Bruingrijs" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Leigrijs" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antracietgrijs" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Lichtgrijs" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Ombergrijs" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Betongrijs" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafietgrijs" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Granietgrijs" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Steengrijs" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Kiezelgrijs" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Cementgrijs" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Geelgrijs" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platinagrijs" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Stofgrijs" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Agaatgrijs" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Kwartsgrijs" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Raamgrijs" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Verkeersgrijs A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Verkeersgrijs B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Zijdegrijs" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegrijs 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegrijs 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegrijs 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Parelmuisgrijs" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Groenbruin" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Okerbruin" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Kleibruin" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Koperbruin" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Chocoladebruin" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Olijfbruin" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Notenbruin" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Roodbruin" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sepiabruin" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Kastanjebruin" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Mahoniebruin" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Grijsbruin" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Parelkoper" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Beigebruin" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Parelmokkabruin" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Aardbruin" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Parelbruin" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Crème" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Grijswit" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Signaalwit" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Signaalzwart" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Gitzwart" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Wit aluminium" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Grijs aluminium" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Zuiver wit" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Grafietzwart" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Verkeerswit" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Verkeerszwart" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papyruswit" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Parellichtgrijs" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metaal: Zilver" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metaal: Messing" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metaal: Goud" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metaal: Koper" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metaal: Brons" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Natuur: Parel" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Natuur: Regenboog" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Natuur: Heldere hemel" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Natuur: Zonsondergang" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Hout: Donker" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Hout: Gemiddeld" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Hout: Licht" # AI Translated msgid "Alternate nozzles:" @@ -34538,13 +34982,25 @@ msgstr "Verwijderen uit Mijn texturen" msgid "Built-in" msgstr "Ingebouwd" +# AI Translated +msgid "My textures" +msgstr "Mijn texturen" + # AI Translated msgid "No textures found." msgstr "Geen texturen gevonden." # AI Translated -msgid "My textures" -msgstr "Mijn texturen" +msgid "Texture libraries" +msgstr "Textuurbibliotheken" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Ontdek meer textuurbibliotheken" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Opent OrcaCloud op de startpagina om naar plug-ins te zoeken." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -34947,11 +35403,13 @@ msgstr "Gekoppeld via de eigen UV-indeling van het model, die al de plaatsing be msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Hoe breed één kopie van de textuur op het model is. Kleiner herhaalt het patroon vaker en maakt het detail fijner; met Tegelen uit is dit de grootte van de enkele kopie." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Groter" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Kleiner" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -35027,11 +35485,14 @@ msgstr "Gemengde kleuren" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Het maximale aantal gemengde filamenten dat bij het bakken mag worden toegevoegd. Ze worden gekozen uit de kleuren van de textuur, en alleen de filamenten die bij het bakken daadwerkelijk worden gebruikt, worden aangemaakt." +# AI Translated +# Needs human review: Caption under an illustration in the texture displacement mixed-colors option; check it reads right as a pair with Many. msgid "Few" -msgstr "" +msgstr "Weinig" +# AI Translated msgid "Many" -msgstr "" +msgstr "Veel" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -35387,11 +35848,13 @@ msgstr "Remeshen" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Driehoeksgrootte waarmee het hele model opnieuw wordt opgebouwd, in millimeters. Verplaatsing werkt het best op een gelijkmatige mesh; hiermee maakt u er een van een ongelijkmatige import." +# AI Translated msgid "Before" -msgstr "" +msgstr "Voor" +# AI Translated msgid "After" -msgstr "" +msgstr "Na" # AI Translated msgid "Keep sharp edges" @@ -37270,6 +37733,10 @@ msgstr "Script" msgid "Slicing Pipeline" msgstr "Slicepijplijn" +# AI Translated +msgid "Resource Texture" +msgstr "Resourcetextuur" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "De configuratie-UI van de plug-in was leeg. De standaardeditor wordt getoond." @@ -37417,6 +37884,30 @@ msgstr "Plug-inmap bevat zowel .py- als .whl-startbestanden" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Plug-inmap bevat geen .py- of .whl-startbestand" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "De map voor de resourcetextuur is niet ingesteld" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "De map voor de resourcetextuur kon niet worden bepaald" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Het pad van de resourcetextuur is geen map" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "De plug-inmap kon niet worden bepaald" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "De map voor de resourcetextuur ligt buiten de plug-inmap" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "De map voor de resourcetextuur kon niet worden gelezen" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -38364,6 +38855,29 @@ msgstr "" "Kromtrekken voorkomen\n" "Wist je dat bij het printen van materialen die gevoelig zijn voor kromtrekken, zoals ABS, een juiste verhoging van de temperatuur van het warmtebed de kans op kromtrekken kan verkleinen?" +# AI Translated +# Needs human review: Likely RAL 1007 daffodil yellow (Narcisgeel); source name is nonstandard. +#~ msgid "Dalmatian yellow" +#~ msgstr "Narcisgeel" + +# AI Translated +# Needs human review: Source likely a typo for RAL 5019 Capri blue (sits between Turquoise blue and Ocean blue); translated as Capriblauw. +#~ msgid "Capsanthin violet" +#~ msgstr "Capriblauw" + +# AI Translated +# Needs human review: Source likely a typo for RAL 7002 Olive grey; translated as Olijfgrijs. +#~ msgid "Olivestone" +#~ msgstr "Olijfgrijs" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Overal in het venster beschikbaar, zelfs tijdens het typen in een tekstveld." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Globale sneltoetsen werken ook tijdens het typen." + # AI Translated #~ msgid "Please choose the filament color" #~ msgstr "Kies de filamentkleur" diff --git a/localization/i18n/pl/OrcaSlicer_pl.po b/localization/i18n/pl/OrcaSlicer_pl.po index e503aca909..4da84941df 100644 --- a/localization/i18n/pl/OrcaSlicer_pl.po +++ b/localization/i18n/pl/OrcaSlicer_pl.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: OrcaSlicer 2.3.0-rc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: \n" "Last-Translator: Krzysztof Morga <>\n" "Language-Team: \n" @@ -790,18 +790,21 @@ msgstr "Wybór" msgid "Plate" msgstr "Płyta" +# AI Translated msgid "Distribute" -msgstr "" +msgstr "Rozłóż" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Układ współrzędnych używany przy operacjach transformacji." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Odniesienie wyrównania" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Wybierz co najmniej 3 części lub obiekty" # AI Translated msgid "Align left" @@ -854,8 +857,9 @@ msgstr "Rozłóż góra-dół" msgid "Drop" msgstr "Upuść" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Przesuwa zaznaczenie wzdłuż osi Z tak, aby jego najniższy punkt dotykał stołu." # AI Translated msgid "Absolute" @@ -2099,17 +2103,21 @@ msgstr "Wejście do gizmo składania" msgid "Leaving Assembly gizmo" msgstr "Wyjście z gizmo składania" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Części przeciętego obiektu nie mogą być przesuwane" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Wyrównanie do stołu jest dostępne tylko w osiach X i Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Wyłącz automatyczne opuszczanie dla wybranych obiektów, aby przesuwać je w osi Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Wszystkie wybrane obiekty muszą znajdować się na tej samej płycie" msgid "Shift+" msgstr "Shift+" @@ -6644,8 +6652,9 @@ msgstr "Osie" msgid "Gridlines" msgstr "Linie siatki" +# AI Translated msgid "Focus mode" -msgstr "" +msgstr "Tryb skupienia" # AI Translated msgid "Labels" @@ -6707,7 +6716,7 @@ msgstr "Objętość:" msgid "Size:" msgstr "Rozmiar:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Wykryto konflikty ścieżek G-code na warstwie %d, Z = %.2lfmm. Proszę oddalić od siebie obiekty będące w konflikcie (%s <-> %s)." @@ -11186,11 +11195,14 @@ msgstr "Pokaż nieobsługiwane profile" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Pokazuj niekompatybilne/nieobsługiwane profile na listach rozwijanych drukarek i filamentów. Tych profili nie można wybrać." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Eksportuj statystyki razem z G-code" +# AI Translated +# Needs human review: 'feature totals' = totals per extrusion feature type; check the wording. msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Jeśli włączone, eksport pliku G-code zapisuje obok niego także jego statystyki w formacie JSON, jako .statistics.json, a wyeksportowany plik 3MF z wynikiem cięcia zawiera je w środku: czas druku, sumy dla filamentu i rodzajów linii oraz te same dane dla każdej warstwy i każdego obiektu." # AI Translated msgid "Experimental Features" @@ -12063,6 +12075,10 @@ msgstr "Nie udało się przesłać pliku do pamięci drukarki. Spróbuj ponownie msgid "Send Failed" msgstr "Wysyłanie nieudane" +# AI Translated +msgid "No available printers" +msgstr "Brak dostępnych drukarek" + msgid "The name length exceeds the limit." msgstr "Długość nazwy przekracza limit." @@ -13948,8 +13964,8 @@ msgid "Left mouse" msgstr "Lewy przycisk myszy" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Dostępne w dowolnym miejscu okna, nawet podczas wpisywania tekstu w polu tekstowym." +msgid "Available anywhere in the window." +msgstr "Dostępne w dowolnym miejscu okna." # AI Translated msgid "Run favorite 1 to 10" @@ -14061,10 +14077,6 @@ msgstr "Skrót %s jest przypisany do %s. Przypisać go do %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Domyślny skrót %s jest przypisany do %s. Przypisać go do %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Skróty globalne działają także podczas pisania." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Klawisz wpisujący znak nie może być skrótem globalnym." @@ -14521,9 +14533,10 @@ msgstr "modyfikator „%1%” obiektu „%2%” (łącznie %3%) nie wpłynął n msgid "Seam placement may differ from expected." msgstr "Położenie szwu może różnić się od oczekiwanego." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Nie udało się zapisać statystyk G-code do %1%." msgid "Internal Bridge" msgstr "Wewnętrzny most" @@ -17998,6 +18011,14 @@ msgstr "Wyłącz obiekty" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Włącz tę opcję, aby dodać polecenie EXCLUDE OBJECT do G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Tolerancja konturu" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Maksymalne odchylenie konturu obiektu zapisanego w EXCLUDE_OBJECT_DEFINE od konturu oryginalnego. Większe wartości dają mniej punktów, co pomaga w przypadku firmware, który zawiesza się podczas analizy G-code z wieloma obiektami. 0 zachowuje każdy punkt." + msgid "Verbose G-code" msgstr "Rozszerzony G-code" @@ -21304,11 +21325,14 @@ msgstr "Katalog wyjściowy" msgid "This is the output directory for exported files." msgstr "Katalog wyjściowy dla eksportowanych plików." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Eksportuj statystyki" +# AI Translated +# Needs human review: 'feature totals' = totals per extrusion feature type; check the wording. msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Zapisuje statystyki każdej pociętej płyty w formacie JSON, jako plate_N.statistics.json obok jej G-code w katalogu wyjściowym oraz w pliku 3MF z --export-3mf: czas druku, sumy dla filamentu i rodzajów linii oraz te same dane dla każdej warstwy i każdego obiektu." msgid "Debug level" msgstr "Poziom debugowania" @@ -31330,1231 +31354,1648 @@ msgstr[0] "Bieżąca lista filamentów nie zawiera: %s. Filament projektu wymaga msgstr[1] "Bieżąca lista filamentów nie zawiera: %s. Filamenty projektu wymagane przez filament mieszany zostaną utworzone automatycznie po rozkładzie." msgstr[2] "Bieżąca lista filamentów nie zawiera: %s. Filamenty projektu wymagane przez filament mieszany zostaną utworzone automatycznie po rozkładzie." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Selektor kolorów" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Kolory podstawowe" +# AI Translated #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Paleta Orca" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Classic" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Gradienty" +# AI Translated +# Needs human review: Color picker tab: single solid color as opposed to a gradient; check it reads right next to 'Gradients'. +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Jednolity" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Gradient" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Początek gradientu" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Koniec gradientu" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Kolor gradientu" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Dodaj kolor" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Usuń kolor" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Nasycenie" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Oryginalny kolor" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Zapisz bieżący kolor" +# AI Translated msgid "Palettes" -msgstr "" +msgstr "Palety" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Szukaj kolorów" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Filtruj kolory" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Brak pasujących kolorów" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Kolor HEX" # AI Translated msgid "Opacity" msgstr "Krycie" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Krycie w procentach" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Zapisz kolor" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Wprowadź pełny kolor szesnastkowy" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Bieżący wybór wielu kolorów zostaje zachowany, dopóki nie wybierzesz innego koloru." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Obsługiwanych jest maksymalnie %d kolorów." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmazynowy" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Pomarańczowoczerwony" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Pomidorowy" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Pomarańczowy" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Ciemnopomarańczowy" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Złoty" +# AI Translated +# Needs human review: CSS color name; 'Drewniany' is a free rendering. msgid "Burly wood" -msgstr "" +msgstr "Drewniany" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Kremoworóżowy" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Mglistoróżowy" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Jasnożółty" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Cytrynowy szyfon" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beżowy" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Jasny nawłociowożółty" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Blady nawłociowy" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Khaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Ciemne khaki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Brzoskwiniowy krem" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mokasynowy" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Krem papai" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Blady migdałowy" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antyczna biel" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Biel Navajo" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Pszeniczny" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Nawłociowy" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Czekoladowy" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Ceglasty" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Sjena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Siodłowy brąz" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Brązowy" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Różowobrązowy" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Łososiowy" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Jasnołososiowy" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Ciemnołososiowy" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Piaskowobrązowy" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Koralowy" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Jasnokoralowy" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Indyjskoczerwony" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Ciemnoczerwony" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Kasztanowy" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Zielonożółty" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Żółtozielony" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Trawnikowozielony" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Limonkowozielony" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Wiosennozielony" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Średni wiosennozielony" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Limonkowy" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Leśnozielony" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Ciemnozielony" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Wojskowooliwkowy" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliwkowy" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Ciemny oliwkowozielony" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Bladozielony" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Jasnozielony" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Średni morskozielony" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Morskozielony" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Ciemny morskozielony" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Kadetowoniebieski" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Średni akwamarynowy" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turkusowy" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Średni turkusowy" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Ciemnoturkusowy" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Bladoturkusowy" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Jasny cyjan" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Miętowy krem" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Rosa miodowa" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Akwamarynowy" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Jasny morskozielony" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Ciemny cyjan" +# AI Translated +# Needs human review: CSS color kept in English; no distinct Polish name found; check. msgid "Teal" -msgstr "" +msgstr "Teal" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Ciemny łupkowoszary" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Jasny łupkowoszary" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Łupkowoszary" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Intensywny błękit nieba" +# AI Translated +# Needs human review: CSS color name; proper name kept. msgid "Dodger Blue" -msgstr "" +msgstr "Niebieski Dodger" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Błękit nieba" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Jasny błękit nieba" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Jasnoniebieski" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Pudrowoniebieski" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Jasny stalowoniebieski" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Stalowoniebieski" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Chabrowy" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Królewski niebieski" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Średni niebieski" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Północnoniebieski" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Ciemnoniebieski" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Granatowy" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Łupkowoniebieski" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Ciemny łupkowoniebieski" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Średni łupkowoniebieski" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Niebieskofioletowy" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indygo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Ciemnofioletowy" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Ciemna orchidea" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Średnia orchidea" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orchidea" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Fioletowy" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Średni purpurowy" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Purpurowy" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Purpurowy Rebecca" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Średni fioletowoczerwony" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Blady fioletowoczerwony" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Intensywny różowy" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Jaskraworóżowy" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Jasnoróżowy" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Różowy" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Śliwkowy" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Ostowy" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuksjowy" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Ciemna magenta" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Lniany" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Stara koronka" +# AI Translated +# Needs human review: CSS color Seashell; the glossary Shell term does not apply (false match). msgid "Sea shell" -msgstr "" +msgstr "Muszlowy" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Kość słoniowa" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Kwiatowa biel" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lawendowy róż" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Widmowa biel" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Błękit Alicji" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lawendowy" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Dymna biel" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Czarny" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Koralowy ogień" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Ukwiał" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Głęboka otchłań" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Homarowa czerwień" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Piaszczysta glina" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Wyrzucone drewno" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Rokitnik" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Rafa o zachodzie słońca" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tygrysi koral" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Różowy koral" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Blask muszli" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Piasek" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Złote wodorosty" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Wydma w słońcu" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Bursztynowy łodzik" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Morska cytryna" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Blada rozgwiazda" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Wiosenny przypływ" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Limonkowe algi" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Trawa morska" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neonowy plankton" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Las wodorostów" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Szmaragdowa fala" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Cień wieloryba" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Żółw morski" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Laguna" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Tropikalny prąd" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Północny rów" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Ciemne wodorosty" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Kryształowy przybój" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Turkusowa zatoka" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Niebo nad rafą" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Płytkie niebo" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektryczny błękit" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfin" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Głębiny oceanu" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Wieloryb" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indygowa otchłań" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Jeżowiec" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Lawendowy koral" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Fioletowy przypływ" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Głębinowa orchidea" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neonowa meduza" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuksjowy koral" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Różowa meduza" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Piana" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Muszlowa biel" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Otoczakowoszary" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Burzowa chmura" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Atramentowa czerń" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Zielonobeżowy" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Piaskowożółty" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Sygnałowy żółty" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Złotożółty" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Miodowożółty" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Kukurydzianożółty" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Narcyzowożółty" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Brązowobeżowy" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Cytrynowożółty" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Ostrygowa biel" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Jasna kość słoniowa" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Cynkowożółty" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Szarobeżowy" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Oliwkowożółty" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Rzepakowożółty" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Drogowy żółty" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Ochrowożółty" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Drogowy pomarańczowożółty" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Melonowożółty" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Żarnowcowożółty" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Daliowożółty" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pastelowożółty" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Perłowy beżowy" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Perłowy złoty" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Słonecznożółty" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Żółtopomarańczowy" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Intensywny pomarańczowy" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Cynober" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Perłowy pomarańczowy" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Czysty pomarańczowy" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Jaskrawy pomarańczowy" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Jaskrawy jasnopomarańczowy" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Jasny czerwonopomarańczowy" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Drogowy pomarańczowy" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Sygnałowy pomarańczowy" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Łososiowopomarańczowy" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Perłowy różowy" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Miedzianopomarańczowy" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Sygnałowy brązowy" +# AI Translated +# Needs human review: RAL color name, probably a typo of the source; rendering follows the English literally. msgid "Fir orange" -msgstr "" +msgstr "Jodłowopomarańczowy" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Sygnałowy czerwony" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Jaskrawy czerwony" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karminowoczerwony" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Perłowy karminowoczerwony" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Czysty czerwony" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Jaskrawy intensywnoczerwony" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Porzeczkowoczerwony" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Perłowy rubinowoczerwony" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Ognistoczerwony" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rubinowoczerwony" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Purpurowoczerwony" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Winnoczerwony" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Czarnoczerwony" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Tlenkowoczerwony" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Brązowoczerwony" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Sosnowoczerwony" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Pomidorowoczerwony" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Staroróżowy" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Koralowoczerwony" +# AI Translated +# Needs human review: RAL color name; rendered as 'różany' to stay distinct from 'Pink'. msgid "Rose" -msgstr "" +msgstr "Różany" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Truskawkowoczerwony" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Drogowy czerwony" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Łososioworóżowy" +# AI Translated +# Needs human review: RAL color name; 'Rose' rendered as 'różany'. msgid "Luminous rose" -msgstr "" +msgstr "Jaskrawy różany" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Jaskrawy jasnoczerwony" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Malinowoczerwony" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Orientalny czerwony" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Perłowy rubinowy" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Czerwonopurpurowy" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Czerwonofioletowy" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Wrzosowofioletowy" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordowofioletowy" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Mahoniowy" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Szaropurpurowy" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Sygnałowy fioletowy" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Jodłowozielony" +# AI Translated +# Needs human review: RAL color name; check. msgid "Sabine grey" -msgstr "" +msgstr "Sabiński szary" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Perłowy fioletowy" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Perłowy jeżynowy" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Zielononiebieski" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarynowy" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Szafirowy" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Czarnoniebieski" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Sygnałowy niebieski" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Brylantowoniebieski" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Szaroniebieski" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Lazurowy" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Goryczkowoniebieski" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobaltowy" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Gołębioniebieski" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Drogowy niebieski" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Turkusowoniebieski" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Niebieski Capri" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Oceanicznoniebieski" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Wodnoniebieski" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Nocnoniebieski" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Odległy niebieski" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pastelowoniebieski" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Perłowy goryczkowoniebieski" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Perłowy północnoniebieski" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patynowozielony" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Szmaragdowozielony" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Liściastozielony" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Oliwkowozielony" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Niebieskozielony" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Mchowozielony" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Szarooliwkowy" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Sosnowozielony" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Sosnowobrązowy" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Trawiastozielony" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Rezedowozielony" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Brązowozielony" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Trzcinowozielony" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Czarnozielony" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Turkusowozielony" +# AI Translated msgid "May green" -msgstr "" +msgstr "Majowozielony" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Zielony tlenek chromu" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Drogowy zielony" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Paprociowozielony" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opalowozielony" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Miętowozielony" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Spiżowozielony" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Perłowy zielony" +# AI Translated +# Needs human review: RAL color name; 'Sax' may be Saxon or sax blue; check. msgid "Sax turquoise" -msgstr "" +msgstr "Turkusowy Sax" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Perłowy turkusowy" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Perłowy nefrytowy" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Czysty zielony" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Jaskrawy zielony" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Wiewiórkowoszary" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Srebrnoszary" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Oliwkowoszary" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Mchowoszary" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Sygnałowy szary" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Mysioszary" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Beżowoszary" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Szary khaki" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Zielonoszary" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Brezentowoszary" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Żelazoszary" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Bazaltowoszary" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Brązowoszary" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Łupkowoszary" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antracytowoszary" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Jasnoszary" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umbrowoszary" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Betonowoszary" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafitowoszary" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Granitowoszary" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Kamiennoszary" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Otoczakowoszary" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Cementowoszary" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Żółtoszary" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platynowoszary" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Pyłowoszary" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Agatowoszary" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Kwarcowoszary" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Okiennoszary" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Drogowy szary A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Drogowy szary B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Jedwabnoszary" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telszary 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telszary 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telszary 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Perłowy mysioszary" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Zielonobrązowy" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Ochrowobrązowy" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Glinianobrązowy" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Miedzianobrązowy" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Czekoladowobrązowy" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Oliwkowobrązowy" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Orzechowobrązowy" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Czerwonobrązowy" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sepiowobrązowy" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Kasztanowobrązowy" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Mahoniowobrązowy" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Szarobrązowy" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Perłowy miedziany" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Beżowobrązowy" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Perłowy mokkowobrązowy" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Ziemistobrązowy" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Perłowy brązowy" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Kremowy" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Szarobiały" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Biel sygnałowa" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Czerń sygnałowa" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Głęboka czerń" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Białe aluminium" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Szare aluminium" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Czysta biel" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Czerń grafitowa" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Biel drogowa" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Czerń drogowa" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Biel papirusowa" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Perłowy jasnoszary" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metal: Srebro" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metal: Mosiądz" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metal: Złoto" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metal: Miedź" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metal: Brąz" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Natura: Perła" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Natura: Tęcza" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Natura: Czyste niebo" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Natura: Zachód słońca" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Drewno: Ciemne" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Drewno: Średnie" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Drewno: Jasne" msgid "Alternate nozzles:" msgstr "Inne rozmiary dysz:" @@ -32965,13 +33406,25 @@ msgstr "Usuń z Moich tekstur" msgid "Built-in" msgstr "Wbudowane" +# AI Translated +msgid "My textures" +msgstr "Moje tekstury" + # AI Translated msgid "No textures found." msgstr "Nie znaleziono tekstur." # AI Translated -msgid "My textures" -msgstr "Moje tekstury" +msgid "Texture libraries" +msgstr "Biblioteki tekstur" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Przeglądaj więcej bibliotek tekstur" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Otwiera OrcaCloud na stronie głównej, aby przeglądać wtyczki." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33374,11 +33827,15 @@ msgstr "Mapowanie według własnego układu UV modelu, który już stanowi rozmi msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Szerokość jednej kopii tekstury na modelu. Mniejsza wartość częściej powtarza wzór, a jego szczegóły stają się drobniejsze; przy wyłączonym Kafelkowaniu jest to rozmiar pojedynczej kopii." +# AI Translated +# Needs human review: Label on the tile-size tip image; check gender agreement with 'tile' (kafelek). msgid "Larger" -msgstr "" +msgstr "Większy" +# AI Translated +# Needs human review: Label on the tile-size tip image; check gender agreement with 'tile' (kafelek). msgid "Smaller" -msgstr "" +msgstr "Mniejszy" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33454,11 +33911,15 @@ msgstr "Kolory mieszane" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Maksymalna liczba filamentów mieszanych, które może dodać wypiekanie. Są wybierane z kolorów tekstury, a tworzone są tylko te, których wypiekanie faktycznie używa." +# AI Translated +# Needs human review: Label on the mixed-colors tip image (few vs many colors); check it reads right. msgid "Few" -msgstr "" +msgstr "Mało" +# AI Translated +# Needs human review: Label on the mixed-colors tip image (few vs many colors); check it reads right. msgid "Many" -msgstr "" +msgstr "Dużo" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33819,11 +34280,13 @@ msgstr "Przebudowa siatki" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Rozmiar trójkątów, z jakim przebudowywany jest cały model, w milimetrach. Przemieszczenie działa najlepiej na równomiernej siatce; to ustawienie tworzy ją z nierównomiernego importu." +# AI Translated msgid "Before" -msgstr "" +msgstr "Przed" +# AI Translated msgid "After" -msgstr "" +msgstr "Po" # AI Translated msgid "Keep sharp edges" @@ -35694,6 +36157,10 @@ msgstr "Skrypt" msgid "Slicing Pipeline" msgstr "Potok cięcia" +# AI Translated +msgid "Resource Texture" +msgstr "Tekstura zasobu" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Interfejs konfiguracji wtyczki był pusty. Wyświetlany jest domyślny edytor." @@ -35841,6 +36308,30 @@ msgstr "Katalog wtyczki zawiera zarówno plik wejściowy .py, jak i .whl" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Katalog wtyczki nie zawiera pliku wejściowego .py ani .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Katalog tekstury zasobu nie jest ustawiony" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Nie udało się ustalić katalogu tekstury zasobu" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Ścieżka tekstury zasobu nie jest katalogiem" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Nie udało się ustalić folderu wtyczki" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Katalog tekstury zasobu znajduje się poza folderem wtyczki" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Nie udało się odczytać katalogu tekstury zasobu" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36789,6 +37280,27 @@ msgstr "" "Unikaj odkształceń\n" "Czy wiesz, że podczas drukowania filamentami podatnymi na odkształcenia, takimi jak ABS, odpowiednie zwiększenie temperatury podgrzewanej płyty może zmniejszyć prawdopodobieństwo odkształceń?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Dalmatyński żółty" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Kapsantynowofioletowy" + +# AI Translated +# Needs human review: RAL color name written as one word in the source; check. +#~ msgid "Olivestone" +#~ msgstr "Oliwkowy kamień" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Dostępne w dowolnym miejscu okna, nawet podczas wpisywania tekstu w polu tekstowym." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Skróty globalne działają także podczas pisania." + #~ msgid "Please choose the filament color" #~ msgstr "Proszę wybrać kolor filamentu" diff --git a/localization/i18n/pt_BR/OrcaSlicer_pt_BR.po b/localization/i18n/pt_BR/OrcaSlicer_pt_BR.po index 697f0f625d..d2491b3d4c 100644 --- a/localization/i18n/pt_BR/OrcaSlicer_pt_BR.po +++ b/localization/i18n/pt_BR/OrcaSlicer_pt_BR.po @@ -3,8 +3,8 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" -"PO-Revision-Date: 2026-10-17 10:38-0300\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" +"PO-Revision-Date: 2026-10-21 19:32-0300\n" "Last-Translator: Alexandre Folle de Menezes\n" "Language-Team: Portuguese, Brazilian\n" "Language: pt_BR\n" @@ -354,7 +354,7 @@ msgstr "Por favor, aguarde" #. TRN %d/%d is the hotend being read and the number of hotends to read. #, c-format, boost-format msgid "Induction Hotend Rack: Reading %d/%d" -msgstr "Suporte para Hotend por Indução: lendo %d/%d" +msgstr "Suporte para Hotend por Indução: Lendo %d/%d" msgid "Running..." msgstr "Executando…" @@ -505,7 +505,6 @@ msgstr "Gizmo-Posicionar na face" msgid "Lay on Face" msgstr "Apoiar na Face" -# AI Translated #, boost-format msgid "Filament count exceeds the maximum number that painting tool supports. Only the first %1% filament will be available in painting tool." msgid_plural "Filament count exceeds the maximum number that painting tool supports. Only the first %1% filaments will be available in painting tool." @@ -561,7 +560,6 @@ msgctxt "Keyboard Shortcut" msgid "Enter" msgstr "Enter" -# AI Translated #, c-format, boost-format msgid "Shortcut Key %d" msgstr "Tecla de atalho %d" @@ -726,62 +724,50 @@ msgid "Plate" msgstr "Placa" msgid "Distribute" -msgstr "" +msgstr "Distribuir" msgid "Coordinate system used for transform actions." msgstr "Sistema de coordenadas usado para ações de transformação." msgid "Reference for alignment" -msgstr "" +msgstr "Referência para o alinhamento" msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Selecione pelo menos 3 peças ou objetos" -# AI Translated msgid "Align left" msgstr "Alinhar à esquerda" -# AI Translated msgid "Align left-right center" msgstr "Alinhar ao centro esquerda-direita" -# AI Translated msgid "Align right" msgstr "Alinhar à direita" -# AI Translated msgid "Align front" msgstr "Alinhar à frente" -# AI Translated msgid "Align front-back center" msgstr "Alinhar ao centro frente-trás" -# AI Translated msgid "Align back" msgstr "Alinhar atrás" -# AI Translated msgid "Align bottom" msgstr "Alinhar embaixo" -# AI Translated msgid "Align top-bottom center" msgstr "Alinhar ao centro cima-baixo" -# AI Translated msgid "Align top" msgstr "Alinhar em cima" -# AI Translated msgid "Distribute left-right" msgstr "Distribuir esquerda-direita" -# AI Translated msgid "Distribute front-back" msgstr "Distribuir frente-trás" -# AI Translated msgid "Distribute top-bottom" msgstr "Distribuir cima-baixo" @@ -789,7 +775,7 @@ msgid "Drop" msgstr "Descartar" msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Move a seleção ao longo de Z para que seu ponto mais baixo toque a mesa." msgid "Absolute" msgstr "Absoluto" @@ -1060,7 +1046,6 @@ msgstr "Plano de corte com cavidade é inválido" msgid "Connector" msgstr "Conector" -# AI Translated #, boost-format msgid "" "Object (%1%) has duplicated connectors. Some connectors may be missing in slicing result.\n" @@ -1140,7 +1125,6 @@ msgstr "Baixo" msgid "Extra low" msgstr "Extra baixo" -# AI Translated #, boost-format msgid "%1% triangle" msgid_plural "%1% triangles" @@ -1156,16 +1140,14 @@ msgstr "Não é possível aplicar quando a pré-visualização está em processa msgid "Operation already cancelling. Please wait a few seconds." msgstr "Operação já está sendo cancelada. Por favor, aguarde alguns segundos." -# AI Translated msgid "Model simplification has been canceled" msgstr "A simplificação do modelo foi cancelada" msgid "Wiki Guide" msgstr "Guia Wiki" -# AI Translated msgid "Video Guide" -msgstr "Guia em vídeo" +msgstr "Guia em Vídeo" msgid "Enforce seam" msgstr "Forçar costura" @@ -1217,11 +1199,9 @@ msgstr "Posição na superfície" msgid "Emboss" msgstr "Relevo" -# AI Translated msgid "No active font in style. Select correct one." msgstr "Nenhuma fonte ativa no estilo. Selecione a correta." -# AI Translated msgid "WxFont is not loaded properly." msgstr "A WxFont não foi carregada corretamente." @@ -1635,16 +1615,16 @@ msgstr "Opacidade (%1%)" #, boost-format msgid "Color gradient (%1%)" -msgstr "Gradiente de cor (%1%)" +msgstr "Degradê de cor (%1%)" msgid "Undefined fill type" msgstr "Tipo de preenchimento indefinido" msgid "Linear gradient" -msgstr "Gradiente linear" +msgstr "Degradê linear" msgid "Radial gradient" -msgstr "Gradiente radial" +msgstr "Degradê radial" msgid "Open filled path" msgstr "Caminho preenchido aberto" @@ -1868,23 +1848,18 @@ msgstr "Diâmetro" msgid "Length" msgstr "Comprimento" -# AI Translated msgid "Face 1 (Fixed)" msgstr "Face 1 (Fixa)" -# AI Translated msgid "Face 2 (Moving)" msgstr "Face 2 (Movendo)" -# AI Translated msgid "Point 1 (Fixed)" msgstr "Ponto 1 (Fixo)" -# AI Translated msgid "Point 2 (Moving)" msgstr "Ponto 2 (Movendo)" -# AI Translated msgid "Selection 1" msgstr "Seleção 1" @@ -1902,7 +1877,6 @@ msgstr "" "Selecione 2 pontos ou círculos em objetos\n" "e especifique a distância entre eles." -# AI Translated msgid "Selection 2" msgstr "Seleção 2" @@ -2002,16 +1976,16 @@ msgid "Leaving Assembly gizmo" msgstr "Saindo do gizmo de Montagem" msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "As peças de um objeto cortado não podem ser movidas" msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "O alinhamento à placa está disponível apenas em X e Y" msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Desative a Soltura Automática dos objetos selecionados para movê-los em Z" msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Todos os objetos selecionados devem estar na mesma placa" msgid "Shift+" msgstr "Shift+" @@ -2054,7 +2028,6 @@ msgstr "O pacote de configuração foi carregado, mas alguns valores não foram msgid "The configuration file “%1%” was loaded, but some values were not recognized." msgstr "O arquivo de configuração \"%1%\" foi carregado, mas alguns valores não foram reconhecidos." -# AI Translated #, c-format, boost-format msgid "" "\"%s\" is not a plain document, image or model file. Opening it may run it as a program or script on this computer.\n" @@ -2186,7 +2159,6 @@ msgstr "" msgid "WebView2 Runtime" msgstr "Tempo de execução WebView2" -# AI Translated #, boost-format msgid "" "The Microsoft WebView2 Runtime could not be installed.\n" @@ -2195,7 +2167,7 @@ msgid "" msgstr "" "Não foi possível instalar o Microsoft WebView2 Runtime.\n" "Alguns recursos, incluindo o assistente de configuração, podem aparecer em branco até que ele seja instalado.\n" -"Instale-o manualmente a partir de %1% e reinicie o Orca Slicer." +"Instale-o manualmente a partir de %1% e reinicie o OrcaSlicer." #, c-format, boost-format msgid "Resources path does not exist or is not a directory: %s" @@ -2413,15 +2385,12 @@ msgstr "Restrição de Plug-in de Rede" msgid "Privacy Policy Update" msgstr "Atualização da Política de Privacidade" -# AI Translated msgid "All your filament presets are available on the printers they were made for." msgstr "Todas as suas predefinições de filamento estão disponíveis nas impressoras para as quais foram criadas." -# AI Translated msgid "Migrate Filament Presets" msgstr "Migrar Predefinições de Filamento" -# AI Translated msgid "" "OrcaSlicer 2.5.0 restructured many system filament presets to fix incorrect profiles and prepare for future features. As a result, the presets below no longer show on some printers they were made for. Sorry for the trouble; this is a one-time fix.\n" "\n" @@ -2429,9 +2398,8 @@ msgid "" msgstr "" "O OrcaSlicer 2.5.0 reestruturou muitas predefinições de filamento do sistema para corrigir perfis incorretos e preparar recursos futuros. Como resultado, as predefinições abaixo não aparecem mais em algumas das impressoras para as quais foram criadas. Pedimos desculpas pelo transtorno; esta é uma correção única.\n" "\n" -"Adicionar essas impressoras de volta às suas predefinições agora? É feito um backup das suas predefinições antes. Você também pode fazer isso mais tarde em Ajuda > Migrar Predefinições de Filamento." +"Adicionar essas impressoras de volta às suas predefinições agora? Será feito um backup das suas predefinições antes. Você também pode fazer isso mais tarde em Ajuda > Migrar Predefinições de Filamento." -# AI Translated #, boost-format msgid "%1% (based on %2%)" msgstr "%1% (baseado em %2%)" @@ -2439,15 +2407,12 @@ msgstr "%1% (baseado em %2%)" msgid "Don't remind me again" msgstr "Não me avise novamente" -# AI Translated msgid "Your presets could not be backed up, so they were not migrated." msgstr "Não foi possível fazer backup das suas predefinições, então elas não foram migradas." -# AI Translated msgid "The user presets folder could not be locked, so nothing was migrated. Another OrcaSlicer instance may be saving presets; try again later from Help > Migrate Filament Presets." -msgstr "Não foi possível bloquear a pasta de predefinições do usuário, então nada foi migrado. Outra instância do OrcaSlicer pode estar salvando predefinições; tente novamente mais tarde em Ajuda > Migrar Predefinições de Filamento." +msgstr "Não foi possível travar a pasta de predefinições do usuário, então nada foi migrado. Outra instância do OrcaSlicer pode estar salvando predefinições; tente novamente mais tarde em Ajuda > Migrar Predefinições de Filamento." -# AI Translated #, boost-format msgid "" "Your filament presets could not be migrated. A backup of your presets was saved to:\n" @@ -2469,7 +2434,6 @@ msgstr "" "Um backup das suas predefinições foi salvo em:\n" "%1%" -# AI Translated msgid "These presets could not be migrated:" msgstr "Não foi possível migrar estas predefinições:" @@ -2545,7 +2509,6 @@ msgstr "%s foi removido." msgid "Switching Orca Slicer to language %s failed." msgstr "Falha ao mudar o idioma do OrcaSlicer para %s." -# AI Translated msgid "" "\n" "You may need to reconfigure the missing locales, likely by running the \"locale-gen\" and \"dpkg-reconfigure locales\" commands.\n" @@ -2553,7 +2516,6 @@ msgstr "" "\n" "Você pode precisar reconfigurar as localidades ausentes, provavelmente executando os comandos \"locale-gen\" e \"dpkg-reconfigure locales\".\n" -# AI Translated msgid "Application will close." msgstr "O aplicativo será fechado." @@ -2577,7 +2539,6 @@ msgstr "" msgid "Failed to open the Plugins dialog (unknown error)." msgstr "Falha ao abrir a caixa de diálogo de Plugins (erro desconhecido)." -# AI Translated msgid "Plugins refreshed." msgstr "Plugins atualizados." @@ -2591,7 +2552,6 @@ msgstr "Erro desconhecido" msgid "Select plugin package" msgstr "Selecione o pacote de plugins" -# AI Translated msgid "Plugin files (*.py;*.whl)|*.py;*.whl" msgstr "Arquivos de plugin (*.py;*.whl)|*.py;*.whl" @@ -2713,9 +2673,8 @@ msgstr "Adicionar Bloqueador de Suporte" msgid "Add Support Enforcer" msgstr "Adicionar Reforço de Suporte" -# AI Translated msgid "Add Precise Seam" -msgstr "Adicionar costura precisa" +msgstr "Adicionar Costura Precisa" msgid "Add text" msgstr "Adicionar texto" @@ -2837,9 +2796,8 @@ msgstr "Bloqueador de Suporte" msgid "Support Enforcer" msgstr "Reforço de Suporte" -# AI Translated msgid "Precise Seam" -msgstr "Costura precisa" +msgstr "Costura Precisa" msgid "Change part type" msgstr "Mudar tipo de peça" @@ -2983,33 +2941,26 @@ msgstr "Espelhar ao longo do Eixo Z" msgid "Mirror object" msgstr "Espelhar objeto" -# AI Translated msgid "Precise Seam Type" -msgstr "Tipo de costura precisa" +msgstr "Tipo de Costura Precisa" -# AI Translated msgid "Seam Center" -msgstr "Costura no centro" +msgstr "Costura no Centro" -# AI Translated msgid "Seam Left" -msgstr "Costura à esquerda" +msgstr "Costura à Esquerda" -# AI Translated msgid "Seam Right" -msgstr "Costura à direita" +msgstr "Costura à Direita" -# AI Translated msgid "Seam Enforced" -msgstr "Costura forçada" +msgstr "Costura Forçada" -# AI Translated msgid "Seam Blocked" -msgstr "Costura bloqueada" +msgstr "Costura Bloqueada" -# AI Translated msgid "Seam Neutral" -msgstr "Costura neutra" +msgstr "Costura Neutra" # AI Translated msgid "Choose precise seam subtype" @@ -3108,19 +3059,15 @@ msgstr "Recarregar Tudo" msgid "Reload all from disk" msgstr "Recarregar tudo do disco" -# AI Translated msgid "Fix All" msgstr "Corrigir Tudo" -# AI Translated msgid "Fix all models on the current plate" msgstr "Corrigir todos os modelos na placa atual" -# AI Translated msgid "Fix All Plates" msgstr "Corrigir Todas as Placas" -# AI Translated msgid "Fix all models on all plates" msgstr "Corrigir todos os modelos em todas as placas" @@ -3175,11 +3122,9 @@ msgstr "(Cor perdida)" msgid "Center" msgstr "Centralizar" -# AI Translated msgid "Align/Distribute" msgstr "Alinhar/Distribuir" -# AI Translated msgid "Align and distribute objects" msgstr "Alinhar e distribuir objetos" @@ -3273,7 +3218,6 @@ msgstr "Renomear Peça" msgid "Paste settings" msgstr "Colar configurações" -# AI Translated msgid "Shift objects to bed" msgstr "Deslocar objetos para a mesa" @@ -3378,7 +3322,6 @@ msgstr "Montagem" msgid "Merge parts to an object" msgstr "Mesclar peças com um objeto" -# AI Translated msgid "Using variable layer height together with mixed color sublayer may result in poor color mixing quality." msgstr "Usar altura de camada variável junto com a subcamada de cor mista pode resultar em uma mistura de cores de baixa qualidade." @@ -3439,9 +3382,8 @@ msgstr "Tipo:" msgid "Choose part type" msgstr "Escolha o tipo de peça" -# AI Translated msgid "Instances to Separated Objects" -msgstr "Instâncias para objetos separados" +msgstr "Instâncias para Objetos Separados" msgid "Enter new name" msgstr "Digite um novo nome" @@ -3459,7 +3401,6 @@ msgid_plural "Failed to repair the following model objects" msgstr[0] "Falha ao reparar o seguinte objeto modelo" msgstr[1] "Falha ao reparar os seguintes objetos modelo" -# AI Translated #, c-format, boost-format msgid "%1$d model object needed no repair." msgid_plural "%1$d model objects needed no repair." @@ -3705,7 +3646,6 @@ msgstr "Mudar Mesmo Assim" msgid "Off" msgstr "Desligado" -# AI Translated msgctxt "air_duct" msgid "Filter" msgstr "Filtro" @@ -3819,12 +3759,10 @@ msgstr "Confirmar extrusão" msgid "Check filament location" msgstr "Verificar localização do filamento" -# AI Translated msgctxt "Verb" msgid "Pause" msgstr "Pausar" -# AI Translated #. TRN Filament change step: the printer switches to the other extruder. msgid "Switch extruder" msgstr "Trocar extrusora" @@ -3837,7 +3775,6 @@ msgstr "Trocar hotend" msgid "Wait for AMS cooling" msgstr "Aguardar resfriamento do AMS" -# AI Translated msgid "Switch current filament at Filament Track Switch" msgstr "Trocar o filamento atual no Filament Track Switch" @@ -3845,22 +3782,18 @@ msgstr "Trocar o filamento atual no Filament Track Switch" msgid "Pull back current filament at Filament Track Switch" msgstr "Recuar o filamento atual no Filament Track Switch" -# AI Translated msgid "Switch track at Filament Track Switch" msgstr "Trocar de trilha no Filament Track Switch" -# AI Translated #. TRN AMS unit number, then slot number #, c-format, boost-format msgid "AMS-%d-%d Slot" msgstr "Espaço AMS-%d-%d" -# AI Translated #, c-format, boost-format msgid "The maximum temperature cannot exceed %d" msgstr "A temperatura máxima não pode exceder %d" -# AI Translated #, c-format, boost-format msgid "The minimum temperature should not be less than %d" msgstr "A temperatura mínima não pode ser menor do que %d" @@ -3963,7 +3896,6 @@ msgstr "Sua impressora tem diferentes bico instalados. Selecione um bico para e msgid "Ignore" msgstr "Ignorar" -# AI Translated msgid "unknown" msgstr "desconhecido" @@ -3990,7 +3922,6 @@ msgstr "" msgid "Arranging..." msgstr "Organizando…" -# AI Translated #, c-format, boost-format msgid "Object %s has zero size and can't be arranged." msgstr "O objeto %s tem tamanho zero e não pode ser organizado." @@ -3998,7 +3929,6 @@ msgstr "O objeto %s tem tamanho zero e não pode ser organizado." msgid "Arranging" msgstr "Organizando" -# AI Translated #. TRN Progress status. %1% is the name of the object being arranged. #, boost-format msgid "Arranging %1%" @@ -4041,7 +3971,6 @@ msgstr "" msgid "Orienting..." msgstr "Orientando…" -# AI Translated #. TRN Progress status. %1% is the name of the object being oriented. #, boost-format msgid "Orienting %1%" @@ -4053,7 +3982,6 @@ msgstr "Orientação cancelada." msgid "Filling" msgstr "Preenchendo" -# AI Translated #. TRN Progress status of Fill bed. %1% is the name of the object being copied. #, boost-format msgid "Filling %1%" @@ -4074,20 +4002,16 @@ msgstr "Busca de orientação cancelada." msgid "Orientation found." msgstr "Orientação encontrada." -# AI Translated msgid "Best surface quality" msgstr "Melhor qualidade de superfície" -# AI Translated msgid "Optimize object rotation for best surface quality." msgstr "Otimiza a rotação do objeto para a melhor qualidade de superfície." -# AI Translated # Needs human review: Option name in the Optimize Rotation menu (RotoptimizeJob); check it reads as a choice next to the other options. msgid "Reduced overhang slopes" msgstr "Inclinações de saliência reduzidas" -# AI Translated msgid "" "Optimize object rotation to have minimum amount of overhangs needing support structures.\n" "Note that this method will try to find the best surface of the object for touching the print bed if no elevation is set." @@ -4095,11 +4019,9 @@ msgstr "" "Otimiza a rotação do objeto para ter a mínima quantidade de saliências que precisam de estruturas de suporte.\n" "Observe que este método tentará encontrar a melhor superfície do objeto para tocar a mesa se nenhuma elevação estiver definida." -# AI Translated msgid "Lowest Z height" msgstr "Menor altura Z" -# AI Translated msgid "Rotate the model to have the lowest z height for faster print time." msgstr "Gira o modelo para obter a menor altura Z e um tempo de impressão menor." @@ -4215,14 +4137,12 @@ msgstr "O Armazenamento na impressora está anormal. Substitua-o por um Armazena msgid "The Storage in the printer is read-only. Please replace it with a normal Storage before sending to printer." msgstr "O Armazenamento na impressora é somente para leitura. Substitua-o por um Armazenamento normal antes de enviar para a impressora." -# AI Translated msgid "Can't create empty volume." msgstr "Não é possível criar um volume vazio." msgid "Bad input data for EmbossCreateObjectJob." msgstr "Dados de entrada inválidos para EmbossCreateObjectJob." -# AI Translated msgid "Can't create empty object." msgstr "Não é possível criar um objeto vazio." @@ -4241,11 +4161,9 @@ msgstr "Dados de entrada inválidos para CreateSurfaceVolumeJob." msgid "Bad input data for UseSurfaceJob." msgstr "Dados de entrada inválidos para UseSurfaceJob." -# AI Translated msgid "It is used default volume for embossed text, try to change text or font to fix it." msgstr "Foi usado o volume padrão para o texto em relevo; tente alterar o texto ou a fonte para corrigir isso." -# AI Translated msgid "Empty mesh can't be created." msgstr "Não é possível criar uma malha vazia." @@ -4254,7 +4172,6 @@ msgstr "Não é possível criar uma malha vazia." msgid "Emboss attribute change" msgstr "Alteração do atributo de relevo" -# AI Translated msgid "Bad object to create volume." msgstr "Objeto inválido para criar o volume." @@ -4353,7 +4270,6 @@ msgstr "Este software utiliza componentes open source cujos direitos autorais e msgid "About %s" msgstr "Sobre %s" -# AI Translated #. TRN %s is the commit the application was built from #, c-format, boost-format msgid "Build %s" @@ -4368,15 +4284,12 @@ msgstr "O OrcaSlicer começou com esse mesmo espírito, inspirando-se no PrusaSl msgid "Today, OrcaSlicer is the most widely used and actively developed open-source slicer in the 3D printing community. Many of its innovations have been adopted by other slicers, making it a driving force for the entire industry." msgstr "Atualmente, o OrcaSlicer é o fatiador de código aberto mais utilizado e ativamente desenvolvido na comunidade de impressão 3D. Muitas de suas inovações foram adotadas por outros fatiadores, tornando-o uma força motriz para toda a indústria." -# AI Translated msgid "Copyright(C) 2026 OrcaSlicer Pte Ltd All Rights Reserved" msgstr "Copyright(C) 2026 OrcaSlicer Pte Ltd Todos os direitos reservados" -# AI Translated msgid "Script plugin skipped." msgstr "Plugin de script ignorado." -# AI Translated msgid "Script plugin finished." msgstr "Plugin de script concluído." @@ -4453,11 +4366,9 @@ msgstr "Por favor insira um valor válido (K entre %.1f~%.1f)" msgid "Please input a valid value (K in %.1f~%.1f, N in %.1f~%.1f)" msgstr "Por favor insira um valor válido (K entre %.1f~%.1f, N entre %.1f~%.1f)" -# AI Translated msgid "Favorite filaments" msgstr "Filamentos favoritos" -# AI Translated msgid "All filaments" msgstr "Todos os filamentos" @@ -4598,22 +4509,18 @@ msgstr "AMS Direito" msgid "Printing with the current nozzle may produce an extra %0.2f g of waste." msgstr "Impressão com o bico atual pode produzir um desperdício extra de %0.2f g." -# AI Translated #, c-format, boost-format msgid "Tips: the filament type(%s) does not match with the filament type(%s) in the slicing file. If you want to use this slot, you can install %s instead of %s and change slot information on the 'Device' page." msgstr "Dicas: o tipo de filamento(%s) não corresponde ao tipo de filamento(%s) no arquivo de fatiamento. Se você quiser usar este slot, pode instalar %s em vez de %s e alterar as informações do slot na página 'Dispositivo'." -# AI Translated #, c-format, boost-format msgid "Cannot select: the filament type(%s) does not match with the filament type(%s) in the slicing file. If you want to use this slot, you can install %s instead of %s and change slot information on the 'Device' page." msgstr "Não é possível selecionar: o tipo de filamento(%s) não corresponde ao tipo de filamento(%s) no arquivo de fatiamento. Se você quiser usar este slot, pode instalar %s em vez de %s e alterar as informações do slot na página 'Dispositivo'." -# AI Translated #, c-format, boost-format msgid "Cannot select: the slot is empty or undefined. If you want to use this slot, you can install %s and change slot information on the 'Device' page." msgstr "Não é possível selecionar: o slot está vazio ou indefinido. Se você quiser usar este slot, pode instalar %s e alterar as informações do slot na página 'Dispositivo'." -# AI Translated msgid "Cannot select: No filament loaded in current slot." msgstr "Não é possível selecionar: nenhum filamento carregado no slot atual." @@ -4776,7 +4683,6 @@ msgstr "O plug-in de rede foi instalado, mas não pôde ser carregado. Reinicie msgid "Restart Required" msgstr "Reinicialização Necessária" -# AI Translated #. TRN %1% marks where the Home button icon is drawn; keep it in the translation. #, boost-format msgid "Please home all axes (click %1%) to locate the toolhead's position. This prevents device moving beyond the printable boundary and causing equipment wear." @@ -4795,7 +4701,6 @@ msgstr "Ocorreu um erro fatal: \"%1%\"" msgid "Please save your project and restart the application." msgstr "Por favor, salve seu projeto e reinicie a aplicação." -# AI Translated msgid "Unknown C++ exception." msgstr "Exceção C++ desconhecida." @@ -5001,16 +4906,13 @@ msgstr "A temperatura da câmara atual está mais alta do que a temperatura segu msgid "The minimal chamber temperature (%d℃) is higher than the target chamber temperature (%d℃). The minimal value is the threshold at which printing starts while the chamber keeps heating toward the target, so it should not exceed it. It will be clamped to the target." msgstr "A temperatura mínima da câmara (%d℃) é superior à temperatura alvo da câmara (%d℃). O valor mínimo é o limite no qual a impressão começa enquanto a câmara continua aquecendo em direção ao alvo; portanto, não deve execedê-lo. O valor será limitado ao alvo." -# AI Translated #, c-format, boost-format msgid "Layer height is too small. It will be set to the minimum (%g mm)." msgstr "A altura da camada é muito pequena. Ela será definida para o mínimo (%g mm)." -# AI Translated msgid "Layer height is outside the limits set in Printer Settings -> Extruder -> Layer height limits, this may cause printing quality issues." msgstr "A altura da camada está fora dos limites definidos em Configurações da Impressora -> Extrusora -> Limites de altura da camada, isso pode causar problemas de qualidade de impressão." -# AI Translated #, c-format, boost-format msgid "Adjust it to the limit (%g mm) automatically?" msgstr "Ajustar automaticamente para o limite (%g mm)?" @@ -6050,31 +5952,24 @@ msgstr "Aumentar/diminuir área de edição" msgid "Sequence" msgstr "Sequência" -# AI Translated msgid "Plate center of mass" msgstr "Centro de massa da placa" -# AI Translated msgid "Part center of mass" msgstr "Centro de massa da peça" -# AI Translated msgid "Support center of mass" msgstr "Centro de massa do suporte" -# AI Translated msgid "Assembly center of mass" msgstr "Centro de massa da montagem" -# AI Translated msgid "Object center of mass" msgstr "Centro de massa do objeto" -# AI Translated msgid "Finished print" msgstr "Impressão concluída" -# AI Translated #, boost-format msgid "Printed up to layer %1%" msgstr "Impresso até a camada %1%" @@ -6085,22 +5980,18 @@ msgstr "Peso" msgid "Volume" msgstr "Volume" -# AI Translated msgid "Center in bounding box" msgstr "Centro na caixa delimitadora" -# AI Translated msgid "Bounding box size" msgstr "Tamanho da caixa delimitadora" -# AI Translated msgid "Moment of inertia" msgstr "Momento de inércia" msgid "Object selection" msgstr "Seleção de objeto" -# AI Translated msgid "1~16 number keys" msgstr "1~16 teclas numéricas" @@ -6305,7 +6196,7 @@ msgid "Gridlines" msgstr "Linhas da Grade" msgid "Focus mode" -msgstr "" +msgstr "Modo focado" msgid "Labels" msgstr "Etiquetas" @@ -6366,7 +6257,7 @@ msgstr "Volume:" msgid "Size:" msgstr "Tamanho:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Foram encontrados conflitos de caminhos de G-code na camada %d, Z = %.2lfmm. Por favor, separe mais os objetos em conflito (%s <-> %s)." @@ -6873,9 +6764,8 @@ msgstr "Editar" msgid "View" msgstr "Visualizar" -# AI Translated msgid "Open Speed Dial" -msgstr "Abrir o Menu rápido" +msgstr "Abrir o Menu Rápido" msgid "Preset Bundle" msgstr "Pacote de Predefinições" @@ -7230,7 +7120,7 @@ msgid "Failed to parse model information." msgstr "Falha ao processar a informação do modelo." msgid "The .gcode.3mf file contains no G-code data. Please slice it with Orca Slicer and export a new .gcode.3mf file." -msgstr "O arquivo .gcode.3mf não contém dados de G-code. Por favor, fatie com Orca Slicer e exporte um novo arquivo .gcode.3mf." +msgstr "O arquivo .gcode.3mf não contém dados de G-code. Por favor, fatie com OrcaSlicer e exporte um novo arquivo .gcode.3mf." #, c-format, boost-format msgid "File '%s' was lost! Please download it again." @@ -9698,8 +9588,6 @@ msgstr "Europa" msgid "North America" msgstr "América do Norte" -# AI Translated -# Needs human review: Region dropdown in Preferences (after Asia-Pacific, China, Europe, North America): feminine 'Outras' agrees with 'regiões'; the generic 'Others' in the catalog is 'Outros'. msgctxt "Region" msgid "Others" msgstr "Outras" @@ -10001,32 +9889,25 @@ msgstr "Gerenciamento de multi dispositivos" msgid "With this option enabled, you can send a task to multiple devices at the same time and manage multiple devices." msgstr "Com esta opção habilitada, você pode enviar uma tarefa para vários dispositivos ao mesmo tempo e gerenciar vários dispositivos." -# AI Translated msgid "Open the Speed Dial from the keyboard" -msgstr "Abrir o Menu rápido pelo teclado" +msgstr "Abrir o Menu Rápido pelo teclado" -# AI Translated msgid "When enabled, the Speed Dial keyboard shortcut (Space by default) opens the action search from any page." -msgstr "Quando ativado, o atalho de teclado do Menu rápido (Espaço por padrão) abre a busca de ações em qualquer página." +msgstr "Quando ativado, o atalho de teclado do Menu Rápido (Espaço por padrão) abre a busca de ações em qualquer página." -# AI Translated msgid "Recent actions" msgstr "Ações recentes" -# AI Translated #. TRN Unit shown after the number of recent actions, as in "5 actions". msgid "actions" msgstr "ações" -# AI Translated msgid "How many recently launched actions to show at the top of the Speed Dial. Set to 0 to hide recent actions." -msgstr "Quantas ações executadas recentemente mostrar no topo do Menu rápido. Defina como 0 para ocultar as ações recentes." +msgstr "Quantas ações executadas recentemente mostrar no topo do Menu Rápido. Defina como 0 para ocultar as ações recentes." -# AI Translated msgid "CAD feature (experimental)" msgstr "Recurso CAD (experimental)" -# AI Translated msgid "With this option enabled, the Design tab is shown, where models can be built and edited parametrically. This feature is experimental and still under development." msgstr "Com esta opção ativada, a aba Design é exibida, onde os modelos podem ser criados e editados parametricamente. Este recurso é experimental e ainda está em desenvolvimento." @@ -10554,11 +10435,13 @@ msgstr "Mostrar predefinições não suportadas" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Exibir predefinições incompatíveis e não suportadas nas listas de impressora e filamento. Essas predefinições não podem ser selecionadas." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Exportar estatísticas com o G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Se ativado, exportar um arquivo G-code também grava suas estatísticas em JSON ao lado dele, como .statistics.json, e um arquivo 3MF fatiado exportado as contém internamente: tempo de impressão, totais de filamento e por tipo de linha, e os mesmos dados por camada e por objeto." msgid "Experimental Features" msgstr "Recursos Experimentais" @@ -11354,6 +11237,10 @@ msgstr "Falha ao enviar o arquivo para o armazenamento da impressora. Tente nova msgid "Send Failed" msgstr "Falha no envio" +# AI Translated +msgid "No available printers" +msgstr "Nenhuma impressora disponível" + msgid "The name length exceeds the limit." msgstr "O comprimento do nome excede o limite." @@ -12977,10 +12864,10 @@ msgid "Custom" msgstr "Personalizado" msgid "Welcome to Orca Slicer" -msgstr "Bem-vindo ao Orca Slicer" +msgstr "Bem-vindo ao OrcaSlicer" msgid "Orca Slicer will be set up in several steps. Let's start!" -msgstr "Orca Slicer será configurado em várias etapas. Vamos começar!" +msgstr "O OrcaSlicer será configurado em várias etapas. Vamos começar!" msgid "Get Started" msgstr "Vamos Começar" @@ -13132,8 +13019,9 @@ msgstr "Tecla" msgid "Left mouse" msgstr "Mouse esquerdo" -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Disponível em qualquer lugar da janela, mesmo ao digitar em um campo de texto." +# AI Translated +msgid "Available anywhere in the window." +msgstr "Disponível em qualquer lugar da janela." msgid "Run favorite 1 to 10" msgstr "Executar favorito 1 a 10" @@ -13229,9 +13117,6 @@ msgstr "%s está atribuído a %s. Reatribuí-lo a %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "O %s padrão está atribuído a %s. Reatribuí-lo a %s?" -msgid "Global shortcuts also apply while typing." -msgstr "Os atalhos globais também funcionam durante a digitação." - msgid "A key that types a character cannot be a global shortcut." msgstr "Uma tecla que digita um caractere não pode ser um atalho global." @@ -13271,7 +13156,7 @@ msgid "Network plug-in update" msgstr "Atualização do plug-in de rede" msgid "Click OK to update the Network plug-in now. If a file is in use, the update will be applied the next time Orca Slicer launches." -msgstr "Clique em OK para atualizar o plug-in de Rede agora. Se um arquivo estiver em uso, a atualização será aplicada na próxima vez que o Orca Slicer for iniciado." +msgstr "Clique em OK para atualizar o plug-in de Rede agora. Se um arquivo estiver em uso, a atualização será aplicada na próxima vez que o OrcaSlicer for iniciado." msgid "A new Network plug-in is available. Do you want to install it?" msgstr "Um novo plug-in de Rede está disponível. Deseja instalá-lo?" @@ -13651,9 +13536,10 @@ msgstr "o modificador \"%1%\" de \"%2%\" (%3% no total) não teve efeito na cost msgid "Seam placement may differ from expected." msgstr "A posição da costura pode diferir do esperado." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Falha ao gravar as estatísticas do G-code em %1%." msgid "Internal Bridge" msgstr "Ponte interna" @@ -13944,7 +13830,7 @@ msgid "\"Leading edge only\" brim applies to belt printers. On this printer it i msgstr "A borda \"Somente bordo de ataque\" se aplica a impressoras de esteira. Nesta impressora, ela é impressa como uma borda externa comum." msgid "A gradient mixed filament is used, but 'Mixed color sublayer' is disabled. The gradient will not be printed." -msgstr "Um filamento misto com gradiente está em uso, mas 'Subcamada de cor mista' está desativado. O gradiente não será impresso." +msgstr "Um filamento misto com degradê está em uso, mas 'Subcamada de cor mista' está desativado. O degradê não será impresso." msgid "Smooth mode of timelapse is not supported when \"by object\" sequence is enabled." msgstr "O modo suave do timelapse não é suportado quando a sequência \"por objeto\" está ativada." @@ -16092,28 +15978,28 @@ msgid "Comma-separated ratio values summing to 1.0, e.g. \"0.7,0.3\"" msgstr "Valores de proporção separados por vírgulas cuja soma seja 1.0; ex.: \"0.7,0.3\"" msgid "Mixed filament gradient" -msgstr "Gradiente do filamento misto" +msgstr "Degradê do filamento misto" msgid "Enable Z-direction gradient mode for mixed filament sub-layers. When enabled, the sub-layer ratios vary linearly across layers." -msgstr "Ativa o modo de gradiente na direção Z para as subcamadas do filamento misto. Quando ativo, as proporções das subcamadas variam linearmente ao longo das camadas." +msgstr "Ativa o modo de degradê na direção Z para as subcamadas do filamento misto. Quando ativo, as proporções das subcamadas variam linearmente ao longo das camadas." msgid "Mixed filament gradient range" -msgstr "Faixa do gradiente do filamento misto" +msgstr "Faixa do degradê do filamento misto" msgid "Start and end ratios for the first component in gradient mode. Comma-separated pair, e.g. \"0.10,0.90\" means 10% to 90%." -msgstr "Proporções inicial e final do primeiro componente no modo de gradiente. Par separado por vírgula; ex.: \"0.10,0.90\" significa de 10% a 90%." +msgstr "Proporções inicial e final do primeiro componente no modo de degradê. Par separado por vírgula; ex.: \"0.10,0.90\" significa de 10% a 90%." msgid "Mixed filament gradient curve" -msgstr "Curva do gradiente do filamento misto" +msgstr "Curva do degradê do filamento misto" msgid "Optional Photoshop-style custom curve mapping Z progress to the first component ratio. Encoded as pipe-separated control points, either \"x,y\" (legacy) or \"x,y,m_in,m_out\" when a tangent override is needed (empty token or \"nan\" means use PCHIP default). x in [0,1]; y is clamped to the configured ratio range, e.g. \"0,0.15|0.5,0.50|1,0.85\". When empty, the linear gradient_range is used instead." msgstr "Curva personalizada opcional no estilo do Photoshop, mapeando o progresso em Z para a proporção do primeiro componente. Codificada como pontos de controle separados por barras verticais, no formato \"x,y\" (legado) ou \"x,y,m_in,m_out\" quando é necessário substituir a tangente (um valor vazio ou \"nan\" usa o padrão PCHIP). X em [0,1]; Y é limitado à faixa de proporção configurada; ex.: \"0,0.15|0.5,0.50|1,0.85\". Quando vazio, o gradient_range linear é usado no lugar." msgid "Mixed filament per-part gradient" -msgstr "Gradiente por peça do filamento misto" +msgstr "Degradê por peça do filamento misto" msgid "When gradient mode is enabled, apply the gradient to each part of an assembly independently rather than treating the whole assembly as one Z range." -msgstr "Quando o modo de gradiente está ativado, aplica o gradiente a cada peça de uma montagem de forma independente em vez de tratar toda a montagem como uma única faixa Z." +msgstr "Quando o modo de degradê está ativado, aplica o degradê a cada peça de uma montagem de forma independente em vez de tratar toda a montagem como uma única faixa Z." msgid "Filament printable" msgstr "Filamento imprimível" @@ -16269,7 +16155,7 @@ msgstr "Densidade do preenchimento adaptativo no centro do objeto." # AI Translated msgid "Adaptive gradient" -msgstr "Gradiente adaptativo" +msgstr "Degradê adaptativo" # AI Translated msgid "" @@ -16940,6 +16826,14 @@ msgstr "Excluir objetos" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Ative esta opção para adicionar o comando EXCLUIR OBJETO no G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Tolerância do contorno" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Desvio máximo do contorno do objeto gravado em EXCLUDE_OBJECT_DEFINE em relação ao contorno original. Valores maiores geram menos pontos, o que ajuda firmwares que travam ao processar G-code com muitos objetos. 0 mantém todos os pontos." + msgid "Verbose G-code" msgstr "G-code detalhado" @@ -19061,44 +18955,32 @@ msgstr "Ângulo de inclinação do referencial da máquina" msgid "Tilt angle (degrees) used to derive the machine-frame shear (cot) and scale (1/|sin|) applied to G-code. Only used when 'Decouple machine-frame tilt' is enabled; otherwise the belt tilt angle is used." msgstr "Ângulo de inclinação (graus) usado para derivar o cisalhamento (cot) e a escala (1/|sin|) do referencial da máquina aplicados ao G-code. Usado somente quando 'Desacoplar a inclinação do referencial da máquina' está ativado; caso contrário, é usado o ângulo de inclinação da esteira." -# AI Translated msgid "+X" msgstr "+X" -# AI Translated msgid "+Y" msgstr "+Y" -# AI Translated msgid "+Z" msgstr "+Z" -# AI Translated msgid "-X" msgstr "-X" -# AI Translated msgid "-Y" msgstr "-Y" -# AI Translated msgid "-Z" msgstr "-Z" -# AI Translated -# Needs human review: Dropdown option of the belt G-code remap: 'Rev' is the reversed axis (max - position), distinct from the negated '-X' next to it; check the two read as different options. msgid "Rev X" -msgstr "X invertido" +msgstr "X reverso" -# AI Translated -# Needs human review: Dropdown option of the belt G-code remap: 'Rev' is the reversed axis (max - position), distinct from the negated '-Y' next to it; check the two read as different options. msgid "Rev Y" -msgstr "Y invertido" +msgstr "Y reverso" -# AI Translated -# Needs human review: Dropdown option of the belt G-code remap: 'Rev' is the reversed axis (max - position), distinct from the negated '-Z' next to it; check the two read as different options. msgid "Rev Z" -msgstr "Z invertido" +msgstr "Z reverso" # AI Translated msgid "G-code remap X" @@ -20059,11 +19941,13 @@ msgstr "Diretório de saída" msgid "This is the output directory for exported files." msgstr "Este é o diretório de saída para arquivos exportados." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Exportar estatísticas" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Grava as estatísticas de cada placa fatiada em JSON, como plate_N.statistics.json ao lado do seu G-code no diretório de saída e dentro do 3MF de --export-3mf: tempo de impressão, totais de filamento e por tipo de linha, e os mesmos dados por camada e por objeto." msgid "Debug level" msgstr "Nível de depuração" @@ -20245,8 +20129,7 @@ msgstr "Na zona de detecção de enrolamento da cabeça da ferramenta" msgid "Indicates if the first layer overlaps with the head wrap zone." msgstr "Indica se a primeira camada se sobrepõe à zona de enrolamento da cabeça da ferramenta." -# AI Translated -# Needs human review: Glossary says Bed = Mesa, but the catalog's established label 'Bed type' is 'Tipo de placa'; kept that wording so the placeholder matches the setting name. +# Glossary says Bed = Mesa, but the catalog's established label 'Bed type' is 'Tipo de placa'; kept that wording so the placeholder matches the setting name. msgid "Current bed type" msgstr "Tipo de placa atual" @@ -21154,11 +21037,11 @@ msgstr "A duplicação deste tipo de variável vetorial não é suportada" # AI Translated msgid "parameter of empty() is not a vector variable" -msgstr "O parâmetro de empty() não é uma variável vetorial" +msgstr "o parâmetro de empty() não é uma variável vetorial" # AI Translated msgid "parameter of size() is not a vector variable" -msgstr "O parâmetro de size() não é uma variável vetorial" +msgstr "o parâmetro de size() não é uma variável vetorial" # AI Translated msgid "Non-integer index is not allowed to address a vector variable." @@ -23521,8 +23404,6 @@ msgstr "Falha na Impressão" msgid "Printing Pause" msgstr "Pausa de Impressão" -# AI Translated -# Needs human review: Printer device status list in the multi-machine view (Idle, Printing, Prepare...); check the gerund reads right next to the other statuses. msgctxt "Device status" msgid "Prepare" msgstr "Preparando" @@ -23996,36 +23877,27 @@ msgstr "Se ativado, os valores acima são armazenados como os padrões usados pa msgid "PresetBundle" msgstr "PresetBundle" -# AI Translated msgid "Export Presets" msgstr "Exportar Predefinições" -# AI Translated msgid "Show in folder" msgstr "Mostrar na pasta" -# AI Translated msgid "Delete bundle" msgstr "Excluir pacote" -# AI Translated msgid "Unsubscribe bundle" -msgstr "Cancelar inscrição do pacote" +msgstr "Desinscrever do pacote" -# AI Translated msgid "Update available" msgstr "Atualização disponível" -# AI Translated msgid "Unauthorized bundle" msgstr "Pacote não autorizado" -# AI Translated msgid "Open this bundle in your browser" msgstr "Abrir este pacote no seu navegador" -# AI Translated -# Needs human review: Shared label: the type of a preset bundle (Preset Bundle dialog) and the source of a plugin (Plugins dialog); check the masculine singular fits both columns. msgid "Subscribed" msgstr "Inscrito" @@ -24052,16 +23924,16 @@ msgid "Remove Bundle" msgstr "Remover pacote" msgid "Unsubscribe bundle?" -msgstr "Cancelar a inscrição do pacote?" +msgstr "Desinscrever do pacote?" msgid "UnsubscribeBundle" msgstr "UnsubscribeBundle" msgid "Failed to unsubscribe bundle." -msgstr "Falha ao cancelar a inscrição do pacote." +msgstr "Falha ao desinscrever do pacote." msgid "Unsubscribe Bundle" -msgstr "Cancelar inscrição do Pacote" +msgstr "Desinscrever do Pacote" msgid "ExportPresetBundle" msgstr "ExportPresetBundle" @@ -26506,36 +26378,29 @@ msgstr "Posicionamento: A e B devem ser sistemas de coordenadas diferentes" msgid "Mate rejected" msgstr "Posicionamento rejeitado" -# AI Translated msgid "Interference needs at least two bodies" msgstr "A verificação de interferência precisa de pelo menos dois corpos" -# AI Translated msgid "No interference found" msgstr "Nenhuma interferência encontrada" -# AI Translated #, c-format, boost-format msgid "Body %d" msgstr "Corpo %d" -# AI Translated #, c-format, boost-format msgid "%s ↔ %s %.2f mm³" msgstr "%s ↔ %s %.2f mm³" -# AI Translated #, c-format msgid "%zu overlapping pair: %s" msgid_plural "%zu overlapping pairs: %s" msgstr[0] "%zu par de corpos sobrepostos: %s" msgstr[1] "%zu pares de corpos sobrepostos: %s" -# AI Translated msgid "Select a body to measure it" msgstr "Selecione um corpo para medi-lo" -# AI Translated msgid "This body could not be measured" msgstr "Não foi possível medir este corpo" @@ -26544,7 +26409,6 @@ msgstr "Não foi possível medir este corpo" msgid "%s: sheet body, area %.2f mm², no volume — thicken it to get one" msgstr "%s: corpo de superfície, área %.2f mm², sem volume — espesse-o para obter um" -# AI Translated #, c-format, boost-format msgid "%s: volume %.2f mm³, area %.2f mm²" msgstr "%s: volume %.2f mm³, área %.2f mm²" @@ -26561,12 +26425,10 @@ msgstr "A operação booleana precisa de dois corpos — adicione ou importe um msgid "Cut needs a solid body — add or import one first" msgstr "O corte precisa de um corpo sólido — adicione ou importe um primeiro" -# AI Translated #, c-format, boost-format msgid "Picked face (Body %d)" msgstr "Face selecionada (Corpo %d)" -# AI Translated msgid "Picked face" msgstr "Face selecionada" @@ -26578,11 +26440,9 @@ msgstr "não foi possível unir a nova forma ao corpo" msgid "the new shape could not be cut from the body" msgstr "não foi possível subtrair a nova forma do corpo" -# AI Translated msgid "the shapes could not be intersected" msgstr "não foi possível intersectar as formas" -# AI Translated msgid "nothing in the history makes a solid yet" msgstr "nada no histórico produz um sólido ainda" @@ -26590,7 +26450,6 @@ msgstr "nada no histórico produz um sólido ainda" msgid "the sketch profile is not a clean closed loop" msgstr "o perfil do esboço não é um laço fechado válido" -# AI Translated msgid "the tool does not touch the body" msgstr "a ferramenta não toca o corpo" @@ -26598,19 +26457,16 @@ msgstr "a ferramenta não toca o corpo" msgid "an expression uses a variable that does not exist" msgstr "uma expressão usa uma variável que não existe" -# AI Translated msgid "an expression divides by zero" msgstr "uma expressão divide por zero" -# AI Translated msgid "two variables are defined in terms of each other" -msgstr "duas variáveis são definidas uma em função da outra" +msgstr "duas variáveis são definidas uma em função uma da outra" # AI Translated msgid "a geometry operation failed" msgstr "uma operação geométrica falhou" -# AI Translated #. TRN Appended to a sketch tool prompt; %d is the number of picked entities. #, c-format, boost-format msgid " · %d picked" @@ -28722,25 +28578,21 @@ msgstr "Alternar entre Preparar/Pré-visualizar" msgid "Collapse/Expand the sidebar" msgstr "Recolher/Expandir a barra lateral" -# AI Translated msgid "Reload the device page" msgstr "Recarregar a página do dispositivo" msgid "Show keyboard shortcuts list" msgstr "Mostrar lista de atalhos de teclado" -# AI Translated msgid "Open the Speed Dial" -msgstr "Abrir o Menu rápido" +msgstr "Abrir o Menu Rápido" -# AI Translated msgid "Slicing and printing" msgstr "Fatiamento e impressão" msgid "Editing" msgstr "Edição" -# AI Translated msgid "Placement" msgstr "Colocação" @@ -28748,82 +28600,65 @@ msgstr "Colocação" msgid "Gizmos" msgstr "Gizmos" -# AI Translated msgid "Sliders" msgstr "Controles deslizantes" -# AI Translated msgid "Painting tools" msgstr "Ferramentas de pintura" msgid "Application" msgstr "Aplicação" -# AI Translated msgid "Speed Dial" -msgstr "Menu rápido" +msgstr "Menu Rápido" -# AI Translated msgid "helix radius must be > 0" -msgstr "o raio da hélice deve ser > 0" +msgstr "raio da hélice deve ser > 0" -# AI Translated msgid "helix pitch must be > 0" -msgstr "o passo da hélice deve ser > 0" +msgstr "passo da hélice deve ser > 0" -# AI Translated msgid "helix height must be >= 0" -msgstr "a altura da hélice deve ser >= 0" +msgstr "altura da hélice deve ser >= 0" -# AI Translated msgid "helix height of 0 (flat spiral) is not supported" msgstr "altura de hélice 0 (espiral plana) não é suportada" -# AI Translated msgid "helix turn count exceeds limit (10000)" -msgstr "o número de voltas da hélice excede o limite (10000)" +msgstr "número de voltas da hélice excede o limite (10000)" # AI Translated msgid "helix taper drives radius negative before reaching height" msgstr "a conicidade da hélice torna o raio negativo antes de atingir a altura" -# AI Translated msgid "bad character in expression" msgstr "caractere inválido na expressão" -# AI Translated msgid "mismatched parentheses" msgstr "parênteses não correspondentes" -# AI Translated #, boost-format msgid "unknown identifier: %1%" msgstr "identificador desconhecido: %1%" -# AI Translated msgid "missing operand for unary minus" msgstr "operando ausente para o menos unário" -# AI Translated #, boost-format msgid "not enough operands for '%1%'" msgstr "operandos insuficientes para '%1%'" -# AI Translated msgid "division by zero" msgstr "divisão por zero" -# AI Translated #, boost-format msgid "not enough arguments for %1%()" msgstr "argumentos insuficientes para %1%()" -# AI Translated #, boost-format msgid "unknown function: %1%" msgstr "função desconhecida: %1%" -# AI Translated msgid "invalid expression" msgstr "expressão inválida" @@ -28832,7 +28667,6 @@ msgstr "expressão inválida" msgid "variable cycle: %1%" msgstr "ciclo de variáveis: %1%" -# AI Translated #, boost-format msgid "unknown parameter: %1%" msgstr "parâmetro desconhecido: %1%" @@ -29614,8 +29448,6 @@ msgstr "Verde" msgid "Blue" msgstr "Azul" -# AI Translated -# Needs human review: Reordered to filament type then color (e.g. 'PLA Basic Ciano') as Portuguese adjectives follow the noun; check it reads right in the color list. #. TRN %1% is a color name such as "Cyan", %2% is a filament type such as "PLA Basic" #, boost-format msgctxt "Color and filament type" @@ -29639,17 +29471,18 @@ msgstr "Seletor de Cores" msgid "Basic Colors" msgstr "Cores Básicas" +#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. msgid "Orca Palette" msgstr "Paleta Orca" -#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. +#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "RAL Classic" msgstr "RAL Clássico" -#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "Gradients" msgstr "Degradês" +msgctxt "Color picker" msgid "Solid" msgstr "Sólido" @@ -29693,31 +29526,35 @@ msgstr "Filtrar cores" msgid "No matching colors" msgstr "Nenhuma cor correspondente" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Cor hexadecimal" # AI Translated msgid "Opacity" msgstr "Opacidade" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Porcentagem de opacidade" msgid "Save color" msgstr "Salvar cor" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Insira uma cor hexadecimal completa" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "A seleção de várias cores atual é mantida até você escolher uma cor diferente." #, c-format, boost-format msgid "Up to %d colors supported." msgstr "Até %d cores suportadas." msgid "Crimson" -msgstr "Carmesin" +msgstr "Carmesim" msgid "Orange red" msgstr "Vermelho laranja" @@ -29734,29 +29571,36 @@ msgstr "Laranja escuro" msgid "Gold" msgstr "Ouro" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Burly wood" -msgstr "" +msgstr "Madeira robusta" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Bisque" -msgstr "" +msgstr "Bisque" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Rosa nebuloso" msgid "Light yellow" msgstr "Amarelo claro" msgid "Lemon chiffon" -msgstr "" +msgstr "Chiffon limão" msgid "Beige" msgstr "Bege" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Amarelo vara-de-ouro claro" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Vara-de-ouro pálido" msgid "Khaki" msgstr "Cáqui" @@ -29764,50 +29608,61 @@ msgstr "Cáqui" msgid "Dark khaki" msgstr "Cáqui escuro" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Peach puff" -msgstr "" +msgstr "Pêssego suave" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mocassim" msgid "Papaya whip" msgstr "Creme de papaia" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Amêndoa branqueada" msgid "Antique white" msgstr "Branco antigo" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Branco navajo" msgid "Wheat" msgstr "Trigo" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Vara-de-ouro" msgid "Chocolate" msgstr "Chocolate" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Tijolo refratário" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Marrom sela" msgid "Brown" msgstr "Marrom" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Marrom rosado" msgid "Salmon" msgstr "Salmão" @@ -29818,8 +29673,9 @@ msgstr "Salmão claro" msgid "Dark salmon" msgstr "Salmão escuro" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Marrom arenoso" msgid "Coral" msgstr "Coral" @@ -29827,8 +29683,9 @@ msgstr "Coral" msgid "Light coral" msgstr "Coral claro" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Vermelho indiano" msgid "Dark red" msgstr "Vermelho escuro" @@ -29836,65 +29693,81 @@ msgstr "Vermelho escuro" msgid "Maroon" msgstr "Bordô" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Amarelo verde" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Verde amarelo" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Verde gramado" msgid "Lime green" msgstr "Verde limão" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Verde primavera" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Verde primavera médio" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Lima" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Verde floresta" msgid "Dark green" msgstr "Verde escuro" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Verde oliva fosco" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliva" msgid "Dark olive green" msgstr "Verde oliva escuro" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Verde pálido" msgid "Light green" msgstr "Verde claro" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Verde mar médio" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Verde mar" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Verde mar escuro" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Azul cadete" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Água-marinha médio" msgid "Turquoise" msgstr "Turquesa" @@ -29905,95 +29778,120 @@ msgstr "Turquesa médio" msgid "Dark turquoise" msgstr "Turquesa escuro" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Turquesa pálido" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Água" msgid "Light cyan" msgstr "Ciano claro" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Creme menta" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Honey dew" -msgstr "" +msgstr "Orvalho de mel" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Água-marinha" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Verde mar claro" msgid "Dark cyan" msgstr "Ciano escuro" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Verde azulado" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Cinza ardósia escuro" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Cinza ardósia claro" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Cinza ardósia" msgid "Deep sky blue" msgstr "Azul celeste profundo" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Dodger Blue" -msgstr "" +msgstr "Azul Dodger" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Azul céu" msgid "Light sky blue" msgstr "Azul celeste claro" msgid "Light blue" -msgstr "Azula claro" +msgstr "Azul claro" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Azul pó" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Azul aço claro" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Azul aço" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Azul centáurea" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Azul royal" msgid "Medium blue" msgstr "Azul médio" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Azul meia-noite" msgid "Dark blue" msgstr "Azul escuro" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Azul naval" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Azul ardósia" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Azul ardósia escuro" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Azul ardósia médio" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Violeta azul" msgid "Indigo" msgstr "Índigo" @@ -30001,14 +29899,17 @@ msgstr "Índigo" msgid "Dark violet" msgstr "Violeta escuro" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Orquídea escuro" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Orquídea médio" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orquídea" msgid "Violet" msgstr "Violeta" @@ -30019,32 +29920,40 @@ msgstr "Púrpura médio" msgid "Purple" msgstr "Púrpura" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Púrpura Rebecca" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Vermelho violeta médio" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Vermelho violeta pálido" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Rosa profundo" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Rosa vivo" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Rosa claro" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rosa" msgid "Plum" msgstr "Ameixa" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Cardo" msgid "Fuchsia" msgstr "Fúcsia" @@ -30055,197 +29964,256 @@ msgstr "Magenta escuro" msgid "Linen" msgstr "Linho" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Renda antiga" +# AI Translated +# Needs human review: CSS color seashell: Concha, not the print Shell (Casca) from the glossary msgid "Sea shell" -msgstr "" +msgstr "Concha do mar" msgid "Ivory" msgstr "Marfim" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Branco floral" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lavanda rosado" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Branco fantasma" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Azul Alice" msgid "Lavender" msgstr "Lavanda" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Branco fumaça" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" msgid "Black" msgstr "Preto" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Coral fogo" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Anêmona-do-mar" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Abismo profundo" msgid "Lobster red" msgstr "Vermelho lagosta" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Argila arenosa" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Madeira flutuante" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Espinheiro-marítimo" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Recife ao pôr do sol" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Coral tigre" msgid "Pink coral" msgstr "Coral rosa" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Brilho de concha" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Areia" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Alga dourada" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Duna iluminada" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Náutilo âmbar" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Limão-do-mar" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Estrela-do-mar pálida" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Maré de primavera" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Alga lima" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Grama-marinha" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Plâncton neon" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Floresta de algas" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Onda esmeralda" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Sombra de baleia" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Tartaruga-marinha" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Lagoa" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Corrente tropical" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Fossa da meia-noite" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Alga escura" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Arrebentação cristalina" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Baía turquesa" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Céu sobre o recife" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Shallow sky" -msgstr "" +msgstr "Céu de águas rasas" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Azul elétrico" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Golfinho" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Profundezas do oceano" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Baleia" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Abismo índigo" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Ouriço-do-mar" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Coral lavanda" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Maré violeta" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Orquídea do mar profundo" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Água-viva neon" msgid "Fuchsia coral" msgstr "Coral fúcsia" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Água-viva rosa" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Espuma" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Branco concha" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Cinza seixo" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Nuvem de tempestade" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Preto tinta" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Bege verde" msgid "Sand yellow" msgstr "Amarelo areia" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Amarelo sinal" msgid "Golden yellow" msgstr "Amarelo dourado" @@ -30253,20 +30221,24 @@ msgstr "Amarelo dourado" msgid "Honey yellow" msgstr "Amarelo mel" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Amarelo milho" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Amarelo narciso" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Bege marrom" msgid "Lemon yellow" msgstr "Amarelo limão" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Branco ostra" msgid "Light ivory" msgstr "Marfim claro" @@ -30274,59 +30246,73 @@ msgstr "Marfim claro" msgid "Zinc yellow" msgstr "Amarelo zinco" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Bege cinza" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Amarelo oliva" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Amarelo colza" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Amarelo trânsito" msgid "Ochre yellow" msgstr "Amarelo ocre" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Amarelo laranja trânsito" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" msgid "Melon yellow" msgstr "Amarelo melão" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Amarelo giesta" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Amarelo dália" msgid "Pastel yellow" msgstr "Amarelo pastel" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Bege perolado" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Ouro perolado" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Amarelo sol" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Laranja amarelo" msgid "Deep orange" msgstr "Laranja profundo" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Vermelhão" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Laranja perolado" msgid "Pure orange" msgstr "Laranja puro" @@ -30337,32 +30323,42 @@ msgstr "Laranja luminoso" msgid "Luminous bright orange" msgstr "Laranja brilhante luminoso" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Laranja vermelho brilhante" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Laranja trânsito" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Laranja sinal" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Laranja salmão" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Rosa perolado" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Laranja cobre" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Marrom sinal" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Fir orange" -msgstr "" +msgstr "Laranja abeto" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Vermelho sinal" msgid "Luminous red" msgstr "Vermelho luminoso" @@ -30370,8 +30366,9 @@ msgstr "Vermelho luminoso" msgid "Carmine red" msgstr "Vermelho carmim" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Vermelho carmim perolado" msgid "Pure red" msgstr "Vermelho puro" @@ -30379,11 +30376,13 @@ msgstr "Vermelho puro" msgid "Luminous deep red" msgstr "Vermelho profundo luminoso" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Vermelho groselha" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Vermelho rubi perolado" msgid "Fire red" msgstr "Vermelho fogo" @@ -30397,38 +30396,46 @@ msgstr "Vermelho púrpura" msgid "Wine red" msgstr "Vermelho vinho" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Vermelho preto" msgid "Oxide red" msgstr "Vermelho ferrugem" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Vermelho marrom" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Pine red" -msgstr "" +msgstr "Vermelho pinheiro" msgid "Tomato red" msgstr "Vermelho tomate" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Rosa antigo" msgid "Coral red" msgstr "Vermelho coral" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Rosa" msgid "Strawberry red" msgstr "Vermelho morango" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Vermelho trânsito" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Rosa salmão" msgid "Luminous rose" msgstr "Rosa luminoso" @@ -30439,107 +30446,134 @@ msgstr "Vermelho brilhante luminoso" msgid "Raspberry red" msgstr "Vermelho framboesa" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Vermelho oriental" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Rubi perolado" msgid "Red purple" msgstr "Púrpura vermelho" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Violeta vermelho" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Violeta urze" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Violeta bordô" msgid "Mahogany" msgstr "Mogno" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Púrpura cinza" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Violeta sinal" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Verde abeto" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Sabine grey" -msgstr "" +msgstr "Cinza sabino" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Violeta perolado" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Pearl blackberry" -msgstr "" +msgstr "Amora perolado" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Azul verde" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Azul ultramar" msgid "Sapphire blue" msgstr "Azul safira" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Azul preto" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Azul sinal" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Azul brilhante" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Azul cinza" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Azure blue" -msgstr "" +msgstr "Azul celeste" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Azul genciana" msgid "Cobalt blue" msgstr "Azul cobalto" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Azul pombo" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Azul trânsito" msgid "Turquoise blue" -msgstr "" +msgstr "Azul turquesa" -msgid "Capsanthin violet" -msgstr "" +msgid "Capri blue" +msgstr "Azul Capri" msgid "Ocean blue" msgstr "Azul marinho" msgid "Water blue" -msgstr "" +msgstr "Azul água" msgid "Night blue" -msgstr "" +msgstr "Azul noite" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Azul distante" msgid "Pastel blue" msgstr "Azul pastel" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Azul genciana perolado" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Azul meia-noite perolado" msgid "Patina green" msgstr "Verde pátina" @@ -30553,71 +30587,92 @@ msgstr "Verde folha" msgid "Olive green" msgstr "Verde oliva" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Verde azul" msgid "Moss green" msgstr "Verde musgo" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Oliva cinza" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Verde pinheiro" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Marrom pinheiro" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Verde grama" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Verde reseda" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Verde marrom" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Verde junco" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Verde preto" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Verde turquesa" +# AI Translated msgid "May green" -msgstr "" +msgstr "Verde maio" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Verde óxido de cromo" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Verde trânsito" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Verde samambaia" msgid "Opal green" msgstr "Verde opala" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Verde menta" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Verde bronze" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Verde perolado" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Sax turquoise" -msgstr "" +msgstr "Turquesa sax" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Turquesa perolado" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Jade perolado" msgid "Pure green" msgstr "Verde puro" @@ -30625,185 +30680,231 @@ msgstr "Verde puro" msgid "Luminous green" msgstr "Verde luminoso" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Cinza esquilo" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Cinza prata" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Cinza oliva" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Cinza musgo" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Cinza sinal" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Cinza rato" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Cinza bege" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Cinza cáqui" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Cinza verde" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Cinza lona" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Cinza ferro" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Cinza basalto" msgid "Brown grey" -msgstr "" +msgstr "Cinza marrom" msgid "Slate grey" -msgstr "" +msgstr "Cinza ardósia" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Cinza antracite" msgid "Light grey" -msgstr "" +msgstr "Cinza claro" msgid "Umber grey" -msgstr "" +msgstr "Cinza umbra" msgid "Concrete grey" -msgstr "" +msgstr "Cinza concreto" msgid "Graphite grey" -msgstr "" +msgstr "Cinza grafite" msgid "Granite grey" -msgstr "" +msgstr "Cinza granito" msgid "Stone grey" -msgstr "" +msgstr "Cinza pedra" msgid "Pebble grey" -msgstr "" +msgstr "Cinza seixo" msgid "Cement grey" -msgstr "" +msgstr "Cinza cimento" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Cinza amarelo" msgid "Platinum grey" -msgstr "" +msgstr "Cinza platina" msgid "Dusty grey" -msgstr "" +msgstr "Cinza poeira" msgid "Agate grey" -msgstr "" +msgstr "Cinza ágata" msgid "Quartz grey" -msgstr "" +msgstr "Cinza quartzo" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Cinza janela" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Cinza trânsito A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Cinza trânsito B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Cinza seda" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Telegrey 1" -msgstr "" +msgstr "Telecinza 1" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Telegrey 2" -msgstr "" +msgstr "Telecinza 2" +# AI Translated +# Needs human review: Color name of uncertain Portuguese rendering; check the shade it names msgid "Telegrey 4" -msgstr "" +msgstr "Telecinza 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Cinza rato perolado" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Marrom verde" msgid "Ochre brown" msgstr "Marrom ocre" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Marrom argila" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Marrom cobre" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Marrom chocolate" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Marrom oliva" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Marrom noz" msgid "Red brown" msgstr "Marrom vermelho" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Marrom sépia" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Marrom castanha" msgid "Mahogany brown" msgstr "Marrom mogno" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Marrom cinza" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Cobre perolado" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Marrom bege" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Marrom moca perolado" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Marrom terra" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Marrom perolado" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Creme" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Branco cinza" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Branco sinal" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Preto sinal" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Preto azeviche" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Alumínio branco" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Alumínio cinza" msgid "Pure white" msgstr "Branco puro" @@ -30811,17 +30912,20 @@ msgstr "Branco puro" msgid "Graphite black" msgstr "Preto grafite" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Branco trânsito" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Preto trânsito" msgid "Papyrus white" msgstr "Branco papiro" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Cinza claro perolado" msgid "Metal: Silver" msgstr "Metal: Prata" @@ -31319,11 +31423,23 @@ msgstr "Remover de Minhas texturas" msgid "Built-in" msgstr "Integradas" +msgid "My textures" +msgstr "Minhas texturas" + msgid "No textures found." msgstr "Nenhuma textura encontrada." -msgid "My textures" -msgstr "Minhas texturas" +# AI Translated +msgid "Texture libraries" +msgstr "Bibliotecas de texturas" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Explorar mais bibliotecas de texturas" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Abre o OrcaCloud na página inicial para procurar plugins." msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." msgstr "Importe sua própria imagem como mapa de altura. Ela é convertida para o formato a partir do qual o fatiador assa e salva na sua pasta pessoal de texturas, mantida separada das texturas fornecidas com o OrcaSlicer." @@ -31692,10 +31808,10 @@ msgid "How wide one copy of the texture is on the model. Smaller repeats the pat msgstr "Largura de uma cópia da textura no modelo. Valores menores repetem o padrão mais vezes e deixam seus detalhes mais finos; com Ladrilho desativado, este é o tamanho da cópia única." msgid "Larger" -msgstr "" +msgstr "Maiores" msgid "Smaller" -msgstr "" +msgstr "Menores" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -31761,9 +31877,8 @@ msgstr "Misturar filamentos" # AI Translated msgid "Interleaves two filaments to fake the colors in between, so a handful of filaments can cover a photo or a gradient. An image of flat colors prints the same either way. Off uses one filament per area." -msgstr "Intercala dois filamentos para simular as cores intermediárias, de modo que poucos filamentos consigam cobrir uma foto ou um gradiente. Uma imagem de cores chapadas é impressa da mesma forma em ambos os casos. Desativado, usa um filamento por área." +msgstr "Intercala dois filamentos para simular as cores intermediárias, de modo que poucos filamentos consigam cobrir uma foto ou um degradê. Uma imagem de cores chapadas é impressa da mesma forma em ambos os casos. Desativado, usa um filamento por área." -# AI Translated msgid "Mixed colors" msgstr "Cores mistas" @@ -31772,10 +31887,10 @@ msgid "The most mixed filaments a bake may add. They are picked from the texture msgstr "O número máximo de filamentos mistos que um assamento pode adicionar. Eles são escolhidos a partir das cores da textura, e somente os que o assamento realmente usa são criados." msgid "Few" -msgstr "" +msgstr "Poucas" msgid "Many" -msgstr "" +msgstr "Muitas" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -32116,11 +32231,13 @@ msgstr "Remalhamento" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Tamanho dos triângulos com que o modelo inteiro é reconstruído, em milímetros. O deslocamento funciona melhor em uma malha uniforme; isto cria uma a partir de uma importação irregular." +# AI Translated msgid "Before" -msgstr "" +msgstr "Antes" +# AI Translated msgid "After" -msgstr "" +msgstr "Depois" msgid "Keep sharp edges" msgstr "Manter arestas vivas" @@ -32399,7 +32516,7 @@ msgstr "Efeito de Degradê" # AI Translated msgid "Enable per-part gradient effect" -msgstr "Ativar efeito de gradiente por peça" +msgstr "Ativar efeito de degradê por peça" # AI Translated msgid "Mixing Recommendations" @@ -32554,9 +32671,8 @@ msgstr "A interface de configuração do plugin não pôde ser carregada (%1%). msgid "Delete Plugin" msgstr "Excluir Plugin" -# AI Translated msgid "Unsubscribe" -msgstr "Cancelar inscrição" +msgstr "Desinscrever" # AI Translated msgid "Overwrite Plugin" @@ -33038,39 +33154,32 @@ msgstr "\"%s\" excluído." msgid "Deleting plugin" msgstr "Excluindo plugin" -# AI Translated msgid "Deleting plugin..." msgstr "Excluindo plugin..." -# AI Translated #, c-format, boost-format msgid "" "Unsubscribe plugin \"%s\"?\n" "\n" "This will stop tracking the plugin and delete any local plugin files." msgstr "" -"Cancelar a inscrição do plugin \"%s\"?\n" +"Desinscrever do plugin \"%s\"?\n" "\n" "Isso deixará de acompanhar o plugin e excluirá todos os arquivos locais do plugin." -# AI Translated msgid "Failed to unsubscribe plugin." -msgstr "Falha ao cancelar a inscrição do plugin." +msgstr "Falha ao desinscrever do plugin." -# AI Translated #, c-format, boost-format msgid "Unsubscribed \"%s\"." msgstr "Inscrição de \"%s\" cancelada." -# AI Translated msgid "Unsubscribing plugin" -msgstr "Cancelando a inscrição do plugin" +msgstr "Desinscrevendo do plugin" -# AI Translated msgid "Deleting local files and unsubscribing plugin..." -msgstr "Excluindo arquivos locais e cancelando a inscrição do plugin..." +msgstr "Excluindo arquivos locais e desinscrevendo do plugin..." -# AI Translated msgid "Plugin not found." msgstr "Plugin não encontrado." @@ -33612,8 +33721,6 @@ msgstr "Pressione Desdobrar primeiro - ainda não há ilhas para trabalhar." msgid "Click an island on the canvas first, in Island mode." msgstr "Primeiro clique em uma ilha na tela, no modo Ilha." -# AI Translated -# Needs human review: Short badge for a published project (about three letters); kept as PUB, abbreviation of 'Publicado'. Check it fits the badge. #. TRN Short badge on a recent project that was published (a published 3MF). Keep it about three letters long. msgid "PUB" msgstr "PUB" @@ -33945,6 +34052,10 @@ msgstr "Script" msgid "Slicing Pipeline" msgstr "Pipeline de fatiamento" +# AI Translated +msgid "Resource Texture" +msgstr "Textura de recurso" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "A interface de configuração do plugin estava vazia. Exibindo o editor padrão." @@ -33977,11 +34088,9 @@ msgstr "Falha na instalação do plugin: %1%" msgid "%1%: installed plugin was not found in the catalog." msgstr "%1%: o plugin instalado não foi encontrado no catálogo." -# AI Translated msgid "Cloud plugin key is missing UUID." msgstr "A chave do plugin na nuvem não tem UUID." -# AI Translated msgid "Failed to subscribe to cloud plugin, see logs for more info." msgstr "Falha ao se inscrever no plugin na nuvem; consulte os logs para mais informações." @@ -33989,9 +34098,8 @@ msgstr "Falha ao se inscrever no plugin na nuvem; consulte os logs para mais inf msgid "Only cloud plugins can be unsubscribed." msgstr "Somente plugins na nuvem podem ter a inscrição cancelada." -# AI Translated msgid "Failed to unsubscribe plugin, see logs for more info." -msgstr "Falha ao cancelar a inscrição do plugin; consulte os logs para mais informações." +msgstr "Falha ao desinscrever do plugin; consulte os logs para mais informações." # AI Translated #. TRN %1% is the numeric result code returned by the cloud service. @@ -34092,6 +34200,30 @@ msgstr "O diretório do plugin contém arquivos de entrada .py e .whl" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "O diretório do plugin não contém um arquivo de entrada .py ou .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "O diretório de textura de recurso não está definido" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Não foi possível resolver o diretório de textura de recurso" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "O caminho da textura de recurso não é um diretório" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Não foi possível resolver a pasta do plugin" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "O diretório de textura de recurso está fora da pasta do plugin" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Não foi possível ler o diretório de textura de recurso" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -34290,23 +34422,18 @@ msgstr "Não é possível manter o plugin local: a chave de plugin local já exi msgid "Failed to update plugin install state: %1%" msgstr "Falha ao atualizar o estado de instalação do plugin: %1%" -# AI Translated msgid "Cannot unsubscribe your own plugins." -msgstr "Não é possível cancelar a inscrição dos seus próprios plugins." +msgstr "Não é possível desinscrever dos seus próprios plugins." -# AI Translated msgid "Only cloud plugins can be deleted and unsubscribed." msgstr "Somente plugins na nuvem podem ser excluídos e ter a inscrição cancelada." -# AI Translated msgid "Cannot unsubscribe your own plugins. Use Delete to remove the local files." -msgstr "Não é possível cancelar a inscrição dos seus próprios plugins. Use Excluir para remover os arquivos locais." +msgstr "Não é possível desinscrever dos seus próprios plugins. Use Excluir para remover os arquivos locais." -# AI Translated msgid "Plugin filesystem read permission request denied" msgstr "Solicitação de permissão de leitura do sistema de arquivos pelo plugin negada" -# AI Translated msgid "Profile has fewer than 2 points" msgstr "O perfil tem menos de 2 pontos" @@ -34314,15 +34441,12 @@ msgstr "O perfil tem menos de 2 pontos" msgid "Failed to build wire from profile" msgstr "Falha ao construir o contorno a partir do perfil" -# AI Translated msgid "extrude depth is zero" msgstr "a profundidade de extrusão é zero" -# AI Translated msgid "extrude failed" msgstr "falha na extrusão" -# AI Translated msgid "Fuse failed" msgstr "Falha na fusão" @@ -34330,19 +34454,15 @@ msgstr "Falha na fusão" msgid "Failed to make face from wire" msgstr "Falha ao criar a face a partir do contorno" -# AI Translated msgid "two-sided extrude fuse failed" msgstr "falha na fusão da extrusão de dois lados" -# AI Translated msgid "imported regions produced no extrudable geometry" msgstr "as regiões importadas não produziram geometria extrudável" -# AI Translated msgid "the profile crosses the revolve axis — it must lie on one side of it" msgstr "o perfil cruza o eixo de revolução — ele deve ficar de um lado do eixo" -# AI Translated msgid "Failed to revolve" msgstr "Falha na revolução" @@ -34370,201 +34490,157 @@ msgstr "o loft não produziu sólido" msgid "loft produced no shape" msgstr "o loft não produziu forma" -# AI Translated msgid "Pocket face failed" msgstr "Falha na face da cavidade" -# AI Translated msgid "Pocket cut failed" msgstr "Falha no corte da cavidade" -# AI Translated msgid "the profile crosses or folds back on itself, so it does not bound one region" msgstr "o perfil se cruza ou se dobra sobre si mesmo, então não delimita uma única região" -# AI Translated msgid "sketch has no closed loop" msgstr "o esboço não tem laço fechado" -# AI Translated msgid "sketch loop does not bound a face" msgstr "o laço do esboço não delimita uma face" -# AI Translated msgid "sketch has two disjoint regions; put each in its own sketch" msgstr "o esboço tem duas regiões separadas; coloque cada uma em seu próprio esboço" -# AI Translated msgid "cannot read STEP file" msgstr "não é possível ler o arquivo STEP" -# AI Translated msgid "STEP file has no geometry" msgstr "o arquivo STEP não tem geometria" -# AI Translated msgid "OCCT failed to read STEP" msgstr "o OCCT não conseguiu ler o STEP" -# AI Translated msgid "mesh_to_brep: mesh has no triangles" msgstr "mesh_to_brep: a malha não tem triângulos" -# AI Translated msgid "mesh_to_brep: every triangle was rejected as degenerate (try a smaller tolerance)" msgstr "mesh_to_brep: todos os triângulos foram rejeitados como degenerados (tente uma tolerância menor)" -# AI Translated msgid "the fillet radius must be greater than 0" msgstr "o raio do filete deve ser maior que 0" -# AI Translated msgid "no edges to fillet in that group" msgstr "nenhuma aresta para filetar nesse grupo" -# AI Translated msgid "fillet radius too large for this geometry" msgstr "raio do filete grande demais para esta geometria" -# AI Translated msgid "the chamfer distance must be greater than 0" msgstr "a distância do chanfro deve ser maior que 0" -# AI Translated msgid "no edges to chamfer in that group" msgstr "nenhuma aresta para chanfrar nesse grupo" -# AI Translated msgid "chamfer distance too large for this geometry" msgstr "distância do chanfro grande demais para esta geometria" -# AI Translated msgid "apply_fillet: OCCT fillet failed" msgstr "apply_fillet: falha no filete do OCCT" -# AI Translated msgid "apply_chamfer: OCCT chamfer failed" msgstr "apply_chamfer: falha no chanfro do OCCT" -# AI Translated msgid "empty component list" msgstr "lista de componentes vazia" -# AI Translated msgid "empty component index" msgstr "índice de componente vazio" -# AI Translated #, boost-format msgid "component index must be >= 1 (got %1%)" msgstr "o índice do componente deve ser >= 1 (recebido %1%)" -# AI Translated #, boost-format msgid "invalid component index \"%1%\"" msgstr "índice de componente inválido \"%1%\"" -# AI Translated #, boost-format msgid "at least 2 components required (got %1%)" msgstr "são necessários pelo menos 2 componentes (recebido %1%)" -# AI Translated #, boost-format msgid "duplicate component index %1%" msgstr "índice de componente duplicado %1%" -# AI Translated msgid "empty ratio value" msgstr "valor de proporção vazio" -# AI Translated #, boost-format msgid "ratio must be positive (got %1%)" msgstr "a proporção deve ser positiva (recebido %1%)" -# AI Translated #, boost-format msgid "invalid ratio \"%1%\"" msgstr "proporção inválida \"%1%\"" -# AI Translated #. TRN %1% is the expected number of ratios, %2% the number found. #, boost-format msgid "the ratio count must match the component count: expected %1%, got %2%" msgstr "a quantidade de proporções deve corresponder à quantidade de componentes: esperado %1%, recebido %2%" -# AI Translated msgid "expected two comma-separated floats, e.g. \"0.10,0.90\"" msgstr "esperados dois floats separados por vírgula, por exemplo \"0.10,0.90\"" -# AI Translated msgid "start and end ratios must be in (0, 1)" msgstr "as proporções inicial e final devem estar em (0, 1)" -# AI Translated #, boost-format msgid "array size %1% does not match filament slot count %2%" msgstr "o tamanho do array %1% não corresponde à quantidade de espaços de filamento %2%" -# AI Translated msgid "must be set when mixed filament parameters are specified" msgstr "deve ser definido quando parâmetros de filamento misto são especificados" -# AI Translated #. TRN Mixed filament validation error. %1% is the filament slot number, %2% the reason. #, boost-format msgid "slot %1%: %2%" msgstr "espaço %1%: %2%" -# AI Translated #, boost-format msgid "slot %1%: component %2% out of range (max physical filament index is %3%)" msgstr "espaço %1%: componente %2% fora do intervalo (o índice máximo de filamento físico é %3%)" -# AI Translated #, boost-format msgid "slot %1%: cannot reference itself as a component" msgstr "espaço %1%: não pode referenciar a si mesmo como componente" -# AI Translated #, boost-format msgid "slot %1%: component %2% references a mixed filament slot" msgstr "espaço %1%: o componente %2% referencia um espaço de filamento misto" -# AI Translated #, boost-format msgid "slot %1%: gradient requires exactly 2 components" -msgstr "espaço %1%: o gradiente exige exatamente 2 componentes" +msgstr "espaço %1%: o degradê requer exatamente 2 componentes" -# AI Translated #, boost-format msgid "slot %1%: invalid curve (need at least 2 valid control points)" msgstr "espaço %1%: curva inválida (são necessários pelo menos 2 pontos de controle válidos)" -# AI Translated #, boost-format msgid "Failed loading configuration file \"%1%\": %2%" msgstr "Falha ao carregar o arquivo de configuração \"%1%\": %2%" -# AI Translated #. TRN %1% is the application name. #, boost-format msgid "Not a G-code file generated by %1%." msgstr "Não é um arquivo G-code gerado pelo %1%." -# AI Translated #. TRN %1% is a tag in the G-code file that must not be translated. #, boost-format msgid "Config tag \"%1%\" not found" msgstr "Tag de configuração \"%1%\" não encontrada" -# AI Translated #, boost-format msgid "Suspiciously low number of configuration values extracted from %1%: %2%" msgstr "Número suspeitamente baixo de valores de configuração extraídos de %1%: %2%" -# AI Translated msgid "" "Load step file failed.\n" "Cannot open file for reading.\n" @@ -34572,68 +34648,53 @@ msgstr "" "Falha ao carregar o arquivo STEP.\n" "Não foi possível abrir o arquivo para leitura.\n" -# AI Translated msgid "import svg failed: could not open svg." -msgstr "falha ao importar o svg: não foi possível abrir o svg." +msgstr "falha ao importar o SVG: não foi possível abrir o SVG." -# AI Translated msgid "import svg failed: could not parse imported svg data." -msgstr "falha ao importar o svg: não foi possível analisar os dados do svg importado." +msgstr "falha ao importar o SVG: não foi possível analisar os dados do SVG importado." -# AI Translated msgid "Custom G-code reports negative z_retracted." msgstr "O G-code personalizado informa z_retracted negativo." -# AI Translated msgid "Custom G-code reports negative z_restart_extra." msgstr "O G-code personalizado informa z_restart_extra negativo." -# AI Translated #, boost-format msgid "Copying directory %1% to %2% failed: %3%" msgstr "Falha ao copiar o diretório %1% para %2%: %3%" -# AI Translated msgid "Authentication complete" msgstr "Autenticação concluída" -# AI Translated msgid "Authentication failed" msgstr "Falha na autenticação" -# AI Translated msgid "You can return to OrcaSlicer. This window will close automatically." msgstr "Você pode voltar ao OrcaSlicer. Esta janela será fechada automaticamente." -# AI Translated msgid "Something went wrong. Please return to OrcaSlicer and try again." msgstr "Algo deu errado. Volte ao OrcaSlicer e tente novamente." -# AI Translated msgid "You can return to OrcaSlicer. If your browser does not redirect automatically, use the button below." msgstr "Você pode voltar ao OrcaSlicer. Se o seu navegador não redirecionar automaticamente, use o botão abaixo." -# AI Translated #, boost-format msgid "Failed starting the script %1%, Win32 error: %2%" msgstr "Falha ao iniciar o script %1%, erro Win32: %2%" -# AI Translated #, boost-format msgid "Post processing script %1% on file %2% failed. CommandLineToArgvW() refused to parse the command line path." msgstr "O script de pós-processamento %1% no arquivo %2% falhou. CommandLineToArgvW() se recusou a analisar o caminho da linha de comando." -# AI Translated #, boost-format msgid "The configured post-processing script does not exist: %1%" msgstr "O script de pós-processamento configurado não existe: %1%" -# AI Translated #, boost-format msgid "Perl interpreter %1% does not exist." msgstr "O interpretador Perl %1% não existe." -# AI Translated #, boost-format msgid "" "Post-processing plugin %1% raised an exception.\n" @@ -34642,7 +34703,6 @@ msgstr "" "O plugin de pós-processamento %1% gerou uma exceção.\n" "Erro: %2%" -# AI Translated #, boost-format msgid "" "Post-processing plugin %1% failed.\n" @@ -35023,56 +35083,18 @@ msgstr "" "Evitar empenamento\n" "Você sabia que ao imprimir materiais propensos ao empenamento como ABS, aumentar adequadamente a temperatura da mesa aquecida pode reduzir a probabilidade de empenamento?" +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Disponível em qualquer lugar da janela, mesmo ao digitar em um campo de texto." + +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Os atalhos globais também funcionam durante a digitação." + +#~ msgid "Solid" +#~ msgstr "Sólido" + #~ msgid "Please choose the filament color" #~ msgstr "Escolha a cor do filamento" -# AI Translated -#~ msgid "" -#~ "Line width of the Bridge. If expressed as a %, it will be computed over the nozzle diameter.\n" -#~ "Recommended to use with a higher Bridge density or Bridge flow ratio.\n" -#~ "\n" -#~ "The maximum value is 100% or the nozzle diameter.\n" -#~ "If set to 0, the line width will match the Internal solid infill width." -#~ msgstr "" -#~ "Largura de linha da Ponte. Se expressa como %, será calculada sobre o diâmetro do bico.\n" -#~ "Recomendado usar com uma densidade de Ponte ou taxa de fluxo de Ponte mais alta.\n" -#~ "\n" -#~ "O valor máximo é 100% ou o diâmetro do bico.\n" -#~ "Se definido como 0, a largura de linha corresponderá à largura do preenchimento sólido interno." - -# AI Translated -#, no-c-format, no-boost-format -#~ msgid "" -#~ "Enable this option to slow down printing in areas where perimeters may have curled upwards.\n" -#~ "For example, additional slowdown will be applied when printing overhangs on sharp corners like the front of the Benchy hull, reducing curling which compounds over multiple layers.\n" -#~ "\n" -#~ "It is generally recommended to have this option switched on unless your printer cooling is powerful enough or the print speed is slow enough that perimeter curling does not happen. \n" -#~ "If printing with a high external perimeter speed, this parameter may introduce wall artifacts when slowing down, due to the potentially large variance in print speeds causing the extruder to be unable to keep up with the requested flow change.\n" -#~ "Root cause of these artifacts is most likely PA tuning being slightly off, especially when combined with a high PA smooth time.\n" -#~ "\n" -#~ "Recommendations when enabling this option:\n" -#~ "1. Reduce Pressure Advance smooth time to 0.015 - 0.02 so the extruder reacts quickly to the speed changes.\n" -#~ "2. Increase the minimum print speeds to limit the magnitude of the slowdown and reduce the variance between fast and slow segments.\n" -#~ "3. If artifacts still appear, enable Extrusion Rate Smoothing (ERS) to further smooth the flow transitions.\n" -#~ "\n" -#~ "Note: When this option is enabled, overhang perimeters are treated like overhangs, meaning the overhang speed is applied even if the overhanging perimeter is part of a bridge.\n" -#~ "For example, when the perimeters are 100% overhanging, with no wall supporting them from underneath, the 100% overhang speed will be applied." -#~ msgstr "" -#~ "Ative esta opção para reduzir a velocidade de impressão em áreas onde os perímetros podem ter se enrolado para cima.\n" -#~ "Por exemplo, uma desaceleração adicional será aplicada ao imprimir saliências em cantos vivos, como a frente do casco do Benchy, reduzindo o enrolamento que se acumula ao longo de várias camadas.\n" -#~ "\n" -#~ "Geralmente, recomenda-se manter esta opção ativada, a menos que o resfriamento da sua impressora seja potente o suficiente ou a velocidade de impressão seja lenta o suficiente para que o enrolamento dos perímetros não ocorra. \n" -#~ "Se imprimir com uma velocidade alta de perímetro externo, este parâmetro pode introduzir artefatos na parede ao desacelerar, devido à variação potencialmente grande nas velocidades de impressão que faz com que a extrusora não consiga acompanhar a mudança de fluxo solicitada.\n" -#~ "A causa raiz desses artefatos é provavelmente um ajuste de PA ligeiramente incorreto, especialmente quando combinado com um alto tempo de suavização de PA.\n" -#~ "\n" -#~ "Recomendações ao ativar esta opção:\n" -#~ "1. Reduza o tempo de suavização do Pressure Advance para 0,015 - 0,02 para que a extrusora reaja rapidamente às mudanças de velocidade.\n" -#~ "2. Aumente as velocidades mínimas de impressão para limitar a magnitude da desaceleração e reduzir a variação entre os segmentos rápidos e lentos.\n" -#~ "3. Se os artefatos ainda aparecerem, ative a Suavização da Taxa de Extrusão (ERS) para suavizar ainda mais as transições de fluxo.\n" -#~ "\n" -#~ "Nota: quando esta opção está ativada, os perímetros de saliência são tratados como saliências, o que significa que a velocidade de saliência é aplicada mesmo que o perímetro em saliência faça parte de uma ponte.\n" -#~ "Por exemplo, quando os perímetros estão 100% em saliência, sem nenhuma parede os sustentando por baixo, a velocidade de saliência de 100% será aplicada." - #~ msgid "" #~ "Speed of the externally visible bridge extrusions.\n" #~ "\n" @@ -35189,43 +35211,12 @@ msgstr "" #~ "\n" #~ "NOTA: As superfícies inferior e superior não serão afetadas por este valor para evitar lacunas visuais no exterior do modelo. Ajuste o 'Limiar de uma parede' nas configurações avançadas abaixo para ajustar a sensibilidade do que é considerado uma superfície superior. 'Limiar de uma parede' só é visível se esta configuração estiver acima do valor padrão de 0,5, ou se superfícies superiores de uma única parede estiverem habilitadas." -# AI Translated -#, boost-format -#~ msgid "Split into %1% part" -#~ msgid_plural "Split into %1% parts" -#~ msgstr[0] "Dividir em %1% peça" -#~ msgstr[1] "Dividir em %1% peças" - #~ msgid "Repair failed" #~ msgstr "Reparo falhou" #~ msgid "Repair canceled" #~ msgstr "Reparo cancelado" -# AI Translated -#~ msgid "What this layer does where it overlaps the ones below. Add and Subtract pile relief on or carve it away. Multiply and Divide scale what is underneath, which turns this layer into a mask over it - there, Depth acts as a strength, and 1 mm leaves white areas untouched." -#~ msgstr "O que esta camada faz onde se sobrepõe às de baixo. Adicionar e Subtrair acumulam relevo ou o retiram. Multiplicar e Dividir escalam o que está embaixo, o que transforma esta camada em uma máscara sobre ele - ali, Profundidade age como intensidade, e 1 mm deixa as áreas brancas intactas." - -# AI Translated -#~ msgid "The mesh has non-manifold geometry or open boundaries. You can import it as-is or repair it with Windows 3D repair service before importing." -#~ msgstr "A malha tem geometria não-manifold ou bordas abertas. Você pode importá-la como está ou repará-la com o serviço de reparo 3D do Windows antes de importar." - -# AI Translated -#~ msgid "Please note that the mesh has non-manifold geometry or open boundaries." -#~ msgstr "Observe que a malha tem geometria não-manifold ou bordas abertas." - -# AI Translated -#~ msgid "Mesh issue" -#~ msgstr "Problema na malha" - -# AI Translated -#~ msgid "Repair failed: mesh still open after hole filling." -#~ msgstr "Falha no reparo: a malha ainda está aberta após o preenchimento de buracos." - -# AI Translated -#~ msgid "Cannot apply logical operation to non-boolean operators." -#~ msgstr "Não é possível aplicar uma operação lógica a operadores não booleanos." - #~ msgid "Reading" #~ msgstr "Lendo" @@ -35265,10 +35256,6 @@ msgstr "" #~ msgid "hotend" #~ msgstr "hotend" -# AI Translated -#~ msgid "Arranging " -#~ msgstr "Organizando " - #~ msgid "Orienting" #~ msgstr "Orientando" @@ -35357,11 +35344,6 @@ msgstr "" #~ "\n" #~ "Gostaria de ser redirecionado para a página da web para avaliar?" -# AI Translated -#, boost-format -#~ msgid " (process preset: %1%)" -#~ msgstr " (predefinição de processo: %1%)" - #, c-format, boost-format #~ msgid "The %s nozzle can not print %s." #~ msgstr "O bico %s não pode imprimir %s." @@ -35377,30 +35359,15 @@ msgstr "" #~ msgid " plate %1%:" #~ msgstr " placa %1%:" -# AI Translated -#, boost-format -#~ msgid "Remove all %1% mixed filaments?" -#~ msgstr "Remover todos os %1% filamentos mistos?" - #~ msgid "Do you want to replace it" #~ msgstr "Deseja substituí-lo" -# AI Translated -#, c-format, boost-format -#~ msgid "Bed temperature conflict: T%d (%s) sets the bed to %d°C — T%d (%s) requires %d°C. The primary tool controls the bed; secondary tools print at whatever temperature it sets." -#~ msgstr "Conflito de temperatura da mesa: T%d (%s) define a mesa em %d°C — T%d (%s) requer %d°C. A ferramenta principal controla a mesa; as ferramentas secundárias imprimem na temperatura que ela definir." - #~ msgid "No accelerations provided for calibration. Use default acceleration value " #~ msgstr "Nenhuma aceleração fornecida para calibração. Usar o valor de aceleração padrão " #~ msgid "No speeds provided for calibration. Use default optimal speed " #~ msgstr "Nenhuma velocidade fornecida para calibração. Usar a velocidade padrão " -# AI Translated -#, boost-format -#~ msgid "No belt temperature tower is available for the range %1% to %2% °C. Use a range the tower models cover, for example 230 to 190." -#~ msgstr "Nenhuma torre de temperatura para esteira está disponível para a faixa de %1% a %2% °C. Use uma faixa coberta pelos modelos de torre, por exemplo, 230 a 190." - #~ msgid "The selected file" #~ msgstr "O arquivo selecionado" @@ -35414,10 +35381,6 @@ msgstr "" #~ msgid "Cost %dg filament and %d changes more than optimal grouping." #~ msgstr "O custo de %dg de filamento e %d muda mais do que o agrupamento ideal." -# AI Translated -#~ msgid "Parameters with this icon can be configurable per nozzle." -#~ msgstr "Parâmetros com este ícone podem ser configurados por bico." - #~ msgid "Reserved keywords found" #~ msgstr "Palavras-chave reservadas encontradas" @@ -35438,11 +35401,6 @@ msgstr "" #~ msgid "Are you sure you want to %1% the selected preset?" #~ msgstr "Tem certeza de que quer %1% a predefinição selecionada?" -# AI Translated -#, c-format, boost-format -#~ msgid "%s %s" -#~ msgstr "%s %s" - #, boost-format #~ msgid "Split into %1% parts" #~ msgstr "Dividir em %1% peças" @@ -35453,16 +35411,6 @@ msgstr "" #~ msgid "Failed to download vendor profile(s): " #~ msgstr "Falha ao baixar o(s) perfil(is) de fornecedor: " -# AI Translated -#, boost-format -#~ msgid "In this Span mode only %1% print colors, but filament %2% isn't routed to any tool. Use filaments routed to %1%, or switch this plate to Primary mode." -#~ msgstr "Neste modo Span, as cores só são impressas por %1%, mas o filamento %2% não está direcionado a nenhuma ferramenta. Use filamentos direcionados a %1% ou mude esta placa para o modo Principal." - -# AI Translated -#, boost-format -#~ msgid "In this Span mode only %1% print colors, but filament %2% is routed to T%3%. Use filaments routed to %1%, or switch this plate to Primary mode." -#~ msgstr "Neste modo Span, as cores só são impressas por %1%, mas o filamento %2% está direcionado a T%3%. Use filamentos direcionados a %1% ou mude esta placa para o modo Principal." - #~ msgid " is too close to exclusion area, there may be collisions when printing." #~ msgstr " está muito perto da área de exclusão, pode haver colisões durante a impressão." @@ -35499,10 +35447,6 @@ msgstr "" #~ msgid "Python plugin(s) invoked at each slicing pipeline step to read and modify intermediate slicing data, including a final G-code post-processing step. Research/experimental." #~ msgstr "Plugin(s) Python invocado(s) em cada etapa do pipeline de fatiamento para ler e modificar dados intermediários de fatiamento, incluindo uma etapa final de pós-processamento do G-code. Pesquisa/experimental." -# AI Translated -#~ msgid "Per-plate override mapping physical heads to filament slots (1-based). Empty means use pem-inversion defaults." -#~ msgstr "Substituição por placa que mapeia as cabeças físicas para os espaços de filamento (começando em 1). Vazio significa usar os padrões da inversão do pem." - #~ msgid " not in range " #~ msgstr " fora do intervalo " @@ -35530,10 +35474,6 @@ msgstr "" #~ msgid "This machine type can only hold %d historical results per nozzle." #~ msgstr "Este tipo de máquina só pode manter %d resultados históricos por bico." -# AI Translated -#~ msgid "Overhang" -#~ msgstr "Saliência" - #~ msgid "Start / End" #~ msgstr "Inicial / Final" @@ -35570,111 +35510,10 @@ msgstr "" #~ msgid "Skipping %d objects." #~ msgstr "Ignorando %d objetos." -# AI Translated -#~ msgid "Open folder in explorer" -#~ msgstr "Abrir pasta no explorador de arquivos" - -# AI Translated -#, c-format, boost-format -#~ msgid "Click center then a vertex — %d sides, %s" -#~ msgstr "Clique no centro e depois em um vértice — %d lados, %s" - -# AI Translated -#~ msgid "circumscribed" -#~ msgstr "circunscrito" - -# AI Translated -#~ msgid "inscribed" -#~ msgstr "inscrito" - -# AI Translated -#, c-format -#~ msgid "Sketch created (%zu driving dims) — select it, then right-click to Extrude" -#~ msgstr "Esboço criado (%zu cotas motrizes) — selecione-o e clique com o botão direito para extrudar" - -# AI Translated -#, c-format -#~ msgid "OK — %zu triangles" -#~ msgstr "OK — %zu triângulos" - -# AI Translated -#, c-format, boost-format -#~ msgid "" -#~ "This mesh has %d triangles. Every triangle becomes a B-rep face before coplanar merging, so importing it may take a long time and leave a body that is slow to edit. Decimating the mesh first is usually better.\n" -#~ "\n" -#~ "Import anyway?" -#~ msgstr "" -#~ "Esta malha tem %d triângulos. Cada triângulo se torna uma face B-rep antes da mesclagem de faces coplanares, então importá-la pode levar muito tempo e deixar um corpo lento para editar. Geralmente é melhor decimar a malha primeiro.\n" -#~ "\n" -#~ "Importar mesmo assim?" - -# AI Translated -#, c-format, boost-format -#~ msgid "Imported solid — %d triangles → %d faces, volume %.2f mm³. Pick a face or edge, then Fillet / Cut / Shell to modify" -#~ msgstr "Sólido importado — %d triângulos → %d faces, volume %.2f mm³. Selecione uma face ou aresta e depois Filete / Cortar / Casca para modificar" - -# AI Translated -#~ msgid " — drag to place/size, then Confirm" -#~ msgstr " — arraste para colocar/dimensionar e depois confirme" - -# AI Translated -#, c-format, boost-format -#~ msgid "%d sketch entities" -#~ msgstr "%d entidades de esboço" - -# AI Translated -#~ msgid " — type a value, press Enter (or Confirm)" -#~ msgstr " — digite um valor e pressione Enter (ou Confirmar)" - -# AI Translated -#, c-format -#~ msgid "Preview — %zu triangles" -#~ msgstr "Pré-visualização — %zu triângulos" - -# AI Translated -#, boost-format -#~ msgid "%1% constraint(s) cannot act on this geometry (an ellipse or spline curve, or a zero-size circle) and are ignored" -#~ msgstr "Restrições ignoradas por não poderem atuar sobre esta geometria (uma elipse ou curva spline, ou um círculo de tamanho zero): %1%" - -# AI Translated -#, boost-format -#~ msgid "%1% constraint(s) the fillet/chamfer invalidated were removed" -#~ msgstr "Restrições invalidadas pelo filete/chanfro e removidas: %1%" - -# AI Translated -#, boost-format -#~ msgid "%1% constraint(s) released by the transform" -#~ msgstr "Restrições liberadas pela transformação: %1%" - -# AI Translated -#, boost-format -#~ msgid "...and %1% more open end(s)" -#~ msgstr "...e mais %1% extremidade(s) aberta(s)" - -# AI Translated -#, boost-format -#~ msgid "The material list supports at most %1% colors. After %2% decomposition, the material count would exceed %1%. Please delete unused filaments on the main screen before decomposing." -#~ msgstr "A lista de materiais suporta no máximo %1% cores. Após a decomposição de %2%, a quantidade de materiais excederia %1%. Exclua os filamentos não utilizados na tela principal antes de decompor." - #, boost-format #~ msgid "%1% printable colors from %2% filaments" #~ msgstr "%1% cores imprimíveis a partir de %2% filamentos" -# AI Translated -#, boost-format -#~ msgid "%1% islands" -#~ msgstr "%1% ilhas" - -# AI Translated -#, boost-format -#~ msgid "All %1% layers used" -#~ msgstr "Todas as %1% camadas usadas" - -# AI Translated -#, boost-format -#~ msgid "Preview: %1% triangles" -#~ msgstr "Pré-visualização: %1% triângulos" - #, boost-format #~ msgid "Model: %1% triangles - the bake refines to the resolution above, up to its budget" #~ msgstr "Modelo: %1% triângulos - o assamento refina até a resolução acima, dentro do seu orçamento" @@ -35687,90 +35526,6 @@ msgstr "" #~ msgid "Bake result up to ~%1% k triangles" #~ msgstr "Resultado do assamento até ~%1% k triângulos" -# AI Translated -#, boost-format -#~ msgid "%1% layers not painted, skipped" -#~ msgstr "%1% camadas sem pintura ignoradas" - -# AI Translated -#, c-format, boost-format -#~ msgid "The project supports up to %d filaments. Extra filaments will be discarded." -#~ msgstr "O projeto suporta até %d filamentos. Os filamentos extras serão descartados." - -# AI Translated -#, c-format, boost-format -#~ msgid "%d vertices selected | drag = move together, Shift/Ctrl click = add/remove" -#~ msgstr "%d vértices selecionados | arrastar = mover juntos, Shift/Ctrl clique = adicionar/remover" - -# AI Translated -#, c-format, boost-format -#~ msgid "%d edges selected | drag = move together, Shift/Ctrl click = add/remove" -#~ msgstr "%d arestas selecionadas | arrastar = mover juntas, Shift/Ctrl clique = adicionar/remover" - -# AI Translated -#, c-format, boost-format -#~ msgid "%d islands selected | drag = move together, Shift/Ctrl click = add/remove, R/S = rotate/scale primary" -#~ msgstr "%d ilhas selecionadas | arrastar = mover juntas, Shift/Ctrl clique = adicionar/remover, R/S = girar/escalar a principal" - -# AI Translated -# Needs human review: Source says 'Change it with Tiling', but the texture layer's controls are labeled 'Tile' (Ladrilho) and 'Tile size' (Tamanho do ladrilho); check which control is meant and quote its label. -#~ msgid "The active layer's tile size: how much of the model one repeat of the texture covers. The canvas is measured in tiles, so one grid cell is one repeat. Change it with Tiling in the layer's settings." -#~ msgstr "O tamanho do ladrilho da camada ativa: quanto do modelo uma repetição da textura cobre. A tela é medida em ladrilhos, então uma célula da grade é uma repetição. Altere-o no ladrilhamento das configurações da camada." - -# AI Translated -#, c-format, boost-format -#~ msgid "%d islands, %s faces" -#~ msgstr "%d ilhas, %s faces" - -# AI Translated -#, c-format, boost-format -#~ msgid "" -#~ "Plugin \"%s\" is requesting to read the following file(s):\n" -#~ "%s" -#~ msgstr "" -#~ "O plugin \"%s\" está solicitando a leitura do(s) seguinte(s) arquivo(s):\n" -#~ "%s" - -# AI Translated -#, c-format, boost-format -#~ msgid "" -#~ "Plugin \"%s\" is requesting to read/write the following file(s):\n" -#~ "%s" -#~ msgstr "" -#~ "O plugin \"%s\" está solicitando a leitura/gravação do(s) seguinte(s) arquivo(s):\n" -#~ "%s" - -# AI Translated -#, c-format, boost-format -#~ msgid "" -#~ "Plugin \"%s\" is requesting to create the following file(s):\n" -#~ "%s" -#~ msgstr "" -#~ "O plugin \"%s\" está solicitando a criação do(s) seguinte(s) arquivo(s):\n" -#~ "%s" - -# AI Translated -#, c-format, boost-format -#~ msgid "" -#~ "Plugin \"%s\" is requesting to delete the following file(s):\n" -#~ "%s" -#~ msgstr "" -#~ "O plugin \"%s\" está solicitando a exclusão do(s) seguinte(s) arquivo(s):\n" -#~ "%s" - -# AI Translated -#, c-format, boost-format -#~ msgid "" -#~ "Plugin \"%s\" is requesting to run the following command(s):\n" -#~ "%s" -#~ msgstr "" -#~ "O plugin \"%s\" está solicitando executar o(s) seguinte(s) comando(s):\n" -#~ "%s" - -# AI Translated -#~ msgid "Plugin installation failed" -#~ msgstr "Falha na instalação do plugin" - #~ msgid "" #~ "The Microsoft WebView2 Runtime could not be installed.\n" #~ "Some features, including the setup wizard, may appear blank until it is installed.\n" @@ -36189,9 +35944,6 @@ msgstr "" #~ msgid "Print time (seconds)" #~ msgstr "Tempo de impressão (segundos)" -#~ msgid "Open actions speed dial" -#~ msgstr "Abrir menu rápido de ações" - #~ msgid "Left: " #~ msgstr "Esquerda: " diff --git a/localization/i18n/ru/OrcaSlicer_ru.po b/localization/i18n/ru/OrcaSlicer_ru.po index abe50f3433..639d9948fc 100644 --- a/localization/i18n/ru/OrcaSlicer_ru.po +++ b/localization/i18n/ru/OrcaSlicer_ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: OrcaSlicer V2.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2026-02-25 13:38+0300\n" "Last-Translator: Felix14_v2\n" "Language-Team: Felix14_v2 (ДС/ТГ: @felix14_v2, почта: aleks111001@list.ru), Andylg \n" @@ -750,17 +750,22 @@ msgstr "Элемент" msgid "Plate" msgstr "Стол" +# AI Translated +# Needs human review: No glossary rendering yet (Russian cell empty); Распределить matches the existing Align/Distribute label. msgid "Distribute" -msgstr "" +msgstr "Распределить" msgid "Coordinate system used for transform actions." msgstr "Опорная система координат для изменения положения." +# AI Translated +# Needs human review: Label in the Align/Distribute tool: what the objects are aligned to; check the wording in the UI. msgid "Reference for alignment" -msgstr "" +msgstr "Опора для выравнивания" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Выберите не менее 3 частей или объектов" # AI Translated msgid "Align left" @@ -814,8 +819,9 @@ msgstr "Распределить по высоте" msgid "Drop" msgstr "Опустить на стол" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Сместить выбранное по оси Z так, чтобы его нижняя точка касалась стола." msgid "Absolute" msgstr "Поворот" @@ -2070,17 +2076,23 @@ msgstr "Запуск режима сборки" msgid "Leaving Assembly gizmo" msgstr "Выход из режима сборки" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Части разрезанного объекта нельзя перемещать" +# AI Translated +# Needs human review: Plate renders as Стол per the glossary; check it reads naturally for a project plate. msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Выравнивание по столу доступно только по осям X и Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Отключите притягивание к столу для выбранных объектов, чтобы перемещать их по оси Z" +# AI Translated +# Needs human review: Plate renders as Стол per the glossary; check it reads naturally for a project plate. msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Все выбранные объекты должны находиться на одном столе" msgid "Shift+" msgstr "Shift+" @@ -6538,8 +6550,10 @@ msgstr "Оси координат" msgid "Gridlines" msgstr "Разметка" +# AI Translated +# Needs human review: No glossary rendering yet (Russian cell empty); check the term for hiding the interface to concentrate on the 3D canvas. msgid "Focus mode" -msgstr "" +msgstr "Режим фокуса" msgid "Labels" msgstr "Имена моделей" @@ -6600,7 +6614,7 @@ msgstr "Объём:" msgid "Size:" msgstr "Размер:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "В G-code на %d слое (z = %.2lf мм) обнаружен конфликт путей. Пожалуйста, разместите конфликтующие модели дальше друг от друга (%s <-> %s)." @@ -10941,11 +10955,13 @@ msgstr "" "\n" "Примечание: профили остаются недоступными для выбора." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Экспортировать статистику вместе с G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Если включено, при экспорте файла G-code рядом с ним записывается его статистика в формате JSON (.statistics.json), а экспортируемый нарезанный файл 3MF содержит её внутри: время печати, итоги по материалу и типам линий, а также те же данные по слоям и по объектам." msgid "Experimental Features" msgstr "Экспериментальные настройки" @@ -11791,6 +11807,10 @@ msgstr "Не удалось загрузить файл в хранилище п msgid "Send Failed" msgstr "Ошибка отправки" +# AI Translated +msgid "No available printers" +msgstr "Нет доступных принтеров" + msgid "The name length exceeds the limit." msgstr "Слишком длинное имя." @@ -13629,8 +13649,8 @@ msgid "Left mouse" msgstr "ЛКМ" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Доступно в любом месте окна, даже при вводе текста в поле." +msgid "Available anywhere in the window." +msgstr "Доступно в любом месте окна." # AI Translated msgid "Run favorite 1 to 10" @@ -13740,10 +13760,6 @@ msgstr "%s уже назначено для: %s. Переназначить на msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Сочетание по умолчанию %s уже назначено для: %s. Переназначить на «%s»?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Глобальные сочетания клавиш работают и при вводе текста." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Клавиша, вводящая символ, не может быть глобальным сочетанием." @@ -14184,9 +14200,10 @@ msgstr "модификатор «%1%» модели «%2%» (всего: %3%) н msgid "Seam placement may differ from expected." msgstr "Размещение шва может отличаться от ожидаемого." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Не удалось записать статистику G-code в %1%." msgid "Internal Bridge" msgstr "Внутренний мост" @@ -17713,6 +17730,14 @@ msgstr "Исключение объектов" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Включите эту опцию, чтобы добавить команду EXCLUDE OBJECT (исключение объектов) в G-code для печати на принтере с прошивкой Klipper." +# AI Translated +msgid "Outline tolerance" +msgstr "Допуск обводки" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Максимальное отклонение обводки объекта, записываемой в EXCLUDE_OBJECT_DEFINE, от исходной обводки. Чем больше значение, тем меньше точек, что помогает прошивкам, которые зависают при разборе G-code с большим числом объектов. При 0 сохраняются все точки." + msgid "Verbose G-code" msgstr "Подробный G-code" @@ -21204,11 +21229,13 @@ msgstr "Папку сохранения" msgid "This is the output directory for exported files." msgstr "Выходной каталог для экспортированных файлов." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Экспорт статистики" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Записывать статистику каждого нарезанного стола в формате JSON: plate_N.statistics.json рядом с его G-code в выходной папке и внутри 3MF при --export-3mf. Содержит время печати, итоги по материалу и типам линий, а также те же данные по слоям и по объектам." msgid "Debug level" msgstr "Уровень отладки журнала" @@ -31029,1231 +31056,1649 @@ msgstr[0] "В текущем списке материалов нет: %s. Ма msgstr[1] "В текущем списке материалов нет: %s. Материалы проекта, необходимые для смешанного материала, будут созданы автоматически после разложения." msgstr[2] "В текущем списке материалов нет: %s. Материалы проекта, необходимые для смешанного материала, будут созданы автоматически после разложения." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Выбор цвета" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Основные цвета" +# AI Translated +# Needs human review: No glossary rendering yet for Palette (Russian cell empty); Палитра proposed. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Палитра Orca" +# AI Translated +# Needs human review: Brand RAL kept; check whether Classic should be translated or kept in English. #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Классика" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Градиенты" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Однотонный" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Градиент" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Начало градиента" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Конец градиента" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Цвет градиента" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Добавить цвет" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Удалить цвет" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Насыщенность" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Исходный цвет" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Сохранить текущий цвет" +# AI Translated +# Needs human review: No glossary rendering yet for Palette (Russian cell empty); Палитра proposed. msgid "Palettes" -msgstr "" +msgstr "Палитры" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Поиск цветов" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Фильтр цветов" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Нет подходящих цветов" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "HEX-цвет" # AI Translated msgid "Opacity" msgstr "Непрозрачность" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Непрозрачность в процентах" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Сохранить цвет" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Введите полный шестнадцатеричный код цвета" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Текущий выбор нескольких цветов сохраняется, пока вы не выберете другой цвет." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Поддерживается до %d цветов." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Кармазин" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Оранжево-красный" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Томатный" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Оранжевый" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Тёмно-оранжевый" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Золотой" +# AI Translated +# Needs human review: CSS burlywood; check the natural Russian color name. msgid "Burly wood" -msgstr "" +msgstr "Древесный" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Бисквитный" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Туманная роза" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Светло-жёлтый" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Лимонный шифон" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Бежевый" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Светло-золотисто-жёлтый" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Бледно-золотистый" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Хаки" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Тёмный хаки" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Персиковый мусс" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Мокасиновый" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Взбитая папайя" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Бланшированный миндаль" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Античный белый" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Белый навахо" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Пшеничный" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Золотистый" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Шоколадный" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Перу" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Кирпичный" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Сиена" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Седельно-коричневый" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Коричневый" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Розово-коричневый" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Лососевый" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Светло-лососевый" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Тёмно-лососевый" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Песочно-коричневый" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Коралловый" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Светло-коралловый" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Индийский красный" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Тёмно-красный" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Бордовый" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Зелёно-жёлтый" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Жёлто-зелёный" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Шартрез" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Зелёный газон" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Зелёный лайм" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Весенний зелёный" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Средний весенний зелёный" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Лайм" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Лесной зелёный" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Тёмно-зелёный" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Тускло-оливковый" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Оливковый" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Тёмно-оливковый" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Бледно-зелёный" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Светло-зелёный" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Средний морской зелёный" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Морской зелёный" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Тёмный морской зелёный" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Кадетский синий" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Средний аквамарин" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Бирюзовый" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Средне-бирюзовый" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Тёмно-бирюзовый" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Бледно-бирюзовый" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Аква" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Светло-циановый" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Мятный крем" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Медовая роса" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Аквамарин" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Светлый морской зелёный" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Тёмно-циановый" +# AI Translated +# Needs human review: CSS teal; check the natural Russian color name. msgid "Teal" -msgstr "" +msgstr "Зелёная бирюза" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Тёмный сланцево-серый" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Светлый сланцево-серый" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Сланцево-серый" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Насыщенный небесно-голубой" +# AI Translated +# Needs human review: CSS dodgerblue; check the natural Russian color name. msgid "Dodger Blue" -msgstr "" +msgstr "Синий доджер" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Небесно-голубой" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Светлый небесно-голубой" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Светло-голубой" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Пудрово-голубой" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Светлый стально-синий" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Стально-синий" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Васильковый" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Королевский синий" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Средний синий" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Полуночно-синий" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Тёмно-синий" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Морской синий" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Сланцево-синий" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Тёмный сланцево-синий" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Средний сланцево-синий" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Сине-фиолетовый" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Индиго" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Тёмно-фиолетовый" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Тёмная орхидея" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Средняя орхидея" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Орхидея" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Фиолетовый" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Средний пурпурный" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Пурпурный" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Пурпурный Ребекки" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Средний фиолетово-красный" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Бледный фиолетово-красный" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Насыщенный розовый" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Ярко-розовый" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Светло-розовый" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Розовый" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Сливовый" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Чертополох" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Фуксия" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Тёмная маджента" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Льняной" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Старое кружево" +# AI Translated +# Needs human review: Color name; the Shell glossary term does not apply. msgid "Sea shell" -msgstr "" +msgstr "Морская раковина" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Слоновая кость" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Цветочно-белый" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Лавандовый румянец" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Призрачно-белый" +# AI Translated +# Needs human review: CSS aliceblue; check the natural Russian color name. msgid "Alice blue" -msgstr "" +msgstr "Голубой Элис" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Лавандовый" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Белый дым" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Гейнсборо" +# AI Translated msgid "Black" -msgstr "" +msgstr "Чёрный" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Коралловый огонь" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Морская анемона" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Глубокая бездна" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Красный омар" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Песчаная глина" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Плавник" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Облепиха" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Закатный риф" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Тигровый коралл" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Розовый коралл" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Сияние ракушки" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Песок" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Золотая ламинария" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Дюна на солнце" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Янтарный наутилус" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Морской лимон" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Бледная морская звезда" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Весенний прилив" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Лаймовые водоросли" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Морская трава" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Неоновый планктон" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Лес ламинарии" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Изумрудная волна" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Тень кита" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Морская черепаха" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Лагуна" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Тропическое течение" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Полуночная впадина" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Тёмная ламинария" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Хрустальный прибой" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Бирюзовая бухта" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Небо над рифом" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Небо мелководья" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Электрик" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Дельфин" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Океанские глубины" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Кит" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Индиговая бездна" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Морской ёж" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Лавандовый коралл" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Фиолетовый прилив" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Глубоководная орхидея" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Неоновое желе" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Фуксиевый коралл" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Розовая медуза" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Пена" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Белая ракушка" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Галечно-серый" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Грозовая туча" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Чернильно-чёрный" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Зелёно-бежевый" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Песочно-жёлтый" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Сигнальный жёлтый" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Золотисто-жёлтый" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Медово-жёлтый" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Кукурузно-жёлтый" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Нарциссово-жёлтый" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Коричнево-бежевый" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Лимонно-жёлтый" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Устрично-белый" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Светлая слоновая кость" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Цинково-жёлтый" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Серо-бежевый" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Оливково-жёлтый" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Рапсово-жёлтый" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Транспортный жёлтый" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Охристо-жёлтый" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Транспортный оранжево-жёлтый" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Карри" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Дынно-жёлтый" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Ракитниково-жёлтый" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Георгиново-жёлтый" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Пастельно-жёлтый" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Перламутровый бежевый" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Перламутровый золотой" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Солнечно-жёлтый" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Жёлто-оранжевый" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Насыщенный оранжевый" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Киноварь" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Перламутровый оранжевый" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Чистый оранжевый" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Светящийся оранжевый" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Светящийся ярко-оранжевый" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Ярко-красно-оранжевый" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Транспортный оранжевый" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Сигнальный оранжевый" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Лососево-оранжевый" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Перламутровый розовый" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Медно-оранжевый" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Сигнальный коричневый" +# AI Translated +# Needs human review: Source name unclear; translated literally. msgid "Fir orange" -msgstr "" +msgstr "Пихтово-оранжевый" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Сигнальный красный" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Светящийся красный" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Карминово-красный" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Перламутровый карминово-красный" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Чистый красный" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Светящийся насыщенный красный" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Смородиново-красный" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Перламутровый рубиново-красный" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Огненно-красный" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Рубиново-красный" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Пурпурно-красный" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Винно-красный" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Чёрно-красный" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Оксидно-красный" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Коричнево-красный" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Сосново-красный" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Томатно-красный" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Античный розовый" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Кораллово-красный" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Роза" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Клубнично-красный" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Транспортный красный" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Лососево-розовый" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Светящаяся роза" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Светящийся ярко-красный" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Малиново-красный" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Восточный красный" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Перламутровый рубиновый" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Красно-пурпурный" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Красно-фиолетовый" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Вересково-фиолетовый" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Бордово-фиолетовый" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Красное дерево" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Серо-пурпурный" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Сигнальный фиолетовый" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Пихтово-зелёный" +# AI Translated +# Needs human review: Source name unclear; translated literally. msgid "Sabine grey" -msgstr "" +msgstr "Сабинский серый" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Перламутровый фиолетовый" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Перламутровый ежевичный" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Зелёно-синий" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ультрамариново-синий" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Сапфирово-синий" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Чёрно-синий" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Сигнальный синий" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Бриллиантово-синий" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Серо-синий" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Лазурно-синий" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Горечавково-синий" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Кобальтово-синий" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Голубино-синий" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Транспортный синий" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Бирюзово-синий" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Синий Капри" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Океанский синий" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Водно-синий" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Ночно-синий" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Дальний синий" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Пастельно-синий" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Перламутровый горечавково-синий" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Перламутровый полуночно-синий" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Патиново-зелёный" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Изумрудно-зелёный" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Лиственно-зелёный" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Оливково-зелёный" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Сине-зелёный" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Мшисто-зелёный" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Серо-оливковый" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Сосново-зелёный" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Сосново-коричневый" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Травяно-зелёный" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Резедово-зелёный" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Коричнево-зелёный" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Тростниково-зелёный" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Чёрно-зелёный" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Бирюзово-зелёный" +# AI Translated msgid "May green" -msgstr "" +msgstr "Майский зелёный" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Хромоксидный зелёный" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Транспортный зелёный" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Папоротниково-зелёный" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Опалово-зелёный" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Мятно-зелёный" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Бронзово-зелёный" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Перламутровый зелёный" +# AI Translated +# Needs human review: Source name unclear (Saxe blue?); translated literally. msgid "Sax turquoise" -msgstr "" +msgstr "Саксонско-бирюзовый" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Перламутровый бирюзовый" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Перламутровый нефритовый" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Чистый зелёный" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Светящийся зелёный" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Беличий серый" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Серебристо-серый" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Оливково-серый" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Мшисто-серый" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Сигнальный серый" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Мышино-серый" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Бежево-серый" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Хаки-серый" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Зелёно-серый" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Брезентово-серый" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Железно-серый" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Базальтово-серый" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Коричнево-серый" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Сланцево-серый" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Антрацитово-серый" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Светло-серый" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Умброво-серый" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Бетонно-серый" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Графитово-серый" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Гранитно-серый" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Каменно-серый" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Галечно-серый" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Цементно-серый" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Жёлто-серый" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Платиново-серый" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Пыльно-серый" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Агатово-серый" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Кварцево-серый" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Оконно-серый" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Транспортный серый A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Транспортный серый B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Шёлково-серый" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Телесерый 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Телесерый 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Телесерый 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Перламутровый мышино-серый" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Зелёно-коричневый" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Охристо-коричневый" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Глинисто-коричневый" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Медно-коричневый" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Шоколадно-коричневый" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Оливково-коричневый" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Орехово-коричневый" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Красно-коричневый" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Сепиево-коричневый" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Каштаново-коричневый" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Махагоново-коричневый" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Серо-коричневый" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Перламутровый медный" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Бежево-коричневый" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Перламутровый мокко-коричневый" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Землисто-коричневый" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Перламутровый коричневый" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Кремовый" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Серо-белый" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Сигнальный белый" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Сигнальный чёрный" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Гагатово-чёрный" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Белый алюминий" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Серый алюминий" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Чистый белый" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Графитово-чёрный" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Транспортный белый" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Транспортный чёрный" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Папирусно-белый" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Перламутровый светло-серый" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Металл: серебро" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Металл: латунь" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Металл: золото" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Металл: медь" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Металл: бронза" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Природа: жемчуг" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Природа: радуга" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Природа: ясное небо" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Природа: закат" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Дерево: тёмное" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Дерево: среднее" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Дерево: светлое" # AI Translated msgid "Alternate nozzles:" @@ -32730,13 +33175,25 @@ msgstr "Удалить из «Моих текстур»" msgid "Built-in" msgstr "Встроенные" +# AI Translated +msgid "My textures" +msgstr "Мои текстуры" + # AI Translated msgid "No textures found." msgstr "Текстуры не найдены." # AI Translated -msgid "My textures" -msgstr "Мои текстуры" +msgid "Texture libraries" +msgstr "Библиотеки текстур" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Найти другие библиотеки текстур" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Открывает OrcaCloud на главной странице для просмотра плагинов." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33139,11 +33596,15 @@ msgstr "Наложение выполняется по собственной UV msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Ширина одной копии текстуры на модели. Чем меньше значение, тем чаще повторяется узор и тем мельче его детали; при выключенной «Плитке» это размер единственной копии." +# AI Translated +# Needs human review: Caption of a tile-size picture in the texture-displacement tool; check it reads right. msgid "Larger" -msgstr "" +msgstr "Крупнее" +# AI Translated +# Needs human review: Caption of a tile-size picture in the texture-displacement tool; check it reads right. msgid "Smaller" -msgstr "" +msgstr "Мельче" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33219,11 +33680,15 @@ msgstr "Смешанные цвета" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Максимальное число смешанных материалов, которое может добавить запекание. Они подбираются по цветам текстуры, и создаются только те, которые запекание действительно использует." +# AI Translated +# Needs human review: Caption under a mixed-colors image in the texture-displacement tool; check it reads right. msgid "Few" -msgstr "" +msgstr "Мало" +# AI Translated +# Needs human review: Caption under a mixed-colors image in the texture-displacement tool; check it reads right. msgid "Many" -msgstr "" +msgstr "Много" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33584,11 +34049,13 @@ msgstr "Перестроение сетки" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Размер треугольников, с которым перестраивается вся модель, в миллиметрах. Смещение лучше всего работает на равномерной сетке; этот параметр делает её из неравномерной импортированной." +# AI Translated msgid "Before" -msgstr "" +msgstr "До" +# AI Translated msgid "After" -msgstr "" +msgstr "После" # AI Translated msgid "Keep sharp edges" @@ -35475,6 +35942,10 @@ msgstr "Скрипт" msgid "Slicing Pipeline" msgstr "Конвейер нарезки" +# AI Translated +msgid "Resource Texture" +msgstr "Текстура ресурса" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Интерфейс настройки плагина пуст. Показан редактор по умолчанию." @@ -35622,6 +36093,30 @@ msgstr "В папке плагина есть одновременно вход msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "В папке плагина нет входного файла .py или .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Папка текстур ресурса не задана" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Не удалось определить папку текстур ресурса" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Путь к текстурам ресурса не является папкой" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Не удалось определить папку плагина" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Папка текстур ресурса находится вне папки плагина" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Не удалось прочитать папку текстур ресурса" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36344,7 +36839,9 @@ msgstr "" msgid "" "Reverse on even\n" "Did you know that Reverse on even feature can significantly improve the surface quality of your overhangs? However, it can cause wall inconsistencies so use carefully!" -msgstr "Реверс на чётных слояхСовет: настройка Реверс на чётных слоях может существенно улучшить качество нависающих поверхностей. Как и нарушить их однородность, так что используйте с осторожностью." +msgstr "" +"Реверс на чётных слоях\n" +"Совет: настройка Реверс на чётных слоях может существенно улучшить качество нависающих поверхностей. Как и нарушить их однородность, так что используйте с осторожностью." #: resources/data/hints.ini: [hint:Cut Tool] msgid "" @@ -36566,6 +37063,28 @@ msgstr "" "Предотвращение коробления материала\n" "Знаете ли вы, что при печати материалами, склонными к короблению, таких как ABS, повышение температуры подогреваемого стола может снизить эту вероятность?" +# AI Translated +# Needs human review: Not a known RAL name; translated literally. +#~ msgid "Dalmatian yellow" +#~ msgstr "Далматский жёлтый" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Капсантиново-фиолетовый" + +# AI Translated +# Needs human review: Source name unclear; translated literally. +#~ msgid "Olivestone" +#~ msgstr "Оливково-каменный" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Доступно в любом месте окна, даже при вводе текста в поле." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Глобальные сочетания клавиш работают и при вводе текста." + #~ msgid "Please choose the filament color" #~ msgstr "Изменение цвета" diff --git a/localization/i18n/sv/OrcaSlicer_sv.po b/localization/i18n/sv/OrcaSlicer_sv.po index 8962c506c3..bd4f298798 100644 --- a/localization/i18n/sv/OrcaSlicer_sv.po +++ b/localization/i18n/sv/OrcaSlicer_sv.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -823,18 +823,22 @@ msgstr "Markering" msgid "Plate" msgstr "Platta" +# AI Translated +# Needs human review: Glossary has no Swedish rendering for Distribute; matches the existing 'Justera/Fördela'. msgid "Distribute" -msgstr "" +msgstr "Fördela" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Koordinatsystem som används för transformeringar." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Referens för justering" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Välj minst 3 delar eller objekt" # AI Translated msgid "Align left" @@ -887,8 +891,9 @@ msgstr "Fördela i höjdled" msgid "Drop" msgstr "Släpp" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Flytta markeringen längs Z så att dess lägsta punkt når byggplattan." # AI Translated msgid "Absolute" @@ -2335,17 +2340,21 @@ msgstr "Öppnar monterings-gizmot" msgid "Leaving Assembly gizmo" msgstr "Lämnar monterings-gizmot" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Delar av ett klippt objekt kan inte flyttas" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Justering mot plattan är bara tillgänglig i X och Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Avaktivera automatiskt nedsläpp för de valda objekten för att flytta dem i Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Alla valda objekt måste ligga på samma platta" msgid "Shift+" msgstr "Shift+" @@ -7126,8 +7135,10 @@ msgstr "Axlar" msgid "Gridlines" msgstr "Rutnät" +# AI Translated +# Needs human review: Glossary has no Swedish rendering for Focus mode yet; check Fokusläge fits the view-mode name. msgid "Focus mode" -msgstr "" +msgstr "Fokusläge" msgid "Labels" msgstr "Etiketter" @@ -7190,7 +7201,7 @@ msgid "Size:" msgstr "Storlek:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Konflikter mellan G-code-banor hittades på lager %d, Z = %.2lfmm. Placera de objekt som krockar längre ifrån varandra (%s <-> %s)." @@ -11889,11 +11900,13 @@ msgstr "Visa förinställningar som inte stöds" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Visa inkompatibla förinställningar och förinställningar som inte stöds i rullgardinslistorna för skrivare och filament. Dessa förinställningar kan inte väljas." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Exportera statistik med G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Om det är aktiverat skrivs statistiken även som JSON bredvid G-code-filen vid export, som .statistics.json, och en exporterad beredd 3MF-fil innehåller den: utskriftstid, totaler för filament och linjetyper, samt samma sak per lager och per objekt." # AI Translated msgid "Experimental Features" @@ -12793,6 +12806,10 @@ msgstr "Det gick inte att ladda upp filen till skrivarens lagring. Försök igen msgid "Send Failed" msgstr "Sändningen misslyckades" +# AI Translated +msgid "No available printers" +msgstr "Inga tillgängliga skrivare" + msgid "The name length exceeds the limit." msgstr "Namnlängden överskrider gränsen." @@ -14844,8 +14861,8 @@ msgid "Left mouse" msgstr "Vänster musknapp" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Tillgängligt överallt i fönstret, även när du skriver i ett textfält." +msgid "Available anywhere in the window." +msgstr "Tillgängligt var som helst i fönstret." # AI Translated msgid "Run favorite 1 to 10" @@ -14957,10 +14974,6 @@ msgstr "%s är tilldelat till %s. Vill du tilldela det till %s i stället?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Standardkortkommandot %s är tilldelat till %s. Vill du tilldela det till %s i stället?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Globala kortkommandon gäller även när du skriver." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "En tangent som skriver ett tecken kan inte vara ett globalt kortkommando." @@ -15442,9 +15455,10 @@ msgstr "modifieraren \"%1%\" för \"%2%\" (%3% totalt) hade ingen effekt på sö msgid "Seam placement may differ from expected." msgstr "Sömmens placering kan skilja sig från det förväntade." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Det gick inte att skriva G-code-statistiken till %1%." # AI Translated msgid "Internal Bridge" @@ -19202,6 +19216,14 @@ msgstr "Exkludera objekt" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Aktivera det här alternativet för att lägga till kommandot EXCLUDE OBJECT i G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Konturtolerans" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Största avvikelse för objektkonturen som skrivs till EXCLUDE_OBJECT_DEFINE från den ursprungliga konturen. Större värden ger färre punkter, vilket hjälper fast programvara som hänger sig vid tolkning av G-code med många objekt. 0 behåller alla punkter." + # AI Translated msgid "Verbose G-code" msgstr "Utförlig G-code" @@ -22784,11 +22806,13 @@ msgstr "Mata ut katalog" msgid "This is the output directory for exported files." msgstr "Mata ut katalogen för exporterade filer." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Exportera statistik" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Skriv statistiken för varje beredd platta som JSON, som plate_N.statistics.json bredvid dess G-code i utdatamappen och inuti 3MF-filen från --export-3mf: utskriftstid, totaler för filament och linjetyper, samt samma sak per lager och per objekt." msgid "Debug level" msgstr "Felsökningsnivå" @@ -33073,1231 +33097,1647 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "Den aktuella filamentlistan innehåller inte %s. Ett projektfilament som det blandade filamentet kräver skapas automatiskt efter uppdelningen." msgstr[1] "Den aktuella filamentlistan innehåller inte %s. Projektfilament som det blandade filamentet kräver skapas automatiskt efter uppdelningen." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Färgväljare" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Grundfärger" +# AI Translated +# Needs human review: Glossary has no Swedish rendering for Palette; check 'palett' (also Paletter). #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca-palett" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Klassisk" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Gradienter" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Enfärgad" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Gradient" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Gradientstart" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Gradientslut" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Gradientfärg" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Lägg till färg" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Ta bort färg" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Färgmättnad" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Ursprunglig färg" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Spara aktuell färg" +# AI Translated +# Needs human review: Glossary has no Swedish rendering for Palette; check 'Paletter'. msgid "Palettes" -msgstr "" +msgstr "Paletter" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Sök färger" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Filtrera färger" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Inga matchande färger" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Hexfärg" # AI Translated msgid "Opacity" msgstr "Opacitet" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Opacitet i procent" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Spara färg" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Ange en komplett hexadecimal färg" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Det aktuella flerfärgsvalet behålls tills du väljer en annan färg." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Upp till %d färger stöds." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Karmosinröd" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Orangeröd" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Tomatröd" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Orange" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Mörkorange" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Guld" +# AI Translated +# Needs human review: CSS color; check Träbrun conveys burlywood (light tan wood). msgid "Burly wood" -msgstr "" +msgstr "Träbrun" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Aprikosbeige" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Dimrosa" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Ljusgul" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Citronchiffong" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Beige" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Ljus gullrisgul" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Blek gullrisgul" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Khaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Mörk khaki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Persikokräm" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mockasin" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papayakräm" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Blancherad mandel" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antikvit" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navajovit" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Vete" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Gullrisgul" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Choklad" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Tegelröd" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Sienna" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Sadelbrun" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Brun" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Rosabrun" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Lax" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Ljus lax" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Mörk lax" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Sandbrun" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Korall" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Ljus korall" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Indianröd" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Mörkröd" +# AI Translated +# Needs human review: Kept as Maroon (loan word); Rödbrun/Brunröd are taken by RAL names. msgid "Maroon" -msgstr "" +msgstr "Maroon" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Gröngul" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Gulgrön" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Gräsmattegrön" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Limegrön" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Vårgrön" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Mellan vårgrön" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Lime" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Skogsgrön" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Mörkgrön" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Armégrön" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Oliv" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Mörk olivgrön" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Blekgrön" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Ljusgrön" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Mellan havsgrön" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Havsgrön" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Mörk havsgrön" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Kadettblå" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Mellan akvamarin" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turkos" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Mellanturkos" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Mörkturkos" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Blekturkos" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Ljuscyan" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Mintkräm" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Honungsmelon" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Akvamarin" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Ljus havsgrön" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Mörkcyan" +# AI Translated +# Needs human review: Rendered Petrol; check it reads as teal. msgid "Teal" -msgstr "" +msgstr "Petrol" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Mörk skiffergrå" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Ljus skiffergrå" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Skiffergrå" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Djup himmelsblå" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodgerblå" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Himmelsblå" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Ljus himmelsblå" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Ljusblå" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Pulverblå" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Ljus stålblå" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Stålblå" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Blåklintsblå" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Kungsblå" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Mellanblå" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Midnattsblå" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Mörkblå" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Marinblå" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Skifferblå" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Mörk skifferblå" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Mellan skifferblå" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Blåviolett" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Indigo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Mörkviolett" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Mörk orkidé" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Mellan orkidé" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orkidé" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Violett" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Mellanlila" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Lila" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebecca-lila" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Mellan violettröd" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Blek violettröd" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Djuprosa" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Knallrosa" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Ljusrosa" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Rosa" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Plommon" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Tistel" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuchsia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Mörk magenta" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Linne" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Gammal spets" +# AI Translated msgid "Sea shell" -msgstr "" +msgstr "Snäckskal" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Elfenben" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Blomvit" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lavendelrosa" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Spökvit" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Alice-blå" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lavendel" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Rökvit" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Svart" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Korallglöd" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Havsanemon" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Djup avgrund" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Hummerröd" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Sandlera" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Drivved" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Havtorn" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Solnedgångsrev" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Tigerkorall" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Rosa korall" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Snäckskalsglöd" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Sand" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Gyllene tång" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Solbelyst dyn" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Bärnstensnautilus" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Havscitron" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Blek sjöstjärna" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Springflod" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Limealg" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Ålgräs" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neonplankton" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Tångskog" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Smaragdvåg" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Valskugga" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Havssköldpadda" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Lagun" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Tropisk ström" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Midnattsgrav" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Mörk tång" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Kristallbränning" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Turkos vik" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Himmel över revet" +# AI Translated +# Needs human review: Ocean-themed color name; check 'Grund himmel' reads as a color. msgid "Shallow sky" -msgstr "" +msgstr "Grund himmel" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektrisk blå" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Delfin" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Havsdjup" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Val" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Indigoavgrund" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Sjöborre" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Lavendelkorall" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Violett tidvatten" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Djuphavsorkidé" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neonmanet" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuchsiakorall" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Rosa manet" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Skum" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Snäckskalsvit" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Kiselgrå" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Stormmoln" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Bläckssvart" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Grönbeige" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Sandgul" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Signalgul" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Gyllengul" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Honungsgul" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Majsgul" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Påskliljegul" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Brunbeige" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Citrongul" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Ostronvit" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Ljust elfenben" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Zinkgul" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Gråbeige" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Olivgul" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Rapsgul" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Trafikgul" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Ockragul" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Trafikorangegul" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Curry" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Melongul" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Ginstgul" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Dahliagul" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pastellgul" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Pärlbeige" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Pärlguld" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Solgul" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Gulorange" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Djuporange" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Cinnober" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Pärlorange" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Ren orange" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Lysorange" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Ljus lysorange" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Ljus rödorange" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Trafikorange" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Signalorange" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Laxorange" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Pärlrosa" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Kopparorange" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Signalbrun" +# AI Translated +# Needs human review: Odd RAL name; translated literally as Granorange. msgid "Fir orange" -msgstr "" +msgstr "Granorange" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Signalröd" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Lysröd" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karminröd" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Pärlkarminröd" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Ren röd" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Djup lysröd" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Vinbärsröd" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Pärlrubinröd" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Eldröd" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Rubinröd" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Lilaröd" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Vinröd" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Svartröd" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oxidröd" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Brunröd" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Tallröd" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Tomatröd" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Antikrosa" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Korallröd" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Ros" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Jordgubbsröd" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Trafikröd" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Laxrosa" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Lysrosa" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Ljus lysröd" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Hallonröd" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Orientröd" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Pärlrubin" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Rödlila" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Rödviolett" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Ljungviolett" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordeauxviolett" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Mahogny" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Grålila" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Signalviolett" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Grangrön" +# AI Translated +# Needs human review: RAL name; check the Swedish form. msgid "Sabine grey" -msgstr "" +msgstr "Sabinegrå" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Pärlviolett" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Pärlbjörnbär" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Grönblå" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarinblå" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Safirblå" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Svartblå" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Signalblå" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Briljantblå" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Gråblå" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azurblå" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Gentianablå" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Koboltblå" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Duvblå" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Trafikblå" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Turkosblå" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Capriblå" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Havsblå" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Vattenblå" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Nattblå" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Avlägsen blå" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pastellblå" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Pärlgentianablå" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Pärlmidnattsblå" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patinagrön" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Smaragdgrön" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Lövgrön" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Olivgrön" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Blågrön" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Mossgrön" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Gråoliv" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Tallgrön" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Tallbrun" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Gräsgrön" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Resedagrön" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Brungrön" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Vassgrön" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Svartgrön" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Turkosgrön" +# AI Translated msgid "May green" -msgstr "" +msgstr "Majgrön" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Kromoxidgrön" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Trafikgrön" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Ormbunksgrön" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opalgrön" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Mintgrön" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Bronsgrön" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Pärlgrön" +# AI Translated +# Needs human review: RAL name; check the Swedish form. msgid "Sax turquoise" -msgstr "" +msgstr "Saxturkos" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Pärlturkos" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Pärljade" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Ren grön" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Lysgrön" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Ekorrgrå" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Silvergrå" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Olivgrå" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Mossgrå" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Signalgrå" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Musgrå" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Beigegrå" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Khakigrå" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Gröngrå" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Presenninggrå" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Järngrå" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Basaltgrå" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Brungrå" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Skiffergrå" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antracitgrå" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Ljusgrå" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umbragrå" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Betonggrå" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafitgrå" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Granitgrå" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Stengrå" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Kiselgrå" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Cementgrå" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Gulgrå" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platinagrå" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Dammgrå" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Agatgrå" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Kvartsgrå" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Fönstergrå" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Trafikgrå A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Trafikgrå B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Sidengrå" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegrå 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegrå 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegrå 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Pärlmusgrå" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Grönbrun" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Ockrabrun" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Lerbrun" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Kopparbrun" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Chokladbrun" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Olivbrun" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Nötbrun" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Rödbrun" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sepiabrun" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Kastanjebrun" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Mahognybrun" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Gråbrun" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Pärlkoppar" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Beigebrun" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Pärlmockabrun" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Jordbrun" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Pärlbrun" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Kräm" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Gråvit" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Signalvit" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Signalsvart" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Kolsvart" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Vitt aluminium" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Grått aluminium" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Ren vit" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Grafitsvart" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Trafikvit" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Trafiksvart" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papyrusvit" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Pärl-ljusgrå" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metall: Silver" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metall: Mässing" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metall: Guld" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metall: Koppar" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metall: Brons" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Natur: Pärla" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Natur: Regnbåge" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Natur: Klar himmel" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Natur: Solnedgång" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Trä: Mörkt" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Trä: Medel" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Trä: Ljust" # AI Translated msgid "Alternate nozzles:" @@ -34773,13 +35213,25 @@ msgstr "Ta bort från Mina texturer" msgid "Built-in" msgstr "Inbyggda" +# AI Translated +msgid "My textures" +msgstr "Mina texturer" + # AI Translated msgid "No textures found." msgstr "Inga texturer hittades." # AI Translated -msgid "My textures" -msgstr "Mina texturer" +msgid "Texture libraries" +msgstr "Texturbibliotek" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Utforska fler texturbibliotek" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Öppnar OrcaCloud på startsidan för att bläddra bland insticksmoduler." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -35182,11 +35634,13 @@ msgstr "Mappas av modellens egen UV-layout, som redan är placeringen - en kopia msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Hur bred en kopia av texturen är på modellen. Mindre värden upprepar mönstret oftare och gör detaljerna finare; med Sida vid sida avstängt är detta storleken på den enda kopian." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Större" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Mindre" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -35262,11 +35716,15 @@ msgstr "Blandade färger" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Det högsta antalet blandade filament som en inbakning får lägga till. De väljs ur texturens färger, och endast de som inbakningen faktiskt använder skapas." +# AI Translated +# Needs human review: Bare label in the app; check Få/Många fit their context. msgid "Few" -msgstr "" +msgstr "Få" +# AI Translated +# Needs human review: Bare label in the app; check Få/Många fit their context. msgid "Many" -msgstr "" +msgstr "Många" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -35622,11 +36080,15 @@ msgstr "Ombyggnad av mesh" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Triangelstorleken som hela modellen byggs om med, i millimeter. Förskjutning fungerar bäst på en jämn mesh; det är detta som skapar en sådan av en ojämn import." +# AI Translated +# Needs human review: Bare label in the app; check Före/Efter fit their context. msgid "Before" -msgstr "" +msgstr "Före" +# AI Translated +# Needs human review: Bare label in the app; check Före/Efter fit their context. msgid "After" -msgstr "" +msgstr "Efter" # AI Translated msgid "Keep sharp edges" @@ -37498,6 +37960,10 @@ msgstr "Skript" msgid "Slicing Pipeline" msgstr "Beredningspipeline" +# AI Translated +msgid "Resource Texture" +msgstr "Resurstextur" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Insticksmodulens konfigurationsgränssnitt var tomt. Standardredigeraren visas." @@ -37645,6 +38111,30 @@ msgstr "Insticksmodulens mapp innehåller både .py- och .whl-startfiler" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Insticksmodulens mapp innehåller ingen .py- eller .whl-startfil" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Mappen för resurstexturer är inte angiven" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Mappen för resurstexturer kunde inte lösas upp" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Sökvägen för resurstexturer är ingen mapp" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Insticksmodulens mapp kunde inte lösas upp" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Mappen för resurstexturer ligger utanför insticksmodulens mapp" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Mappen för resurstexturer kunde inte läsas" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -38609,6 +39099,28 @@ msgstr "" "Undvik vridning\n" "Visste du att när du skriver ut material som är benägna att vrida, såsom ABS, kan en lämplig ökning av värmebäddens temperatur minska sannolikheten för vridning?" +# AI Translated +# Needs human review: Possibly meant Daffodil yellow (RAL 1007); translated literally. +#~ msgid "Dalmatian yellow" +#~ msgstr "Dalmatinergul" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Capsanthinviolett" + +# AI Translated +# Needs human review: Probably RAL Olive grey; translated as Olivgrå. +#~ msgid "Olivestone" +#~ msgstr "Olivgrå" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Tillgängligt överallt i fönstret, även när du skriver i ett textfält." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Globala kortkommandon gäller även när du skriver." + # AI Translated #~ msgid "Please choose the filament color" #~ msgstr "Välj filamentfärg" diff --git a/localization/i18n/th/OrcaSlicer_th.po b/localization/i18n/th/OrcaSlicer_th.po index 80274623aa..0f076d2209 100644 --- a/localization/i18n/th/OrcaSlicer_th.po +++ b/localization/i18n/th/OrcaSlicer_th.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2026-06-19 13:40+0700\n" "Last-Translator: Icezaza\n" "Language-Team: Thai\n" @@ -799,18 +799,21 @@ msgstr "การเลือก" msgid "Plate" msgstr "เพลต" +# AI Translated msgid "Distribute" -msgstr "" +msgstr "กระจาย" # AI Translated msgid "Coordinate system used for transform actions." msgstr "ระบบพิกัดที่ใช้สำหรับการแปลงรูป" +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "ตัวอ้างอิงสำหรับการจัดแนว" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "เลือกชิ้นส่วนหรือวัตถุอย่างน้อย 3 รายการ" # AI Translated msgid "Align left" @@ -863,8 +866,9 @@ msgstr "กระจายในแนวบน-ล่าง" msgid "Drop" msgstr "วางลงฐานพิมพ์" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "เลื่อนส่วนที่เลือกไปตามแกน Z ให้จุดต่ำสุดแตะฐานพิมพ์" # AI Translated msgid "Absolute" @@ -2081,17 +2085,21 @@ msgstr "เข้าสู่กิซโมการประกอบ" msgid "Leaving Assembly gizmo" msgstr "ออกจากกิซโมการประกอบ" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "ไม่สามารถย้ายชิ้นส่วนของวัตถุที่ถูกตัดได้" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "การจัดแนวกับเพลตทำได้เฉพาะแกน X และ Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "ปิดการวางอัตโนมัติของวัตถุที่เลือกเพื่อย้ายในแกน Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "วัตถุที่เลือกทั้งหมดต้องอยู่บนเพลตเดียวกัน" msgid "Shift+" msgstr "Shift+" @@ -6501,8 +6509,9 @@ msgstr "แกน" msgid "Gridlines" msgstr "เส้นกริด" +# AI Translated msgid "Focus mode" -msgstr "" +msgstr "โหมดโฟกัส" msgid "Labels" msgstr "ป้ายชื่อ" @@ -6564,7 +6573,7 @@ msgid "Size:" msgstr "ขนาด:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "พบความขัดแย้งของเส้นทาง G-code ที่เลเยอร์ %d, Z = %.2lfmm โปรดแยกวัตถุที่ขัดแย้งกันให้ไกลออกไป (%s <-> %s)" @@ -10863,11 +10872,14 @@ msgstr "แสดงค่าที่ตั้งไว้ล่วงหน้ msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "แสดงค่าที่ตั้งไว้ล่วงหน้าที่ไม่เข้ากันหรือไม่รองรับในรายการเลือกเครื่องพิมพ์และเส้นพลาสติก ไม่สามารถเลือกค่าที่ตั้งไว้ล่วงหน้าเหล่านี้ได้" +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "ส่งออกสถิติพร้อมกับ G-code" +# AI Translated +# Needs human review: "feature" rendered as line type (ประเภทเส้น / Loại đường); check this matches the per-feature totals in the exported JSON msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "เมื่อเปิดใช้งาน การส่งออกไฟล์ G-code จะเขียนสถิติของไฟล์นั้นเป็น JSON ไว้ข้างกันด้วย ในชื่อ .statistics.json และไฟล์ 3MF ที่สไลซ์แล้วซึ่งส่งออกจะมีสถิตินี้อยู่ภายใน ได้แก่ เวลาพิมพ์ ยอดรวมของเส้นพลาสติกและประเภทเส้น และข้อมูลเดียวกันนี้แยกตามเลเยอร์และตามวัตถุ" # AI Translated msgid "Experimental Features" @@ -11731,6 +11743,10 @@ msgstr "ไม่สามารถอัปโหลดไฟล์ไปยั msgid "Send Failed" msgstr "ส่งล้มเหลว" +# AI Translated +msgid "No available printers" +msgstr "ไม่มีเครื่องพิมพ์ที่พร้อมใช้งาน" + msgid "The name length exceeds the limit." msgstr "ชื่อมีความยาวเกินขีดจำกัด" @@ -13582,8 +13598,8 @@ msgid "Left mouse" msgstr "เมาส์ซ้าย" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "ใช้ได้ทุกที่ในหน้าต่าง แม้ขณะพิมพ์ในช่องข้อความ" +msgid "Available anywhere in the window." +msgstr "ใช้ได้ทุกที่ในหน้าต่าง" # AI Translated msgid "Run favorite 1 to 10" @@ -13695,10 +13711,6 @@ msgstr "%s ถูกกำหนดให้กับ %s แล้ว กำห msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "%s ซึ่งเป็นค่าเริ่มต้นถูกกำหนดให้กับ %s แล้ว กำหนดใหม่ให้กับ %s หรือไม่" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "แป้นพิมพ์ลัดส่วนกลางจะทำงานแม้ขณะพิมพ์ข้อความ" - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "ปุ่มที่พิมพ์ตัวอักษรไม่สามารถเป็นแป้นพิมพ์ลัดส่วนกลางได้" @@ -14143,9 +14155,10 @@ msgstr "ตัวปรับแต่ง \"%1%\" ของ \"%2%\" (ทั้ msgid "Seam placement may differ from expected." msgstr "ตำแหน่งรอยตะเข็บอาจแตกต่างจากที่คาดไว้" +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "เขียนสถิติ G-code ไปยัง %1% ไม่สำเร็จ" msgid "Internal Bridge" msgstr "สะพานภายใน" @@ -17621,6 +17634,14 @@ msgstr "ไม่รวมวัตถุ" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "เปิดใช้งานตัวเลือกนี้เพื่อเพิ่มคำสั่ง EXCLUDE OBJECT ใน G-code" +# AI Translated +msgid "Outline tolerance" +msgstr "ค่าความเผื่อเส้นขอบ" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "ค่าเบี่ยงเบนสูงสุดของเส้นขอบวัตถุที่เขียนลงใน EXCLUDE_OBJECT_DEFINE จากเส้นขอบเดิม ค่าที่มากขึ้นจะให้จำนวนจุดน้อยลง ซึ่งช่วยเฟิร์มแวร์ที่ค้างขณะแยกวิเคราะห์ G-code ที่มีวัตถุจำนวนมาก ค่า 0 คือเก็บทุกจุดไว้" + msgid "Verbose G-code" msgstr "G-code แบบละเอียด" @@ -20894,11 +20915,14 @@ msgstr "ไดเร็กทอรีเอาต์พุต" msgid "This is the output directory for exported files." msgstr "ไดเร็กทอรีเอาต์พุตสำหรับไฟล์ที่ส่งออก" +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "ส่งออกสถิติ" +# AI Translated +# Needs human review: "feature" rendered as line type (ประเภทเส้น / Loại đường); check this matches the per-feature totals in the exported JSON msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "เขียนสถิติของแต่ละเพลตที่สไลซ์แล้วเป็น JSON ชื่อ plate_N.statistics.json ไว้ข้างไฟล์ G-code ในโฟลเดอร์ปลายทาง และภายใน 3MF ของ --export-3mf ได้แก่ เวลาพิมพ์ ยอดรวมของเส้นพลาสติกและประเภทเส้น และข้อมูลเดียวกันนี้แยกตามเลเยอร์และตามวัตถุ" msgid "Debug level" msgstr "ระดับการแก้ไขข้อบกพร่อง" @@ -30676,1231 +30700,1641 @@ msgid "The current filament list does not contain %s. A project filament require msgid_plural "The current filament list does not contain %s. Project filaments required by the mixed filament will be created automatically after decomposition." msgstr[0] "รายการเส้นพลาสติกปัจจุบันไม่มี %s เส้นพลาสติกโครงการที่เส้นพลาสติกผสมต้องใช้จะถูกสร้างขึ้นโดยอัตโนมัติหลังจากแยกสี" +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "ตัวเลือกสี" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "สีพื้นฐาน" +# AI Translated #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "จานสี Orca" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL คลาสสิก" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "การไล่ระดับสี" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "สีเดียว" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "ไล่ระดับสี" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "จุดเริ่มต้นการไล่ระดับสี" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "จุดสิ้นสุดการไล่ระดับสี" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "สีของการไล่ระดับสี" +# AI Translated msgid "Add color" -msgstr "" +msgstr "เพิ่มสี" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "ลบสี" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "ความอิ่มตัว" +# AI Translated msgid "Original color" -msgstr "" +msgstr "สีเดิม" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "บันทึกสีปัจจุบัน" +# AI Translated msgid "Palettes" -msgstr "" +msgstr "จานสี" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "ค้นหาสี" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "กรองสี" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "ไม่มีสีที่ตรงกัน" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "สีเลขฐานสิบหก" # AI Translated msgid "Opacity" msgstr "ความทึบแสง" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "เปอร์เซ็นต์ความทึบแสง" +# AI Translated msgid "Save color" -msgstr "" +msgstr "บันทึกสี" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "ป้อนสีเลขฐานสิบหกให้ครบถ้วน" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "การเลือกหลายสีปัจจุบันจะคงไว้จนกว่าคุณจะเลือกสีอื่น" +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "รองรับสูงสุด %d สี" +# AI Translated msgid "Crimson" -msgstr "" +msgstr "แดงคริมสัน" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "แดงส้ม" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "แดงมะเขือเทศ" +# AI Translated msgid "Orange" -msgstr "" +msgstr "ส้ม" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "ส้มเข้ม" +# AI Translated msgid "Gold" -msgstr "" +msgstr "ทอง" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "น้ำตาลไม้อ่อน" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "ส้มครีม" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "ชมพูหมอก" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "เหลืองอ่อน" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "ครีมเลมอน" +# AI Translated msgid "Beige" -msgstr "" +msgstr "เบจ" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "เหลืองขมิ้นอ่อน" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "เหลืองขมิ้นซีด" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "กากี" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "กากีเข้ม" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "พีชอ่อน" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "เหลืองหนังกวาง" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "ครีมมะละกอ" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "อัลมอนด์ลอกเปลือก" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "ขาวโบราณ" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "ขาวนาวาโฮ" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "ข้าวสาลี" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "เหลืองขมิ้น" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "ช็อกโกแลต" +# AI Translated msgid "Peru" -msgstr "" +msgstr "น้ำตาลเปรู" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "อิฐทนไฟ" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "น้ำตาลเซียนนา" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "น้ำตาลอานม้า" +# AI Translated msgid "Brown" -msgstr "" +msgstr "น้ำตาล" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "น้ำตาลกุหลาบ" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "แซลมอน" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "แซลมอนอ่อน" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "แซลมอนเข้ม" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "น้ำตาลทราย" +# AI Translated msgid "Coral" -msgstr "" +msgstr "ปะการัง" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "ปะการังอ่อน" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "แดงอินเดียน" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "แดงเข้ม" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "แดงเลือดหมู" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "เหลืองเขียว" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "เขียวเหลือง" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "ชาร์เทรอส" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "เขียวสนามหญ้า" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "เขียวมะนาว" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "เขียวฤดูใบไม้ผลิ" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "เขียวฤดูใบไม้ผลิกลาง" +# AI Translated msgid "Lime" -msgstr "" +msgstr "ไลม์" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "เขียวป่า" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "เขียวเข้ม" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "เขียวมะกอกหม่น" +# AI Translated msgid "Olive" -msgstr "" +msgstr "มะกอก" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "เขียวมะกอกเข้ม" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "เขียวซีด" +# AI Translated msgid "Light green" -msgstr "" +msgstr "เขียวอ่อน" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "เขียวทะเลกลาง" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "เขียวทะเล" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "เขียวทะเลเข้ม" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "น้ำเงินแคเด็ต" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "อความารีนกลาง" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "เทอร์ควอยซ์" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "เทอร์ควอยซ์กลาง" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "เทอร์ควอยซ์เข้ม" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "เทอร์ควอยซ์ซีด" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "อควา" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "ไซแอนอ่อน" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "ครีมมินต์" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "ฮันนีดิว" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "อความารีน" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "เขียวทะเลอ่อน" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "ไซแอนเข้ม" +# AI Translated msgid "Teal" -msgstr "" +msgstr "เขียวหัวเป็ด" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "เทาหินชนวนเข้ม" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "เทาหินชนวนอ่อน" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "เทาหินชนวน" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "ฟ้าท้องฟ้าเข้ม" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "น้ำเงินดอดเจอร์" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "ฟ้าท้องฟ้า" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "ฟ้าท้องฟ้าอ่อน" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "ฟ้าอ่อน" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "ฟ้าแป้ง" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "น้ำเงินเหล็กอ่อน" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "น้ำเงินเหล็ก" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "น้ำเงินคอร์นฟลาวเวอร์" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "น้ำเงินรอยัล" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "น้ำเงินกลาง" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "น้ำเงินเที่ยงคืน" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "น้ำเงินเข้ม" +# AI Translated msgid "Navy" -msgstr "" +msgstr "น้ำเงินกรมท่า" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "น้ำเงินหินชนวน" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "น้ำเงินหินชนวนเข้ม" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "น้ำเงินหินชนวนกลาง" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "ม่วงน้ำเงิน" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "คราม" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "ไวโอเล็ตเข้ม" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "กล้วยไม้เข้ม" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "กล้วยไม้กลาง" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "กล้วยไม้" +# AI Translated msgid "Violet" -msgstr "" +msgstr "ไวโอเล็ต" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "ม่วงกลาง" +# AI Translated msgid "Purple" -msgstr "" +msgstr "ม่วง" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "ม่วงเรเบกกา" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "แดงไวโอเล็ตกลาง" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "แดงไวโอเล็ตซีด" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "ชมพูเข้ม" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "ชมพูสด" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "ชมพูอ่อน" +# AI Translated msgid "Pink" -msgstr "" +msgstr "ชมพู" +# AI Translated msgid "Plum" -msgstr "" +msgstr "ม่วงบ๊วย" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "ม่วงธิสเซิล" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "ฟูเชีย" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "แมเจนตาเข้ม" +# AI Translated msgid "Linen" -msgstr "" +msgstr "ผ้าลินิน" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "ลูกไม้เก่า" +# AI Translated msgid "Sea shell" -msgstr "" +msgstr "เปลือกหอย" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "งาช้าง" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "ขาวดอกไม้" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "ลาเวนเดอร์อมชมพู" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "ขาวโกสต์" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "ฟ้าอลิซ" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "ลาเวนเดอร์" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "ขาวควัน" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "เกนส์โบโร" +# AI Translated msgid "Black" -msgstr "" +msgstr "ดำ" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "ปะการังเพลิง" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "ดอกไม้ทะเล" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "ห้วงเหวลึก" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "แดงกุ้งมังกร" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "ดินเหนียวปนทราย" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "ไม้ลอยน้ำ" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "ซีบัคธอร์น" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "แนวปะการังยามอาทิตย์ตก" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "ปะการังเสือ" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "ปะการังชมพู" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "ประกายเปลือกหอย" +# AI Translated msgid "Sand" -msgstr "" +msgstr "ทราย" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "สาหร่ายเคลป์สีทอง" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "เนินทรายยามแดด" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "นอติลุสอำพัน" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "มะนาวทะเล" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "ดาวทะเลซีด" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "น้ำเกิด" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "สาหร่ายเขียวมะนาว" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "หญ้าทะเล" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "แพลงก์ตอนนีออน" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "ป่าสาหร่ายเคลป์" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "คลื่นมรกต" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "เงาวาฬ" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "เต่าทะเล" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "ลากูน" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "กระแสน้ำเขตร้อน" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "ร่องลึกยามเที่ยงคืน" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "สาหร่ายเคลป์เข้ม" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "คลื่นคริสตัล" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "อ่าวเทอร์ควอยซ์" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "ท้องฟ้าเหนือแนวปะการัง" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "ท้องฟ้าน้ำตื้น" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "น้ำเงินอิเล็กทริก" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "โลมา" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "ห้วงลึกมหาสมุทร" +# AI Translated msgid "Whale" -msgstr "" +msgstr "วาฬ" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "ห้วงลึกสีคราม" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "เม่นทะเล" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "ปะการังลาเวนเดอร์" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "กระแสน้ำไวโอเล็ต" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "กล้วยไม้ทะเลลึก" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "แมงกะพรุนนีออน" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "ปะการังฟูเชีย" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "แมงกะพรุนชมพู" +# AI Translated msgid "Foam" -msgstr "" +msgstr "ฟองคลื่น" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "ขาวเปลือกหอย" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "เทาก้อนกรวด" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "เมฆพายุ" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "ดำหมึก" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "เบจเขียว" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "เหลืองทราย" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "เหลืองสัญญาณ" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "เหลืองทอง" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "เหลืองน้ำผึ้ง" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "เหลืองข้าวโพด" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "เหลืองแดฟโฟดิล" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "เบจน้ำตาล" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "เหลืองเลมอน" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "ขาวหอยนางรม" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "งาช้างอ่อน" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "เหลืองสังกะสี" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "เบจเทา" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "เหลืองมะกอก" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "เหลืองดอกเรพ" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "เหลืองจราจร" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "เหลืองออคเคอร์" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "เหลืองส้มจราจร" +# AI Translated msgid "Curry" -msgstr "" +msgstr "แกงกะหรี่" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "เหลืองเมลอน" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "เหลืองดอกบรูม" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "เหลืองดาห์เลีย" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "เหลืองพาสเทล" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "เบจมุก" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "ทองมุก" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "เหลืองอาทิตย์" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "ส้มเหลือง" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "ส้มเข้มจัด" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "แดงชาด" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "ส้มมุก" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "ส้มบริสุทธิ์" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "ส้มเรืองแสง" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "ส้มสดเรืองแสง" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "ส้มแดงสด" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "ส้มจราจร" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "ส้มสัญญาณ" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "ส้มแซลมอน" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "ชมพูมุก" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "ส้มทองแดง" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "น้ำตาลสัญญาณ" +# AI Translated msgid "Fir orange" -msgstr "" +msgstr "ส้มเฟอร์" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "แดงสัญญาณ" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "แดงเรืองแสง" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "แดงคาร์ไมน์" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "แดงคาร์ไมน์มุก" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "แดงบริสุทธิ์" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "แดงเข้มเรืองแสง" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "แดงเคอร์แรนต์" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "แดงทับทิมมุก" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "แดงเพลิง" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "แดงทับทิม" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "แดงม่วง" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "แดงไวน์" +# AI Translated msgid "Black red" -msgstr "" +msgstr "แดงดำ" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "แดงออกไซด์" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "แดงน้ำตาล" +# AI Translated +# Needs human review: Source name "Pine red" looks unusual for a RAL color; translated literally msgid "Pine red" -msgstr "" +msgstr "แดงต้นสน" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "แดงมะเขือเทศ" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "ชมพูโบราณ" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "แดงปะการัง" +# AI Translated msgid "Rose" -msgstr "" +msgstr "กุหลาบ" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "แดงสตรอว์เบอร์รี" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "แดงจราจร" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "ชมพูแซลมอน" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "กุหลาบเรืองแสง" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "แดงสดเรืองแสง" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "แดงราสเบอร์รี" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "แดงตะวันออก" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "ทับทิมมุก" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "ม่วงแดง" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "ไวโอเล็ตแดง" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "ไวโอเล็ตเฮเทอร์" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "ไวโอเล็ตบอร์โดซ์" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "มะฮอกกานี" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "ม่วงเทา" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "ไวโอเล็ตสัญญาณ" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "เขียวเฟอร์" +# AI Translated msgid "Sabine grey" -msgstr "" +msgstr "เทาซาบีน" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "ไวโอเล็ตมุก" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "แบล็กเบอร์รีมุก" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "น้ำเงินเขียว" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "น้ำเงินอัลตรามารีน" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "น้ำเงินไพลิน" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "น้ำเงินดำ" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "น้ำเงินสัญญาณ" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "น้ำเงินสดใส" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "น้ำเงินเทา" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "ฟ้าอาซูร์" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "น้ำเงินเจนเชียน" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "น้ำเงินโคบอลต์" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "น้ำเงินนกพิราบ" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "น้ำเงินจราจร" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "น้ำเงินเทอร์ควอยซ์" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "น้ำเงินคาปรี" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "น้ำเงินมหาสมุทร" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "ฟ้าสีน้ำ" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "น้ำเงินราตรี" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "ฟ้าไกล" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "ฟ้าพาสเทล" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "น้ำเงินเจนเชียนมุก" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "น้ำเงินเที่ยงคืนมุก" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "เขียวสนิม" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "เขียวมรกต" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "เขียวใบไม้" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "เขียวมะกอก" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "เขียวน้ำเงิน" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "เขียวมอส" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "มะกอกเทา" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "เขียวสน" +# AI Translated +# Needs human review: Source name "Pine brown" looks unusual for a RAL color; translated literally msgid "Pine brown" -msgstr "" +msgstr "น้ำตาลสน" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "เขียวหญ้า" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "เขียวเรเซดา" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "เขียวน้ำตาล" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "เขียวต้นอ้อ" +# AI Translated msgid "Black green" -msgstr "" +msgstr "เขียวดำ" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "เขียวเทอร์ควอยซ์" +# AI Translated msgid "May green" -msgstr "" +msgstr "เขียวเดือนพฤษภาคม" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "เขียวโครมออกไซด์" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "เขียวจราจร" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "เขียวเฟิร์น" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "เขียวโอปอล" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "เขียวมินต์" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "เขียวบรอนซ์" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "เขียวมุก" +# AI Translated +# Needs human review: Unusual source name ("Sax turquoise"); translated literally msgid "Sax turquoise" -msgstr "" +msgstr "เทอร์ควอยซ์แซกซ์" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "เทอร์ควอยซ์มุก" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "หยกมุก" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "เขียวบริสุทธิ์" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "เขียวเรืองแสง" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "เทากระรอก" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "เทาเงิน" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "เทามะกอก" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "เทามอส" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "เทาสัญญาณ" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "เทาหนู" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "เทาเบจ" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "เทากากี" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "เทาเขียว" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "เทาผ้าใบ" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "เทาเหล็ก" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "เทาบะซอลต์" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "เทาน้ำตาล" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "เทาหินชนวน" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "เทาแอนทราไซต์" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "เทาอ่อน" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "เทาอัมเบอร์" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "เทาคอนกรีต" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "เทากราไฟต์" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "เทาหินแกรนิต" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "เทาหิน" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "เทาก้อนกรวด" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "เทาซีเมนต์" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "เทาเหลือง" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "เทาแพลทินัม" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "เทาฝุ่น" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "เทาอาเกต" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "เทาควอตซ์" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "เทาหน้าต่าง" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "เทาจราจร A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "เทาจราจร B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "เทาไหม" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "เทเลเกรย์ 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "เทเลเกรย์ 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "เทเลเกรย์ 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "เทาหนูมุก" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "น้ำตาลเขียว" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "น้ำตาลออคเคอร์" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "น้ำตาลดินเหนียว" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "น้ำตาลทองแดง" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "น้ำตาลช็อกโกแลต" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "น้ำตาลมะกอก" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "น้ำตาลถั่ว" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "น้ำตาลแดง" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "น้ำตาลซีเปีย" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "น้ำตาลเกาลัด" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "น้ำตาลมะฮอกกานี" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "น้ำตาลเทา" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "ทองแดงมุก" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "น้ำตาลเบจ" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "น้ำตาลม็อกค่ามุก" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "น้ำตาลดิน" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "น้ำตาลมุก" +# AI Translated msgid "Cream" -msgstr "" +msgstr "ครีม" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "ขาวเทา" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "ขาวสัญญาณ" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "ดำสัญญาณ" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "ดำสนิท" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "อะลูมิเนียมขาว" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "อะลูมิเนียมเทา" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "ขาวบริสุทธิ์" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "ดำกราไฟต์" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "ขาวจราจร" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "ดำจราจร" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "ขาวปาปิรุส" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "เทาอ่อนมุก" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "โลหะ: เงิน" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "โลหะ: ทองเหลือง" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "โลหะ: ทอง" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "โลหะ: ทองแดง" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "โลหะ: บรอนซ์" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "ธรรมชาติ: มุก" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "ธรรมชาติ: สายรุ้ง" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "ธรรมชาติ: ท้องฟ้าโปร่ง" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "ธรรมชาติ: พระอาทิตย์ตก" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "ไม้: เข้ม" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "ไม้: ปานกลาง" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "ไม้: อ่อน" # AI Translated msgid "Alternate nozzles:" @@ -32376,13 +32810,25 @@ msgstr "นำออกจาก พื้นผิวของฉัน" msgid "Built-in" msgstr "ในตัว" +# AI Translated +msgid "My textures" +msgstr "พื้นผิวของฉัน" + # AI Translated msgid "No textures found." msgstr "ไม่พบพื้นผิว" # AI Translated -msgid "My textures" -msgstr "พื้นผิวของฉัน" +msgid "Texture libraries" +msgstr "คลังพื้นผิว" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "สำรวจคลังพื้นผิวเพิ่มเติม" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "เปิด OrcaCloud ในหน้าแรกเพื่อเรียกดูปลั๊กอิน" # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -32785,11 +33231,13 @@ msgstr "แมปด้วยเลย์เอาต์ UV ของโมเ msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "ความกว้างของพื้นผิวหนึ่งชุดบนโมเดล ค่าที่เล็กลงจะทำให้ลวดลายซ้ำบ่อยขึ้นและมีรายละเอียดละเอียดขึ้น เมื่อปิด ไทล์ ค่านี้คือขนาดของสำเนาเดียว" +# AI Translated msgid "Larger" -msgstr "" +msgstr "ใหญ่ขึ้น" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "เล็กลง" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -32865,11 +33313,13 @@ msgstr "สีผสม" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "จำนวนเส้นพลาสติกผสมสูงสุดที่การอบอาจเพิ่มได้ โดยเลือกจากสีของพื้นผิว และจะสร้างเฉพาะเส้นที่การอบใช้จริงเท่านั้น" +# AI Translated msgid "Few" -msgstr "" +msgstr "น้อย" +# AI Translated msgid "Many" -msgstr "" +msgstr "มาก" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33220,11 +33670,13 @@ msgstr "การรีเมช" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "ขนาดสามเหลี่ยมที่ใช้สร้างทั้งโมเดลใหม่ หน่วยเป็นมม. การกระจัดทำงานได้ดีที่สุดบนเมชที่สม่ำเสมอ ซึ่งค่านี้จะช่วยสร้างเมชดังกล่าวจากไฟล์นำเข้าที่ไม่สม่ำเสมอ" +# AI Translated msgid "Before" -msgstr "" +msgstr "ก่อน" +# AI Translated msgid "After" -msgstr "" +msgstr "หลัง" # AI Translated msgid "Keep sharp edges" @@ -35077,6 +35529,10 @@ msgstr "สคริปต์" msgid "Slicing Pipeline" msgstr "ไปป์ไลน์การสไลซ์" +# AI Translated +msgid "Resource Texture" +msgstr "พื้นผิวทรัพยากร" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "UI การกำหนดค่าของปลั๊กอินว่างเปล่า กำลังแสดงตัวแก้ไขเริ่มต้น" @@ -35224,6 +35680,30 @@ msgstr "ไดเรกทอรีปลั๊กอินมีทั้งไ msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "ไดเรกทอรีปลั๊กอินไม่มีไฟล์ entry .py หรือ .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "ยังไม่ได้ตั้งค่าโฟลเดอร์พื้นผิวทรัพยากร" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "ไม่สามารถระบุโฟลเดอร์พื้นผิวทรัพยากรได้" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "พาธพื้นผิวทรัพยากรไม่ใช่โฟลเดอร์" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "ไม่สามารถระบุโฟลเดอร์ปลั๊กอินได้" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "โฟลเดอร์พื้นผิวทรัพยากรอยู่นอกโฟลเดอร์ปลั๊กอิน" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "ไม่สามารถอ่านโฟลเดอร์พื้นผิวทรัพยากรได้" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36173,6 +36653,28 @@ msgstr "" "หลีกเลี่ยงการบิดเบี้ยว\n" "คุณรู้หรือไม่ว่าเมื่อพิมพ์วัสดุที่มีแนวโน้มที่จะเกิดการบิดเบี้ยว เช่น ABS การเพิ่มอุณหภูมิฐานพิมพ์อย่างเหมาะสมสามารถลดความน่าจะเป็นของการบิดเบี้ยวได้" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "เหลืองดัลเมเชียน" + +# AI Translated +# Needs human review: Source "Capsanthin violet" is probably a typo for RAL "Capri blue" (sits between Turquoise blue and Ocean blue); translated as Capri blue. Source string needs fixing +#~ msgid "Capsanthin violet" +#~ msgstr "น้ำเงินคาปรี" + +# AI Translated +# Needs human review: Source "Olivestone" is probably a typo for RAL "Olive grey" (sits between Silver grey and Moss grey); translated as Olive grey. Source string needs fixing +#~ msgid "Olivestone" +#~ msgstr "เทามะกอก" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "ใช้ได้ทุกที่ในหน้าต่าง แม้ขณะพิมพ์ในช่องข้อความ" + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "แป้นพิมพ์ลัดส่วนกลางจะทำงานแม้ขณะพิมพ์ข้อความ" + #~ msgid "Please choose the filament color" #~ msgstr "กรุณาเลือกสีเส้นพลาสติก" diff --git a/localization/i18n/tr/OrcaSlicer_tr.po b/localization/i18n/tr/OrcaSlicer_tr.po index 0d42b6b8d8..ff66cc5b2d 100644 --- a/localization/i18n/tr/OrcaSlicer_tr.po +++ b/localization/i18n/tr/OrcaSlicer_tr.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2026-08-21 23:18+0300\n" "Last-Translator: GlauTech\n" "Language-Team: \n" @@ -783,18 +783,21 @@ msgstr "Seçim" msgid "Plate" msgstr "Plaka" +# AI Translated msgid "Distribute" -msgstr "" +msgstr "Dağıt" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Dönüştürme işlemlerinde kullanılan koordinat sistemi." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Hizalama referansı" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "En az 3 parça veya nesne seçin" # AI Translated msgid "Align left" @@ -847,8 +850,9 @@ msgstr "Üst-alt yönünde dağıt" msgid "Drop" msgstr "Düşür" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Seçimi, en alçak noktası yatağa değecek şekilde Z ekseni boyunca taşır." # AI Translated msgid "Absolute" @@ -1714,10 +1718,10 @@ msgid "Undefined fill type" msgstr "Tanımsız dolgu türü" msgid "Linear gradient" -msgstr "Doğrusal degrade" +msgstr "Doğrusal gradyan" msgid "Radial gradient" -msgstr "Radyal degrade" +msgstr "Radyal gradyan" msgid "Open filled path" msgstr "Doldurulmuş yolu aç" @@ -2089,17 +2093,21 @@ msgstr "Birleştirme gizmosuna giriliyor" msgid "Leaving Assembly gizmo" msgstr "Birleştirme gizmosundan çıkılıyor" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Kesilmiş bir nesnenin parçaları taşınamaz" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Plakaya hizalama yalnızca X ve Y'de kullanılabilir" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Seçilen nesneleri Z ekseninde taşımak için Otomatik düşürmeyi kapatın" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Seçilen tüm nesneler aynı plakada olmalıdır" msgid "Shift+" msgstr "Shift+" @@ -6557,8 +6565,10 @@ msgstr "Eksenler" msgid "Gridlines" msgstr "Kılavuz çizgileri" +# AI Translated +# Needs human review: Glossary has no Turkish rendering for Focus mode yet; check 'Odak modu' fits the view-mode name. msgid "Focus mode" -msgstr "" +msgstr "Odak modu" msgid "Labels" msgstr "Etiketler" @@ -6619,7 +6629,7 @@ msgstr "Hacim:" msgid "Size:" msgstr "Boyut:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "%d katmanında G-code yollarında çakışmalar bulundu, Z = %.2lfmm. Lütfen çakışan nesneleri daha uzağa ayırın (%s <-> %s)." @@ -10985,11 +10995,13 @@ msgstr "Desteklenmeyen ön ayarları göster" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Yazıcı ve filament açılır listelerinde uyumsuz/desteklenmeyen ön ayarları gösterir. Bu ön ayarlar seçilemez." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "İstatistikleri G-code ile dışa aktar" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Etkinleştirilirse, bir G-code dosyası dışa aktarılırken istatistikleri de yanına .statistics.json olarak JSON biçiminde yazılır; dışa aktarılan dilimlenmiş 3MF dosyası da bunları içinde barındırır: baskı süresi, filament ve çizgi türü toplamları ile katman ve nesne başına aynı bilgiler." # AI Translated msgid "Experimental Features" @@ -11853,6 +11865,10 @@ msgstr "Dosya yazıcının depolama alanına yüklenemedi. Lütfen tekrar deneyi msgid "Send Failed" msgstr "Gönderim Başarısız" +# AI Translated +msgid "No available printers" +msgstr "Kullanılabilir yazıcı yok" + msgid "The name length exceeds the limit." msgstr "Ad uzunluğu sınırı aşıyor." @@ -13721,8 +13737,8 @@ msgid "Left mouse" msgstr "Sol fare tuşu" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Pencerenin her yerinde, bir metin alanına yazarken bile kullanılabilir." +msgid "Available anywhere in the window." +msgstr "Pencerenin her yerinde kullanılabilir." # AI Translated msgid "Run favorite 1 to 10" @@ -13834,10 +13850,6 @@ msgstr "%s, %s için atanmış. %s için yeniden atansın mı?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Varsayılan %s, %s için atanmış. %s için yeniden atansın mı?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Genel kısayollar yazarken de geçerlidir." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Karakter yazan bir tuş genel kısayol olamaz." @@ -14294,9 +14306,10 @@ msgstr "\"%2%\" nesnesinin \"%1%\" değiştiricisinin (toplam %3%) dikiş üzeri msgid "Seam placement may differ from expected." msgstr "Dikiş yerleşimi beklenenden farklı olabilir." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "G-code istatistikleri %1% konumuna yazılamadı." msgid "Internal Bridge" msgstr "İç köprü" @@ -17740,6 +17753,14 @@ msgstr "Nesneleri hariç tut" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "G-code'a EXCLUDE OBJECT komutunu eklemek için bu seçeneği etkinleştirin." +# AI Translated +msgid "Outline tolerance" +msgstr "Dış hat toleransı" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "EXCLUDE_OBJECT_DEFINE'a yazılan nesne dış hattının orijinal dış hattan en fazla sapması. Daha büyük değerler daha az nokta üretir; bu, çok sayıda nesne içeren G-code'u ayrıştırırken takılan ürün yazılımına yardımcı olur. 0 her noktayı korur." + msgid "Verbose G-code" msgstr "Ayrıntılı G-code" @@ -21022,11 +21043,13 @@ msgstr "Çıkış dizini" msgid "This is the output directory for exported files." msgstr "Dışa aktarılan dosyalar için çıkış dizini." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "İstatistikleri dışa aktar" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Dilimlenen her plakanın istatistiklerini JSON olarak yazar: çıktı dizininde G-code'un yanına plate_N.statistics.json olarak ve --export-3mf ile oluşturulan 3MF'in içine; baskı süresi, filament ve çizgi türü toplamları ile katman ve nesne başına aynı bilgiler." msgid "Debug level" msgstr "Hata ayıklama düzeyi" @@ -30966,1231 +30989,1652 @@ msgid_plural "The current filament list does not contain %s. Project filaments r msgstr[0] "Mevcut filament listesi %s içermiyor. Karışık filamentin gerektirdiği bir proje filamenti, ayrıştırmadan sonra otomatik olarak oluşturulacak." msgstr[1] "Mevcut filament listesi %s içermiyor. Karışık filamentin gerektirdiği proje filamentleri, ayrıştırmadan sonra otomatik olarak oluşturulacak." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Renk seçici" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Temel renkler" +# AI Translated +# Needs human review: Glossary has no Turkish rendering for Palette; check 'palet' (also Paletler). #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Orca paleti" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Klasik" + +# AI Translated +# Needs human review: Glossary has no Turkish cell for Gradient; used 'Gradyan' (as in Karışık filament gradyanı), though 'Linear gradient' is 'Doğrusal degrade' in the catalog. msgid "Gradients" -msgstr "" +msgstr "Gradyanlar" +# AI Translated +# Needs human review: Color-picker sense (single color, not a gradient); check 'Düz' reads as 'solid color'. +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Düz" +# AI Translated +# Needs human review: Glossary has no Turkish cell for Gradient; used 'Gradyan' (as in Karışık filament gradyanı), though 'Linear gradient' is 'Doğrusal degrade' in the catalog. msgid "Gradient" -msgstr "" +msgstr "Gradyan" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Gradyan başlangıcı" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Gradyan sonu" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Gradyan rengi" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Renk ekle" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Rengi kaldır" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Doygunluk" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Orijinal renk" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Geçerli rengi kaydet" +# AI Translated +# Needs human review: Glossary has no Turkish rendering for Palette; check 'Paletler'. msgid "Palettes" -msgstr "" +msgstr "Paletler" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Renk ara" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Renkleri filtrele" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Eşleşen renk yok" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Onaltılık renk" # AI Translated msgid "Opacity" msgstr "Opaklık" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Opaklık yüzdesi" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Rengi kaydet" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Eksiksiz bir onaltılık renk girin" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Mevcut çok renkli seçim, farklı bir renk seçene kadar korunur." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "En fazla %d renk desteklenir." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Kızıl" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Turuncu kırmızı" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Domates" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Turuncu" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Koyu turuncu" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Altın" +# AI Translated +# Needs human review: CSS color; check 'Ahşap kahvesi' conveys burlywood (light tan wood). msgid "Burly wood" -msgstr "" +msgstr "Ahşap kahvesi" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Bisküvi" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Sisli gül" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Açık sarı" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Limon şifonu" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Bej" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Açık altın çubuk sarısı" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Soluk altın çubuk" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Haki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Koyu haki" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Şeftali kreması" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Mokasen" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Papaya kreması" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Soyulmuş badem" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Antik beyaz" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Navaho beyazı" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Buğday" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Altın çubuk" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Çikolata" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Tuğla kırmızısı" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Siyena" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Eyer kahvesi" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Kahverengi" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Gül kahvesi" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Somon" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Açık somon" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Koyu somon" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Kum kahvesi" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Mercan" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Açık mercan" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Hint kırmızısı" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Koyu kırmızı" +# AI Translated +# Needs human review: CSS maroon rendered 'Vişne çürüğü'; check. msgid "Maroon" -msgstr "" +msgstr "Vişne çürüğü" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Yeşil sarı" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Sarı yeşil" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Şartröz" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Çim yeşili" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Misket limonu yeşili" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Bahar yeşili" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Orta bahar yeşili" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Misket limonu" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Orman yeşili" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Koyu yeşil" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Mat zeytin yeşili" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Zeytin" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Koyu zeytin yeşili" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Soluk yeşil" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Açık yeşil" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Orta deniz yeşili" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Deniz yeşili" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Koyu deniz yeşili" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Harbiye mavisi" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Orta akuamarin" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Turkuaz" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Orta turkuaz" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Koyu turkuaz" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Soluk turkuaz" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Akua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Açık camgöbeği" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Nane kreması" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Bal kavunu" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Akuamarin" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Açık deniz yeşili" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Koyu camgöbeği" +# AI Translated +# Needs human review: Rendered 'Petrol mavisi'; check it reads as teal. msgid "Teal" -msgstr "" +msgstr "Petrol mavisi" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Koyu arduvaz grisi" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Açık arduvaz grisi" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Arduvaz grisi" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Derin gökyüzü mavisi" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Dodger mavisi" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Gökyüzü mavisi" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Açık gökyüzü mavisi" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Açık mavi" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Pudra mavisi" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Açık çelik mavisi" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Çelik mavisi" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Kantaron mavisi" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Kraliyet mavisi" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Orta mavi" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Gece yarısı mavisi" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Koyu mavi" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Lacivert" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Arduvaz mavisi" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Koyu arduvaz mavisi" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Orta arduvaz mavisi" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Mavi menekşe" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "İndigo" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Koyu menekşe" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Koyu orkide" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Orta orkide" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Orkide" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Menekşe" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Orta mor" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Mor" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Rebecca moru" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Orta menekşe kırmızısı" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Soluk menekşe kırmızısı" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Derin pembe" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Sıcak pembe" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Açık pembe" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Pembe" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Erik" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Devedikeni" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuşya" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Koyu macenta" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Keten" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Eski dantel" +# AI Translated msgid "Sea shell" -msgstr "" +msgstr "Deniz kabuğu" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Fildişi" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Çiçek beyazı" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Lavanta pembesi" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Hayalet beyazı" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Alice mavisi" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Lavanta" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Duman beyazı" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Siyah" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Mercan ateşi" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Deniz anemonu" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Derin uçurum" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Istakoz kırmızısı" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Kumlu kil" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Sürüklenmiş odun" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Deniz iğdesi" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Gün batımı resifi" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Kaplan mercanı" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Pembe mercan" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Deniz kabuğu parıltısı" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Kum" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Altın deniz yosunu" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Güneşli kumul" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Kehribar nautilus" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Deniz limonu" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Soluk deniz yıldızı" +# AI Translated +# Needs human review: Ocean-themed name; 'Büyük gelgit' is the oceanographic term; check it reads as a color name. msgid "Spring tide" -msgstr "" +msgstr "Büyük gelgit" +# AI Translated +# Needs human review: Ocean-themed name; check 'Misket limonu algi' reads right. msgid "Lime algae" -msgstr "" +msgstr "Misket limonu algi" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Deniz çimi" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Neon plankton" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Deniz yosunu ormanı" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Zümrüt dalga" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Balina gölgesi" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Deniz kaplumbağası" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Lagün" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Tropik akıntı" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Gece yarısı çukuru" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Koyu deniz yosunu" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Kristal dalga" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Turkuaz koy" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Resif üstü gökyüzü" +# AI Translated +# Needs human review: Ocean-themed color name; check 'Sığ gökyüzü' reads as a color. msgid "Shallow sky" -msgstr "" +msgstr "Sığ gökyüzü" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Elektrik mavisi" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Yunus" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Okyanus derinlikleri" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Balina" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "İndigo uçurum" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Deniz kestanesi" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Lavanta mercanı" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Menekşe gelgiti" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Derin deniz orkidesi" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Neon denizanası" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Fuşya mercan" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Pembe denizanası" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Köpük" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Deniz kabuğu beyazı" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Çakıl grisi" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Fırtına bulutu" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Mürekkep siyahı" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Yeşil bej" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Kum sarısı" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Sinyal sarısı" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Altın sarısı" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Bal sarısı" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Mısır sarısı" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Nergis sarısı" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Kahverengi bej" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Limon sarısı" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "İstiridye beyazı" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Açık fildişi" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Çinko sarısı" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Gri bej" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Zeytin sarısı" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Kolza sarısı" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Trafik sarısı" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Oker sarısı" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Trafik turuncu sarısı" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Köri" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Kavun sarısı" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Katırtırnağı sarısı" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Dahlia sarısı" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Pastel sarı" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "İnci bej" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "İnci altın" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Güneş sarısı" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Sarı turuncu" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Derin turuncu" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Vermilyon" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "İnci turuncu" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Saf turuncu" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Parlak turuncu" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Parlak açık turuncu" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Açık kırmızı turuncu" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Trafik turuncusu" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Sinyal turuncusu" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Somon turuncusu" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "İnci pembe" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Bakır turuncusu" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Sinyal kahvesi" +# AI Translated +# Needs human review: Odd RAL name; translated literally as Ladin turuncusu. msgid "Fir orange" -msgstr "" +msgstr "Ladin turuncusu" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Sinyal kırmızısı" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Parlak kırmızı" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Karmen kırmızısı" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "İnci karmen kırmızısı" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Saf kırmızı" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Parlak koyu kırmızı" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Frenk üzümü kırmızısı" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "İnci yakut kırmızısı" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Ateş kırmızısı" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Yakut kırmızısı" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Mor kırmızı" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Şarap kırmızısı" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Siyah kırmızı" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Oksit kırmızısı" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Kahverengi kırmızı" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Çam kırmızısı" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Domates kırmızısı" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Antik pembe" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Mercan kırmızısı" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Gül" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Çilek kırmızısı" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Trafik kırmızısı" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Somon pembesi" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Parlak gül" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Parlak açık kırmızı" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Ahududu kırmızısı" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Doğu kırmızısı" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "İnci yakut" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Kırmızı mor" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Kırmızı menekşe" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Funda moru" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Bordo moru" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Maun" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Gri mor" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Sinyal moru" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Ladin yeşili" +# AI Translated +# Needs human review: RAL name; check the Turkish form. msgid "Sabine grey" -msgstr "" +msgstr "Sabine grisi" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "İnci mor" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "İnci böğürtlen" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Yeşil mavi" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ultramarin mavisi" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Safir mavisi" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Siyah mavi" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Sinyal mavisi" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Canlı mavi" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Gri mavi" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Azur mavisi" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Centiyana mavisi" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Kobalt mavisi" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Güvercin mavisi" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Trafik mavisi" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Turkuaz mavisi" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Capri mavisi" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Okyanus mavisi" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Su mavisi" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Gece mavisi" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Uzak mavi" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Pastel mavi" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "İnci centiyana mavisi" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "İnci gece yarısı mavisi" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Patina yeşili" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Zümrüt yeşili" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Yaprak yeşili" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Zeytin yeşili" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Mavi yeşil" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Karayosunu yeşili" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Gri zeytin" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Çam yeşili" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Çam kahvesi" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Ot yeşili" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Reseda yeşili" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Kahverengi yeşil" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Sazlık yeşili" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Siyah yeşil" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Turkuaz yeşili" +# AI Translated msgid "May green" -msgstr "" +msgstr "Mayıs yeşili" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Krom oksit yeşili" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Trafik yeşili" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Eğrelti otu yeşili" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Opal yeşili" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Nane yeşili" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Bronz yeşili" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "İnci yeşil" +# AI Translated +# Needs human review: RAL name; check the Turkish form. msgid "Sax turquoise" -msgstr "" +msgstr "Sax turkuazı" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "İnci turkuaz" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "İnci yeşim" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Saf yeşil" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Parlak yeşil" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Sincap grisi" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Gümüş grisi" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Zeytin grisi" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Karayosunu grisi" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Sinyal grisi" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Fare grisi" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Bej gri" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Haki gri" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Yeşil gri" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Branda grisi" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Demir grisi" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Bazalt grisi" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Kahverengi gri" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Arduvaz grisi" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Antrasit grisi" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Açık gri" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Umber grisi" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Beton grisi" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Grafit grisi" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Granit grisi" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Taş grisi" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Çakıl grisi" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Çimento grisi" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Sarı gri" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Platin grisi" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Tozlu gri" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Akik grisi" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Kuvars grisi" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Pencere grisi" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Trafik grisi A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Trafik grisi B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "İpek grisi" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegri 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegri 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegri 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "İnci fare grisi" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Yeşil kahverengi" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Oker kahvesi" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Kil kahvesi" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Bakır kahvesi" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Çikolata kahvesi" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Zeytin kahvesi" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Ceviz kahvesi" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Kırmızı kahverengi" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Sepya kahvesi" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Kestane kahvesi" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Maun kahvesi" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Gri kahverengi" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "İnci bakır" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Bej kahverengi" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "İnci mokka kahvesi" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Toprak kahvesi" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "İnci kahverengi" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Krem" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Gri beyaz" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Sinyal beyazı" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Sinyal siyahı" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Jet siyahı" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Beyaz alüminyum" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Gri alüminyum" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Saf beyaz" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Grafit siyahı" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Trafik beyazı" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Trafik siyahı" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Papirüs beyazı" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "İnci açık gri" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Metal: Gümüş" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Metal: Pirinç" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Metal: Altın" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Metal: Bakır" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Metal: Bronz" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Doğa: İnci" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Doğa: Gökkuşağı" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Doğa: Açık gökyüzü" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Doğa: Gün batımı" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Ahşap: Koyu" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Ahşap: Orta" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Ahşap: Açık" # AI Translated msgid "Alternate nozzles:" @@ -32667,13 +33111,25 @@ msgstr "Dokularım'dan kaldır" msgid "Built-in" msgstr "Yerleşik" +# AI Translated +msgid "My textures" +msgstr "Dokularım" + # AI Translated msgid "No textures found." msgstr "Doku bulunamadı." # AI Translated -msgid "My textures" -msgstr "Dokularım" +msgid "Texture libraries" +msgstr "Doku kütüphaneleri" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Daha fazla doku kütüphanesi keşfedin" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Eklentilere göz atmak için OrcaCloud'u Ana sayfada açar." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33076,11 +33532,13 @@ msgstr "Modelin kendi UV düzeniyle haritalanır; bu düzen zaten yerleşimin ke msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Dokunun bir kopyasının model üzerindeki genişliği. Küçük değerler deseni daha sık tekrarlar ve ayrıntısını inceltir; Döşeme kapalıyken bu, tek kopyanın boyutudur." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Daha büyük" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Daha küçük" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33156,11 +33614,15 @@ msgstr "Karışık renkler" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Bir pişirmenin ekleyebileceği en fazla karışık filament sayısı. Bunlar dokunun renklerinden seçilir ve yalnızca pişirmenin gerçekten kullandıkları oluşturulur." +# AI Translated +# Needs human review: Bare label in the app; check Az/Çok fit their context. msgid "Few" -msgstr "" +msgstr "Az" +# AI Translated +# Needs human review: Bare label in the app; check Az/Çok fit their context. msgid "Many" -msgstr "" +msgstr "Çok" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33516,11 +33978,15 @@ msgstr "Yeniden mesh oluşturma" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Tüm modelin yeniden oluşturulacağı üçgen boyutu (milimetre). Yer değiştirme en iyi düzgün bir mesh üzerinde çalışır; düzensiz bir içe aktarmadan düzgün mesh bu şekilde elde edilir." +# AI Translated +# Needs human review: Bare label in the app; check Önce/Sonra fit their context. msgid "Before" -msgstr "" +msgstr "Önce" +# AI Translated +# Needs human review: Bare label in the app; check Önce/Sonra fit their context. msgid "After" -msgstr "" +msgstr "Sonra" # AI Translated msgid "Keep sharp edges" @@ -35381,6 +35847,10 @@ msgstr "Betik" msgid "Slicing Pipeline" msgstr "Dilimleme Hattı" +# AI Translated +msgid "Resource Texture" +msgstr "Kaynak dokusu" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Eklentinin yapılandırma arayüzü boştu. Varsayılan düzenleyici gösteriliyor." @@ -35528,6 +35998,30 @@ msgstr "Eklenti dizini hem .py hem de .whl giriş dosyaları içeriyor" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Eklenti dizini bir .py veya .whl giriş dosyası içermiyor" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Kaynak dokusu dizini ayarlanmamış" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Kaynak dokusu dizini belirlenemedi" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Kaynak dokusu yolu bir dizin değil" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Eklenti klasörü belirlenemedi" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Kaynak dokusu dizini eklenti klasörünün dışında" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Kaynak dokusu dizini okunamadı" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36478,6 +36972,28 @@ msgstr "" "Eğilmeyi önleyin\n" "ABS gibi bükülmeye yatkın malzemelere baskı yaparken, ısıtma yatağı sıcaklığının uygun şekilde arttırılmasının bükülme olasılığını azaltabileceğini biliyor muydunuz?" +# AI Translated +# Needs human review: Possibly meant Daffodil yellow (RAL 1007); translated literally. +#~ msgid "Dalmatian yellow" +#~ msgstr "Dalmaçya sarısı" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Kapsantin moru" + +# AI Translated +# Needs human review: Probably RAL Olive grey; translated as Zeytin grisi. +#~ msgid "Olivestone" +#~ msgstr "Zeytin grisi" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Pencerenin her yerinde, bir metin alanına yazarken bile kullanılabilir." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Genel kısayollar yazarken de geçerlidir." + #~ msgid "Please choose the filament color" #~ msgstr "Lütfen filament rengini seçin" diff --git a/localization/i18n/uk/OrcaSlicer_uk.po b/localization/i18n/uk/OrcaSlicer_uk.po index 2611479982..6ae4916fef 100644 --- a/localization/i18n/uk/OrcaSlicer_uk.po +++ b/localization/i18n/uk/OrcaSlicer_uk.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: orcaslicerua\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2026-07-17 16:25+0300\n" "Last-Translator: Andrij Mizyk \n" "Language-Team: Ukrainian\n" @@ -772,17 +772,22 @@ msgstr "Вибір" msgid "Plate" msgstr "Пластина" +# AI Translated +# Needs human review: No glossary rendering yet (Ukrainian cell empty); Розподілити proposed. msgid "Distribute" -msgstr "" +msgstr "Розподілити" msgid "Coordinate system used for transform actions." msgstr "Система координат для дій перетворення." +# AI Translated +# Needs human review: Label in the Align/Distribute tool: what the objects are aligned to; check the wording in the UI. msgid "Reference for alignment" -msgstr "" +msgstr "Опора для вирівнювання" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Виберіть щонайменше 3 частини або обʼєкти" # AI Translated msgid "Align left" @@ -836,8 +841,9 @@ msgstr "Розподілити за висотою" msgid "Drop" msgstr "Кинути" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Перемістити виділене вздовж осі Z так, щоб його найнижча точка торкалася столу." msgid "Absolute" msgstr "Абсолютно" @@ -2073,17 +2079,21 @@ msgstr "Вхід у gizmo-збирання" msgid "Leaving Assembly gizmo" msgstr "Вихід з gizmo-збирання" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Частини розрізаного обʼєкта не можна переміщувати" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Вирівнювання за пластиною доступне лише за осями X та Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Вимкніть авто-кидання для вибраних обʼєктів, щоб переміщувати їх за віссю Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Усі вибрані обʼєкти мають бути на одній пластині" msgid "Shift+" msgstr "Shift+" @@ -6532,8 +6542,10 @@ msgstr "Осі" msgid "Gridlines" msgstr "Лінії сітки" +# AI Translated +# Needs human review: No glossary rendering yet (Ukrainian cell empty); check the term for hiding the interface to concentrate on the 3D canvas. msgid "Focus mode" -msgstr "" +msgstr "Режим фокусу" msgid "Labels" msgstr "Підписи" @@ -6596,7 +6608,7 @@ msgid "Size:" msgstr "Розмір:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Виявлено конфлікти шляхів G-code на шарі %d, Z = %.2lf мм. Будь ласка, рознесіть конфліктуючі обʼєкти далі один від одного (%s <-> %s)." @@ -11016,11 +11028,13 @@ msgstr "Показати непідтримувані пресети" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Показати несумісні/непідтримувані пресети у випадаючому списку принтера і філаменту. Ці пресети не можна вибрати." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Експортувати статистику разом із G-code" +# AI Translated msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Якщо ввімкнено, під час експорту файлу G-code поруч із ним записується його статистика у форматі JSON (.statistics.json), а експортований нарізаний файл 3MF містить її всередині: час друку, підсумки за філаментом і типами ліній, а також ті самі дані за шарами та обʼєктами." msgid "Experimental Features" msgstr "Експериментальні функції" @@ -11893,6 +11907,10 @@ msgstr "Не вдалося вивантажити файл у памʼять п msgid "Send Failed" msgstr "Не вдалося надіслати" +# AI Translated +msgid "No available printers" +msgstr "Немає доступних принтерів" + msgid "The name length exceeds the limit." msgstr "Довжина імені перевищує обмеження." @@ -13828,8 +13846,8 @@ msgid "Left mouse" msgstr "Ліва кнопка миші" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Доступно будь-де у вікні, навіть під час введення тексту в текстовому полі." +msgid "Available anywhere in the window." +msgstr "Доступно в будь-якому місці вікна." # AI Translated msgid "Run favorite 1 to 10" @@ -13941,10 +13959,6 @@ msgstr "%s призначено для %s. Перепризначити для % msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "Типову комбінацію %s призначено для %s. Перепризначити її для %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Глобальні комбінації клавіш діють і під час введення тексту." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Клавіша, яка вводить символ, не може бути глобальною комбінацією." @@ -14402,9 +14416,10 @@ msgstr "модифікатор \"%1%\" обʼєкта \"%2%\" (усього %3%) msgid "Seam placement may differ from expected." msgstr "Розташування шва може відрізнятися від очікуваного." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Не вдалося записати статистику G-code до %1%." msgid "Internal Bridge" msgstr "Внутрішній міст" @@ -17926,6 +17941,14 @@ msgstr "Виключити обʼєкт" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Увімкнути цей параметр для додавання команди ВИКЛЮЧИТИ ОБʼЄКТ у G-code" +# AI Translated +msgid "Outline tolerance" +msgstr "Допуск контуру" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Максимальне відхилення контуру обʼєкта, що записується в EXCLUDE_OBJECT_DEFINE, від вихідного контуру. Чим більше значення, тим менше точок, що допомагає прошивкам, які зависають під час розбору G-code з великою кількістю обʼєктів. 0 зберігає всі точки." + msgid "Verbose G-code" msgstr "Докладний G-code" @@ -21290,11 +21313,13 @@ msgstr "Вихідний каталог" msgid "This is the output directory for exported files." msgstr "Цільова папка для експортованих файлів." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Експорт статистики" +# AI Translated msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Записувати статистику кожної нарізаної пластини у форматі JSON: plate_N.statistics.json поруч із її G-code у вихідній теці та всередині 3MF для --export-3mf. Містить час друку, підсумки за філаментом і типами ліній, а також ті самі дані за шарами та обʼєктами." msgid "Debug level" msgstr "Рівень налагодження" @@ -31219,1231 +31244,1650 @@ msgstr[1] "Поточний список філаментів не містит msgstr[2] "Поточний список філаментів не містить %s. Філаменти проєкту, потрібні для змішаного філаменту, буде створено автоматично після розкладання." msgstr[3] "Поточний список філаментів не містить %s. Філаменти проєкту, потрібні для змішаного філаменту, буде створено автоматично після розкладання." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Вибір кольору" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Основні кольори" +# AI Translated +# Needs human review: No glossary rendering yet for Palette (Ukrainian cell empty); Палітра proposed. #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Палітра Orca" +# AI Translated +# Needs human review: Brand RAL kept; check whether Classic should be translated or kept in English. #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Класика" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Градієнти" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Однотонний" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Градієнт" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Початок градієнта" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Кінець градієнта" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Колір градієнта" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Додати колір" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Вилучити колір" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Насиченість" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Початковий колір" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Зберегти поточний колір" +# AI Translated +# Needs human review: No glossary rendering yet for Palette (Ukrainian cell empty); Палітра proposed. msgid "Palettes" -msgstr "" +msgstr "Палітри" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Пошук кольорів" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Фільтр кольорів" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Немає відповідних кольорів" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "HEX-колір" # AI Translated msgid "Opacity" msgstr "Непрозорість" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Непрозорість у відсотках" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Зберегти колір" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Введіть повний шістнадцятковий код кольору" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Поточний вибір кількох кольорів зберігається, доки ви не виберете інший колір." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Підтримується до %d кольорів." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Кармазин" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Помаранчево-червоний" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Томатний" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Помаранчевий" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Темно-помаранчевий" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Золотий" +# AI Translated +# Needs human review: CSS burlywood; check the natural Ukrainian color name. msgid "Burly wood" -msgstr "" +msgstr "Деревний" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Бісквітний" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Туманна троянда" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Світло-жовтий" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Лимонний шифон" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Бежевий" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Світло-золотисто-жовтий" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Блідо-золотистий" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Хакі" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Темний хакі" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Персиковий мус" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Мокасиновий" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Збита папайя" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Бланшований мигдаль" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Античний білий" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Білий навахо" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Пшеничний" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Золотистий" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Шоколадний" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Перу" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Цегляний" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Сієна" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Сідлово-коричневий" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Коричневий" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Рожево-коричневий" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Лососевий" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Світло-лососевий" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Темно-лососевий" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Піщано-коричневий" +# AI Translated msgid "Coral" -msgstr "" +msgstr "Кораловий" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "Світло-кораловий" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Індійський червоний" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Темно-червоний" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Бордовий" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Зелено-жовтий" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Жовто-зелений" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Шартрез" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Зелений газон" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Зелений лайм" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Весняний зелений" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Середній весняний зелений" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Лайм" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Лісовий зелений" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Темно-зелений" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Тьмяно-оливковий" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Оливковий" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Темно-оливковий" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Блідо-зелений" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Світло-зелений" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Середній морський зелений" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Морський зелений" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Темний морський зелений" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Кадетський синій" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Середній аквамарин" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Бірюзовий" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Середньо-бірюзовий" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Темно-бірюзовий" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Блідо-бірюзовий" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Аква" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Світло-ціановий" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Мʼятний крем" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Медова роса" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Аквамарин" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Світлий морський зелений" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Темно-ціановий" +# AI Translated +# Needs human review: CSS teal; check the natural Ukrainian color name. msgid "Teal" -msgstr "" +msgstr "Зелена бірюза" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Темний сланцево-сірий" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Світлий сланцево-сірий" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Сланцево-сірий" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Насичений небесно-блакитний" +# AI Translated +# Needs human review: CSS dodgerblue; check the natural Ukrainian color name. msgid "Dodger Blue" -msgstr "" +msgstr "Синій доджер" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Небесно-блакитний" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Світлий небесно-блакитний" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Світло-блакитний" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Пудрово-блакитний" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Світлий сталево-синій" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Сталево-синій" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Волошковий" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Королівський синій" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Середній синій" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Опівнічно-синій" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Темно-синій" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Морський синій" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Сланцево-синій" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Темний сланцево-синій" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Середній сланцево-синій" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Синьо-фіолетовий" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Індиго" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Темно-фіолетовий" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Темна орхідея" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Середня орхідея" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Орхідея" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Фіолетовий" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Середній пурпуровий" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Пурпуровий" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Пурпуровий Ребекки" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Середній фіолетово-червоний" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Блідий фіолетово-червоний" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Насичений рожевий" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Яскраво-рожевий" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Світло-рожевий" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Рожевий" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Сливовий" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Будяк" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Фуксія" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Темна маджента" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Льняний" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Старе мереживо" +# AI Translated +# Needs human review: Color name; the Shell glossary term does not apply. msgid "Sea shell" -msgstr "" +msgstr "Морська мушля" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Слонова кістка" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Квітково-білий" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Лавандовий румʼянець" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Примарно-білий" +# AI Translated +# Needs human review: CSS aliceblue; check the natural Ukrainian color name. msgid "Alice blue" -msgstr "" +msgstr "Блакитний Еліс" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Лавандовий" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Білий дим" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Гейнсборо" +# AI Translated msgid "Black" -msgstr "" +msgstr "Чорний" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "Кораловий вогонь" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Морська актинія" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Глибока безодня" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Червоний омар" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Піщана глина" +# AI Translated +# Needs human review: Ocean-themed color name; check it reads as a color. msgid "Driftwood" -msgstr "" +msgstr "Дрейфуюча деревина" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Обліпиха" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Захід сонця на рифі" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "Тигровий корал" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "Рожевий корал" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Сяйво мушлі" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Пісок" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Золота ламінарія" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Дюна на сонці" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Бурштиновий наутилус" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Морський лимон" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Бліда морська зірка" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Весняний приплив" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Лаймові водорості" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Морська трава" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Неоновий планктон" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Ліс ламінарії" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Смарагдова хвиля" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Тінь кита" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Морська черепаха" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Лагуна" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Тропічна течія" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Опівнічна западина" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Темна ламінарія" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Кришталевий прибій" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Бірюзова бухта" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Небо над рифом" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Небо мілководдя" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Електрик" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Дельфін" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Океанські глибини" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Кит" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Індигова безодня" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Морський їжак" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "Лавандовий корал" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Фіолетовий приплив" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Глибоководна орхідея" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Неонове желе" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "Фуксієвий корал" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Рожева медуза" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Піна" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Біла мушля" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Галечно-сірий" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Грозова хмара" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Чорнильно-чорний" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Зелено-бежевий" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Піщано-жовтий" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Сигнальний жовтий" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Золотисто-жовтий" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Медово-жовтий" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Кукурудзяно-жовтий" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Нарцисово-жовтий" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Коричнево-бежевий" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Лимонно-жовтий" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Устрично-білий" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Світла слонова кістка" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Цинково-жовтий" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Сіро-бежевий" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Оливково-жовтий" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Ріпаково-жовтий" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Дорожній жовтий" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Охристо-жовтий" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Дорожній помаранчево-жовтий" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Карі" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Динно-жовтий" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Дріково-жовтий" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Жоржиново-жовтий" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Пастельно-жовтий" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Перламутровий бежевий" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Перламутровий золотий" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Сонячно-жовтий" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Жовто-помаранчевий" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Насичений помаранчевий" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Кіновар" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Перламутровий помаранчевий" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Чистий помаранчевий" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Сяйний помаранчевий" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Сяйний яскраво-помаранчевий" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Яскраво-червоно-помаранчевий" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Дорожній помаранчевий" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Сигнальний помаранчевий" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Лососево-помаранчевий" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Перламутровий рожевий" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Мідно-помаранчевий" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Сигнальний коричневий" +# AI Translated +# Needs human review: Source name unclear; translated literally. msgid "Fir orange" -msgstr "" +msgstr "Ялицево-помаранчевий" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Сигнальний червоний" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Сяйний червоний" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Карміново-червоний" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Перламутровий карміново-червоний" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Чистий червоний" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Сяйний насичений червоний" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Смородиново-червоний" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Перламутровий рубіново-червоний" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Вогненно-червоний" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Рубіново-червоний" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Пурпурово-червоний" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Винно-червоний" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Чорно-червоний" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Оксидно-червоний" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Коричнево-червоний" +# AI Translated msgid "Pine red" -msgstr "" +msgstr "Сосново-червоний" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Томатно-червоний" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Античний рожевий" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Корало-червоний" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Троянда" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Полунично-червоний" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Дорожній червоний" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Лососево-рожевий" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Сяйна троянда" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Сяйний яскраво-червоний" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Малиново-червоний" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Східний червоний" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Перламутровий рубіновий" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Червоно-пурпуровий" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Червоно-фіолетовий" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Вересково-фіолетовий" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Бордово-фіолетовий" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Червоне дерево" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Сіро-пурпуровий" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Сигнальний фіолетовий" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Ялицево-зелений" +# AI Translated +# Needs human review: Source name unclear; translated literally. msgid "Sabine grey" -msgstr "" +msgstr "Сабінський сірий" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Перламутровий фіолетовий" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Перламутровий ожиновий" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Зелено-синій" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Ультрамарино-синій" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Сапфірово-синій" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Чорно-синій" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Сигнальний синій" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Бриліантово-синій" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Сіро-синій" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Лазурово-синій" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Тирличево-синій" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Кобальтово-синій" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Голубино-синій" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Дорожній синій" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Бірюзово-синій" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Синій Капрі" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Океанський синій" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Водяно-синій" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Нічно-синій" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Далекий синій" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Пастельно-синій" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Перламутровий тирличево-синій" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Перламутровий опівнічно-синій" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Патиново-зелений" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Смарагдово-зелений" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Листяно-зелений" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Оливково-зелений" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Синьо-зелений" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Мохово-зелений" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Сіро-оливковий" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Сосново-зелений" +# AI Translated msgid "Pine brown" -msgstr "" +msgstr "Сосново-коричневий" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Травʼяно-зелений" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Резедово-зелений" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Коричнево-зелений" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Очеретяно-зелений" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Чорно-зелений" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Бірюзово-зелений" +# AI Translated msgid "May green" -msgstr "" +msgstr "Травневий зелений" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Хромооксидний зелений" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Дорожній зелений" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Папоротево-зелений" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Опалово-зелений" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Мʼятно-зелений" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Бронзово-зелений" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Перламутровий зелений" +# AI Translated +# Needs human review: Source name unclear (Saxe blue?); translated literally. msgid "Sax turquoise" -msgstr "" +msgstr "Саксонсько-бірюзовий" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Перламутровий бірюзовий" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Перламутровий нефритовий" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Чистий зелений" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Сяйний зелений" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Білячий сірий" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Сріблясто-сірий" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Оливково-сірий" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Мохово-сірий" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Сигнальний сірий" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Мишачо-сірий" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Бежево-сірий" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Хакі-сірий" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Зелено-сірий" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Брезентово-сірий" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Залізно-сірий" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Базальтово-сірий" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Коричнево-сірий" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Сланцево-сірий" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Антрацитово-сірий" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Світло-сірий" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Умбро-сірий" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Бетонно-сірий" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Графітово-сірий" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Гранітно-сірий" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Камʼяно-сірий" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Галечно-сірий" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Цементно-сірий" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Жовто-сірий" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Платиново-сірий" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Пильно-сірий" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Агатово-сірий" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Кварцово-сірий" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Віконно-сірий" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Дорожній сірий A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Дорожній сірий B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Шовково-сірий" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Телесірий 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Телесірий 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Телесірий 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Перламутровий мишачо-сірий" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Зелено-коричневий" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Охристо-коричневий" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Глинисто-коричневий" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Мідно-коричневий" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Шоколадно-коричневий" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Оливково-коричневий" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Горіхово-коричневий" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Червоно-коричневий" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Сепієво-коричневий" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Каштаново-коричневий" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Махагонево-коричневий" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Сіро-коричневий" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Перламутровий мідний" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Бежево-коричневий" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Перламутровий мокко-коричневий" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Земляно-коричневий" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Перламутровий коричневий" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Кремовий" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Сіро-білий" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Сигнальний білий" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Сигнальний чорний" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Гагатово-чорний" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Білий алюміній" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Сірий алюміній" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Чистий білий" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Графітово-чорний" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Дорожній білий" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Дорожній чорний" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Папірусно-білий" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Перламутровий світло-сірий" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Метал: срібло" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Метал: латунь" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Метал: золото" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Метал: мідь" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Метал: бронза" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Природа: перлина" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Природа: веселка" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Природа: ясне небо" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Природа: захід сонця" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Дерево: темне" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Дерево: середнє" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Дерево: світле" # AI Translated msgid "Alternate nozzles:" @@ -32921,13 +33365,25 @@ msgstr "Вилучити з «Мої текстури»" msgid "Built-in" msgstr "Вбудовані" +# AI Translated +msgid "My textures" +msgstr "Мої текстури" + # AI Translated msgid "No textures found." msgstr "Текстур не знайдено." # AI Translated -msgid "My textures" -msgstr "Мої текстури" +msgid "Texture libraries" +msgstr "Бібліотеки текстур" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Знайти інші бібліотеки текстур" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Відкриває OrcaCloud на домашній сторінці для перегляду плагінів." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33330,11 +33786,15 @@ msgstr "Накладається за власною UV-розкладкою м msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Ширина однієї копії текстури на моделі. Менше значення частіше повторює візерунок і робить його деталі дрібнішими; якщо «Плитка» вимкнена, це розмір єдиної копії." +# AI Translated +# Needs human review: Caption of a tile-size picture in the texture-displacement tool; check it reads right. msgid "Larger" -msgstr "" +msgstr "Більше" +# AI Translated +# Needs human review: Caption of a tile-size picture in the texture-displacement tool; check it reads right. msgid "Smaller" -msgstr "" +msgstr "Менше" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33410,11 +33870,15 @@ msgstr "Змішані кольори" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Найбільша кількість змішаних філаментів, яку може додати запікання. Їх вибирають із кольорів текстури, і створюються лише ті, що справді використовуються під час запікання." +# AI Translated +# Needs human review: Caption under a mixed-colors image in the texture-displacement tool; check it reads right. msgid "Few" -msgstr "" +msgstr "Мало" +# AI Translated +# Needs human review: Caption under a mixed-colors image in the texture-displacement tool; check it reads right. msgid "Many" -msgstr "" +msgstr "Багато" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -33780,11 +34244,13 @@ msgstr "Перебудова сітки" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Розмір трикутника, з яким перебудовується вся модель, у міліметрах. Зміщення найкраще працює на рівномірній сітці; саме цей параметр робить її з нерівномірної імпортованої." +# AI Translated msgid "Before" -msgstr "" +msgstr "До" +# AI Translated msgid "After" -msgstr "" +msgstr "Після" # AI Translated msgid "Keep sharp edges" @@ -35716,6 +36182,10 @@ msgstr "Скрипт" msgid "Slicing Pipeline" msgstr "Конвеєр нарізки" +# AI Translated +msgid "Resource Texture" +msgstr "Текстура ресурсу" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Інтерфейс конфігурації плагіна порожній. Показано типовий редактор." @@ -35863,6 +36333,30 @@ msgstr "Каталог плагіна містить одночасно вхід msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Каталог плагіна не містить вхідного файлу .py або .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Теку текстур ресурсу не задано" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Не вдалося визначити теку текстур ресурсу" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Шлях до текстур ресурсу не є текою" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Не вдалося визначити теку плагіна" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Тека текстур ресурсу розташована поза текою плагіна" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Не вдалося прочитати теку текстур ресурсу" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -36816,6 +37310,28 @@ msgstr "" "Уникнення деформації\n" "Чи знаєте ви, що при друку матеріалами, схильними до деформації, такими як ABS, відповідне підвищення температури столу може зменшити ймовірність деформації?" +# AI Translated +# Needs human review: Not a known RAL name; translated literally. +#~ msgid "Dalmatian yellow" +#~ msgstr "Далматинський жовтий" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "Капсантиново-фіолетовий" + +# AI Translated +# Needs human review: Source name unclear; translated literally. +#~ msgid "Olivestone" +#~ msgstr "Оливково-камʼяний" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Доступно будь-де у вікні, навіть під час введення тексту в текстовому полі." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Глобальні комбінації клавіш діють і під час введення тексту." + #~ msgid "Please choose the filament color" #~ msgstr "Будь ласка, виберіть колір філаменту" diff --git a/localization/i18n/vi/OrcaSlicer_vi.po b/localization/i18n/vi/OrcaSlicer_vi.po index 104fea5474..5c7f337df0 100644 --- a/localization/i18n/vi/OrcaSlicer_vi.po +++ b/localization/i18n/vi/OrcaSlicer_vi.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2025-10-02 17:43+0700\n" "Last-Translator: \n" "Language-Team: hainguyen.ts13@gmail.com\n" @@ -836,18 +836,21 @@ msgstr "Lựa chọn" msgid "Plate" msgstr "Plate" +# AI Translated msgid "Distribute" -msgstr "" +msgstr "Phân bố" # AI Translated msgid "Coordinate system used for transform actions." msgstr "Hệ tọa độ dùng cho các thao tác biến đổi." +# AI Translated msgid "Reference for alignment" -msgstr "" +msgstr "Tham chiếu để căn chỉnh" +# AI Translated msgid "Select at least 3 parts or objects" -msgstr "" +msgstr "Chọn ít nhất 3 phần hoặc vật thể" # AI Translated msgid "Align left" @@ -901,8 +904,9 @@ msgstr "Phân bố trên-dưới" msgid "Drop" msgstr "Thả xuống" +# AI Translated msgid "Move the selection along Z so that its lowest point touches the bed." -msgstr "" +msgstr "Di chuyển vùng chọn theo trục Z để điểm thấp nhất chạm bàn in." # AI Translated msgid "Absolute" @@ -2147,17 +2151,21 @@ msgstr "Đang vào gizmo Lắp ráp" msgid "Leaving Assembly gizmo" msgstr "Đang rời gizmo Lắp ráp" +# AI Translated msgid "Parts of a cut object cannot be moved" -msgstr "" +msgstr "Không thể di chuyển các phần của vật thể đã cắt" +# AI Translated msgid "Aligning to the plate is available in X and Y only" -msgstr "" +msgstr "Căn chỉnh theo plate chỉ khả dụng theo X và Y" +# AI Translated msgid "Turn off Auto-Drop for the selected objects to move them in Z" -msgstr "" +msgstr "Tắt Tự động thả cho các vật thể đã chọn để di chuyển chúng theo Z" +# AI Translated msgid "All selected objects must be on the same plate" -msgstr "" +msgstr "Tất cả vật thể đã chọn phải ở trên cùng một plate" msgid "Shift+" msgstr "Shift+" @@ -6843,8 +6851,9 @@ msgstr "Trục tọa độ" msgid "Gridlines" msgstr "Đường lưới" +# AI Translated msgid "Focus mode" -msgstr "" +msgstr "Chế độ tập trung" # AI Translated msgid "Labels" @@ -6906,7 +6915,7 @@ msgstr "Thể tích:" msgid "Size:" msgstr "Kích thước:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "Đã tìm thấy xung đột đường đi G-code tại lớp %d, Z = %.2lfmm. Vui lòng tách các vật thể xung đột ra xa hơn (%s <-> %s)." @@ -11460,11 +11469,14 @@ msgstr "Hiện cài đặt sẵn không được hỗ trợ" msgid "Show incompatible/unsupported presets in the printer and filament dropdown lists. These presets cannot be selected." msgstr "Hiện các cài đặt sẵn không tương thích/không được hỗ trợ trong danh sách thả xuống máy in và filament. Không thể chọn các cài đặt sẵn này." +# AI Translated msgid "Export statistics with G-code" -msgstr "" +msgstr "Xuất thống kê cùng với G-code" +# AI Translated +# Needs human review: "feature" rendered as line type (ประเภทเส้น / Loại đường); check this matches the per-feature totals in the exported JSON msgid "If enabled, exporting a G-code file also writes its statistics as JSON next to it, as .statistics.json, and an exported sliced 3MF file holds them inside: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Nếu bật, khi xuất file G-code, thống kê của nó cũng được ghi dưới dạng JSON cạnh file đó, với tên .statistics.json, và file 3MF đã slice được xuất sẽ chứa chúng bên trong: thời gian in, tổng filament và tổng theo loại đường, cùng số liệu tương tự theo từng lớp và từng vật thể." # AI Translated msgid "Experimental Features" @@ -12352,6 +12364,10 @@ msgstr "Tải file lên bộ nhớ của máy in thất bại. Vui lòng thử l msgid "Send Failed" msgstr "Gửi thất bại" +# AI Translated +msgid "No available printers" +msgstr "Không có máy in khả dụng" + msgid "The name length exceeds the limit." msgstr "Độ dài tên vượt quá giới hạn." @@ -14300,8 +14316,8 @@ msgid "Left mouse" msgstr "Chuột trái" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "Khả dụng ở mọi nơi trong cửa sổ, kể cả khi đang gõ trong ô văn bản." +msgid "Available anywhere in the window." +msgstr "Khả dụng ở mọi nơi trong cửa sổ." # AI Translated msgid "Run favorite 1 to 10" @@ -14414,10 +14430,6 @@ msgstr "%s đã được gán cho %s. Gán lại cho %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "%s mặc định đã được gán cho %s. Gán lại cho %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "Phím tắt toàn cục cũng có tác dụng khi đang gõ." - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "Phím gõ ra ký tự không thể là phím tắt toàn cục." @@ -14882,9 +14894,10 @@ msgstr "modifier \"%1%\" của \"%2%\" (tổng cộng %3%) không có tác dụn msgid "Seam placement may differ from expected." msgstr "Vị trí đường nối có thể khác với dự kiến." +# AI Translated #, boost-format msgid "Failed to write the G-code statistics to %1%." -msgstr "" +msgstr "Không thể ghi thống kê G-code vào %1%." msgid "Internal Bridge" msgstr "Cầu bên trong" @@ -18376,6 +18389,14 @@ msgstr "Loại trừ đối tượng" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "Bật tùy chọn này để thêm lệnh EXCLUDE OBJECT vào G-code." +# AI Translated +msgid "Outline tolerance" +msgstr "Dung sai đường viền" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "Độ lệch tối đa của đường viền vật thể được ghi vào EXCLUDE_OBJECT_DEFINE so với đường viền gốc. Giá trị lớn hơn cho ít điểm hơn, giúp ích cho firmware bị treo khi phân tích G-code có nhiều vật thể. 0 giữ lại mọi điểm." + msgid "Verbose G-code" msgstr "G-code chi tiết" @@ -21664,11 +21685,14 @@ msgstr "Thư mục đầu ra" msgid "This is the output directory for exported files." msgstr "Thư mục đầu ra cho các file được xuất." +# AI Translated msgid "Export statistics" -msgstr "" +msgstr "Xuất thống kê" +# AI Translated +# Needs human review: "feature" rendered as line type (ประเภทเส้น / Loại đường); check this matches the per-feature totals in the exported JSON msgid "Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer and per object." -msgstr "" +msgstr "Ghi thống kê của từng plate đã slice dưới dạng JSON, là plate_N.statistics.json cạnh file G-code của nó trong thư mục đầu ra và bên trong file 3MF của --export-3mf: thời gian in, tổng filament và tổng theo loại đường, cùng số liệu tương tự theo từng lớp và từng vật thể." msgid "Debug level" msgstr "Mức gỡ lỗi" @@ -31675,1231 +31699,1641 @@ msgid "The current filament list does not contain %s. A project filament require msgid_plural "The current filament list does not contain %s. Project filaments required by the mixed filament will be created automatically after decomposition." msgstr[0] "Danh sách filament hiện tại không chứa %s. Một filament dự án mà filament pha trộn cần sẽ được tạo tự động sau khi phân tách." +# AI Translated msgid "Color Picker" -msgstr "" +msgstr "Bộ chọn màu" +# AI Translated msgid "Basic Colors" -msgstr "" - -msgid "Orca Palette" -msgstr "" +msgstr "Màu cơ bản" +# AI Translated #. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. -msgid "RAL Classic" -msgstr "" +msgid "Orca Palette" +msgstr "Bảng màu Orca" +# AI Translated #. TRN: Keep the standard/brand name "RAL" unchanged. +msgid "RAL Classic" +msgstr "RAL Cổ điển" + +# AI Translated msgid "Gradients" -msgstr "" +msgstr "Chuyển màu" +# AI Translated +msgctxt "Color picker" msgid "Solid" -msgstr "" +msgstr "Đơn sắc" +# AI Translated msgid "Gradient" -msgstr "" +msgstr "Chuyển màu" +# AI Translated msgid "Gradient start" -msgstr "" +msgstr "Điểm bắt đầu chuyển màu" +# AI Translated msgid "Gradient end" -msgstr "" +msgstr "Điểm kết thúc chuyển màu" +# AI Translated msgid "Gradient color" -msgstr "" +msgstr "Màu chuyển màu" +# AI Translated msgid "Add color" -msgstr "" +msgstr "Thêm màu" +# AI Translated msgid "Remove color" -msgstr "" +msgstr "Xóa màu" +# AI Translated msgid "Saturation" -msgstr "" +msgstr "Độ bão hòa" +# AI Translated msgid "Original color" -msgstr "" +msgstr "Màu gốc" +# AI Translated #. TRN: Clicking the current color preview adds it to the saved favorites. msgid "Save current color" -msgstr "" +msgstr "Lưu màu hiện tại" +# AI Translated msgid "Palettes" -msgstr "" +msgstr "Bảng màu" +# AI Translated msgid "Search colors" -msgstr "" +msgstr "Tìm màu" +# AI Translated msgid "Filter colors" -msgstr "" +msgstr "Lọc màu" +# AI Translated msgid "No matching colors" -msgstr "" +msgstr "Không có màu phù hợp" +# AI Translated msgid "Hex color" -msgstr "" +msgstr "Màu hex" # AI Translated msgid "Opacity" msgstr "Độ đục" +# AI Translated msgid "Opacity percent" -msgstr "" +msgstr "Phần trăm độ đục" +# AI Translated msgid "Save color" -msgstr "" +msgstr "Lưu màu" +# AI Translated msgid "Enter a complete hexadecimal color" -msgstr "" +msgstr "Nhập đầy đủ màu thập lục phân" +# AI Translated msgid "The current multi-color selection is kept until you choose a different color." -msgstr "" +msgstr "Lựa chọn nhiều màu hiện tại được giữ lại cho đến khi bạn chọn màu khác." +# AI Translated #, c-format, boost-format msgid "Up to %d colors supported." -msgstr "" +msgstr "Hỗ trợ tối đa %d màu." +# AI Translated msgid "Crimson" -msgstr "" +msgstr "Đỏ thẫm" +# AI Translated msgid "Orange red" -msgstr "" +msgstr "Đỏ cam" +# AI Translated msgid "Tomato" -msgstr "" +msgstr "Đỏ cà chua" +# AI Translated msgid "Orange" -msgstr "" +msgstr "Cam" +# AI Translated msgid "Dark orange" -msgstr "" +msgstr "Cam đậm" +# AI Translated msgid "Gold" -msgstr "" +msgstr "Vàng kim" +# AI Translated msgid "Burly wood" -msgstr "" +msgstr "Nâu gỗ nhạt" +# AI Translated msgid "Bisque" -msgstr "" +msgstr "Kem cam" +# AI Translated msgid "Misty rose" -msgstr "" +msgstr "Hồng sương" +# AI Translated msgid "Light yellow" -msgstr "" +msgstr "Vàng nhạt" +# AI Translated msgid "Lemon chiffon" -msgstr "" +msgstr "Kem chanh" +# AI Translated msgid "Beige" -msgstr "" +msgstr "Be" +# AI Translated msgid "Light golden rod yellow" -msgstr "" +msgstr "Vàng nghệ sáng" +# AI Translated msgid "Pale golden rod" -msgstr "" +msgstr "Vàng nghệ dịu" +# AI Translated msgid "Khaki" -msgstr "" +msgstr "Kaki" +# AI Translated msgid "Dark khaki" -msgstr "" +msgstr "Kaki đậm" +# AI Translated msgid "Peach puff" -msgstr "" +msgstr "Đào nhạt" +# AI Translated msgid "Moccasin" -msgstr "" +msgstr "Vàng da hươu" +# AI Translated msgid "Papaya whip" -msgstr "" +msgstr "Kem đu đủ" +# AI Translated msgid "Blanched almond" -msgstr "" +msgstr "Hạnh nhân lột vỏ" +# AI Translated msgid "Antique white" -msgstr "" +msgstr "Trắng cổ" +# AI Translated msgid "Navajo white" -msgstr "" +msgstr "Trắng Navajo" +# AI Translated msgid "Wheat" -msgstr "" +msgstr "Lúa mì" +# AI Translated msgid "Golden rod" -msgstr "" +msgstr "Vàng nghệ" +# AI Translated msgid "Chocolate" -msgstr "" +msgstr "Sô-cô-la" +# AI Translated msgid "Peru" -msgstr "" +msgstr "Nâu Peru" +# AI Translated msgid "Fire brick" -msgstr "" +msgstr "Gạch chịu lửa" +# AI Translated msgid "Sienna" -msgstr "" +msgstr "Nâu sienna" +# AI Translated msgid "Saddle brown" -msgstr "" +msgstr "Nâu yên ngựa" +# AI Translated msgid "Brown" -msgstr "" +msgstr "Nâu" +# AI Translated msgid "Rosy brown" -msgstr "" +msgstr "Nâu hồng" +# AI Translated msgid "Salmon" -msgstr "" +msgstr "Cá hồi" +# AI Translated msgid "Light salmon" -msgstr "" +msgstr "Cá hồi nhạt" +# AI Translated msgid "Dark salmon" -msgstr "" +msgstr "Cá hồi đậm" +# AI Translated msgid "Sandy brown" -msgstr "" +msgstr "Nâu cát" +# AI Translated msgid "Coral" -msgstr "" +msgstr "San hô" +# AI Translated msgid "Light coral" -msgstr "" +msgstr "San hô nhạt" +# AI Translated msgid "Indian red" -msgstr "" +msgstr "Đỏ Ấn Độ" +# AI Translated msgid "Dark red" -msgstr "" +msgstr "Đỏ đậm" +# AI Translated msgid "Maroon" -msgstr "" +msgstr "Nâu đỏ sẫm" +# AI Translated msgid "Green yellow" -msgstr "" +msgstr "Vàng lục" +# AI Translated msgid "Yellow green" -msgstr "" +msgstr "Xanh lá vàng" +# AI Translated msgid "Chartreuse" -msgstr "" +msgstr "Chartreuse" +# AI Translated msgid "Lawn green" -msgstr "" +msgstr "Xanh thảm cỏ" +# AI Translated msgid "Lime green" -msgstr "" +msgstr "Xanh lá chanh" +# AI Translated msgid "Spring green" -msgstr "" +msgstr "Xanh lá mùa xuân" +# AI Translated msgid "Medium spring green" -msgstr "" +msgstr "Xanh lá mùa xuân vừa" +# AI Translated msgid "Lime" -msgstr "" +msgstr "Xanh chanh" +# AI Translated msgid "Forest green" -msgstr "" +msgstr "Xanh lá rừng" +# AI Translated msgid "Dark green" -msgstr "" +msgstr "Xanh lá đậm" +# AI Translated msgid "Olive drab" -msgstr "" +msgstr "Xanh ô liu xỉn" +# AI Translated msgid "Olive" -msgstr "" +msgstr "Ô liu" +# AI Translated msgid "Dark olive green" -msgstr "" +msgstr "Xanh lá ô liu đậm" +# AI Translated msgid "Pale green" -msgstr "" +msgstr "Xanh lá dịu" +# AI Translated msgid "Light green" -msgstr "" +msgstr "Xanh lá nhạt" +# AI Translated msgid "Medium sea green" -msgstr "" +msgstr "Xanh lá biển vừa" +# AI Translated msgid "Sea green" -msgstr "" +msgstr "Xanh lá biển" +# AI Translated msgid "Dark sea green" -msgstr "" +msgstr "Xanh lá biển đậm" +# AI Translated msgid "Cadet blue" -msgstr "" +msgstr "Xanh dương cadet" +# AI Translated msgid "Medium aqua marine" -msgstr "" +msgstr "Aquamarine vừa" +# AI Translated msgid "Turquoise" -msgstr "" +msgstr "Ngọc lam" +# AI Translated msgid "Medium turquoise" -msgstr "" +msgstr "Ngọc lam vừa" +# AI Translated msgid "Dark turquoise" -msgstr "" +msgstr "Ngọc lam đậm" +# AI Translated msgid "Pale turquoise" -msgstr "" +msgstr "Ngọc lam dịu" +# AI Translated msgid "Aqua" -msgstr "" +msgstr "Aqua" +# AI Translated msgid "Light cyan" -msgstr "" +msgstr "Xanh lơ nhạt" +# AI Translated msgid "Mint cream" -msgstr "" +msgstr "Kem bạc hà" +# AI Translated msgid "Honey dew" -msgstr "" +msgstr "Dưa mật" +# AI Translated msgid "Aquamarine" -msgstr "" +msgstr "Aquamarine" +# AI Translated msgid "Light sea green" -msgstr "" +msgstr "Xanh lá biển nhạt" +# AI Translated msgid "Dark cyan" -msgstr "" +msgstr "Xanh lơ đậm" +# AI Translated msgid "Teal" -msgstr "" +msgstr "Xanh mòng két" +# AI Translated msgid "Dark slate gray" -msgstr "" +msgstr "Xám đá phiến đậm" +# AI Translated msgid "Light slate gray" -msgstr "" +msgstr "Xám đá phiến nhạt" +# AI Translated msgid "Slate gray" -msgstr "" +msgstr "Xám đá phiến" +# AI Translated msgid "Deep sky blue" -msgstr "" +msgstr "Xanh da trời đậm" +# AI Translated msgid "Dodger Blue" -msgstr "" +msgstr "Xanh dương Dodger" +# AI Translated msgid "Sky blue" -msgstr "" +msgstr "Xanh da trời" +# AI Translated msgid "Light sky blue" -msgstr "" +msgstr "Xanh da trời nhạt" +# AI Translated msgid "Light blue" -msgstr "" +msgstr "Xanh dương nhạt" +# AI Translated msgid "Powder blue" -msgstr "" +msgstr "Xanh dương phấn" +# AI Translated msgid "Light steel blue" -msgstr "" +msgstr "Xanh thép nhạt" +# AI Translated msgid "Steel blue" -msgstr "" +msgstr "Xanh thép" +# AI Translated msgid "Cornflower blue" -msgstr "" +msgstr "Xanh dương cornflower" +# AI Translated msgid "Royal blue" -msgstr "" +msgstr "Xanh hoàng gia" +# AI Translated msgid "Medium blue" -msgstr "" +msgstr "Xanh dương vừa" +# AI Translated msgid "Midnight blue" -msgstr "" +msgstr "Xanh dương nửa đêm" +# AI Translated msgid "Dark blue" -msgstr "" +msgstr "Xanh dương đậm" +# AI Translated msgid "Navy" -msgstr "" +msgstr "Xanh navy" +# AI Translated msgid "Slate blue" -msgstr "" +msgstr "Xanh dương đá phiến" +# AI Translated msgid "Dark slate blue" -msgstr "" +msgstr "Xanh dương đá phiến đậm" +# AI Translated msgid "Medium slate blue" -msgstr "" +msgstr "Xanh dương đá phiến vừa" +# AI Translated msgid "Blue violet" -msgstr "" +msgstr "Tím lam" +# AI Translated msgid "Indigo" -msgstr "" +msgstr "Chàm" +# AI Translated msgid "Dark violet" -msgstr "" +msgstr "Tím violet đậm" +# AI Translated msgid "Dark orchid" -msgstr "" +msgstr "Lan đậm" +# AI Translated msgid "Medium orchid" -msgstr "" +msgstr "Lan vừa" +# AI Translated msgid "Orchid" -msgstr "" +msgstr "Lan" +# AI Translated msgid "Violet" -msgstr "" +msgstr "Tím violet" +# AI Translated msgid "Medium purple" -msgstr "" +msgstr "Tím vừa" +# AI Translated msgid "Purple" -msgstr "" +msgstr "Tím" +# AI Translated msgid "Rebecca purple" -msgstr "" +msgstr "Tím Rebecca" +# AI Translated msgid "Medium violet red" -msgstr "" +msgstr "Đỏ tím vừa" -msgid "PaleV violet red" -msgstr "" +# AI Translated +msgid "Pale violet red" +msgstr "Đỏ tím dịu" +# AI Translated msgid "Deep pink" -msgstr "" +msgstr "Hồng đậm" +# AI Translated msgid "Hot pink" -msgstr "" +msgstr "Hồng tươi" +# AI Translated msgid "Light pink" -msgstr "" +msgstr "Hồng nhạt" +# AI Translated msgid "Pink" -msgstr "" +msgstr "Hồng" +# AI Translated msgid "Plum" -msgstr "" +msgstr "Mận" +# AI Translated msgid "Thistle" -msgstr "" +msgstr "Tím kế" +# AI Translated msgid "Fuchsia" -msgstr "" +msgstr "Fuchsia" +# AI Translated msgid "Dark magenta" -msgstr "" +msgstr "Magenta đậm" +# AI Translated msgid "Linen" -msgstr "" +msgstr "Vải lanh" +# AI Translated msgid "Old lace" -msgstr "" +msgstr "Ren cũ" +# AI Translated msgid "Sea shell" -msgstr "" +msgstr "Vỏ sò" +# AI Translated msgid "Ivory" -msgstr "" +msgstr "Ngà" +# AI Translated msgid "Floral white" -msgstr "" +msgstr "Trắng hoa" +# AI Translated msgid "Lavender blush" -msgstr "" +msgstr "Oải hương ửng hồng" +# AI Translated msgid "Ghost white" -msgstr "" +msgstr "Trắng bóng ma" +# AI Translated msgid "Alice blue" -msgstr "" +msgstr "Xanh Alice" +# AI Translated msgid "Lavender" -msgstr "" +msgstr "Oải hương" +# AI Translated msgid "White smoke" -msgstr "" +msgstr "Trắng khói" +# AI Translated msgid "Gainsboro" -msgstr "" +msgstr "Gainsboro" +# AI Translated msgid "Black" -msgstr "" +msgstr "Đen" +# AI Translated msgid "Coral fire" -msgstr "" +msgstr "San hô lửa" +# AI Translated msgid "Sea anemone" -msgstr "" +msgstr "Hải quỳ" +# AI Translated msgid "Deep abyss" -msgstr "" +msgstr "Vực sâu" +# AI Translated msgid "Lobster red" -msgstr "" +msgstr "Đỏ tôm hùm" +# AI Translated msgid "Sandy clay" -msgstr "" +msgstr "Đất sét cát" +# AI Translated msgid "Driftwood" -msgstr "" +msgstr "Gỗ trôi dạt" +# AI Translated msgid "Sea buckthorn" -msgstr "" +msgstr "Hắc mai biển" +# AI Translated msgid "Sunset reef" -msgstr "" +msgstr "Rạn san hô hoàng hôn" +# AI Translated msgid "Tiger coral" -msgstr "" +msgstr "San hô hổ" +# AI Translated msgid "Pink coral" -msgstr "" +msgstr "San hô hồng" +# AI Translated msgid "Seashell glow" -msgstr "" +msgstr "Ánh vỏ sò" +# AI Translated msgid "Sand" -msgstr "" +msgstr "Cát" +# AI Translated msgid "Golden kelp" -msgstr "" +msgstr "Tảo bẹ vàng" +# AI Translated msgid "Sunlit dune" -msgstr "" +msgstr "Cồn cát nắng" +# AI Translated msgid "Amber nautilus" -msgstr "" +msgstr "Ốc anh vũ hổ phách" +# AI Translated msgid "Sea lemon" -msgstr "" +msgstr "Chanh biển" +# AI Translated msgid "Pale starfish" -msgstr "" +msgstr "Sao biển dịu" +# AI Translated msgid "Spring tide" -msgstr "" +msgstr "Triều cường" +# AI Translated msgid "Lime algae" -msgstr "" +msgstr "Tảo xanh chanh" +# AI Translated msgid "Sea grass" -msgstr "" +msgstr "Cỏ biển" +# AI Translated msgid "Neon plankton" -msgstr "" +msgstr "Sinh vật phù du neon" +# AI Translated msgid "Kelp forest" -msgstr "" +msgstr "Rừng tảo bẹ" +# AI Translated msgid "Emerald wave" -msgstr "" +msgstr "Sóng ngọc lục bảo" +# AI Translated msgid "Whale shadow" -msgstr "" +msgstr "Bóng cá voi" +# AI Translated msgid "Sea turtle" -msgstr "" +msgstr "Rùa biển" +# AI Translated msgid "Lagoon" -msgstr "" +msgstr "Đầm phá" +# AI Translated msgid "Tropical current" -msgstr "" +msgstr "Dòng hải lưu nhiệt đới" +# AI Translated msgid "Midnight trench" -msgstr "" +msgstr "Rãnh biển nửa đêm" +# AI Translated msgid "Dark kelp" -msgstr "" +msgstr "Tảo bẹ đậm" +# AI Translated msgid "Crystal surf" -msgstr "" +msgstr "Sóng pha lê" +# AI Translated msgid "Turquoise bay" -msgstr "" +msgstr "Vịnh ngọc lam" +# AI Translated msgid "Sky over reef" -msgstr "" +msgstr "Bầu trời trên rạn san hô" +# AI Translated msgid "Shallow sky" -msgstr "" +msgstr "Bầu trời nước nông" -msgid "Electric bel" -msgstr "" +# AI Translated +msgid "Electric blue" +msgstr "Xanh dương điện" +# AI Translated msgid "Dolphin" -msgstr "" +msgstr "Cá heo" +# AI Translated msgid "Ocean depths" -msgstr "" +msgstr "Độ sâu đại dương" +# AI Translated msgid "Whale" -msgstr "" +msgstr "Cá voi" +# AI Translated msgid "Indigo abyss" -msgstr "" +msgstr "Vực sâu chàm" +# AI Translated msgid "Sea urchin" -msgstr "" +msgstr "Nhím biển" +# AI Translated msgid "Lavender coral" -msgstr "" +msgstr "San hô oải hương" +# AI Translated msgid "Violet tide" -msgstr "" +msgstr "Thủy triều tím" +# AI Translated msgid "Deep sea orchid" -msgstr "" +msgstr "Lan biển sâu" +# AI Translated msgid "Neon jelly" -msgstr "" +msgstr "Sứa neon" +# AI Translated msgid "Fuchsia coral" -msgstr "" +msgstr "San hô fuchsia" +# AI Translated msgid "Pink jellyfish" -msgstr "" +msgstr "Sứa hồng" +# AI Translated msgid "Foam" -msgstr "" +msgstr "Bọt sóng" +# AI Translated msgid "Seashell white" -msgstr "" +msgstr "Trắng vỏ sò" +# AI Translated msgid "Pebble gray" -msgstr "" +msgstr "Xám sỏi" +# AI Translated msgid "Storm cloud" -msgstr "" +msgstr "Mây bão" +# AI Translated msgid "Ink black" -msgstr "" +msgstr "Đen mực" +# AI Translated msgid "Green beige" -msgstr "" +msgstr "Be lục" +# AI Translated msgid "Sand yellow" -msgstr "" +msgstr "Vàng cát" +# AI Translated msgid "Signal yellow" -msgstr "" +msgstr "Vàng tín hiệu" +# AI Translated msgid "Golden yellow" -msgstr "" +msgstr "Vàng óng" +# AI Translated msgid "Honey yellow" -msgstr "" +msgstr "Vàng mật ong" +# AI Translated msgid "Maize yellow" -msgstr "" +msgstr "Vàng ngô" -msgid "Dalmatian yellow" -msgstr "" +# AI Translated +msgid "Daffodil yellow" +msgstr "Vàng thủy tiên" +# AI Translated msgid "Brown beige" -msgstr "" +msgstr "Be nâu" +# AI Translated msgid "Lemon yellow" -msgstr "" +msgstr "Vàng chanh" +# AI Translated msgid "Oyster white" -msgstr "" +msgstr "Trắng hàu" +# AI Translated msgid "Light ivory" -msgstr "" +msgstr "Ngà nhạt" +# AI Translated msgid "Zinc yellow" -msgstr "" +msgstr "Vàng kẽm" +# AI Translated msgid "Grey beige" -msgstr "" +msgstr "Be xám" +# AI Translated msgid "Olive yellow" -msgstr "" +msgstr "Vàng ô liu" +# AI Translated msgid "Rape yellow" -msgstr "" +msgstr "Vàng cải dầu" +# AI Translated msgid "Traffic yellow" -msgstr "" +msgstr "Vàng giao thông" +# AI Translated msgid "Ochre yellow" -msgstr "" +msgstr "Vàng ocher" +# AI Translated msgid "Traffic orange yellow" -msgstr "" +msgstr "Vàng cam giao thông" +# AI Translated msgid "Curry" -msgstr "" +msgstr "Cà ri" +# AI Translated msgid "Melon yellow" -msgstr "" +msgstr "Vàng dưa" +# AI Translated msgid "Broom yellow" -msgstr "" +msgstr "Vàng hoa chổi" +# AI Translated msgid "Dahlia yellow" -msgstr "" +msgstr "Vàng thược dược" +# AI Translated msgid "Pastel yellow" -msgstr "" +msgstr "Vàng pastel" +# AI Translated msgid "Pearl beige" -msgstr "" +msgstr "Be xà cừ" +# AI Translated msgid "Pearl gold" -msgstr "" +msgstr "Vàng kim xà cừ" +# AI Translated msgid "Sun yellow" -msgstr "" +msgstr "Vàng mặt trời" +# AI Translated msgid "Yellow orange" -msgstr "" +msgstr "Cam vàng" +# AI Translated msgid "Deep orange" -msgstr "" +msgstr "Cam sẫm" +# AI Translated msgid "Vermilion" -msgstr "" +msgstr "Đỏ son" +# AI Translated msgid "Pearl orange" -msgstr "" +msgstr "Cam xà cừ" +# AI Translated msgid "Pure orange" -msgstr "" +msgstr "Cam tinh khiết" +# AI Translated msgid "Luminous orange" -msgstr "" +msgstr "Cam huỳnh quang" +# AI Translated msgid "Luminous bright orange" -msgstr "" +msgstr "Cam huỳnh quang tươi" +# AI Translated msgid "Bright red orange" -msgstr "" +msgstr "Cam đỏ tươi" +# AI Translated msgid "Traffic orange" -msgstr "" +msgstr "Cam giao thông" +# AI Translated msgid "Signal orange" -msgstr "" +msgstr "Cam tín hiệu" +# AI Translated msgid "Salmon orange" -msgstr "" +msgstr "Cam cá hồi" +# AI Translated msgid "Pearl pink" -msgstr "" +msgstr "Hồng xà cừ" +# AI Translated msgid "Copper orange" -msgstr "" +msgstr "Cam đồng" +# AI Translated msgid "Signal brown" -msgstr "" +msgstr "Nâu tín hiệu" +# AI Translated msgid "Fir orange" -msgstr "" +msgstr "Cam linh sam" +# AI Translated msgid "Signal red" -msgstr "" +msgstr "Đỏ tín hiệu" +# AI Translated msgid "Luminous red" -msgstr "" +msgstr "Đỏ huỳnh quang" +# AI Translated msgid "Carmine red" -msgstr "" +msgstr "Đỏ carmine" +# AI Translated msgid "Pearl carmine red" -msgstr "" +msgstr "Đỏ carmine xà cừ" +# AI Translated msgid "Pure red" -msgstr "" +msgstr "Đỏ tinh khiết" +# AI Translated msgid "Luminous deep red" -msgstr "" +msgstr "Đỏ sẫm huỳnh quang" +# AI Translated msgid "Currant red" -msgstr "" +msgstr "Đỏ lý chua" +# AI Translated msgid "Pearl ruby red" -msgstr "" +msgstr "Đỏ ruby xà cừ" +# AI Translated msgid "Fire red" -msgstr "" +msgstr "Đỏ lửa" +# AI Translated msgid "Ruby red" -msgstr "" +msgstr "Đỏ ruby" +# AI Translated msgid "Purple red" -msgstr "" +msgstr "Đỏ tím" +# AI Translated msgid "Wine red" -msgstr "" +msgstr "Đỏ rượu vang" +# AI Translated msgid "Black red" -msgstr "" +msgstr "Đỏ đen" +# AI Translated msgid "Oxide red" -msgstr "" +msgstr "Đỏ oxit" +# AI Translated msgid "Brown red" -msgstr "" +msgstr "Đỏ nâu" +# AI Translated +# Needs human review: Source name "Pine red" looks unusual for a RAL color; translated literally msgid "Pine red" -msgstr "" +msgstr "Đỏ thông" +# AI Translated msgid "Tomato red" -msgstr "" +msgstr "Đỏ cà chua" +# AI Translated msgid "Antique pink" -msgstr "" +msgstr "Hồng cổ" +# AI Translated msgid "Coral red" -msgstr "" +msgstr "Đỏ san hô" +# AI Translated msgid "Rose" -msgstr "" +msgstr "Hoa hồng" +# AI Translated msgid "Strawberry red" -msgstr "" +msgstr "Đỏ dâu tây" +# AI Translated msgid "Traffic red" -msgstr "" +msgstr "Đỏ giao thông" +# AI Translated msgid "Salmon pink" -msgstr "" +msgstr "Hồng cá hồi" +# AI Translated msgid "Luminous rose" -msgstr "" +msgstr "Hoa hồng huỳnh quang" +# AI Translated msgid "Luminous bright red" -msgstr "" +msgstr "Đỏ huỳnh quang tươi" +# AI Translated msgid "Raspberry red" -msgstr "" +msgstr "Đỏ mâm xôi" +# AI Translated msgid "Orient red" -msgstr "" +msgstr "Đỏ phương Đông" +# AI Translated msgid "Pearl ruby" -msgstr "" +msgstr "Ruby xà cừ" +# AI Translated msgid "Red purple" -msgstr "" +msgstr "Tím đỏ" +# AI Translated msgid "Red violet" -msgstr "" +msgstr "Tím violet đỏ" +# AI Translated msgid "Heather violet" -msgstr "" +msgstr "Tím violet thạch nam" +# AI Translated msgid "Bordeaux violet" -msgstr "" +msgstr "Tím violet bordeaux" +# AI Translated msgid "Mahogany" -msgstr "" +msgstr "Gỗ gụ" +# AI Translated msgid "Grey purple" -msgstr "" +msgstr "Tím xám" +# AI Translated msgid "Signal violet" -msgstr "" +msgstr "Tím violet tín hiệu" +# AI Translated msgid "Fir green" -msgstr "" +msgstr "Xanh lá linh sam" +# AI Translated msgid "Sabine grey" -msgstr "" +msgstr "Xám Sabine" +# AI Translated msgid "Pearl violet" -msgstr "" +msgstr "Tím violet xà cừ" +# AI Translated msgid "Pearl blackberry" -msgstr "" +msgstr "Mâm xôi đen xà cừ" +# AI Translated msgid "Green blue" -msgstr "" +msgstr "Xanh dương lục" +# AI Translated msgid "Ultramarine blue" -msgstr "" +msgstr "Xanh dương ultramarine" +# AI Translated msgid "Sapphire blue" -msgstr "" +msgstr "Xanh dương sapphire" +# AI Translated msgid "Black blue" -msgstr "" +msgstr "Xanh dương đen" +# AI Translated msgid "Signal blue" -msgstr "" +msgstr "Xanh dương tín hiệu" +# AI Translated msgid "Brilliant blue" -msgstr "" +msgstr "Xanh dương rực rỡ" +# AI Translated msgid "Grey blue" -msgstr "" +msgstr "Xanh dương xám" +# AI Translated msgid "Azure blue" -msgstr "" +msgstr "Xanh thiên thanh" +# AI Translated msgid "Gentian blue" -msgstr "" +msgstr "Xanh dương long đởm" +# AI Translated msgid "Cobalt blue" -msgstr "" +msgstr "Xanh dương cobalt" +# AI Translated msgid "Pigeon blue" -msgstr "" +msgstr "Xanh dương bồ câu" +# AI Translated msgid "Traffic blue" -msgstr "" +msgstr "Xanh dương giao thông" +# AI Translated msgid "Turquoise blue" -msgstr "" +msgstr "Xanh dương ngọc lam" -msgid "Capsanthin violet" -msgstr "" +# AI Translated +msgid "Capri blue" +msgstr "Xanh dương Capri" +# AI Translated msgid "Ocean blue" -msgstr "" +msgstr "Xanh dương đại dương" +# AI Translated msgid "Water blue" -msgstr "" +msgstr "Xanh dương nước" +# AI Translated msgid "Night blue" -msgstr "" +msgstr "Xanh dương đêm" +# AI Translated msgid "Distant blue" -msgstr "" +msgstr "Xanh dương xa" +# AI Translated msgid "Pastel blue" -msgstr "" +msgstr "Xanh dương pastel" +# AI Translated msgid "Pearl gentian blue" -msgstr "" +msgstr "Xanh dương long đởm xà cừ" +# AI Translated msgid "Pearl midnight blue" -msgstr "" +msgstr "Xanh dương nửa đêm xà cừ" +# AI Translated msgid "Patina green" -msgstr "" +msgstr "Xanh lá gỉ đồng" +# AI Translated msgid "Emerald green" -msgstr "" +msgstr "Xanh lá ngọc lục bảo" +# AI Translated msgid "Leaf green" -msgstr "" +msgstr "Xanh diệp lục" +# AI Translated msgid "Olive green" -msgstr "" +msgstr "Xanh lá ô liu" +# AI Translated msgid "Blue green" -msgstr "" +msgstr "Xanh lá lam" +# AI Translated msgid "Moss green" -msgstr "" +msgstr "Xanh lá rêu" +# AI Translated msgid "Grey olive" -msgstr "" +msgstr "Ô liu xám" +# AI Translated msgid "Pine green" -msgstr "" +msgstr "Xanh lá thông" +# AI Translated +# Needs human review: Source name "Pine brown" looks unusual for a RAL color; translated literally msgid "Pine brown" -msgstr "" +msgstr "Nâu thông" +# AI Translated msgid "Grass green" -msgstr "" +msgstr "Xanh lá cỏ" +# AI Translated msgid "Reseda green" -msgstr "" +msgstr "Xanh lá reseda" +# AI Translated msgid "Brown green" -msgstr "" +msgstr "Xanh lá nâu" +# AI Translated msgid "Reed green" -msgstr "" +msgstr "Xanh lá lau sậy" +# AI Translated msgid "Black green" -msgstr "" +msgstr "Xanh lá đen" +# AI Translated msgid "Turquoise green" -msgstr "" +msgstr "Xanh lá ngọc lam" +# AI Translated msgid "May green" -msgstr "" +msgstr "Xanh lá tháng Năm" +# AI Translated msgid "Chrome oxide green" -msgstr "" +msgstr "Xanh lá crom oxit" +# AI Translated msgid "Traffic green" -msgstr "" +msgstr "Xanh lá giao thông" +# AI Translated msgid "Fern green" -msgstr "" +msgstr "Xanh lá dương xỉ" +# AI Translated msgid "Opal green" -msgstr "" +msgstr "Xanh lá opal" +# AI Translated msgid "Mint green" -msgstr "" +msgstr "Xanh lá bạc hà" +# AI Translated msgid "Bronze green" -msgstr "" +msgstr "Xanh lá đồng thanh" +# AI Translated msgid "Pearl green" -msgstr "" +msgstr "Xanh lá xà cừ" +# AI Translated +# Needs human review: Unusual source name ("Sax turquoise"); translated literally msgid "Sax turquoise" -msgstr "" +msgstr "Ngọc lam Sax" +# AI Translated msgid "Pearl turquoise" -msgstr "" +msgstr "Ngọc lam xà cừ" +# AI Translated msgid "Pearl jade" -msgstr "" +msgstr "Ngọc bích xà cừ" +# AI Translated msgid "Pure green" -msgstr "" +msgstr "Xanh lá tinh khiết" +# AI Translated msgid "Luminous green" -msgstr "" +msgstr "Xanh lá huỳnh quang" +# AI Translated msgid "Squirrel grey" -msgstr "" +msgstr "Xám sóc" +# AI Translated msgid "Silver grey" -msgstr "" +msgstr "Xám bạc" -msgid "Olivestone" -msgstr "" +# AI Translated +msgid "Olive grey" +msgstr "Xám ô liu" +# AI Translated msgid "Moss grey" -msgstr "" +msgstr "Xám rêu" +# AI Translated msgid "Signal grey" -msgstr "" +msgstr "Xám tín hiệu" +# AI Translated msgid "Mouse grey" -msgstr "" +msgstr "Xám chuột" +# AI Translated msgid "Beige grey" -msgstr "" +msgstr "Xám be" +# AI Translated msgid "Khaki grey" -msgstr "" +msgstr "Xám kaki" +# AI Translated msgid "Green grey" -msgstr "" +msgstr "Xám lục" +# AI Translated msgid "Tarpaulin grey" -msgstr "" +msgstr "Xám bạt" +# AI Translated msgid "Iron grey" -msgstr "" +msgstr "Xám sắt" +# AI Translated msgid "Basalt grey" -msgstr "" +msgstr "Xám bazan" +# AI Translated msgid "Brown grey" -msgstr "" +msgstr "Xám nâu" +# AI Translated msgid "Slate grey" -msgstr "" +msgstr "Xám đá phiến" +# AI Translated msgid "Anthracite grey" -msgstr "" +msgstr "Xám antraxit" +# AI Translated msgid "Light grey" -msgstr "" +msgstr "Xám nhạt" +# AI Translated msgid "Umber grey" -msgstr "" +msgstr "Xám umber" +# AI Translated msgid "Concrete grey" -msgstr "" +msgstr "Xám bê tông" +# AI Translated msgid "Graphite grey" -msgstr "" +msgstr "Xám than chì" +# AI Translated msgid "Granite grey" -msgstr "" +msgstr "Xám đá granit" +# AI Translated msgid "Stone grey" -msgstr "" +msgstr "Xám đá" +# AI Translated msgid "Pebble grey" -msgstr "" +msgstr "Xám sỏi" +# AI Translated msgid "Cement grey" -msgstr "" +msgstr "Xám xi măng" +# AI Translated msgid "Yellow grey" -msgstr "" +msgstr "Xám vàng" +# AI Translated msgid "Platinum grey" -msgstr "" +msgstr "Xám bạch kim" +# AI Translated msgid "Dusty grey" -msgstr "" +msgstr "Xám bụi" +# AI Translated msgid "Agate grey" -msgstr "" +msgstr "Xám mã não" +# AI Translated msgid "Quartz grey" -msgstr "" +msgstr "Xám thạch anh" +# AI Translated msgid "Window grey" -msgstr "" +msgstr "Xám cửa sổ" +# AI Translated msgid "Traffic grey A" -msgstr "" +msgstr "Xám giao thông A" +# AI Translated msgid "Traffic grey B" -msgstr "" +msgstr "Xám giao thông B" +# AI Translated msgid "Silk grey" -msgstr "" +msgstr "Xám lụa" +# AI Translated msgid "Telegrey 1" -msgstr "" +msgstr "Telegrey 1" +# AI Translated msgid "Telegrey 2" -msgstr "" +msgstr "Telegrey 2" +# AI Translated msgid "Telegrey 4" -msgstr "" +msgstr "Telegrey 4" +# AI Translated msgid "Pearl mouse grey" -msgstr "" +msgstr "Xám chuột xà cừ" +# AI Translated msgid "Green brown" -msgstr "" +msgstr "Nâu lục" +# AI Translated msgid "Ochre brown" -msgstr "" +msgstr "Nâu ocher" +# AI Translated msgid "Clay brown" -msgstr "" +msgstr "Nâu đất sét" +# AI Translated msgid "Copper brown" -msgstr "" +msgstr "Nâu đồng" +# AI Translated msgid "Chocolate brown" -msgstr "" +msgstr "Nâu sô-cô-la" +# AI Translated msgid "Olive brown" -msgstr "" +msgstr "Nâu ô liu" +# AI Translated msgid "Nut brown" -msgstr "" +msgstr "Nâu quả hạch" +# AI Translated msgid "Red brown" -msgstr "" +msgstr "Nâu đỏ" +# AI Translated msgid "Sepia brown" -msgstr "" +msgstr "Nâu sepia" +# AI Translated msgid "Chestnut brown" -msgstr "" +msgstr "Nâu hạt dẻ" +# AI Translated msgid "Mahogany brown" -msgstr "" +msgstr "Nâu gỗ gụ" +# AI Translated msgid "Grey brown" -msgstr "" +msgstr "Nâu xám" +# AI Translated msgid "Pearl copper" -msgstr "" +msgstr "Đồng xà cừ" +# AI Translated msgid "Beige brown" -msgstr "" +msgstr "Nâu be" +# AI Translated msgid "Pearl mocha brown" -msgstr "" +msgstr "Nâu mocha xà cừ" +# AI Translated msgid "Earth brown" -msgstr "" +msgstr "Nâu đất" +# AI Translated msgid "Pearl brown" -msgstr "" +msgstr "Nâu xà cừ" +# AI Translated msgid "Cream" -msgstr "" +msgstr "Kem" +# AI Translated msgid "Grey white" -msgstr "" +msgstr "Trắng xám" +# AI Translated msgid "Signal white" -msgstr "" +msgstr "Trắng tín hiệu" +# AI Translated msgid "Signal black" -msgstr "" +msgstr "Đen tín hiệu" +# AI Translated msgid "Jet black" -msgstr "" +msgstr "Đen tuyền" +# AI Translated msgid "White aluminium" -msgstr "" +msgstr "Nhôm trắng" +# AI Translated msgid "Grey aluminium" -msgstr "" +msgstr "Nhôm xám" +# AI Translated msgid "Pure white" -msgstr "" +msgstr "Trắng tinh khiết" +# AI Translated msgid "Graphite black" -msgstr "" +msgstr "Đen than chì" +# AI Translated msgid "Traffic white" -msgstr "" +msgstr "Trắng giao thông" +# AI Translated msgid "Traffic black" -msgstr "" +msgstr "Đen giao thông" +# AI Translated msgid "Papyrus white" -msgstr "" +msgstr "Trắng giấy cói" +# AI Translated msgid "Pearl light grey" -msgstr "" +msgstr "Xám nhạt xà cừ" +# AI Translated msgid "Metal: Silver" -msgstr "" +msgstr "Kim loại: Bạc" +# AI Translated msgid "Metal: Brass" -msgstr "" +msgstr "Kim loại: Đồng thau" +# AI Translated msgid "Metal: Gold" -msgstr "" +msgstr "Kim loại: Vàng" +# AI Translated msgid "Metal: Copper" -msgstr "" +msgstr "Kim loại: Đồng" +# AI Translated msgid "Metal: Bronze" -msgstr "" +msgstr "Kim loại: Đồng thanh" +# AI Translated msgid "Nature: Pearl" -msgstr "" +msgstr "Thiên nhiên: Ngọc trai" +# AI Translated msgid "Nature: Rainbow" -msgstr "" +msgstr "Thiên nhiên: Cầu vồng" +# AI Translated msgid "Nature: Clear Sky" -msgstr "" +msgstr "Thiên nhiên: Trời quang" +# AI Translated msgid "Nature: Sunset" -msgstr "" +msgstr "Thiên nhiên: Hoàng hôn" +# AI Translated msgid "Wood: Dark" -msgstr "" +msgstr "Gỗ: Đậm" +# AI Translated msgid "Wood: Medium" -msgstr "" +msgstr "Gỗ: Vừa" +# AI Translated msgid "Wood: Light" -msgstr "" +msgstr "Gỗ: Nhạt" # AI Translated msgid "Alternate nozzles:" @@ -33375,13 +33809,25 @@ msgstr "Xóa khỏi Kết cấu của tôi" msgid "Built-in" msgstr "Tích hợp sẵn" +# AI Translated +msgid "My textures" +msgstr "Kết cấu của tôi" + # AI Translated msgid "No textures found." msgstr "Không tìm thấy kết cấu nào." # AI Translated -msgid "My textures" -msgstr "Kết cấu của tôi" +msgid "Texture libraries" +msgstr "Thư viện kết cấu" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "Khám phá thêm thư viện kết cấu" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "Mở OrcaCloud trong trang chủ để duyệt plugin." # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -33784,11 +34230,13 @@ msgstr "Được ánh xạ theo bố cục UV riêng của mô hình, vốn đã msgid "How wide one copy of the texture is on the model. Smaller repeats the pattern more often and makes its detail finer; with Tile off, this is the size of the single copy." msgstr "Chiều rộng của một bản kết cấu trên mô hình. Nhỏ hơn thì mẫu lặp lại nhiều hơn và chi tiết mịn hơn; khi tắt Xếp ô, đây là kích thước của bản duy nhất." +# AI Translated msgid "Larger" -msgstr "" +msgstr "Lớn hơn" +# AI Translated msgid "Smaller" -msgstr "" +msgstr "Nhỏ hơn" # AI Translated msgid "Turns the texture on the surface, in degrees - for lining a pattern up with an edge of the model." @@ -33864,11 +34312,13 @@ msgstr "Màu pha trộn" msgid "The most mixed filaments a bake may add. They are picked from the texture's colors, and only the ones the bake actually uses are created." msgstr "Số filament pha trộn tối đa mà một lần nướng có thể thêm. Chúng được chọn từ các màu của kết cấu, và chỉ những filament mà lần nướng thực sự dùng mới được tạo." +# AI Translated msgid "Few" -msgstr "" +msgstr "Ít" +# AI Translated msgid "Many" -msgstr "" +msgstr "Nhiều" # AI Translated #. TRN The %2% part of "%1% printable colors %2%"; %1% is the number of filaments. @@ -34219,11 +34669,13 @@ msgstr "Tạo lại lưới" msgid "Triangle size the whole model is rebuilt with, in millimetres. Displacement works best on an even mesh; this is what makes one out of an uneven import." msgstr "Kích thước tam giác dùng để dựng lại toàn bộ mô hình, tính bằng milimét. Dịch chuyển hoạt động tốt nhất trên lưới đều; đây là cách tạo lưới đều từ một mô hình nhập vào không đều." +# AI Translated msgid "Before" -msgstr "" +msgstr "Trước" +# AI Translated msgid "After" -msgstr "" +msgstr "Sau" # AI Translated msgid "Keep sharp edges" @@ -36075,6 +36527,10 @@ msgstr "Script" msgid "Slicing Pipeline" msgstr "Quy trình slice" +# AI Translated +msgid "Resource Texture" +msgstr "Kết cấu tài nguyên" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "Giao diện cấu hình của plugin trống. Đang hiển thị trình chỉnh sửa mặc định." @@ -36222,6 +36678,30 @@ msgstr "Thư mục plugin chứa cả file đầu vào .py và .whl" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "Thư mục plugin không chứa file đầu vào .py hoặc .whl" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "Chưa đặt thư mục kết cấu tài nguyên" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "Không thể xác định thư mục kết cấu tài nguyên" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "Đường dẫn kết cấu tài nguyên không phải là thư mục" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "Không thể xác định thư mục plugin" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "Thư mục kết cấu tài nguyên nằm ngoài thư mục plugin" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "Không thể đọc thư mục kết cấu tài nguyên" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -37169,6 +37649,28 @@ msgstr "" "Tránh cong vênh\n" "Bạn có biết rằng khi in vật liệu dễ cong vênh như ABS, tăng nhiệt độ bàn nóng một cách thích hợp có thể giảm xác suất cong vênh không?" +# AI Translated +#~ msgid "Dalmatian yellow" +#~ msgstr "Vàng Dalmatia" + +# AI Translated +# Needs human review: Source "Capsanthin violet" is probably a typo for RAL "Capri blue" (sits between Turquoise blue and Ocean blue); translated as Capri blue. Source string needs fixing +#~ msgid "Capsanthin violet" +#~ msgstr "Xanh dương Capri" + +# AI Translated +# Needs human review: Source "Olivestone" is probably a typo for RAL "Olive grey" (sits between Silver grey and Moss grey); translated as Olive grey. Source string needs fixing +#~ msgid "Olivestone" +#~ msgstr "Xám ô liu" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "Khả dụng ở mọi nơi trong cửa sổ, kể cả khi đang gõ trong ô văn bản." + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "Phím tắt toàn cục cũng có tác dụng khi đang gõ." + # AI Translated #~ msgid "Please choose the filament color" #~ msgstr "Vui lòng chọn màu filament" diff --git a/localization/i18n/zh_CN/OrcaSlicer_zh_CN.po b/localization/i18n/zh_CN/OrcaSlicer_zh_CN.po index 362b0a844b..79bfbfd6c2 100644 --- a/localization/i18n/zh_CN/OrcaSlicer_zh_CN.po +++ b/localization/i18n/zh_CN/OrcaSlicer_zh_CN.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Slic3rPE\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2026-06-11 12:37-0300\n" "Last-Translator: Handle \n" "Language-Team: \n" @@ -6699,7 +6699,7 @@ msgstr "体积:" msgid "Size:" msgstr "尺寸:" -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "发现G-code路径在层%d,高度为%.2lf mm处有冲突。请将有冲突的对象分离得更远(%s <-> %s)。" @@ -12013,6 +12013,10 @@ msgstr "上传文件到打印机存储失败,请重试。" msgid "Send Failed" msgstr "发送失败" +# AI Translated +msgid "No available printers" +msgstr "没有可用的打印机" + msgid "The name length exceeds the limit." msgstr "名称长度超过限制。" @@ -13922,8 +13926,8 @@ msgid "Left mouse" msgstr "鼠标左键" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "在窗口任意位置可用,即使正在文本框中输入。" +msgid "Available anywhere in the window." +msgstr "在窗口任意位置可用。" # AI Translated msgid "Run favorite 1 to 10" @@ -14039,10 +14043,6 @@ msgstr "%s 已分配给 %s。是否将其重新分配给 %s?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "默认的 %s 已分配给 %s。是否将其重新分配给 %s?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "全局快捷键在输入文字时同样生效。" - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "会输入字符的按键不能用作全局快捷键。" @@ -18086,6 +18086,14 @@ msgstr "对象排除" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "启用此选项以在G-code中添加EXCLUDE OBJECT命令。" +# AI Translated +msgid "Outline tolerance" +msgstr "轮廓线公差" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "写入 EXCLUDE_OBJECT_DEFINE 的对象轮廓线与原始轮廓线之间的最大偏差。数值越大,点数越少,有助于避免固件在解析包含大量对象的 G-code 时卡顿。0 表示保留所有点。" + msgid "Verbose G-code" msgstr "注释G-code" @@ -31498,20 +31506,21 @@ msgid "Basic Colors" msgstr "基本颜色" # AI Translated +#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. msgid "Orca Palette" msgstr "Orca 调色板" # AI Translated -#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. +#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "RAL Classic" msgstr "RAL 经典色" # AI Translated -#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "Gradients" msgstr "渐变预设" # AI Translated +msgctxt "Color picker" msgid "Solid" msgstr "纯色" @@ -32010,7 +32019,7 @@ msgid "Medium violet red" msgstr "中紫罗兰红" # AI Translated -msgid "PaleV violet red" +msgid "Pale violet red" msgstr "浅紫罗兰红" # AI Translated @@ -32226,8 +32235,7 @@ msgid "Shallow sky" msgstr "浅空" # AI Translated -# Needs human review: The English “Electric bel” looks like a typo (Electric blue? Electric eel?); the color is #1E90FF, so 电光蓝 was chosen. Recheck once the source name is fixed. -msgid "Electric bel" +msgid "Electric blue" msgstr "电光蓝" # AI Translated @@ -32319,9 +32327,8 @@ msgid "Maize yellow" msgstr "玉米黄" # AI Translated -# Needs human review: RAL 1007 is “Daffodil yellow” (水仙黄); the English name in the palette looks wrong. Recheck once the source name is fixed. -msgid "Dalmatian yellow" -msgstr "达尔马提亚黄" +msgid "Daffodil yellow" +msgstr "水仙黄" # AI Translated msgid "Brown beige" @@ -32668,8 +32675,8 @@ msgid "Turquoise blue" msgstr "绿松石蓝" # AI Translated -msgid "Capsanthin violet" -msgstr "辣椒红素紫" +msgid "Capri blue" +msgstr "卡普里蓝" # AI Translated msgid "Ocean blue" @@ -32820,8 +32827,8 @@ msgid "Silver grey" msgstr "银灰色" # AI Translated -msgid "Olivestone" -msgstr "橄榄石色" +msgid "Olive grey" +msgstr "橄榄灰" # AI Translated msgid "Moss grey" @@ -33597,13 +33604,25 @@ msgstr "从“我的纹理”中移除" msgid "Built-in" msgstr "内置" +# AI Translated +msgid "My textures" +msgstr "我的纹理" + # AI Translated msgid "No textures found." msgstr "未找到纹理。" # AI Translated -msgid "My textures" -msgstr "我的纹理" +msgid "Texture libraries" +msgstr "纹理库" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "探索更多纹理库" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "在主页中打开 OrcaCloud,浏览插件。" # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -36285,6 +36304,10 @@ msgstr "脚本" msgid "Slicing Pipeline" msgstr "切片流水线" +# AI Translated +msgid "Resource Texture" +msgstr "资源纹理" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "插件的配置界面为空。正在显示默认编辑器。" @@ -36433,6 +36456,30 @@ msgstr "插件目录同时包含 .py 和 .whl 入口文件" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "插件目录不包含 .py 或 .whl 入口文件" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "未设置资源纹理目录" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "无法解析资源纹理目录" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "资源纹理路径不是目录" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "无法解析插件文件夹" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "资源纹理目录位于插件文件夹之外" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "无法读取资源纹理目录" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -37400,6 +37447,40 @@ msgstr "" "避免翘曲\n" "您知道吗?打印ABS这类易翘曲材料时,适当提高热床温度可以降低翘曲的概率。" +# AI Translated +# Needs human review: RAL 1007 is “Daffodil yellow” (水仙黄); the English name in the palette looks wrong. Recheck once the source name is fixed. +#~ msgid "Dalmatian yellow" +#~ msgstr "达尔马提亚黄" + +# AI Translated +#~ msgid "Capsanthin violet" +#~ msgstr "辣椒红素紫" + +# AI Translated +#~ msgid "Olivestone" +#~ msgstr "橄榄石色" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "在窗口任意位置可用,即使正在文本框中输入。" + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "全局快捷键在输入文字时同样生效。" + +# AI Translated +#~ msgid "Solid" +#~ msgstr "纯色" + +# AI Translated +#~ msgid "PaleV violet red" +#~ msgstr "浅紫罗兰红" + +# AI Translated +# Needs human review: The English “Electric bel” looks like a typo (Electric blue? Electric eel?); the color is #1E90FF, so 电光蓝 was chosen. Recheck once the source name is fixed. +#~ msgid "Electric bel" +#~ msgstr "电光蓝" + #~ msgid "Please choose the filament color" #~ msgstr "请选择耗材丝颜色" diff --git a/localization/i18n/zh_TW/OrcaSlicer_zh_TW.po b/localization/i18n/zh_TW/OrcaSlicer_zh_TW.po index f19843d911..893078edf8 100644 --- a/localization/i18n/zh_TW/OrcaSlicer_zh_TW.po +++ b/localization/i18n/zh_TW/OrcaSlicer_zh_TW.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Orca Slicer\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-10-15 17:40+0800\n" +"POT-Creation-Date: 2026-10-19 09:48-0300\n" "PO-Revision-Date: 2025-11-28 13:48-0600\n" "Last-Translator: tntchn <15895303+tntchn@users.noreply.github.com>\n" "Language-Team: \n" @@ -6912,7 +6912,7 @@ msgid "Size:" msgstr "尺寸:" # AI Translated -#, boost-format +#, c-format, boost-format msgid "Conflicts of G-code paths have been found at layer %d, Z = %.2lfmm. Please separate the conflicted objects farther (%s <-> %s)." msgstr "在第 %d 層(Z = %.2lf mm)發現 G-code 路徑衝突。請將有衝突的物件分開得更遠(%s <-> %s)。" @@ -12298,6 +12298,10 @@ msgstr "無法將檔案上傳至列印裝置的儲存空間,請重試。" msgid "Send Failed" msgstr "傳送失敗" +# AI Translated +msgid "No available printers" +msgstr "沒有可用的列印裝置" + msgid "The name length exceeds the limit." msgstr "名稱長度超過限制。" @@ -14251,8 +14255,8 @@ msgid "Left mouse" msgstr "滑鼠左鍵" # AI Translated -msgid "Available anywhere in the window, even while typing in a text field." -msgstr "在視窗中任何位置皆可使用,即使正在文字欄位中輸入也可以。" +msgid "Available anywhere in the window." +msgstr "在視窗中任何位置皆可使用。" # AI Translated msgid "Run favorite 1 to 10" @@ -14372,10 +14376,6 @@ msgstr "%s 已指派給 %s。要改為指派給 %s 嗎?" msgid "The default %s is assigned to %s. Reassign it to %s?" msgstr "預設的 %s 已指派給 %s。要改為指派給 %s 嗎?" -# AI Translated -msgid "Global shortcuts also apply while typing." -msgstr "全域快速鍵在輸入文字時也會生效。" - # AI Translated msgid "A key that types a character cannot be a global shortcut." msgstr "會輸入字元的按鍵不能作為全域快速鍵。" @@ -18513,6 +18513,14 @@ msgstr "物件排除" msgid "Enable this option to add EXCLUDE OBJECT command in G-code." msgstr "啟用此選項以在 G-code 中加入 EXCLUDE OBJECT 指令。" +# AI Translated +msgid "Outline tolerance" +msgstr "輪廓線公差" + +# AI Translated +msgid "Maximum deviation of the object outline written to EXCLUDE_OBJECT_DEFINE from the original outline. Larger values give fewer points, which helps firmware that stalls while parsing G-code with many objects. 0 keeps every point." +msgstr "寫入 EXCLUDE_OBJECT_DEFINE 的物件輪廓線與原始輪廓線之間的最大偏差。數值越大,點數越少,有助於避免韌體在解析包含大量物件的 G-code 時卡住。0 表示保留所有點。" + msgid "Verbose G-code" msgstr "詳細 G-code" @@ -32124,21 +32132,22 @@ msgid "Basic Colors" msgstr "基本顏色" # AI Translated +#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. msgid "Orca Palette" msgstr "Orca 調色盤" # AI Translated -#. TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. +#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "RAL Classic" msgstr "RAL 經典色" # AI Translated # Needs human review: Palette dropdown entry for the gradient presets (next to 基本顏色 / Orca 調色盤 / RAL 經典色); 漸層配色 keeps it apart from the Solid/Gradient switch label 漸層. Check it reads right in the dropdown. -#. TRN: Keep the standard/brand name "RAL" unchanged. msgid "Gradients" msgstr "漸層配色" # AI Translated +msgctxt "Color picker" msgid "Solid" msgstr "純色" @@ -32637,7 +32646,7 @@ msgid "Medium violet red" msgstr "中紫羅蘭紅" # AI Translated -msgid "PaleV violet red" +msgid "Pale violet red" msgstr "淡紫羅蘭紅" # AI Translated @@ -32853,8 +32862,7 @@ msgid "Shallow sky" msgstr "淺色天空" # AI Translated -# Needs human review: Orca palette: the English is a typo for "Electric blue" (hex #1E90FF); translated as 電光藍. Revisit if the source keeps a different name. -msgid "Electric bel" +msgid "Electric blue" msgstr "電光藍" # AI Translated @@ -32946,9 +32954,8 @@ msgid "Maize yellow" msgstr "玉米黃" # AI Translated -# Needs human review: RAL 1007 in the RAL Classic list: the English name looks wrong (1007 is Daffodil yellow, 水仙黃); translated literally. Revisit once the source name is fixed. -msgid "Dalmatian yellow" -msgstr "達爾馬提亞黃" +msgid "Daffodil yellow" +msgstr "水仙黃" # AI Translated msgid "Brown beige" @@ -33296,9 +33303,8 @@ msgid "Turquoise blue" msgstr "綠松石藍" # AI Translated -# Needs human review: RAL 5019 in the RAL Classic list: the English name is not a RAL Classic name (5019 is Capri blue); translated literally. Revisit once the source name is fixed. -msgid "Capsanthin violet" -msgstr "辣椒紅素紫" +msgid "Capri blue" +msgstr "卡布里藍" # AI Translated msgid "Ocean blue" @@ -33449,8 +33455,8 @@ msgid "Silver grey" msgstr "銀灰" # AI Translated -msgid "Olivestone" -msgstr "橄欖石色" +msgid "Olive grey" +msgstr "橄欖灰" # AI Translated msgid "Moss grey" @@ -34226,13 +34232,25 @@ msgstr "從「我的紋理」移除" msgid "Built-in" msgstr "內建" +# AI Translated +msgid "My textures" +msgstr "我的紋理" + # AI Translated msgid "No textures found." msgstr "找不到紋理。" # AI Translated -msgid "My textures" -msgstr "我的紋理" +msgid "Texture libraries" +msgstr "紋理庫" + +# AI Translated +msgid "Explore more texture libraries" +msgstr "探索更多紋理庫" + +# AI Translated +msgid "Opens OrcaCloud in the Home page to browse for plugins." +msgstr "在首頁中開啟 OrcaCloud,瀏覽外掛。" # AI Translated msgid "Import your own image as a height map. It is converted to the format the slicer bakes from and saved to your personal texture folder, kept separate from the textures shipped with OrcaSlicer." @@ -36928,6 +36946,10 @@ msgstr "指令碼" msgid "Slicing Pipeline" msgstr "切片管線" +# AI Translated +msgid "Resource Texture" +msgstr "資源紋理" + # AI Translated msgid "The plugin's configuration UI was empty. Showing the default editor." msgstr "外掛的設定介面為空。將顯示預設編輯器。" @@ -37075,6 +37097,30 @@ msgstr "外掛目錄同時包含 .py 和 .whl 進入點檔案" msgid "Plugin directory does not contain a .py or .whl entry file" msgstr "外掛目錄不包含 .py 或 .whl 進入點檔案" +# AI Translated +msgid "Resource texture directory is not set" +msgstr "未設定資源紋理目錄" + +# AI Translated +msgid "Resource texture directory could not be resolved" +msgstr "無法解析資源紋理目錄" + +# AI Translated +msgid "Resource texture path is not a directory" +msgstr "資源紋理路徑不是目錄" + +# AI Translated +msgid "Plugin folder could not be resolved" +msgstr "無法解析外掛資料夾" + +# AI Translated +msgid "Resource texture directory is outside the plugin folder" +msgstr "資源紋理目錄位於外掛資料夾之外" + +# AI Translated +msgid "Resource texture directory could not be read" +msgstr "無法讀取資源紋理目錄" + # AI Translated #, boost-format msgid "Slicing pipeline plugin '%1%' error: %2%" @@ -38049,6 +38095,41 @@ msgstr "" "避免翹曲\n" "您知道嗎?當列印容易翹曲的材料(如 ABS)時,適當提高熱床溫度可以降低翹曲的機率。" +# AI Translated +# Needs human review: RAL 1007 in the RAL Classic list: the English name looks wrong (1007 is Daffodil yellow, 水仙黃); translated literally. Revisit once the source name is fixed. +#~ msgid "Dalmatian yellow" +#~ msgstr "達爾馬提亞黃" + +# AI Translated +# Needs human review: RAL 5019 in the RAL Classic list: the English name is not a RAL Classic name (5019 is Capri blue); translated literally. Revisit once the source name is fixed. +#~ msgid "Capsanthin violet" +#~ msgstr "辣椒紅素紫" + +# AI Translated +#~ msgid "Olivestone" +#~ msgstr "橄欖石色" + +# AI Translated +#~ msgid "Available anywhere in the window, even while typing in a text field." +#~ msgstr "在視窗中任何位置皆可使用,即使正在文字欄位中輸入也可以。" + +# AI Translated +#~ msgid "Global shortcuts also apply while typing." +#~ msgstr "全域快速鍵在輸入文字時也會生效。" + +# AI Translated +#~ msgid "Solid" +#~ msgstr "純色" + +# AI Translated +#~ msgid "PaleV violet red" +#~ msgstr "淡紫羅蘭紅" + +# AI Translated +# Needs human review: Orca palette: the English is a typo for "Electric blue" (hex #1E90FF); translated as 電光藍. Revisit if the source keeps a different name. +#~ msgid "Electric bel" +#~ msgstr "電光藍" + #~ msgid "Please choose the filament color" #~ msgstr "請選擇線材顏色" diff --git a/resources/fonts/NotoSansKR-Bold.ttf b/resources/fonts/NotoSansKR-Bold.ttf deleted file mode 100644 index 6cf639eb7d..0000000000 Binary files a/resources/fonts/NotoSansKR-Bold.ttf and /dev/null differ diff --git a/resources/fonts/NotoSansKR-Regular.ttf b/resources/fonts/NotoSansKR-Regular.ttf deleted file mode 100644 index 1b14d32473..0000000000 Binary files a/resources/fonts/NotoSansKR-Regular.ttf and /dev/null differ diff --git a/resources/profiles/Anker.json b/resources/profiles/Anker.json index b6d2ceb80d..a902697e8c 100644 --- a/resources/profiles/Anker.json +++ b/resources/profiles/Anker.json @@ -1,6 +1,6 @@ { "name": "Anker", - "version": "02.04.00.06", + "version": "02.04.00.07", "force_update": "0", "description": "Anker configurations", "machine_model_list": [ diff --git a/resources/profiles/Anker/machine/fdm_marlin_common.json b/resources/profiles/Anker/machine/fdm_marlin_common.json index 23dd8ea7c5..4f17be404f 100644 --- a/resources/profiles/Anker/machine/fdm_marlin_common.json +++ b/resources/profiles/Anker/machine/fdm_marlin_common.json @@ -6,7 +6,7 @@ "instantiation": "false", "gcode_flavor": "marlin2", "before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\n\n", - "file_start_gcode": ";TIME:{print_time_sec}s", + "file_start_gcode": ";TIME:{print_time_sec}s\n;Filament weight: {total_weight}g\n;Filament used: {used_filament}m\n;Layer height: {layer_height}\n;material_print_temperature_layer_0: {first_layer_temperature[0]}", "machine_start_gcode": "M4899 T3 ; Enable v3 jerk and S-curve acceleration \nM104 S150 ; Set hotend temp to 150 degrees to prevent ooze\nM190 S{first_layer_bed_temperature[0]} ; set and wait for bed temp to stabilize\nM109 S{first_layer_temperature[0]} ; set final nozzle temp to stabilize\nG28 ;Home\n;LAYER_COUNT:{total_layer_count}", "machine_end_gcode": "M104 S0\nM140 S0\n;Retract the filament\nG92 E1\nG1 E-1 F300\nG28 X0 Y0\nM18", "change_filament_gcode": "M600", diff --git a/resources/profiles/BBL.json b/resources/profiles/BBL.json index da56f36ccd..42a4da548b 100644 --- a/resources/profiles/BBL.json +++ b/resources/profiles/BBL.json @@ -1,7 +1,7 @@ { "name": "Bambulab", "url": "http://www.bambulab.com/Parameters/vendor/BBL.json", - "version": "02.08.00.15", + "version": "02.08.00.16", "force_update": "0", "description": "the initial version of BBL configurations", "machine_model_list": [ diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL P2S 0.6 nozzle.json b/resources/profiles/BBL/filament/Bambu ABS @BBL P2S 0.6 nozzle.json index 98be4a6887..b31f665898 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL P2S 0.6 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL P2S 0.6 nozzle.json @@ -5,6 +5,11 @@ "from": "system", "setting_id": "GFSB00_36", "instantiation": "true", + "activate_air_filtration": [ + "0", + "0", + "0" + ], "chamber_temperatures": [ "65" ], diff --git a/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json index 7102ecef5b..bb4ac6942b 100644 --- a/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json @@ -468,6 +468,7 @@ "319", "319" ], + "support_air_filtration": "1", "support_cooling_filter": "1", "support_chamber_temp_control": "1", "support_object_skip_flush": "0", diff --git a/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json index 1b2565e73a..fab04b5cac 100644 --- a/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json @@ -372,6 +372,7 @@ "319", "319" ], + "support_air_filtration": "1", "support_cooling_filter": "1", "support_chamber_temp_control": "1", "support_object_skip_flush": "0", diff --git a/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json index a71260a9ba..ec9ce9cc42 100644 --- a/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json @@ -267,6 +267,7 @@ "30", "30" ], + "support_air_filtration": "1", "support_chamber_temp_control": "1", "support_cooling_filter": "1", "support_object_skip_flush": "1", diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json index 960814b881..0d5b9f21d4 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json @@ -210,6 +210,7 @@ "18", "18" ], + "support_air_filtration": "1", "wipe_distance": [ "2", "2" diff --git a/resources/profiles/BBL/machine/Bambu Lab P2S 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P2S 0.4 nozzle.json index 55119f44e5..fab0cc24fb 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P2S 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P2S 0.4 nozzle.json @@ -267,6 +267,7 @@ "18", "18" ], + "support_air_filtration": "1", "support_object_skip_flush": "1", "wipe_distance": [ "2", diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json index 667590e658..527d7b8952 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json @@ -213,6 +213,7 @@ "18" ], "scan_first_layer": "1", + "support_air_filtration": "1", "wipe_distance": [ "2", "2" diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json index f208c2e5fd..2328c7ccf4 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json @@ -208,6 +208,7 @@ "18" ], "scan_first_layer": "1", + "support_air_filtration": "1", "wipe_distance": [ "2", "2" diff --git a/resources/profiles/BBL/machine/Bambu Lab X2D 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X2D 0.4 nozzle.json index e381fbdbee..e1162945e7 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X2D 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X2D 0.4 nozzle.json @@ -189,6 +189,7 @@ "20", "20" ], + "support_air_filtration": "1", "support_chamber_temp_control": "1", "upward_compatible_machine": [ "Bambu Lab A1 0.4 nozzle", diff --git a/resources/profiles/Flashforge.json b/resources/profiles/Flashforge.json index be6e64da1e..5625649e3b 100644 --- a/resources/profiles/Flashforge.json +++ b/resources/profiles/Flashforge.json @@ -1,7 +1,7 @@ { "name": "Flashforge", "url": "", - "version": "02.04.00.11", + "version": "02.04.00.12", "force_update": "0", "description": "Flashforge configurations", "machine_model_list": [ diff --git a/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M 0.4 Nozzle.json b/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M 0.4 Nozzle.json index 498f9c3064..849bc46c44 100644 --- a/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M 0.4 Nozzle.json +++ b/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M 0.4 Nozzle.json @@ -8,6 +8,7 @@ "compatible_printers": [ "Flashforge Adventurer 5M 0.4 Nozzle" ], + "exclude_object_tolerance": "0.2", "filename_format": "{input_filename_base}_{filament_type[initial_tool]}_{print_time}.gcode", "post_process": "", "only_one_wall_top": "0", diff --git a/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M Pro 0.4 Nozzle.json b/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M Pro 0.4 Nozzle.json index cf9f12b7f2..bb45f2a088 100644 --- a/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M Pro 0.4 Nozzle.json +++ b/resources/profiles/Flashforge/process/0.20mm Standard @Flashforge AD5M Pro 0.4 Nozzle.json @@ -8,6 +8,7 @@ "compatible_printers": [ "Flashforge Adventurer 5M Pro 0.4 Nozzle" ], + "exclude_object_tolerance": "0.2", "filename_format": "{input_filename_base}_{filament_type[0]}_{print_time}.gcode", "post_process": "", "only_one_wall_top": "0", diff --git a/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M 0.6 Nozzle.json b/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M 0.6 Nozzle.json index 7540593b77..4ee2bd6afa 100644 --- a/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M 0.6 Nozzle.json +++ b/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M 0.6 Nozzle.json @@ -8,6 +8,7 @@ "compatible_printers": [ "Flashforge Adventurer 5M 0.6 Nozzle" ], + "exclude_object_tolerance": "0.2", "filename_format": "{input_filename_base}_{filament_type[initial_tool]}_{print_time}.gcode", "post_process": "", "only_one_wall_top": "0", diff --git a/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M Pro 0.6 Nozzle.json b/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M Pro 0.6 Nozzle.json index efc774872f..5fefdc83e7 100644 --- a/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M Pro 0.6 Nozzle.json +++ b/resources/profiles/Flashforge/process/0.30mm Standard @Flashforge AD5M Pro 0.6 Nozzle.json @@ -8,6 +8,7 @@ "compatible_printers": [ "Flashforge Adventurer 5M Pro 0.6 Nozzle" ], + "exclude_object_tolerance": "0.2", "filename_format": "{input_filename_base}_{filament_type[initial_tool]}_{print_time}.gcode", "post_process": "", "only_one_wall_top": "0", diff --git a/resources/profiles/OrcaFilamentLibrary.json b/resources/profiles/OrcaFilamentLibrary.json index ed48c2787c..66c591d44c 100644 --- a/resources/profiles/OrcaFilamentLibrary.json +++ b/resources/profiles/OrcaFilamentLibrary.json @@ -592,10 +592,18 @@ "name": "SUNLU PETG @base", "sub_path": "filament/SUNLU/SUNLU PETG @base.json" }, + { + "name": "School House Spools Matte PETG @base", + "sub_path": "filament/SchoolHouseSpools/School House Spools Matte PETG @base.json" + }, { "name": "School House Spools PETG @base", "sub_path": "filament/SchoolHouseSpools/School House Spools PETG @base.json" }, + { + "name": "School House Spools Transparent PETG @base", + "sub_path": "filament/SchoolHouseSpools/School House Spools Transparent PETG @base.json" + }, { "name": "eSUN PETG @base", "sub_path": "filament/eSUN/eSUN PETG @base.json" @@ -1100,10 +1108,22 @@ "name": "SUNLU Wood PLA @base", "sub_path": "filament/SUNLU/SUNLU Wood PLA @base.json" }, + { + "name": "School House Spools Marble PLA @base", + "sub_path": "filament/SchoolHouseSpools/School House Spools Marble PLA @base.json" + }, + { + "name": "School House Spools Matte PLA @base", + "sub_path": "filament/SchoolHouseSpools/School House Spools Matte PLA @base.json" + }, { "name": "School House Spools PLA @base", "sub_path": "filament/SchoolHouseSpools/School House Spools PLA @base.json" }, + { + "name": "School House Spools Silk PLA @base", + "sub_path": "filament/SchoolHouseSpools/School House Spools Silk PLA @base.json" + }, { "name": "Valment PLA @base", "sub_path": "filament/Valment/Valment PLA @base.json" @@ -1296,6 +1316,10 @@ "name": "Overture TPU @base", "sub_path": "filament/Overture/Overture TPU @base.json" }, + { + "name": "School House Spools TPU 95A @base", + "sub_path": "filament/SchoolHouseSpools/School House Spools TPU 95A @base.json" + }, { "name": "FusRock ABS-GF @BBL A1", "sub_path": "filament/FusRock/BBL/FusRock ABS-GF @BBL A1.json" @@ -2268,10 +2292,18 @@ "name": "SUNLU PETG @System", "sub_path": "filament/SUNLU/SUNLU PETG @System.json" }, + { + "name": "School House Spools Matte PETG @System", + "sub_path": "filament/SchoolHouseSpools/School House Spools Matte PETG @System.json" + }, { "name": "School House Spools PETG @System", "sub_path": "filament/SchoolHouseSpools/School House Spools PETG @System.json" }, + { + "name": "School House Spools Transparent PETG @System", + "sub_path": "filament/SchoolHouseSpools/School House Spools Transparent PETG @System.json" + }, { "name": "eSUN PETG @System", "sub_path": "filament/eSUN/eSUN PETG @System.json" @@ -3824,10 +3856,22 @@ "name": "SUNLU Wood PLA @System", "sub_path": "filament/SUNLU/SUNLU Wood PLA @System.json" }, + { + "name": "School House Spools Marble PLA @System", + "sub_path": "filament/SchoolHouseSpools/School House Spools Marble PLA @System.json" + }, + { + "name": "School House Spools Matte PLA @System", + "sub_path": "filament/SchoolHouseSpools/School House Spools Matte PLA @System.json" + }, { "name": "School House Spools PLA @System", "sub_path": "filament/SchoolHouseSpools/School House Spools PLA @System.json" }, + { + "name": "School House Spools Silk PLA @System", + "sub_path": "filament/SchoolHouseSpools/School House Spools Silk PLA @System.json" + }, { "name": "Valment PLA @System", "sub_path": "filament/Valment/Valment PLA @System.json" @@ -4228,6 +4272,10 @@ "name": "Overture TPU @System", "sub_path": "filament/Overture/Overture TPU @System.json" }, + { + "name": "School House Spools TPU 95A @System", + "sub_path": "filament/SchoolHouseSpools/School House Spools TPU 95A @System.json" + }, { "name": "Goofoo ABS @System", "sub_path": "filament/Goofoo/Goofoo ABS @System.json" diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Marble PLA @System.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Marble PLA @System.json new file mode 100644 index 0000000000..89547a0fbc --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Marble PLA @System.json @@ -0,0 +1,9 @@ +{ + "type": "filament", + "name": "School House Spools Marble PLA @System", + "inherits": "School House Spools Marble PLA @base", + "from": "system", + "setting_id": "gKoqhVeZCBn8YuPM", + "instantiation": "true", + "compatible_printers": [] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Marble PLA @base.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Marble PLA @base.json new file mode 100644 index 0000000000..a55c8bb54f --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Marble PLA @base.json @@ -0,0 +1,20 @@ +{ + "type": "filament", + "name": "School House Spools Marble PLA @base", + "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "OFEU6OJY", + "instantiation": "false", + "filament_cost": [ + "17" + ], + "filament_density": [ + "1.22" + ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_vendor": [ + "School House Spools" + ] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PETG @System.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PETG @System.json new file mode 100644 index 0000000000..4b5df650e7 --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PETG @System.json @@ -0,0 +1,9 @@ +{ + "type": "filament", + "name": "School House Spools Matte PETG @System", + "inherits": "School House Spools Matte PETG @base", + "from": "system", + "setting_id": "gVrdOWAeve7Ytkvq", + "instantiation": "true", + "compatible_printers": [] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PETG @base.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PETG @base.json new file mode 100644 index 0000000000..2ad5e79fe7 --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PETG @base.json @@ -0,0 +1,71 @@ +{ + "type": "filament", + "name": "School House Spools Matte PETG @base", + "inherits": "fdm_filament_pet", + "from": "system", + "filament_id": "OFiwOjce", + "instantiation": "false", + "cool_plate_temp": [ + "0" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp": [ + "70" + ], + "eng_plate_temp_initial_layer": [ + "70" + ], + "fan_cooling_layer_time": [ + "30" + ], + "fan_max_speed": [ + "40" + ], + "fan_min_speed": [ + "10" + ], + "filament_cost": [ + "15" + ], + "filament_density": [ + "1.25" + ], + "filament_flow_ratio": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "filament_vendor": [ + "School House Spools" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "nozzle_temperature_range_low": [ + "230" + ], + "overhang_fan_speed": [ + "90" + ], + "overhang_fan_threshold": [ + "10%" + ], + "slow_down_layer_time": [ + "12" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PLA @System.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PLA @System.json new file mode 100644 index 0000000000..350ea1872d --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PLA @System.json @@ -0,0 +1,9 @@ +{ + "type": "filament", + "name": "School House Spools Matte PLA @System", + "inherits": "School House Spools Matte PLA @base", + "from": "system", + "setting_id": "HlZ93lZcHerJYqK6", + "instantiation": "true", + "compatible_printers": [] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PLA @base.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PLA @base.json new file mode 100644 index 0000000000..c4814820b6 --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Matte PLA @base.json @@ -0,0 +1,26 @@ +{ + "type": "filament", + "name": "School House Spools Matte PLA @base", + "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "OFJe1Nqi", + "instantiation": "false", + "filament_cost": [ + "17" + ], + "filament_density": [ + "1.32" + ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_scarf_gap": [ + "0%" + ], + "filament_scarf_height": [ + "5%" + ], + "filament_vendor": [ + "School House Spools" + ] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Silk PLA @System.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Silk PLA @System.json new file mode 100644 index 0000000000..717760959c --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Silk PLA @System.json @@ -0,0 +1,9 @@ +{ + "type": "filament", + "name": "School House Spools Silk PLA @System", + "inherits": "School House Spools Silk PLA @base", + "from": "system", + "setting_id": "9cH3rxwal3s5GCZi", + "instantiation": "true", + "compatible_printers": [] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Silk PLA @base.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Silk PLA @base.json new file mode 100644 index 0000000000..4133e4f22c --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Silk PLA @base.json @@ -0,0 +1,33 @@ +{ + "type": "filament", + "name": "School House Spools Silk PLA @base", + "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "OFFUPLH1", + "instantiation": "false", + "description": "Fresh, sealed spools print fine as they are. Dry the filament again only after it has sat out in your environment for a while. For the highest gloss, set the outer wall speed to 40 to 60 mm/s when slicing.", + "filament_cost": [ + "20" + ], + "filament_density": [ + "1.32" + ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_scarf_gap": [ + "0%" + ], + "filament_scarf_height": [ + "5%" + ], + "filament_vendor": [ + "School House Spools" + ], + "nozzle_temperature": [ + "230" + ], + "nozzle_temperature_initial_layer": [ + "230" + ] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools TPU 95A @System.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools TPU 95A @System.json new file mode 100644 index 0000000000..492147d93d --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools TPU 95A @System.json @@ -0,0 +1,9 @@ +{ + "type": "filament", + "name": "School House Spools TPU 95A @System", + "inherits": "School House Spools TPU 95A @base", + "from": "system", + "setting_id": "DsCimJeIIAKpyMzY", + "instantiation": "true", + "compatible_printers": [] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools TPU 95A @base.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools TPU 95A @base.json new file mode 100644 index 0000000000..87127f077c --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools TPU 95A @base.json @@ -0,0 +1,24 @@ +{ + "type": "filament", + "name": "School House Spools TPU 95A @base", + "inherits": "fdm_filament_tpu", + "from": "system", + "filament_id": "OFChno4b", + "instantiation": "false", + "description": "This TPU is dried after extrusion and ships ready to print, so it does not need drying out of the box. Drying is optional if the spool has been sitting out for a while. It is soft and flexible, so it is not suited to automatic multi-material feeders.", + "filament_cost": [ + "25" + ], + "filament_density": [ + "1.22" + ], + "filament_vendor": [ + "School House Spools" + ], + "nozzle_temperature": [ + "230" + ], + "nozzle_temperature_initial_layer": [ + "230" + ] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Transparent PETG @System.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Transparent PETG @System.json new file mode 100644 index 0000000000..5cea71ecf8 --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Transparent PETG @System.json @@ -0,0 +1,9 @@ +{ + "type": "filament", + "name": "School House Spools Transparent PETG @System", + "inherits": "School House Spools Transparent PETG @base", + "from": "system", + "setting_id": "gJW8Fi5DP81yKDcm", + "instantiation": "true", + "compatible_printers": [] +} diff --git a/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Transparent PETG @base.json b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Transparent PETG @base.json new file mode 100644 index 0000000000..5ff74121b5 --- /dev/null +++ b/resources/profiles/OrcaFilamentLibrary/filament/SchoolHouseSpools/School House Spools Transparent PETG @base.json @@ -0,0 +1,77 @@ +{ + "type": "filament", + "name": "School House Spools Transparent PETG @base", + "inherits": "fdm_filament_pet", + "from": "system", + "filament_id": "OFVt3PHa", + "instantiation": "false", + "cool_plate_temp": [ + "0" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp": [ + "70" + ], + "eng_plate_temp_initial_layer": [ + "70" + ], + "fan_cooling_layer_time": [ + "30" + ], + "fan_max_speed": [ + "30" + ], + "fan_min_speed": [ + "10" + ], + "filament_cost": [ + "17" + ], + "filament_density": [ + "1.25" + ], + "filament_flow_ratio": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "filament_vendor": [ + "School House Spools" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], + "nozzle_temperature": [ + "245" + ], + "nozzle_temperature_initial_layer": [ + "250" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "nozzle_temperature_range_low": [ + "230" + ], + "overhang_fan_speed": [ + "90" + ], + "overhang_fan_threshold": [ + "10%" + ], + "slow_down_layer_time": [ + "12" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ] +} diff --git a/resources/profiles/Qidi.json b/resources/profiles/Qidi.json index dcb39ee957..075b9f7c54 100644 --- a/resources/profiles/Qidi.json +++ b/resources/profiles/Qidi.json @@ -1,6 +1,6 @@ { "name": "Qidi", - "version": "02.04.00.17", + "version": "02.04.00.18", "force_update": "0", "description": "Qidi configurations", "machine_model_list": [ diff --git a/resources/profiles/Qidi/process/0.12mm High Quality @X-Plus 5.json b/resources/profiles/Qidi/process/0.12mm High Quality @X-Plus 5.json index d2b490a4b1..ea753045ff 100644 --- a/resources/profiles/Qidi/process/0.12mm High Quality @X-Plus 5.json +++ b/resources/profiles/Qidi/process/0.12mm High Quality @X-Plus 5.json @@ -57,7 +57,7 @@ "support_bottom_z_distance": "0.12", "support_threshold_angle": "20", "support_top_z_distance": "0.12", - "top_color_penetration_layers": "7", + "top_color_penetration_layers": "5", "top_shell_layers": "5", "top_shell_thickness": "0.6", "top_surface_speed": [ diff --git a/resources/profiles/Snapmaker.json b/resources/profiles/Snapmaker.json index 4abf624a41..b702a02de3 100644 --- a/resources/profiles/Snapmaker.json +++ b/resources/profiles/Snapmaker.json @@ -1,6 +1,6 @@ { "name": "Snapmaker", - "version": "02.04.00.18", + "version": "02.04.00.19", "force_update": "0", "description": "Snapmaker configurations", "machine_model_list": [ diff --git a/resources/profiles/Snapmaker/process/0.06 High Quality @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.06 High Quality @Snapmaker U1 (0.2 nozzle).json index 357aeda830..861ef8c87e 100644 --- a/resources/profiles/Snapmaker/process/0.06 High Quality @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.06 High Quality @Snapmaker U1 (0.2 nozzle).json @@ -112,5 +112,7 @@ "600", "100", "600" - ] + ], + "top_color_penetration_layers": "7", + "bottom_color_penetration_layers": "5" } diff --git a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker (0.2 nozzle).json index f9c88f0fd6..4c036f678f 100644 --- a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker (0.2 nozzle).json @@ -24,6 +24,7 @@ "Snapmaker A350 Dual QS+B Kit (0.2 nozzle)" ], "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "bridge_flow": "1", "initial_layer_line_width": "0.25", "initial_layer_print_height": "0.1", @@ -35,6 +36,7 @@ "sparse_infill_line_width": "0.22", "support_line_width": "0.22", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "top_surface_line_width": "0.22", "wall_loops": "4", "initial_layer_speed": "40", diff --git a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker Artisan (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker Artisan (0.2 nozzle).json index 2f9d2d3d04..9c900f5f23 100644 --- a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker Artisan (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker Artisan (0.2 nozzle).json @@ -8,6 +8,7 @@ "Snapmaker Artisan (0.2 nozzle)" ], "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "bridge_flow": "1", "initial_layer_line_width": "0.25", "initial_layer_print_height": "0.1", @@ -19,6 +20,7 @@ "sparse_infill_line_width": "0.22", "support_line_width": "0.22", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_surface_line_width": "0.22", "wall_loops": "4", "initial_layer_infill_speed": "70", diff --git a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker J1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker J1 (0.2 nozzle).json index 11e667b0f1..cd5c9c379e 100644 --- a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker J1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker J1 (0.2 nozzle).json @@ -9,6 +9,7 @@ "Snapmaker J1 (0.2 nozzle)" ], "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "bridge_flow": "1", "initial_layer_line_width": "0.25", "initial_layer_print_height": "0.1", @@ -20,6 +21,7 @@ "sparse_infill_line_width": "0.22", "support_line_width": "0.22", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_surface_line_width": "0.22", "wall_loops": "4", "initial_layer_infill_speed": "80", diff --git a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker U1 (0.2 nozzle).json index 88bc187c8e..fa3e13fb67 100644 --- a/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.06 Standard @Snapmaker U1 (0.2 nozzle).json @@ -91,5 +91,7 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "7", + "bottom_color_penetration_layers": "5" } diff --git a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker (0.4 nozzle).json index 1158054b03..eb952a16d1 100644 --- a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker (0.4 nozzle).json @@ -24,6 +24,7 @@ "Snapmaker A350 Dual QS+B Kit (0.4 nozzle)" ], "bottom_shell_layers": "7", + "bottom_color_penetration_layers": "3", "bridge_flow": "1", "elefant_foot_compensation": "0.15", "ironing_flow": "8%", @@ -31,6 +32,7 @@ "initial_layer_print_height": "0.1", "support_threshold_angle": "15", "top_shell_layers": "9", + "top_color_penetration_layers": "5", "gap_infill_speed": "85", "initial_layer_infill_speed": "65", "inner_wall_speed": "120", diff --git a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker Artisan (0.4 nozzle).json index adf8ae30d1..21b20814d8 100644 --- a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker Artisan (0.4 nozzle).json @@ -9,6 +9,7 @@ "Snapmaker Artisan (0.4 nozzle)" ], "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "bridge_flow": "1", "elefant_foot_compensation": "0.15", "ironing_flow": "8%", @@ -16,6 +17,7 @@ "initial_layer_print_height": "0.1", "support_threshold_angle": "15", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "initial_layer_infill_speed": "80", "inner_wall_speed": "145", "internal_solid_infill_speed": "150" diff --git a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker J1 (0.4 nozzle).json index 890b8a4dad..eec06cf341 100644 --- a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker J1 (0.4 nozzle).json @@ -9,6 +9,7 @@ "Snapmaker J1 (0.4 nozzle)" ], "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "bridge_flow": "1", "elefant_foot_compensation": "0.15", "ironing_flow": "8%", @@ -16,6 +17,7 @@ "initial_layer_print_height": "0.1", "support_threshold_angle": "15", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "initial_layer_infill_speed": "80", "inner_wall_speed": "145", "internal_solid_infill_speed": "150" diff --git a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker U1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker U1 (0.4 nozzle).json index d102118041..5c31ac5c5b 100644 --- a/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker U1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.08 Extra Fine @Snapmaker U1 (0.4 nozzle).json @@ -93,5 +93,7 @@ "600", "450", "600" - ] + ], + "top_color_penetration_layers": "8", + "bottom_color_penetration_layers": "6" } diff --git a/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.2 nozzle).json index b5d2ade0a4..20a5ae8d4d 100644 --- a/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.2 nozzle).json @@ -112,5 +112,7 @@ "600", "100", "600" - ] + ], + "top_color_penetration_layers": "7", + "bottom_color_penetration_layers": "5" } diff --git a/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.4 nozzle).json index 81b775fb9d..f83a45df08 100644 --- a/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.08 High Quality @Snapmaker U1 (0.4 nozzle).json @@ -134,5 +134,7 @@ "Direct Drive High Flow", "Direct Drive Standard", "Direct Drive High Flow" - ] + ], + "top_color_penetration_layers": "8", + "bottom_color_penetration_layers": "6" } diff --git a/resources/profiles/Snapmaker/process/0.08 Standard @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.08 Standard @Snapmaker U1 (0.2 nozzle).json index 16f85b3466..1787be7916 100644 --- a/resources/profiles/Snapmaker/process/0.08 Standard @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.08 Standard @Snapmaker U1 (0.2 nozzle).json @@ -91,5 +91,7 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "7", + "bottom_color_penetration_layers": "5" } diff --git a/resources/profiles/Snapmaker/process/0.10 High Quality @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.10 High Quality @Snapmaker U1 (0.2 nozzle).json index 95719fcc46..5a213b709a 100644 --- a/resources/profiles/Snapmaker/process/0.10 High Quality @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.10 High Quality @Snapmaker U1 (0.2 nozzle).json @@ -112,5 +112,7 @@ "600", "100", "600" - ] + ], + "top_color_penetration_layers": "7", + "bottom_color_penetration_layers": "5" } diff --git a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker (0.2 nozzle).json index 581909f3a7..f9b570dbe3 100644 --- a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker (0.2 nozzle).json @@ -27,7 +27,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker Artisan (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker Artisan (0.2 nozzle).json index 4664301284..d195277ba7 100644 --- a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker Artisan (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker Artisan (0.2 nozzle).json @@ -12,7 +12,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker J1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker J1 (0.2 nozzle).json index 050a0d217d..2f38278dd6 100644 --- a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker J1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker J1 (0.2 nozzle).json @@ -12,7 +12,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker U1 (0.2 nozzle).json index d654bca839..4bcad523e3 100644 --- a/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.10 Standard @Snapmaker U1 (0.2 nozzle).json @@ -93,5 +93,7 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "7", + "bottom_color_penetration_layers": "5" } diff --git a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker (0.4 nozzle).json index 0096cf3d9f..e1f9458945 100644 --- a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker (0.4 nozzle).json @@ -26,8 +26,10 @@ "layer_height": "0.12", "initial_layer_print_height": "0.2", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "elefant_foot_compensation": "0.15", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_shell_thickness": "0.6", "bridge_flow": "1", "support_threshold_angle": "20", diff --git a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker Artisan (0.4 nozzle).json index 855369306e..02c78abaf8 100644 --- a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker Artisan (0.4 nozzle).json @@ -10,8 +10,10 @@ ], "layer_height": "0.12", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "elefant_foot_compensation": "0.15", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_shell_thickness": "0.6", "bridge_flow": "1", "support_threshold_angle": "20", diff --git a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker J1 (0.4 nozzle).json index c0a6a4d0e5..dcb4096e68 100644 --- a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker J1 (0.4 nozzle).json @@ -10,8 +10,10 @@ ], "layer_height": "0.12", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "elefant_foot_compensation": "0.15", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_shell_thickness": "0.6", "bridge_flow": "1", "support_threshold_angle": "20", diff --git a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker U1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker U1 (0.4 nozzle).json index 7552908319..bbbaa6a1b1 100644 --- a/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker U1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.12 Fine @Snapmaker U1 (0.4 nozzle).json @@ -94,5 +94,7 @@ "500", "200", "500" - ] + ], + "top_color_penetration_layers": "8", + "bottom_color_penetration_layers": "6" } diff --git a/resources/profiles/Snapmaker/process/0.12 High Quality @Snapmaker U1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.12 High Quality @Snapmaker U1 (0.4 nozzle).json index 7e473aeb2c..6eefec9d02 100644 --- a/resources/profiles/Snapmaker/process/0.12 High Quality @Snapmaker U1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.12 High Quality @Snapmaker U1 (0.4 nozzle).json @@ -135,5 +135,7 @@ "Direct Drive High Flow", "Direct Drive Standard", "Direct Drive High Flow" - ] + ], + "top_color_penetration_layers": "8", + "bottom_color_penetration_layers": "6" } diff --git a/resources/profiles/Snapmaker/process/0.12 Standard @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.12 Standard @Snapmaker U1 (0.2 nozzle).json index d6038972a6..3aff903e9e 100644 --- a/resources/profiles/Snapmaker/process/0.12 Standard @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.12 Standard @Snapmaker U1 (0.2 nozzle).json @@ -91,5 +91,7 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "6", + "bottom_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker (0.2 nozzle).json index b07c8f4758..b04c7c0c2c 100644 --- a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker (0.2 nozzle).json @@ -27,7 +27,9 @@ "initial_layer_print_height": "0.2", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker Artisan (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker Artisan (0.2 nozzle).json index e63fd634d4..3ab37fd7fc 100644 --- a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker Artisan (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker Artisan (0.2 nozzle).json @@ -11,7 +11,9 @@ "layer_height": "0.14", "wall_loops": "4", "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker J1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker J1 (0.2 nozzle).json index c9c285e7e2..13aaa274bd 100644 --- a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker J1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker J1 (0.2 nozzle).json @@ -11,7 +11,9 @@ "layer_height": "0.14", "wall_loops": "4", "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker U1 (0.2 nozzle).json b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker U1 (0.2 nozzle).json index 0bc45246f0..bcab59ed53 100644 --- a/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker U1 (0.2 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.14 Standard @Snapmaker U1 (0.2 nozzle).json @@ -91,5 +91,7 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "6", + "bottom_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.16 High Quality @Snapmaker U1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.16 High Quality @Snapmaker U1 (0.4 nozzle).json index ef1d0be7c0..64fa5326ce 100644 --- a/resources/profiles/Snapmaker/process/0.16 High Quality @Snapmaker U1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.16 High Quality @Snapmaker U1 (0.4 nozzle).json @@ -135,5 +135,7 @@ "Direct Drive High Flow", "Direct Drive Standard", "Direct Drive High Flow" - ] + ], + "top_color_penetration_layers": "6", + "bottom_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker (0.4 nozzle).json index c77a8dbfb6..4c77cb1ead 100644 --- a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker (0.4 nozzle).json @@ -27,6 +27,7 @@ "initial_layer_print_height": "0.2", "elefant_foot_compensation": "0.15", "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "top_shell_thickness": "0.6", "bridge_flow": "1", "support_threshold_angle": "25", @@ -41,5 +42,6 @@ "overhang_2_4_speed": "30", "overhang_3_4_speed": "10", "ironing_speed": "30", - "support_speed": "100" + "support_speed": "100", + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker Artisan (0.4 nozzle).json index 67fc4c5c17..3df04e4021 100644 --- a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker Artisan (0.4 nozzle).json @@ -11,7 +11,9 @@ "layer_height": "0.16", "elefant_foot_compensation": "0.15", "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_shell_thickness": "0.6", "bridge_flow": "1", "support_threshold_angle": "25", diff --git a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker J1 (0.4 nozzle).json index 983fdfc1f2..500e7cd5fc 100644 --- a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker J1 (0.4 nozzle).json @@ -11,7 +11,9 @@ "layer_height": "0.16", "elefant_foot_compensation": "0.15", "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_shell_thickness": "0.6", "bridge_flow": "1", "support_threshold_angle": "25", diff --git a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker U1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker U1 (0.4 nozzle).json index 79c1ad6f8f..cd6425d883 100644 --- a/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker U1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.16 Optimal @Snapmaker U1 (0.4 nozzle).json @@ -93,5 +93,7 @@ "500", "200", "500" - ] + ], + "top_color_penetration_layers": "6", + "bottom_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker (0.6 nozzle).json index 58ba1f433e..f3a6274866 100644 --- a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker (0.6 nozzle).json @@ -27,6 +27,7 @@ "initial_layer_print_height": "0.2", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_flow": "1", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -46,5 +47,6 @@ "overhang_2_4_speed": "50", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker Artisan (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker Artisan (0.6 nozzle).json index 571da9803b..5dcb62be15 100644 --- a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker Artisan (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker Artisan (0.6 nozzle).json @@ -18,5 +18,7 @@ "inner_wall_line_width": "0.62", "internal_solid_infill_line_width": "0.62", "support_line_width": "0.62", - "top_surface_line_width": "0.62" + "top_surface_line_width": "0.62", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker J1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker J1 (0.6 nozzle).json index 65113d6de1..f7c1415ee5 100644 --- a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker J1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker J1 (0.6 nozzle).json @@ -20,5 +20,7 @@ "support_line_width": "0.62", "top_surface_line_width": "0.62", "inner_wall_speed": "145", - "internal_solid_infill_speed": "150" + "internal_solid_infill_speed": "150", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker U1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker U1 (0.6 nozzle).json index cbe81ad191..8f82c85f5d 100644 --- a/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker U1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.18 Standard @Snapmaker U1 (0.6 nozzle).json @@ -105,5 +105,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "5" } diff --git a/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker (0.4 nozzle).json index 8f007e2a34..96e55587c2 100644 --- a/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker (0.4 nozzle).json @@ -33,5 +33,7 @@ "ironing_speed": "30", "overhang_1_4_speed": "40", "overhang_2_4_speed": "20", - "overhang_3_4_speed": "10" + "overhang_3_4_speed": "10", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker Artisan (0.4 nozzle).json index 1b40cd1f2a..7e3e4e04e6 100644 --- a/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker Artisan (0.4 nozzle).json @@ -8,5 +8,7 @@ "compatible_printers": [ "Snapmaker Artisan (0.4 nozzle)" ], - "elefant_foot_compensation": "0.15" + "elefant_foot_compensation": "0.15", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker J1 (0.4 nozzle).json index f81b4247e3..ee1ea602e7 100644 --- a/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.20 Standard @Snapmaker J1 (0.4 nozzle).json @@ -8,5 +8,7 @@ "compatible_printers": [ "Snapmaker J1 (0.4 nozzle)" ], - "elefant_foot_compensation": "0.15" + "elefant_foot_compensation": "0.15", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker (0.4 nozzle).json index 453c35a65c..72e7d8ba9b 100644 --- a/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker (0.4 nozzle).json @@ -37,5 +37,7 @@ "top_surface_speed": "70", "overhang_1_4_speed": "55", "overhang_2_4_speed": "30", - "overhang_3_4_speed": "10" + "overhang_3_4_speed": "10", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker Artisan (0.4 nozzle).json index 4098850307..5a4675ae00 100644 --- a/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker Artisan (0.4 nozzle).json @@ -11,5 +11,7 @@ "elefant_foot_compensation": "0.15", "wall_loops": "6", "bottom_shell_layers": "4", - "sparse_infill_density": "25%" + "bottom_color_penetration_layers": "3", + "sparse_infill_density": "25%", + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker J1 (0.4 nozzle).json index d6349b8dec..636cfbd010 100644 --- a/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.20 Strength @Snapmaker J1 (0.4 nozzle).json @@ -11,5 +11,7 @@ "elefant_foot_compensation": "0.15", "wall_loops": "6", "bottom_shell_layers": "4", - "sparse_infill_density": "25%" + "bottom_color_penetration_layers": "3", + "sparse_infill_density": "25%", + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker (0.4 nozzle).json index 25abfea922..0e1f06d651 100644 --- a/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker (0.4 nozzle).json @@ -27,6 +27,7 @@ "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.6", "support_threshold_angle": "35", "initial_layer_infill_speed": "65", @@ -39,5 +40,6 @@ "support_speed": "100", "overhang_1_4_speed": "55", "overhang_2_4_speed": "30", - "overhang_3_4_speed": "10" + "overhang_3_4_speed": "10", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker Artisan (0.4 nozzle).json index 17fe35c5d6..70b4e00f06 100644 --- a/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker Artisan (0.4 nozzle).json @@ -12,7 +12,9 @@ "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.6", "support_threshold_angle": "35", - "initial_layer_infill_speed": "65" + "initial_layer_infill_speed": "65", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker J1 (0.4 nozzle).json index 5f5199f7ec..f9f36ae985 100644 --- a/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Draft @Snapmaker J1 (0.4 nozzle).json @@ -12,7 +12,9 @@ "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.6", "support_threshold_angle": "35", - "initial_layer_infill_speed": "65" + "initial_layer_infill_speed": "65", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.6 nozzle).json index 3fa8e9b3db..63c16a319d 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.6 nozzle).json @@ -26,6 +26,7 @@ "layer_height": "0.24", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "line_width": "0.62", "outer_wall_line_width": "0.62", "initial_layer_line_width": "0.62", @@ -44,5 +45,6 @@ "overhang_2_4_speed": "50", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.8 nozzle).json index 9fdeff863a..64b7a40361 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker (0.8 nozzle).json @@ -26,6 +26,7 @@ "layer_height": "0.24", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "line_width": "0.82", "outer_wall_line_width": "0.82", "initial_layer_line_width": "0.82", @@ -46,5 +47,6 @@ "overhang_4_4_speed": "5", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.6 nozzle).json index e90dd34c1d..0f7ace584f 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.24", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "line_width": "0.62", "outer_wall_line_width": "0.62", "initial_layer_line_width": "0.62", @@ -18,5 +19,6 @@ "inner_wall_line_width": "0.62", "internal_solid_infill_line_width": "0.62", "support_line_width": "0.62", - "top_surface_line_width": "0.62" + "top_surface_line_width": "0.62", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.8 nozzle).json index 4615647a66..a7c6d8027e 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker Artisan (0.8 nozzle).json @@ -12,6 +12,7 @@ "initial_layer_print_height": "0.3", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "line_width": "0.82", "outer_wall_line_width": "0.82", "initial_layer_line_width": "0.82", @@ -19,5 +20,6 @@ "inner_wall_line_width": "0.82", "internal_solid_infill_line_width": "0.82", "support_line_width": "0.82", - "top_surface_line_width": "0.82" + "top_surface_line_width": "0.82", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.6 nozzle).json index c3c6d46268..7f637b0c7d 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.24", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "line_width": "0.62", "outer_wall_line_width": "0.62", "initial_layer_line_width": "0.62", @@ -18,5 +19,6 @@ "inner_wall_line_width": "0.62", "internal_solid_infill_line_width": "0.62", "support_line_width": "0.62", - "top_surface_line_width": "0.62" + "top_surface_line_width": "0.62", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.8 nozzle).json index 8aa8de9223..a7bac0ac16 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker J1 (0.8 nozzle).json @@ -12,6 +12,7 @@ "initial_layer_print_height": "0.3", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "line_width": "0.82", "outer_wall_line_width": "0.82", "initial_layer_line_width": "0.82", @@ -19,5 +20,6 @@ "inner_wall_line_width": "0.82", "internal_solid_infill_line_width": "0.82", "support_line_width": "0.82", - "top_surface_line_width": "0.82" + "top_surface_line_width": "0.82", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.6 nozzle).json index d5f4513a58..6d654e923a 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.6 nozzle).json @@ -105,5 +105,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.8 nozzle).json index 1865821910..0b4018dc1e 100644 --- a/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.24 Standard @Snapmaker U1 (0.8 nozzle).json @@ -105,5 +105,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker Artisan (0.4 nozzle).json index 2a0f1ae009..9b5ba0627f 100644 --- a/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker Artisan (0.4 nozzle).json @@ -10,6 +10,7 @@ ], "elefant_foot_compensation": "0.15", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.5", "initial_layer_speed": "100", "initial_layer_infill_speed": "180", @@ -46,6 +47,7 @@ "sparse_infill_line_width": "0.5", "top_surface_line_width": "0.5", "bottom_shell_layers": "2", + "bottom_color_penetration_layers": "2", "initial_layer_travel_speed": "100%", "bridge_acceleration": "3000", "bridge_speed": "100", diff --git a/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker J1 (0.4 nozzle).json index a38c31b2fd..57d1f1e724 100644 --- a/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker J1 (0.4 nozzle).json @@ -10,6 +10,7 @@ ], "elefant_foot_compensation": "0.15", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.5", "initial_layer_speed": "120", "initial_layer_infill_speed": "200", @@ -45,6 +46,7 @@ "sparse_infill_line_width": "0.5", "top_surface_line_width": "0.5", "bottom_shell_layers": "2", + "bottom_color_penetration_layers": "2", "initial_layer_travel_speed": "100%", "bridge_acceleration": "3000", "bridge_speed": "180", diff --git a/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker U1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker U1 (0.4 nozzle).json index 0b012c715a..03fba2f160 100644 --- a/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker U1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.25 Benchy @Snapmaker U1 (0.4 nozzle).json @@ -11,6 +11,7 @@ ], "elefant_foot_compensation": "0.15", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.5", "initial_layer_speed": [ "100", @@ -155,6 +156,7 @@ "sparse_infill_line_width": "0.5", "top_surface_line_width": "0.5", "bottom_shell_layers": "2", + "bottom_color_penetration_layers": "2", "initial_layer_travel_speed": [ "100%", "100%", diff --git a/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker (0.4 nozzle).json index f8d31d6c3d..e3aeb98f99 100644 --- a/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker (0.4 nozzle).json @@ -27,6 +27,7 @@ "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.6", "support_threshold_angle": "40", "wall_loops": "2", @@ -41,5 +42,6 @@ "support_speed": "100", "overhang_1_4_speed": "55", "overhang_2_4_speed": "30", - "overhang_3_4_speed": "10" + "overhang_3_4_speed": "10", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker Artisan (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker Artisan (0.4 nozzle).json index e89e5148ee..560bf770d8 100644 --- a/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker Artisan (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker Artisan (0.4 nozzle).json @@ -12,8 +12,10 @@ "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.6", "support_threshold_angle": "40", "wall_loops": "2", - "initial_layer_infill_speed": "65" + "initial_layer_infill_speed": "65", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker J1 (0.4 nozzle).json b/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker J1 (0.4 nozzle).json index b472f8b73c..6ed0a6d391 100644 --- a/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker J1 (0.4 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.28 Extra Draft @Snapmaker J1 (0.4 nozzle).json @@ -12,8 +12,10 @@ "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.6", "support_threshold_angle": "40", "wall_loops": "2", - "initial_layer_infill_speed": "65" + "initial_layer_infill_speed": "65", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker (0.6 nozzle).json index 71ca1a7364..da67937cfc 100644 --- a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker (0.6 nozzle).json @@ -25,6 +25,7 @@ ], "layer_height": "0.3", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -46,5 +47,6 @@ "overhang_2_4_speed": "50", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker Artisan (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker Artisan (0.6 nozzle).json index 740b764a6b..f79be0d7ab 100644 --- a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker Artisan (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker Artisan (0.6 nozzle).json @@ -10,6 +10,7 @@ ], "layer_height": "0.3", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -21,5 +22,6 @@ "top_surface_line_width": "0.62", "wall_loops": "2", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker J1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker J1 (0.6 nozzle).json index 82e876cd59..539fbdf7c8 100644 --- a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker J1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker J1 (0.6 nozzle).json @@ -10,6 +10,7 @@ ], "layer_height": "0.3", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -21,5 +22,6 @@ "top_surface_line_width": "0.62", "wall_loops": "2", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker U1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker U1 (0.6 nozzle).json index 4cc91537ee..f7c8c5b87b 100644 --- a/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker U1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Standard @Snapmaker U1 (0.6 nozzle).json @@ -104,5 +104,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker (0.6 nozzle).json index 69c56f442d..091680c54b 100644 --- a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker (0.6 nozzle).json @@ -25,6 +25,7 @@ ], "layer_height": "0.3", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -47,5 +48,6 @@ "overhang_2_4_speed": "50", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker Artisan (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker Artisan (0.6 nozzle).json index 6cd6ab07e6..37fc0c9b1e 100644 --- a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker Artisan (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker Artisan (0.6 nozzle).json @@ -10,6 +10,7 @@ ], "layer_height": "0.3", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -22,5 +23,6 @@ "wall_loops": "5", "sparse_infill_density": "25%", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker J1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker J1 (0.6 nozzle).json index 27945ce986..d1f9f9b101 100644 --- a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker J1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker J1 (0.6 nozzle).json @@ -10,6 +10,7 @@ ], "layer_height": "0.3", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -22,5 +23,6 @@ "wall_loops": "5", "sparse_infill_density": "25%", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker U1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker U1 (0.6 nozzle).json index fe96840a26..6e2f19423d 100644 --- a/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker U1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.30 Strength @Snapmaker U1 (0.6 nozzle).json @@ -106,5 +106,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker (0.8 nozzle).json index ce2b7b3f83..12edce9985 100644 --- a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker (0.8 nozzle).json @@ -26,6 +26,7 @@ "layer_height": "0.32", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -48,5 +49,6 @@ "overhang_4_4_speed": "5", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker Artisan (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker Artisan (0.8 nozzle).json index b599d87fc9..236b357fd6 100644 --- a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker Artisan (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker Artisan (0.8 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.32", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker J1 (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker J1 (0.8 nozzle).json index 986296cbd6..771fafa9c3 100644 --- a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker J1 (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker J1 (0.8 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.32", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker U1 (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker U1 (0.8 nozzle).json index 4804264bba..acfa080b98 100644 --- a/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker U1 (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.32 Standard @Snapmaker U1 (0.8 nozzle).json @@ -107,5 +107,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker (0.6 nozzle).json index 5c4ad7a5d5..790f8be105 100644 --- a/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker (0.6 nozzle).json @@ -26,6 +26,7 @@ "layer_height": "0.34", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -47,5 +48,6 @@ "support_speed": "100", "travel_speed": "110", "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50" + "overhang_2_4_speed": "50", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker Artisan (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker Artisan (0.6 nozzle).json index 352f0b751f..ece3699a4d 100644 --- a/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker Artisan (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker Artisan (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.34", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker J1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker J1 (0.6 nozzle).json index 8686fac739..aca67c2ca1 100644 --- a/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker J1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.34 Standard @Snapmaker J1 (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.34", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker (0.8 nozzle).json index 9e9cb83680..19c77ca822 100644 --- a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker (0.8 nozzle).json @@ -26,6 +26,7 @@ "layer_height": "0.36", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -48,5 +49,6 @@ "overhang_1_4_speed": "0", "overhang_2_4_speed": "50", "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" + "overhang_4_4_speed": "5", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker Artisan (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker Artisan (0.8 nozzle).json index 4357e58d05..9f254f8006 100644 --- a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker Artisan (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker Artisan (0.8 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.36", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker J1 (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker J1 (0.8 nozzle).json index bedb42aed1..5becfb6916 100644 --- a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker J1 (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker J1 (0.8 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.36", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker U1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker U1 (0.6 nozzle).json index b8231f6dd1..e8b6f5931a 100644 --- a/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker U1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.36 Standard @Snapmaker U1 (0.6 nozzle).json @@ -105,5 +105,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker (0.6 nozzle).json index 79d8086f1a..cbe561d7a5 100644 --- a/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker (0.6 nozzle).json @@ -26,6 +26,7 @@ "layer_height": "0.38", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -46,5 +47,6 @@ "support_interface_speed": "35", "support_speed": "100", "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50" + "overhang_2_4_speed": "50", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker Artisan (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker Artisan (0.6 nozzle).json index e65f9dd631..422d997295 100644 --- a/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker Artisan (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker Artisan (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.38", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker J1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker J1 (0.6 nozzle).json index 198a83b1fd..a5f683f629 100644 --- a/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker J1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.38 Standard @Snapmaker J1 (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.38", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker (0.8 nozzle).json index 05205f3a8e..d67e80cf53 100644 --- a/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker (0.8 nozzle).json @@ -25,6 +25,7 @@ ], "layer_height": "0.4", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -48,5 +49,6 @@ "overhang_4_4_speed": "5", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker Artisan (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker Artisan (0.8 nozzle).json index d90fa0aaad..0d7655407a 100644 --- a/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker Artisan (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker Artisan (0.8 nozzle).json @@ -10,6 +10,7 @@ ], "layer_height": "0.4", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "top_surface_line_width": "0.82", "wall_loops": "2", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker J1 (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker J1 (0.8 nozzle).json index cb3557bc22..6fd267e41c 100644 --- a/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker J1 (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.40 Standard @Snapmaker J1 (0.8 nozzle).json @@ -10,6 +10,7 @@ ], "layer_height": "0.4", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,5 +22,6 @@ "top_surface_line_width": "0.82", "wall_loops": "2", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker (0.6 nozzle).json index 64c0394ee6..ea5c6b965d 100644 --- a/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker (0.6 nozzle).json @@ -26,6 +26,7 @@ "layer_height": "0.42", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -46,5 +47,6 @@ "overhang_2_4_speed": "50", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker Artisan (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker Artisan (0.6 nozzle).json index 372be18eb8..f76579de23 100644 --- a/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker Artisan (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker Artisan (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.42", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -21,5 +22,6 @@ "support_line_width": "0.62", "top_surface_line_width": "0.62", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker J1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker J1 (0.6 nozzle).json index 4b8949cc9e..482aba7afe 100644 --- a/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker J1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.42 Draft @Snapmaker J1 (0.6 nozzle).json @@ -11,6 +11,7 @@ "layer_height": "0.42", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -21,5 +22,6 @@ "support_line_width": "0.62", "top_surface_line_width": "0.62", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.42 Standard @Snapmaker U1 (0.6 nozzle).json b/resources/profiles/Snapmaker/process/0.42 Standard @Snapmaker U1 (0.6 nozzle).json index 3c6d1e38f5..2617a330ef 100644 --- a/resources/profiles/Snapmaker/process/0.42 Standard @Snapmaker U1 (0.6 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.42 Standard @Snapmaker U1 (0.6 nozzle).json @@ -105,5 +105,6 @@ "500", "120", "500" - ] + ], + "top_color_penetration_layers": "4" } diff --git a/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker (0.8 nozzle).json index 9407cacd15..1ab3010d2a 100644 --- a/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker (0.8 nozzle).json @@ -27,6 +27,7 @@ "initial_layer_print_height": "0.4", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -49,5 +50,6 @@ "overhang_4_4_speed": "5", "ironing_speed": "30", "support_interface_speed": "35", - "support_speed": "100" + "support_speed": "100", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker Artisan (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker Artisan (0.8 nozzle).json index 55a73e7e6c..1e7c5c5f93 100644 --- a/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker Artisan (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker Artisan (0.8 nozzle).json @@ -12,6 +12,7 @@ "initial_layer_print_height": "0.4", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -22,5 +23,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker J1 (0.8 nozzle).json b/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker J1 (0.8 nozzle).json index 7eb2426f70..0d4c86bf24 100644 --- a/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker J1 (0.8 nozzle).json +++ b/resources/profiles/Snapmaker/process/0.48 Draft @Snapmaker J1 (0.8 nozzle).json @@ -12,6 +12,7 @@ "initial_layer_print_height": "0.4", "wall_loops": "2", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "bridge_speed": "30", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -22,5 +23,6 @@ "support_line_width": "0.82", "top_surface_line_width": "0.82", "initial_layer_infill_speed": "55", - "initial_layer_speed": "40" + "initial_layer_speed": "40", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1.json b/resources/profiles/Snapmaker/process/fdm_process_U1.json index 4e0d7bf6e6..dde062b62f 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1.json @@ -65,5 +65,7 @@ "prime_tower_width": "60", "xy_hole_compensation": "0", "xy_contour_compensation": "0", - "compatible_printers": [] + "compatible_printers": [], + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.06_nozzle_0.2.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.06_nozzle_0.2.json index 240fd4f425..3ed77c4829 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.06_nozzle_0.2.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.06_nozzle_0.2.json @@ -8,7 +8,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.08.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.08.json index d3a81f35f4..414a60b000 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.08.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.08.json @@ -7,7 +7,9 @@ "layer_height": "0.08", "elefant_foot_compensation": "0.15", "bottom_shell_layers": "7", + "bottom_color_penetration_layers": "3", "top_shell_layers": "9", + "top_color_penetration_layers": "5", "bridge_flow": "1", "ironing_flow": "8%", "initial_layer_speed": "50", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.08_nozzle_0.2.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.08_nozzle_0.2.json index 41a824fa3a..521555211e 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.08_nozzle_0.2.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.08_nozzle_0.2.json @@ -8,7 +8,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.10_nozzle_0.2.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.10_nozzle_0.2.json index 5ca58d7bd1..316d46e6f0 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.10_nozzle_0.2.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.10_nozzle_0.2.json @@ -8,7 +8,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.12.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.12.json index 117198bfbe..0ecde2d1aa 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.12.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.12.json @@ -6,8 +6,10 @@ "instantiation": "false", "layer_height": "0.12", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "elefant_foot_compensation": "0.15", "top_shell_layers": "5", + "top_color_penetration_layers": "5", "top_shell_thickness": "0.6", "bridge_flow": "1", "initial_layer_speed": "50", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.12_nozzle_0.2.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.12_nozzle_0.2.json index 8c70dd9dee..79b929ec24 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.12_nozzle_0.2.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.12_nozzle_0.2.json @@ -8,7 +8,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.14_nozzle_0.2.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.14_nozzle_0.2.json index 1ac42c9ffa..c9aaa108d4 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.14_nozzle_0.2.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.14_nozzle_0.2.json @@ -8,7 +8,9 @@ "initial_layer_print_height": "0.1", "wall_loops": "4", "bottom_shell_layers": "5", + "bottom_color_penetration_layers": "3", "top_shell_layers": "7", + "top_color_penetration_layers": "5", "bridge_flow": "1", "line_width": "0.22", "outer_wall_line_width": "0.22", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.16.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.16.json index a93ca21a57..038823aaca 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.16.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.16.json @@ -7,7 +7,9 @@ "layer_height": "0.16", "elefant_foot_compensation": "0.15", "bottom_shell_layers": "4", + "bottom_color_penetration_layers": "3", "top_shell_layers": "6", + "top_color_penetration_layers": "5", "top_shell_thickness": "1.0", "bridge_flow": "1", "initial_layer_speed": "50", diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.18_nozzle_0.6.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.18_nozzle_0.6.json index f4725a73c7..9ddf4fa333 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.18_nozzle_0.6.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.18_nozzle_0.6.json @@ -22,5 +22,7 @@ "bridge_speed": "30", "overhang_3_4_speed": "15", "support_top_z_distance": "0.18", - "support_bottom_z_distance": "0.18" + "support_bottom_z_distance": "0.18", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.20.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.20.json index 34a8212b3f..f7f85a53b6 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.20.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.20.json @@ -14,5 +14,7 @@ "sparse_infill_speed": "270", "internal_solid_infill_speed": "250", "gap_infill_speed": "250", - "top_shell_layers": "5" + "top_shell_layers": "5", + "top_color_penetration_layers": "5", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.24.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.24.json index 03c817db34..ccbcb8ebd2 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.24.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.24.json @@ -17,5 +17,7 @@ "internal_solid_infill_speed": "230", "gap_infill_speed": "230", "support_threshold_angle": "35", - "top_shell_layers": "4" + "top_shell_layers": "4", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.6.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.6.json index a014a375b3..43dc7830c2 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.6.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.6.json @@ -20,5 +20,7 @@ "sparse_infill_speed": "100", "top_surface_speed": "150", "bridge_speed": "30", - "overhang_3_4_speed": "15" + "overhang_3_4_speed": "15", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.8.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.8.json index e958e9a2ee..f6787070a9 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.8.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.24_nozzle_0.8.json @@ -22,5 +22,7 @@ "top_surface_speed": "150", "bridge_speed": "30", "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" + "overhang_4_4_speed": "5", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.28.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.28.json index acd52db1be..8058c779cc 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.28.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.28.json @@ -17,5 +17,7 @@ "internal_solid_infill_speed": "200", "gap_infill_speed": "200", "support_threshold_angle": "40", - "top_shell_layers": "4" + "top_shell_layers": "4", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.30_nozzle_0.6.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.30_nozzle_0.6.json index a44a9ca05a..c5aea43483 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.30_nozzle_0.6.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.30_nozzle_0.6.json @@ -20,5 +20,7 @@ "sparse_infill_speed": "100", "top_surface_speed": "150", "bridge_speed": "30", - "overhang_3_4_speed": "15" + "overhang_3_4_speed": "15", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.32_nozzle_0.8.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.32_nozzle_0.8.json index 67d9ecdb62..c3e843e98c 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.32_nozzle_0.8.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.32_nozzle_0.8.json @@ -22,5 +22,7 @@ "top_surface_speed": "150", "bridge_speed": "30", "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" + "overhang_4_4_speed": "5", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.36_nozzle_0.6.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.36_nozzle_0.6.json index 314965b603..2b7688f659 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.36_nozzle_0.6.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.36_nozzle_0.6.json @@ -20,5 +20,7 @@ "sparse_infill_speed": "100", "top_surface_speed": "150", "bridge_speed": "30", - "overhang_3_4_speed": "15" + "overhang_3_4_speed": "15", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.40_nozzle_0.8.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.40_nozzle_0.8.json index ec19b56fa5..8dcad4e2e6 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.40_nozzle_0.8.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.40_nozzle_0.8.json @@ -22,5 +22,7 @@ "top_surface_speed": "150", "bridge_speed": "30", "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" + "overhang_4_4_speed": "5", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.42_nozzle_0.6.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.42_nozzle_0.6.json index 18c1e7d79b..1836edeb73 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.42_nozzle_0.6.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.42_nozzle_0.6.json @@ -20,5 +20,7 @@ "sparse_infill_speed": "100", "top_surface_speed": "150", "bridge_speed": "30", - "overhang_3_4_speed": "15" + "overhang_3_4_speed": "15", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.48_nozzle_0.8.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.48_nozzle_0.8.json index 8d5632b790..c5bf5c6457 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.48_nozzle_0.8.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.48_nozzle_0.8.json @@ -22,5 +22,7 @@ "top_surface_speed": "150", "bridge_speed": "30", "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" + "overhang_4_4_speed": "5", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_0.56_nozzle_0.8.json b/resources/profiles/Snapmaker/process/fdm_process_U1_0.56_nozzle_0.8.json index 7a5c92932d..16e949c0e4 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_0.56_nozzle_0.8.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_0.56_nozzle_0.8.json @@ -22,5 +22,7 @@ "top_surface_speed": "150", "bridge_speed": "30", "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" + "overhang_4_4_speed": "5", + "top_color_penetration_layers": "3", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_U1_common.json b/resources/profiles/Snapmaker/process/fdm_process_U1_common.json index 3fbacd5f4f..e0270d1989 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_U1_common.json +++ b/resources/profiles/Snapmaker/process/fdm_process_U1_common.json @@ -7,6 +7,7 @@ "max_travel_detour_distance": "0", "bottom_surface_pattern": "monotonic", "bottom_shell_layers": "3", + "bottom_color_penetration_layers": "3", "bottom_shell_thickness": "0", "bridge_speed": "50", "brim_object_gap": "0.1", @@ -62,6 +63,7 @@ "top_surface_acceleration": "2000", "top_surface_speed": "200", "top_shell_layers": "3", + "top_color_penetration_layers": "3", "top_shell_thickness": "0.8", "travel_speed": "500", "enable_prime_tower": "1", diff --git a/resources/profiles/Snapmaker/process/fdm_process_a400.json b/resources/profiles/Snapmaker/process/fdm_process_a400.json index f8ca481f9f..8e6ea65ee0 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_a400.json +++ b/resources/profiles/Snapmaker/process/fdm_process_a400.json @@ -32,5 +32,7 @@ "support_interface_top_layers": "3", "support_interface_pattern": "rectilinear", "small_perimeter_threshold": "0", - "support_material_synchronize_layers": "1" + "support_material_synchronize_layers": "1", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/Snapmaker/process/fdm_process_common.json b/resources/profiles/Snapmaker/process/fdm_process_common.json index 13e5825ebd..86c3ded508 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_common.json +++ b/resources/profiles/Snapmaker/process/fdm_process_common.json @@ -57,9 +57,11 @@ "detect_thin_wall": "0", "top_surface_pattern": "monotonic", "top_shell_layers": "4", + "top_color_penetration_layers": "4", "top_shell_thickness": "0.8", "bottom_surface_pattern": "monotonic", "bottom_shell_layers": "3", + "bottom_color_penetration_layers": "3", "bottom_shell_thickness": "0", "sparse_infill_density": "15%", "sparse_infill_pattern": "cubic", diff --git a/resources/profiles/Snapmaker/process/fdm_process_idex.json b/resources/profiles/Snapmaker/process/fdm_process_idex.json index 6aeabfdaa7..5e30212c97 100644 --- a/resources/profiles/Snapmaker/process/fdm_process_idex.json +++ b/resources/profiles/Snapmaker/process/fdm_process_idex.json @@ -38,5 +38,7 @@ "preheat_time": "90", "filename_format": "{input_filename_base}_{layer_height}mm_{print_time}_J1.gcode", "small_perimeter_threshold": "0", - "support_material_synchronize_layers": "1" + "support_material_synchronize_layers": "1", + "top_color_penetration_layers": "4", + "bottom_color_penetration_layers": "3" } diff --git a/resources/profiles/re3D.json b/resources/profiles/re3D.json index 1a9e2ec591..21fb3db3b8 100644 --- a/resources/profiles/re3D.json +++ b/resources/profiles/re3D.json @@ -1,7 +1,7 @@ { "name": "re3D", "url": "", - "version": "03.00.12", + "version": "03.00.13", "force_update": "0", "description": "re3D configurations", "machine_model_list": [ diff --git a/resources/profiles/re3D/process/fgf_process_re3D_common.json b/resources/profiles/re3D/process/fgf_process_re3D_common.json index 902366c830..eaa6bc14fb 100644 --- a/resources/profiles/re3D/process/fgf_process_re3D_common.json +++ b/resources/profiles/re3D/process/fgf_process_re3D_common.json @@ -46,7 +46,7 @@ "print_settings_id": "fgf_process_re3D_common", "raft_layers": "0", "seam_position": "aligned", - "seam_gap": "10", + "seam_gap": "10%", "staggered_inner_seams": "1", "skirt_distance": "10", "skirt_height": "1", diff --git a/resources/shaders/140/gouraud.fs b/resources/shaders/140/gouraud.fs index f609495597..0c9011d634 100644 --- a/resources/shaders/140/gouraud.fs +++ b/resources/shaders/140/gouraud.fs @@ -40,6 +40,10 @@ uniform SlopeDetection slope; //BBS: add outline_color uniform bool is_outline; +// ORCA: a part of a translucent filament, drawn as its print would show in premultiplied color, see +// GLVolumeCollection::render(). It catches a highlight only with translucent_gloss, in realistic view. +uniform bool translucent_filament; +uniform bool translucent_gloss; // The outline is a per-fragment discard mask, which the framebuffer MSAA cannot smooth, so the // silhouette is resolved per sample from a multisample copy of the outlined model's depth buffer. #ifdef GL_ARB_texture_multisample @@ -224,6 +228,14 @@ float shadow_shade() return 1.0 - shadow_intensity * (sum / 25.0); } +// ORCA: the view ray crosses two shells of the part, the front and the back one, of two 0.45 mm walls each, +// longer at grazing angles, and the opacity of the filament is that of 0.4 mm of it, as in the G-code preview. +vec4 translucent_filament_color(vec3 diffuse, float alpha, vec3 highlight, float cos_view) +{ + float a = 1.0 - pow(1.0 - alpha, 2.0 * 0.9 / 0.4 / max(cos_view, 0.25)); + return vec4(diffuse * a + highlight, a); +} + out vec4 out_color; void main() @@ -285,11 +297,16 @@ void main() if (s < 0.01) discard; out_color = vec4(mix(color.rgb, getBackfaceColor(color.rgb), s), color.a); + if (translucent_filament) + out_color.rgb *= out_color.a; } #ifdef ENABLE_ENVIRONMENT_MAP else if (use_environment_tex) out_color = vec4((0.45 * texture(environment_tex, normalize(eye_normal).xy * 0.5 + 0.5).xyz + 0.8 * color.rgb * intensity.x) * shade, color.a); #endif + else if (translucent_filament) + out_color = translucent_filament_color(color.rgb * intensity.x * shade, color.a, + translucent_gloss ? vec3(intensity.y * shade) : ZERO, abs(normalize(eye_normal).z)); else out_color = vec4((vec3(intensity.y) + color.rgb * intensity.x) * shade, color.a); } \ No newline at end of file diff --git a/resources/shaders/140/phong.fs b/resources/shaders/140/phong.fs index 4cfae1e03e..c0cbc1c144 100644 --- a/resources/shaders/140/phong.fs +++ b/resources/shaders/140/phong.fs @@ -55,6 +55,10 @@ uniform SlopeDetection slope; //BBS: add outline_color uniform bool is_outline; +// ORCA: a part of a translucent filament, drawn as its print would show in premultiplied color, see +// GLVolumeCollection::render(). It catches a highlight only with translucent_gloss, in realistic view. +uniform bool translucent_filament; +uniform bool translucent_gloss; // The outline is a per-fragment discard mask, which the framebuffer MSAA cannot smooth, so the // silhouette is resolved per sample from a multisample copy of the outlined model's depth buffer. #ifdef GL_ARB_texture_multisample @@ -98,6 +102,14 @@ in float world_normal_z; in vec3 eye_normal; in vec3 eye_position; +// ORCA: the view ray crosses two shells of the part, the front and the back one, of two 0.45 mm walls each, +// longer at grazing angles, and the opacity of the filament is that of 0.4 mm of it, as in the G-code preview. +vec4 translucent_filament_color(vec3 diffuse, float alpha, vec3 highlight, float cos_view) +{ + float a = 1.0 - pow(1.0 - alpha, 2.0 * 0.9 / 0.4 / max(cos_view, 0.25)); + return vec4(diffuse * a + highlight, a); +} + out vec4 out_color; vec3 getBackfaceColor(vec3 fill) { @@ -359,11 +371,17 @@ void main() if (s < 0.01) discard; out_color = vec4(mix(shaded_color.rgb, getBackfaceColor(shaded_color.rgb), s), shaded_color.a); + if (translucent_filament) + out_color.rgb *= out_color.a; } #ifdef ENABLE_ENVIRONMENT_MAP else if (use_environment_tex) out_color = vec4(clamp((0.45 * texture(environment_tex, normalize(eye_normal).xy * 0.5 + 0.5).xyz + window_reflection + 0.8 * color.rgb * diffuse) * PHONG_BRIGHTNESS * shade, vec3(0.0), vec3(1.0)), color.a); #endif + else if (translucent_filament) + out_color = translucent_filament_color(clamp(color.rgb * diffuse * PHONG_BRIGHTNESS * shade, vec3(0.0), vec3(1.0)), color.a, + translucent_gloss ? (vec3(specular) + window_reflection) * PHONG_BRIGHTNESS * shade : ZERO, + abs(dot(normal, view_dir))); else out_color = vec4(clamp(lit * shade, vec3(0.0), vec3(1.0)), color.a); } \ No newline at end of file diff --git a/resources/web/dialog/ColorPickerDialog/palettes.js b/resources/web/dialog/ColorPickerDialog/palettes.js index 4f65f101db..5c17ad5402 100644 --- a/resources/web/dialog/ColorPickerDialog/palettes.js +++ b/resources/web/dialog/ColorPickerDialog/palettes.js @@ -109,7 +109,7 @@ const cssColors = [ {hex: "#800080", name: "Purple"}, {hex: "#663399", name: "Rebecca purple"}, {hex: "#C71585", name: "Medium violet red"}, - {hex: "#DB7093", name: "PaleV violet red"}, + {hex: "#DB7093", name: "Pale violet red"}, {hex: "#FF1493", name: "Deep pink"}, {hex: "#FF69B4", name: "Hot pink"}, {hex: "#FFB6C1", name: "Light pink"}, @@ -193,7 +193,7 @@ const palettes = { {hex: "#40E0D0", name: "Turquoise bay"}, {hex: "#2EBDEF", name: "Sky over reef"}, {hex: "#87CEEB", name: "Shallow sky"}, - {hex: "#1E90FF", name: "Electric bel"}, + {hex: "#1E90FF", name: "Electric blue"}, {hex: "#4169E1", name: "Dolphin"}, {hex: "#0000CD", name: "Ocean depths"}, {hex: "#191970", name: "Whale"}, @@ -219,7 +219,7 @@ const palettes = { {hex: "#EFBF04", name: "1004 Golden yellow"}, {hex: "#D7A500", name: "1005 Honey yellow"}, {hex: "#F2D185", name: "1006 Maize yellow"}, - {hex: "#FDD185", name: "1007 Dalmatian yellow"}, + {hex: "#FDD185", name: "1007 Daffodil yellow"}, {hex: "#8B7D6B", name: "1011 Brown beige"}, {hex: "#F5DB50", name: "1012 Lemon yellow"}, {hex: "#F3E5AB", name: "1013 Oyster white"}, @@ -318,7 +318,7 @@ const palettes = { {hex: "#0384A7", name: "5015 Sky blue"}, {hex: "#006A9E", name: "5017 Traffic blue"}, {hex: "#005F87", name: "5018 Turquoise blue"}, - {hex: "#5A3D5B", name: "5019 Capsanthin violet"}, + {hex: "#1B5583", name: "5019 Capri blue"}, {hex: "#04749F", name: "5020 Ocean blue"}, {hex: "#009AAA", name: "5021 Water blue"}, {hex: "#1A3D5F", name: "5022 Night blue"}, @@ -366,7 +366,7 @@ const palettes = { {hex: "#00A550", name: "6039 Mint green"}, {hex: "#7D7D7D", name: "7000 Squirrel grey"}, {hex: "#A8A9AD", name: "7001 Silver grey"}, - {hex: "#6F7368", name: "7002 Olivestone"}, + {hex: "#6F7368", name: "7002 Olive grey"}, {hex: "#8F9080", name: "7003 Moss grey"}, {hex: "#8E9291", name: "7004 Signal grey"}, {hex: "#8B8788", name: "7005 Mouse grey"}, diff --git a/sandboxes/orca_preset_transaction_demo.py b/sandboxes/orca_preset_transaction_demo.py new file mode 100644 index 0000000000..5cdfd80197 --- /dev/null +++ b/sandboxes/orca_preset_transaction_demo.py @@ -0,0 +1,99 @@ +# /// script +# requires-python = ">=3.12" +# +# [tool.orcaslicer.plugin] +# id = "preset-transaction-demo" +# name = "Preset Transaction Demo" +# description = "Stages several settings on one preset with begin_update()/set()/commit() (demo)." +# author = "OrcaSlicer contributors" +# version = "0.2.0" +# type = "script" +# /// +"""Preset transaction demo: change several settings with one commit. + +Enable the plugin, then run "Preset Transaction Demo" from the Plugins dialog. +Edit CATEGORY, PRESET_NAME, FILAMENT_SLOT and UPDATES below to try other presets +and settings. + +``begin_update()`` resolves the target through Orca's normal preset-selection +flow, so it may open Orca's usual "unsaved changes" dialog. The call is +synchronous: the background Script worker waits until the user answers, while +the UI thread stays responsive. ``set()`` only stages values; ``commit()`` +validates and applies the whole batch. The edited preset stays unsaved (dirty) +until the user saves it through the normal preset workflow; nothing here writes +to disk. + +Values are Orca's serialized config strings: numbers plain, percentages with +"%", booleans "1"/"0", choices by their internal key, lists ";"-separated. +""" + +import orca + +# --------------------------------------------------------------------------- +# Edit these. CATEGORY and UPDATES belong together: each presets category only +# accepts its own setting keys. +# --------------------------------------------------------------------------- + +# Preset category: "process", "printer", or "filament". +CATEGORY = "process" + +# Target preset name for process/printer. "" keeps the currently active preset. +# For filament this optionally selects and assigns the preset for FILAMENT_SLOT; +# "" keeps the preset the slot already has. +PRESET_NAME = "" + +# 1-based filament slot. Only used when CATEGORY is "filament". +FILAMENT_SLOT = 1 + +# Settings staged in order, then committed together. +UPDATES = ( + ("layer_height", "0.25"), + ("wall_loops", "3"), +) + + +def _begin_update(): + """Bind CATEGORY's target and return a transaction to stage changes on.""" + if CATEGORY not in ("process", "printer", "filament"): + raise ValueError('CATEGORY must be "process", "printer", or "filament"') + if CATEGORY == "filament": + # Filament updates are addressed by their 1-based slot number. + return orca.host.preset.filament.begin_update(FILAMENT_SLOT, PRESET_NAME) + return getattr(orca.host.preset, CATEGORY).begin_update(PRESET_NAME) + + +class PresetTransactionDemo(orca.script.ScriptPluginCapabilityBase): + def get_name(self): + return "Preset transaction demo" + + def execute(self): + # A plain def runs on the background Script worker, so begin_update() may + # block here through Orca's selection / unsaved-edit prompts. + try: + transaction = _begin_update() + for key, value in UPDATES: + transaction.set(key, value) + result = transaction.commit() + except Exception as error: + return orca.ExecutionResult.failure( + orca.PluginResult.RecoverableError, + "Preset transaction demo failed: %s" % error, + ) + + return orca.ExecutionResult.success( + 'Committed %d setting(s) to the %s preset "%s"; %s.' + % ( + len(result.keys), + result.category, + result.target_name, + "it stays unsaved until you save it" + if result.dirty + else "it already matches its saved state", + ) + ) + + +@orca.plugin +class PresetTransactionDemoPackage(orca.base): + def register_capabilities(self): + orca.register_capability(PresetTransactionDemo) diff --git a/sandboxes/orca_preset_update_demo.py b/sandboxes/orca_preset_update_demo.py new file mode 100644 index 0000000000..44c9923ec7 --- /dev/null +++ b/sandboxes/orca_preset_update_demo.py @@ -0,0 +1,188 @@ +# /// script +# requires-python = ">=3.12" +# +# [tool.orcaslicer.plugin] +# id = "preset-update-demo" +# name = "Preset Update Demo" +# description = "Browse and edit settings in process, printer, and filament presets." +# author = "OrcaSlicer contributors" +# version = "0.4.0" +# type = "script" +# /// +"""Interactive preset editor. Snapshots are read on the UI thread; edits run on execute's worker.""" + +import queue +import orca + + +PAGE = r''' +
◈

Preset editor

+
+
Selected setting

Choose a setting

Current value
—
Choose a category, preset and filament slot. Edit any listed key, then apply. Orca may ask to switch presets or resolve unsaved changes. Values stay unsaved until saved in Orca.
Loading presets…
+''' + + +class PresetUpdateDemo(orca.script.ScriptPluginCapabilityBase): + window = None + _commands = None + _cancelled = False + + def get_name(self): + return "Preset editor demo" + + def execute(self): + if self.window is not None and self.window.is_open(): + return orca.ExecutionResult.success("Preset editor is already open.") + # The queue exists before the window so on_cancelled() can always unblock this worker, even + # when a forced unload destroys the window without firing on_close. + commands = queue.Queue() + self._commands = commands + try: + if self._cancelled: + return orca.ExecutionResult.success("Preset editor closed.") + self.window = orca.host.ui.create_window( + title="Preset editor", html=PAGE, width=900, height=620, + on_message=self._on_message, + on_close=self._on_close, + ) + while True: + message = commands.get() + if self._cancelled or message.get("command") == "close": + return orca.ExecutionResult.success("Preset editor closed.") + try: + notice = {"command": "refresh", "message": self._apply(message)} + except Exception as error: + notice = {"command": "refresh", "error": str(error)} + if self.window is not None and self.window.is_open(): + self.window.post(notice) + except Exception as error: + return orca.ExecutionResult.failure(orca.PluginResult.RecoverableError, + "Preset editor failed: %s" % error) + finally: + if self._commands is commands: + self._commands = None + self.window = None + + # Both UI callbacks run on the wx main thread with the GIL held. + def _on_message(self, message): + message = dict(message) if isinstance(message, dict) else {} + if message.get("command") == "apply": + self._enqueue(message) + return + try: + state = self._snapshot(message) + except Exception as error: + state = {"command": "state", "kind": message.get("kind", "process"), + "slot": message.get("slot", 1), "rows": [], "presets": [], "slots": [], + "preset_name": "", "dirty": False, "error": str(error)} + window = self.window + if window is not None and window.is_open(): + window.post(state) + + def _on_close(self): + self._enqueue({"command": "close"}) + + def on_cancelled(self): + # Called before the unload drain. Enqueueing a close lets a worker parked in get() exit; a + # callback that arrives after the worker already left sees no queue and is harmless. + self._cancelled = True + self._enqueue({"command": "close"}) + + def _enqueue(self, message): + commands = self._commands + if commands is not None: + commands.put(message) + + def _apply(self, message): + kind = message.get("kind", "process") + if kind not in ("process", "printer", "filament"): + raise ValueError("Unknown preset category") + name = message.get("preset") or "" + if not isinstance(name, str): + raise ValueError("Preset name must be a string") + key, value = message.get("key"), message.get("value") + if not isinstance(key, str) or not key or not isinstance(value, str): + raise ValueError("Setting key and serialized value required") + editor = getattr(orca.host.preset, kind) + if kind == "filament": + slot = int(message.get("slot", 1)) + if slot < 1: + raise ValueError("Filament slot numbers are 1-based") + transaction = editor.begin_update(slot, name) + else: + transaction = editor.begin_update(name) + transaction.set(key, value) + result = transaction.commit() + status = "Set %s on %s. Changes remain unsaved." % (key, result.target_name) + if result.selection_changed: + status += " Orca switched the active preset." + if kind == "filament" and len(result.shared_slots) > 1: + status += " Shared by filament slots: %s." % ", ".join(str(s) for s in result.shared_slots) + return status + + # Read-only snapshot. Runs on the UI thread so no live Preset or PresetBundle object is read + # from the Script worker, and never calls begin_update() or another blocking preset operation. + def _snapshot(self, message): + kind = message.get("kind", "process") + if kind not in ("process", "printer", "filament"): + raise ValueError("Unknown preset category") + try: + slot = int(message.get("slot", 1)) + except (TypeError, ValueError): + slot = 1 + requested = message.get("preset") or "" + if not isinstance(requested, str): + requested = "" + bundle = orca.host.preset_bundle() + slots = [] + if kind == "filament": + assigned_names = list(bundle.current_filament_preset_names()) + presets = list(bundle.current_filament_presets()) + slots = [{"slot": index + 1, + "name": presets[index].name if presets[index] is not None + else (assigned_names[index] or None)} + for index in range(len(presets))] + if not 1 <= slot <= len(presets): + slot = 1 + preset = bundle.filaments.find_preset(requested) if requested else None + if preset is None and presets: + preset = presets[slot - 1] + available = list(bundle.filaments.preset_names()) + else: + collection = bundle.prints if kind == "process" else bundle.printers + available = list(collection.preset_names()) + preset = collection.find_preset(requested) if requested else None + if preset is None: + preset = (bundle.current_process_preset() if kind == "process" + else bundle.current_printer_preset()) + rows = [] + if preset is not None: + for key in sorted(preset.config_keys()): + value = preset.config_value(key) + rows.append({"k": key, "v": "" if value is None else str(value)}) + return {"command": "state", "kind": kind, "slot": slot, "slots": slots, + "presets": available, "preset_name": preset.name if preset is not None else "", + "dirty": bool(preset.is_dirty) if preset is not None else False, "rows": rows} + + +@orca.plugin +class PresetUpdateDemoPackage(orca.base): + def register_capabilities(self): + orca.register_capability(PresetUpdateDemo) diff --git a/scripts/build_preset_cache.bat b/scripts/build_preset_cache.bat index 82f3e02723..3529f7591e 100644 --- a/scripts/build_preset_cache.bat +++ b/scripts/build_preset_cache.bat @@ -23,7 +23,9 @@ rem goes along with its preset JSONs: the cache carries the vendor profile and rem the version it was built at, so discovery, version checks and installing all rem read it there. Only a vendor that has a cache is pruned, so non-vendor JSONs rem (blacklist.json) are left alone, as are the vendor directories themselves - -rem thumbnails, covers and bed models still live there. +rem thumbnails, covers and bed models still live there. Only the preset files +rem the vendor profile lists are deleted: data files beside them (BBL's +rem filaments_color_codes.json, cli_config.json, ...) are read at runtime. rem rem set CONFIG= to pin the build config for multi-config generators rem (default: the config of the tool already in the build tree, else Release) @@ -118,21 +120,30 @@ set /a PRUNED=0 for %%c in ("%PROFILES%\*.opc") do ( set /a SHIPPED+=1 set "VENDOR=%%~nc" + rem Prune the vendor directory first: it reads the profile's preset list, + rem and with --prune-source the profile is the target's own. + if exist "%TARGET%\!VENDOR!\" ( + call :prune_listed_presets "%PROFILES%\!VENDOR!.json" "%TARGET%\!VENDOR!" + rem Deepest first, so a directory the delete above emptied goes too; rd + rem refuses the ones still holding covers, meshes or data files. + for /f "delims=" %%d in ('dir /s /b /ad "%TARGET%\!VENDOR!" 2^>nul ^| sort /r') do rd "%%d" 2>nul + ) if exist "%TARGET%\!VENDOR!.json" ( del /q "%TARGET%\!VENDOR!.json" set /a PRUNED+=1 ) - if exist "%TARGET%\!VENDOR!\" ( - for /f %%n in ('dir /s /b "%TARGET%\!VENDOR!\*.json" 2^>nul ^| find /c /v ""') do set /a PRUNED+=%%n - del /s /q "%TARGET%\!VENDOR!\*.json" >nul 2>&1 - rem Deepest first, so a directory the delete above emptied goes too; rd - rem refuses the ones still holding covers or meshes. - for /f "delims=" %%d in ('dir /s /b /ad "%TARGET%\!VENDOR!" 2^>nul ^| sort /r') do rd "%%d" 2>nul - ) ) echo %TARGET%: !SHIPPED! caches, dropped !PRUNED! preset JSONs exit /b 0 +rem Delete the preset files a vendor profile (%1) lists from its vendor +rem directory (%2). Data files beside them (BBL's filaments_color_codes.json, +rem cli_config.json, ...) are read at runtime, so they ship. +:prune_listed_presets +if not exist "%~1" exit /b 0 +for /f %%n in ('powershell -NoProfile -ExecutionPolicy Bypass -Command "$n = 0; $p = ConvertFrom-Json (Get-Content -LiteralPath '%~1' -Raw -Encoding UTF8); foreach ($k in 'machine_model_list','process_list','filament_list','machine_list') { foreach ($e in $p.$k) { $f = Join-Path '%~2' $e.sub_path; if (Test-Path -LiteralPath $f -PathType Leaf) { Remove-Item -LiteralPath $f; $n++ } } }; $n"') do set /a PRUNED+=%%n +exit /b 0 + :find_tool set "TOOL=" for /f "delims=" %%f in ('dir /s /b /o-d "%BUILD_DIR%\generate_system_cache.exe" 2^>nul') do ( diff --git a/scripts/build_preset_cache.sh b/scripts/build_preset_cache.sh index 7a874f7e06..265534c753 100755 --- a/scripts/build_preset_cache.sh +++ b/scripts/build_preset_cache.sh @@ -20,7 +20,9 @@ # and nothing else. Only a vendor that has a cache is pruned, so an ungenerated # vendor keeps its JSONs and is simply parsed at startup; non-vendor JSONs # (blacklist.json) are left alone, as are the vendor directories themselves — -# thumbnails, covers and bed models still live there. +# thumbnails, covers and bed models still live there. Only the preset files the +# vendor profile lists are deleted: data files beside them (BBL's +# filaments_color_codes.json, cli_config.json, ...) are read at runtime. # # -b build tree holding the tool # (default: build/arm64, build/x86_64, or build — first that exists) @@ -87,6 +89,20 @@ find_tool() { printf '%s' "$best" } +# The preset files a vendor profile lists, relative to its vendor directory, one +# per line. Nothing when the profile is missing. +listed_presets() { + [ -f "$1" ] || return 0 + python3 - "$1" <<'EOF' +import json, sys +with open(sys.argv[1], encoding="utf-8") as f: + profile = json.load(f) +for key in ("machine_model_list", "process_list", "filament_list", "machine_list"): + for entry in profile.get(key, []): + print(entry["sub_path"]) +EOF +} + tool=$(find_tool) if [ -z "$config" ]; then case "$tool" in @@ -147,15 +163,21 @@ for target in "$@"; do for cache in "$profiles_dir"/*.opc; do vendor=$(basename "$cache" .opc) shipped=$(( shipped + 1 )) + # Read the list before the profile goes: with --prune-source it is the + # same file as the target's. + listed=$(listed_presets "$profiles_dir/$vendor.json") if [ -f "$resolved/$vendor.json" ]; then rm -f "$resolved/$vendor.json" pruned=$(( pruned + 1 )) fi [ -d "$resolved/$vendor" ] || continue - n=$(find "$resolved/$vendor" -name '*.json' | wc -l) - find "$resolved/$vendor" -name '*.json' -delete + while IFS= read -r sub_path; do + if [ -n "$sub_path" ] && [ -f "$resolved/$vendor/$sub_path" ]; then + rm -f "$resolved/$vendor/$sub_path" + pruned=$(( pruned + 1 )) + fi + done <<< "$listed" find "$resolved/$vendor" -type d -empty -delete - pruned=$(( pruned + n )) done echo "$resolved: $shipped caches, dropped $pruned preset JSONs" done diff --git a/scripts/check_exception_throw_info.ps1 b/scripts/check_exception_throw_info.ps1 new file mode 100644 index 0000000000..5fd76599b8 --- /dev/null +++ b/scripts/check_exception_throw_info.ps1 @@ -0,0 +1,126 @@ +<# +.SYNOPSIS + Fails when a Windows build has an exception class with broken throw info. + +.DESCRIPTION + Clang on the MSVC ABI can leave the copy constructor out of the CatchableType it emits for + an exception class that comes through a precompiled header + (https://github.com/llvm/llvm-project/issues/53486). The linker keeps one throw info per + class, so when it keeps such a record, a copy of that exception (std::exception_ptr, a catch + by value) shares its data with the original and the data is freed twice. + + A class is either trivially copyable or not, so a binary should never have both a CatchableType + without a copy constructor (_CT??_R0?AV@@@8) and one with it + (_CT??_R0?AV@@@8??0...). The script lists each PDB's public symbols with the + llvm-pdbutil next to the build's compiler and reports every class that has both. + + scripts\test_check_exception_throw_info.ps1 tests it. + +.PARAMETER BuildDir + The slicer build directory. Its CMakeCache.txt names the compiler, and its src\ + holds the PDBs to check, which must include OrcaSlicer.pdb. + +.PARAMETER Config + The configuration whose PDBs to check (default: Release). + +.PARAMETER Pdb + PDBs to check instead of the ones in \src\, as a list or comma-separated. + +.PARAMETER Dump + Saved `llvm-pdbutil dump --publics` output to check instead of PDBs. Needs no build. + +.EXAMPLE + scripts\check_exception_throw_info.ps1 -BuildDir build +#> +param( + [string] $BuildDir, + [string] $Config = 'Release', + [string[]] $Pdb, + [string[]] $Dump +) +$ErrorActionPreference = 'Stop' + +# powershell -File passes "a.pdb,b.pdb" as one string. A path that exists as given stays whole. +function Split-PathList([string[]] $values) { + @($values | Where-Object { $_ } | ForEach-Object { + if ((Test-Path -LiteralPath $_) -or $_ -notmatch ',') { $_ } else { $_ -split ',' | Where-Object { $_ } } + }) +} + +$Dump = Split-PathList $Dump +if (-not $Dump) { + if (-not $BuildDir) { + throw 'Name the slicer build directory with -BuildDir.' + } + $cache = Join-Path $BuildDir 'CMakeCache.txt' + if (-not (Test-Path $cache)) { + throw "No CMakeCache.txt in $BuildDir. Name the slicer build directory." + } + $entry = Select-String -Path $cache -Pattern '^CMAKE_CXX_COMPILER:\w+=(.+)$' | Select-Object -First 1 + if (-not $entry) { + throw "No CMAKE_CXX_COMPILER in $cache." + } + $compiler = $entry.Matches[0].Groups[1].Value + # A tree configured with a bare compiler name found it on PATH. + if (-not (Split-Path $compiler)) { + $found = Get-Command $compiler -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1 + if (-not $found) { + throw "$compiler, the compiler in $cache, is not on PATH." + } + $compiler = $found.Source + } + $pdbutil = Join-Path (Split-Path $compiler) 'llvm-pdbutil.exe' + if (-not (Test-Path $pdbutil)) { + throw "No llvm-pdbutil.exe next to $compiler. This check needs a build made with Clang." + } + + $Pdb = Split-PathList $Pdb + if (-not $Pdb) { + # OrcaSlicer.dll holds the slicer itself, so a check without it proves nothing. + $pdbDir = Join-Path $BuildDir "src\$Config" + if (-not (Test-Path (Join-Path $pdbDir 'OrcaSlicer.pdb'))) { + throw "No OrcaSlicer.pdb in $pdbDir." + } + $Pdb = @(Get-ChildItem $pdbDir -Filter *.pdb | ForEach-Object FullName) + } +} + +$catchable = [regex]'`_CT\?\?_R0\?A[UV](.+?)@@@8([^`]*)`' +$tmp = [IO.Path]::GetTempFileName() +$failed = $false +$classes = 0 +try { + foreach ($file in $(if ($Dump) { $Dump } else { $Pdb })) { + $text = $file + if (-not $Dump) { + $run = Start-Process -FilePath $pdbutil -ArgumentList 'dump', '--publics', "`"$file`"" -NoNewWindow -Wait -PassThru -RedirectStandardOutput $tmp + if ($run.ExitCode -ne 0) { + throw "llvm-pdbutil failed on $file." + } + $text = $tmp + } + + $kinds = @{} + foreach ($match in $catchable.Matches([IO.File]::ReadAllText((Resolve-Path -LiteralPath $text).Path))) { + $class = $match.Groups[1].Value + if (-not $kinds.ContainsKey($class)) { $kinds[$class] = @{} } + $kinds[$class][$(if ($match.Groups[2].Value.StartsWith('??0')) { 'copy' } else { 'bitwise' })] = $true + } + + $broken = @($kinds.Keys | Where-Object { $kinds[$_].Count -eq 2 } | Sort-Object) + "$(Split-Path -Leaf $file): $($kinds.Count) exception classes, $($broken.Count) with broken throw info" + foreach ($class in $broken) { " $class" } + if ($broken.Count -gt 0) { $failed = $true } + $classes += $kinds.Count + } +} finally { + Remove-Item $tmp -ErrorAction SilentlyContinue +} + +# The slicer's PDBs always contain exception throw info, so finding none means the dump format or the PDBs changed. +if ($classes -eq 0) { + 'No exception classes found. Check that llvm-pdbutil still prints public symbols in backticks.' + $failed = $true +} + +exit [int]$failed diff --git a/scripts/create_dmg.sh b/scripts/create_dmg.sh new file mode 100644 index 0000000000..81804b7542 --- /dev/null +++ b/scripts/create_dmg.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Sourceable helper: `create_dmg ` builds a +# compressed DMG, retrying via `retry` (source retry.sh first). +# hdiutil sizes the image from -srcfolder itself and sometimes leaves too +# little room, failing with "No space left on device" on every attempt. An +# explicit -size of the source plus 20% and 50 MB avoids that; the free space +# compresses away in UDZO. +create_dmg() { + local volname="$1" srcfolder="$2" output="$3" + local src_mb + src_mb=$(( $(du -sk "$srcfolder" | cut -f1) / 1024 )) + retry hdiutil create -volname "$volname" -srcfolder "$srcfolder" \ + -size "$(( src_mb + src_mb / 5 + 50 ))m" -ov -format UDZO "$output" +} diff --git a/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml b/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml index cca417f735..27c9fcfdc2 100644 --- a/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml +++ b/scripts/flatpak/com.orcaslicer.OrcaSlicer.yml @@ -226,10 +226,10 @@ modules: sha256: f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81 dest: external-packages/OpenVDB - # GMP 6.2.1 + # GMP 6.3.0 - type: file - url: https://github.com/SoftFever/OrcaSlicer_deps/releases/download/gmp-6.2.1/gmp-6.2.1.tar.bz2 - sha256: eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c + url: https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz + sha256: a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898 dest: external-packages/GMP # MPFR 4.2.2 diff --git a/scripts/flatpak/entrypoint b/scripts/flatpak/entrypoint index 7137c3798d..172b66c1f0 100644 --- a/scripts/flatpak/entrypoint +++ b/scripts/flatpak/entrypoint @@ -8,4 +8,38 @@ # while preserving the user's language/locale for translations. export LC_NUMERIC=C +# The runtime only has the locales of the languages Flatpak installs for it +# (flatpak config languages / extra-languages), while the session can name +# others, e.g. per-category regional formats. OrcaSlicer cannot start when any +# category names a missing locale, so drop just the variables that do: a +# category then follows LANG, and LANG falls back to C.UTF-8. An environment +# whose locales all exist is left as it is. +locale_missing() { + # glibc's locale reports each category it cannot set; LANGUAGE=C keeps the + # message untranslated. Without the tool nothing is reported. + env LANGUAGE=C "$@" locale 2>&1 >/dev/null | grep -q "Cannot set LC_" +} +repair_locale() { + # libstdc++ also accepts a composite LC_ALL ("LC_CTYPE=...;LC_NUMERIC=..."), + # which glibc and so the check reject; leave such a setup alone. + case ${LC_ALL-} in *=*) return ;; esac + locale_missing || return + languages= + for var in LC_ALL LANG LC_CTYPE LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES \ + LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION; do + eval "value=\${$var-}" + [ -n "$value" ] && locale_missing LC_ALL="$value" || continue + unset "$var" 2>/dev/null + echo "OrcaSlicer: $var=$value is not available in the Flatpak runtime and is ignored." >&2 + # The hint names the language, e.g. "de" for de_DE.UTF-8. + lang=${value%%[_.@]*} + case $lang in [a-z][a-z]|[a-z][a-z][a-z]) ;; *) continue ;; esac + case ";$languages;" in *";$lang;"*) ;; *) languages="${languages:+$languages;}$lang" ;; esac + done + [ -n "${LANG-}" ] || export LANG=C.UTF-8 + [ -z "$languages" ] || echo "OrcaSlicer: to install it, add \"$languages\" to Flatpak's extra-languages" \ + "(or to languages, if set) with 'flatpak config' (--user for a per-user install), then run 'flatpak update'." >&2 +} +repair_locale + exec /app/bin/orca-slicer "$@" diff --git a/scripts/test_build_win.ps1 b/scripts/test_build_win.ps1 index 5f36fb7ac9..0c2a26c952 100644 --- a/scripts/test_build_win.ps1 +++ b/scripts/test_build_win.ps1 @@ -301,6 +301,10 @@ $cases = @( Contains = @('Precompiled header: off') } @{ Name = 'the precompiled header is on unless asked'; Args = @('-s') NotContains = @('SLIC3R_PCH') } + @{ Name = '-l turns the precompiled header off'; Args = @('-s', '-l') + Contains = @('-DSLIC3R_PCH=OFF', 'Precompiled header: off') } + @{ Name = 'a deps-only build says nothing about the precompiled header'; Args = @('-d', '-l') + NotContains = @('Precompiled header') } @{ Name = '--no-pch works without a cache'; Args = @('-s', '--no-pch') NotContains = @('COMPILER_LAUNCHER') } @{ Name = 'the slicer build runs gettext'; Args = @('-s') diff --git a/scripts/test_check_exception_throw_info.ps1 b/scripts/test_check_exception_throw_info.ps1 new file mode 100644 index 0000000000..0c2ef2edfb --- /dev/null +++ b/scripts/test_check_exception_throw_info.ps1 @@ -0,0 +1,93 @@ +<# +.SYNOPSIS + Tests scripts/check_exception_throw_info.ps1 on canned llvm-pdbutil dumps. + +.DESCRIPTION + Each case runs the check in its own powershell -File process, as CI does, and asserts on the + exit code and output. Dumps are written to a temporary folder, so no build is needed. + +.EXAMPLE + powershell -File scripts/test_check_exception_throw_info.ps1 +#> +$ErrorActionPreference = 'Stop' + +$check = Join-Path $PSScriptRoot 'check_exception_throw_info.ps1' +$work = Join-Path ([IO.Path]::GetTempPath()) 'check_exception_throw_info_tests' +Remove-Item -Recurse -Force $work -ErrorAction SilentlyContinue +New-Item -ItemType Directory -Force -Path $work | Out-Null + +function Write-Dump([string] $path, [string[]] $symbols) { + New-Item -ItemType Directory -Force -Path (Split-Path $path) | Out-Null + $i = 0 + $lines = @(' Public Symbols', '============================================================') + foreach ($symbol in $symbols) { + $i++ + $lines += " $i | S_PUB32 [size = 48] ``$symbol``", ' flags = none, addr = 0007:0000' + } + Set-Content -Path $path -Encoding ascii -Value $lines +} + +$bitwise = '_CT??_R0?AVfuture_error@std@@@840' +$copy = '_CT??_R0?AVfuture_error@std@@@8??0future_error@std@@QEAA@AEBV01@@Z40' +$trivial = '_CT??_R0?AUtag@@@81' +Write-Dump "$work\broken.txt" @($bitwise, $copy, $trivial) +Write-Dump "$work\clean.txt" @($copy, $trivial) +Write-Dump "$work\empty.txt" @() +Write-Dump "$work\a dir, with a comma\clean.txt" @($copy) + +# A build directory whose compiler has an llvm-pdbutil beside it but no OrcaSlicer.pdb. +# Nothing runs the stand-in; the check stops before it gets there. +$build = "$work\build" +New-Item -ItemType Directory -Force -Path "$build\bin", "$build\src\Release" | Out-Null +Copy-Item "$env:SystemRoot\System32\where.exe" "$build\bin\llvm-pdbutil.exe" +Set-Content -Path "$build\CMakeCache.txt" -Encoding ascii -Value "CMAKE_CXX_COMPILER:FILEPATH=$build\bin\clang-cl.exe" +Set-Content -Path "$build\src\Release\orca-slicer.pdb" -Value '' +$bare = "$work\bare" +New-Item -ItemType Directory -Force -Path $bare | Out-Null +Set-Content -Path "$bare\CMakeCache.txt" -Encoding ascii -Value 'CMAKE_CXX_COMPILER:STRING=no-such-clang-cl.exe' + +$cases = @( + @{ Name = 'a class with and without a copy constructor fails'; Args = @('-Dump', "$work\broken.txt") + Exit = 1; Contains = @('1 with broken throw info', 'future_error@std') } + @{ Name = 'copy constructors and trivially copyable classes pass'; Args = @('-Dump', "$work\clean.txt") + Exit = 0; Contains = @('2 exception classes, 0 with broken throw info') } + @{ Name = 'no exception classes at all fails'; Args = @('-Dump', "$work\empty.txt") + Exit = 1; Contains = @('No exception classes found') } + @{ Name = 'a comma-separated list checks each dump'; Args = @('-Dump', "$work\broken.txt,$work\clean.txt") + Exit = 1; Contains = @('broken.txt: 2 exception classes', 'clean.txt: 2 exception classes') } + @{ Name = 'a path with a comma stays whole'; Args = @('-Dump', "$work\a dir, with a comma\clean.txt") + Exit = 0; Contains = @('clean.txt: 1 exception classes') } + @{ Name = 'a build without OrcaSlicer.pdb fails'; Args = @('-BuildDir', $build) + Exit = 1; Contains = @('No OrcaSlicer.pdb in') } + @{ Name = 'a compiler that is not on PATH is named'; Args = @('-BuildDir', $bare) + Exit = 1; Contains = @('no-such-clang-cl.exe, the compiler in') } + @{ Name = 'a missing build directory is named'; Args = @('-BuildDir', "$work\nowhere") + Exit = 1; Contains = @('No CMakeCache.txt in') } + @{ Name = 'no build directory and no dump fails'; Args = @() + Exit = 1; Contains = @('Name the slicer build directory') } +) + +$failed = 0 +foreach ($case in $cases) { + $ErrorActionPreference = 'Continue' + $output = (& powershell -NoProfile -File $check @($case.Args) 2>&1 | Out-String) + $code = $LASTEXITCODE + $ErrorActionPreference = 'Stop' + $problems = @() + if ($code -ne $case.Exit) { $problems += "exit $code, expected $($case.Exit)" } + foreach ($text in $case.Contains) { + if (-not $output.Contains($text)) { $problems += "no '$text' in the output" } + } + if ($problems) { + $failed++ + " FAIL $($case.Name)" + $problems | ForEach-Object { " $_" } + $output.TrimEnd() -split "`r?`n" | ForEach-Object { " | $_" } + } else { + " ok $($case.Name)" + } +} + +Remove-Item -Recurse -Force $work -ErrorAction SilentlyContinue +"$($cases.Count - $failed) passed, $failed failed" +exit [int]($failed -gt 0) diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 48ddd16a3b..2bf5cb4825 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -104,6 +104,7 @@ #include "libslic3r/ModelArrange.hpp" #include "libslic3r/Platform.hpp" #include "libslic3r/Print.hpp" +#include "libslic3r/PrintConfig.hpp" #include "libslic3r/SLAPrint.hpp" #include "libslic3r/TriangleMesh.hpp" #include "libslic3r/Format/AMF.hpp" @@ -183,6 +184,12 @@ using namespace Slic3r; #define MAX_CLONEABLE_SIZE 512 +static Pointfs legacy_bed_exclude_area_points(const DynamicPrintConfig &config) +{ + const ConfigOptionPoints *option = config.option("bed_exclude_area"); + return option != nullptr ? option->values : Pointfs{}; +} + std::map cli_errors = { {CLI_SUCCESS, "Success."}, {CLI_ENVIRONMENT_ERROR, "Failed setting up server environment."}, @@ -1842,7 +1849,7 @@ int CLI::run(int argc, char **argv) //use Pointfs insteadof Points old_printable_area = config.option("printable_area", true)->values; - old_exclude_area = config.option("bed_exclude_area", true)->values; + old_exclude_area = legacy_bed_exclude_area_points(config); if (old_printable_area.size() >= 4) { BoundingBoxf old_printable_bbox(old_printable_area); old_printable_width = static_cast(old_printable_bbox.size().x()); @@ -2723,10 +2730,24 @@ int CLI::run(int argc, char **argv) fetch_compatible_values = true; } + // A project whose different_settings_to_system is missing or empty in every entry does not say which of its + // values were changed: the GUI saves it that way when its presets match their parents, but also when it cannot + // find those parents. Only --uptodate then replaces the stored values with system ones. + const bool refresh_unlisted = up_config_to_date || std::any_of(current_different_settings.begin(), current_different_settings.end(), + [](const std::string &keys) { return !keys.empty(); }); + // Refresh every project filament no loaded filament replaces from its current system preset, as the GUI // does when it loads the project; the filament merge below keeps the keys the project lists as changed. + // Without refresh_unlisted it keeps every key the project has except filament_extruder_variant, whose + // system layout the kept values are mapped onto. // Entries stay in slot order, which the merge's variant bookkeeping relies on. std::vector load_filaments_refresh(load_filaments_config.size(), false); + std::set project_keys; + if (!refresh_unlisted) { + for (const std::string &key : m_print_config.keys()) + project_keys.insert(key); + project_keys.erase("filament_extruder_variant"); + } if (is_bbl_3mf && new_printer_name.empty()) { const ConfigOptionStrings *project_filament_ids = m_print_config.option("filament_ids"); for (size_t index = 0; index < current_filaments_system_name.size(); index++) { @@ -3100,8 +3121,8 @@ int CLI::run(int argc, char **argv) // Load the project's printer and process settings as the GUI loads its presets: over the default preset, // with every key the project does not list as changed, including keys saved before an option existed, - // taken from its current system preset. - auto load_project_preset = [this, &ensure_system_preset_resolver, ¤t_different_settings, filament_count](const std::string &system_name, Preset::Type type) { + // taken from its current system preset. Without refresh_unlisted the project only gets the keys it lacks. + auto load_project_preset = [this, &ensure_system_preset_resolver, ¤t_different_settings, refresh_unlisted, filament_count](const std::string &system_name, Preset::Type type) { if (system_name.empty()) return; // Preset bookkeeping the CLI keeps in its own groups, e.g. inherits_group and print_compatible_printers. @@ -3124,7 +3145,7 @@ int CLI::run(int argc, char **argv) for (const std::string &key : keys) { const ConfigOption *opt = config.option(key); const ConfigOption *old = m_print_config.option(key); - if (bookkeeping_keys.count(key) != 0 || opt == nullptr || (old != nullptr && *old == *opt)) + if (bookkeeping_keys.count(key) != 0 || opt == nullptr || (old != nullptr && (!refresh_unlisted || *old == *opt))) continue; BOOST_LOG_TRIVIAL(info) << boost::format("CLI: %1% from '%2%': %3% -> %4%") % key % system_name % (old ? old->serialize() : std::string("(missing)")) % opt->serialize(); m_print_config.set_key_value(key, opt->clone()); @@ -3510,6 +3531,8 @@ int CLI::run(int argc, char **argv) int filament_index = load_filaments_index[index]; // A filament given with --load-filaments replaces the slot; a refreshed one keeps the project's changed keys. const bool loaded = load_filament_count > 0 && !load_filaments_refresh[index]; + // A refreshed filament of a project that lists no changed settings keeps every key it has. + const bool keep_project = load_filaments_refresh[index] && !refresh_unlisted; std::vector different_keys; //ORCA: diff before load_default_gcodes_to_config, the way the process and machine @@ -3537,6 +3560,8 @@ int CLI::run(int argc, char **argv) different_settings[filament_index] = filament_different_settings; inherits_group[filament_index] = load_filaments_inherit[index]; } + else if (keep_project) + different_keys.assign(project_keys.begin(), project_keys.end()); else { std::string diff_settings; @@ -3630,7 +3655,8 @@ int CLI::run(int argc, char **argv) // destination to the filament's slot first (set_with_restore_2 only restores). if (opt_vec_src->size() > 0 && opt_vec_dst->size() < size_t(old_start_indice[filament_index - 1] + old_variant_count)) opt_vec_dst->resize(size_t(old_start_indice[filament_index - 1] + old_variant_count), opt_vec_src); - opt_vec_dst->set_with_restore_2(opt_vec_src, new_variant_indice, old_start_indice[filament_index - 1], old_variant_count); + // A kept key is padded like a refreshed one below rather than failing the run. + opt_vec_dst->set_with_restore_2(opt_vec_src, new_variant_indice, old_start_indice[filament_index - 1], old_variant_count, keep_project); } catch (const std::exception &ex) { // Was an uncaught abort BOOST_LOG_TRIVIAL(error) << boost::format("filament %1%: option %2% could not be applied: %3%") % filament_index % opt_key % ex.what(); boost::nowide::cerr << "filament " << filament_index << ": option " << opt_key << " could not be applied: " << ex.what() << std::endl; @@ -3733,7 +3759,7 @@ int CLI::run(int argc, char **argv) } } - if (diff_keys_size != different_keys_set.size()) { + if (!keep_project && diff_keys_size != different_keys_set.size()) { //changed different_keys.clear(); @@ -3749,8 +3775,21 @@ int CLI::run(int argc, char **argv) for (size_t index = 0; index < load_filaments_config.size(); index++) if (load_filaments_index[index] >= 1 && load_filaments_index[index] <= filament_count) filament_configs[load_filaments_index[index] - 1] = &load_filaments_config[index]; - if (std::find(filament_configs.begin(), filament_configs.end(), nullptr) == filament_configs.end()) - set_filament_dev_options(m_print_config, filament_configs); + // Without refresh_unlisted and with no filament loaded from a file, only the keys the project lacks are + // filled, with the option defaults for a filament that has no system preset. A loaded filament still + // replaces them all. + if (refresh_unlisted || std::find(load_filaments_refresh.begin(), load_filaments_refresh.end(), false) != load_filaments_refresh.end()) { + if (std::find(filament_configs.begin(), filament_configs.end(), nullptr) == filament_configs.end()) + set_filament_dev_options(m_print_config, filament_configs); + } else { + const DynamicPrintConfig no_preset; + std::replace(filament_configs.begin(), filament_configs.end(), static_cast(nullptr), &no_preset); + DynamicPrintConfig dev_config; + set_filament_dev_options(dev_config, filament_configs); + for (const std::string &key : dev_config.keys()) + if (project_keys.count(key) == 0) + m_print_config.set_key_value(key, dev_config.option(key)->clone()); + } if (m_print_config.option("filament_extruder_variant")) { std::vector& filament_self_indice = m_print_config.option("filament_self_index", true)->values; @@ -4262,7 +4301,7 @@ int CLI::run(int argc, char **argv) Slic3r::GUI::PartPlateList partplate_list(NULL, m_models.data(), printer_technology); //use Pointfs insteadof Points Pointfs current_printable_area = m_print_config.opt("printable_area")->values; - Pointfs current_exclude_area = m_print_config.opt("bed_exclude_area")->values; + Pointfs current_exclude_area = legacy_bed_exclude_area_points(m_print_config); std::vector current_extruder_areas; //update part plate's size double print_height = m_print_config.opt_float("printable_height"); @@ -4672,7 +4711,7 @@ int CLI::run(int argc, char **argv) printer_plate.printer_name = config_name; temp_printable_area = config.option("printable_area", true)->values; - temp_exclude_area = config.option("bed_exclude_area", true)->values; + temp_exclude_area = legacy_bed_exclude_area_points(config); temp_wrapping_area = config.option("wrapping_exclude_area", true)->values; temp_extruder_areas = config.option("extruder_printable_area", true)->values; temp_extruder_print_heights = config.option("extruder_printable_height", true)->values; @@ -5395,7 +5434,7 @@ int CLI::run(int argc, char **argv) } // add the virtual object into unselect list if has - partplate_list.preprocess_exclude_areas(unselected, enable_wrapping_detect, i + 1); + partplate_list.preprocess_exclude_areas(unselected, m_print_config, enable_wrapping_detect, i + 1); if (avoid_extrusion_cali_region) partplate_list.preprocess_nonprefered_areas(unselected, i + 1); @@ -5427,7 +5466,8 @@ int CLI::run(int argc, char **argv) beds = get_shrink_bedpts(&m_print_config, arrange_cfg); - partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, enable_wrapping_detect, 1, scale_(1)); + partplate_list.preprocess_exclude_areas( + arrange_cfg.excluded_regions, m_print_config, enable_wrapping_detect, 1, scale_(1)); { BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << beds[0].transpose() << ", " << beds[1].transpose() << ", " << beds[2].transpose() << ", " << beds[3].transpose(); @@ -5637,7 +5677,7 @@ int CLI::run(int argc, char **argv) } //add the virtual object into unselect list if has - partplate_list.preprocess_exclude_areas(unselected, enable_wrapping_detect); + partplate_list.preprocess_exclude_areas(unselected, m_print_config, enable_wrapping_detect); // Filament ids given on the command line size the tower for STL input. A project // records its filament use per plate, so count there and keep its tower positions. @@ -5868,7 +5908,8 @@ int CLI::run(int argc, char **argv) } // add the virtual object into unselect list if has - partplate_list.preprocess_exclude_areas(unselected, enable_wrapping_detect, plate_to_slice); + partplate_list.preprocess_exclude_areas( + unselected, m_print_config, enable_wrapping_detect, plate_to_slice); } @@ -5900,7 +5941,8 @@ int CLI::run(int argc, char **argv) beds=get_shrink_bedpts(&m_print_config, arrange_cfg); - partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, enable_wrapping_detect, 1, scale_(1)); + partplate_list.preprocess_exclude_areas( + arrange_cfg.excluded_regions, m_print_config, enable_wrapping_detect, 1, scale_(1)); { BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << beds[0].transpose() << ", " << beds[1].transpose() << ", " << beds[2].transpose() << ", " << beds[3].transpose(); @@ -6403,10 +6445,16 @@ int CLI::run(int argc, char **argv) continue; // An empty estimate is a plate that prints no tower (one filament and // neither smooth timelapse, wrapping detection nor a raft). - Vec3d wt_pos, wt_size; - plate->estimate_wipe_tower_polygon(m_print_config, index, wt_pos, wt_size); + Vec3d wt_pos, wt_size; + Slic3r::GUI::WipeTowerRelocation relocation; + plate->estimate_wipe_tower_polygon(m_print_config, index, wt_pos, wt_size, 0, false, &relocation); if (wt_size(0) < EPSILON || wt_size(1) < EPSILON) continue; + if (relocation.moved) + BOOST_LOG_TRIVIAL(warning) << boost::format("plate %1%: the wipe tower no longer fits at its saved position {%2%, %3%} and was moved %4%") + % (index + 1) % m_print_config.option("wipe_tower_x", true)->get_at(index) + % m_print_config.option("wipe_tower_y", true)->get_at(index) + % (relocation.overlaps_objects ? "onto an object, as no free space is left" : "to free space"); ConfigOptionFloat wt_x_opt((float) wt_pos(0)); ConfigOptionFloat wt_y_opt((float) wt_pos(1)); m_print_config.option("wipe_tower_x", true)->set_at(&wt_x_opt, index, 0); diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 98efc032b8..5ec97c347a 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -242,6 +242,14 @@ void AppConfig::set_defaults() set("preview_dim_previous_layers_brightness", std::to_string(std::max(0, std::min(brightness, 99)))); } + // ORCA: whether the G-code preview keeps the opacity of the filament colors + if (get("preview_translucent_filaments").empty()) + set_bool("preview_translucent_filaments", true); + + // ORCA: whether realistic view gives the opaque toolpaths a glossy highlight + if (get(SETTING_OPENGL_REALISTIC_GLOSS).empty()) + set_bool(SETTING_OPENGL_REALISTIC_GLOSS, true); + // ORCA: view type the G-code preview opens with. "auto" keeps the automatic choice (Filament for // multi material prints, Line Type for single material ones), "last" restores the view type the user // picked last, any other value is a fixed view type name, see GCodeViewer::view_type_to_config_name(). @@ -410,6 +418,8 @@ void AppConfig::set_defaults() if (get("show_labels").empty()) set_bool("show_labels", false); + if (get("show_collision_volumes").empty()) + set_bool("show_collision_volumes", false); if (get("show_overhang").empty()) set_bool("show_overhang", false); diff --git a/src/libslic3r/AppConfig.hpp b/src/libslic3r/AppConfig.hpp index 61dceda87a..1e35df6999 100644 --- a/src/libslic3r/AppConfig.hpp +++ b/src/libslic3r/AppConfig.hpp @@ -48,6 +48,7 @@ #define SETTING_OPENGL_PHONG_SSAO "opengl_phong_ssao" #define SETTING_OPENGL_PHONG_SMOOTH_NORMALS "opengl_phong_smooth_normals" #define SETTING_OPENGL_REALISTIC_PREVIEW "opengl_realistic_preview" +#define SETTING_OPENGL_REALISTIC_GLOSS "opengl_realistic_gloss" #define SETTING_PLUGIN_PAGES_VISIBLE_COUNT "plugin_pages_visible_count" #define PLUGIN_PAGES_VISIBLE_COUNT_MIN 1 diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 50b20bacd1..997ae00a56 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -105,6 +105,46 @@ using ItemGroup = std::vector>; const double BIG_ITEM_TRESHOLD = 0.02; #define VITRIFY_TEMP_DIFF_THRSH 15 // bed temp can be higher than vitrify temp, but not higher than this thresh +static bool z_ranges_overlap(double first_min, double first_max, double second_min, double second_max) +{ + if (first_min > first_max) + std::swap(first_min, first_max); + if (second_min > second_max) + std::swap(second_min, second_max); + + // Touching a volume is treated as a collision. Arrangement may leave some + // usable space empty, but it must not create a marginally unsafe placement. + return first_max >= second_min - EPSILON && second_max >= first_min - EPSILON; +} + +template +static bool bed_exclusion_applies_impl(const T &item, const T &fixed_item) +{ + if (!fixed_item.is_bed_exclusion) + return false; + if (item.has_z_range && fixed_item.has_z_range && + !z_ranges_overlap(item.z_min, item.z_max, fixed_item.z_min, fixed_item.z_max)) + return false; + + // Shared volumes and unresolved object mappings apply conservatively to + // every nozzle. Otherwise only the owning physical nozzle participates. + return fixed_item.bed_exclusion_extruder_id < 0 || item.bed_exclusion_extruder_ids.empty() || + std::find(item.bed_exclusion_extruder_ids.begin(), item.bed_exclusion_extruder_ids.end(), + fixed_item.bed_exclusion_extruder_id) != item.bed_exclusion_extruder_ids.end(); +} + +bool has_bed_exclusion_regions(const ArrangePolygons &polygons) +{ + return std::any_of(polygons.begin(), polygons.end(), [](const ArrangePolygon &polygon) { + return polygon.is_bed_exclusion; + }); +} + +bool bed_exclusion_applies(const ArrangePolygon &item, const ArrangePolygon &fixed_item) +{ + return bed_exclusion_applies_impl(item, fixed_item); +} + void update_arrange_params(ArrangeParams& params, const DynamicPrintConfig* print_cfg, const ArrangePolygons& selected) { double skirt_distance = get_real_skirt_dist(*print_cfg); @@ -122,8 +162,8 @@ void update_arrange_params(ArrangeParams& params, const DynamicPrintConfig* prin void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPrintConfig* print_cfg, ArrangeParams& params) { // do not inflate brim_width. Objects are allowed to have overlapped brim. - Points bedpts = get_shrink_bedpts(print_cfg, params); - BoundingBox bedbb = Polygon(bedpts).bounding_box(); + // A brim reaching the printable area's edge is fine, so measure against the full bed. + BoundingBox bedbb = Polygon(get_bed_shape(*print_cfg)).bounding_box(); // set obj distance for auto seq_print if (params.is_seq_print) { bool all_objects_are_short = std::all_of(selected.begin(), selected.end(), [&](ArrangePolygon& ap) { return ap.height < params.nozzle_height; }); @@ -144,14 +184,30 @@ void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPri // 3. otherwise, use each object's own brim width ap.inflation = params.min_obj_distance != 0 ? params.min_obj_distance / 2 : plate_has_tree_support ? scaled(brim_max / 2) : scaled(ap.brim_width); - BoundingBox apbb = ap.poly.contour.bounding_box(); - auto diffx = bedbb.size().x() - apbb.size().x() - 5; - auto diffy = bedbb.size().y() - apbb.size().y() - 5; - if (diffx > 0 && diffy > 0) { - auto min_diff = std::min(diffx, diffy); - ap.inflation = std::min(min_diff / 2, ap.inflation); - } + if (params.min_obj_distance != 0) + return; // an explicit object distance is the user's call, not ours to shrink + // An item cannot be larger than the printable area, inflation included. Inflating + // an almost bed filling item would leave it too big to ever be placed. + BoundingBox apbb = ap.poly.contour.bounding_box(); + auto diffx = bedbb.size().x() - apbb.size().x(); + auto diffy = bedbb.size().y() - apbb.size().y(); + ap.inflation = std::max(0, std::min({ ap.inflation, diffx / 2, diffy / 2 })); }); + + // Give the bed margin, which the arrange bed keeps from the printable area, back + // where the largest item needs it. The skirt keeps its room: pushing a skirt off + // the bed is worse than saying the item does not fit. + if (!selected.empty()) { + coord_t max_width = 0, max_height = 0; + for (const ArrangePolygon &ap : selected) { + BoundingBox apbb = ap.poly.contour.bounding_box(); + max_width = std::max(max_width, apbb.size().x() + 2 * ap.inflation); + max_height = std::max(max_height, apbb.size().y() + 2 * ap.inflation); + } + auto margin = [](coord_t bed, coord_t item) { return std::max(0., unscale(bed - item) / 2.); }; + params.bed_shrink_x = std::min(params.bed_shrink_x, std::max(params.brim_skirt_distance, margin(bedbb.size().x(), max_width))); + params.bed_shrink_y = std::min(params.bed_shrink_y, std::max(params.brim_skirt_distance, margin(bedbb.size().y(), max_height))); + } } void update_unselected_items_inflation(ArrangePolygons& unselected, const DynamicPrintConfig* print_cfg, const ArrangeParams& params) @@ -334,6 +390,14 @@ void fill_config(PConf& pcfg, const ArrangeParams ¶ms) { // Allow parallel execution. pcfg.parallel = params.parallel; + pcfg.should_check_collision = [](const Item &candidate, const Item &packed) { + if (packed.is_bed_exclusion) + return bed_exclusion_applies_impl(candidate, packed); + if (candidate.is_bed_exclusion) + return bed_exclusion_applies_impl(packed, candidate); + return true; + }; + // BBS: excluded regions in BBS bed for (auto& poly : params.excluded_regions) process_arrangeable(poly, pcfg.m_excluded_regions); @@ -1175,6 +1239,12 @@ static void process_arrangeable(const ArrangePolygon &arrpoly, item.itemId(arrpoly.itemid); item.extrude_ids = arrpoly.extrude_ids; item.height = arrpoly.height; + item.z_min = arrpoly.z_min; + item.z_max = arrpoly.z_max; + item.has_z_range = arrpoly.has_z_range; + item.is_bed_exclusion = arrpoly.is_bed_exclusion; + item.bed_exclusion_extruder_ids = arrpoly.bed_exclusion_extruder_ids; + item.bed_exclusion_extruder_id = arrpoly.bed_exclusion_extruder_id; item.name = arrpoly.name; //BBS: add virtual object logic item.is_virt_object = arrpoly.is_virt_object; diff --git a/src/libslic3r/Arrange.hpp b/src/libslic3r/Arrange.hpp index b63b8c938b..20f5e7db9a 100644 --- a/src/libslic3r/Arrange.hpp +++ b/src/libslic3r/Arrange.hpp @@ -81,6 +81,17 @@ struct ArrangePolygon { int itemid{ 0 }; // item id in the vector, used for accessing all possible params like extrude_id int is_applied{ 0 }; // transform has been applied double height{ 0 }; // item height + double z_min{ 0 }; // lowest occupied Z coordinate + double z_max{ 0 }; // highest occupied Z coordinate + bool has_z_range{ false }; // whether z_min / z_max are authoritative + bool is_bed_exclusion{ false }; // conditional bed-exclusion obstacle + // Physical nozzle ids used only for per-nozzle exclusion checks. These are + // deliberately separate from extrude_ids, which contains logical filament + // ids used by Orca's normal material-aware arrangement. Empty is treated + // conservatively as unresolved and therefore applicable to every nozzle. + std::vector bed_exclusion_extruder_ids{}; + // Zero-based nozzle owning an exclusion obstacle; -1 means shared. + int bed_exclusion_extruder_id{ -1 }; double brim_width{ 0 }; // brim width std::string name; @@ -201,6 +212,9 @@ void update_unselected_items_inflation(ArrangePolygons& unselected, const Dynami void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPrintConfig* print_cfg, const ArrangeParams& params); +bool has_bed_exclusion_regions(const ArrangePolygons& polygons); +bool bed_exclusion_applies(const ArrangePolygon& item, const ArrangePolygon& fixed_item); + Points get_shrink_bedpts(const DynamicPrintConfig* print_cfg, const ArrangeParams& params); /** diff --git a/src/libslic3r/Brim.cpp b/src/libslic3r/Brim.cpp index 23b515647b..1ab8cecbce 100644 --- a/src/libslic3r/Brim.cpp +++ b/src/libslic3r/Brim.cpp @@ -2,6 +2,7 @@ #include "BrimEarsPoint.hpp" #include "ClipperUtils.hpp" #include "EdgeGrid.hpp" +#include "ExclusionVolumeGeometry.hpp" #include "ExPolygon.hpp" #include "Flow.hpp" #include "Geometry.hpp" @@ -20,11 +21,14 @@ #include "PrintConfig.hpp" #include "MaterialType.hpp" #include "Model.hpp" +#include "Support/SupportCommon.hpp" #include #include #include #include #include +#include +#include #include #include #include @@ -48,6 +52,20 @@ namespace Slic3r { +static coord_t brim_exclusion_clearance(const Flow &flow) +{ + const coord_t width_spacing_delta = std::max(0, flow.scaled_width() - flow.scaled_spacing()); + return (width_spacing_delta + 1) / 2 + coord_t(SCALED_EPSILON); +} + +static bool combine_object_brims(const Print &print) +{ + const bool has_per_object_skirt_or_shield = print.config().skirt_type == stPerObject && + (print.has_skirt() || print.has_infinite_skirt()); + return print.config().combine_brims.value && !has_per_object_skirt_or_shield && + print.config().print_sequence != PrintSequence::ByObject; +} + static void append_and_translate(ExPolygons &dst, const ExPolygons &src, const PrintInstance &instance) { size_t dst_idx = dst.size(); expolygons_append(dst, src); @@ -444,6 +462,17 @@ static ExPolygons outer_inner_brim_area(const Print& print, { unsigned int support_material_extruder = printExtruders.front() + 1; Flow flow = print.brim_flow(); + std::vector> exclusion_regions_by_extruder; + if (has_bed_exclude_volumes(print.config())) { + exclusion_regions_by_extruder = get_bed_excluded_regions_by_extruder(print.config()); + // The established bed polygon below still clips the bed edge and + // legacy areas. Only explicit volumes use the new Z-aware trimming. + for (std::vector ®ions : exclusion_regions_by_extruder) + regions.erase(std::remove_if(regions.begin(), regions.end(), + [](const BedExcludeRegion ®ion) { return !region.is_collision_volume(); }), regions.end()); + } + const double first_layer_top_z = std::max(0.0, print.skirt_first_layer_height()); + const coord_t exclusion_clearance = brim_exclusion_clearance(flow); ExPolygons brim_area; ExPolygons no_brim_area; @@ -638,14 +667,13 @@ static ExPolygons outer_inner_brim_area(const Print& print, } } - int extruder_nums = print.config().nozzle_diameter.values.size(); std::vector extruder_unprintable_area = print.get_extruder_printable_polygons(); + const size_t extruder_count = print.config().nozzle_diameter.size(); // Orca: if per-extruder print area is not specified, use the whole bed as printable area for all extruders - if (extruder_unprintable_area.empty()) { - extruder_unprintable_area.resize(extruder_nums, Polygons{Model::getBedPolygon()}); - } - std::vector filament_map = print.get_filament_maps(); - + if (extruder_unprintable_area.empty()) + extruder_unprintable_area.resize(extruder_count, Polygons{Model::getBedPolygon()}); + const size_t physical_extruder_count = std::max( + extruder_count, extruder_unprintable_area.size()); if (print.has_wipe_tower() && !print.get_fake_wipe_tower().outer_wall.empty()) { ExPolygons expolyFromLines{}; for (auto polyline : print.get_fake_wipe_tower().outer_wall.begin()->second) { @@ -661,22 +689,36 @@ static ExPolygons outer_inner_brim_area(const Print& print, auto iter = std::find_if(objPrintVec.begin(), objPrintVec.end(), [object](const std::pair& item) { return item.first == object->id(); }); + std::vector object_physical_extruders; - if (iter != objPrintVec.end()) { - int extruder_id = filament_map[iter->second - 1] - 1; - auto bedPoly = extruder_unprintable_area[extruder_id]; - auto bedExPoly = diff_ex((offset(bedPoly, scale_(30.), jtRound, SCALED_RESOLUTION)), {bedPoly}); - if (!bedExPoly.empty()) { - extruder_no_brim_area.push_back(bedExPoly.front()); + if (iter != objPrintVec.end() && iter->second > 0) { + object_physical_extruders = bed_exclusion_physical_extruders( + print, { iter->second - 1 }, physical_extruder_count, 0); + for (const size_t extruder_id : object_physical_extruders) { + if (extruder_id >= extruder_unprintable_area.size()) + continue; + const Polygons &bed_poly = extruder_unprintable_area[extruder_id]; + ExPolygons bed_exterior = diff_ex( + offset(bed_poly, scale_(30.), jtRound, SCALED_RESOLUTION), bed_poly); + expolygons_append(extruder_no_brim_area, std::move(bed_exterior)); } //extruder_no_brim_area = offset2_ex(extruder_no_brim_area, scaled_flow_width, -scaled_flow_width); // connect scattered small areas to prevent generating very small brims - } - for (auto& [key, areas] : brimAreaMap) - if (key.object_id == object->id()) - areas = diff_ex(areas, extruder_no_brim_area); - + if (object_physical_extruders.empty()) { + object_physical_extruders.resize(physical_extruder_count); + std::iota(object_physical_extruders.begin(), object_physical_extruders.end(), size_t(0)); + } + const ExPolygons exclusions = active_bed_exclusion_footprints( + exclusion_regions_by_extruder, object_physical_extruders, + 0.0, first_layer_top_z, Point(0, 0), exclusion_clearance); + for (auto& [key, areas] : brimAreaMap) { + if (key.object_id != object->id()) + continue; + areas = diff_ex(areas, extruder_no_brim_area); + if (!exclusions.empty()) + areas = diff_ex(areas, exclusions); + } } brim_area.clear(); diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index fa9aec8531..fd89ad78dc 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -127,6 +127,8 @@ set(lisbslic3r_sources Emboss.hpp EmbossShape.hpp enum_bitmask.hpp + ExclusionVolumeGeometry.cpp + ExclusionVolumeGeometry.hpp Execution/Execution.hpp Execution/ExecutionSeq.hpp Execution/ExecutionTBB.hpp @@ -182,8 +184,8 @@ set(lisbslic3r_sources Fill/FillPlanePath.hpp Fill/FillRectilinear.cpp Fill/FillRectilinear.hpp - Fill/FillTpmsAdaptive.cpp - Fill/FillTpmsAdaptive.hpp + Fill/AdaptiveInfillField.cpp + Fill/AdaptiveInfillField.hpp Fill/FillTpmsD.cpp Fill/FillTpmsD.hpp Fill/FillTpmsFK.cpp @@ -257,6 +259,10 @@ set(lisbslic3r_sources GCode/ConflictChecker.hpp GCode/CoolingBuffer.cpp GCode/CoolingBuffer.hpp + GCode/ExclusionVolumePathCheck.cpp + GCode/ExclusionVolumePathCheck.hpp + GCode/ExclusionVolumeTravelAvoidance.cpp + GCode/ExclusionVolumeTravelAvoidance.hpp GCode/TimelapsePosPicker.cpp GCode/TimelapsePosPicker.hpp GCode.cpp @@ -281,6 +287,8 @@ set(lisbslic3r_sources GCode/RetractWhenCrossingPerimeters.hpp GCode/SeamPlacer.cpp GCode/SeamPlacer.hpp + GCode/SeamContour.cpp + GCode/SeamContour.hpp GCode/PreciseSeam.cpp GCode/PreciseSeam.hpp GCode/PreciseSeamInternal.hpp @@ -666,6 +674,9 @@ endif () encoding_check(libslic3r) target_compile_definitions(libslic3r PUBLIC -DUSE_TBB -DTBB_USE_CAPTURED_EXCEPTION=0) +# CGAL changes Kd_tree's member layout when TBB is enabled. Match libslic3r_cgal +# in every consumer so inline constructors/destructors cannot mix the two layouts. +target_compile_definitions(libslic3r PUBLIC CGAL_LINKED_WITH_TBB) if (USE_SLIC3R_CONSOLE_LOG) target_compile_definitions(libslic3r PRIVATE $<$:SLIC3R_CONSOLE_LOG>) endif() diff --git a/src/libslic3r/ClipperUtils.cpp b/src/libslic3r/ClipperUtils.cpp index 8e9decf37a..bdfd97b01d 100644 --- a/src/libslic3r/ClipperUtils.cpp +++ b/src/libslic3r/ClipperUtils.cpp @@ -7,9 +7,13 @@ #include #include #include +#include #include +#include + #include "ClipperUtils.hpp" +#include "AABBTreeIndirect.hpp" #include "BoundingBox.hpp" #include "ExPolygon.hpp" #include "Point.hpp" @@ -276,6 +280,7 @@ Polylines c2_to_polylines(const C2::Paths64 &paths) return out; } +// Only sizes the reserve of c2_to_expolygons(): for a tree Clipper2 misnested (see below) the count is approximate. size_t c2_count_expolygons(const C2::PolyPath64 &outer) { size_t cnt = 1; @@ -285,17 +290,90 @@ size_t c2_count_expolygons(const C2::PolyPath64 &outer) return cnt; } -void c2_append_expolygons(const C2::PolyPath64 &outer, ExPolygons &out) +// Clipper2 sometimes puts a path at the wrong level of its PolyTree: a hole beside the outer path around it instead of +// under it, or an island at the level of holes. Taken as they are, a misplaced hole becomes a clockwise contour and its +// outer an expolygon that covers it; whole-layer booleans cancel the two, but anything handling expolygons one at a time +// sees the hole filled. So the orientation of a path decides its role: a clockwise path where a contour belongs is +// collected in stray_holes, for c2_attach_stray_holes() to give to the contour around it. +void c2_append_expolygons(const C2::PolyPath64 &outer, ExPolygons &out, std::vector &stray_holes) { - ExPolygon &expoly = out.emplace_back(); - expoly.contour.points = c2_to_points(outer.Polygon()); - expoly.holes.reserve(outer.Count()); - for (const auto &hole : outer) - expoly.holes.emplace_back().points = c2_to_points(hole->Polygon()); - // Islands inside the holes. - for (const auto &hole : outer) - for (const auto &island : *hole) - c2_append_expolygons(*island, out); + if (C2::Area(outer.Polygon()) < 0.) { + stray_holes.emplace_back(&outer.Polygon()); + for (const auto &island : outer) + c2_append_expolygons(*island, out, stray_holes); + return; + } + // Indexed, as the recursion below may reallocate out. + const size_t idx = out.size(); + out.emplace_back().contour.points = c2_to_points(outer.Polygon()); + out[idx].holes.reserve(outer.Count()); + for (const auto &child : outer) + if (C2::Area(child->Polygon()) > 0.) + c2_append_expolygons(*child, out, stray_holes); + else { + out[idx].holes.emplace_back().points = c2_to_points(child->Polygon()); + // Islands inside the hole. + for (const auto &island : *child) + c2_append_expolygons(*island, out, stray_holes); + } +} + +// Whether outer encloses inner, two paths of one Clipper2 result. Such paths don't cross, they only touch, and rounding +// both to the grid leaves a touching vertex up to about 1.5 units across the other path. So a vertex of inner that close +// to outer doesn't count, the first vertex clear of it decides, and a path touching at every vertex goes by a point +// strictly inside it: either lies on the same side of outer as the whole path. A sliver too thin to hold such a point is +// taken as not enclosed. A hole closely hugging an island inside it would pass, so callers skip any outer no larger than +// inner: a path inside another is always the smaller. +bool path_encloses(const Polygon &outer, const Polygon &inner) +{ + // The rounding of the two paths, and of the projection Polygon::on_boundary() measures to. + static constexpr double touching = 3.; + for (const Point &pt : inner.points) + if (! outer.on_boundary(pt, touching)) + return contains(outer, pt, true); + const std::optional pt = ClipperUtils::interior_point(inner); + return pt && contains(outer, *pt, true); +} + +// Gives each stray hole to the innermost of the contours out[first..] around it. Contours of a Clipper2 result don't +// cross, so those around a hole are nested and the innermost one is the smallest: candidates are tried smallest first, +// from the first one larger than the hole. +void c2_attach_stray_holes(ExPolygons &out, size_t first, const std::vector &stray_holes) +{ + if (stray_holes.empty()) + return; + using Tree = AABBTreeIndirect::Tree<2, coord_t>; + std::vector bboxes; + bboxes.reserve(out.size() - first); + for (size_t i = first; i < out.size(); ++ i) + bboxes.emplace_back(i, get_extents(out[i].contour)); + Tree tree; + tree.build_modify_input(bboxes); + // Contour areas, computed when a contour first becomes a candidate. + std::vector areas(out.size(), 0.); + std::vector candidates; + for (const C2::Path64 *path : stray_holes) { + Polygon hole; + hole.points = c2_to_points(*path); + const double hole_area = - C2::Area(*path); + const BoundingBox bbox = get_extents(hole); + const Tree::BoundingBox hole_bbox(bbox.min, bbox.max); + candidates.clear(); + AABBTreeIndirect::traverse(tree, + [&hole_bbox](const Tree::Node &node) { return node.bbox.contains(hole_bbox); }, + [&candidates](const Tree::Node &node) { candidates.emplace_back(node.idx); return true; }); + for (size_t idx : candidates) + if (areas[idx] == 0.) + areas[idx] = out[idx].contour.area(); + std::sort(candidates.begin(), candidates.end(), [&areas](size_t a, size_t b) { return areas[a] < areas[b]; }); + auto larger = std::upper_bound(candidates.begin(), candidates.end(), hole_area, [&areas](double area, size_t idx) { return area < areas[idx]; }); + if (auto it = std::find_if(larger, candidates.end(), [&out, &hole](size_t idx) { return path_encloses(out[idx].contour, hole); }); + it == candidates.end()) + // Nothing around it: keep the path as Clipper2 returned it. + out.emplace_back().contour = std::move(hole); + else + out[*it].holes.emplace_back(std::move(hole)); + } } ExPolygons c2_to_expolygons(const C2::PolyTree64 &tree) @@ -305,8 +383,10 @@ ExPolygons c2_to_expolygons(const C2::PolyTree64 &tree) cnt += c2_count_expolygons(*outer); ExPolygons out; out.reserve(cnt); + std::vector stray_holes; for (const auto &outer : tree) - c2_append_expolygons(*outer, out); + c2_append_expolygons(*outer, out, stray_holes); + c2_attach_stray_holes(out, 0, stray_holes); return out; } @@ -335,14 +415,15 @@ Polylines c2_clip_open(C2::ClipType type, const C2::Paths64 &subject, const C2:: } // Clipper1 semantics: miter limit at least 2, arc tolerance (also for round caps) at most a quarter of the offset. -void c2_offset_setup(C2::ClipperOffset &co, float delta, JoinType joinType, double miterLimit) +// Without a round join, a positive capTolerance replaces Clipper1's 0.25 for the round caps. +void c2_offset_setup(C2::ClipperOffset &co, float delta, JoinType joinType, double miterLimit, double capTolerance = 0.) { const double max_arc_tolerance = std::abs(delta) * 0.25; if (joinType == jtRound) co.ArcTolerance(miterLimit > 0. ? std::min(miterLimit, max_arc_tolerance) : 0.25); else { co.MiterLimit(std::max(miterLimit, 2.)); - co.ArcTolerance(std::min(0.25, max_arc_tolerance)); + co.ArcTolerance(std::min(capTolerance > 0. ? capTolerance : 0.25, max_arc_tolerance)); } } @@ -466,7 +547,7 @@ ExPolygons c2_expolygons_offset_ex(const ExPolygonRange &src, float delta, JoinT } template -Polygons c2_offset_lines(PathsProvider &&src, float delta, JoinType joinType, double miterLimit, EndType endType) +Polygons c2_offset_lines(PathsProvider &&src, float delta, JoinType joinType, double miterLimit, EndType endType, double capTolerance = 0.) { C2::Paths64 out; if (endType == etClosedPolygon) { @@ -480,7 +561,7 @@ Polygons c2_offset_lines(PathsProvider &&src, float delta, JoinType joinType, do for (const Points &path : src) append_offset_path(paths, path, shortest, end); C2::ClipperOffset co; - c2_offset_setup(co, delta, joinType, miterLimit); + c2_offset_setup(co, delta, joinType, miterLimit, capTolerance); co.AddPaths(paths, to_c2(joinType), end); co.Execute(delta, out); return c2_to_polygons(out); @@ -536,8 +617,8 @@ Slic3r::Polygons offset(const Slic3r::Polyline3 &polyline, const float delta, Jo assert(delta > 0); return c2_offset_lines(ClipperUtils::SinglePathProvider(polyline.to_polyline().points), delta, joinType, miterLimit, end_type); } -Slic3r::Polygons offset(const Slic3r::Polylines &polylines, const float delta, JoinType joinType, double miterLimit, EndType end_type) - { assert(delta > 0); return c2_offset_lines(ClipperUtils::PolylinesProvider(polylines), delta, joinType, miterLimit, end_type); } +Slic3r::Polygons offset(const Slic3r::Polylines &polylines, const float delta, JoinType joinType, double miterLimit, EndType end_type, double cap_tolerance) + { assert(delta > 0); return c2_offset_lines(ClipperUtils::PolylinesProvider(polylines), delta, joinType, miterLimit, end_type, cap_tolerance); } Polygons contour_to_polygons(const Polygon &polygon, const float line_width, JoinType join_type, double miter_limit) { assert(line_width > 1.f); return c2_offset_lines(ClipperUtils::SinglePathProvider(polygon.points), line_width / 2, join_type, miter_limit, etClosedLine); } @@ -667,6 +748,24 @@ Slic3r::Polygons diff(const Slic3r::ExPolygons &subject, const Slic3r::ExPolygon { return _clipper(ctDifference, ClipperUtils::ExPolygonsProvider(subject), ClipperUtils::ExPolygonsProvider(clip), do_safety_offset); } Slic3r::Polygons diff(const Slic3r::Surfaces &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset) { return _clipper(ctDifference, ClipperUtils::SurfacesProvider(subject), ClipperUtils::PolygonsProvider(clip), do_safety_offset); } +Slic3r::Polygons diff_expanded(const Slic3r::Polygons &subject, const Slic3r::Polygons &clip, float delta) +{ + if (subject.empty()) + return {}; + // Each path simplified on its own, and kept as it is where simplifying would turn a contour into a hole or back. + Polygons coarse; + for (const Polygon &path : clip) { + Polygons simplified = polygons_simplify({ path }, delta / 8.); + if (!simplified.empty() && (area(simplified) > 0.) != path.is_counter_clockwise()) + coarse.emplace_back(path); + else + append(coarse, std::move(simplified)); + } + // The miter limit argument of a round join is its arc tolerance. + if (diff(subject, expand(coarse, 0.7f * delta, jtRound, 0.01 * delta)).empty()) + return {}; + return diff(subject, expand(clip, delta)); +} Slic3r::Polygons intersection(const Slic3r::Polygon &subject, const Slic3r::Polygon &clip, ApplySafetyOffset do_safety_offset) { return _clipper(ctIntersection, ClipperUtils::SinglePathProvider(subject.points), ClipperUtils::SinglePathProvider(clip.points), do_safety_offset); } Slic3r::Polygons intersection_clipped(const Slic3r::Polygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset) @@ -800,6 +899,114 @@ Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r { return _clipper_ex(ctIntersection, ClipperUtils::SurfacesProvider(subject), ClipperUtils::SurfacesProvider(clip), do_safety_offset); } Slic3r::ExPolygons intersection_ex(const Slic3r::SurfacesPtr &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset) { return _clipper_ex(ctIntersection, ClipperUtils::SurfacesPtrProvider(subject), ClipperUtils::ExPolygonsProvider(clip), do_safety_offset); } + +namespace ClipperUtils { + std::vector tile_expolygons(const ExPolygons &expolygons, size_t per_tile) + { + BoundingBox extent; + std::vector bboxes; + bboxes.reserve(expolygons.size()); + for (const ExPolygon &expoly : expolygons) { + bboxes.emplace_back(get_extents(expoly)); + extent.merge(bboxes.back()); + } + if (! extent.defined) + return {}; + const int tiles = std::clamp(int(std::sqrt(double(expolygons.size()) / double(std::max(per_tile, 1)))), 1, 32); + const Point size = extent.size(); + const coord_t tile_w = std::max(1, size.x() / tiles + 1), tile_h = std::max(1, size.y() / tiles + 1); + std::vector out(size_t(tiles * tiles)); + for (size_t i = 0; i < expolygons.size(); ++ i) { + const Point c = bboxes[i].center(); + ExPolygonsTile &tile = out[size_t(std::clamp(int((c.y() - extent.min.y()) / tile_h), 0, tiles - 1) * tiles + + std::clamp(int((c.x() - extent.min.x()) / tile_w), 0, tiles - 1))]; + tile.members.emplace_back(i); + tile.bbox.merge(bboxes[i]); + } + out.erase(std::remove_if(out.begin(), out.end(), [](const ExPolygonsTile &tile) { return tile.members.empty(); }), out.end()); + return out; + } + + // Between two consecutive heights of its vertices the polygon is a set of trapezoids, and the line through the middle + // of that band meets no vertex and no horizontal edge: its crossings with the edges alternate into and out of the + // polygon, and there each trapezoid is at least half as wide as at its widest. So the bands are tried widest first, + // until the middle of the widest span on that line rounds to a point strictly inside. A band under two units has no + // grid line inside it. + std::optional interior_point(const Polygon &polygon) + { + std::vector heights; + heights.reserve(polygon.size()); + for (const Point &pt : polygon.points) + heights.emplace_back(pt.y()); + std::sort(heights.begin(), heights.end()); + heights.erase(std::unique(heights.begin(), heights.end()), heights.end()); + std::vector> bands; + for (size_t i = 1; i < heights.size(); ++ i) + if (heights[i] - heights[i - 1] >= 2) + bands.emplace_back(heights[i - 1], heights[i]); + std::sort(bands.begin(), bands.end(), [](const auto &a, const auto &b) { return a.second - a.first > b.second - b.first; }); + std::vector crossings; + for (const auto &[low, high] : bands) { + const coord_t y = low + (high - low) / 2; + crossings.clear(); + for (size_t i = 0, j = polygon.size() - 1; i < polygon.size(); j = i ++) { + const Point &a = polygon.points[j]; + const Point &b = polygon.points[i]; + if ((a.y() > y) != (b.y() > y)) + crossings.emplace_back(double(a.x()) + double(y - a.y()) * double(b.x() - a.x()) / double(b.y() - a.y())); + } + std::sort(crossings.begin(), crossings.end()); + // Inside from the first crossing to the second, from the third to the fourth... + double left = 0., right = 0.; + for (size_t i = 1; i < crossings.size(); i += 2) + if (crossings[i] - crossings[i - 1] > right - left) { + left = crossings[i - 1]; + right = crossings[i]; + } + if (const Point pt(coord_t(std::round(0.5 * (left + right))), y); right > left && contains(polygon, pt, false)) + return pt; + } + return std::nullopt; + } +} + +static Slic3r::ExPolygons clipper_ex_by_piece(ClipType clipType, const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset) +{ + // A few dozen subject ExPolygons to a tile, each tile one Clipper call with the clip cut to the tile's box. + const std::vector tiles = ClipperUtils::tile_expolygons(subject, 32); + // One tile is the plain call: cutting the clip would only cost time. + if (tiles.size() <= 1) + return _clipper_ex(clipType, ClipperUtils::ExPolygonsProvider(subject), ClipperUtils::PolygonsProvider(clip), do_safety_offset); + std::vector clip_bboxes; + clip_bboxes.reserve(clip.size()); + for (const Polygon &polygon : clip) + clip_bboxes.emplace_back(get_extents(polygon)); + + std::vector out_tiles(tiles.size()); + tbb::parallel_for(size_t(0), tiles.size(), [&](size_t tile_idx) { + const ClipperUtils::ExPolygonsTile &tile = tiles[tile_idx]; + Slic3r::ExPolygons local_subject; + local_subject.reserve(tile.members.size()); + for (size_t i : tile.members) + local_subject.emplace_back(subject[i]); + // Grown so that the cut edges of the clip stay clear of the subject, also after the safety offset. + const BoundingBox bbox = tile.bbox.inflated(SCALED_EPSILON); + Polygons local_clip; + for (size_t i = 0; i < clip.size(); ++i) + if (clip_bboxes[i].overlap(bbox)) + if (Polygon clipped = ClipperUtils::clip_clipper_polygon_with_subject_bbox(clip[i], bbox); ! clipped.empty()) + local_clip.emplace_back(std::move(clipped)); + out_tiles[tile_idx] = _clipper_ex(clipType, ClipperUtils::ExPolygonsProvider(local_subject), ClipperUtils::PolygonsProvider(local_clip), do_safety_offset); + }); + Slic3r::ExPolygons out; + for (Slic3r::ExPolygons &out_tile : out_tiles) + append(out, std::move(out_tile)); + return out; +} +Slic3r::ExPolygons diff_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset) + { return clipper_ex_by_piece(ctDifference, subject, clip, do_safety_offset); } +Slic3r::ExPolygons intersection_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset) + { return clipper_ex_by_piece(ctIntersection, subject, clip, do_safety_offset); } // May be used to "heal" unusual models (3DLabPrints etc.) by providing fill_type (pftEvenOdd, pftNonZero, pftPositive, pftNegative). Slic3r::ExPolygons union_ex(const Slic3r::Polygons &subject, PolyFillType fill_type) { return _clipper_ex(ctUnion, ClipperUtils::PolygonsProvider(subject), ClipperUtils::EmptyPathsProvider(), ApplySafetyOffset::No, fill_type); } @@ -1007,24 +1214,75 @@ Lines _clipper_ln(ClipType clipType, const Lines &subject, const Polygons &clip) return retval; } -static void traverse_pt_outside_in(const C2::PolyPath64 &parent, Polygons *retval) +// Chains the loops of one level of the tree, each followed by the loops under it, depth first. Clipper2 may put a loop +// beside the loop around it instead of under it (see c2_append_expolygons()), out of the nesting order the callers rely +// on: the spiral of FillSpiralInset continues only into a loop inside the last one. So a loop whose orientation doesn't +// fit its level (CCW under the top or a CW loop, CW under a CCW loop) goes under the smallest loop of the level around +// it, the one Clipper2 failed to put it under, and stays where it is if none is. +static void traverse_pt_outside_in(const std::vector &nodes, bool holes, Polygons *retval) { - // collect ordering points - Points ordering_points; - ordering_points.reserve(parent.Count()); - for (const auto &node : parent) - ordering_points.emplace_back(node->Polygon().front().x, node->Polygon().front().y); + struct Loop + { + const C2::PolyPath64 *node; + double area; + // The loops to traverse under this one: its children, then the misplaced loops it takes in. + std::vector next; + bool moved = false; + }; + std::vector loops; + std::vector fitting, misfits; + loops.reserve(nodes.size()); + for (const C2::PolyPath64 *node : nodes) { + Loop &loop = loops.emplace_back(Loop{ node, C2::Area(node->Polygon()), {} }); + loop.next.reserve(node->Count()); + for (const auto &child : *node) + loop.next.emplace_back(child.get()); + ((loop.area < 0.) == holes ? fitting : misfits).emplace_back(loops.size() - 1); + } + if (! misfits.empty()) { + // Candidates are tried smallest first, from the first one larger than the misplaced loop (see path_encloses()). + std::sort(fitting.begin(), fitting.end(), [&loops](size_t a, size_t b) { return std::abs(loops[a].area) < std::abs(loops[b].area); }); + std::vector bounds(loops.size()); + for (size_t i = 0; i < loops.size(); ++ i) + bounds[i] = C2::GetBounds(loops[i].node->Polygon()); + for (size_t misfit : misfits) { + Loop &loop = loops[misfit]; + const C2::Rect64 &box = bounds[misfit]; + Polygon inner; + inner.points = c2_to_points(loop.node->Polygon()); + for (size_t idx : fitting) { + // The slack of a vertex rounded across the candidate, as in c2_attach_stray_holes(). + const C2::Rect64 &around = bounds[idx]; + if (std::abs(loops[idx].area) <= std::abs(loop.area) || around.left - SCALED_EPSILON > box.left || + around.right + SCALED_EPSILON < box.right || around.top - SCALED_EPSILON > box.top || around.bottom + SCALED_EPSILON < box.bottom) + continue; + Polygon outer; + outer.points = c2_to_points(loops[idx].node->Polygon()); + if (path_encloses(outer, inner)) { + loops[idx].next.emplace_back(loop.node); + loop.moved = true; + break; + } + } + } + } - // Perform the ordering, push results recursively. + // Chain the loops staying on this level, push results recursively. + std::vector staying; + Points ordering_points; + for (size_t i = 0; i < loops.size(); ++ i) + if (! loops[i].moved) { + staying.emplace_back(i); + ordering_points.emplace_back(loops[i].node->Polygon().front().x, loops[i].node->Polygon().front().y); + } //FIXME pass the last point to chain_points? for (size_t idx : chain_points(ordering_points)) { - const C2::PolyPath64 &node = *parent.Child(idx); - retval->emplace_back().points = c2_to_points(node.Polygon()); - if (node.IsHole()) + const Loop &loop = loops[staying[idx]]; + retval->emplace_back().points = c2_to_points(loop.node->Polygon()); + if (loop.area < 0.) // Orient a hole, which is clockwise oriented, to CCW. retval->back().reverse(); - // traverse the next depth - traverse_pt_outside_in(node, retval); + traverse_pt_outside_in(loop.next, loop.area > 0., retval); } } @@ -1032,8 +1290,12 @@ Polygons union_pt_chained_outside_in(const Polygons &subject) { C2::PolyTree64 tree; c2_clip(C2::ClipType::Union, to_paths64(ClipperUtils::PolygonsProvider(subject)), {}, C2::FillRule::EvenOdd, tree); + std::vector top_level; + top_level.reserve(tree.Count()); + for (const auto &node : tree) + top_level.emplace_back(node.get()); Polygons retval; - traverse_pt_outside_in(tree, &retval); + traverse_pt_outside_in(top_level, false, &retval); return retval; } @@ -1070,6 +1332,8 @@ ExPolygons top_level_expolygons(const ExPolygons &expolygons, ExPolygons *nested c2_clip(C2::ClipType::Union, to_paths64(ClipperUtils::ExPolygonsProvider(expolygons)), {}, C2::FillRule::EvenOdd, tree); ExPolygons out; out.reserve(tree.Count()); + const size_t first_nested = nested ? nested->size() : 0; + std::vector stray_holes; for (const auto &outer : tree) { ExPolygon &expoly = out.emplace_back(); expoly.contour.points = c2_to_points(outer->Polygon()); @@ -1077,9 +1341,11 @@ ExPolygons top_level_expolygons(const ExPolygons &expolygons, ExPolygons *nested expoly.holes.emplace_back().points = c2_to_points(hole->Polygon()); if (nested) for (const auto &island : *hole) - c2_append_expolygons(*island, *nested); + c2_append_expolygons(*island, *nested, stray_holes); } } + if (nested) + c2_attach_stray_holes(*nested, first_nested, stray_holes); return out; } diff --git a/src/libslic3r/ClipperUtils.hpp b/src/libslic3r/ClipperUtils.hpp index 26585a1fef..438f753fe4 100644 --- a/src/libslic3r/ClipperUtils.hpp +++ b/src/libslic3r/ClipperUtils.hpp @@ -5,12 +5,14 @@ #include "Polyline.hpp" #include "Line.hpp" #include "libslic3r.h" +#include "BoundingBox.hpp" #include "ExPolygon.hpp" #include "Polygon.hpp" #include "Surface.hpp" #include #include #include +#include #include namespace Slic3r { @@ -332,6 +334,19 @@ namespace ClipperUtils { [[nodiscard]] Polygons clip_clipper_polygons_with_subject_bbox(const ExPolygon &src, const BoundingBox &bbox, const bool get_entire_polygons = false); [[nodiscard]] Polygons clip_clipper_polygons_with_subject_bbox(const ExPolygons &src, const BoundingBox &bbox, const bool get_entire_polygons = false); + // Splits ExPolygons into tiles by the centres of their boxes, about `per_tile` of them to a tile, to run Clipper on a + // layer of many pieces tile by tile. Returns the non-empty tiles, each with the indices of its ExPolygons and their box. + struct ExPolygonsTile + { + BoundingBox bbox; + std::vector members; + }; + [[nodiscard]] std::vector tile_expolygons(const ExPolygons &expolygons, size_t per_tile); + + // A grid point strictly inside the polygon, or none if the polygon is at most a few units thick everywhere. + // Decides on which side of another path a path lies when every one of its vertices touches that path. + [[nodiscard]] std::optional interior_point(const Polygon &polygon); + } // offset Polygons @@ -343,7 +358,8 @@ Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinT // Input polygons for negative offset shall be "normalized": There must be no overlap / intersections between the input polygons. Slic3r::Polygons offset(const Slic3r::Polyline &polyline, const float delta, JoinType joinType = DefaultLineJoinType, double miterLimit = DefaultLineMiterLimit, EndType end_type = DefaultEndType); Slic3r::Polygons offset(const Slic3r::Polyline3 &polyline, const float delta, JoinType joinType = DefaultLineJoinType, double miterLimit = DefaultLineMiterLimit, EndType end_type = DefaultEndType); -Slic3r::Polygons offset(const Slic3r::Polylines &polylines, const float delta, JoinType joinType = DefaultLineJoinType, double miterLimit = DefaultLineMiterLimit, EndType end_type = DefaultEndType); +// cap_tolerance: the arc tolerance of round end caps when joinType is not jtRound, 0 for the default. +Slic3r::Polygons offset(const Slic3r::Polylines &polylines, const float delta, JoinType joinType = DefaultLineJoinType, double miterLimit = DefaultLineMiterLimit, EndType end_type = DefaultEndType, double cap_tolerance = 0.); Slic3r::Polygons offset(const Slic3r::Polygons &polygons, const float delta, JoinType joinType = DefaultJoinType, double miterLimit = DefaultMiterLimit); Slic3r::Polygons offset(const Slic3r::ExPolygon &expolygon, const float delta, JoinType joinType = DefaultJoinType, double miterLimit = DefaultMiterLimit); Slic3r::Polygons offset(const Slic3r::ExPolygons &expolygons, const float delta, JoinType joinType = DefaultJoinType, double miterLimit = DefaultMiterLimit); @@ -447,6 +463,12 @@ Slic3r::ExPolygons diff_clipped(const Slic3r::ExPolygons &src, const Slic3r::ExP Slic3r::Polygons diff(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); Slic3r::Polygons diff(const Slic3r::ExPolygons &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); Slic3r::Polygons diff(const Slic3r::Surfaces &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); +// The part of subject farther than delta from clip, as diff(subject, expand(clip, delta)). Expanding finely detailed polygons by +// a large delta is slow, so a cheaper, smaller round expansion of the simplified clip, which lies within the full one, is tried +// first: where it covers the subject, so does the full expansion. That holds as long as both expansions grow the regions their +// paths enclose; the offsets' own input decimation can fold a sliver thinner than about 0.01 * delta and break it, so the +// result may then differ from diff with expand. Callers use it where such a difference cannot matter. +Slic3r::Polygons diff_expanded(const Slic3r::Polygons &subject, const Slic3r::Polygons &clip, float delta); Slic3r::ExPolygons diff_ex(const Slic3r::Polygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); Slic3r::ExPolygons diff_ex(const Slic3r::Polygons &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); Slic3r::ExPolygons diff_ex(const Slic3r::Polygons &subject, const Slic3r::Surfaces &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); @@ -527,6 +549,11 @@ Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); Slic3r::ExPolygons intersection_ex(const Slic3r::Surfaces &subject, const Slic3r::Surfaces &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); Slic3r::ExPolygons intersection_ex(const Slic3r::SurfacesPtr &subject, const Slic3r::ExPolygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); +// diff_ex() / intersection_ex() of the subject split into tiles, each against only the part of the clip near it, the tiles in +// parallel. The same area as the operation on the whole subject when its ExPolygons do not overlap, and much faster for a +// subject of thousands of pieces spread over a layer: Clipper slows down with the number of edges crossing a scan line. +Slic3r::ExPolygons diff_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); +Slic3r::ExPolygons intersection_ex_by_piece(const Slic3r::ExPolygons &subject, const Slic3r::Polygons &clip, ApplySafetyOffset do_safety_offset = ApplySafetyOffset::No); Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::Polygon &clip); Slic3r::Polylines intersection_pl(const Slic3r::Polyline &subject, const Slic3r::ExPolygon &clip); Slic3r::Polylines intersection_pl(const Slic3r::Polylines &subject, const Slic3r::ExPolygon &clip); diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 9d76262ec6..495fac2263 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -37,6 +37,7 @@ #include #include +#include #include // The serialize() members below archive ConfigOption hierarchies through // cereal::base_class, whose registration machinery lives in polymorphic.hpp. @@ -377,7 +378,8 @@ public: virtual void set(const ConfigOption* rhs, size_t start, size_t len) = 0; virtual void set_with_restore(const ConfigOptionVectorBase* rhs, std::vector& restore_index, int stride) = 0; virtual void set_with_restore_2(const ConfigOptionVectorBase* rhs, std::vector& restore_index, int start, int len, bool skip_error = false) = 0; - virtual void set_only_diff(const ConfigOptionVectorBase* rhs, std::vector& diff_index, int stride) = 0; + // keep_nil: copy a nil column from rhs as well, for options whose nil means "disabled" rather than "inherit". + virtual void set_only_diff(const ConfigOptionVectorBase* rhs, std::vector& diff_index, int stride, bool keep_nil = false) = 0; virtual void set_to_index(const ConfigOptionVectorBase* rhs, std::vector& dest_index, int stride) = 0; virtual void set_with_nil(const ConfigOptionVectorBase* rhs, const ConfigOptionVectorBase* inherits, int stride) = 0; // Resize the vector of values, copy the newly added values from opt_default if provided. @@ -580,7 +582,7 @@ public: //set a item related with extruder variants when loading user config, only set the different value of some extruder //rhs: item from user config //diff_index: which index in this vector need to be set - virtual void set_only_diff(const ConfigOptionVectorBase* rhs, std::vector& diff_index, int stride) override + virtual void set_only_diff(const ConfigOptionVectorBase* rhs, std::vector& diff_index, int stride, bool keep_nil) override { if (rhs->type() == this->type()) { // Assign the first value of the rhs vector. @@ -592,7 +594,7 @@ public: for (size_t i = 0; i < diff_index.size(); i++) { if (diff_index[i] != -1) { for (size_t j = 0; j < stride; j++) { - if (!other->is_nil(diff_index[i] * stride)) + if (keep_nil || !other->is_nil(diff_index[i] * stride)) this->values[i * stride + j] = other->values[diff_index[i] * stride + j]; } } @@ -841,8 +843,12 @@ public: { UNUSED(append); std::istringstream iss(str); - iss >> this->value; - return !iss.fail(); + double value; + iss >> value; + if (iss.fail()) + return false; + this->value = value; + return true; } bool operator==(const ConfigOption &rhs) const override @@ -1033,8 +1039,12 @@ public: { UNUSED(append); std::istringstream iss(str); - iss >> this->value; - return !iss.fail(); + int value; + iss >> value; + if (iss.fail()) + return false; + this->value = value; + return true; } ConfigOptionInt& operator=(const ConfigOption *opt) @@ -1252,8 +1262,12 @@ public: UNUSED(append); // don't try to parse the trailing % since it's optional std::istringstream iss(str); - iss >> this->value; - return !iss.fail(); + double value; + iss >> value; + if (iss.fail()) + return false; + this->value = value; + return true; } private: @@ -1365,10 +1379,14 @@ public: bool deserialize(const std::string &str, bool append = false) override { UNUSED(append); - this->percent = str.find_first_of("%") != std::string::npos; std::istringstream iss(str); - iss >> this->value; - return !iss.fail(); + double value; + iss >> value; + if (iss.fail()) + return false; + this->value = value; + this->percent = str.find_first_of("%") != std::string::npos; + return true; } private: @@ -1538,8 +1556,12 @@ public: { UNUSED(append); char dummy; - return sscanf(str.data(), " %lf , %lf %c", &this->value(0), &this->value(1), &dummy) == 2 || - sscanf(str.data(), " %lf x %lf %c", &this->value(0), &this->value(1), &dummy) == 2; + Vec2d value; + if (sscanf(str.data(), " %lf , %lf %c", &value(0), &value(1), &dummy) != 2 && + sscanf(str.data(), " %lf x %lf %c", &value(0), &value(1), &dummy) != 2) + return false; + this->value = value; + return true; } private: @@ -1594,6 +1616,11 @@ public: bool deserialize(const std::string &str, bool append = false) override { + // Extended exclusion-volume syntax belongs to the dedicated string option. + // Rejecting it here also makes --bed-exclude-area fail instead of silently + // turning a volume definition into malformed legacy points. + if (str.find('|') != std::string::npos || str.find(';') != std::string::npos || str.find("..") != std::string::npos) + return false; if (! append) this->values.clear(); std::istringstream is(str); @@ -1614,18 +1641,18 @@ public: } private: - friend class cereal::access; - template void save(Archive& archive) const { - size_t cnt = this->values.size(); - archive(cnt); - archive.saveBinary((const char*)this->values.data(), sizeof(Vec2d) * cnt); - } - template void load(Archive& archive) { - size_t cnt; - archive(cnt); - this->values.assign(cnt, Vec2d()); - archive.loadBinary((char*)this->values.data(), sizeof(Vec2d) * cnt); - } + friend class cereal::access; + template void save(Archive& archive) const { + size_t cnt = this->values.size(); + archive(cnt); + archive.saveBinary((const char*)this->values.data(), sizeof(Vec2d) * cnt); + } + template void load(Archive& archive) { + size_t cnt; + archive(cnt); + this->values.assign(cnt, Vec2d()); + archive.loadBinary((char*)this->values.data(), sizeof(Vec2d) * cnt); + } }; class ConfigOptionPoint3 : public ConfigOptionSingle @@ -1658,8 +1685,12 @@ public: { UNUSED(append); char dummy; - return sscanf(str.data(), " %lf , %lf , %lf %c", &this->value(0), &this->value(1), &this->value(2), &dummy) == 3 || - sscanf(str.data(), " %lf x %lf x %lf %c", &this->value(0), &this->value(1), &this->value(2), &dummy) == 3; + Vec3d value; + if (sscanf(str.data(), " %lf , %lf , %lf %c", &value(0), &value(1), &value(2), &dummy) != 3 && + sscanf(str.data(), " %lf x %lf x %lf %c", &value(0), &value(1), &value(2), &dummy) != 3) + return false; + this->value = value; + return true; } private: diff --git a/src/libslic3r/ConnectedBodies.cpp b/src/libslic3r/ConnectedBodies.cpp index 8cfe5a3e43..e9fe96511d 100644 --- a/src/libslic3r/ConnectedBodies.cpp +++ b/src/libslic3r/ConnectedBodies.cpp @@ -89,11 +89,14 @@ std::vector> connected_bodies(const std::vector order(m_boxes.size()); for (size_t i = 0; i < order.size(); ++i) diff --git a/src/libslic3r/ConnectedBodies.hpp b/src/libslic3r/ConnectedBodies.hpp index a420401d28..d6f43a8bb5 100644 --- a/src/libslic3r/ConnectedBodies.hpp +++ b/src/libslic3r/ConnectedBodies.hpp @@ -26,7 +26,9 @@ class IslandLocator { public: // The islands must outlive the locator. Their boxes are widened by the margin, for points reaching past an outline. - IslandLocator(const ExPolygons &islands, coord_t margin); + // A caller that needs only to know that some island holds a point, not which one, need not tell them apart: then the + // box of every island vouches for it unless the call is strict. + IslandLocator(const ExPolygons &islands, coord_t margin, bool tell_apart = true); // Whether the island holds the point, or its box does where no other box reaches unless strict. bool holds(size_t island, const Point &point, bool strict = false) const; // The island holding the point as above, else the nearest one whose box holds it, with the squared distance to it; -1 diff --git a/src/libslic3r/EdgeGrid.cpp b/src/libslic3r/EdgeGrid.cpp index c6e003505a..35d3608dd8 100644 --- a/src/libslic3r/EdgeGrid.cpp +++ b/src/libslic3r/EdgeGrid.cpp @@ -616,7 +616,7 @@ struct PropagateDanielssonSingleStep { if ((signs[addr] & 2) == 0) { float *v = &L[addr << 1]; float l = v[0] * v[0] + v[1] * v[1]; - float *v2s = v + (addr_delta << 1); + float *v2s = v + 2 * addr_delta; float v2[2] = { v2s[0] + INCX * resolution, v2s[1] + INCY * resolution diff --git a/src/libslic3r/ExclusionVolumeGeometry.cpp b/src/libslic3r/ExclusionVolumeGeometry.cpp new file mode 100644 index 0000000000..cee9f9506f --- /dev/null +++ b/src/libslic3r/ExclusionVolumeGeometry.cpp @@ -0,0 +1,182 @@ +#include "ExclusionVolumeGeometry.hpp" +#include "ExPolygon.hpp" +#include "Point.hpp" +#include "Polygon.hpp" +#include "PrintConfig.hpp" +#include "libslic3r.h" +#include +#include +#include + +#include "BoundingBox.hpp" +#include "ClipperUtils.hpp" +#include "Geometry/ConvexHull.hpp" +#include "Print.hpp" + +#include +#include +#include + +namespace Slic3r { + +namespace { + +constexpr double Z_EPSILON_MM = 1e-6; + +void append_active_footprints( + Polygons &out, + const std::vector ®ions, + const double z_min, + const double z_max, + const Point &translation) +{ + for (const BedExcludeRegion ®ion : regions) { + if (region.polygon.points.size() < 3 || region.z_max < region.z_min || + !bed_exclusion_z_ranges_overlap(z_min, z_max, region.z_min, region.z_max)) + continue; + + Polygon footprint = region.polygon; + footprint.translate(translation); + out.emplace_back(std::move(footprint)); + } +} + +ExPolygons union_active_footprints(Polygons footprints, const coord_t clearance) +{ + if (footprints.empty()) + return {}; + + ExPolygons result = union_ex(footprints); + if (clearance > 0) + result = offset_ex(result, float(clearance)); + return result; +} + +} // namespace + +bool bed_exclusion_z_ranges_overlap( + double first_min, + double first_max, + double second_min, + double second_max) +{ + if (first_min > first_max) + std::swap(first_min, first_max); + if (second_min > second_max) + std::swap(second_min, second_max); + return first_max >= second_min - Z_EPSILON_MM && first_min <= second_max + Z_EPSILON_MM; +} + +Polygon bed_exclusion_arrange_polygon(const Polygon &polygon) +{ + if (polygon.points.size() < 3) + return polygon; + + const Polygon convex_hull = Geometry::convex_hull(polygon.points); + const double polygon_area = std::abs(polygon.area()); + const double hull_area = std::abs(convex_hull.area()); + const double tolerance = std::max(1.0, hull_area) * 1e-12; + if (std::abs(hull_area - polygon_area) <= tolerance) + return polygon; + + return get_extents(polygon).polygon(); +} + +ExPolygons active_bed_exclusion_footprints( + const std::vector ®ions, + const double z_min, + const double z_max, + const Point &translation, + const coord_t clearance) +{ + Polygons footprints; + footprints.reserve(regions.size()); + append_active_footprints(footprints, regions, z_min, z_max, translation); + return union_active_footprints(std::move(footprints), clearance); +} + +ExPolygons active_bed_exclusion_footprints( + const std::vector> ®ions_by_extruder, + const std::vector &physical_extruders, + const double z_min, + const double z_max, + const Point &translation, + const coord_t clearance) +{ + Polygons footprints; + std::vector visited(regions_by_extruder.size(), false); + for (const size_t extruder_id : physical_extruders) { + if (extruder_id >= regions_by_extruder.size() || visited[extruder_id]) + continue; + visited[extruder_id] = true; + const std::vector ®ions = regions_by_extruder[extruder_id]; + footprints.reserve(footprints.size() + regions.size()); + append_active_footprints(footprints, regions, z_min, z_max, translation); + } + return union_active_footprints(std::move(footprints), clearance); +} + +std::vector bed_exclusion_physical_extruders( + const Print &print, + const std::vector &filament_ids, + const size_t physical_extruder_count, + const int layer_id) +{ + if (physical_extruder_count == 0) + return {}; + + std::vector result; + const auto grouping = print.get_layered_nozzle_group_result(); + const bool automatic_mapping_resolved = + !is_auto_filament_map_mode(print.get_filament_map_mode()) || !print.is_BBL_printer() || + print.get_nozzle_group_result() != nullptr; + bool unresolved = filament_ids.empty(); + + for (const unsigned int filament_id : filament_ids) { + if (grouping) { + if (const auto nozzle = grouping->get_nozzle_for_filament(int(filament_id), layer_id); + nozzle.has_value() && nozzle->extruder_id >= 0 && + size_t(nozzle->extruder_id) < physical_extruder_count) { + result.emplace_back(size_t(nozzle->extruder_id)); + continue; + } + } + + const int resolved = bed_exclusion_extruder_for_filament( + filament_id, print.get_filament_maps(), print.get_filament_map_mode(), print.is_BBL_printer(), + automatic_mapping_resolved, physical_extruder_count); + if (resolved >= 0) + result.emplace_back(size_t(resolved)); + else + unresolved = true; + } + + std::sort(result.begin(), result.end()); + result.erase(std::unique(result.begin(), result.end()), result.end()); + if (!unresolved && !result.empty()) + return result; + + result.resize(physical_extruder_count); + std::iota(result.begin(), result.end(), size_t(0)); + return result; +} + +ExPolygons active_bed_exclusion_footprints_for_object( + const PrintObject &object, + const std::vector> ®ions_by_extruder, + const std::vector &physical_extruders, + const double z_min, + const double z_max, + const coord_t clearance) +{ + ExPolygons result; + for (const PrintInstance &instance : object.instances()) { + const Point instance_shift = instance.shift_without_plate_offset(); + const Point shift(-instance_shift.x(), -instance_shift.y()); + expolygons_append(result, active_bed_exclusion_footprints( + regions_by_extruder, physical_extruders, z_min, z_max, shift, clearance)); + } + return result.empty() ? ExPolygons{} : union_ex(result); +} + +} // namespace Slic3r diff --git a/src/libslic3r/ExclusionVolumeGeometry.hpp b/src/libslic3r/ExclusionVolumeGeometry.hpp new file mode 100644 index 0000000000..fc745bb5dd --- /dev/null +++ b/src/libslic3r/ExclusionVolumeGeometry.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include "ExPolygon.hpp" +#include "Polygon.hpp" +#include "libslic3r.h" +#include "Point.hpp" +#include "PrintConfig.hpp" + +#include +#include + +namespace Slic3r { + +class Print; +class PrintObject; + +bool bed_exclusion_z_ranges_overlap(double first_min, double first_max, double second_min, double second_max); + +// libnest2d currently accepts only convex fixed obstacles. Keep convex +// exclusions exact and conservatively use the bounding box for concave ones. +Polygon bed_exclusion_arrange_polygon(const Polygon &polygon); + +// Return the union of exclusion footprints intersecting the requested extrusion +// slab. Regions are already resolved into physical-nozzle/model coordinates by +// PrintConfig; callers only provide the physical nozzles that may emit the +// generated geometry and the translation into the caller's coordinate space. +ExPolygons active_bed_exclusion_footprints( + const std::vector ®ions, + double z_min, + double z_max, + const Point &translation = Point(0, 0), + coord_t clearance = 0); + +ExPolygons active_bed_exclusion_footprints( + const std::vector> ®ions_by_extruder, + const std::vector &physical_extruders, + double z_min, + double z_max, + const Point &translation = Point(0, 0), + coord_t clearance = 0); + +// Resolve logical filaments to every physical extruder which may print them. +// An unresolved automatic mapping deliberately returns every physical +// extruder, keeping generated geometry conservative until tool assignment is +// known. +std::vector bed_exclusion_physical_extruders( + const Print &print, + const std::vector &filament_ids, + size_t physical_extruder_count, + int layer_id = -1); + +// Exclusion areas are stored in bed coordinates while generated support is +// shared in PrintObject coordinates. Return the conservative union transformed +// for every instance of the object. +ExPolygons active_bed_exclusion_footprints_for_object( + const PrintObject &object, + const std::vector> ®ions_by_extruder, + const std::vector &physical_extruders, + double z_min, + double z_max, + coord_t clearance = 0); + +} // namespace Slic3r diff --git a/src/libslic3r/ExtrusionEntity.hpp b/src/libslic3r/ExtrusionEntity.hpp index d7dac99364..73e06d7d45 100644 --- a/src/libslic3r/ExtrusionEntity.hpp +++ b/src/libslic3r/ExtrusionEntity.hpp @@ -156,13 +156,19 @@ public: virtual double length() const = 0; virtual double total_volume() const = 0; - // Orca: Used for inner/outer/inner mode - classic perimeter generator + // Orca: Wall index set by the perimeter generators, 0 for the outer wall, -1 if unset int inset_idx = -1; static std::string role_to_string(ExtrusionRole role); static ExtrusionRole string_to_role(const std::string_view role); }; +// Orca: Overhang paths share one role on every wall, so the inset index tells inner walls apart where set. +inline bool is_inner_wall(const ExtrusionEntity &entity) +{ + return entity.inset_idx >= 0 ? entity.inset_idx > 0 : entity.role() == erPerimeter; +} + typedef std::vector ExtrusionEntitiesPtr; class ExtrusionPath : public ExtrusionEntity @@ -395,21 +401,23 @@ public: ExtrusionPaths paths; ExtrusionMultiPath() {} - ExtrusionMultiPath(const ExtrusionMultiPath &rhs) : paths(rhs.paths), m_can_reverse(rhs.m_can_reverse) {} - ExtrusionMultiPath(ExtrusionMultiPath &&rhs) : paths(std::move(rhs.paths)), m_can_reverse(rhs.m_can_reverse) {} + ExtrusionMultiPath(const ExtrusionMultiPath &rhs) : ExtrusionEntity(rhs), paths(rhs.paths), m_can_reverse(rhs.m_can_reverse) {} + ExtrusionMultiPath(ExtrusionMultiPath &&rhs) : ExtrusionEntity(rhs), paths(std::move(rhs.paths)), m_can_reverse(rhs.m_can_reverse) {} ExtrusionMultiPath(const ExtrusionPaths &paths) : paths(paths) {} ExtrusionMultiPath(const ExtrusionPath &path) {this->paths.push_back(path); m_can_reverse = path.can_reverse(); } ExtrusionMultiPath &operator=(const ExtrusionMultiPath &rhs) { - this->paths = rhs.paths; - m_can_reverse = rhs.m_can_reverse; + this->paths = rhs.paths; + m_can_reverse = rhs.m_can_reverse; + this->inset_idx = rhs.inset_idx; return *this; } ExtrusionMultiPath &operator=(ExtrusionMultiPath &&rhs) { - this->paths = std::move(rhs.paths); - m_can_reverse = rhs.m_can_reverse; + this->paths = std::move(rhs.paths); + m_can_reverse = rhs.m_can_reverse; + this->inset_idx = rhs.inset_idx; return *this; } diff --git a/src/libslic3r/Fill/FillTpmsAdaptive.cpp b/src/libslic3r/Fill/AdaptiveInfillField.cpp similarity index 91% rename from src/libslic3r/Fill/FillTpmsAdaptive.cpp rename to src/libslic3r/Fill/AdaptiveInfillField.cpp index 2dcd2930b9..1f5ea234d3 100644 --- a/src/libslic3r/Fill/FillTpmsAdaptive.cpp +++ b/src/libslic3r/Fill/AdaptiveInfillField.cpp @@ -1,4 +1,4 @@ -#include "FillTpmsAdaptive.hpp" +#include "AdaptiveInfillField.hpp" #include #include @@ -146,11 +146,11 @@ void rasterize(const ExPolygons &expolygons, const Vec2d &origin, double cell, i } // Scale of the pattern relative to the surface at a depth from 0 at the surface to 1 at the deepest point. -double target_scale(double ratio, TpmsAdaptiveGradient gradient, double depth) +double target_scale(double ratio, AdaptiveInfillGradient gradient, double depth) { switch (gradient) { - case TpmsAdaptiveGradient::Quadratic: return 1. + (ratio - 1.) * depth * depth; - case TpmsAdaptiveGradient::Exponential: return std::pow(ratio, depth); + case AdaptiveInfillGradient::Quadratic: return 1. + (ratio - 1.) * depth * depth; + case AdaptiveInfillGradient::Exponential: return std::pow(ratio, depth); default: return 1. + (ratio - 1.) * depth; } } @@ -159,7 +159,7 @@ double target_scale(double ratio, TpmsAdaptiveGradient gradient, double depth) // continuous level of the target of a depth. struct DensityLevels { - DensityLevels(double ratio, double step, TpmsAdaptiveGradient gradient) + DensityLevels(double ratio, double step, AdaptiveInfillGradient gradient) : ratio(ratio), gradient(gradient), count(int(std::ceil(std::abs(std::log(ratio)) / std::log(step) - EPSILON))) {} @@ -170,7 +170,7 @@ struct DensityLevels } double ratio; - TpmsAdaptiveGradient gradient; + AdaptiveInfillGradient gradient; int count; }; @@ -212,12 +212,12 @@ private: } // namespace -TpmsRadialField::TpmsRadialField(const std::vector &slices, const BoundingBox &bbox, TpmsAdaptiveMode mode, +AdaptiveInfillField::AdaptiveInfillField(const std::vector &slices, const BoundingBox &bbox, AdaptiveInfillMode mode, const std::function &throw_if_canceled) : m_mode(mode) - , m_axis(mode == TpmsAdaptiveMode::NormalX ? 0 : mode == TpmsAdaptiveMode::NormalY ? 1 : mode == TpmsAdaptiveMode::NormalZ ? 2 : -1) + , m_axis(mode == AdaptiveInfillMode::NormalX ? 0 : mode == AdaptiveInfillMode::NormalY ? 1 : mode == AdaptiveInfillMode::NormalZ ? 2 : -1) { - assert(!slices.empty() && mode != TpmsAdaptiveMode::Disabled); + assert(!slices.empty() && mode != AdaptiveInfillMode::Disabled); const Vec3d min(unscaled(bbox.min.x()), unscaled(bbox.min.y()), slices.front().bottom_z); const Vec3d extent = Vec3d(unscaled(bbox.max.x()), unscaled(bbox.max.y()), slices.back().top_z) - min; @@ -269,7 +269,7 @@ TpmsRadialField::TpmsRadialField(const std::vector &slices, const Boundin // Bodies are the connected inside nodes, none of which is on the border. The deepest nodes of a body are the // centers of its lobes, unless the depth between them stays above NeckRatio; where the depth ties, the center // is the node nearest to the middle of the tied nodes. - const bool lobes = m_mode != TpmsAdaptiveMode::SteppedShells && m_mode != TpmsAdaptiveMode::SmoothBlend; + const bool lobes = m_mode != AdaptiveInfillMode::SteppedShells && m_mode != AdaptiveInfillMode::SmoothBlend; m_body.assign(depth.size(), -1); std::vector body_nodes; for (size_t seed = 0; seed < depth.size(); ++seed) { @@ -341,7 +341,7 @@ TpmsRadialField::TpmsRadialField(const std::vector &slices, const Boundin } throw_if_canceled(); - if (m_mode == TpmsAdaptiveMode::SteppedShells || m_mode == TpmsAdaptiveMode::SmoothBlend || m_mode == TpmsAdaptiveMode::DistanceWarp) { + if (m_mode == AdaptiveInfillMode::SteppedShells || m_mode == AdaptiveInfillMode::SmoothBlend || m_mode == AdaptiveInfillMode::DistanceWarp) { m_depth.assign(depth.size(), 0.f); for (size_t i = 0; i < depth.size(); ++i) if (m_body[i] >= 0) @@ -421,7 +421,7 @@ TpmsRadialField::TpmsRadialField(const std::vector &slices, const Boundin lobe.reach.resize(log_reach.size()); std::transform(log_reach.begin(), log_reach.end(), lobe.reach.begin(), [](double v) { return float(std::exp(v)); }); - if (m_mode == TpmsAdaptiveMode::DistanceWarp) { + if (m_mode == AdaptiveInfillMode::DistanceWarp) { std::vector mean(log_reach.size() * (Samples + 1)); for (size_t d = 0; d < log_reach.size(); ++d) { const Vec3d dir = direction(int(d) / Azimuth, int(d) % Azimuth); @@ -488,7 +488,7 @@ TpmsRadialField::TpmsRadialField(const std::vector &slices, const Boundin } } -double TpmsRadialField::depth(const Vec3d &pt) const +double AdaptiveInfillField::depth(const Vec3d &pt) const { assert(!m_depth.empty()); const Vec3d f = (pt - m_origin) / m_cell; @@ -508,7 +508,7 @@ double TpmsRadialField::depth(const Vec3d &pt) const return value; } -Vec3d TpmsRadialField::offset(const Vec3d &pt, const Vec3d ¢er) const +Vec3d AdaptiveInfillField::offset(const Vec3d &pt, const Vec3d ¢er) const { Vec3d d = pt - center; if (m_axis >= 0) @@ -516,7 +516,7 @@ Vec3d TpmsRadialField::offset(const Vec3d &pt, const Vec3d ¢er) const return d; } -double TpmsRadialField::radial(const Lobe &lobe, const Vec3d &pt) const +double AdaptiveInfillField::radial(const Lobe &lobe, const Vec3d &pt) const { const Vec3d d = this->offset(pt, lobe.center); const double r = d.norm(); @@ -562,7 +562,7 @@ double TpmsRadialField::radial(const Lobe &lobe, const Vec3d &pt) const return warp(mean); } -size_t TpmsRadialField::radial(const Vec3d &pt, Radials &out) const +size_t AdaptiveInfillField::radial(const Vec3d &pt, Radials &out) const { assert(!this->empty()); Vec3i32 idx; @@ -588,7 +588,7 @@ size_t TpmsRadialField::radial(const Vec3d &pt, Radials &out) const return count; } -size_t TpmsRadialField::body_radial(size_t node, const Vec3d &pt, float weight, Radial *out) const +size_t AdaptiveInfillField::body_radial(size_t node, const Vec3d &pt, float weight, Radial *out) const { const Body &body = m_bodies[m_body[node]]; if (body.lobes == 1) { @@ -641,7 +641,7 @@ struct AdaptiveTpmsField const long gsize = std::lround(gsizef / rsizef); const AdaptiveTpms &tpms; - const TpmsRadialField &radial_field; + const AdaptiveInfillField &radial_field; RadialScale scale; DensityLevels levels; Point size; @@ -650,7 +650,7 @@ struct AdaptiveTpmsField double cos_angle; double sin_angle; - AdaptiveTpmsField(const AdaptiveTpms &tpms, const TpmsRadialField &radial_field, const BoundingBox &bbox, coordf_t z, float angle) + AdaptiveTpmsField(const AdaptiveTpms &tpms, const AdaptiveInfillField &radial_field, const BoundingBox &bbox, coordf_t z, float angle) : tpms(tpms), radial_field(radial_field), scale(tpms, radial_field.axis() < 0 ? 3 : 2) , levels(std::max(tpms.interior_frequency / tpms.surface_frequency, 1e-3), BlendRatio, tpms.gradient) , size(bbox.size()), offs(bbox.min), z(z) @@ -666,7 +666,7 @@ struct AdaptiveTpmsField const double x = unscaled(pt.x()); const double y = unscaled(pt.y()); const Vec3d obj(cos_angle * x - sin_angle * y, sin_angle * x + cos_angle * y, z); - if (radial_field.mode() == TpmsAdaptiveMode::SmoothBlend) { + if (radial_field.mode() == AdaptiveInfillMode::SmoothBlend) { // The regular patterns of the two levels around the target of the depth, blended by a smoothstep. auto lattice = [this, x, y](int level) { const double frequency = tpms.surface_frequency * levels.scale(level); @@ -681,7 +681,7 @@ struct AdaptiveTpmsField return float((w < 1. ? (1. - w) * lattice(k) : 0.) + (w > 0. ? w * lattice(k + 1) : 0.)); } const int axis = radial_field.axis(); - TpmsRadialField::Radials radials; + AdaptiveInfillField::Radials radials; const size_t count = radial_field.radial(obj, radials); float value = 0.f; for (size_t i = 0; i < count; ++i) { @@ -708,20 +708,20 @@ template<> struct _RasterTraits }; // Continuous density level of the depth over a layer, in the object frame. -struct TpmsLevelField +struct AdaptiveLevelField { static constexpr float gsizef = 0.5f; static constexpr float rsizef = 0.05f; const coord_t rsize = scaled(rsizef); const long gsize = std::lround(gsizef / rsizef); - const TpmsRadialField &field; + const AdaptiveInfillField &field; const DensityLevels &levels; Point size; Point offs; double z; - TpmsLevelField(const TpmsRadialField &field, const DensityLevels &levels, const BoundingBox &bbox, coordf_t z) + AdaptiveLevelField(const AdaptiveInfillField &field, const DensityLevels &levels, const BoundingBox &bbox, coordf_t z) : field(field), levels(levels), size(bbox.size()), offs(bbox.min), z(z) {} @@ -736,19 +736,19 @@ struct TpmsLevelField inline Point to_Point(const Coord &p) const { return Point(to_coord(p.c) + offs.x(), to_coord(p.r) + offs.y()); } }; -template<> struct _RasterTraits +template<> struct _RasterTraits { using ValueType = float; - static float get(const TpmsLevelField &sf, size_t row, size_t col) { return sf.get_scalar(Coord(long(row), long(col))); } - static size_t rows(const TpmsLevelField &sf) { return sf.to_coordr(sf.size.y()); } - static size_t cols(const TpmsLevelField &sf) { return sf.to_coordr(sf.size.x()); } + static float get(const AdaptiveLevelField &sf, size_t row, size_t col) { return sf.get_scalar(Coord(long(row), long(col))); } + static size_t rows(const AdaptiveLevelField &sf) { return sf.to_coordr(sf.size.y()); } + static size_t cols(const AdaptiveLevelField &sf) { return sf.to_coordr(sf.size.x()); } }; } // namespace marchsq namespace Slic3r { -Polylines make_adaptive_tpms(const AdaptiveTpms &tpms, const TpmsRadialField &field, BoundingBox bbox, +Polylines make_adaptive_tpms(const AdaptiveTpms &tpms, const AdaptiveInfillField &field, BoundingBox bbox, coordf_t z, coordf_t layer_height, coordf_t spacing, float angle) { // A cell of margin for the rings closed along the raster border, and a fixed sampling grid for every region. @@ -775,21 +775,21 @@ Polylines make_adaptive_tpms(const AdaptiveTpms &tpms, const TpmsRadialField &fi return polylines; } -std::vector make_tpms_shells(const TpmsRadialField &field, const ExPolygon &expolygon, coordf_t z, - float surface_density, float interior_density, TpmsAdaptiveGradient gradient) +std::vector make_adaptive_infill_shells(const AdaptiveInfillField &field, const ExPolygon &expolygon, coordf_t z, + float surface_density, float interior_density, AdaptiveInfillGradient gradient) { const DensityLevels levels(interior_density / surface_density, ShellRatio, gradient); if (levels.count == 0) return {{surface_density, {expolygon}}}; // A fixed sampling grid, so that every region of a layer gets the same shells. - const coord_t cell = scaled(marchsq::TpmsLevelField::gsizef); + const coord_t cell = scaled(marchsq::AdaptiveLevelField::gsizef); BoundingBox bbox = get_extents(expolygon); bbox.offset(cell); bbox.merge(align_to_grid(bbox.min, Point(cell, cell))); - const marchsq::TpmsLevelField raster(field, levels, bbox, z); + const marchsq::AdaptiveLevelField raster(field, levels, bbox, z); // Each level takes the part deeper than the middle between it and the previous one. - std::vector shells; + std::vector shells; ExPolygons remaining{expolygon}; for (int level = 0; level < levels.count && !remaining.empty(); ++level) { Polygons deeper; @@ -808,12 +808,12 @@ std::vector make_tpms_shells(const TpmsRadialField &field, const ExPo return shells; } -void fill_tpms_shells(const TpmsRadialField &field, const ExPolygon &expolygon, coordf_t z, const FillParams ¶ms, coordf_t spacing, +void fill_adaptive_infill_shells(const AdaptiveInfillField &field, const ExPolygon &expolygon, coordf_t z, const FillParams ¶ms, coordf_t spacing, const std::function &fill_shell) { FillParams shell_params = params; - shell_params.tpms_adaptive = TpmsAdaptiveMode::Disabled; - for (const TpmsShell &shell : make_tpms_shells(field, expolygon, z, params.density, params.tpms_interior_density, params.tpms_adaptive_gradient)) { + shell_params.adaptive_infill_mode = AdaptiveInfillMode::Disabled; + for (const AdaptiveInfillShell &shell : make_adaptive_infill_shells(field, expolygon, z, params.density, params.adaptive_infill_interior_density, params.adaptive_infill_gradient)) { shell_params.density = shell.density; for (const ExPolygon &part : offset_ex(shell.expolygons, -float(scale_(0.5 * spacing)))) fill_shell(shell_params, part); diff --git a/src/libslic3r/Fill/FillTpmsAdaptive.hpp b/src/libslic3r/Fill/AdaptiveInfillField.hpp similarity index 84% rename from src/libslic3r/Fill/FillTpmsAdaptive.hpp rename to src/libslic3r/Fill/AdaptiveInfillField.hpp index 8e7b9db6cd..bfeaf07692 100644 --- a/src/libslic3r/Fill/FillTpmsAdaptive.hpp +++ b/src/libslic3r/Fill/AdaptiveInfillField.hpp @@ -21,7 +21,7 @@ namespace Slic3r { // lobe, 1 at its surface. Lobes are parts of a body separated by a neck, like two spheres united. In the 2D modes, // every section normal to the axis has its own bodies and lobes, and distances are measured within the section. The // modes following the distance to the surface use the depth of every point instead; Distance warp also the lobes. -class TpmsRadialField +class AdaptiveInfillField { public: struct Slice @@ -39,7 +39,7 @@ public: }; // Slices sorted by z, in the XY coordinates of the fill and the print Z. - TpmsRadialField(const std::vector &slices, const BoundingBox &bbox, TpmsAdaptiveMode mode, + AdaptiveInfillField(const std::vector &slices, const BoundingBox &bbox, AdaptiveInfillMode mode, const std::function &throw_if_canceled); // Lobes blended near the sides between them, from a body or from each of the two sections around a point. @@ -56,7 +56,7 @@ public: // Axis normal to the sections in the 2D modes, -1 in the modes graded in 3D. int axis() const { return m_axis; } - TpmsAdaptiveMode mode() const { return m_mode; } + AdaptiveInfillMode mode() const { return m_mode; } // In the modes following the distance to the surface: depth relative to the deepest point of the body, from 0 at // the surface to 1. @@ -91,7 +91,7 @@ private: static constexpr int Polar = 24; static constexpr int Azimuth = 48; - TpmsAdaptiveMode m_mode; + AdaptiveInfillMode m_mode; int m_axis; Vec3d m_origin; double m_cell; @@ -106,9 +106,9 @@ private: std::vector m_depth; }; -using TpmsRadialFieldPtr = std::unique_ptr; +using AdaptiveInfillFieldPtr = std::unique_ptr; // A field for every adaptive mode in use, indexed by the mode. -using TpmsRadialFields = std::array; +using AdaptiveInfillFields = std::array; struct AdaptiveTpms { @@ -117,14 +117,14 @@ struct AdaptiveTpms // Pattern frequencies at the surface and at the center, in radians per mm. double surface_frequency; double interior_frequency; - TpmsAdaptiveGradient gradient; + AdaptiveInfillGradient gradient; }; // Infill lines in the fill frame, the object frame rotated by -angle; z is the print_z of the layer. -Polylines make_adaptive_tpms(const AdaptiveTpms &tpms, const TpmsRadialField &field, BoundingBox bbox, +Polylines make_adaptive_tpms(const AdaptiveTpms &tpms, const AdaptiveInfillField &field, BoundingBox bbox, coordf_t z, coordf_t layer_height, coordf_t spacing, float angle); -struct TpmsShell +struct AdaptiveInfillShell { float density; ExPolygons expolygons; @@ -132,12 +132,12 @@ struct TpmsShell // Stepped shells: the parts of an expolygon in the object frame at each density, from the surface inwards; z is the // middle of the layer. -std::vector make_tpms_shells(const TpmsRadialField &field, const ExPolygon &expolygon, coordf_t z, - float surface_density, float interior_density, TpmsAdaptiveGradient gradient); +std::vector make_adaptive_infill_shells(const AdaptiveInfillField &field, const ExPolygon &expolygon, coordf_t z, + float surface_density, float interior_density, AdaptiveInfillGradient gradient); // Stepped shells: fills every shell with fill_shell at its density, each shrunk by half a line like a filled region, // so the lines connected along the boundaries of two shells don't overlap. -void fill_tpms_shells(const TpmsRadialField &field, const ExPolygon &expolygon, coordf_t z, const FillParams ¶ms, coordf_t spacing, +void fill_adaptive_infill_shells(const AdaptiveInfillField &field, const ExPolygon &expolygon, coordf_t z, const FillParams ¶ms, coordf_t spacing, const std::function &fill_shell); } // namespace Slic3r diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 146d3ee7b4..d2d6bfb0f5 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -22,6 +22,8 @@ #include "../PrintConfig.hpp" #include "../Surface.hpp" +#include + #include "AABBTreeLines.hpp" #include "libslic3r/Config.hpp" #include "libslic3r/ExPolygon.hpp" @@ -312,9 +314,9 @@ struct SurfaceFillParams bool gyroid_optimized = false; // For TPMS: grade the density from the surface to the interior of the object. - TpmsAdaptiveMode tpms_adaptive = TpmsAdaptiveMode::Disabled; - float tpms_interior_density = 0.f; - TpmsAdaptiveGradient tpms_adaptive_gradient = TpmsAdaptiveGradient::Linear; + AdaptiveInfillMode adaptive_infill_mode = AdaptiveInfillMode::Disabled; + float adaptive_infill_interior_density = 0.f; + AdaptiveInfillGradient adaptive_infill_gradient = AdaptiveInfillGradient::Linear; // Orca: corner smoothing factor in the range [0, 1]. double smooth_factor { 0. }; @@ -358,9 +360,9 @@ struct SurfaceFillParams RETURN_COMPARE_NON_EQUAL(skin_infill_depth); RETURN_COMPARE_NON_EQUAL(infill_overhang_angle); RETURN_COMPARE_NON_EQUAL(gyroid_optimized); - RETURN_COMPARE_NON_EQUAL(tpms_adaptive); - RETURN_COMPARE_NON_EQUAL(tpms_interior_density); - RETURN_COMPARE_NON_EQUAL(tpms_adaptive_gradient); + RETURN_COMPARE_NON_EQUAL(adaptive_infill_mode); + RETURN_COMPARE_NON_EQUAL(adaptive_infill_interior_density); + RETURN_COMPARE_NON_EQUAL(adaptive_infill_gradient); RETURN_COMPARE_NON_EQUAL(smooth_factor); RETURN_COMPARE_NON_EQUAL(center_of_surface_pattern); RETURN_COMPARE_NON_EQUAL(separated_infills); @@ -394,9 +396,9 @@ struct SurfaceFillParams this->center_of_surface_pattern == rhs.center_of_surface_pattern && this->separated_infills == rhs.separated_infills && this->gyroid_optimized == rhs.gyroid_optimized && - this->tpms_adaptive == rhs.tpms_adaptive && - this->tpms_interior_density == rhs.tpms_interior_density && - this->tpms_adaptive_gradient == rhs.tpms_adaptive_gradient && + this->adaptive_infill_mode == rhs.adaptive_infill_mode && + this->adaptive_infill_interior_density == rhs.adaptive_infill_interior_density && + this->adaptive_infill_gradient == rhs.adaptive_infill_gradient && this->smooth_factor == rhs.smooth_factor && this->fill_order == rhs.fill_order; } @@ -675,24 +677,28 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n if (!line_based_pattern) { const coord_t scaled_spacing = scaled(fill.params.spacing); - for (const ExPolygon &expolygon : fill.expolygons) { + // Each expolygon is split on its own, so they run in parallel and are collected in their original order. + std::vector> split_parts(fill.expolygons.size()); // normal, narrow + tbb::parallel_for(size_t(0), fill.expolygons.size(), [&](size_t idx) { + const ExPolygon &expolygon = fill.expolygons[idx]; Polygons filled_area = to_polygons(expolygon); // "Core" area: open (erode+dilate) to drop thin features, then clamp back to the original polygon. Polygons inner_area = intersection(filled_area, opening(filled_area, scaled_spacing, scaled_spacing)); if (inner_area.empty()) { - narrow_infill.emplace_back(expolygon); - continue; + split_parts[idx].second.emplace_back(expolygon); + return; } ExPolygons inner_ex = union_ex(inner_area); ExPolygons expolys{expolygon}; - ExPolygons narrow_ex = diff_ex(expolys, inner_ex); - ExPolygons normal_ex = intersection_ex(expolys, inner_ex); - - append(normal_infill, normal_ex); // normal infill area - append(narrow_infill, narrow_ex); // narrow infill area + split_parts[idx].second = diff_ex(expolys, inner_ex); // narrow infill area + split_parts[idx].first = intersection_ex(expolys, inner_ex); // normal infill area + }); + for (auto &[normal_ex, narrow_ex] : split_parts) { + append(normal_infill, std::move(normal_ex)); + append(narrow_infill, std::move(narrow_ex)); } return; @@ -714,7 +720,10 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n } const double aligning_angle = -base_angle + PI; - for (const ExPolygon &expolygon : fill.expolygons) { + // Each expolygon is reconstructed on its own, so they run in parallel and are collected in their original order. + std::vector split_reconstructed(fill.expolygons.size()); + tbb::parallel_for(size_t(0), fill.expolygons.size(), [&](size_t expolygon_idx) { + const ExPolygon &expolygon = fill.expolygons[expolygon_idx]; Polygons filled_area = to_polygons(expolygon); polygons_rotate(filled_area, aligning_angle); BoundingBox bb = get_extents(filled_area); @@ -845,8 +854,10 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n } } - polygons_append(normal_fill_areas, reconstructed_area); - } + split_reconstructed[expolygon_idx] = std::move(reconstructed_area); + }); + for (Polygons &reconstructed_area : split_reconstructed) + polygons_append(normal_fill_areas, std::move(reconstructed_area)); polygons_rotate(normal_fill_areas, -aligning_angle); @@ -1010,17 +1021,17 @@ std::vector group_fills(const Layer &layer, LockRegionParam &lock_p params.extrusion_role != erTopSolidInfill && params.extrusion_role != erBottomSurface; // Orca: only the TPMS sparse infill is graded; reset otherwise, as params is reused. - params.tpms_adaptive = is_tpms_adaptive_pattern(params.pattern) && params.extrusion_role == erInternalInfill ? - region_config.tpms_adaptive.value : TpmsAdaptiveMode::Disabled; - const bool tpms_adaptive = params.tpms_adaptive != TpmsAdaptiveMode::Disabled; - params.tpms_interior_density = tpms_adaptive ? std::max(1.f, float(region_config.tpms_interior_density)) : 0.f; - params.tpms_adaptive_gradient = tpms_adaptive ? region_config.tpms_adaptive_gradient.value : TpmsAdaptiveGradient::Linear; + params.adaptive_infill_mode = is_adaptive_infill_pattern(params.pattern) && params.extrusion_role == erInternalInfill ? + region_config.adaptive_infill_mode.value : AdaptiveInfillMode::Disabled; + const bool adaptive_infill_mode = params.adaptive_infill_mode != AdaptiveInfillMode::Disabled; + params.adaptive_infill_interior_density = adaptive_infill_mode ? std::max(1.f, float(region_config.adaptive_infill_interior_density)) : 0.f; + params.adaptive_infill_gradient = adaptive_infill_mode ? region_config.adaptive_infill_gradient.value : AdaptiveInfillGradient::Linear; // Pass through gyroid_optimized only when the effective pattern is Gyroid, // so non-Gyroid fills do not differ in SurfaceFillParams by an irrelevant flag // (which would unnecessarily split fill batching). Adaptive density replaces it. // Stored on SurfaceFillParams; copied to FillParams during conversion. - params.gyroid_optimized = (params.pattern == ipGyroid) && region_config.gyroid_optimized && !tpms_adaptive; + params.gyroid_optimized = (params.pattern == ipGyroid) && region_config.gyroid_optimized && !adaptive_infill_mode; if (params.extrusion_role == erInternalInfill) { params.angle = calculate_infill_rotation_angle(layer.object(), layer.id(), region_config.infill_direction.value, @@ -1373,7 +1384,7 @@ void Layer::make_fills(const FillAdaptive::RegionOctrees* fill_octrees, FillLigh f->angle = surface_fill.params.angle; f->fixed_angle = surface_fill.params.fixed_angle; const FillAdaptive::Octrees *octrees = fill_octrees ? fill_octrees->region(surface_fill.region_id) : nullptr; - f->tpms_radial_field = this->object()->tpms_radial_field(surface_fill.params.tpms_adaptive); + f->adaptive_infill_field = this->object()->adaptive_infill_field(surface_fill.params.adaptive_infill_mode); f->print_config = &this->object()->print()->config(); f->print_object_config = &this->object()->config(); if (surface_fill.params.pattern == ipConcentricInternal) { @@ -1423,9 +1434,9 @@ void Layer::make_fills(const FillAdaptive::RegionOctrees* fill_octrees, FillLigh params.lateral_lattice_angle_2 = surface_fill.params.lateral_lattice_angle_2; params.infill_overhang_angle = surface_fill.params.infill_overhang_angle; params.gyroid_optimized = surface_fill.params.gyroid_optimized; - params.tpms_adaptive = surface_fill.params.tpms_adaptive; - params.tpms_interior_density = float(0.01 * surface_fill.params.tpms_interior_density); - params.tpms_adaptive_gradient = surface_fill.params.tpms_adaptive_gradient; + params.adaptive_infill_mode = surface_fill.params.adaptive_infill_mode; + params.adaptive_infill_interior_density = float(0.01 * surface_fill.params.adaptive_infill_interior_density); + params.adaptive_infill_gradient = surface_fill.params.adaptive_infill_gradient; params.smooth_factor = surface_fill.params.smooth_factor; // BBS @@ -1473,7 +1484,15 @@ void Layer::make_fills(const FillAdaptive::RegionOctrees* fill_octrees, FillLigh f->set_bounding_box(body >= 0 ? this->object()->separated_body_bboxes()[body] : bbox); f->adapt_fill_octree = octrees ? octrees->get(body) : nullptr; - f->no_overlap_expolygons = intersection_ex(surface_fill.no_overlap_expolygons, ExPolygons() = {expoly}, ApplySafetyOffset::Yes); + // Only the part of the layer-wide no-overlap area under this expolygon matters, so clip it to the + // expolygon's box first (padded past the safety offset, which grows the clip side). The result is + // identical; the cost is not: a layer split into many small fills, e.g. by colour painting, + // otherwise intersects every one of them with the whole layer. + BoundingBox no_overlap_bbox = get_extents(expoly); + no_overlap_bbox.offset(SCALED_EPSILON); + f->no_overlap_expolygons = intersection_ex( + ClipperUtils::clip_clipper_polygons_with_subject_bbox(surface_fill.no_overlap_expolygons, no_overlap_bbox), + ExPolygons() = {expoly}, ApplySafetyOffset::Yes); if (params.symmetric_infill_y_axis) { params.symmetric_y_axis = f->extended_object_bounding_box().center().x(); expoly.symmetric_y(params.symmetric_y_axis); @@ -1598,7 +1617,7 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(const FillAdapti f->angle = surface_fill.params.angle; f->fixed_angle = surface_fill.params.fixed_angle; const FillAdaptive::Octrees *octrees = fill_octrees ? fill_octrees->region(surface_fill.region_id) : nullptr; - f->tpms_radial_field = this->object()->tpms_radial_field(surface_fill.params.tpms_adaptive); + f->adaptive_infill_field = this->object()->adaptive_infill_field(surface_fill.params.adaptive_infill_mode); f->print_config = &this->object()->print()->config(); f->print_object_config = &this->object()->config(); @@ -1638,9 +1657,9 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(const FillAdapti params.infill_overhang_angle = surface_fill.params.infill_overhang_angle; params.multiline = surface_fill.params.multiline; params.gyroid_optimized = surface_fill.params.gyroid_optimized; - params.tpms_adaptive = surface_fill.params.tpms_adaptive; - params.tpms_interior_density = float(0.01 * surface_fill.params.tpms_interior_density); - params.tpms_adaptive_gradient = surface_fill.params.tpms_adaptive_gradient; + params.adaptive_infill_mode = surface_fill.params.adaptive_infill_mode; + params.adaptive_infill_interior_density = float(0.01 * surface_fill.params.adaptive_infill_interior_density); + params.adaptive_infill_gradient = surface_fill.params.adaptive_infill_gradient; params.smooth_factor = surface_fill.params.smooth_factor; // Orca: Match make_fills() when choosing the origin of plane-path patterns. // Without the sparse extrusion role, the filler uses each surface's bounds diff --git a/src/libslic3r/Fill/Fill3DHoneycomb.cpp b/src/libslic3r/Fill/Fill3DHoneycomb.cpp index 3612608301..d810bb671e 100644 --- a/src/libslic3r/Fill/Fill3DHoneycomb.cpp +++ b/src/libslic3r/Fill/Fill3DHoneycomb.cpp @@ -400,10 +400,9 @@ void Fill3DHoneycomb::_fill_surface_single( // move pattern in place for (Polyline &pl : polylines){ pl.translate(bb.min); - pl.simplify(5 * spacing); // simplify to 5x line width // Orca: round the corners of the octahedral wave. The layers where the wave degenerates to a // straight line have no corner to round. - smooth_polyline_corners(pl, params.smooth_factor, scaled(params.resolution)); + smooth_polyline_corners(pl, params.corner_smoothing()); } // Note: multiline fill adjustment is carried out in this code, diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index a852f2c42b..6338bc3208 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -11,6 +11,10 @@ #include #include #include +#include +#include +#include +#include "../AABBTreeLines.hpp" #include "../ClipperUtils.hpp" #include "../EdgeGrid.hpp" #include "../Geometry.hpp" @@ -206,6 +210,9 @@ void Fill::fill_surface_extrusion(const Surface* surface, const FillParams& para thick_polylines.clear(); } else { + // Orca: sparse infill lines whose ends are next to each other print as one path, without a travel between them. + if (params.extrusion_role == erInternalInfill && ! eec->no_sort) + join_close_ends(polylines, scale_(2. * this->spacing), params.can_reverse); extrusion_entities_append_paths( eec->entities, std::move(polylines), params.extrusion_role, @@ -221,6 +228,79 @@ void Fill::fill_surface_extrusion(const Surface* surface, const FillParams& para } } +// Orca: port of Bambu Studio's gap fill interleaving for fills printed in a fixed order, see docs/HLSD/travel-optimization.md. +static void insert_gap_fill(const ThickPolylines &gaps, const Flow &flow, ExtrusionEntitiesPtr &entities) +{ + if (entities.empty()) { + variable_width(gaps, erGapFill, flow, entities); + return; + } + static constexpr size_t npos = size_t(-1); + // An extrusion of the fill, or gaps[gap], with the points where the nozzle enters and leaves it. + struct Item { Point in, out; size_t gap; bool reversed; }; + auto distance = [](const Point &a, const Point &b) { return (b - a).cast().norm(); }; + auto closed = [&gaps](size_t gap) { return gaps[gap].first_point() == gaps[gap].last_point(); }; + // GCode::extrude_loop starts a loop at its point nearest the nozzle. + auto travel = [&](const std::vector &seq) { + double sum = 0.; + Point at = seq.front().out; + for (auto it = seq.begin() + 1; it != seq.end(); ++ it) { + const Point in = it->gap != npos && closed(it->gap) ? *gaps[it->gap].closest_point(at) : it->in; + sum += distance(at, in); + at = it->gap != npos && closed(it->gap) ? in : it->out; + } + return sum; + }; + + std::vector items, appended; + items.reserve(entities.size() + gaps.size()); + for (const ExtrusionEntity *ee : entities) + items.push_back({ ee->first_point(), ee->last_point(), npos, false }); + appended = items; + for (size_t gap = 0; gap < gaps.size(); ++ gap) { + appended.push_back({ gaps[gap].first_point(), gaps[gap].last_point(), gap, false }); + double best = std::numeric_limits::max(); + size_t best_slot = 0; + Item best_item{}; + for (size_t slot = 0; slot <= items.size(); ++ slot) { + const Point *prev = slot > 0 ? &items[slot - 1].out : nullptr; + const Point *next = slot < items.size() ? &items[slot].in : nullptr; + auto consider = [&](const Point &in, const Point &out, bool reversed) { + const double added = (prev ? distance(*prev, in) : 0.) + (next ? distance(out, *next) : 0.) - (prev && next ? distance(*prev, *next) : 0.); + if (added < best) { + best = added; + best_slot = slot; + best_item = { in, out, gap, reversed }; + } + }; + if (closed(gap)) { + const Point &entry = *gaps[gap].closest_point(prev ? *prev : *next); + consider(entry, entry, false); + } else { + consider(gaps[gap].first_point(), gaps[gap].last_point(), false); + consider(gaps[gap].last_point(), gaps[gap].first_point(), true); + } + } + items.insert(items.begin() + best_slot, best_item); + } + if (travel(appended) <= travel(items)) + items = std::move(appended); + + ExtrusionEntitiesPtr out; + out.reserve(entities.size() + gaps.size()); + size_t next_entity = 0; + for (const Item &item : items) + if (item.gap == npos) + out.push_back(entities[next_entity ++]); + else { + ThickPolylines gap { gaps[item.gap] }; + if (item.reversed) + gap.front().reverse(); + variable_width(gap, erGapFill, flow, out); + } + entities = std::move(out); +} + // Orca: Dedicated function to calculate gap fill lines for the provided surface, according to the print object parameters // and append them to the out ExtrusionEntityCollection. void Fill::_create_gap_fill(const Surface* surface, const FillParams& params, ExtrusionEntityCollection* out){ @@ -270,7 +350,10 @@ void Fill::_create_gap_fill(const Surface* surface, const FillParams& params, Ex return p.length() < scale_(params.config->filter_out_gap_fill.value); }), polylines.end()); - variable_width(polylines, erGapFill, params.flow, out->entities); + if (out->no_sort) + insert_gap_fill(polylines, params.flow, out->entities); + else + variable_width(polylines, erGapFill, params.flow, out->entities); } } } @@ -1644,6 +1727,8 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector SCALED_EPSILON ? std::max(anchor_length_max, 2. * (anchor_length + line_half_width)) : anchor_length_max; #if 0 // Connection from end of one infill line to the start of another infill line. @@ -1720,6 +1805,10 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector open_end(graph.map_infill_end_point_to_boundary.size(), 1); + auto end_index = [&graph](const ContourIntersectionPoint *cp) { return size_t(cp - graph.map_infill_end_point_to_boundary.data()); }; + struct Arc { ContourIntersectionPoint *intersection; double arc_length; @@ -1731,6 +1820,81 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector &order) { + std::vector consumed(graph.map_infill_end_point_to_boundary.size()); + for (size_t i = 0; i < consumed.size(); ++ i) + consumed[i] = graph.map_infill_end_point_to_boundary[i].consumed; + std::vector parent(infill_ordered.size()); + std::iota(parent.begin(), parent.end(), 0); + auto find = [&parent](size_t i) { + while (parent[i] != i) + i = parent[i] = parent[parent[i]]; + return i; + }; + size_t joins = 0; + for (const Arc &arc : order) { + const size_t end1 = end_index(arc.intersection), end2 = end_index(arc.intersection->next_on_contour); + if (consumed[end1] || consumed[end2] || (params.multiline > 1 && arc.arc_length < scale_(spacing) * params.multiline)) + continue; + const size_t polyline1 = find(end1 / 2), polyline2 = find(end2 / 2); + if (polyline1 == polyline2) + continue; + if (arc.arc_length < join_length) { + parent[polyline2] = polyline1; + ++ joins; + } else if (anchor_length <= SCALED_EPSILON) + continue; + consumed[end1] = consumed[end2] = 1; + } + // The last pass joins the open ends next to each other, also those of a multiline group. + for (size_t end = 0; end < consumed.size(); ++ end) { + const ContourIntersectionPoint &cp = graph.map_infill_end_point_to_boundary[end]; + if (consumed[end] || cp.contour_idx == boundary_idx_unconnected) + continue; + const double length = graph.boundary_params[cp.contour_idx].back(); + auto open = [&](const ContourIntersectionPoint *other, bool trimmed) { + return other != &cp && ! consumed[end_index(other)] && ! trimmed; + }; + const double lprev = open(cp.prev_on_contour, cp.prev_trimmed || cp.prev_on_contour->next_trimmed) ? + path_length_along_contour_ccw(cp.prev_on_contour, &cp, length) : std::numeric_limits::max(); + const double lnext = open(cp.next_on_contour, cp.next_trimmed || cp.next_on_contour->prev_trimmed) ? + path_length_along_contour_ccw(&cp, cp.next_on_contour, length) : std::numeric_limits::max(); + consumed[end] = anchor_length > SCALED_EPSILON; + for (const double l : { std::min(lprev, lnext), std::max(lprev, lnext) }) { + if (l > join_length) + break; + const size_t other = end_index(l == lprev ? cp.prev_on_contour : cp.next_on_contour); + const size_t polyline1 = find(end / 2), polyline2 = find(other / 2); + if (polyline1 == polyline2) + continue; + parent[polyline2] = polyline1; + consumed[end] = consumed[other] = 1; + ++ joins; + break; + } + } + return joins; + }; + // Equal arcs taken along the contour pair a wall in one phase; keep the order that joins the most lines. + size_t best_joins = count_joins(arches); + const double bucket = 0.5 * scale_(spacing); + for (const bool backwards : { false, true }) { + std::vector along_contour = arches; + std::sort(along_contour.begin(), along_contour.end(), [bucket, backwards](const Arc &l, const Arc &r) { + const long long bucket_l = std::llround(l.arc_length / bucket), bucket_r = std::llround(r.arc_length / bucket); + if (bucket_l != bucket_r) + return bucket_l < bucket_r; + if (l.intersection->contour_idx != r.intersection->contour_idx) + return l.intersection->contour_idx < r.intersection->contour_idx; + return backwards ? l.intersection->param > r.intersection->param : l.intersection->param < r.intersection->param; + }); + if (const size_t joins = count_joins(along_contour); joins > best_joins) { + best_joins = joins; + arches = std::move(along_contour); + } + } } //FIXME improve the Traveling Salesman problem with 2-opt and 3-opt local optimization. @@ -1752,7 +1916,7 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vectorpoint_idx] == polyline1.points.front() || contour[cp1->point_idx] == polyline1.points.back()); if (contour[cp1->point_idx] == polyline1.points.front()) @@ -1761,6 +1925,7 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vectorpoint_idx] == polyline2.points.back()) polyline2.reverse(); take(polyline1, polyline2, contour, cp1, cp2, false); + open_end[end_index(cp1)] = open_end[end_index(cp2)] = 0; // Mark the second polygon as merged with the first one. if (polyline_idx2 < polyline_idx1) { polyline2 = std::move(polyline1); @@ -1778,6 +1943,23 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vectorprev_on_contour : cp->next_on_contour; + if (other == nullptr || other == &from) + break; + distance += backwards ? closed_contour_distance_cw(cp->param, other->param, length) : closed_contour_distance_ccw(cp->param, other->param, length); + if (open_end[end_index(other)] && get_and_update_merged_with(end_index(other) / 2) != polyline_idx) + return distance; + cp = other; + } + return std::numeric_limits::max(); + }; + // Connect the remaining open infill lines to the perimeter lines if possible. for (ContourIntersectionPoint &contour_point : graph.map_infill_end_point_to_boundary) if (! contour_point.consumed && contour_point.contour_idx != boundary_idx_unconnected) { @@ -1796,7 +1978,7 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector::max() || l > anchor_length_max) + if (l == std::numeric_limits::max() || l > join_length) break; // Take the complete contour. bool reversed = l == lprev; @@ -1815,6 +1997,7 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vectorpoint_idx] == polyline2.points.back()) polyline2.reverse(); take(polyline, polyline2, contour, &contour_point, cp2, reversed); + open_end[end_index(&contour_point)] = open_end[end_index(cp2)] = 0; if (polyline_idx < polyline_idx2) { // Mark the second polyline as merged with the first one. merged_with[polyline_idx2] = polyline_idx; @@ -1829,18 +2012,35 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector SCALED_EPSILON) { - // Which to take? One could optimize for: - // 1) Shortest path - // 2) Hook length - // ... - // Let's take the longer now, as this improves the chance of another hook to be placed on the other side of this contour point. - double l = std::max(contour_point.contour_not_taken_length_prev, contour_point.contour_not_taken_length_next); - if (l > SCALED_EPSILON) { - if (contour_point.contour_not_taken_length_prev > contour_point.contour_not_taken_length_next) - take_limited(polyline, contour, contour_params, &contour_point, contour_point.prev_on_contour, true, anchor_length, line_half_width); - else - take_limited(polyline, contour, contour_params, &contour_point, contour_point.next_on_contour, false, anchor_length, line_half_width); + // Hook toward the nearest open end of another polyline, where the next path likely starts. + const double free_prev = contour_point.contour_not_taken_length_prev; + const double free_next = contour_point.contour_not_taken_length_next; + const double to_prev = distance_to_open_end(contour_point, polyline_idx, true); + const double to_next = distance_to_open_end(contour_point, polyline_idx, false); + bool backwards = free_prev > free_next; + if (to_prev < to_next && free_prev > SCALED_EPSILON) + backwards = true; + else if (to_next < to_prev && free_next > SCALED_EPSILON) + backwards = false; + // Orca: with multiline, a hook toward a copy stops short of it; the copy takes half a width over the sine of its wall angle. + double length = anchor_length; + if (const ContourIntersectionPoint *other = backwards ? contour_point.prev_on_contour : contour_point.next_on_contour; + params.multiline > 1 && other != &contour_point) { + const Point &end = contour[contour_point.point_idx]; + Vec2d dir = Vec2d::Zero(); + for (size_t i = 1; i < polyline.size() && dir.squaredNorm() < sqr(2. * scale_(spacing) * params.multiline); ++ i) + dir = (end - polyline.points[polyline.points.front() == end ? i : polyline.size() - 1 - i]).cast(); + const Vec2d to_copy = (contour[other->point_idx] - end).cast(); + const double across = dir.squaredNorm() > 0. ? std::abs(cross2(dir.normalized(), to_copy)) : 0.; + if (across > SCALED_EPSILON && across < scale_(spacing) * params.multiline) { + const double gap = backwards ? path_length_along_contour_ccw(other, &contour_point, contour_params.back()) : + path_length_along_contour_ccw(&contour_point, other, contour_params.back()); + length = std::min(length, gap - line_half_width * (1. + to_copy.norm() / across)); + } } + if ((backwards ? free_prev : free_next) > SCALED_EPSILON) + take_limited(polyline, contour, contour_params, &contour_point, backwards ? contour_point.prev_on_contour : contour_point.next_on_contour, + backwards, std::max(0., length), line_half_width); } } @@ -2789,8 +2989,8 @@ void multiline_fill(Polylines& polylines, const FillParams& params, float spacin } const float delta = float(scale_(t)); - // Arc tolerance of 1/500 of the offset, Clipper2's default. - for (const Polygon &ring : offset(polylines, delta, jtRound, 0.002 * delta, etOpenRound)) + // Mitered corners keep the lines parallel; the round end caps take 1/500 of the offset, Clipper2's default. + for (const Polygon &ring : offset(polylines, delta, jtMiter, DefaultMiterLimit, etOpenRound, 0.002 * delta)) if (ring.size() >= 3) all_polylines.emplace_back(ring.split_at_first_point()); } @@ -2798,4 +2998,123 @@ void multiline_fill(Polylines& polylines, const FillParams& params, float spacin polylines = std::move(all_polylines); } +void join_close_ends(Polylines &polylines, double max_gap, bool can_reverse) +{ + const size_t n = polylines.size(); + if (n < 2 || max_gap <= 0.) + return; + static constexpr size_t npos = size_t(-1); + // End 2 * i is the first point of polyline i, 2 * i + 1 its last. + auto end_point = [&polylines](size_t e) -> const Point & { return (e & 1) ? polylines[e >> 1].points.back() : polylines[e >> 1].points.front(); }; + // Ends in cells of max_gap, so the ends within max_gap of one are in its cell or the eight around it. + auto cell_of = [max_gap](const Point &p) { return Vec2i64(int64_t(std::floor(p.x() / max_gap)), int64_t(std::floor(p.y() / max_gap))); }; + auto key = [](const Vec2i64 &c) { return (uint64_t(c.x()) << 32) ^ uint64_t(uint32_t(c.y())); }; + std::unordered_map> grid; + for (size_t e = 0; e < 2 * n; ++ e) + if (polylines[e >> 1].size() >= 2) + grid[key(cell_of(end_point(e)))].push_back(e); + + // The end of a polyline that comes last along its overall direction, taken along the dominant axis. + std::vector backwards(n, 0); + for (size_t i = 0; i < n; ++ i) + if (polylines[i].size() >= 2) { + const Vec2d dir = (polylines[i].points.back() - polylines[i].points.front()).cast(); + backwards[i] = std::abs(dir.x()) >= std::abs(dir.y()) ? dir.x() < 0. : dir.y() < 0.; + } + auto trailing = [&backwards](size_t e) { return bool(e & 1) != bool(backwards[e >> 1]); }; + // Ends that meet first, then shortest gaps between leading ends, then the others: the copies of neighboring multiline + // groups are all joined at the same side, which leaves their open ends next to each other rather than on alternating walls. + std::vector> gaps; + for (const auto &[cell_key, ends] : grid) { + const Vec2i64 c = cell_of(end_point(ends.front())); + for (int64_t dx = -1; dx <= 1; ++ dx) + for (int64_t dy = -1; dy <= 1; ++ dy) + if (auto it = grid.find(key(c + Vec2i64(dx, dy))); it != grid.end()) + for (size_t a : ends) + for (size_t b : it->second) + if (a < b && (a >> 1) != (b >> 1) && (can_reverse || (a & 1) != (b & 1))) + if (const double d = (end_point(a) - end_point(b)).cast().norm(); d <= max_gap) + gaps.emplace_back(d > SCALED_EPSILON, d > SCALED_EPSILON && (trailing(a) || trailing(b)), d, a, b); + } + if (gaps.empty()) + return; + std::sort(gaps.begin(), gaps.end()); + + std::vector partner(2 * n, npos), parent(n); + std::iota(parent.begin(), parent.end(), 0); + auto find = [&parent](size_t i) { + while (parent[i] != i) + i = parent[i] = parent[parent[i]]; + return i; + }; + // A join may not cross a line or another join; touching them at its own ends is fine, as where a line ends on another. + // Only the segments through a cell next to a candidate join can cross one. + std::unordered_set near_gaps; + for (const auto &[apart, trail, d, a, b] : gaps) + for (size_t e : { a, b }) + for (int64_t dx = -1; dx <= 1; ++ dx) + for (int64_t dy = -1; dy <= 1; ++ dy) + near_gaps.insert(key(cell_of(end_point(e)) + Vec2i64(dx, dy))); + Lines near_lines; + for (const Polyline &pl : polylines) + for (size_t i = 1; i < pl.size(); ++ i) { + const Vec2i64 c0 = cell_of(pl.points[i - 1]), c1 = cell_of(pl.points[i]); + const Vec2i64 lo = c0.cwiseMin(c1), hi = c0.cwiseMax(c1); + bool near = (hi - lo).maxCoeff() > 3; + for (int64_t x = lo.x(); x <= hi.x() && ! near; ++ x) + for (int64_t y = lo.y(); y <= hi.y() && ! near; ++ y) + near = near_gaps.count(key(Vec2i64(x, y))) > 0; + if (near) + near_lines.emplace_back(pl.points[i - 1], pl.points[i]); + } + const AABBTreeLines::LinesDistancer lines(std::move(near_lines)); + auto crosses = [&](size_t a, size_t b) { + const Vec2d p = end_point(a).cast(), q = end_point(b).cast(); + const double length = (q - p).norm(); + if (length <= 2. * SCALED_EPSILON) + return false; + const Vec2d dir = (q - p) / length; + const Line inner(Point((p + SCALED_EPSILON * dir).cast()), Point((q - SCALED_EPSILON * dir).cast())); + if (! lines.get_lines().empty() && ! lines.intersections_with_line(inner).empty()) + return true; + const Vec2i64 c = cell_of(end_point(a)); + for (int64_t dx = -3; dx <= 3; ++ dx) + for (int64_t dy = -3; dy <= 3; ++ dy) + if (auto it = grid.find(key(c + Vec2i64(dx, dy))); it != grid.end()) + for (size_t e : it->second) + if (partner[e] != npos && Geometry::segments_intersect(inner.a, inner.b, end_point(e), end_point(partner[e]))) + return true; + return false; + }; + for (const auto &[apart, trail, d, a, b] : gaps) + if (partner[a] == npos && partner[b] == npos && find(a >> 1) != find(b >> 1) && ! crosses(a, b)) { + partner[a] = b; + partner[b] = a; + parent[find(a >> 1)] = find(b >> 1); + } + + // Walk each group from a polyline with a free end, entering the next polyline at the end joined to the last one. + Polylines out; + std::vector done(n, 0); + auto walk = [&](size_t first_end) { + Polyline joined; + for (size_t e = first_end; e != npos;) { + Polyline &pl = polylines[e >> 1]; + done[e >> 1] = 1; + if (e & 1) + pl.reverse(); + joined.points.insert(joined.points.end(), pl.points.begin() + (! joined.empty() && joined.points.back() == pl.points.front()), pl.points.end()); + e = partner[e ^ 1]; + } + out.emplace_back(std::move(joined)); + }; + for (size_t i = 0; i < n; ++ i) + if (! done[i] && partner[2 * i] == npos) + walk(2 * i); + for (size_t i = 0; i < n; ++ i) + if (! done[i] && partner[2 * i + 1] == npos) + walk(2 * i + 1); + polylines = std::move(out); +} + } // namespace Slic3r diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index e0308c9450..4711192999 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -24,6 +24,7 @@ #include "../PrintConfig.hpp" #include "../Flow.hpp" #include "../ExtrusionEntity.hpp" +#include "FillCornerSmoothing.hpp" #include "libslic3r/Polyline.hpp" #include "libslic3r/Polygon.hpp" #include "libslic3r/Point.hpp" @@ -33,7 +34,7 @@ namespace Slic3r { class ExtrusionEntityCollection; } namespace Slic3r { class Surface; -class TpmsRadialField; +class AdaptiveInfillField; enum InfillPattern : int; namespace FillAdaptive { @@ -93,12 +94,14 @@ struct FillParams bool gyroid_optimized { false }; // For TPMS: grade the density from the surface to the interior of the object. Density fraction. - TpmsAdaptiveMode tpms_adaptive { TpmsAdaptiveMode::Disabled }; - float tpms_interior_density { 0.f }; - TpmsAdaptiveGradient tpms_adaptive_gradient { TpmsAdaptiveGradient::Linear }; + AdaptiveInfillMode adaptive_infill_mode { AdaptiveInfillMode::Disabled }; + float adaptive_infill_interior_density { 0.f }; + AdaptiveInfillGradient adaptive_infill_gradient { AdaptiveInfillGradient::Linear }; // Orca: corner smoothing factor in the range [0, 1]. double smooth_factor { 0. }; + // The corner smoothing in scaled coordinates. + CornerSmoothing corner_smoothing() const { return CornerSmoothing{smooth_factor, scaled(resolution)}; } // For Lateral lattice coordf_t lateral_lattice_angle_1 { 0.f }; @@ -162,7 +165,7 @@ public: FillAdaptive::Octree* adapt_fill_octree = nullptr; // Radial coordinate inside the object for the adaptive TPMS infill - const TpmsRadialField* tpms_radial_field = nullptr; + const AdaptiveInfillField* adaptive_infill_field = nullptr; // PrintConfig and PrintObjectConfig are used by infills that use Arachne (Concentric and FillEnsuring). // Orca: also used by gap fill function. @@ -258,8 +261,11 @@ public: static coord_t _adjust_solid_spacing(const coord_t width, const coord_t distance); }; - //Fill Multiline + //Fill Multiline void multiline_fill(Polylines& polylines, const FillParams& params, float spacing); + // Joins polylines whose ends are at most max_gap apart, shortest gaps first and without closing a loop, so each such + // group prints as one path. Without can_reverse only the end of one polyline joins the start of another. + void join_close_ends(Polylines &polylines, double max_gap, bool can_reverse); } // namespace Slic3r #endif // slic3r_FillBase_hpp_ diff --git a/src/libslic3r/Fill/FillConcentric.cpp b/src/libslic3r/Fill/FillConcentric.cpp index f112d6243a..dff2e654e5 100644 --- a/src/libslic3r/Fill/FillConcentric.cpp +++ b/src/libslic3r/Fill/FillConcentric.cpp @@ -73,8 +73,7 @@ void FillConcentric::_fill_surface_single( } return true; }; - smooth_polygons_corners(loops, params.smooth_factor, scaled(params.resolution), 0.5 * distance, - corner_stays_inside); + smooth_polygons_corners(loops, params.corner_smoothing(), 0.5 * distance, corner_stays_inside); // generate paths from the outermost to the innermost, to avoid // adhesion problems of the first central tiny loops diff --git a/src/libslic3r/Fill/FillCornerSmoothing.cpp b/src/libslic3r/Fill/FillCornerSmoothing.cpp index f87de98293..f8af0a59d6 100644 --- a/src/libslic3r/Fill/FillCornerSmoothing.cpp +++ b/src/libslic3r/Fill/FillCornerSmoothing.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -18,104 +19,176 @@ namespace Slic3r { // coincide, so the corner would be rounded into a degenerate loop instead of a hairpin. static constexpr const double min_smoothed_turn_cosine = -0.9; -// The control points are expressed in the (incoming, outgoing) basis of the corner, which is not -// orthonormal for turns other than a right angle. -using QuinticBezier = std::array; +// Spacing of the control points of the corner curve along each leg, as a fraction of the reach. +static constexpr const double control_spacing = 0.3; -static bool is_bezier_flat(const QuinticBezier &curve, const Vec2d &incoming, const Vec2d &outgoing, const double deviation) +// Bounds the vertices of a corner whatever the tolerance. +static constexpr const size_t max_corner_vertices = 256; +// Bounds the corners a smoother keeps, for paths turning by ever new angles. +static constexpr const size_t max_cached_corners = 4096; + +// The control points of the quintic Bezier corner curve. +using ControlPoints = std::array; + +// The control points of the corner curve in a frame where the incoming leg runs along +x into the corner at +// the origin and the outgoing leg leaves it turning left. At each end, the first three control points are +// collinear and equally spaced: the tangent follows the adjoining leg and the second derivative is zero, +// so the curvature starts from zero and the toolhead eases into the turn. +static ControlPoints bezier_control_points(const double reach, const Vec2d &outgoing) { - // A Bezier curve stays inside the convex hull of its control points. Therefore, keeping every - // control point within a deviation-wide strip around the endpoint chord conservatively bounds the - // flattening error. The cross product is the perpendicular distance scaled by the chord length; - // comparing squared values avoids a square root. - auto in_plane = [&incoming, &outgoing](const Vec2d &c) { return c.x() * incoming + c.y() * outgoing; }; - const Vec2d chord = in_plane(curve.back() - curve.front()); - const double chord_length_sq = chord.squaredNorm(); - const double max_cross_sq = deviation * deviation * chord_length_sq; - - for (size_t i = 1; i + 1 < curve.size(); ++i) { - const Vec2d offset = in_plane(curve[i] - curve.front()); - const double cross = chord.x() * offset.y() - chord.y() * offset.x(); - if (cross * cross > max_cross_sq) - return false; - } - return true; + const double spacing = control_spacing * reach; + return { Vec2d(-reach, 0.), Vec2d(-(reach - spacing), 0.), Vec2d(-(reach - 2. * spacing), 0.), + (reach - 2. * spacing) * outgoing, (reach - spacing) * outgoing, reach * outgoing }; } -static void subdivide_bezier(const QuinticBezier &curve, QuinticBezier &left, QuinticBezier &right) +// The first and second derivatives of the curve, by de Casteljau down to its last three points. +static std::pair bezier_derivatives(const ControlPoints &control, const double t) { - // Split the curve at t = 0.5 using de Casteljau's algorithm. Each averaging level contributes one - // control point to the left half and one to the right half; the latter is filled backwards to keep - // both resulting control polygons in their original parameter direction. - QuinticBezier subdivision = curve; - left.front() = subdivision.front(); - right.back() = subdivision.back(); - for (size_t level = 1; level < curve.size(); ++level) { - for (size_t i = 0; i + level < curve.size(); ++i) - subdivision[i] = 0.5 * (subdivision[i] + subdivision[i + 1]); - left[level] = subdivision.front(); - right[curve.size() - level - 1] = subdivision[curve.size() - level - 1]; - } + ControlPoints work = control; + for (size_t count = work.size(); count > 3; --count) + for (size_t i = 0; i + 1 < count; ++i) + work[i] = (1. - t) * work[i] + t * work[i + 1]; + const double degree = double(work.size() - 1); + return { degree * ((1. - t) * (work[1] - work[0]) + t * (work[2] - work[1])), + degree * (degree - 1.) * (work[2] - 2. * work[1] + work[0]) }; } -static void flatten_bezier( - const QuinticBezier &curve, const Vec2d &incoming, const Vec2d &outgoing, const double deviation, std::vector &output) +static Vec2d bezier_point(const ControlPoints &control, const double t) { - // Subdivide to at least depth 1 so a rounded corner cannot collapse to a single diagonal chord. - // A uniform subdivision depth keeps samples at equal parameter intervals t = k / 2^depth, - // avoiding abrupt segment-length jumps at adaptive-depth boundaries. - static constexpr size_t max_depth = 16; + ControlPoints work = control; + for (size_t count = work.size(); count > 1; --count) + for (size_t i = 0; i + 1 < count; ++i) + work[i] = (1. - t) * work[i] + t * work[i + 1]; + return work.front(); +} - std::vector subcurves(2); - subdivide_bezier(curve, subcurves[0], subcurves[1]); +// A rounded corner of unit reach: its vertices in the (incoming, outgoing) basis of the corner, relative to it, +// and how far they stray from the curve. +struct UnitCorner +{ + std::vector vertices; + double deviation { 0. }; +}; - for (size_t depth = 1; depth < max_depth; ++depth) { - bool all_flat = true; - for (const QuinticBezier &c : subcurves) - if (!is_bezier_flat(c, incoming, outgoing, deviation)) { - all_flat = false; +// The corner shapes built on a thread. They depend on the turn and the vertex count only, so all the smoothers of +// the thread share them: some fills start a smoother for every path, and every layer starts its own. +struct CornerShapes +{ + std::map, UnitCorner> corners; + std::map peak_curvatures; +}; +static thread_local CornerShapes corner_shapes; + +// The peak curvature of the corner curve times its reach, which depends on the turn only. +static double peak_curvature_by_reach(const double cosine) +{ + std::map &cache = corner_shapes.peak_curvatures; + if (const auto it = cache.find(cosine); it != cache.end()) + return it->second; + + const double turn = std::acos(std::clamp(cosine, -1., 1.)); + const ControlPoints control = bezier_control_points(1., Vec2d(cosine, std::sin(turn))); + static constexpr const size_t samples = 256; + double peak = 0.; + for (size_t i = 0; i <= samples; ++i) { + const auto [first, second] = bezier_derivatives(control, double(i) / double(samples)); + const double speed = first.norm(); + if (speed > EPSILON) + peak = std::max(peak, std::abs(cross2(first, second)) / (speed * speed * speed)); + } + if (cache.size() >= max_cached_corners) + cache.clear(); + cache.emplace(cosine, peak); + return peak; +} + +// The polygon of `count` vertices of the corner of unit reach, and how far it strays from the curve. +static double tangent_polygon(const double cosine, const size_t count, std::vector &vertices) +{ + const double turn = std::acos(std::clamp(cosine, -1., 1.)); + const double sine = std::sin(turn); + const Vec2d outgoing(cosine, sine); + + // The lines tangent to the curve at equal steps of direction, both legs included, and halfway between them. + // Each vertex of the rounded corner is where two consecutive steps cross, so each turns by the same step. + std::vector> tangents; + tangents.reserve(2 * count + 1); + tangents.emplace_back(Vec2d(-1., 0.), Vec2d(1., 0.)); + const ControlPoints control = bezier_control_points(1., outgoing); + double from = 0.; + for (size_t i = 1; i < 2 * count; ++i) { + // The direction of the tangent grows monotonically along the curve, so Newton steps on it converge + // within the bracket of the parameter; a step leaving the bracket is replaced by a bisection. + const double angle = 0.5 * turn * double(i) / double(count); + double low = from, high = 1., t = 0.5 * (low + high); + for (int iteration = 0; iteration < 64 && high - low > 1e-15; ++iteration) { + const auto [first, second] = bezier_derivatives(control, t); + const double error = std::atan2(first.y(), first.x()) - angle; + if (std::abs(error) < 1e-14) break; - } - if (all_flat) - break; - std::vector finer(subcurves.size() * 2); - for (size_t i = 0; i < subcurves.size(); ++i) - subdivide_bezier(subcurves[i], finer[i * 2], finer[i * 2 + 1]); - subcurves = std::move(finer); + if (error < 0.) + low = t; + else + high = t; + const double rate = cross2(first, second) / first.squaredNorm(); + const double next = rate > 0. ? t - error / rate : low; + t = next > low && next < high ? next : 0.5 * (low + high); + } + from = low; + tangents.emplace_back(bezier_point(control, t), bezier_derivatives(control, t).first.normalized()); } + tangents.emplace_back(outgoing, outgoing); - // The curve start is deliberately omitted so it can be shared with the straight leg feeding into it. - output.clear(); - output.reserve(subcurves.size()); - for (const QuinticBezier &c : subcurves) - output.emplace_back(c.back()); + vertices.clear(); + vertices.reserve(count); + double deviation = 0.; + for (size_t i = 0; i < count; ++i) { + const auto &[point, direction] = tangents[2 * i]; + const auto &[next_point, next_direction] = tangents[2 * i + 2]; + const Vec2d vertex = point + (cross2(next_point - point, next_direction) / cross2(direction, next_direction)) * direction; + // The curve passes closest to the vertex about where it heads halfway between the two tangents. + deviation = std::max(deviation, (vertex - tangents[2 * i + 1].first).norm()); + // In the (incoming, outgoing) basis, which is not orthonormal for turns other than a right angle. + const double along_outgoing = vertex.y() / sine; + vertices.emplace_back(vertex.x() - along_outgoing * cosine, along_outgoing); + } + return deviation; } -const std::vector& CornerSmoother::curve_coefficients( - const double corner_distance, const Vec2d &incoming, const Vec2d &outgoing) +// Valid until the next corner of the thread is built. +static const UnitCorner &unit_corner(const double cosine, const size_t count) { - const double cosine = incoming.dot(outgoing); - // Corners of the same size and turn angle are congruent, so they flatten identically. An infill - // path walks over the very same corner over and over again, the Hilbert curve over a single one. - if (m_has_cached_coefficients && corner_distance == m_cached_distance && cosine == m_cached_cosine) - return m_cached_coefficients; + std::map, UnitCorner> &cache = corner_shapes.corners; + const std::pair key(cosine, count); + if (const auto it = cache.find(key); it != cache.end()) + return it->second; + if (cache.size() >= max_cached_corners) + cache.clear(); + UnitCorner corner; + corner.deviation = tangent_polygon(cosine, count, corner.vertices); + return cache.emplace(key, std::move(corner)).first->second; +} - // One canonical corner running from -corner_distance along the incoming leg to corner_distance - // along the outgoing one. At each end, the first three control points are collinear and equally - // spaced: the tangent follows the adjoining straight leg and the second derivative is zero. The - // endpoint curvature is therefore zero, giving G2 joins to both legs. - const double d = corner_distance; - const QuinticBezier corner_curve {{ - {-d, 0.}, {-0.7 * d, 0.}, {-0.4 * d, 0.}, {0., 0.4 * d}, {0., 0.7 * d}, {0., d} - }}; - // Retain a finite positive tolerance if the smoother was set up with an invalid one. - const double deviation = m_tolerance > 0. && std::isfinite(m_tolerance) ? m_tolerance : EPSILON; - flatten_bezier(corner_curve, incoming, outgoing, deviation, m_cached_coefficients); - - m_cached_distance = corner_distance; - m_cached_cosine = cosine; - m_has_cached_coefficients = true; - return m_cached_coefficients; +const std::vector *CornerSmoother::corner_vertices(const double reach, const double cosine) const +{ + const double tolerance = m_smoothing.tolerance > 0. && std::isfinite(m_smoothing.tolerance) ? m_smoothing.tolerance : EPSILON; + const double turn = std::acos(std::clamp(cosine, -1., 1.)); + const double curvature = peak_curvature_by_reach(cosine) / reach; + // Simplifying the path to the tolerance drops a vertex standing out of the chord of its neighbours by less, + // which the sharpest vertex of the curve does at finer steps than this. + const size_t most = size_t(std::min(double(max_corner_vertices), turn / std::sqrt(2. * curvature * tolerance))); + // The count an arc of the peak curvature takes; the flatter parts of the curve may need more. + size_t count = std::min(most, size_t(std::ceil(turn / std::sqrt(8. * curvature * tolerance) - EPSILON))); + if (count < 2) + return nullptr; + for (;;) { + const double deviation = reach * unit_corner(cosine, count).deviation; + if (deviation <= tolerance || count >= most) + break; + // The deviation falls about with the square of the count. + count = std::min(most, std::max(count + 1, size_t(std::ceil(double(count) * std::sqrt(deviation / tolerance))))); + } + return &unit_corner(cosine, count).vertices; } bool CornerSmoother::is_on_straight_run(const Vec2d &previous, const Vec2d &vertex, const Vec2d &next) @@ -150,29 +223,28 @@ void CornerSmoother::round_corner(const Vec2d &previous, const Vec2d &corner, co const Vec2d incoming = incoming_leg / incoming_length; const Vec2d outgoing = outgoing_leg / outgoing_length; const double cross = incoming.x() * outgoing.y() - incoming.y() * outgoing.x(); + // Snapped, so that the corners of one turn share the cached shapes whatever rounding their legs carry. + const double cosine = std::round(incoming.dot(outgoing) * 1e12) * 1e-12; // A collinear vertex is no corner at all, and a hairpin cannot be rounded, see above. - if (std::abs(cross) < EPSILON || incoming.dot(outgoing) < min_smoothed_turn_cosine) { + if (std::abs(cross) < EPSILON || cosine < min_smoothed_turn_cosine) { m_corner_points.emplace_back(corner); return; } // Consuming at most half of the shorter leg keeps the curves of two adjacent corners apart. - double corner_distance = m_corner_distance_ratio * std::min(incoming_length, outgoing_length); + double reach = m_corner_distance_ratio * std::min(incoming_length, outgoing_length); if (m_max_corner_distance > 0.) - corner_distance = std::min(corner_distance, m_max_corner_distance); + reach = std::min(reach, m_max_corner_distance); - const Vec2d curve_start = corner - corner_distance * incoming; - const Vec2d curve_end = corner + corner_distance * outgoing; - if (m_corner_filter && !m_corner_filter(curve_start, curve_end)) { + const std::vector *vertices = corner_vertices(reach, cosine); + if (vertices == nullptr || (m_corner_filter && !m_corner_filter(corner - reach * incoming, corner + reach * outgoing))) { m_corner_points.emplace_back(corner); return; } - const std::vector &coefficients = curve_coefficients(corner_distance, incoming, outgoing); - m_corner_points.reserve(coefficients.size() + 1); - m_corner_points.emplace_back(curve_start); - for (const Vec2d &coefficient : coefficients) - m_corner_points.emplace_back(corner + coefficient.x() * incoming + coefficient.y() * outgoing); + m_corner_points.reserve(vertices->size()); + for (const Vec2d &vertex : *vertices) + m_corner_points.emplace_back(corner + reach * (vertex.x() * incoming + vertex.y() * outgoing)); } // Rounds the corners of a scaled point sequence. A polygon closes implicitly, so all of its vertices @@ -209,31 +281,31 @@ static Points smooth_corners(const Points &points, const bool polygon, CornerSmo return smoothed; } -void smooth_polyline_corners(Polyline &polyline, const double smooth_factor, const double tolerance, - const double max_corner_distance, const CornerFilter &corner_filter) +void smooth_polyline_corners(Polyline &polyline, const CornerSmoothing &smoothing, const double max_corner_distance, + const CornerFilter &corner_filter) { - CornerSmoother smoother(smooth_factor, tolerance, max_corner_distance, corner_filter); + CornerSmoother smoother(smoothing, max_corner_distance, corner_filter); if (!smoother.enabled() || polyline.size() < 3) return; polyline.points = smooth_corners(polyline.points, false, smoother); - // Rounding back to the integer grid may collapse neighbouring samples of a curve. + // Rounding back to the integer grid may collapse neighbouring vertices of a corner. polyline.remove_duplicate_points(); } -void smooth_polylines_corners(Polylines &polylines, const double smooth_factor, const double tolerance, - const double max_corner_distance, const CornerFilter &corner_filter) +void smooth_polylines_corners(Polylines &polylines, const CornerSmoothing &smoothing, const double max_corner_distance, + const CornerFilter &corner_filter) { - if (sanitize_smooth_factor(smooth_factor) == 0.) + if (sanitize_smooth_factor(smoothing.factor) == 0.) return; for (Polyline &polyline : polylines) - smooth_polyline_corners(polyline, smooth_factor, tolerance, max_corner_distance, corner_filter); + smooth_polyline_corners(polyline, smoothing, max_corner_distance, corner_filter); } -void smooth_polygons_corners(Polygons &polygons, const double smooth_factor, const double tolerance, - const double max_corner_distance, const CornerFilter &corner_filter) +void smooth_polygons_corners(Polygons &polygons, const CornerSmoothing &smoothing, const double max_corner_distance, + const CornerFilter &corner_filter) { - CornerSmoother smoother(smooth_factor, tolerance, max_corner_distance, corner_filter); + CornerSmoother smoother(smoothing, max_corner_distance, corner_filter); if (!smoother.enabled()) return; @@ -242,8 +314,8 @@ void smooth_polygons_corners(Polygons &polygons, const double smooth_factor, con continue; polygon.points = smooth_corners(polygon.points, true, smoother); polygon.remove_duplicate_points(); - // The curves of the first and of the last corner may have met on the segment they share. A - // polygon closes implicitly, so it must not repeat its first vertex at the end. + // The vertices of the first and of the last corner may meet on the leg they share. A polygon closes + // implicitly, so it must not repeat its first vertex at the end. if (polygon.points.size() > 1 && polygon.points.front() == polygon.points.back()) polygon.points.pop_back(); } diff --git a/src/libslic3r/Fill/FillCornerSmoothing.hpp b/src/libslic3r/Fill/FillCornerSmoothing.hpp index b6acf20049..195283e641 100644 --- a/src/libslic3r/Fill/FillCornerSmoothing.hpp +++ b/src/libslic3r/Fill/FillCornerSmoothing.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -19,29 +20,39 @@ inline double sanitize_smooth_factor(double smooth_factor) return std::isfinite(smooth_factor) ? std::clamp(smooth_factor, 0., 1.) : 0.; } +// Orca: How the corners of an infill path are rounded. The tolerance is in the units of the points the smoother is fed. +struct CornerSmoothing +{ + // Fraction of the shorter adjoining leg a curve may reach along it, relative to half of that leg. + double factor { 0. }; + // The G-code resolution: a rounded corner keeps within it of its curve, and its vertices stand out of the + // path by at least it, so that simplifying the path to it keeps them. + double tolerance { 0. }; +}; + // Decides whether a corner may be replaced by the curve that leaves the path at `from` and rejoins it // at `to`, both in the coordinate system of the pushed points. Rounding cuts toward the inside of the // turn, so a path that is not clipped to the fill region afterwards needs this to stay inside it. using CornerFilter = std::function; -// Orca: Replaces the sharp vertices of an infill path with curves that join the adjoining straight -// legs with a continuous curvature, so the toolhead does not have to stop in every corner. -// Points are pushed one by one, because the plane path fills produce their path on the fly, and -// every point of the smoothed path is handed over to the caller supplied emit callback. -// Fully smoothed adjacent corners meet at the midpoint of the segment they share, so the emitted -// points may collapse onto each other once rounded to the integer grid of the caller. Dropping such -// duplicates is left to the caller, which is the only one knowing that grid. +// Orca: Replaces the sharp vertices of an infill path with curves joining the adjoining straight legs, so the +// toolhead does not have to slow down to a stop in every corner. A curve is printed as the polygon of its +// tangents taken at equal steps of direction, so every vertex of a rounded corner turns by the same angle: +// a planner limits the speed at a vertex by how much it turns, and equal turns make the most of each vertex. +// Points are pushed one by one, because the plane path fills produce their path on the fly, and every point +// of the smoothed path is handed over to the caller supplied emit callback. Points that collapse onto each +// other once rounded to the integer grid of the caller are left to the caller to drop. class CornerSmoother { public: - // tolerance is the maximum chordal deviation of the flattened curves, in the units of the pushed - // points. max_corner_distance caps how far a curve may reach along a leg, in the same units; it - // bounds how far a rounded corner moves away from the original path, which matters where the legs - // are much longer than the spacing of the pattern. Zero leaves the reach uncapped. - CornerSmoother(double smooth_factor, double tolerance, double max_corner_distance = 0., - CornerFilter corner_filter = {}) - : m_corner_distance_ratio(0.5 * sanitize_smooth_factor(smooth_factor)), m_tolerance(tolerance), - m_max_corner_distance(max_corner_distance), m_corner_filter(std::move(corner_filter)) + // max_corner_distance caps how far a curve may reach along a leg, in the units of the pushed points; it + // bounds how far a rounded corner moves away from the original path, which matters where the legs are + // much longer than the spacing of the pattern. Zero leaves the reach uncapped. + CornerSmoother(const CornerSmoothing &smoothing, double max_corner_distance = 0., CornerFilter corner_filter = {}) + : m_smoothing(smoothing) + , m_corner_distance_ratio(0.5 * sanitize_smooth_factor(smoothing.factor)) + , m_max_corner_distance(max_corner_distance) + , m_corner_filter(std::move(corner_filter)) {} bool enabled() const { return m_corner_distance_ratio > 0.; } @@ -93,22 +104,17 @@ private: static bool is_on_straight_run(const Vec2d &previous, const Vec2d &vertex, const Vec2d &next); // Fills m_corner_points with the points replacing the corner vertex. void round_corner(const Vec2d &previous, const Vec2d &corner, const Vec2d &next); - // Flattens the canonical corner curve of the given size and turn into coordinates of the - // (incoming, outgoing) basis of the corner. Cached, as an infill path repeats the same corner. - const std::vector& curve_coefficients(double corner_distance, const Vec2d &incoming, const Vec2d &outgoing); + // The vertices of the rounded corner of unit reach in the (incoming, outgoing) basis of the corner, relative to it, + // or none if the sharp corner keeps within the tolerance. A corner of another reach is this one scaled. + const std::vector *corner_vertices(double reach, double cosine) const; + const CornerSmoothing m_smoothing; // Fraction of the shorter adjoining leg consumed on each side of a corner. Half of a leg is the // maximum, otherwise the curves of two adjacent corners would overlap. const double m_corner_distance_ratio; - const double m_tolerance; const double m_max_corner_distance; const CornerFilter m_corner_filter; std::vector m_corner_points; - // Cached flattening of the last corner, valid for corners of the same size and turn angle. - std::vector m_cached_coefficients; - double m_cached_distance { 0. }; - double m_cached_cosine { 0. }; - bool m_has_cached_coefficients { false }; // The corners seen last, kept free of vertices that merely split a straight leg. The middle one // is rounded once the third arrives, which is what makes its outgoing leg final. @@ -120,12 +126,12 @@ private: // Rounds the corners of already scaled paths in place. Paths of less than three points are left alone. // Both ends of a polyline are kept where they are, even when they coincide: such a path retraces its // way back and joining its ends would turn it into a loop. See CornerSmoother for max_corner_distance. -void smooth_polyline_corners(Polyline &polyline, double smooth_factor, double tolerance, - double max_corner_distance = 0., const CornerFilter &corner_filter = {}); -void smooth_polylines_corners(Polylines &polylines, double smooth_factor, double tolerance, - double max_corner_distance = 0., const CornerFilter &corner_filter = {}); +void smooth_polyline_corners(Polyline &polyline, const CornerSmoothing &smoothing, double max_corner_distance = 0., + const CornerFilter &corner_filter = {}); +void smooth_polylines_corners(Polylines &polylines, const CornerSmoothing &smoothing, double max_corner_distance = 0., + const CornerFilter &corner_filter = {}); // Polygons close implicitly, so every one of their vertices is a corner. -void smooth_polygons_corners(Polygons &polygons, double smooth_factor, double tolerance, - double max_corner_distance = 0., const CornerFilter &corner_filter = {}); +void smooth_polygons_corners(Polygons &polygons, const CornerSmoothing &smoothing, double max_corner_distance = 0., + const CornerFilter &corner_filter = {}); } // namespace Slic3r diff --git a/src/libslic3r/Fill/FillCrossHatch.cpp b/src/libslic3r/Fill/FillCrossHatch.cpp index 79ca4743d9..a77bbaf021 100644 --- a/src/libslic3r/Fill/FillCrossHatch.cpp +++ b/src/libslic3r/Fill/FillCrossHatch.cpp @@ -214,7 +214,7 @@ void FillCrossHatch ::_fill_surface_single( for (Polyline &pl : polylines) { pl.translate(bb.min); } // Orca: round the corners of the transition layers. The repeat layers are straight lines and stay as they are. - smooth_polylines_corners(polylines, params.smooth_factor, scaled(params.resolution)); + smooth_polylines_corners(polylines, params.corner_smoothing()); // Apply multiline offset if needed multiline_fill(polylines, params, spacing); diff --git a/src/libslic3r/Fill/FillGyroid.cpp b/src/libslic3r/Fill/FillGyroid.cpp index 06cb55f70e..3ebb2f9633 100644 --- a/src/libslic3r/Fill/FillGyroid.cpp +++ b/src/libslic3r/Fill/FillGyroid.cpp @@ -18,7 +18,7 @@ #include "FillGyroid.hpp" #include "libslic3r/Polygon.hpp" #include "libslic3r/PrintConfig.hpp" -#include "FillTpmsAdaptive.hpp" +#include "AdaptiveInfillField.hpp" namespace Slic3r { @@ -315,8 +315,8 @@ void FillGyroid::_fill_surface_single( ExPolygon expolygon, Polylines &polylines_out) { - if (params.tpms_adaptive == TpmsAdaptiveMode::SteppedShells && this->tpms_radial_field != nullptr) { - fill_tpms_shells(*this->tpms_radial_field, expolygon, this->z - 0.5 * params.layer_height, params, this->spacing, + if (params.adaptive_infill_mode == AdaptiveInfillMode::SteppedShells && this->adaptive_infill_field != nullptr) { + fill_adaptive_infill_shells(*this->adaptive_infill_field, expolygon, this->z - 0.5 * params.layer_height, params, this->spacing, [&](const FillParams &shell_params, const ExPolygon &shell) { this->_fill_surface_single(shell_params, thickness_layers, direction, shell, polylines_out); }); @@ -342,11 +342,11 @@ void FillGyroid::_fill_surface_single( // generate pattern Polylines polylines; - if (params.tpms_adaptive != TpmsAdaptiveMode::Disabled && this->tpms_radial_field != nullptr) { + if (params.adaptive_infill_mode != AdaptiveInfillMode::Disabled && this->adaptive_infill_field != nullptr) { // Radians per mm of the regular pattern at a density. auto frequency = [¶ms, this](double density) { return density * DensityAdjust / (params.multiline * this->spacing); }; - polylines = make_adaptive_tpms({gyroid, frequency(params.density), frequency(params.tpms_interior_density), params.tpms_adaptive_gradient}, - *this->tpms_radial_field, bb, this->z, params.layer_height, this->spacing, infill_angle); + polylines = make_adaptive_tpms({gyroid, frequency(params.density), frequency(params.adaptive_infill_interior_density), params.adaptive_infill_gradient}, + *this->adaptive_infill_field, bb, this->z, params.layer_height, this->spacing, infill_angle); } else if (params.gyroid_optimized) { // Marching-squares path on the gyroid implicit field. Base period matches // the standard parametric path's wavelength: 2*pi * spacing / density_adj. diff --git a/src/libslic3r/Fill/FillHoneycomb.cpp b/src/libslic3r/Fill/FillHoneycomb.cpp index c9337074f7..3d2c4ae62c 100644 --- a/src/libslic3r/Fill/FillHoneycomb.cpp +++ b/src/libslic3r/Fill/FillHoneycomb.cpp @@ -79,10 +79,9 @@ void FillHoneycomb::_fill_surface_single( x += m.distance; } p.rotate(-direction.first, m.hex_center); - p.simplify(5 * spacing); // simplify to 5x line width // Orca: round the corners of the honeycomb cells. Done before the clipping, so that the // curves are cut by the region boundary just like the sharp path would be. - smooth_polyline_corners(p, params.smooth_factor, scaled(params.resolution)); + smooth_polyline_corners(p, params.corner_smoothing()); all_polylines.push_back(p); } } diff --git a/src/libslic3r/Fill/FillLightning.cpp b/src/libslic3r/Fill/FillLightning.cpp index a81ef31586..6bd5172db8 100644 --- a/src/libslic3r/Fill/FillLightning.cpp +++ b/src/libslic3r/Fill/FillLightning.cpp @@ -36,7 +36,7 @@ void Filler::_fill_surface_single( const double branch_width = scaled(this->spacing) * params.multiline; const double branch_spacing = branch_width / std::max(double(params.density), EPSILON); const double max_reach = 0.5 * (params.multiline > 1 ? branch_width : branch_spacing); - smooth_polylines_corners(fill_lines, params.smooth_factor, scaled(params.resolution), max_reach); + smooth_polylines_corners(fill_lines, params.corner_smoothing(), max_reach); // Apply multiline offset if needed multiline_fill(fill_lines, params, spacing); diff --git a/src/libslic3r/Fill/FillPlanePath.cpp b/src/libslic3r/Fill/FillPlanePath.cpp index 4e967affa4..5ae254f8e6 100644 --- a/src/libslic3r/Fill/FillPlanePath.cpp +++ b/src/libslic3r/Fill/FillPlanePath.cpp @@ -308,8 +308,8 @@ template class SmoothingPolylineOutput { public: - SmoothingPolylineOutput(Output &output, const double smooth_factor, const double tolerance) - : m_output(output), m_smoother(smooth_factor, tolerance) {} + SmoothingPolylineOutput(Output &output, const CornerSmoothing &smoothing) + : m_output(output), m_smoother(smoothing) {} void reserve(size_t n) { m_output.reserve(n); } void add_point(const Vec2d &pt) { auto emit = emitter(); m_smoother.push(pt, emit); } @@ -317,8 +317,8 @@ public: void finish() { auto emit = emitter(); m_smoother.flush(emit); } private: - // The curves of two adjacent corners meet at the midpoint of the segment they share, where they - // may round to the very same output point. Drop those, they would be zero length extrusions. + // Close vertices of a rounded corner may round to the very same output point. Drop those, they + // would be zero length extrusions. auto emitter() { return [this](const Vec2d &pt) { @@ -342,14 +342,15 @@ private: template static void generate_path(InfillPolylineOutput &output, const FillParams ¶ms, const double resolution, GenerateFn generate) { - const double smooth_factor = sanitize_smooth_factor(params.smooth_factor); - auto run = [smooth_factor, resolution, &generate](auto &out) { - if (smooth_factor == 0.) { + // The path runs in units of the line spacing, as the resolution passed in does. + const CornerSmoothing smoothing{ params.smooth_factor, resolution }; + auto run = [&smoothing, &generate](auto &out) { + if (sanitize_smooth_factor(smoothing.factor) == 0.) { generate(out); } else { - SmoothingPolylineOutput> smoothing(out, smooth_factor, resolution); - generate(smoothing); - smoothing.finish(); + SmoothingPolylineOutput> smoothing_output(out, smoothing); + generate(smoothing_output); + smoothing_output.finish(); } }; diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index f7954ef7fc..142afbae1a 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -3428,7 +3428,7 @@ bool FillRectilinear::fill_surface_trapezoidal( // Orca: round the corners of the trapezoids. The straight base lines of the triangular family // have no corner to round. - smooth_polylines_corners(polylines, params.smooth_factor, scaled(params.resolution)); + smooth_polylines_corners(polylines, params.corner_smoothing()); // Only the centerlines within d1 / 2 of the surface have outlines reaching it. polylines = intersection_pl(std::move(polylines), offset(expolygon, float(d1 / 2))); diff --git a/src/libslic3r/Fill/FillTpmsD.cpp b/src/libslic3r/Fill/FillTpmsD.cpp index 04f8222ca5..d1a9fae8fd 100644 --- a/src/libslic3r/Fill/FillTpmsD.cpp +++ b/src/libslic3r/Fill/FillTpmsD.cpp @@ -17,7 +17,7 @@ #include "libslic3r/PrintConfig.hpp" #include "libslic3r/libslic3r.h" #include "FillTpmsD.hpp" -#include "FillTpmsAdaptive.hpp" +#include "AdaptiveInfillField.hpp" namespace Slic3r { @@ -117,8 +117,8 @@ void FillTpmsD::_fill_surface_single( ExPolygon expolygon, Polylines &polylines_out) { - if (params.tpms_adaptive == TpmsAdaptiveMode::SteppedShells && this->tpms_radial_field != nullptr) { - fill_tpms_shells(*this->tpms_radial_field, expolygon, this->z - 0.5 * params.layer_height, params, this->spacing, + if (params.adaptive_infill_mode == AdaptiveInfillMode::SteppedShells && this->adaptive_infill_field != nullptr) { + fill_adaptive_infill_shells(*this->adaptive_infill_field, expolygon, this->z - 0.5 * params.layer_height, params, this->spacing, [&](const FillParams &shell_params, const ExPolygon &shell) { this->_fill_surface_single(shell_params, thickness_layers, direction, shell, polylines_out); }); @@ -130,13 +130,13 @@ void FillTpmsD::_fill_surface_single( expolygon.rotate(-infill_angle); Polylines polylines; - if (params.tpms_adaptive != TpmsAdaptiveMode::Disabled && this->tpms_radial_field != nullptr) { + if (params.adaptive_infill_mode != AdaptiveInfillMode::Disabled && this->adaptive_infill_field != nullptr) { // Radians per mm of the regular pattern at a density. auto frequency = [¶ms, this](double density) { return density * DensityAdjust / (params.multiline * this->spacing); }; BoundingBox bbox = expolygon.contour.bounding_box(); bbox.offset(scale_((params.multiline + 1) * this->spacing)); - polylines = make_adaptive_tpms({schwarz_d, frequency(params.density), frequency(params.tpms_interior_density), params.tpms_adaptive_gradient}, - *this->tpms_radial_field, bbox, this->z, params.layer_height, this->spacing, infill_angle); + polylines = make_adaptive_tpms({schwarz_d, frequency(params.density), frequency(params.adaptive_infill_interior_density), params.adaptive_infill_gradient}, + *this->adaptive_infill_field, bbox, this->z, params.layer_height, this->spacing, infill_angle); } else { BoundingBox bb = expolygon.contour.bounding_box(); // Density adjusted to have a good %of weight. diff --git a/src/libslic3r/Fill/FillTpmsFK.cpp b/src/libslic3r/Fill/FillTpmsFK.cpp index 819ef2998e..6ebc495dd6 100644 --- a/src/libslic3r/Fill/FillTpmsFK.cpp +++ b/src/libslic3r/Fill/FillTpmsFK.cpp @@ -8,7 +8,7 @@ #include "libslic3r/Fill/FillBase.hpp" #include "libslic3r/ExPolygon.hpp" #include "FillTpmsFK.hpp" -#include "FillTpmsAdaptive.hpp" +#include "AdaptiveInfillField.hpp" #include #include #include @@ -132,8 +132,8 @@ void FillTpmsFK::_fill_surface_single(const FillParams& params, ExPolygon expolygon, Polylines& polylines_out) { - if (params.tpms_adaptive == TpmsAdaptiveMode::SteppedShells && this->tpms_radial_field != nullptr) { - fill_tpms_shells(*this->tpms_radial_field, expolygon, this->z - 0.5 * params.layer_height, params, this->spacing, + if (params.adaptive_infill_mode == AdaptiveInfillMode::SteppedShells && this->adaptive_infill_field != nullptr) { + fill_adaptive_infill_shells(*this->adaptive_infill_field, expolygon, this->z - 0.5 * params.layer_height, params, this->spacing, [&](const FillParams &shell_params, const ExPolygon &shell) { this->_fill_surface_single(shell_params, thickness_layers, direction, shell, polylines_out); }); @@ -151,10 +151,10 @@ void FillTpmsFK::_fill_surface_single(const FillParams& params, // Enlarge the bounding box by the multi-line width to avoid artifacts at the edges. bbox.offset(scale_((params.multiline + 1) * spacing)); Polylines polylines; - if (params.tpms_adaptive != TpmsAdaptiveMode::Disabled && this->tpms_radial_field != nullptr) { - polylines = make_adaptive_tpms({fischer_koch, 2. * PI / period(params.density), 2. * PI / period(params.tpms_interior_density), - params.tpms_adaptive_gradient}, - *this->tpms_radial_field, bbox, this->z, params.layer_height, spacing, infill_angle); + if (params.adaptive_infill_mode != AdaptiveInfillMode::Disabled && this->adaptive_infill_field != nullptr) { + polylines = make_adaptive_tpms({fischer_koch, 2. * PI / period(params.density), 2. * PI / period(params.adaptive_infill_interior_density), + params.adaptive_infill_gradient}, + *this->adaptive_infill_field, bbox, this->z, params.layer_height, spacing, infill_angle); } else { marchsq::ScalarField sf = marchsq::ScalarField(bbox, this->z, period(params.density)); // Get simplified lines using coarse tolerance of 0.1mm (this is infill). diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 1500483f6e..780a7035e0 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1,4 +1,5 @@ #include "ArcFitter.hpp" +#include #include "BoundingBox.hpp" #include "Circle.hpp" #include "Config.hpp" @@ -152,6 +153,53 @@ namespace fs = boost::filesystem; namespace Slic3r { +namespace { + +// Follow XY commands in a generated G-code block. This deliberately handles +// only standard motion/modal commands: an opaque macro that moves the head is +// already outside the position guarantees made by GCodeWriter. +std::optional emitted_xy_after_gcode(const std::string &gcode, const Vec2d &initial_xy) +{ + Vec2d position = initial_xy; + bool absolute = true; + bool coordinate_frame_known = true; + + GCodeReader reader; + reader.parse_buffer(gcode, [&position, &absolute, &coordinate_frame_known](GCodeReader &, const GCodeReader::GCodeLine &line) { + if (line.cmd_is("G90")) { + absolute = true; + return; + } + if (line.cmd_is("G91")) { + absolute = false; + return; + } + + const bool is_motion = line.cmd_is("G0") || line.cmd_is("G1") || line.cmd_is("G2") || line.cmd_is("G3"); + if (is_motion) { + if (line.has_x()) + position.x() = absolute ? line.x() : position.x() + line.x(); + if (line.has_y()) + position.y() = absolute ? line.y() : position.y() + line.y(); + return; + } + + // G92 changes the coordinate system without moving the machine, and + // G28 moves to a firmware-defined position. Do not invent a position + // if either command affects XY. + if (line.cmd_is("G92")) { + coordinate_frame_known = coordinate_frame_known && !line.has_x() && !line.has_y(); + } else if (line.cmd_is("G28")) { + const bool homes_all = !line.has_x() && !line.has_y() && !line.has_z(); + coordinate_frame_known = coordinate_frame_known && !homes_all && !line.has_x() && !line.has_y(); + } + }); + + return coordinate_frame_known ? std::optional(position) : std::nullopt; +} + +} // namespace + //! macro used to mark string used at localization, //! return same string #define L(s) (s) @@ -1056,6 +1104,9 @@ static std::vector get_path_of_change_filament(const Print& print) if (new_filament_id != -1 && new_filament_id != tcr.new_tool) throw Slic3r::InvalidArgument("Error: WipeTowerIntegration::append_tcr was asked to do a toolchange it didn't expect."); + const std::optional position_before_toolchange = + gcodegen.capture_toolchange_position(); + int new_extruder_id = get_extruder_index(*m_print_config, new_filament_id); // Logical nozzle grouping for this print (null on paths that don't populate it). @@ -1135,12 +1186,14 @@ static std::vector get_path_of_change_filament(const Print& print) const std::string& filament_end_gcode = gcodegen.config().filament_end_gcode.get_at(old_filament_id); if (gcodegen.writer().filament() != nullptr && !filament_end_gcode.empty()) { DynamicConfig config; + config.set_key_value("filament_extruder_id", new ConfigOptionInt((int) old_filament_id)); config.set_key_value("current_filament_id", new ConfigOptionInt((int) old_filament_id)); config.set_key_value("current_nozzle_id", new ConfigOptionInt(nozzle_id_for_gcode_placeholder(group_result, (int) old_filament_id, (int) gcodegen.writer().filament()->extruder_id(), m_layer_idx))); config.set_key_value("nozzle_diameter_at_nozzle_id", new ConfigOptionFloats(get_nozzle_diameters_by_nozzle_id(group_result.get()))); config.set_key_value("nozzle_volume_types", new ConfigOptionStrings(get_nozzle_volume_types_by_nozzle_id(group_result.get()))); config.set_key_value("layer_num", new ConfigOptionInt(gcodegen.m_layer_index)); config.set_key_value("layer_z", new ConfigOptionFloat(tcr.print_z)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(gcodegen.m_max_layer_z)); if (!gcodegen.m_filament_instances_code.empty()) { end_filament_gcode_str += ("M624 " + gcodegen.m_filament_instances_code + "\n"); gcodegen.m_filament_instances_code = ""; @@ -1435,6 +1488,13 @@ static std::vector get_path_of_change_filament(const Print& print) // We have informed the m_writer about the current extruder_id, we can ignore the generated G-code. } + // The change G-code may move the carriage even when the incoming + // filament uses the same physical nozzle (the common AMS case). + // Synchronize before planning the tower-entry travel so exclusion + // avoidance starts from the emitted position, not the stale one. + if (position_before_toolchange) + gcodegen.synchronize_toolchange_position(*position_before_toolchange, toolchange_gcode_str); + if (need_travel_after_change_filament_gcode) { // move to start_pos for wiping after toolchange if (!is_used_travel_avoid_perimeter) { @@ -1524,6 +1584,9 @@ static std::vector get_path_of_change_filament(const Print& print) config.set_key_value("current_nozzle_id", new ConfigOptionInt(nozzle_id_for_gcode_placeholder(group_result, new_filament_id, new_extruder_id, m_layer_idx))); config.set_key_value("nozzle_diameter_at_nozzle_id", new ConfigOptionFloats(get_nozzle_diameters_by_nozzle_id(group_result.get()))); config.set_key_value("nozzle_volume_types", new ConfigOptionStrings(get_nozzle_volume_types_by_nozzle_id(group_result.get()))); + config.set_key_value("layer_num", new ConfigOptionInt(gcodegen.m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(tcr.print_z)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(gcodegen.m_max_layer_z)); start_filament_gcode_str = gcodegen.placeholder_parser_process("filament_start_gcode", filament_start_gcode, new_filament_id, &config); if (add_change_filament_624) { start_filament_gcode_str += "M625\n"; @@ -1580,6 +1643,8 @@ static std::vector get_path_of_change_filament(const Print& print) // Let the planner know we are traveling between objects. gcodegen.m_avoid_crossing_perimeters.use_external_mp_once(); + if (position_before_toolchange) + gcodegen.synchronize_toolchange_position(*position_before_toolchange, gcode); return gcode; } @@ -1591,6 +1656,9 @@ static std::vector get_path_of_change_filament(const Print& print) if (new_extruder_id != -1 && new_extruder_id != tcr.new_tool) throw Slic3r::InvalidArgument("Error: WipeTowerIntegration::append_tcr was asked to do a toolchange it didn't expect."); + const std::optional position_before_toolchange = + gcodegen.capture_toolchange_position(); + std::string gcode; // Toolchangeresult.gcode assumes the wipe tower corner is at the origin (except for priming lines) @@ -1875,6 +1943,8 @@ static std::vector get_path_of_change_filament(const Print& print) // Let the planner know we are traveling between objects. gcodegen.m_avoid_crossing_perimeters.use_external_mp_once(); + if (position_before_toolchange) + gcodegen.synchronize_toolchange_position(*position_before_toolchange, gcode); return gcode; } @@ -2644,9 +2714,11 @@ static void set_mass_locator(GCodeProcessor &processor, const Print &print) model_instances.begin()); } bodies_total += int(count * object->instances().size()); + // Without bodies only the instance matters, which any island box of an instance no other reaches proves. The + // islands of crowded instances are tested strictly anyway. for (const Layer *layer : layers) { o.print_zs.emplace_back(layer->print_z); - o.islands.emplace_back(layer->lslices, scaled(1.)); + o.islands.emplace_back(layer->lslices, scaled(1.), o.bodies_count > 0); } } if (objects.empty()) @@ -2706,12 +2778,13 @@ static void set_mass_locator(GCodeProcessor &processor, const Print &print) return GCodeProcessor::MassLocation{ o.first_instance + int(hit.instance), o.bodies_count == 0 ? -1 : o.first_body + int(hit.instance * o.bodies_count + o.bodies[hit.layer][hit.island]) }; }; - // A point lies on the first layer at or above it, as spiral vase rises through each layer. + // A point lies on the first layer whose print_z is at least its height less the tolerance, as spiral vase rises + // through each layer. Both paths below pick it alike, as lower_bound does. + const double z = point.z() - z_tolerance; // Extrusions mostly follow each other on one island. if (last) { const Object &o = objects[last->object]; - if (point.z() <= o.print_zs[last->layer] + z_tolerance && - (last->layer == 0 || point.z() > o.print_zs[last->layer - 1] + z_tolerance) && + if (!(o.print_zs[last->layer] < z) && (last->layer == 0 || o.print_zs[last->layer - 1] < z) && o.islands[last->layer].holds(last->island, local(last->object, last->instance), o.crowded[last->instance])) return location(*last); } @@ -2720,10 +2793,10 @@ static void set_mass_locator(GCodeProcessor &processor, const Print &print) double distance = std::numeric_limits::max(); for (size_t object = 0; object < objects.size(); ++object) { const Object &o = objects[object]; - const auto z = std::lower_bound(o.print_zs.begin(), o.print_zs.end(), point.z() - z_tolerance); - if (z == o.print_zs.end()) + const auto above = std::lower_bound(o.print_zs.begin(), o.print_zs.end(), z); + if (above == o.print_zs.end()) continue; - const size_t layer = size_t(z - o.print_zs.begin()); + const size_t layer = size_t(above - o.print_zs.begin()); for (size_t instance = 0; instance < o.object->instances().size(); ++instance) { const auto [island, d] = o.islands[layer].find(local(object, instance), o.crowded[instance]); if (island < 0) @@ -2749,6 +2822,8 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu // BBS m_curr_print = print; m_skirt_group_done.clear(); + m_pending_start_gcode_position.reset(); + m_exclusion_volume_travel_avoidance.init(print->config(), print->get_plate_origin()); GCodeWriter::full_gcode_comment = print->config().gcode_comments; CNumericLocalesSetter locales_setter; @@ -2930,6 +3005,23 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu m_processor.result().nozzle_group_result = m_print->get_layered_nozzle_group_result(); m_processor.finalize(true); + if (m_processor.get_result().exclusion_volume_path_conflict) { + const int extruder_id = m_processor.get_result().exclusion_volume_conflict_extruder_id; + std::string warning = extruder_id >= 0 ? + Slic3r::format( + _(L("A G-code move intersects a collision volume for extruder %1%. This may cause a printer collision.")), + std::to_string(extruder_id + 1)) : + _(L("A G-code move intersects a collision volume. This may cause a printer collision.")); + if (m_processor.get_result().exclusion_volume_conflict_used_unknown_z) { + warning += "\n" + Slic3r::format( + _(L("The intersecting move is at G-code line %1%. Its Z position is unknown after homing, so Orca checked it against every height.")), + std::to_string(m_processor.get_result().exclusion_volume_conflict_gcode_id)); + } + print->active_step_add_warning( + PrintStateBase::WarningLevel::CRITICAL, + warning, + PrintStateBase::SlicingExclusionVolumeToolpath); + } // DoExport::update_print_estimated_times_stats(m_processor, print->m_print_statistics); DoExport::update_print_estimated_stats(m_processor, m_writer.extruders(), print->m_print_statistics, print->config()); // Printed-mass safety check. Flushed filament leaves the bed, so subtract it @@ -3000,11 +3092,9 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu // free functions called by GCode::_do_export() namespace DoExport { - static void init_gcode_processor(const PrintConfig& config, GCodeProcessor& processor, bool& silent_time_estimator_enabled, + static void init_gcode_processor(const PrintConfig& config, GCodeProcessor& processor, const std::shared_ptr& nozzle_group_result = nullptr) { - silent_time_estimator_enabled = (config.gcode_flavor == gcfMarlinLegacy || config.gcode_flavor == gcfMarlinFirmware) - && config.silent_mode; processor.reset(); // Slot-resolution context for the streaming replay (reset() just cleared it). This is NOT // the post-stream result-field handover at the end of do_export, which gates the richer @@ -3012,7 +3102,7 @@ namespace DoExport { processor.initialize_from_context(nozzle_group_result); processor.initialize_result_moves(); processor.apply_config(config); - processor.enable_stealth_time_estimator(silent_time_estimator_enabled); + processor.configure_exclusion_volume_path_check(config); } #if 0 @@ -3294,12 +3384,17 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato m_print = &print; m_timelapse_pos_picker.init(&print,m_writer.get_xy_offset().cast()); + { + // Runs the costly per-layer snapshot picker only for a template that names its results. + const std::string &templ = print.config().time_lapse_gcode.value; + m_timelapse_uses_pos = templ.find("timelapse_pos") != std::string::npos || + templ.find("has_timelapse_safe_pos") != std::string::npos; + m_timelapse_uses_clear_to_x0 = templ.find("clear_to_x0") != std::string::npos; + } // init as filament map update_layer_related_config(0); - // modifies m_silent_time_estimator_enabled - DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled, - print.get_layered_nozzle_group_result()); + DoExport::init_gcode_processor(print.config(), m_processor, print.get_layered_nozzle_group_result()); set_mass_locator(m_processor, print); const bool is_bbl_printers = print.is_BBL_printer(); const bool skip_config_block = print.config().gcode_skip_config_block; @@ -3979,22 +4074,22 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato this->placeholder_parser().set("hold_chamber_temp_for_flat_print", new ConfigOptionBool(hold_chamber_temp_for_flat_print)); } - this->placeholder_parser().set("print_time_total_sec", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Total_Sec_Placeholder))); - this->placeholder_parser().set("print_time_day", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Day_Placeholder))); - this->placeholder_parser().set("print_time_hour", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Hour_Placeholder))); - this->placeholder_parser().set("print_time_minute", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Minute_Placeholder))); - this->placeholder_parser().set("print_time_sec", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Sec_Placeholder))); - this->placeholder_parser().set("used_filament_length", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Used_Filament_Length_Placeholder))); + this->placeholder_parser().set_deferred("print_time_total_sec", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Total_Sec_Placeholder)); + this->placeholder_parser().set_deferred("print_time_day", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Day_Placeholder)); + this->placeholder_parser().set_deferred("print_time_hour", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Hour_Placeholder)); + this->placeholder_parser().set_deferred("print_time_minute", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Minute_Placeholder)); + this->placeholder_parser().set_deferred("print_time_sec", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Print_Time_Sec_Placeholder)); + this->placeholder_parser().set_deferred("used_filament_length", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Used_Filament_Length_Placeholder)); // The final print statistics are known only after the whole G-code is generated, so they are filled in during post-processing too. // The running extruded_* totals are left alone; profiles use them as numbers. - this->placeholder_parser().set("used_filament", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Used_Filament_Length_Placeholder))); - this->placeholder_parser().set("print_time", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Normal_Print_Time_Placeholder))); - this->placeholder_parser().set("normal_print_time", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Normal_Print_Time_Placeholder))); - this->placeholder_parser().set("silent_print_time", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Silent_Print_Time_Placeholder))); - this->placeholder_parser().set("total_weight", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Weight_Placeholder))); - this->placeholder_parser().set("total_cost", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Cost_Placeholder))); - this->placeholder_parser().set("total_wipe_tower_cost", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Wipe_Tower_Cost_Placeholder))); - this->placeholder_parser().set("total_wipe_tower_filament", new ConfigOptionString(GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Wipe_Tower_Filament_Placeholder))); + this->placeholder_parser().set_deferred("used_filament", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Used_Filament_Length_Placeholder)); + this->placeholder_parser().set_deferred("print_time", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Normal_Print_Time_Placeholder)); + this->placeholder_parser().set_deferred("normal_print_time", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Normal_Print_Time_Placeholder)); + this->placeholder_parser().set_deferred("silent_print_time", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Silent_Print_Time_Placeholder)); + this->placeholder_parser().set_deferred("total_weight", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Weight_Placeholder)); + this->placeholder_parser().set_deferred("total_cost", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Cost_Placeholder)); + this->placeholder_parser().set_deferred("total_wipe_tower_cost", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Wipe_Tower_Cost_Placeholder)); + this->placeholder_parser().set_deferred("total_wipe_tower_filament", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Wipe_Tower_Filament_Placeholder)); // Sync variant-mapped params into placeholder_parser before processing start gcode update_placeholder_parser_with_variant_params(); @@ -4297,6 +4392,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato config.set_key_value("nozzle_diameter_at_nozzle_id", new ConfigOptionFloats(get_nozzle_diameters_by_nozzle_id(group_result.get()))); config.set_key_value("nozzle_volume_types", new ConfigOptionStrings(get_nozzle_volume_types_by_nozzle_id(group_result.get()))); config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(m_writer.get_position().z() - m_config.z_offset.value)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); std::string filament_start_gcode = this->placeholder_parser_process("filament_start_gcode", print.config().filament_start_gcode.get_at(initial_non_support_extruder_id), initial_non_support_extruder_id,&config); file.writeln(filament_start_gcode); // Mark the first filament used in print. Multi-nozzle printers (H2C) get ";VT%d H%d" where @@ -4432,6 +4529,17 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato } } + // Direct output writes are parsed synchronously. Preserve the startup + // endpoint before the generator establishes its first model-space point, + // so that first travel can be planned from the position the G-code actually + // left the machine at rather than the default last_pos value. + GCodeProcessor::PositionState startup_position = m_processor.get_current_position(); + const Vec2f plate_offset = m_writer.get_xy_offset(); + startup_position.position.x() += plate_offset.x(); + startup_position.position.y() += plate_offset.y(); + m_pending_start_gcode_position = !m_last_pos_defined && startup_position.has_known_xy() ? + std::optional(startup_position) : std::nullopt; + this->m_objsWithBrim.clear(); m_brim_done = false; @@ -5388,7 +5496,9 @@ int GCode::get_highest_bed_temperature(const bool is_first_layer, const Print& p { auto bed_type = m_config.curr_bed_type; int bed_temp = 0; - for (auto fidx : print.get_slice_used_filaments(is_first_layer)) { + // Only the filaments printed on the first layer touch the bed, so a filament that starts higher up, such as a + // support interface, must not raise the bed temperature for the rest of the print. + for (auto fidx : print.get_slice_used_filaments(true)) { bed_temp = std::max(bed_temp, get_bed_temperature(fidx, is_first_layer, bed_type)); } return bed_temp; @@ -5869,8 +5979,13 @@ std::string GCode::generate_object_skirt_group(const Print &print, object_skirt_tools, layer, extruder_id, m_skirt_group_done[group_idx]); } -std::string GCode::generate_object_brim(const Print &print, const PrintObject &object, size_t instance_id, bool first_layer, - const Layer *object_layer) +std::string GCode::generate_object_brim( + const Print &print, + const PrintObject &object, + const size_t instance_id, + const bool first_layer, + const unsigned int extruder_id, + const Layer *object_layer) { // Belt printers lay the brim onto the tilted belt over many layers, so there is // nothing special about the first one. The bands that coincide with an object @@ -5909,8 +6024,17 @@ std::string GCode::generate_object_brim(const Print &print, const PrintObject &o if (!first_layer) return {}; - auto emit_brim = [this](const ExtrusionEntityCollection& brim, const std::vector& instances) { + const bool wait_for_owner_filament = has_bed_exclude_volumes(m_config) && + active_bed_exclude_volume_mode(m_config) != BedExcludeVolumeMode::Shared; + auto emit_brim = [this, extruder_id, wait_for_owner_filament](const ExtrusionEntityCollection& brim, + const std::vector& instances, + const unsigned int brim_filament_id) { std::string gcode; + // Combined brims have an explicit owner filament. Waiting for that + // filament is only required when each nozzle has different obstacles. + // Otherwise retain Orca's established first-visit emission order. + if (wait_for_owner_filament && brim_filament_id != extruder_id) + return gcode; const bool already_emitted = std::none_of(instances.begin(), instances.end(), [this](const ObjectInstanceID& instance) { return m_objsWithBrim.find(instance) != m_objsWithBrim.end(); }); @@ -5935,13 +6059,49 @@ std::string GCode::generate_object_brim(const Print &print, const PrintObject &o std::string gcode; for (const Print::SkirtBrimGroup::Brim& brim : print.skirt_brim_groups()[group_idx].brims) if (std::find(brim.instances.begin(), brim.instances.end(), object_instance_id) != brim.instances.end()) - gcode += emit_brim(brim.brim, brim.instances); + gcode += emit_brim(brim.brim, brim.instances, brim.filament_id); return gcode; } return {}; } +std::string GCode::process_layer_change_gcode(const Print &print, coordf_t print_z, int most_used_extruder, bool has_wipe_tower) +{ + DynamicConfig config; + config.set_key_value("most_used_physical_extruder_id", new ConfigOptionInt(m_config.physical_extruder_map.get_at(most_used_extruder))); + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); + { + const int cur_filament_id = (int) m_writer.filament()->id(); + const auto group_result = m_print->get_layered_nozzle_group_result(); + config.set_key_value("current_filament_id", new ConfigOptionInt(cur_filament_id)); + config.set_key_value("current_nozzle_id", new ConfigOptionInt( + nozzle_id_for_gcode_placeholder(group_result, cur_filament_id, (int) m_writer.filament()->extruder_id(), m_layer_index))); + } + + PrintStatistics curr_print_statistics; + for (const Extruder &extruder : m_writer.extruders()) { + double extruded_volume = extruder.extruded_volume() + (has_wipe_tower ? print.wipe_tower_data().used_filament[extruder.id()] * 2.4052f : 0.f); // assumes 1.75mm filament diameter + double filament_weight = extruded_volume * extruder.filament_density() * 0.001; + if (filament_weight > 0.) + curr_print_statistics.total_weight += filament_weight; + } + double curr_y_acceleration_limit = -1, curr_accumulated_mass = -1; + mass_load_limited_machine_acceleration(curr_print_statistics, print, curr_y_acceleration_limit, curr_accumulated_mass); + double curr_layer_mass = curr_print_statistics.total_weight - m_last_layer_accumulated_mass; + if (curr_layer_mass <= EPSILON) curr_layer_mass = 0.0; + m_last_layer_accumulated_mass = curr_print_statistics.total_weight; + config.set_key_value("curr_y_acceleration_limit", new ConfigOptionFloat(curr_y_acceleration_limit)); + config.set_key_value("curr_accumulated_mass", new ConfigOptionFloat(curr_accumulated_mass)); + config.set_key_value("curr_layer_mass", new ConfigOptionFloat(curr_layer_mass)); + + return this->placeholder_parser_process("layer_change_gcode", + print.config().layer_change_gcode.value, m_writer.filament()->id(), &config) + + "\n"; +} + // Belt printers: emit one brim-only apron layer. On a tilted belt the brim ahead // of the part lands at slicing Z below the object's first layer, because the // object's layer 0 IS its leading contact with the belt. Those layers carry brim @@ -5957,7 +6117,8 @@ LayerResult GCode::process_belt_brim_layer( const std::vector &layers, const LayerTools &layer_tools, const bool last_layer, - const size_t single_object_instance_idx) + const size_t single_object_instance_idx, + const int most_used_extruder) { // layer_id 0 is deliberate, not a placeholder. CoolingBuffer reads it for the // initial_layer_fan_speed override and the close_fan_the_first_x_layers gate @@ -6029,14 +6190,8 @@ LayerResult GCode::process_belt_brim_layer( gcode += this->change_layer(print_z); - if (! m_config.layer_change_gcode.value.empty()) { - DynamicConfig config; - config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); - config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); - config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); - gcode += this->placeholder_parser_process("layer_change_gcode", - print.config().layer_change_gcode.value, m_writer.filament()->id(), &config) + "\n"; - } + if (! m_config.layer_change_gcode.value.empty()) + gcode += this->process_layer_change_gcode(print, print_z, most_used_extruder, layer_tools.has_wipe_tower && m_wipe_tower); // Objects sharing this apron Z may use different brim filaments; print each in its own tool. for (const unsigned int brim_extruder : layer_tools.extruders) { @@ -6304,41 +6459,10 @@ std::string GCode::generate_timelapse_gcode(const Print &print, coordf_t print_z if (!m_writer.filament()) return {}; - PosPickCtx ctx; - ctx.curr_pos = { (coord_t)(scale_(m_writer.get_position().x())),(coord_t)(scale_(m_writer.get_position().y())) }; - ctx.curr_layer = this->layer(); - ctx.curr_extruder_id = m_writer.filament()->extruder_id(); - ctx.picture_extruder_id = most_used_extruder; - if (m_farthest_point_timelapse.enabled) { - // farthest_point is stored in the global print frame (includes plate origin); the picker works in - // the plate-relative frame, so subtract the plate origin here. - Vec3d po = print.get_plate_origin(); - ctx.farthest_point = m_farthest_point_timelapse.farthest_point - Point(scale_(po.x()), scale_(po.y())); - } - if (m_config.print_sequence == PrintSequence::ByObject && printed_objects) - ctx.printed_objects = *printed_objects; - - auto timelapse_pos = skip_pos_pick ? DefaultTimelapsePos : m_timelapse_pos_picker.pick_pos(ctx); - std::string timelapse_gcode; if (!print.config().time_lapse_gcode.value.empty()) { - DynamicConfig config; - config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); - config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); - config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); - config.set_key_value("most_used_physical_extruder_id", new ConfigOptionInt(m_config.physical_extruder_map.get_at(most_used_extruder))); - config.set_key_value("curr_physical_extruder_id", new ConfigOptionInt(m_config.physical_extruder_map.get_at(ctx.curr_extruder_id))); - config.set_key_value("timelapse_pos_x", new ConfigOptionInt((int)timelapse_pos.x())); - config.set_key_value("timelapse_pos_y", new ConfigOptionInt((int)timelapse_pos.y())); - config.set_key_value("has_timelapse_safe_pos", new ConfigOptionBool(timelapse_pos != DefaultTimelapsePos)); - // Timelapse-context vars. - config.set_key_value("timelapse_inline_photo", new ConfigOptionBool(skip_pos_pick)); - // Drive the template ternary Z{layer_z + (farthest_point_timelapse_enabled ? 0.0 : 0.4)} from the - // effective (per-layer, config+traditional+non-i3-folded) enabled state. False for every printer - // that leaves the toggle off, so their template evaluates to the pre-existing +0.4 lift byte-for-byte. - config.set_key_value("farthest_point_timelapse_enabled", new ConfigOptionBool(m_farthest_point_timelapse.enabled)); - config.set_key_value("clear_to_x0", new ConfigOptionBool(m_timelapse_pos_picker.get_is_clear_to_x0(ctx))); - timelapse_gcode = this->placeholder_parser_process("timelapse_gcode", print.config().time_lapse_gcode.value, m_writer.filament()->id(), &config) + "\n"; + const DynamicConfig config = timelapse_gcode_config(print, print_z, most_used_extruder, printed_objects, skip_pos_pick); + timelapse_gcode = this->placeholder_parser_process("time_lapse_gcode", print.config().time_lapse_gcode.value, m_writer.filament()->id(), &config) + "\n"; } if (!timelapse_gcode.empty()) { @@ -6377,6 +6501,42 @@ std::string GCode::generate_timelapse_gcode(const Print &print, coordf_t print_z return timelapse_gcode; } +DynamicConfig GCode::timelapse_gcode_config(const Print &print, coordf_t print_z, int most_used_extruder, + const std::vector *printed_objects, + bool skip_pos_pick) +{ + assert(m_writer.filament()); + PosPickCtx ctx; + ctx.curr_pos = { (coord_t)(scale_(m_writer.get_position().x())),(coord_t)(scale_(m_writer.get_position().y())) }; + ctx.curr_layer = this->layer(); + ctx.curr_extruder_id = m_writer.filament()->extruder_id(); + ctx.picture_extruder_id = most_used_extruder; + if (m_farthest_point_timelapse.enabled) { + // farthest_point is stored in the global print frame (includes plate origin); the picker works in + // the plate-relative frame, so subtract the plate origin here. + Vec3d po = print.get_plate_origin(); + ctx.farthest_point = m_farthest_point_timelapse.farthest_point - Point(scale_(po.x()), scale_(po.y())); + } + if (m_config.print_sequence == PrintSequence::ByObject && printed_objects) + ctx.printed_objects = *printed_objects; + + auto timelapse_pos = (skip_pos_pick || !m_timelapse_uses_pos) ? DefaultTimelapsePos : m_timelapse_pos_picker.pick_pos(ctx); + + DynamicConfig config; + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); + config.set_key_value("most_used_physical_extruder_id", new ConfigOptionInt(m_config.physical_extruder_map.get_at(most_used_extruder))); + config.set_key_value("curr_physical_extruder_id", new ConfigOptionInt(m_config.physical_extruder_map.get_at(ctx.curr_extruder_id))); + config.set_key_value("timelapse_pos_x", new ConfigOptionInt((int)timelapse_pos.x())); + config.set_key_value("timelapse_pos_y", new ConfigOptionInt((int)timelapse_pos.y())); + config.set_key_value("has_timelapse_safe_pos", new ConfigOptionBool(timelapse_pos != DefaultTimelapsePos)); + config.set_key_value("timelapse_inline_photo", new ConfigOptionBool(skip_pos_pick)); + config.set_key_value("farthest_point_timelapse_enabled", new ConfigOptionBool(m_farthest_point_timelapse.enabled)); + config.set_key_value("clear_to_x0", new ConfigOptionBool(m_timelapse_uses_clear_to_x0 && m_timelapse_pos_picker.get_is_clear_to_x0(ctx))); + return config; +} + // In sequential mode, process_layer is called once per each object and its copy, // therefore layers will contain a single entry and single_object_instance_idx will point to the copy of the object. // In non-sequential mode, process_layer is called per each print_z height with all object and support layers accumulated. @@ -6422,7 +6582,7 @@ LayerResult GCode::process_layer( if (object_layer == nullptr && support_layer == nullptr && std::any_of(layers.begin(), layers.end(), [](const LayerToPrint &l) { return l.belt_brim_band != nullptr; })) - return this->process_belt_brim_layer(print, layers, layer_tools, last_layer, single_object_instance_idx); + return this->process_belt_brim_layer(print, layers, layer_tools, last_layer, single_object_instance_idx, most_used_extruder); const Layer* layer_ptr = nullptr; if (object_layer != nullptr) @@ -6536,55 +6696,15 @@ LayerResult GCode::process_layer( m_object_layer_over_raft = false; if (!need_insert_timelapse_gcode_for_traditional && !m_config.time_lapse_gcode.value.empty() && !is_BBL_Printer()) { - DynamicConfig config; - config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); - config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); - config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); - gcode += this->placeholder_parser_process("timelapse_gcode", + const DynamicConfig config = timelapse_gcode_config(print, print_z, most_used_extruder, &m_printed_objects, false); + gcode += this->placeholder_parser_process("time_lapse_gcode", print.config().time_lapse_gcode.value, m_writer.filament()->id(), &config) + "\n"; } - if (!m_config.layer_change_gcode.value.empty()) { - DynamicConfig config; - config.set_key_value("most_used_physical_extruder_id", new ConfigOptionInt(m_config.physical_extruder_map.get_at(most_used_extruder))); - config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); - config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); - { - const int cur_filament_id = (int) m_writer.filament()->id(); - const auto group_result = m_print->get_layered_nozzle_group_result(); - config.set_key_value("current_filament_id", new ConfigOptionInt(cur_filament_id)); - config.set_key_value("current_nozzle_id", new ConfigOptionInt( - nozzle_id_for_gcode_placeholder(group_result, cur_filament_id, (int) m_writer.filament()->extruder_id(), m_layer_index))); - } + if (!m_config.layer_change_gcode.value.empty()) + gcode += this->process_layer_change_gcode(print, print_z, most_used_extruder, has_wipe_tower); - // Bedslinger mass model. Compute the running printed mass at this layer (same weight calc as - // DoExport::update_print_stats_and_format_filament_stats) and the Y acceleration limit it implies. - // These are new placeholder vars no existing template reads, and mass_load_limited_machine_acceleration - // returns the plain min Y accel unless the A2L force/bed-mass keys are set, so this is inert for every - // existing printer. - PrintStatistics curr_print_statistics; - for (const Extruder &extruder : m_writer.extruders()) { - double extruded_volume = extruder.extruded_volume() + (has_wipe_tower ? print.wipe_tower_data().used_filament[extruder.id()] * 2.4052f : 0.f); // assumes 1.75mm filament diameter - double filament_weight = extruded_volume * extruder.filament_density() * 0.001; - if (filament_weight > 0.) - curr_print_statistics.total_weight += filament_weight; - } - double curr_y_acceleration_limit = -1, curr_accumulated_mass = -1; - mass_load_limited_machine_acceleration(curr_print_statistics, print, curr_y_acceleration_limit, curr_accumulated_mass); - double curr_layer_mass = curr_print_statistics.total_weight - m_last_layer_accumulated_mass; - if (curr_layer_mass <= EPSILON) curr_layer_mass = 0.0; - m_last_layer_accumulated_mass = curr_print_statistics.total_weight; - config.set_key_value("curr_y_acceleration_limit", new ConfigOptionFloat(curr_y_acceleration_limit)); - config.set_key_value("curr_accumulated_mass", new ConfigOptionFloat(curr_accumulated_mass)); - config.set_key_value("curr_layer_mass", new ConfigOptionFloat(curr_layer_mass)); - - gcode += this->placeholder_parser_process("layer_change_gcode", - print.config().layer_change_gcode.value, m_writer.filament()->id(), &config) - + "\n"; - config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); - } - //BBS: set layer time fan speed after layer change gcode gcode += ";_SET_FAN_SPEED_CHANGING_LAYER\n"; @@ -6660,10 +6780,6 @@ LayerResult GCode::process_layer( case CalibMode::Calib_Input_shaping_freq: { if (m_layer_index == 1){ gcode += writer().set_input_shaping('A', print.calib_params().start, 0.f, print.calib_params().shaper_type); - if (m_writer.get_gcode_flavor() == gcfKlipper) { - // Disable minimum cruise ratio to ensure consistent motion for calibration - gcode += "SET_VELOCITY_LIMIT MINIMUM_CRUISE_RATIO=0\n"; - } } else { if (print.calib_params().freqStartX == print.calib_params().freqStartY && print.calib_params().freqEndX == print.calib_params().freqEndY) { gcode += writer().set_input_shaping('A', 0.f, this->interpolate_value_across_layers(print.calib_params().freqStartX, print.calib_params().freqEndX), ""); @@ -6676,10 +6792,6 @@ LayerResult GCode::process_layer( } case CalibMode::Calib_Input_shaping_damp: { if (m_layer_index == 1){ - if (m_writer.get_gcode_flavor() == gcfKlipper) { - // Disable minimum cruise ratio to ensure consistent motion for calibration - gcode += "SET_VELOCITY_LIMIT MINIMUM_CRUISE_RATIO=0\n"; - } gcode += writer().set_input_shaping('X', 0.f, print.calib_params().freqStartX, print.calib_params().shaper_type); gcode += writer().set_input_shaping('Y', 0.f, print.calib_params().freqStartY, print.calib_params().shaper_type); } else { @@ -7075,30 +7187,23 @@ LayerResult GCode::process_layer( } }; + const auto is_inner = [](const ExtrusionEntity *entity) { return is_inner_wall(*entity); }; + const size_t inner_count = entity_type == ObjectByExtruder::Island::Region::PERIMETERS ? + std::count_if(extrusions->entities.begin(), extrusions->entities.end(), is_inner) : 0; bool split_mixed_perimeters = - entity_type == ObjectByExtruder::Island::Region::PERIMETERS && region.config().outer_wall_filament_id.value != region.config().inner_wall_filament_id.value && - extrusions->role() == erMixed; + inner_count > 0 && inner_count < extrusions->entities.size(); if (split_mixed_perimeters) { auto outer_perimeters = std::make_unique(); auto inner_perimeters = std::make_unique(); - for (const ExtrusionEntity *entity : extrusions->entities) { - const ExtrusionRole role = entity->role(); - if (role == erExternalPerimeter || role == erOverhangPerimeter) - outer_perimeters->append(*entity); - else if (role == erPerimeter) - inner_perimeters->append(*entity); - } + for (const ExtrusionEntity *entity : extrusions->entities) + (is_inner(entity) ? inner_perimeters : outer_perimeters)->append(*entity); - if (!outer_perimeters->entities.empty()) { - split_perimeter_storage.emplace_back(std::move(outer_perimeters)); - process_extrusions(split_perimeter_storage.back().get(), nullptr, false); - } - if (!inner_perimeters->entities.empty()) { - split_perimeter_storage.emplace_back(std::move(inner_perimeters)); - process_extrusions(split_perimeter_storage.back().get(), nullptr, false); - } + split_perimeter_storage.emplace_back(std::move(outer_perimeters)); + process_extrusions(split_perimeter_storage.back().get(), nullptr, false); + split_perimeter_storage.emplace_back(std::move(inner_perimeters)); + process_extrusions(split_perimeter_storage.back().get(), nullptr, false); } else { process_extrusions(extrusions, extrusions, true); } @@ -7465,10 +7570,10 @@ LayerResult GCode::process_layer( // sweep below never re-emits it. if (extruder_id == (unsigned int)(vobj.belt_brim_filament() - 1) && belt_brim_emitted.insert({ instance_to_print.layer_id, instance_to_print.instance_id }).second) - gcode += generate_object_brim(print, vobj, instance_to_print.instance_id, first_layer, + gcode += generate_object_brim(print, vobj, instance_to_print.instance_id, first_layer, extruder_id, layer_to_print.object_layer); } else { - gcode += generate_object_brim(print, vobj, instance_to_print.instance_id, first_layer, + gcode += generate_object_brim(print, vobj, instance_to_print.instance_id, first_layer, extruder_id, layer_to_print.object_layer); } } @@ -8007,7 +8112,7 @@ LayerResult GCode::process_layer( continue; if (m_writer.filament() == nullptr || m_writer.filament()->id() != brim0) gcode += this->set_extruder(brim0, print_z); - gcode += generate_object_brim(print, *obj, instance_id, first_layer, ltp.object_layer); + gcode += generate_object_brim(print, *obj, instance_id, first_layer, brim0, ltp.object_layer); } } this->set_origin(saved_origin); @@ -8246,6 +8351,41 @@ void GCode::set_extruders(const std::vector &extruder_ids) } } +std::optional GCode::capture_toolchange_position() +{ + if (m_exclusion_volume_travel_avoidance.empty() || !m_last_pos_defined || m_writer.filament() == nullptr) + return std::nullopt; + + const Vec2d plate_offset = m_writer.get_xy_offset().cast(); + return ToolchangePositionState{ + this->point_to_gcode(m_last_pos.to_point()) - plate_offset + }; +} + +void GCode::synchronize_toolchange_position(const ToolchangePositionState &before, const std::string &emitted_gcode) +{ + if (m_writer.filament() == nullptr) + return; + + const std::optional emitted_xy = emitted_xy_after_gcode(emitted_gcode, before.emitted_xy); + if (!emitted_xy) + return; + + // GCodeWriter stores coordinates before applying the per-plate output + // offset. Convert the parsed file coordinates back into that space, then + // into model space using the newly active nozzle offset. + const Vec2d writer_xy = *emitted_xy + m_writer.get_xy_offset().cast(); + Vec3d writer_position = m_writer.get_position(); + writer_position.head<2>() = writer_xy; + m_writer.set_position(writer_position); + // Updating the known XY origin must not cancel Orca's deliberate + // post-toolchange Z restore. set_last_pos() normally marks the entire + // position as defined, so preserve the caller's state across the XY sync. + const bool last_pos_defined = m_last_pos_defined; + this->set_last_pos(this->gcode_to_point(writer_xy)); + m_last_pos_defined = last_pos_defined; +} + void GCode::set_origin(const Vec2d &pointf) { // if origin increases (goes towards right), last_pos decreases because it goes towards left @@ -9750,7 +9890,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d } // BBS: use G1 if not enable arc fitting or has no arc fitting result or in spiral_mode mode or we are doing sloped extrusion // Attention: G2 and G3 is not supported in spiral_mode mode - if (!m_config.enable_arc_fitting || path.polyline.fitting_result.empty() || m_config.spiral_mode || sloped != nullptr || path.z_contoured || this->should_disable_arc_fitting()) { + if (m_config.enable_arc_fitting.value == ArcFittingMode::Disabled || path.polyline.fitting_result.empty() || m_config.spiral_mode || sloped != nullptr || path.z_contoured || this->should_disable_arc_fitting()) { double path_length = 0.; double total_length = sloped == nullptr ? 0. : path.polyline.length() * SCALING_FACTOR; double saved_z = m_writer.get_position().z(); @@ -10125,10 +10265,17 @@ std::string GCode::_encode_label_ids_to_base64(std::vector ids) // This method accepts &point in print coordinates. std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string comment, double z/* = DBL_MAX*/) { + const std::optional start_gcode_position = + !m_exclusion_volume_travel_avoidance.empty() && !m_last_pos_defined && + !m_writer.is_current_position_clear() && m_pending_start_gcode_position.has_value() ? + m_pending_start_gcode_position : std::nullopt; + /* Define the travel move as a line between current position and the taget point. This is expressed in print coordinates, so it will need to be translated by this->origin in order to get G-code coordinates. */ - Polyline travel { this->last_pos(), point }; + const Point travel_start = start_gcode_position ? + this->gcode_to_point(to_2d(start_gcode_position->position)) : this->last_pos(); + Polyline travel { travel_start, point }; // check whether a straight travel move would need retraction LiftType lift_type = LiftType::SpiralLift; @@ -10138,6 +10285,66 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string // Save state of use_external_mp_once for the case that will be needed to call twice m_avoid_crossing_perimeters.travel_to. const bool used_external_mp_once = m_avoid_crossing_perimeters.used_external_mp_once(); std::string gcode; + bool exclusion_volume_travel_rerouted = false; + + const auto active_extruder_id = [this]() { + if (m_writer.filament() == nullptr) + return -1; + const size_t id = m_writer.filament()->extruder_id(); + return id < m_config.nozzle_diameter.size() ? int(id) : -1; + }; + const auto to_gcode_point = [this](const Point &local_point) { + const Vec2d point = this->point_to_gcode(local_point); + return Point(scale_(point.x()), scale_(point.y())); + }; + const auto to_local_point = [this](const Point &gcode_point) { + return this->gcode_to_point(unscaled(gcode_point)); + }; + const auto to_gcode_polyline = [&to_gcode_point](const Polyline &local_path) { + Polyline result; + result.points.reserve(local_path.points.size()); + for (const Point &local_point : local_path.points) + result.append(to_gcode_point(local_point)); + return result; + }; + const auto to_local_polyline = [&to_local_point](const Polyline &gcode_path) { + Polyline result; + result.points.reserve(gcode_path.points.size()); + for (const Point &gcode_point : gcode_path.points) + result.append(to_local_point(gcode_point)); + return result; + }; + const auto nominal_writer_z = [this]() { + return m_writer.get_position().z() - m_writer.get_zhop(); + }; + const auto route_around_exclusion_volumes = [&]( + Polyline &path, + const std::optional &start_z_override, + const bool include_planned_lift = false) { + if (m_exclusion_volume_travel_avoidance.empty() || path.size() < 2) + return false; + + const double target_z = z == DBL_MAX ? m_nominal_z : z; + double route_start_z = start_z_override.value_or(nominal_writer_z()); + double route_end_z = target_z; + if (include_planned_lift) { + const Vec2d destination_xy = this->point_to_gcode(path.back()); + std::tie(route_start_z, route_end_z) = m_writer.planned_travel_z( + Vec3d(destination_xy.x(), destination_xy.y(), target_z), + m_need_change_layer_lift_z); + } + const ExclusionVolumeTravelAvoidance::Result result = + m_exclusion_volume_travel_avoidance.route( + to_gcode_polyline(path), + route_start_z, + route_end_z, + active_extruder_id()); + if (!result.rerouted()) + return false; + + path = to_local_polyline(result.path); + return true; + }; // Orca: we don't need to optimize the Klipper as only set once double jerk_to_set = 0.0; @@ -10203,6 +10410,14 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string //if (needs_retraction && m_layer_index > 1) exit(0); } + const std::optional start_gcode_z = + start_gcode_position && start_gcode_position->has_known_z() ? + std::optional(start_gcode_position->position.z()) : std::nullopt; + if (route_around_exclusion_volumes(travel, start_gcode_z)) { + exclusion_volume_travel_rerouted = true; + needs_retraction = this->needs_retraction(travel, role, lift_type); + } + // Re-allow reduce_crossing_wall for the next travel moves m_avoid_crossing_perimeters.reset_once_modifiers(); @@ -10218,16 +10433,22 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string // When "Wipe while retracting" is enabled, then extruder moves to another position, and travel from this position can cross perimeters. // Because of it, it is necessary to call avoid crossing perimeters again with new starting point after calling retraction() // FIXME Lukas H.: Try to predict if this second calling of avoid crossing perimeters will be needed or not. It could save computations. - if (last_post_before_retract != this->last_pos() && m_config.reduce_crossing_wall - && m_layer != nullptr) { // A brim apron layer has no Layer to avoid crossing - // If in the previous call of m_avoid_crossing_perimeters.travel_to was use_external_mp_once set to true restore this value for next call. - if (used_external_mp_once) - m_avoid_crossing_perimeters.use_external_mp_once(); - travel = m_avoid_crossing_perimeters.travel_to(*this, point); - // If state of use_external_mp_once was changed reset it to right value. - if (used_external_mp_once) - m_avoid_crossing_perimeters.reset_once_modifiers(); + if (last_post_before_retract != this->last_pos()) { + travel = Polyline { this->last_pos(), point }; + if (m_config.reduce_crossing_wall && m_layer != nullptr) { // Belt brim apron layers have no Layer. + // If in the previous call of m_avoid_crossing_perimeters.travel_to was use_external_mp_once set to true restore this value for next call. + if (used_external_mp_once) + m_avoid_crossing_perimeters.use_external_mp_once(); + travel = m_avoid_crossing_perimeters.travel_to(*this, point); + // If state of use_external_mp_once was changed reset it to right value. + if (used_external_mp_once) + m_avoid_crossing_perimeters.reset_once_modifiers(); + } } + + exclusion_volume_travel_rerouted = + route_around_exclusion_volumes(travel, std::nullopt, true) || + (last_post_before_retract == this->last_pos() && exclusion_volume_travel_rerouted); } else { // Reset the wipe path when traveling, so one would not wipe along an old path. m_wipe.reset_path(); @@ -10259,6 +10480,24 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string Vec3d dest3d(dest2d(0), dest2d(1), z == DBL_MAX ? m_nominal_z : z); gcode += m_writer.travel_to_xyz(dest3d, comment, m_need_change_layer_lift_z); m_need_change_layer_lift_z = false; + } else if (exclusion_volume_travel_rerouted && z != DBL_MAX) { + // Preserve the original sloped-Z move over the longer detour. + // The router activates every volume touched by the complete Z + // range, so this interpolation remains conservative. + const double start_z = m_writer.get_position().z(); + const double total_length = std::max(travel.length(), 1.0); + double traveled = 0.0; + for (size_t i = 1; i < travel.size(); ++i) { + traveled += (travel.points[i] - travel.points[i - 1]).cast().norm(); + const Vec2d dest2d = this->point_to_gcode(travel.points[i]); + const Vec3d dest3d( + dest2d.x(), + dest2d.y(), + start_z + (z - start_z) * std::min(1.0, traveled / total_length)); + gcode += m_writer.travel_to_xyz(dest3d, comment, i == 1 && m_need_change_layer_lift_z); + if (i == 1) + m_need_change_layer_lift_z = false; + } } else { // Extra movements emitted by avoid_crossing_perimeters, lift the z to normal height at the beginning, then apply the z // ratio at the last point @@ -10585,6 +10824,9 @@ std::string GCode::set_extruder(unsigned int new_filament_id, double print_z, bo if (!m_writer.need_toolchange(new_filament_id)) return ""; + const std::optional position_before_toolchange = + this->capture_toolchange_position(); + // if we are running a single-extruder setup, just set the extruder and return nothing if (!m_writer.multiple_extruders) { this->placeholder_parser().set("current_extruder", new_filament_id); @@ -10639,6 +10881,8 @@ std::string GCode::set_extruder(unsigned int new_filament_id, double print_z, bo gcode += toolchange_command; if (Extruder *fil = m_writer.filament()) fil->set_config_index((int)get_filament_config_index((int)fil->id())); + if (position_before_toolchange) + this->synchronize_toolchange_position(*position_before_toolchange, gcode); return gcode; } @@ -11055,6 +11299,8 @@ std::string GCode::set_extruder(unsigned int new_filament_id, double print_z, bo imex_pem_tool_for((int) new_filament_id, m_imex_parallel_mode, m_config.physical_extruder_map)); //Orca: tool changer or IDEX's firmware may change Z position, so we set it to unknown/undefined m_last_pos_defined = false; + if (position_before_toolchange) + this->synchronize_toolchange_position(*position_before_toolchange, gcode); return gcode; } diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index b5898b2305..ac646c2a85 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -14,6 +14,7 @@ #include "PrintConfig.hpp" #include "GCode/AvoidCrossingPerimeters.hpp" #include "GCode/CoolingBuffer.hpp" +#include "GCode/ExclusionVolumeTravelAvoidance.hpp" #include "GCode/FanMover.hpp" #include "GCode/RetractWhenCrossingPerimeters.hpp" #include "GCode/SpiralVase.hpp" @@ -247,7 +248,6 @@ public: #endif // ENABLE_GCODE_VIEWER_DATA_CHECKING m_brim_done(false), m_second_layer_things_done(false), - m_silent_time_estimator_enabled(false), m_last_obj_copy(nullptr, Point(std::numeric_limits::max(), std::numeric_limits::max())), // BBS m_toolchange_count(0), @@ -470,19 +470,25 @@ protected: const PrintObject &object, size_t instance_id, bool first_layer, + unsigned int extruder_id, const Layer *object_layer); // Belt printers: emit one brim-only apron layer. These print below the // object's first layer, so there is no object or support layer for the normal // process_layer() machinery to work from. Kept to the minimum a layer needs - // tool, Z move, extrusions - so that nothing here can perturb the - // Layer::id()-based logic the ordinary path relies on. + // Layer::id()-based logic the ordinary path relies on. Its layer change G-code + // uses process_layer_change_gcode(), so an apron band counts in the running + // printed mass like an object layer. LayerResult process_belt_brim_layer( const Print &print, const std::vector &layers, const LayerTools &layer_tools, const bool last_layer, - const size_t single_object_instance_idx); + const size_t single_object_instance_idx, + const int most_used_extruder); + + std::string process_layer_change_gcode(const Print &print, coordf_t print_z, int most_used_extruder, bool has_wipe_tower); // Emit the apron bands carried by these layers whose brim filament is extruder_id // (0-based). Called from both the brim-only branch and the ordinary path, since a @@ -535,8 +541,16 @@ protected: size_t get_extruder_id(unsigned int filament_id) const; void update_placeholder_parser_with_variant_params(); - void set_last_pos(const Point &pos) { m_last_pos = Point3(pos, 0); m_last_pos_defined = true; } - void set_last_pos(const Point3 &pos) { m_last_pos = pos; m_last_pos_defined = true; } + void set_last_pos(const Point &pos) { + m_last_pos = Point3(pos, 0); + m_last_pos_defined = true; + m_pending_start_gcode_position.reset(); + } + void set_last_pos(const Point3 &pos) { + m_last_pos = pos; + m_last_pos_defined = true; + m_pending_start_gcode_position.reset(); + } bool last_pos_defined() const { return m_last_pos_defined; } void set_extruders(const std::vector &extruder_ids); std::string preamble(); @@ -649,6 +663,10 @@ protected: // Farthest-point timelapse: find the extrusion point farthest from camera (0,0) void compute_farthest_point(const std::vector &layers, int most_used_extruder, const std::map, unsigned int> &support_filaments); + // Requires an active filament. + DynamicConfig timelapse_gcode_config(const Print &print, coordf_t print_z, int most_used_extruder, + const std::vector *printed_objects, + bool skip_pos_pick); // Build the per-layer timelapse snapshot g-code (safe-position or, when skip_pos_pick, // an inline photo at the current head position). Extracted from the former process_layer lambda so the // per-extrusion farthest-point hook (_extrude) can call it too. Identical to the old lambda when the @@ -757,8 +775,11 @@ protected: OozePrevention m_ooze_prevention; Wipe m_wipe; AvoidCrossingPerimeters m_avoid_crossing_perimeters; + ExclusionVolumeTravelAvoidance m_exclusion_volume_travel_avoidance; RetractWhenCrossingPerimeters m_retract_when_crossing_perimeters; TimelapsePosPicker m_timelapse_pos_picker; + bool m_timelapse_uses_pos{ false }; + bool m_timelapse_uses_clear_to_x0{ false }; // Farthest-point timelapse context. Corexy-only refinement layered on top of the existing // timelapse_type. All fields default to the inert state; `enabled` is (re)computed each layer in @@ -844,6 +865,18 @@ protected: Point3 m_last_pos; bool m_last_pos_defined; + struct ToolchangePositionState + { + Vec2d emitted_xy{Vec2d::Zero()}; + }; + + // Capture and restore the actual command-space position around a physical + // nozzle change. Model-space m_last_pos is tied to the active nozzle offset, + // while the machine position itself does not change when Tx is emitted. + std::optional capture_toolchange_position(); + void synchronize_toolchange_position(const ToolchangePositionState &before, + const std::string &emitted_gcode); + std::unique_ptr m_cooling_buffer; std::unique_ptr m_spiral_vase; std::unique_ptr m_pressure_equalizer; @@ -877,7 +910,6 @@ protected: int m_timelapse_warning_code = 0; bool m_support_traditional_timelapse = true; - bool m_silent_time_estimator_enabled; Print *m_print{nullptr}; @@ -885,6 +917,10 @@ protected: // Processor GCodeProcessor m_processor; + // Command-space endpoint after startup G-code. The processor sees direct + // file writes synchronously, while the generator has not established its + // first model-space point yet. + std::optional m_pending_start_gcode_position; //some post-processing on the file, with their data class std::unique_ptr m_fan_mover; diff --git a/src/libslic3r/GCode/ExclusionVolumePathCheck.cpp b/src/libslic3r/GCode/ExclusionVolumePathCheck.cpp new file mode 100644 index 0000000000..fbe3e6b465 --- /dev/null +++ b/src/libslic3r/GCode/ExclusionVolumePathCheck.cpp @@ -0,0 +1,234 @@ +#include "ExclusionVolumePathCheck.hpp" +#include "libslic3r/AABBTreeLines.hpp" +#include "libslic3r/BoundingBox.hpp" +#include "libslic3r/Line.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/PrintConfig.hpp" +#include +#include + +#include "libslic3r/Polygon.hpp" +#include "libslic3r/libslic3r.h" + +#include +#include +#include + +namespace Slic3r { + +namespace { + +constexpr double Z_EPSILON_MM = 1e-6; + +Point scaled_point(const Vec3d &point) +{ + return { scale_(point.x()), scale_(point.y()) }; +} + +BoundingBox line_bbox(const Point &a, const Point &b) +{ + BoundingBox bbox; + bbox.merge(a); + bbox.merge(b); + bbox.offset(SCALED_EPSILON); + return bbox; +} + +bool intervals_overlap(coord_t a_min, coord_t a_max, coord_t b_min, coord_t b_max) +{ + if (a_min > a_max) + std::swap(a_min, a_max); + if (b_min > b_max) + std::swap(b_min, b_max); + return std::max(a_min, b_min) <= std::min(a_max, b_max); +} + +bool collinear_segments_overlap(const Line &a, const Line &b) +{ + const Vec2crd a_dir = a.b - a.a; + if (a_dir == Vec2crd::Zero()) + return a.a == b.a || a.a == b.b; + + if (cross2(a_dir, b.a - a.a) != 0 || cross2(a_dir, b.b - a.a) != 0) + return false; + + return std::abs(a_dir.x()) >= std::abs(a_dir.y()) ? + intervals_overlap(a.a.x(), a.b.x(), b.a.x(), b.b.x()) : + intervals_overlap(a.a.y(), a.b.y(), b.a.y(), b.b.y()); +} + +bool overlaps_collinear_boundary(const Line &line, const Lines &edges) +{ + const BoundingBox line_bounds = line_bbox(line.a, line.b); + for (const Line &edge : edges) { + if (line_bounds.overlap(line_bbox(edge.a, edge.b)) && collinear_segments_overlap(line, edge)) + return true; + } + return false; +} + +bool clip_segment_to_z_range( + const Vec3d &from, + const Vec3d &to, + double z_min, + double z_max, + Vec3d &out_from, + Vec3d &out_to) +{ + const double segment_min_z = std::min(from.z(), to.z()); + const double segment_max_z = std::max(from.z(), to.z()); + if (segment_max_z < z_min - Z_EPSILON_MM || segment_min_z > z_max + Z_EPSILON_MM) + return false; + + double t0 = 0.0; + double t1 = 1.0; + const double dz = to.z() - from.z(); + if (std::abs(dz) < Z_EPSILON_MM) { + if (from.z() < z_min - Z_EPSILON_MM || from.z() > z_max + Z_EPSILON_MM) + return false; + } else { + const double z0 = (z_min - from.z()) / dz; + const double z1 = (z_max - from.z()) / dz; + t0 = std::max(t0, std::min(z0, z1)); + t1 = std::min(t1, std::max(z0, z1)); + if (t0 > t1 + Z_EPSILON_MM) + return false; + } + + t0 = std::clamp(t0, 0.0, 1.0); + t1 = std::clamp(t1, 0.0, 1.0); + const Vec3d delta = to - from; + out_from = from + t0 * delta; + out_to = from + t1 * delta; + return true; +} + +} // namespace + +void ExclusionVolumePathChecker::configure(const PrintConfig &config) +{ + clear(); + m_configured = true; + m_extruder_offsets = config.extruder_offset.values; + + const std::vector> regions = + get_bed_excluded_regions_by_extruder(config); + m_regions_by_extruder.resize(regions.size()); + if (m_extruder_offsets.size() < regions.size()) + m_extruder_offsets.resize(regions.size(), Vec2d::Zero()); + + for (size_t extruder_id = 0; extruder_id < regions.size(); ++extruder_id) { + std::vector &prepared = m_regions_by_extruder[extruder_id]; + prepared.reserve(regions[extruder_id].size()); + for (const BedExcludeRegion ®ion : regions[extruder_id]) { + // Legacy excluded areas are material keep-outs. Some stock profiles + // deliberately move the nozzle into them (for example, a cutter), so + // only explicitly configured collision volumes constrain motion. + if (!region.is_collision_volume() || region.polygon.points.size() < 3 || region.z_max < region.z_min) + continue; + + PreparedRegion item; + item.region = region; + item.bbox = BoundingBox(region.polygon.points); + item.bbox.offset(SCALED_EPSILON); + item.edge_tree = AABBTreeLines::LinesDistancer(to_lines(region.polygon)); + prepared.emplace_back(std::move(item)); + } + } +} + +void ExclusionVolumePathChecker::clear() +{ + m_configured = false; + m_extruder_offsets.clear(); + m_regions_by_extruder.clear(); + m_result = {}; +} + +bool ExclusionVolumePathChecker::segment_intersects_region( + const Vec3d &from, + const Vec3d &to, + const bool z_known, + const PreparedRegion ®ion) const +{ + Vec3d clipped_from = from; + Vec3d clipped_to = to; + if (z_known && !clip_segment_to_z_range( + from, to, region.region.z_min, region.region.z_max, clipped_from, clipped_to)) + return false; + + const Point a = scaled_point(clipped_from); + const Point b = scaled_point(clipped_to); + if (!line_bbox(a, b).overlap(region.bbox)) + return false; + + if (region.region.polygon.contains(a) || region.region.polygon.contains(b)) + return true; + if (a == b) + return false; + + const Line line(a, b); + if (!region.edge_tree.intersections_with_line(line).empty()) + return true; + + // The line tree intentionally omits collinear intersections. + return overlaps_collinear_boundary(line, region.edge_tree.get_lines()); +} + +void ExclusionVolumePathChecker::check_motion( + const Vec3d &from, + const Vec3d &to, + const bool start_xy_known, + const bool end_xy_known, + const bool start_z_known, + const bool end_z_known, + const int active_extruder_id, + const ExclusionVolumeMotionType motion_type, + const unsigned char source_move_type, + const unsigned int gcode_id, + const size_t move_id) +{ + if (!m_configured || m_result.has_any_conflict || !start_xy_known || !end_xy_known || + m_regions_by_extruder.empty()) + return; + + const bool z_known = start_z_known && end_z_known; + const bool active_extruder_valid = + active_extruder_id >= 0 && size_t(active_extruder_id) < m_regions_by_extruder.size(); + const size_t first_extruder = active_extruder_valid ? size_t(active_extruder_id) : 0; + const size_t last_extruder = active_extruder_valid ? first_extruder + 1 : m_regions_by_extruder.size(); + + for (size_t extruder_id = first_extruder; extruder_id < last_extruder; ++extruder_id) { + const Vec2d offset = extruder_id < m_extruder_offsets.size() ? + m_extruder_offsets[extruder_id] : Vec2d::Zero(); + Vec3d model_from = from; + Vec3d model_to = to; + model_from.head<2>() += offset; + model_to.head<2>() += offset; + + const std::vector ®ions = m_regions_by_extruder[extruder_id]; + for (size_t region_id = 0; region_id < regions.size(); ++region_id) { + if (!segment_intersects_region(model_from, model_to, z_known, regions[region_id])) + continue; + + m_result.has_any_conflict = true; + m_result.has_travel_conflict = motion_type == ExclusionVolumeMotionType::Travel; + m_result.has_extrusion_conflict = motion_type == ExclusionVolumeMotionType::Extrude; + m_result.has_other_motion_conflict = motion_type == ExclusionVolumeMotionType::Other; + m_result.first_hit = ExclusionVolumePathHit{ + move_id, + gcode_id, + motion_type, + source_move_type, + int(extruder_id), + region_id, + model_from, + model_to, + !z_known + }; + return; + } + } +} + +} // namespace Slic3r diff --git a/src/libslic3r/GCode/ExclusionVolumePathCheck.hpp b/src/libslic3r/GCode/ExclusionVolumePathCheck.hpp new file mode 100644 index 0000000000..af94ef0076 --- /dev/null +++ b/src/libslic3r/GCode/ExclusionVolumePathCheck.hpp @@ -0,0 +1,90 @@ +#pragma once + +#include "libslic3r/AABBTreeLines.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/BoundingBox.hpp" +#include "libslic3r/Line.hpp" +#include "libslic3r/PrintConfig.hpp" + +#include +#include +#include + +namespace Slic3r { + +enum class ExclusionVolumeMotionType : unsigned char +{ + Travel, + Extrude, + Other +}; + +struct ExclusionVolumePathHit +{ + size_t move_id { 0 }; + unsigned int gcode_id { 0 }; + ExclusionVolumeMotionType motion_type { ExclusionVolumeMotionType::Other }; + unsigned char source_move_type { 0 }; + int extruder_id { -1 }; + size_t region_id { 0 }; + Vec3d from { Vec3d::Zero() }; + Vec3d to { Vec3d::Zero() }; + bool used_unknown_z { false }; +}; + +struct ExclusionVolumePathCheckResult +{ + bool has_any_conflict { false }; + bool has_travel_conflict { false }; + bool has_extrusion_conflict { false }; + bool has_other_motion_conflict { false }; + std::optional first_hit; +}; + +// Checks G-code coordinates as they are parsed. Exclusion regions are expressed +// in nozzle/model space, so each candidate physical extruder offset is applied +// before testing a motion. This keeps the checker independent of preview +// vertices, whose extruder_id field represents a filament rather than a nozzle. +class ExclusionVolumePathChecker +{ +public: + void configure(const PrintConfig &config); + void clear(); + + bool configured() const { return m_configured; } + const ExclusionVolumePathCheckResult &result() const { return m_result; } + + void check_motion( + const Vec3d &from, + const Vec3d &to, + bool start_xy_known, + bool end_xy_known, + bool start_z_known, + bool end_z_known, + int active_extruder_id, + ExclusionVolumeMotionType motion_type, + unsigned char source_move_type, + unsigned int gcode_id, + size_t move_id); + +private: + struct PreparedRegion + { + BedExcludeRegion region; + BoundingBox bbox; + AABBTreeLines::LinesDistancer edge_tree; + }; + + bool segment_intersects_region( + const Vec3d &from, + const Vec3d &to, + bool z_known, + const PreparedRegion ®ion) const; + + bool m_configured { false }; + std::vector m_extruder_offsets; + std::vector> m_regions_by_extruder; + ExclusionVolumePathCheckResult m_result; +}; + +} // namespace Slic3r diff --git a/src/libslic3r/GCode/ExclusionVolumeTravelAvoidance.cpp b/src/libslic3r/GCode/ExclusionVolumeTravelAvoidance.cpp new file mode 100644 index 0000000000..5f702ccdec --- /dev/null +++ b/src/libslic3r/GCode/ExclusionVolumeTravelAvoidance.cpp @@ -0,0 +1,672 @@ +#include "ExclusionVolumeTravelAvoidance.hpp" +#include "libslic3r/ExPolygon.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/PrintConfig.hpp" +#include "libslic3r/libslic3r.h" +#include +#include +#include + +#include "libslic3r/ClipperUtils.hpp" +#include "libslic3r/ExclusionVolumeGeometry.hpp" +#include "libslic3r/Line.hpp" +#include "libslic3r/Polygon.hpp" + +#include +#include +#include +#include + +namespace Slic3r { + +namespace { + +constexpr double T_EPSILON = 1e-9; +constexpr size_t MAX_REROUTE_ITERATIONS = 16; + +struct SegmentIntersection +{ + double t { 0.0 }; + Point point; + size_t edge_idx { 0 }; +}; + +double boundary_epsilon() +{ + return std::max(SCALED_EPSILON, scale_(0.005)); +} + +bool line_intersection_t( + const Point &a, + const Point &b, + const Point &c, + const Point &d, + double &t, + Point &intersection) +{ + const Vec2d p = a.cast(); + const Vec2d r = (b - a).cast(); + const Vec2d q = c.cast(); + const Vec2d s = (d - c).cast(); + const double denominator = cross2(r, s); + if (std::abs(denominator) < T_EPSILON) + return false; + + const Vec2d qp = q - p; + const double candidate_t = cross2(qp, s) / denominator; + const double u = cross2(qp, r) / denominator; + if (candidate_t < -T_EPSILON || candidate_t > 1.0 + T_EPSILON || + u < -T_EPSILON || u > 1.0 + T_EPSILON) + return false; + + t = std::clamp(candidate_t, 0.0, 1.0); + intersection = (p + t * r).cast(); + return true; +} + +template +void for_each_expolygon_contour(const ExPolygon &expolygon, Fn &&fn) +{ + fn(expolygon.contour); + for (const Polygon &hole : expolygon.holes) + fn(hole); +} + +void add_unique_param(std::vector ¶ms, double t) +{ + const double clamped = std::clamp(t, 0.0, 1.0); + if (std::none_of(params.begin(), params.end(), [clamped](double value) { + return std::abs(value - clamped) < T_EPSILON; + })) + params.emplace_back(clamped); +} + +std::vector contour_intersections( + const Point &a, + const Point &b, + const Polygon &polygon) +{ + std::vector intersections; + if (polygon.points.size() < 2) + return intersections; + + intersections.reserve(4); + for (size_t edge_idx = 0; edge_idx < polygon.points.size(); ++edge_idx) { + const Point &c = polygon.points[edge_idx]; + const Point &d = polygon.points[(edge_idx + 1) % polygon.points.size()]; + double t = 0.0; + Point point; + if (line_intersection_t(a, b, c, d, t, point) && + std::none_of(intersections.begin(), intersections.end(), [t](const SegmentIntersection &other) { + return std::abs(other.t - t) < T_EPSILON; + })) + intersections.push_back({ t, point, edge_idx }); + } + + std::sort(intersections.begin(), intersections.end(), [](const SegmentIntersection &lhs, const SegmentIntersection &rhs) { + return lhs.t < rhs.t; + }); + return intersections; +} + +bool point_in_expolygons(const ExPolygons &expolygons, const Point &point, bool border_result) +{ + return std::any_of(expolygons.begin(), expolygons.end(), [&point, border_result](const ExPolygon &expolygon) { + return expolygon.contains(point, border_result); + }); +} + +bool point_on_expolygon_boundary(const ExPolygon &expolygon, const Point &point) +{ + const double epsilon = boundary_epsilon(); + if (expolygon.contour.on_boundary(point, epsilon)) + return true; + return std::any_of(expolygon.holes.begin(), expolygon.holes.end(), [&point, epsilon](const Polygon &hole) { + return hole.on_boundary(point, epsilon); + }); +} + +bool point_on_expolygons_boundary(const ExPolygons &expolygons, const Point &point) +{ + return std::any_of(expolygons.begin(), expolygons.end(), [&point](const ExPolygon &expolygon) { + return point_on_expolygon_boundary(expolygon, point); + }); +} + +bool point_in_expolygons_interior(const ExPolygons &expolygons, const Point &point) +{ + return point_in_expolygons(expolygons, point, false) && + !point_on_expolygons_boundary(expolygons, point); +} + +std::vector boundary_params_for_segment( + const Point &a, + const Point &b, + const ExPolygons &expolygons) +{ + std::vector params { 0.0, 1.0 }; + for (const ExPolygon &expolygon : expolygons) { + for_each_expolygon_contour(expolygon, [&](const Polygon &contour) { + for (const SegmentIntersection &intersection : contour_intersections(a, b, contour)) + add_unique_param(params, intersection.t); + }); + } + std::sort(params.begin(), params.end()); + return params; +} + +Point interpolate(const Point &a, const Point &b, double t) +{ + return (a.cast() + t * (b - a).cast()).cast(); +} + +bool segment_enters_expolygons_interior( + const Point &a, + const Point &b, + const ExPolygons &expolygons) +{ + if (expolygons.empty()) + return false; + if (point_in_expolygons_interior(expolygons, a) || point_in_expolygons_interior(expolygons, b)) + return true; + + const std::vector params = boundary_params_for_segment(a, b, expolygons); + for (size_t idx = 1; idx < params.size(); ++idx) { + const double low = params[idx - 1]; + const double high = params[idx]; + if (high - low < T_EPSILON) + continue; + if (point_in_expolygons_interior(expolygons, interpolate(a, b, 0.5 * (low + high)))) + return true; + } + return false; +} + +std::optional first_interior_param_for_segment( + const Point &a, + const Point &b, + const ExPolygons &expolygons) +{ + if (expolygons.empty()) + return std::nullopt; + if (point_in_expolygons_interior(expolygons, a)) + return 0.0; + + const std::vector params = boundary_params_for_segment(a, b, expolygons); + for (size_t idx = 1; idx < params.size(); ++idx) { + const double low = params[idx - 1]; + const double high = params[idx]; + if (high - low < T_EPSILON) + continue; + if (point_in_expolygons_interior(expolygons, interpolate(a, b, 0.5 * (low + high)))) + return low; + } + + return point_in_expolygons_interior(expolygons, b) ? std::optional(1.0) : std::nullopt; +} + +bool segment_inside_bed(const Point &a, const Point &b, const ExPolygons &valid_bed) +{ + if (valid_bed.empty()) + return true; + if (!point_in_expolygons(valid_bed, a, true) || !point_in_expolygons(valid_bed, b, true)) + return false; + + const std::vector params = boundary_params_for_segment(a, b, valid_bed); + for (size_t idx = 1; idx < params.size(); ++idx) { + const double low = params[idx - 1]; + const double high = params[idx]; + if (high - low < T_EPSILON) + continue; + if (!point_in_expolygons(valid_bed, interpolate(a, b, 0.5 * (low + high)), false)) + return false; + } + return true; +} + +double polyline_length(const Polyline &polyline) +{ + double length = 0.0; + for (size_t idx = 1; idx < polyline.points.size(); ++idx) + length += (polyline.points[idx] - polyline.points[idx - 1]).cast().norm(); + return length; +} + +bool points_near(const Point &lhs, const Point &rhs) +{ + const double epsilon = boundary_epsilon(); + return (lhs - rhs).cast().squaredNorm() <= epsilon * epsilon; +} + +bool replacement_matches_original_segment(const Polyline &replacement, const Point &a, const Point &b) +{ + return replacement.points.size() == 2 && + points_near(replacement.points.front(), a) && points_near(replacement.points.back(), b); +} + +void append_point(Points &points, const Point &point) +{ + if (points.empty() || points.back() != point) + points.emplace_back(point); +} + +Polyline make_forward_detour( + const Point &a, + const Point &b, + const Polygon &contour, + const SegmentIntersection &entry, + const SegmentIntersection &exit) +{ + Points points; + append_point(points, a); + append_point(points, entry.point); + + const size_t count = contour.points.size(); + for (size_t idx = (entry.edge_idx + 1) % count; idx != (exit.edge_idx + 1) % count; idx = (idx + 1) % count) + append_point(points, contour.points[idx]); + + append_point(points, exit.point); + append_point(points, b); + return Polyline(std::move(points)); +} + +Polyline make_backward_detour( + const Point &a, + const Point &b, + const Polygon &contour, + const SegmentIntersection &entry, + const SegmentIntersection &exit) +{ + Points points; + append_point(points, a); + append_point(points, entry.point); + + const size_t count = contour.points.size(); + const size_t last_vertex = (exit.edge_idx + 1) % count; + for (size_t idx = entry.edge_idx;; idx = idx == 0 ? count - 1 : idx - 1) { + append_point(points, contour.points[idx]); + if (idx == last_vertex) + break; + } + + append_point(points, exit.point); + append_point(points, b); + return Polyline(std::move(points)); +} + +bool routed_polyline_inside_bed( + const Polyline &polyline, + const ExPolygons &valid_bed, + const bool allow_start_outside, + const bool allow_end_outside) +{ + if (valid_bed.empty()) + return true; + + const size_t last_idx = polyline.points.size() - 1; + for (size_t idx = 0; idx < polyline.points.size(); ++idx) { + if ((idx == 0 && allow_start_outside) || (idx == last_idx && allow_end_outside)) + continue; + if (!point_in_expolygons(valid_bed, polyline.points[idx], true)) + return false; + } + + for (size_t idx = 1; idx < polyline.points.size(); ++idx) { + // A start or end produced by machine G-code may legitimately lie on + // or beyond the printable boundary. Constrain only the route vertices + // Orca adds; the firmware-defined transition to the bed remains intact. + if ((idx == 1 && allow_start_outside) || (idx == last_idx && allow_end_outside)) + continue; + if (!segment_inside_bed(polyline.points[idx - 1], polyline.points[idx], valid_bed)) + return false; + } + return true; +} + +bool polyline_intersects_obstacles(const Polyline &polyline, const ExPolygons &obstacles) +{ + for (size_t idx = 1; idx < polyline.points.size(); ++idx) + if (segment_enters_expolygons_interior(polyline.points[idx - 1], polyline.points[idx], obstacles)) + return true; + return false; +} + +std::optional first_intersected_obstacle( + const Point &a, + const Point &b, + const ExPolygons &obstacles) +{ + std::optional best_idx; + double best_t = std::numeric_limits::infinity(); + for (size_t idx = 0; idx < obstacles.size(); ++idx) { + const ExPolygons single { obstacles[idx] }; + if (const std::optional t = first_interior_param_for_segment(a, b, single); t && *t < best_t) { + best_t = *t; + best_idx = idx; + } + } + return best_idx; +} + +std::optional detour_around_obstacle( + const Point &a, + const Point &b, + const ExPolygon &obstacle, + const ExPolygons &obstacles, + const ExPolygons &valid_bed, + const bool allow_start_outside, + const bool allow_end_outside) +{ + const std::vector intersections = contour_intersections(a, b, obstacle.contour); + if (intersections.size() < 2) + return std::nullopt; + + const SegmentIntersection &entry = intersections.front(); + const SegmentIntersection &exit = intersections.back(); + const Polyline forward = make_forward_detour(a, b, obstacle.contour, entry, exit); + const Polyline backward = make_backward_detour(a, b, obstacle.contour, entry, exit); + + const bool forward_bed_valid = routed_polyline_inside_bed( + forward, valid_bed, allow_start_outside, allow_end_outside); + const bool backward_bed_valid = routed_polyline_inside_bed( + backward, valid_bed, allow_start_outside, allow_end_outside); + const bool forward_clear = forward_bed_valid && !polyline_intersects_obstacles(forward, obstacles); + const bool backward_clear = backward_bed_valid && !polyline_intersects_obstacles(backward, obstacles); + + if (forward_clear || backward_clear) { + if (forward_clear && !backward_clear) + return forward; + if (!forward_clear && backward_clear) + return backward; + return polyline_length(forward) <= polyline_length(backward) ? forward : backward; + } + + // If another obstacle blocks both immediate choices, retain the valid local + // detour and let the outer repair loop address the next crossing. + if (!forward_bed_valid && !backward_bed_valid) + return std::nullopt; + if (forward_bed_valid && !backward_bed_valid) + return forward; + if (!forward_bed_valid && backward_bed_valid) + return backward; + return polyline_length(forward) <= polyline_length(backward) ? forward : backward; +} + +void replace_segment(Polyline &path, size_t segment_idx, const Polyline &replacement) +{ + Points points; + points.reserve(path.points.size() + replacement.points.size()); + for (size_t idx = 0; idx < segment_idx; ++idx) + append_point(points, path.points[idx]); + for (const Point &point : replacement.points) + append_point(points, point); + for (size_t idx = segment_idx + 2; idx < path.points.size(); ++idx) + append_point(points, path.points[idx]); + path.points = std::move(points); +} + +Polyline simplify_path(const Polyline &path, const ExPolygons &obstacles, const ExPolygons &valid_bed) +{ + if (path.points.size() <= 2) + return path; + + Points simplified; + simplified.reserve(path.points.size()); + size_t current = 0; + append_point(simplified, path.points.front()); + while (current + 1 < path.points.size()) { + size_t next = path.points.size() - 1; + for (; next > current + 1; --next) { + if (segment_inside_bed(path.points[current], path.points[next], valid_bed) && + !segment_enters_expolygons_interior(path.points[current], path.points[next], obstacles)) + break; + } + append_point(simplified, path.points[next]); + current = next; + } + return Polyline(std::move(simplified)); +} + +} // namespace + +void ExclusionVolumeTravelAvoidance::init(const PrintConfig &config, const Vec3d &plate_origin) +{ + clear(); + + double max_nozzle_diameter = 0.0; + for (double diameter : config.nozzle_diameter.values) + max_nozzle_diameter = std::max(max_nozzle_diameter, diameter); + + // This is a numerical/perimeter-walk clearance, not a hidden toolhead + // footprint. The exact configured volume remains Stage 2's source of truth. + const coord_t minimum_clearance = static_cast(SCALED_EPSILON); + const coord_t configured_clearance = + static_cast(scale_(std::max(0.05, 0.1 * max_nozzle_diameter))); + m_clearance = std::max(minimum_clearance, configured_clearance); + + std::vector> regions_by_extruder = + get_bed_excluded_regions_by_extruder(config); + m_spaces.resize(regions_by_extruder.size()); + + const Polygon base_bed_shape(get_bed_shape(config)); + const Vec2d plate_xy = plate_origin.head<2>(); + for (size_t extruder_id = 0; extruder_id < regions_by_extruder.size(); ++extruder_id) { + RoutingSpace &space = m_spaces[extruder_id]; + space.regions = std::move(regions_by_extruder[extruder_id]); + space.regions.erase(std::remove_if(space.regions.begin(), space.regions.end(), + [](const BedExcludeRegion ®ion) { return !region.is_collision_volume(); }), space.regions.end()); + + const Vec2d extruder_offset = extruder_id < config.extruder_offset.values.size() ? + config.extruder_offset.values[extruder_id] : Vec2d::Zero(); + // Resolved regions are in nozzle/model space. The generator routes in + // emitted G-code space (model - active nozzle offset), before the writer + // subtracts the plate origin, so transform both obstacles and bed alike. + const Vec2d translation_mm = plate_xy - extruder_offset; + const Point translation = scaled(translation_mm); + for (BedExcludeRegion ®ion : space.regions) { + region.polygon.translate(translation); + BoundingBox bbox(region.polygon.points); + bbox.offset(m_clearance); + space.region_bboxes.emplace_back(std::move(bbox)); + } + + Polygon bed_shape = base_bed_shape; + bed_shape.translate(translation); + bed_shape.make_counter_clockwise(); + if (bed_shape.points.size() >= 3) { + space.valid_bed = offset_ex(bed_shape, -float(m_clearance)); + if (space.valid_bed.empty()) + space.valid_bed = union_ex(Polygons { std::move(bed_shape) }); + } + } +} + +void ExclusionVolumeTravelAvoidance::clear() +{ + m_spaces.clear(); + m_clearance = static_cast(SCALED_EPSILON); +} + +bool ExclusionVolumeTravelAvoidance::empty() const +{ + return std::all_of(m_spaces.begin(), m_spaces.end(), [](const RoutingSpace &space) { + return space.regions.empty(); + }); +} + +const ExPolygons * +ExclusionVolumeTravelAvoidance::active_obstacles( + RoutingSpace &space, + double z_min, + double z_max) +{ + std::vector active_region_ids; + active_region_ids.reserve(space.regions.size()); + for (size_t region_id = 0; region_id < space.regions.size(); ++region_id) { + const BedExcludeRegion ®ion = space.regions[region_id]; + if (bed_exclusion_z_ranges_overlap(z_min, z_max, region.z_min, region.z_max)) + active_region_ids.emplace_back(region_id); + } + if (active_region_ids.empty()) + return nullptr; + + const auto cached = space.obstacle_cache.find(active_region_ids); + if (cached != space.obstacle_cache.end()) + return cached->second.empty() ? nullptr : &cached->second; + + std::vector active_regions; + active_regions.reserve(active_region_ids.size()); + for (const size_t region_id : active_region_ids) + active_regions.emplace_back(space.regions[region_id]); + + ExPolygons obstacles = active_bed_exclusion_footprints( + active_regions, z_min, z_max, Point(0, 0), m_clearance); + const auto cache_result = space.obstacle_cache.emplace( + std::move(active_region_ids), std::move(obstacles)); + return cache_result.first->second.empty() ? nullptr : &cache_result.first->second; +} + +ExclusionVolumeTravelAvoidance::Result ExclusionVolumeTravelAvoidance::route( + const Polyline &travel, + double start_z, + double end_z, + int extruder_id) +{ + Result result; + result.path = travel; + if (travel.points.size() < 2) + return result; + if (extruder_id < 0 || size_t(extruder_id) >= m_spaces.size()) { + result.status = Status::Failed; + result.detail = Detail::UnknownExtruder; + return result; + } + + RoutingSpace &space = m_spaces[size_t(extruder_id)]; + if (space.regions.empty()) { + result.detail = Detail::NoActiveObstacles; + return result; + } + + const double z_min = std::min(start_z, end_z); + const double z_max = std::max(start_z, end_z); + + // Most travels are nowhere near an exclusion. Reject them using the cheap + // precomputed boxes before unioning and inflating obstacle polygons. + const BoundingBox travel_bbox(travel.points); + bool has_active_z = false; + bool may_intersect = false; + for (size_t region_id = 0; region_id < space.regions.size(); ++region_id) { + const BedExcludeRegion ®ion = space.regions[region_id]; + if (!bed_exclusion_z_ranges_overlap(z_min, z_max, region.z_min, region.z_max)) + continue; + has_active_z = true; + if (region_id < space.region_bboxes.size() && space.region_bboxes[region_id].overlap(travel_bbox)) { + may_intersect = true; + break; + } + } + if (!has_active_z) { + result.detail = Detail::NoActiveObstacles; + return result; + } + if (!may_intersect) { + result.detail = Detail::NoIntersection; + return result; + } + + const ExPolygons *active = active_obstacles(space, z_min, z_max); + if (active == nullptr || active->empty()) { + result.detail = Detail::NoActiveObstacles; + return result; + } + result.active_obstacles = active->size(); + + const Point &start = travel.points.front(); + const Point &end = travel.points.back(); + const bool start_outside_bed = !space.valid_bed.empty() && + !point_in_expolygons(space.valid_bed, start, true); + const bool end_outside_bed = !space.valid_bed.empty() && + !point_in_expolygons(space.valid_bed, end, true); + const ExPolygons *start_obstacles = active_obstacles(space, start_z, start_z); + const ExPolygons *end_obstacles = active_obstacles(space, end_z, end_z); + if ((start_obstacles != nullptr && point_in_expolygons_interior(*start_obstacles, start)) || + (end_obstacles != nullptr && point_in_expolygons_interior(*end_obstacles, end))) { + result.status = Status::EndpointInside; + result.detail = Detail::EndpointInside; + return result; + } + + bool needs_reroute = false; + for (size_t idx = 1; idx < travel.points.size(); ++idx) { + if (segment_enters_expolygons_interior(travel.points[idx - 1], travel.points[idx], *active)) { + needs_reroute = true; + break; + } + } + if (!needs_reroute) { + result.detail = Detail::NoIntersection; + return result; + } + + Polyline path = travel; + bool rerouted = false; + for (size_t iteration = 0; iteration < MAX_REROUTE_ITERATIONS; ++iteration) { + result.iterations = iteration + 1; + bool changed = false; + for (size_t segment_idx = 0; segment_idx + 1 < path.points.size(); ++segment_idx) { + const Point &a = path.points[segment_idx]; + const Point &b = path.points[segment_idx + 1]; + const bool allow_a_outside = start_outside_bed && segment_idx == 0; + const bool allow_b_outside = end_outside_bed && segment_idx + 2 == path.points.size(); + const Polyline segment({a, b}); + if (!routed_polyline_inside_bed( + segment, space.valid_bed, allow_a_outside, allow_b_outside)) { + result.status = Status::Failed; + result.detail = Detail::SegmentOutsideBed; + return result; + } + + const std::optional obstacle_idx = first_intersected_obstacle(a, b, *active); + if (!obstacle_idx) + continue; + + const std::optional detour = detour_around_obstacle( + a, b, (*active)[*obstacle_idx], *active, space.valid_bed, + allow_a_outside, allow_b_outside); + if (!detour) { + result.status = Status::Failed; + result.detail = Detail::DetourFailed; + return result; + } + if (replacement_matches_original_segment(*detour, a, b)) + continue; + + replace_segment(path, segment_idx, *detour); + changed = true; + rerouted = true; + break; + } + + if (!changed) { + path = simplify_path(path, *active, space.valid_bed); + if (!routed_polyline_inside_bed( + path, space.valid_bed, start_outside_bed, end_outside_bed) || + polyline_intersects_obstacles(path, *active)) { + result.status = Status::Failed; + result.detail = Detail::FinalPathInvalid; + return result; + } + result.path = std::move(path); + result.status = rerouted ? Status::Rerouted : Status::Unchanged; + result.detail = rerouted ? Detail::None : Detail::NoIntersection; + return result; + } + } + + result.status = Status::Failed; + result.detail = Detail::IterationLimit; + return result; +} + +} // namespace Slic3r diff --git a/src/libslic3r/GCode/ExclusionVolumeTravelAvoidance.hpp b/src/libslic3r/GCode/ExclusionVolumeTravelAvoidance.hpp new file mode 100644 index 0000000000..64dca94865 --- /dev/null +++ b/src/libslic3r/GCode/ExclusionVolumeTravelAvoidance.hpp @@ -0,0 +1,78 @@ +#pragma once + +#include "libslic3r/ExPolygon.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/libslic3r.h" +#include "libslic3r/BoundingBox.hpp" +#include "libslic3r/Polyline.hpp" +#include "libslic3r/PrintConfig.hpp" + +#include +#include +#include + +namespace Slic3r { + +class ExclusionVolumeTravelAvoidance +{ +public: + enum class Status : unsigned char + { + Unchanged, + Rerouted, + EndpointInside, + Failed + }; + + enum class Detail : unsigned char + { + None, + UnknownExtruder, + NoActiveObstacles, + NoIntersection, + EndpointInside, + SegmentOutsideBed, + DetourFailed, + FinalPathInvalid, + IterationLimit + }; + + struct Result + { + Status status { Status::Unchanged }; + Detail detail { Detail::None }; + Polyline path; + size_t active_obstacles { 0 }; + size_t iterations { 0 }; + + bool rerouted() const { return status == Status::Rerouted; } + }; + + void init(const PrintConfig &config, const Vec3d &plate_origin); + void clear(); + + bool empty() const; + + // Input and output are scaled XY points in the active nozzle's generated + // G-code coordinates before GCodeWriter subtracts the plate offset. + Result route(const Polyline &travel, double start_z, double end_z, int extruder_id); + +private: + struct RoutingSpace + { + std::vector regions; + std::vector region_bboxes; + ExPolygons valid_bed; + std::map, ExPolygons> obstacle_cache; + }; + + const ExPolygons *active_obstacles( + RoutingSpace &space, + double z_min, + double z_max); + + std::vector m_spaces; + coord_t m_clearance { 0 }; +}; + +} // namespace Slic3r diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 6346651448..487814a286 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1,4 +1,5 @@ #include "libslic3r/ArcFitter.hpp" +#include "ExclusionVolumePathCheck.hpp" #include "libslic3r/Config.hpp" #include "libslic3r/CustomGCode.hpp" #include "libslic3r/Exception.hpp" @@ -24,6 +25,7 @@ #include #include +#include #include #include #include @@ -378,6 +380,11 @@ void GCodeProcessor::TimeMachine::reset() travel_acceleration = 0.0f; max_travel_acceleration = 0.0f; extrude_factor_override_percentage = 1.0f; + klipper = false; + minimum_cruise_ratio = 0.5f; + requested_accel_to_decel = -1.0f; + klipper_junction_flush = 1.0f; + klipper_queue_priming = true; time = 0.0f; stop_times = std::vector(); curr.reset(); @@ -493,16 +500,87 @@ GCodeProcessor::TimeMachine::AdditionalBuffer GCodeProcessor::TimeMachine::merge return merged; } +// Klipper toolhead.py LookAheadQueue.flush: the pseudo-acceleration pass +// reserves cruising distance across a sequence, not separately in each segment. +size_t GCodeProcessor::TimeMachine::plan_klipper(bool lazy) +{ + klipper_junction_flush = requested_accel_to_decel >= 0.0f ? 0.250f : 0.150f; + klipper_queue_priming = false; + size_t flush_count = blocks.size(); + bool update_flush_count = lazy; + float next_start_v2 = 0.0f; + float next_mcr_start_v2 = 0.0f; + float peak_cruise_v2 = 0.0f; + size_t pending = 0; + for (size_t i = blocks.size(); i-- > 0;) { + TimeBlock& block = blocks[i]; + const float delta_v2 = 2.0f * block.distance * block.acceleration; + const float reachable_start_v2 = next_start_v2 + delta_v2; + const float start_v2 = std::min(sqr(block.max_entry_speed), reachable_start_v2); + const float reachable_mcr_v2 = next_mcr_start_v2 + block.mcr_delta_v2; + const float mcr_start_v2 = std::min(block.max_mcr_entry_speed_sqr, reachable_mcr_v2); + float cruise_v2 = -1.0f; + ++pending; + if (mcr_start_v2 < reachable_mcr_v2) { + if (mcr_start_v2 + block.mcr_delta_v2 > next_mcr_start_v2 || pending > 1) { + // Stop at this block, not past it: the blocks above still have a cruise speed + // that depends on moves not yet seen, so only [0, i) may be committed. + if (update_flush_count && peak_cruise_v2 > 0.0f) { + flush_count = i; + update_flush_count = false; + } + peak_cruise_v2 = std::min(sqr(block.feedrate_profile.cruise), + 0.5f * (mcr_start_v2 + reachable_mcr_v2)); + } + cruise_v2 = std::min({0.5f * (start_v2 + reachable_start_v2), + sqr(block.feedrate_profile.cruise), peak_cruise_v2}); + pending = 0; + } + // Until the forward pass, these fields hold v^2, not speeds; -1 marks + // an unassigned cruise speed. A lazy return leaves them in this state. + block.feedrate_profile.entry = start_v2; + block.feedrate_profile.exit = next_start_v2; + block.trapezoid.cruise_feedrate = cruise_v2; + block.peak_cruise_v2 = peak_cruise_v2; + next_start_v2 = start_v2; + next_mcr_start_v2 = mcr_start_v2; + } + if (update_flush_count) + return 0; + // A run of blocks that cannot accelerate is resolved here, once the peak cruise speed of the + // accelerating block that precedes it is known. Each one takes a running minimum with its own + // entry speed, seeded from that peak rather than from the setter's own clamped cruise speed. + float prev_cruise_v2 = 0.0f; + for (size_t i = 0; i < flush_count; ++i) { + TimeBlock& block = blocks[i]; + float cruise_v2 = block.trapezoid.cruise_feedrate; + if (cruise_v2 < 0.0f) { + cruise_v2 = std::min(prev_cruise_v2, block.feedrate_profile.entry); + prev_cruise_v2 = cruise_v2; + } else + prev_cruise_v2 = block.peak_cruise_v2; + const float start_v2 = std::min(block.feedrate_profile.entry, cruise_v2); + const float end_v2 = std::min(block.feedrate_profile.exit, cruise_v2); + // A zero acceleration would put an infinity in the ramp distances; the Marlin helpers guard + // their divides the same way and fall back to a pure cruise. + const float inv_two_accel = block.acceleration > 0.0f ? 0.5f / block.acceleration : 0.0f; + block.feedrate_profile.entry = std::sqrt(start_v2); + block.feedrate_profile.exit = std::sqrt(end_v2); + block.trapezoid.cruise_feedrate = std::sqrt(cruise_v2); + block.trapezoid.accelerate_until = (cruise_v2 - start_v2) * inv_two_accel; + block.trapezoid.decelerate_after = block.distance - (cruise_v2 - end_v2) * inv_two_accel; + } + return flush_count; +} + void GCodeProcessor::TimeMachine::calculate_time(GCodeProcessorResult& result, PrintEstimatedStatistics::ETimeMode mode, size_t keep_last_n_blocks, float additional_time, EMoveType target_move_type, bool is_final) { if (!enabled) return; - // Orca: on the finalization pass, drain extra time that is still buffered (e.g. a - // trailing filament change) even with fewer than two blocks queued -- no later pass - // exists to attribute it on. Every other pass keeps the original >= 2 requirement, - // and an empty buffer keeps today's early-return unchanged (no behavior change). + // Drain buffered delays on the final pass, even with no motion left. + // A trailing filament change has no later move to receive its time. const bool drain_final = is_final && !m_additional_time_buffer.empty(); - if (blocks.size() < 2 && !drain_final) { + if ((klipper ? blocks.empty() : blocks.size() < 2) && !drain_final) { // Not enough blocks to attribute the extra time to yet; buffer it so it is // applied on a later pass instead of being dropped. if (additional_time > 0.0f) @@ -510,7 +588,7 @@ void GCodeProcessor::TimeMachine::calculate_time(GCodeProcessorResult& result, P return; } - assert(keep_last_n_blocks <= blocks.size()); + assert(klipper || keep_last_n_blocks <= blocks.size()); // Merge any previously buffered extra time with this call's extra time. Each // entry is applied, in order, to the first block matching its target move type @@ -520,23 +598,36 @@ void GCodeProcessor::TimeMachine::calculate_time(GCodeProcessorResult& result, P additional_buffer.emplace_back(target_move_type, additional_time); additional_buffer = merge_adjacent_additional_time_blocks(additional_buffer); - // reverse_pass - for (int i = static_cast(blocks.size()) - 1; i > 0; --i) { - planner_reverse_pass_kernel(blocks[i - 1], blocks[i]); + size_t n_blocks_process; + if (klipper) { + n_blocks_process = plan_klipper(keep_last_n_blocks != 0); + keep_last_n_blocks = blocks.size() - n_blocks_process; + } else { + for (int i = static_cast(blocks.size()) - 1; i > 0; --i) + planner_reverse_pass_kernel(blocks[i - 1], blocks[i]); + for (size_t i = 0; i + 1 < blocks.size(); ++i) + planner_forward_pass_kernel(blocks[i], blocks[i + 1]); + recalculate_trapezoids(blocks); + n_blocks_process = blocks.size() - keep_last_n_blocks; } - - // forward_pass - for (size_t i = 0; i + 1 < blocks.size(); ++i) { - planner_forward_pass_kernel(blocks[i], blocks[i + 1]); - } - - recalculate_trapezoids(blocks); - - const size_t n_blocks_process = blocks.size() - keep_last_n_blocks; size_t additional_buffer_idx = 0; for (size_t i = 0; i < n_blocks_process; ++i) { const TimeBlock& block = blocks[i]; - float block_time = block.time(); + double motion_time; + if (klipper && block.trapezoid.cruise_feedrate > 0.0f) { + // Integrate using the planned speeds. Reconstructing the exit speed + // from rounded deceleration distance loses precision near a stop. + const double cruise = block.trapezoid.cruise_feedrate; + motion_time = block.distance / cruise; + if (block.acceleration > 0.0f) { + const double accel_delta = cruise - block.feedrate_profile.entry; + const double decel_delta = cruise - block.feedrate_profile.exit; + motion_time += (sqr(accel_delta) + sqr(decel_delta)) / (2.0 * block.acceleration * cruise); + } + } else { + motion_time = block.time(); + } + double block_time = motion_time; if (additional_buffer_idx < additional_buffer.size()) { const EMoveType buf_move_type = additional_buffer[additional_buffer_idx].first; if (buf_move_type == EMoveType::Noop || buf_move_type == block.move_type) { @@ -545,13 +636,13 @@ void GCodeProcessor::TimeMachine::calculate_time(GCodeProcessorResult& result, P } } - time += double(block_time); + time += block_time; // Orca: accumulate per-SkipType time spent inside SKIPPABLE regions, folded into this single // calculate_time write site. Fires fleet-wide (the shipping time_lapse_gcode template stamps // blocks stTimelapse), but writes only skippable_part_time, which has no g-code-emitting // reader until the pre-heat injector consumes it, so output is byte-identical. if (block.skippable_type != SkipType::stNone) - result.skippable_part_time[block.skippable_type] += block.time(); + result.skippable_part_time[block.skippable_type] += motion_time; result.moves[block.move_id].time[static_cast(mode)] = block_time; gcode_time.cache += block_time; //BBS @@ -689,14 +780,12 @@ void GCodeProcessor::TimeMachine::calculate_time(GCodeProcessorResult& result, P if (keep_last_n_blocks) { blocks.erase(blocks.begin(), blocks.begin() + n_blocks_process); - // Ensure that the new first block's entry speed will be preserved to prevent discontinuity - // between the erased blocks' exit speed and the new first block's entry speed. - // Otherwise, the first block's entry speed could be recalculated on the next pass without - // considering that there are no more blocks before this first block. This could lead - // to discontinuity between the exit speed (of already processed blocks) and the entry - // speed of the first block. - TimeBlock &first_block = blocks.front(); - first_block.max_entry_speed = first_block.feedrate_profile.entry; + // Preserve the boundary speed in the Marlin planner. Klipper only flushes + // moves whose cruise speed is already independent of future moves. + if (!klipper) { + TimeBlock& first_block = blocks.front(); + first_block.max_entry_speed = first_block.feedrate_profile.entry; + } } else { blocks.clear(); } @@ -2594,6 +2683,17 @@ void GCodeProcessorResult::reset() { wrapping_exclude_area = Pointfs(); //BBS: add toolpath_outside toolpath_outside = false; + exclusion_volume_path_checked = false; + exclusion_volume_path_conflict = false; + exclusion_volume_travel_conflict = false; + exclusion_volume_extrusion_conflict = false; + exclusion_volume_other_motion_conflict = false; + exclusion_volume_conflict_gcode_id = 0; + exclusion_volume_conflict_move_id = 0; + exclusion_volume_conflict_move_type = EMoveType::Noop; + exclusion_volume_conflict_extruder_id = -1; + exclusion_volume_conflict_region_id = 0; + exclusion_volume_conflict_used_unknown_z = false; //BBS: add label_object_enabled label_object_enabled = false; long_retraction_when_cut = false; @@ -3552,14 +3652,6 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) DEFAULT_TRAVEL_ACCELERATION; } - if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware) { - const ConfigOptionBool* silent_mode = config.option("silent_mode"); - if (silent_mode != nullptr) { - if (silent_mode->value && m_time_processor.machine_limits.machine_max_acceleration_x.values.size() > 1) - enable_stealth_time_estimator(true); - } - } - const ConfigOptionFloat* initial_layer_print_height = config.option("initial_layer_print_height"); if (initial_layer_print_height != nullptr) m_first_layer_height = std::abs(initial_layer_print_height->value); @@ -3599,11 +3691,6 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config) ensure_nozzle_group_result(static_cast(m_result.filaments_count)); } -void GCodeProcessor::enable_stealth_time_estimator(bool enabled) -{ - m_time_processor.machines[static_cast(PrintEstimatedStatistics::ETimeMode::Stealth)].enabled = enabled; -} - void GCodeProcessor::reset() { m_units = EUnits::Millimeters; @@ -3616,6 +3703,10 @@ void GCodeProcessor::reset() m_start_position = { 0.0f, 0.0f, 0.0f, 0.0f }; m_end_position = { 0.0f, 0.0f, 0.0f, 0.0f }; m_origin = { 0.0f, 0.0f, 0.0f, 0.0f }; + m_axis_position_known = { false, false, false }; + m_axis_origin_known = { true, true, true }; + m_processing_homing_move = false; + m_exclusion_volume_path_checker.clear(); m_cached_position.reset(); m_wiping = false; m_flushing = false; @@ -3828,6 +3919,40 @@ void GCodeProcessor::process_buffer(const std::string &buffer) }); } +void GCodeProcessor::configure_exclusion_volume_path_check(const PrintConfig &config) +{ + m_exclusion_volume_path_checker.configure(config); +} + +GCodeProcessor::PositionState GCodeProcessor::get_current_position() const +{ + PositionState state; + state.position = Vec3d(m_end_position[X], m_end_position[Y], m_end_position[Z]); + state.axis_known = m_axis_position_known; + return state; +} + +void GCodeProcessor::update_exclusion_volume_path_check_result() +{ + m_result.exclusion_volume_path_checked = m_exclusion_volume_path_checker.configured(); + const ExclusionVolumePathCheckResult &check = m_exclusion_volume_path_checker.result(); + m_result.exclusion_volume_path_conflict = check.has_any_conflict; + m_result.exclusion_volume_travel_conflict = check.has_travel_conflict; + m_result.exclusion_volume_extrusion_conflict = check.has_extrusion_conflict; + m_result.exclusion_volume_other_motion_conflict = check.has_other_motion_conflict; + + if (!check.first_hit) + return; + + const ExclusionVolumePathHit &hit = *check.first_hit; + m_result.exclusion_volume_conflict_gcode_id = hit.gcode_id; + m_result.exclusion_volume_conflict_move_id = hit.move_id; + m_result.exclusion_volume_conflict_move_type = static_cast(hit.source_move_type); + m_result.exclusion_volume_conflict_extruder_id = hit.extruder_id; + m_result.exclusion_volume_conflict_region_id = hit.region_id; + m_result.exclusion_volume_conflict_used_unknown_z = hit.used_unknown_z; +} + void GCodeProcessor::finalize(bool post_process) { m_result.z_offset = m_z_offset; @@ -3868,13 +3993,14 @@ void GCodeProcessor::finalize(bool post_process) if (m_enable_pre_heating) run_second_pass_injection(); } + update_exclusion_volume_path_check_result(); //BBS: update slice warning update_slice_warnings(); } -float GCodeProcessor::get_time(PrintEstimatedStatistics::ETimeMode mode) const +double GCodeProcessor::get_time(PrintEstimatedStatistics::ETimeMode mode) const { - return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? float(m_time_processor.machines[static_cast(mode)].time) : 0.0f; + return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? m_time_processor.machines[static_cast(mode)].time : 0.0; } float GCodeProcessor::get_prepare_time(PrintEstimatedStatistics::ETimeMode mode) const @@ -5022,6 +5148,30 @@ void GCodeProcessor::process_G0(const GCodeReader::GCodeLine& line) process_G1(line); } +void GCodeProcessor::update_position_known_from_move( + const std::array, 4> &axes, + const G1DiscretizationOrigin origin) +{ + if (origin != G1DiscretizationOrigin::G1 || m_global_positioning_type != EPositioningType::Absolute) + return; + + for (unsigned char axis = X; axis <= Z; ++axis) { + if (axes[axis].has_value()) + m_axis_position_known[axis] = m_axis_origin_known[axis]; + } +} + +void GCodeProcessor::update_position_known_from_move(const GCodeReader::GCodeLine &line) +{ + if (m_global_positioning_type != EPositioningType::Absolute) + return; + + for (unsigned char axis = X; axis <= Z; ++axis) { + if (line.has(static_cast(axis))) + m_axis_position_known[axis] = m_axis_origin_known[axis]; + } +} + void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line, const std::optional& remaining_internal_g1_lines) { std::array, 4> g1_axes = { std::nullopt, std::nullopt, std::nullopt, std::nullopt }; @@ -5031,12 +5181,21 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line, const std::o if (line.has_e()) g1_axes[E] = (double)line.e(); std::optional g1_feedrate = std::nullopt; if (line.has_f()) g1_feedrate = (double)line.f(); + if (m_flavor == gcfKlipper) { + // Preserve decimal coordinates for short segments without parsing twice. + for (unsigned char axis = X; axis <= E; ++axis) + if (line.has(static_cast(axis))) + g1_axes[axis] = line.precise_value(static_cast(axis)); + if (line.has_f()) + g1_feedrate = line.precise_value(F); + } process_G1(g1_axes, g1_feedrate); } void GCodeProcessor::process_G1(const std::array, 4>& axes, const std::optional& feedrate, G1DiscretizationOrigin origin, const std::optional& remaining_internal_g1_lines) { + const std::array start_axis_known = m_axis_position_known; int filament_id = get_filament_id(); int last_filament_id = get_last_filament_id(); float filament_diameter = (static_cast(filament_id) < m_result.filament_diameters.size()) ? m_result.filament_diameters[filament_id] : m_result.filament_diameters.back(); @@ -5086,6 +5245,7 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes for (unsigned char a = X; a <= E; ++a) { m_end_position[a] = extract_absolute_position_on_axis((Axis)a, axes[a], double(area_filament_cross_section)); } + update_position_known_from_move(axes, origin); // updates feedrate from line, if present if (feedrate.has_value()) @@ -5107,6 +5267,40 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes const float delta_xyz = std::sqrt(sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z])); m_travel_dist = delta_xyz; + if (!m_processing_homing_move) { + std::optional exclusion_motion_type; + switch (type) { + case EMoveType::Travel: + exclusion_motion_type = ExclusionVolumeMotionType::Travel; + break; + case EMoveType::Extrude: + case EMoveType::Wipe: + exclusion_motion_type = ExclusionVolumeMotionType::Extrude; + break; + case EMoveType::Retract: + case EMoveType::Unretract: + exclusion_motion_type = ExclusionVolumeMotionType::Other; + break; + default: + break; + } + + if (exclusion_motion_type) { + m_exclusion_volume_path_checker.check_motion( + Vec3d(m_start_position[X], m_start_position[Y], m_start_position[Z]), + Vec3d(m_end_position[X], m_end_position[Y], m_end_position[Z]), + start_axis_known[X] && start_axis_known[Y], + m_axis_position_known[X] && m_axis_position_known[Y], + start_axis_known[Z], + m_axis_position_known[Z], + get_extruder_id(false), + *exclusion_motion_type, + static_cast(type), + m_line_id, + m_result.moves.size()); + } + } + if (type == EMoveType::Extrude) { float volume_extruded_filament = area_filament_cross_section * delta_pos[E]; float area_toolpath_cross_section = volume_extruded_filament / delta_xyz; @@ -5138,7 +5332,15 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes if (origin == G1DiscretizationOrigin::G1) m_extruded_last_z = m_end_position[Z]; - m_options_z_corrector.update(m_height); + // The queued blocks of the moves after the erased one follow them down the list. + if (const std::optional erased = m_options_z_corrector.update(m_height)) { + for (TimeMachine& machine : m_time_processor.machines) { + for (TimeBlock& block : machine.blocks) { + if (block.move_id > *erased) + --block.move_id; + } + } + } if (m_forced_width > 0.0f) m_width = m_forced_width; @@ -5228,7 +5430,7 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes //BBS: limite the cruise according to centripetal acceleration //Only need to handle when both prev and curr segment has movement in x-y plane - if ((prev.exit_direction(0) != 0.0f || prev.exit_direction(1) != 0.0f) && + if (m_flavor != gcfKlipper && (prev.exit_direction(0) != 0.0f || prev.exit_direction(1) != 0.0f) && (curr.enter_direction(0) != 0.0f || curr.enter_direction(1) != 0.0f)) { Vec3f v1 = prev.exit_direction; v1(2, 0) = 0.0f; @@ -5252,6 +5454,15 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes } } + if (m_flavor == gcfKlipper && !is_extrusion_only_move(delta_pos)) { + const float max_velocity = get_axis_max_feedrate(static_cast(i), X, m_machine_config_idx); + if (max_velocity > 0.0f) + curr.feedrate = std::min(curr.feedrate, max_velocity); + } + // Klipper applies E limits to retractions and moves without XY motion, + // not to positive extrusion along a printing path. + const bool limit_extruder = m_flavor != gcfKlipper || delta_pos[E] < 0.0 || + (delta_pos[X] == 0.0 && delta_pos[Y] == 0.0); // calculates block cruise feedrate float min_feedrate_factor = 1.0f; for (unsigned char a = X; a <= E; ++a) { @@ -5260,7 +5471,8 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes curr.axis_feedrate[a] *= machine.extrude_factor_override_percentage; curr.abs_axis_feedrate[a] = std::abs(curr.axis_feedrate[a]); - if (curr.abs_axis_feedrate[a] != 0.0f) { + if (curr.abs_axis_feedrate[a] != 0.0f && (a != E || limit_extruder) && + (m_flavor != gcfKlipper || a == Z || a == E)) { float axis_max_feedrate = get_axis_max_feedrate(static_cast(i), static_cast(a), m_machine_config_idx); if (axis_max_feedrate != 0.0f) min_feedrate_factor = std::min(min_feedrate_factor, axis_max_feedrate / curr.abs_axis_feedrate[a]); } @@ -5277,20 +5489,42 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes } // calculates block acceleration - float acceleration = - (type == EMoveType::Travel) ? get_travel_acceleration(static_cast(i)) : - (is_extrusion_only_move(delta_pos) ? - get_retract_acceleration(static_cast(i)) : - get_acceleration(static_cast(i))); + float acceleration; + if (m_flavor == gcfKlipper && is_extrusion_only_move(delta_pos)) { + // Klipper's max_extrude_only_accel. machine_max_acceleration_e is optional and some + // shipped profiles leave it at 0, so keep the non-zero retract fallback. + acceleration = get_axis_max_acceleration(static_cast(i), E, m_machine_config_idx); + if (acceleration <= 0.0f) + acceleration = get_retract_acceleration(static_cast(i)); + } else + acceleration = + (m_flavor == gcfKlipper) ? get_acceleration(static_cast(i)) : + (type == EMoveType::Travel) ? get_travel_acceleration(static_cast(i)) : + (is_extrusion_only_move(delta_pos) ? + get_retract_acceleration(static_cast(i)) : + get_acceleration(static_cast(i))); //BBS for (unsigned char a = X; a <= E; ++a) { + if ((a == E && !limit_extruder) || (m_flavor == gcfKlipper && (a == X || a == Y))) + continue; float axis_max_acceleration = get_axis_max_acceleration(static_cast(i), static_cast(a), m_machine_config_idx); + // An unset (0) limit means "no limit", as in the feedrate loop above. Only the Klipper + // planner divides by the block acceleration, so leave the Marlin path as it was. + if (m_flavor == gcfKlipper && axis_max_acceleration <= 0.0f) + continue; if (acceleration * std::abs(delta_pos[a]) * inv_distance > axis_max_acceleration) acceleration = axis_max_acceleration / (std::abs(delta_pos[a]) * inv_distance); } block.acceleration = acceleration; + if (m_flavor == gcfKlipper) { + block.junction_deviation = get_junction_deviation(static_cast(i), acceleration); + const float cruise_acceleration = machine.requested_accel_to_decel >= 0.0f ? + std::min(machine.acceleration, machine.requested_accel_to_decel) : + machine.acceleration * (1.0f - machine.minimum_cruise_ratio); + block.mcr_delta_v2 = 2.0f * distance * std::min(acceleration, cruise_acceleration); + } static const float PREVIOUS_FEEDRATE_THRESHOLD = 0.0001f; const bool has_prev_move = !blocks.empty() && prev.feedrate > PREVIOUS_FEEDRATE_THRESHOLD; @@ -5401,6 +5635,12 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes block.feedrate_profile.entry = std::min(vmax_junction, v_allowable); block.max_entry_speed = vmax_junction; + if (m_flavor == gcfKlipper && has_prev_move) { + const TimeBlock& previous = blocks.back(); + block.max_entry_speed = std::min(block.max_entry_speed, + std::sqrt(sqr(previous.max_entry_speed) + 2.0f * previous.distance * previous.acceleration)); + block.max_mcr_entry_speed_sqr = std::min(sqr(block.max_entry_speed), previous.max_mcr_entry_speed_sqr + previous.mcr_delta_v2); + } block.flags.nominal_length = (block.feedrate_profile.cruise <= v_allowable); block.flags.recalculate = true; block.safe_feedrate = curr.safe_feedrate; @@ -5412,9 +5652,12 @@ void GCodeProcessor::process_G1(const std::array, 4>& axes prev = curr; blocks.push_back(block); + if (m_flavor == gcfKlipper && blocks.size() > 1) + machine.klipper_junction_flush -= distance / curr.feedrate; } - if (m_time_processor.machines[0].blocks.size() > TimeProcessor::Planner::refresh_threshold) + if (m_flavor == gcfKlipper ? m_time_processor.machines[0].klipper_junction_flush <= 0.0f : + m_time_processor.machines[0].blocks.size() > TimeProcessor::Planner::refresh_threshold) calculate_time(m_result, TimeProcessor::Planner::queue_size); const Vec3f plate_offset = {(float) m_x_offset, (float) m_y_offset, 0.0f}; @@ -6093,6 +6336,10 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc m_start_position = m_end_position; // this is required because we are skipping the call to process_gcode_line() internal_only_g1_line(adjust_target(end_position, prev_target), arc.delta_z() != 0.0, (segments == 1) ? feedrate : std::nullopt, extrusion); } + + // Internal linearized arc segments inherit the arc's starting certainty. + // Only the original absolute command may establish a newly known endpoint. + update_position_known_from_move(line); } //BBS @@ -6166,22 +6413,56 @@ void GCodeProcessor::process_G23(const GCodeReader::GCodeLine& line) store_move_vertex(EMoveType::Unretract); } +static std::array g28_homed_axes(const GCodeReader::GCodeLine &line) +{ + std::array homed { false, false, false }; + std::string_view raw = line.raw(); + const size_t command_end = raw.find_first_of(" \t;"); + size_t pos = command_end == std::string_view::npos ? raw.size() : command_end; + + while (pos < raw.size()) { + pos = raw.find_first_not_of(" \t", pos); + if (pos == std::string_view::npos || raw[pos] == ';') + break; + const size_t end = raw.find_first_of(" \t;", pos); + const std::string_view word = raw.substr(pos, end == std::string_view::npos ? raw.size() - pos : end - pos); + + const bool compact_axes = !word.empty() && std::all_of(word.begin(), word.end(), [](const char c) { + const char upper = static_cast(std::toupper(static_cast(c))); + return upper == 'X' || upper == 'Y' || upper == 'Z'; + }); + if (compact_axes) { + for (const char c : word) + homed[static_cast(std::toupper(static_cast(c)) - 'X')] = true; + } else if (!word.empty()) { + const char axis = static_cast(std::toupper(static_cast(word.front()))); + const bool numeric_axis_word = word.size() > 1 && + (std::isdigit(static_cast(word[1])) || word[1] == '+' || word[1] == '-' || word[1] == '.'); + if (axis >= 'X' && axis <= 'Z' && numeric_axis_word) + homed[static_cast(axis - 'X')] = true; + } + + if (end == std::string_view::npos || raw[end] == ';') + break; + pos = end; + } + return homed; +} + void GCodeProcessor::process_G28(const GCodeReader::GCodeLine& line) { std::string_view cmd = line.cmd(); std::string new_line_raw = { cmd.data(), cmd.size() }; - bool found = false; - if (line.has('X')) { + const std::array homed = g28_homed_axes(line); + const bool found = std::any_of(homed.begin(), homed.end(), [](const bool value) { return value; }); + if (homed[X]) { new_line_raw += " X0"; - found = true; } - if (line.has('Y')) { + if (homed[Y]) { new_line_raw += " Y0"; - found = true; } - if (line.has('Z')) { + if (homed[Z]) { new_line_raw += " Z0"; - found = true; } if (!found) new_line_raw += " X0 Y0 Z0"; @@ -6189,7 +6470,19 @@ void GCodeProcessor::process_G28(const GCodeReader::GCodeLine& line) GCodeReader::GCodeLine new_gline; GCodeReader reader; reader.parse_line(new_line_raw, [&](GCodeReader& reader, const GCodeReader::GCodeLine& gline) { new_gline = gline; }); + m_processing_homing_move = true; process_G1(new_gline); + m_processing_homing_move = false; + + // G28's physical endpoint is printer-specific even though the preview uses + // zero. Wait for a subsequent explicit absolute coordinate before checking + // a path from any homed axis. + for (unsigned char axis = X; axis <= Z; ++axis) { + if (!found || homed[axis]) { + m_axis_position_known[axis] = false; + m_axis_origin_known[axis] = true; + } + } } void GCodeProcessor::process_G90(const GCodeReader::GCodeLine& line) @@ -6208,16 +6501,19 @@ void GCodeProcessor::process_G92(const GCodeReader::GCodeLine& line) bool any_found = false; if (line.has_x()) { + m_axis_origin_known[X] = m_axis_position_known[X]; m_origin[X] = m_end_position[X] - line.x() * lengths_scale_factor; any_found = true; } if (line.has_y()) { + m_axis_origin_known[Y] = m_axis_position_known[Y]; m_origin[Y] = m_end_position[Y] - line.y() * lengths_scale_factor; any_found = true; } if (line.has_z()) { + m_axis_origin_known[Z] = m_axis_position_known[Z]; m_origin[Z] = m_end_position[Z] - line.z() * lengths_scale_factor; any_found = true; // Belt only: the start G-code's purge-blob advance + G92 Z0 resets leave a constant @@ -6242,6 +6538,8 @@ void GCodeProcessor::process_G92(const GCodeReader::GCodeLine& line) // The G92 may be called for axes that PrusaSlicer does not recognize, for example see GH issue #3510, // where G92 A0 B0 is called although the extruder axis is till E. for (unsigned char a = X; a <= E; ++a) { + if (a <= Z) + m_axis_origin_known[a] = m_axis_position_known[a]; m_origin[a] = m_end_position[a]; } } @@ -6341,6 +6639,8 @@ void GCodeProcessor::process_M108(const GCodeReader::GCodeLine& line) void GCodeProcessor::process_M109(const GCodeReader::GCodeLine& line) { + if (m_flavor == gcfKlipper) + simulate_st_synchronize(); int filament_id = get_filament_id(); float new_temp; if (line.has_value('R', new_temp)) { @@ -6403,6 +6703,8 @@ void GCodeProcessor::process_M140(const GCodeReader::GCodeLine& line) void GCodeProcessor::process_M190(const GCodeReader::GCodeLine& line) { + if (m_flavor == gcfKlipper) + simulate_st_synchronize(); float new_temp; if (line.has_value('S', new_temp)) m_highest_bed_temp = m_highest_bed_temp < (int)new_temp ? (int)new_temp : m_highest_bed_temp; @@ -6480,6 +6782,21 @@ void GCodeProcessor::process_M203(const GCodeReader::GCodeLine& line) void GCodeProcessor::process_M204(const GCodeReader::GCodeLine& line) { float value; + if (m_flavor == gcfKlipper) { + if (!line.has_value('S', value)) { + float travel; + if (!line.has_value('P', value) || !line.has_value('T', travel)) + return; + value = std::min(value, travel); + } + // Klipper replaces its single live max_accel for print and travel; the profile-clamping + // setters would diverge from the firmware when custom G-code raises the limit. + if (value > 0.0f) { + for (auto& machine : m_time_processor.machines) + machine.acceleration = machine.travel_acceleration = value; + } + return; + } for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { if (static_cast(i) == PrintEstimatedStatistics::ETimeMode::Normal || m_time_processor.machine_envelope_processing_enabled) { @@ -6541,50 +6858,50 @@ void GCodeProcessor::process_M205(const GCodeReader::GCodeLine& line) void GCodeProcessor::process_SET_VELOCITY_LIMIT(const GCodeReader::GCodeLine& line) { - // handle SQUARE_CORNER_VELOCITY - static const std::regex square_corner_velocity_pattern("\\sSQUARE_CORNER_VELOCITY\\s*=\\s*([0-9]*\\.*[0-9]*)"); - std::smatch matches; - if (std::regex_search(line.raw(), matches, square_corner_velocity_pattern) && matches.size() == 2) { - float _jerk = 0; - try - { - _jerk = std::stof(matches[1]); + static const std::regex parameter_pattern( + R"(\s(VELOCITY|ACCEL|ACCEL_TO_DECEL|SQUARE_CORNER_VELOCITY|MINIMUM_CRUISE_RATIO)\s*=\s*([+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?)(?=\s|;|$))", + std::regex::icase); + const std::string command = line.raw().substr(0, line.raw().find(';')); + std::vector> parameters; + for (std::sregex_iterator it(command.begin(), command.end(), parameter_pattern), end; it != end; ++it) { + float value; + try { + value = std::stof((*it)[2].str()); + } catch (const std::exception&) { + continue; } - catch (...){} - for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { - set_option_value(m_time_processor.machine_limits.machine_max_jerk_x, i, _jerk); - set_option_value(m_time_processor.machine_limits.machine_max_jerk_y, i, _jerk); + if (std::isfinite(value)) + parameters.emplace_back(boost::to_upper_copy((*it)[1].str()), value); + } + // Klipper 0.13 converts ACCEL_TO_DECEL only when the line has no MINIMUM_CRUISE_RATIO, and later + // releases ignore it, so a line carrying both (as Orca writes) is planned with the cruise ratio. + const bool has_cruise_ratio = std::any_of(parameters.begin(), parameters.end(), + [](const auto& parameter) { return parameter.first == "MINIMUM_CRUISE_RATIO" && parameter.second >= 0.0f && parameter.second < 1.0f; }); + for (const auto& [name, value] : parameters) { + for (size_t i = 0; i < m_time_processor.machines.size(); ++i) { + TimeMachine& machine = m_time_processor.machines[i]; + // Klipper replaces its single live max_accel for print and travel; the profile-clamping + // setters would diverge from the firmware when custom G-code raises the limit. + if (name == "ACCEL" && value > 0.0f) + machine.acceleration = machine.travel_acceleration = value; + else if (name == "MINIMUM_CRUISE_RATIO" && value >= 0.0f && value < 1.0f) { + if (machine.klipper_queue_priming && machine.requested_accel_to_decel >= 0.0f) + machine.klipper_junction_flush -= 1.0f; + machine.minimum_cruise_ratio = value; + machine.requested_accel_to_decel = -1.0f; + } else if (name == "ACCEL_TO_DECEL" && value > 0.0f && !has_cruise_ratio) { + if (machine.klipper_queue_priming && machine.requested_accel_to_decel < 0.0f) + machine.klipper_junction_flush += 1.0f; + machine.requested_accel_to_decel = value; + } else if (name == "SQUARE_CORNER_VELOCITY" && value >= 0.0f) { + set_option_value(m_time_processor.machine_limits.machine_max_jerk_x, i, value); + set_option_value(m_time_processor.machine_limits.machine_max_jerk_y, i, value); + } else if (name == "VELOCITY" && value > 0.0f) { + set_option_value(m_time_processor.machine_limits.machine_max_speed_x, i, value); + set_option_value(m_time_processor.machine_limits.machine_max_speed_y, i, value); + } } } - - static const std::regex accel_pattern("\\sACCEL\\s*=\\s*([0-9]*\\.*[0-9]*)"); - if (std::regex_search(line.raw(), matches, accel_pattern) && matches.size() == 2) { - float _accl = 0; - try - { - _accl = std::stof(matches[1]); - } - catch (...) {} - for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { - set_acceleration(static_cast(i), _accl); - set_travel_acceleration(static_cast(i), _accl); - } - } - - static const std::regex velocity_pattern("\\sVELOCITY\\s*=\\s*([0-9]*\\.*[0-9]*)"); - if (std::regex_search(line.raw(), matches, velocity_pattern) && matches.size() == 2) { - float _speed = 0; - try - { - _speed = std::stof(matches[1]); - } - catch (...) {} - for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { - set_option_value(m_time_processor.machine_limits.machine_max_speed_x, i, _speed); - set_option_value(m_time_processor.machine_limits.machine_max_speed_y, i, _speed); - } - } - } void GCodeProcessor::process_M221(const GCodeReader::GCodeLine& line) @@ -6621,14 +6938,15 @@ void GCodeProcessor::process_M400(const GCodeReader::GCodeLine& line) { float value_s = 0.0; float value_p = 0.0; - if (line.has_value('S', value_s) || line.has_value('P', value_p)) { - value_s += value_p * 0.001; - // Skip post-print end-gcode dwells so they don't inflate the M73 estimate (see - // m_skip_end_gcode_delays). Only omits dwell time — no state is updated here. - if (m_skip_end_gcode_delays) - return; - simulate_st_synchronize(value_s); - } + const bool has_delay = line.has_value('S', value_s) || line.has_value('P', value_p); + if (m_flavor != gcfKlipper && !has_delay) + return; + value_s += value_p * 0.001; + // Skip post-print end-gcode dwells so they don't inflate the M73 estimate (see + // m_skip_end_gcode_delays). Only omits dwell time — no state is updated here. + if (m_skip_end_gcode_delays && has_delay) + return; + simulate_st_synchronize(value_s); } void GCodeProcessor::process_M401(const GCodeReader::GCodeLine& line) @@ -7460,12 +7778,12 @@ float GCodeProcessor::get_junction_deviation(PrintEstimatedStatistics::ETimeMode { const size_t id = static_cast(mode); - // Klipper has no classic jerk: jd = scv^2 * (sqrt(2) - 1) / max_accel - // (toolhead.py::_calc_junction_deviation). Passing the block acceleration back in makes it cancel - // in calc_vmax_junction_deviation(), leaving the identity v == scv at a 90 degree corner. + // Klipper derives junction deviation from the live toolhead acceleration, + // before a move is constrained by Z or extruder limits. if (m_flavor == gcfKlipper) { // machine_max_jerk_x holds the square corner velocity; process_SET_VELOCITY_LIMIT() writes it. const float scv = get_option_value(m_time_processor.machine_limits.machine_max_jerk_x, id); + acceleration = m_time_processor.machines[id].acceleration; if (scv <= 0.0f || acceleration <= 0.0f) return 0.0f; return sqr(scv) * (std::sqrt(2.0f) - 1.0f) / acceleration; @@ -7497,18 +7815,45 @@ float GCodeProcessor::calc_vmax_junction_deviation(const TimeBlock& block, const const TimeMachine::State& curr, bool has_prev_move, PrintEstimatedStatistics::ETimeMode mode) const { + if (m_flavor == gcfKlipper) { + if (!has_prev_move || curr.enter_direction.isZero() || prev.exit_direction.isZero()) + return 0.0f; + const TimeBlock& previous = m_time_processor.machines[static_cast(mode)].blocks.back(); + double limit = std::min(sqr(double(block.feedrate_profile.cruise)), sqr(double(prev.feedrate))); + const double extrude_ratio_change = std::abs(curr.axis_feedrate[E] / curr.feedrate - + prev.axis_feedrate[E] / prev.feedrate); + // Klipper's instantaneous_corner_velocity defaults to 1 mm/s. + // It is independent of machine_max_jerk_e; custom firmware values + // cannot be inferred from the slicer's jerk setting. + if (extrude_ratio_change > 0.0f) + limit = std::min(limit, sqr(1.0 / extrude_ratio_change)); + // Recover directions from the double-precision axis velocities: float + // unit vectors lose the angle between nearly collinear short segments. + const Vec3d prev_direction = Vec3d(prev.axis_feedrate[X], prev.axis_feedrate[Y], prev.axis_feedrate[Z]).normalized(); + const Vec3d curr_direction = Vec3d(curr.axis_feedrate[X], curr.axis_feedrate[Y], curr.axis_feedrate[Z]).normalized(); + const double cosine = std::clamp(-prev_direction.dot(curr_direction), -1.0, 1.0); + const double sin_half = std::sqrt(0.5 * (1.0 - cosine)); + const double cos_half = std::sqrt(0.5 * (1.0 + cosine)); + if (sin_half < 1.0 && cos_half > 0.0) { + const double radius = sin_half / (1.0 - sin_half); + const double half_tan = 0.5 * sin_half / cos_half; + limit = std::min({limit, + radius * block.junction_deviation * block.acceleration, + radius * previous.junction_deviation * previous.acceleration, + half_tan * block.distance * block.acceleration, + half_tan * previous.distance * previous.acceleration}); + } + return std::sqrt(limit); + } const float junction_deviation = get_junction_deviation(mode, block.acceleration); if (junction_deviation <= 0.0f) return -1.0f; // classic jerk machine, the caller keeps its own computation if (!has_prev_move) return 0.0f; // starts from rest, the planner raises this on the reverse pass - // -1 for a straight continuation, +1 for a full reversal. Half angle identity, no acos()/sin(). - // Both vectors are unit length over XYZE, so this really is a cosine: scaling by 1 / distance - // instead, as PrusaSlicer does, leaves an E term that makes extruding corners look straighter - // than they are. Marlin normalizes over XYZE for any extruding move (planner.cpp, esteps > 0) - // and Klipper keeps E out of the cosine entirely (toolhead.py::Move.calc_junction); both agree - // that the corner is planned by its geometry, and normalizing matches them to within 1e-5. + // Unit vectors over XYZE keep this a cosine. Scaling by 1 / XYZ distance + // leaves an E term that makes extruding corners appear straighter. + // Marlin normalizes over XYZE; the Klipper branch above uses XYZ only. float junction_cos_theta = (-prev.jd_unit_vec).dot(curr.jd_unit_vec); if (junction_cos_theta > 0.999999f) return 0.0f; // the path doubles back, the machine has to stop @@ -7524,8 +7869,8 @@ float GCodeProcessor::calc_vmax_junction_deviation(const TimeBlock& block, const float vmax_junction_sqr = (junction_acceleration * junction_deviation * sin_theta_d2) / (1.0f - sin_theta_d2); // Marlin's JD_HANDLE_SMALL_SEGMENTS: a short move through a shallow corner is treated as an arc and - // capped by the centripetal acceleration it needs. Klipper has no equivalent. - if (m_flavor != gcfKlipper && block.distance < 1.0f && junction_cos_theta < -0.7071067812f) { + // capped by the centripetal acceleration it needs. + if (block.distance < 1.0f && junction_cos_theta < -0.7071067812f) { // Fast acos(-t), max. error +-0.033rad. MinMax polynomial by W. Randolph Franklin: // https://wrf.ecse.rpi.edu/Research/Short_Notes/arcsin/onlyelem.html const float neg = junction_cos_theta < 0.0f ? -1.0f : 1.0f; @@ -7700,6 +8045,7 @@ void GCodeProcessor::calculate_time(GCodeProcessorResult& result, size_t keep_la std::vector actual_speed_moves; for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { TimeMachine& machine = m_time_processor.machines[i]; + machine.klipper = m_flavor == gcfKlipper; machine.calculate_time(m_result, static_cast(i), keep_last_n_blocks, additional_time, target_move_type, is_final); if (static_cast(i) == PrintEstimatedStatistics::ETimeMode::Normal) actual_speed_moves = std::move(machine.actual_speed_moves); @@ -7773,11 +8119,20 @@ void GCodeProcessor::calculate_time(GCodeProcessorResult& result, size_t keep_la it->second : block.move_id + (unsigned int)inserted_actual_speed_moves_count; } } + m_options_z_corrector.on_moves_inserted(m_actual_speed_id_map); } void GCodeProcessor::simulate_st_synchronize(float additional_time, EMoveType target_move_type) { calculate_time(m_result, 0, additional_time, target_move_type); + if (m_flavor == gcfKlipper) { + // ToolHead overrides the normal look-ahead window with BUFFER_TIME_HIGH + // at startup and after synchronization: 2 s on legacy, 1 s on modern Klipper. + for (TimeMachine& machine : m_time_processor.machines) { + machine.klipper_junction_flush = machine.requested_accel_to_decel >= 0.0f ? 2.0f : 1.0f; + machine.klipper_queue_priming = true; + } + } } void GCodeProcessor::update_estimated_times_stats() @@ -7812,7 +8167,7 @@ double GCodeProcessor::extract_absolute_position_on_axis(Axis axis, const GCodeR is_relative |= (m_e_local_positioning_type == EPositioningType::Relative); const double lengthsScaleFactor = (m_units == EUnits::Inches) ? double(INCHES_TO_MM) : 1.0; - double ret = line.value(Slic3r::Axis(axis)) * lengthsScaleFactor; + double ret = line.precise_value(Slic3r::Axis(axis)) * lengthsScaleFactor; // if (axis == E && m_use_volumetric_e) // ret /= area_filament_cross_section; return is_relative ? m_start_position[axis] + ret : m_origin[axis] + ret; diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 72fb84bad0..a196476e7a 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -13,11 +13,13 @@ #include "libslic3r/PrintConfig.hpp" #include "libslic3r/CustomGCode.hpp" #include "libslic3r/MultiNozzleUtils.hpp" +#include "libslic3r/GCode/ExclusionVolumePathCheck.hpp" #include "libslic3r/GCode/MachineFrameTransform.hpp" #include #include #include +#include #include #include #include @@ -91,12 +93,12 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; struct Mode { - float time; + double time; float prepare_time; std::vector>> custom_gcode_times; void reset() { - time = 0.0f; + time = 0.0; prepare_time = 0.0f; custom_gcode_times.clear(); custom_gcode_times.shrink_to_fit(); @@ -325,6 +327,17 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; std::vector extruder_heights; //BBS: add toolpath_outside bool toolpath_outside; + bool exclusion_volume_path_checked { false }; + bool exclusion_volume_path_conflict { false }; + bool exclusion_volume_travel_conflict { false }; + bool exclusion_volume_extrusion_conflict { false }; + bool exclusion_volume_other_motion_conflict { false }; + unsigned int exclusion_volume_conflict_gcode_id { 0 }; + size_t exclusion_volume_conflict_move_id { 0 }; + EMoveType exclusion_volume_conflict_move_type { EMoveType::Noop }; + int exclusion_volume_conflict_extruder_id { -1 }; + size_t exclusion_volume_conflict_region_id { 0 }; + bool exclusion_volume_conflict_used_unknown_z { false }; //BBS: add object_label_enabled bool label_object_enabled; //BBS : extra retraction when change filament,experiment func @@ -411,6 +424,17 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; bed_exclude_area = std::forward(other).bed_exclude_area; wrapping_exclude_area = std::forward(other).wrapping_exclude_area; toolpath_outside = std::forward(other).toolpath_outside; + exclusion_volume_path_checked = other.exclusion_volume_path_checked; + exclusion_volume_path_conflict = other.exclusion_volume_path_conflict; + exclusion_volume_travel_conflict = other.exclusion_volume_travel_conflict; + exclusion_volume_extrusion_conflict = other.exclusion_volume_extrusion_conflict; + exclusion_volume_other_motion_conflict = other.exclusion_volume_other_motion_conflict; + exclusion_volume_conflict_gcode_id = other.exclusion_volume_conflict_gcode_id; + exclusion_volume_conflict_move_id = other.exclusion_volume_conflict_move_id; + exclusion_volume_conflict_move_type = other.exclusion_volume_conflict_move_type; + exclusion_volume_conflict_extruder_id = other.exclusion_volume_conflict_extruder_id; + exclusion_volume_conflict_region_id = other.exclusion_volume_conflict_region_id; + exclusion_volume_conflict_used_unknown_z = other.exclusion_volume_conflict_used_unknown_z; label_object_enabled = std::forward(other).label_object_enabled; long_retraction_when_cut = std::forward(other).long_retraction_when_cut; timelapse_warning_code = std::forward(other).timelapse_warning_code; @@ -703,6 +727,12 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; float acceleration{ 0.0f }; // mm/s^2 float max_entry_speed{ 0.0f }; // mm/s float safe_feedrate{ 0.0f }; // mm/s + float junction_deviation{ 0.0f }; + float max_mcr_entry_speed_sqr{ 0.0f }; + float mcr_delta_v2{ 0.0f }; + // Peak cruise speed squared in effect when this block was planned. Only set on a block + // that can accelerate; the delayed blocks after it are seeded from its value. + float peak_cruise_v2{ 0.0f }; Flags flags; FeedrateProfile feedrate_profile; Trapezoid trapezoid; @@ -782,6 +812,11 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; // hard limit for the travel acceleration, to which the firmware will clamp. float max_travel_acceleration; // mm/s^2 float extrude_factor_override_percentage; + bool klipper{ false }; + float minimum_cruise_ratio{ 0.5f }; + float requested_accel_to_decel{ -1.0f }; + float klipper_junction_flush{ 1.0f }; + bool klipper_queue_priming{ true }; // We accumulate total print time in doubles to reduce the loss of precision // while adding big floating numbers with small float numbers. double time; // s @@ -818,6 +853,8 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; // Merge adjacent buffer entries that target the same move type. static AdditionalBuffer merge_adjacent_additional_time_blocks(const AdditionalBuffer& buffer); + size_t plan_klipper(bool lazy); + // additional_time is attributed to the first block matching target_move_type // (EMoveType::Noop matches any block, i.e. the first processed block). void calculate_time(GCodeProcessorResult& result, PrintEstimatedStatistics::ETimeMode mode, size_t keep_last_n_blocks = 0, float additional_time = 0.0f, EMoveType target_move_type = EMoveType::Noop, bool is_final = false); @@ -1063,18 +1100,34 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; m_custom_gcode_per_print_z_id = m_result.custom_gcode_per_print_z.size() - 1; } - void update(float height) { - if (!m_move_id.has_value() || !m_custom_gcode_per_print_z_id.has_value()) + // The time pass inserts actual speed moves in front of the moves of its blocks, and the stored + // vertex has no block of its own, so it shifts with every insertion made before it. + void on_moves_inserted(const std::vector>& id_map) { + if (!m_move_id.has_value()) return; + auto it = std::lower_bound(id_map.begin(), id_map.end(), *m_move_id, + [](const std::pair& entry, size_t id) { return entry.first < id; }); + if (it != id_map.begin()) { + --it; + *m_move_id += it->second - it->first; + } + } - const Vec3f position = m_result.moves.back().position; + // Returns the index of the move erased from the list, if any. + std::optional update(float height) { + if (!m_move_id.has_value() || !m_custom_gcode_per_print_z_id.has_value()) + return std::nullopt; - GCodeProcessorResult::MoveVertex& move = m_result.moves.emplace_back(m_result.moves[*m_move_id]); + const Vec3f position = m_result.moves.back().position; + const size_t erased = *m_move_id; + + GCodeProcessorResult::MoveVertex& move = m_result.moves.emplace_back(m_result.moves[erased]); move.position = position; move.height = height; - m_result.moves.erase(m_result.moves.begin() + *m_move_id); + m_result.moves.erase(m_result.moves.begin() + erased); m_result.custom_gcode_per_print_z[*m_custom_gcode_per_print_z_id].print_z = position.z(); reset(); + return erased; } void reset() { @@ -1176,6 +1229,10 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; AxisCoords m_start_position; // mm AxisCoords m_end_position; // mm AxisCoords m_origin; // mm + std::array m_axis_position_known { false, false, false }; + std::array m_axis_origin_known { true, true, true }; + bool m_processing_homing_move { false }; + ExclusionVolumePathChecker m_exclusion_volume_path_checker; CachedPosition m_cached_position; bool m_wiping; bool m_flushing; // mark a section with real flush @@ -1325,6 +1382,15 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; static unsigned int s_result_id; public: + struct PositionState + { + Vec3d position { Vec3d::Zero() }; + std::array axis_known { false, false, false }; + + bool has_known_xy() const { return axis_known[X] && axis_known[Y]; } + bool has_known_z() const { return axis_known[Z]; } + }; + GCodeProcessor(); void init_filament_maps_and_nozzle_type_when_import_only_gcode(); // Reprocessing an already-generated g-code (from-previous / imported g-code) does not rebuild @@ -1342,6 +1408,7 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; const std::vector &filament_map, const std::vector>& unprintable_filament_types ); void apply_config(const PrintConfig& config); + void configure_exclusion_volume_path_check(const PrintConfig &config); void set_print(Print* print) { m_print = print; } // Locates extrusions in the objects and bodies it numbers, those objects listed beforehand. void set_mass_locator(MassLocator locator, std::vector objects) @@ -1358,7 +1425,6 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; DynamicConfig export_config_for_render() const; - void enable_stealth_time_estimator(bool enabled); bool is_stealth_time_estimator_enabled() const { return m_time_processor.machines[static_cast(PrintEstimatedStatistics::ETimeMode::Stealth)].enabled; } @@ -1368,6 +1434,7 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; const GCodeProcessorResult& get_result() const { return m_result; } GCodeProcessorResult& result() { return m_result; } GCodeProcessorResult&& extract_result() { return std::move(m_result); } + PositionState get_current_position() const; // Load a G-code into a stand-alone G-code viewer. // throws CanceledException through print->throw_if_canceled() (sent by the caller as callback). @@ -1383,7 +1450,7 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; void process_buffer(const std::string& buffer); void finalize(bool post_process); - float get_time(PrintEstimatedStatistics::ETimeMode mode) const; + double get_time(PrintEstimatedStatistics::ETimeMode mode) const; float get_prepare_time(PrintEstimatedStatistics::ETimeMode mode) const; std::string get_time_dhm(PrintEstimatedStatistics::ETimeMode mode) const; std::vector>> get_custom_gcode_times(PrintEstimatedStatistics::ETimeMode mode, bool include_remaining) const; @@ -1426,6 +1493,9 @@ inline constexpr float DEFAULT_FILAMENT_DENSITY = 1.245f; void process_G1(const std::array, 4>& axes = { std::nullopt, std::nullopt, std::nullopt, std::nullopt }, const std::optional& feedrate = std::nullopt, G1DiscretizationOrigin origin = G1DiscretizationOrigin::G1, const std::optional& remaining_internal_g1_lines = std::nullopt); + void update_position_known_from_move(const std::array, 4> &axes, G1DiscretizationOrigin origin); + void update_position_known_from_move(const GCodeReader::GCodeLine &line); + void update_exclusion_volume_path_check_result(); // Arc Move void process_G2_G3(const GCodeReader::GCodeLine& line, bool clockwise); diff --git a/src/libslic3r/GCode/OrderingStrategies.cpp b/src/libslic3r/GCode/OrderingStrategies.cpp index 43bf9ecf87..4ac7ce6cb6 100644 --- a/src/libslic3r/GCode/OrderingStrategies.cpp +++ b/src/libslic3r/GCode/OrderingStrategies.cpp @@ -6,8 +6,10 @@ #include "../ShortestPath.hpp" #include "libslic3r/Point.hpp" #include "libslic3r/PrintConfig.hpp" +#include "libslic3r/libslic3r.h" #include +#include #include #include #include @@ -140,19 +142,126 @@ bool tsp_remove_crossings(std::vector& path, const Points& centers) return {std::numeric_limits::max(), std::numeric_limits::max()}; }; + // For many islands, the same scan with the edges binned in a uniform grid over their boxes, so each edge is only tested against the edges sharing a + // cell with it - two edges whose boxes overlap always do. It returns the same crossing as the all-pairs scan + // (smallest i, then smallest j), so the result is unchanged. The all-pairs scan is quadratic in the edge count and + // runs again after every reversal; rebuilding the grid costs more than it saves below the threshold. + constexpr size_t grid_min_size = 500; + BoundingBox extent; + for (size_t idx : path) + extent.merge(centers[idx]); + const int grid_n = std::clamp(int(std::sqrt(double(pn))), 1, 256); + const coord_t cell_w = std::max(1, (extent.max.x() - extent.min.x()) / grid_n + 1); + const coord_t cell_h = std::max(1, (extent.max.y() - extent.min.y()) / grid_n + 1); + const auto for_cells = [&](const Point& a, const Point& b, auto&& fn) { + const int x0 = int((std::min(a.x(), b.x()) - extent.min.x()) / cell_w), x1 = int((std::max(a.x(), b.x()) - extent.min.x()) / cell_w); + const int y0 = int((std::min(a.y(), b.y()) - extent.min.y()) / cell_h), y1 = int((std::max(a.y(), b.y()) - extent.min.y()) / cell_h); + for (int y = y0; y <= y1; ++y) + for (int x = x0; x <= x1; ++x) + fn(y * grid_n + x); + }; + std::vector> edge_cells(size_t(grid_n) * grid_n); + + auto find_crossing_grid = [&]() -> std::pair { + for (std::vector& cell : edge_cells) + cell.clear(); + for (size_t j = 0; j < n_edges; ++j) + for_cells(centers[path[j]], centers[path[(j + 1) % pn]], [&](int cell) { edge_cells[cell].emplace_back(j); }); + + for (size_t i = 0; i < n_edges; ++i) { + const Point& ai = centers[path[i]]; + const Point& bi = centers[path[(i + 1) % pn]]; + + size_t first_j = std::numeric_limits::max(); + for_cells(ai, bi, [&](int cell) { + for (size_t j : edge_cells[cell]) { + if (j < i + 2 || j >= first_j) continue; + // Skip the (0, pn-1) pair: edges (0,1) and (pn-1,0) share node 0. + if (i == 0 && j == pn - 1) continue; + + const Point& aj = centers[path[j]]; + const Point& bj = centers[path[(j + 1) % pn]]; + + if (!bboxes_overlap(ai, bi, aj, bj)) continue; + if (Geometry::segments_intersect(ai, bi, aj, bj)) + first_j = j; + } + }); + if (first_j != std::numeric_limits::max()) + return {i, first_j}; + } + return {std::numeric_limits::max(), std::numeric_limits::max()}; + }; + // Process crossings one at a time: find first, reverse it, restart scan. // Cap iterations to prevent infinite loops on collinear/overlapping segments. - int max_iters = static_cast(pn * pn); + const int max_iters = static_cast(pn * pn); bool improved = false; - while (max_iters-- > 0) { - auto [ci, cj] = find_crossing(); - if (ci == std::numeric_limits::max()) break; - improved = true; + // Reversing between two segments that only touch or overlap along a line need not remove the intersection, so on + // islands laid out on a regular grid (a tiled texture, an array of parts) the loop can cycle through the same + // orderings until the pn * pn cap. Once an ordering repeats the rest of the loop is periodic, so only the steps + // to the ordering the capped loop would have stopped on are taken. + std::unordered_map seen_paths; // path hash -> reversals done when it was reached + const auto path_hash = [&path]() { + uint64_t h = 1469598103934665603ull; // FNV-1a + for (size_t idx : path) + h = (h ^ uint64_t(idx)) * 1099511628211ull; + return h; + }; + const auto reverse_first_crossing = [&]() { + auto [ci, cj] = pn >= grid_min_size ? find_crossing_grid() : find_crossing(); + if (ci == std::numeric_limits::max()) + return false; std::reverse(path.begin() + ci + 1, path.begin() + cj + 1); + return true; + }; + seen_paths.emplace(path_hash(), 0); + for (int iter = 1; iter <= max_iters && reverse_first_crossing(); ++iter) { + improved = true; + if (auto [it, inserted] = seen_paths.emplace(path_hash(), iter); !inserted) { + for (int steps = (max_iters - iter) % (iter - it->second); steps > 0; --steps) + reverse_first_crossing(); + break; + } } return improved; } +std::vector tsp_exact_cycle(const Points& centers) +{ + const size_t n = centers.size(); + std::vector path(n); + std::iota(path.begin(), path.end(), 0); + if (n <= 3) return path; + // State mask * m + j: the points 1..m of mask visited after point 0, the last one j + 1. + const size_t m = n - 1; + assert(m <= 16); + std::vector cost((size_t(1) << m) * m, std::numeric_limits::max()); + std::vector from(cost.size(), size_t(-1)); + auto dist = [¢ers](size_t a, size_t b) { return (centers[a].cast() - centers[b].cast()).norm(); }; + for (size_t j = 0; j < m; ++j) + cost[(size_t(1) << j) * m + j] = dist(0, j + 1); + for (size_t mask = 1; mask < (size_t(1) << m); ++mask) + for (size_t j = 0; j < m; ++j) + if (const double c = cost[mask * m + j]; c < std::numeric_limits::max()) + for (size_t k = 0; k < m; ++k) + if (!(mask >> k & 1)) { + const size_t next = (mask | size_t(1) << k) * m + k; + if (const double nc = c + dist(j + 1, k + 1); nc < cost[next]) { + cost[next] = nc; + from[next] = mask * m + j; + } + } + const size_t full = (size_t(1) << m) - 1; + size_t best = full * m; + for (size_t j = 1; j < m; ++j) + if (cost[full * m + j] + dist(j + 1, 0) < cost[best] + dist(best % m + 1, 0)) + best = full * m + j; + for (size_t s = best, k = n; k-- > 1; s = from[s]) + path[k] = s % m + 1; + return path; +} + void tsp_rotate_minimize_closing(std::vector& path, const Points& centers) { size_t pn = path.size(); diff --git a/src/libslic3r/GCode/OrderingStrategies.hpp b/src/libslic3r/GCode/OrderingStrategies.hpp index a42a338a52..95a6e77bcf 100644 --- a/src/libslic3r/GCode/OrderingStrategies.hpp +++ b/src/libslic3r/GCode/OrderingStrategies.hpp @@ -29,6 +29,9 @@ bool tsp_2opt_improve(std::vector& path, const Points& centers, int max_ // Returns true if any crossing was removed. bool tsp_remove_crossings(std::vector& path, const Points& centers); +// The shortest cycle through the points, starting at point 0, by dynamic programming over subsets; for a few points only. +std::vector tsp_exact_cycle(const Points& centers); + // Rotate the cycle so the closing edge (last -> first) is minimized. void tsp_rotate_minimize_closing(std::vector& path, const Points& centers); diff --git a/src/libslic3r/GCode/SeamContour.cpp b/src/libslic3r/GCode/SeamContour.cpp new file mode 100644 index 0000000000..56be005178 --- /dev/null +++ b/src/libslic3r/GCode/SeamContour.cpp @@ -0,0 +1,261 @@ +#include "SeamContour.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/AABBTreeIndirect.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Slic3r::SeamContour { +namespace { +struct Foot { + Vec2d point = Vec2d::Zero(); + double distance = std::numeric_limits::infinity(); +}; +struct Witness { + size_t contour; + double distance; + double angle_degrees; +}; +struct BoxEntry { + size_t index; + AABBTreeIndirect::Tree2d::BoundingBox box; + size_t idx() const { return index; } + const AABBTreeIndirect::Tree2d::BoundingBox &bbox() const { return box; } + Vec2d centroid() const { return box.center(); } +}; + +double box_distance(const Contour &c, const Vec2d &p) { + return ((c.min - p).cwiseMax(Vec2d::Zero()) + (p - c.max).cwiseMax(Vec2d::Zero())).norm(); +} + +Foot closest(const Contour &c, const Vec2d &p, double stop = -1.0, + const std::vector *source_normals = nullptr, double normal_cosine = 0.0) { + Foot result; + if (stop >= 0.0 && !source_normals) + for (const Vec2d &vertex : c.points) + if ((vertex - p).norm() <= stop) return {vertex, (vertex - p).norm()}; + for (size_t i = 0; i < c.points.size(); ++i) { + const Vec2d &a = c.points[i]; + const Vec2d d = c.points[(i + 1) % c.points.size()] - a; + const double length2 = d.squaredNorm(); + if (source_normals) { + if (length2 <= 1e-18) continue; + const Vec2d normal = (c.hole ? -1.0 : 1.0) * Vec2d(d.y(), -d.x()) / std::sqrt(length2); + // A thin contour's nearest opposite side must not hide its slightly farther facing side. + if (std::none_of(source_normals->begin(), source_normals->end(), [&](const Vec2d &n) { + return n.dot(normal) >= normal_cosine; + })) continue; + } + const double t = length2 > 0.0 ? std::clamp((p - a).dot(d) / length2, 0.0, 1.0) : 0.0; + const Vec2d q = a + t * d; + const double distance = (q - p).norm(); + if (distance < result.distance) result = {q, distance}; + if (result.distance <= stop) break; // A proximity certificate needs no exact closest point. + } + return result; +} + +std::vector normals(const Contour &c, const Vec2d &p) { + std::vector result; + for (size_t i = 0; i < c.points.size(); ++i) { + const Vec2d &a = c.points[i]; + const Vec2d d = c.points[(i + 1) % c.points.size()] - a; + if (d.squaredNorm() <= 1e-18) continue; + const double t = std::clamp((p - a).dot(d) / d.squaredNorm(), 0.0, 1.0); + // Every caller supplies a vertex or closest foot on this boundary; avoid a second full search. + if ((a + t * d - p).norm() <= 1e-6) { + // Candidate polygons are CCW; a hole has material on their opposite side. + const Vec2d n(d.y(), -d.x()); + result.push_back((c.hole ? -1.0 : 1.0) * n.normalized()); + } + } + return result; +} + +} // namespace + +std::vector Resolver::query(size_t layer, const Vec2d &p, double reach) const { + std::vector result; + const Vec2d margin = Vec2d::Constant(reach); + AABBTreeIndirect::traverse(m_indices[layer], + AABBTreeIndirect::intersecting(AABBTreeIndirect::Tree2d::BoundingBox(p - margin, p + margin)), + [&](const auto &node) { result.push_back(node.idx); return true; }); + // Tree traversal order must not alter tie-breaking in the existing contour predicates. + std::sort(result.begin(), result.end()); + return result; +} + +bool Resolver::in_material(size_t layer, const Vec2d &p) const { + bool inside = false; + for (size_t index : query(layer, p, 0.0)) { + const Contour &c = m_layers[layer][index]; + if (!c.reliable) continue; // select() already falls back wherever unknown geometry can affect a probe. + if ((p.array() < c.min.array()).any() || (p.array() > c.max.array()).any()) continue; + for (size_t i = 0; i < c.points.size(); ++i) { + const Vec2d &a = c.points[i], &b = c.points[(i + 1) % c.points.size()]; + if ((a.y() > p.y()) != (b.y() > p.y()) && + p.x() < a.x() + (p.y() - a.y()) * (b.x() - a.x()) / (b.y() - a.y())) + inside = !inside; + } + } + return inside; +} + +bool Resolver::near_boundary(size_t layer, const Vec2d &p, double noise) const { + for (size_t index : query(layer, p, noise)) { + const Contour &c = m_layers[layer][index]; + if (box_distance(c, p) <= noise && closest(c, p, noise).distance <= noise) return true; + } + return false; +} + +Resolver::Resolver(Layers layers, Options options, std::function throw_if_canceled) : + m_layers(std::move(layers)), m_options(options) { + m_indices.resize(m_layers.size()); + for (size_t i = 0; i < m_layers.size(); ++i) { + if (throw_if_canceled) throw_if_canceled(); // Index construction on dense objects remains cancellable. + std::vector boxes; + for (size_t j = 0; j < m_layers[i].size(); ++j) { + Contour &c = m_layers[i][j]; + c.min = Vec2d::Constant(std::numeric_limits::infinity()); + c.max = -c.min; + for (const Vec2d &p : c.points) { c.min = c.min.cwiseMin(p); c.max = c.max.cwiseMax(p); } + if (!c.points.empty()) boxes.push_back({j, AABBTreeIndirect::Tree2d::BoundingBox(c.min, c.max)}); + } + // Build once per layer; all seeds, reverse matches and material probes reuse the boxes. + m_indices[i].build(std::move(boxes)); + } +} + +Result Resolver::select(size_t layer, size_t contour, const Vec2d &p, int direction, double radius, + bool check_reverse) const { + const size_t target = size_t(ptrdiff_t(layer) + direction); + const Contour &source = m_layers[layer][contour]; + const auto &next = m_layers[target]; + const double bounds = source.nozzle * m_options.bounds_nozzle_factor; + const double noise = source.width * m_options.noise_width_factor; + const double reach = std::max({radius, bounds, noise}); + const auto candidates = query(target, p, reach); + // An open path near either end or a material probe makes the geometric restriction uncertain. + for (size_t i : query(layer, p, reach)) + if (!m_layers[layer][i].reliable) return {Outcome::None, Method::Local, {}, true}; + for (size_t i : candidates) + if (!next[i].reliable) return {Outcome::None, Method::Local, {}, true}; + std::vector fast, nearby; + for (size_t i : candidates) { + const Contour &c = next[i]; + if (c.points.size() < 3) continue; + // A wall can become a hole when an opening closes; local geometry decides that continuation. + if (box_distance(c, p) <= radius) nearby.push_back(i); + if (c.hole == source.hole && (c.min - source.min).cwiseAbs().maxCoeff() <= bounds && + (c.max - source.max).cwiseAbs().maxCoeff() <= bounds) fast.push_back(i); + } + const auto source_normals = normals(source, p); + const auto compatible_foot = [&](const Contour &c) { + // Across a type change, use the closest patch itself: another side can mimic a shifted annulus. + return closest(c, p, -1.0, c.hole == source.hole ? &source_normals : nullptr, + m_options.normal_cosine); + }; + const auto normal_agreement = [&](const Contour &c, const Vec2d &foot) { + double agreement = -1.0; + const auto target_normals = normals(c, foot); + for (const Vec2d &a : source_normals) + for (const Vec2d &b : target_normals) agreement = std::max(agreement, a.dot(b)); + return agreement; + }; + if (fast.size() == 1) { + const size_t index = fast.front(); + const Foot foot = compatible_foot(next[index]); + // Bounds alone cannot certify a wall: only a near-coincident, consistently oriented patch can. + if (foot.distance <= noise && normal_agreement(next[index], foot.point) >= m_options.normal_cosine) { + bool competing = false; + for (size_t other : nearby) { + if (other == index || box_distance(next[other], p) > noise) continue; + const Foot alternative = compatible_foot(next[other]); + if (alternative.distance <= noise && + normal_agreement(next[other], alternative.point) >= m_options.normal_cosine) { + competing = true; + break; + } + } + // A competing local wall or failed reverse match must reach the full fallback. + if (!competing) { + if (!check_reverse) return {Outcome::Unique, Method::Bounds, {index}}; + const Result back = select(target, index, foot.point, -direction, radius, false); + // An uncertain certificate must leave the entire legacy candidate set unrestricted. + if (back.uncertain) return back; + if (std::find(back.contours.begin(), back.contours.end(), contour) != back.contours.end()) + return {Outcome::Unique, Method::Bounds, {index}}; + } + } + } + std::vector witnessed; + for (size_t i : nearby) { + const Foot foot = compatible_foot(next[i]); + if (foot.distance > radius) continue; + const double agreement = normal_agreement(next[i], foot.point); + if (agreement < m_options.normal_cosine) continue; + bool band = true; + if (foot.distance > noise) { + // Three witnesses reject connectors through material (or air) shared by both layers. + for (double t : std::array{0.25, 0.5, 0.75}) { + const Vec2d probe = p + t * (foot.point - p); + if (in_material(layer, probe) == in_material(target, probe) && + !near_boundary(layer, probe, noise) && !near_boundary(target, probe, noise)) { + band = false; + break; + } + } + } + if (!band) continue; + if (check_reverse) { + const Result back = select(target, i, foot.point, -direction, radius, false); + if (back.uncertain) return back; + // Several reverse continuations are valid if they still include the source wall. + if (std::find(back.contours.begin(), back.contours.end(), contour) == back.contours.end()) continue; + } + witnessed.push_back({i, foot.distance, std::acos(std::clamp(agreement, -1.0, 1.0)) * + 180.0 / std::acos(-1.0)}); + } + Result result; + const double distance_margin = std::max(1e-6, source.width * m_options.dominance_width_factor); + const double angle_margin = std::max(1e-6, m_options.dominance_angle_degrees); + for (const Witness &candidate : witnessed) { + // A contour is discarded only with a meaningful advantage in every scored criterion. + const bool dominated = std::any_of(witnessed.begin(), witnessed.end(), [&](const Witness &other) { + return other.distance + distance_margin <= candidate.distance && + other.angle_degrees + angle_margin <= candidate.angle_degrees; + }); + if (!dominated) result.contours.push_back(candidate.contour); + } + result.outcome = result.contours.empty() ? Outcome::None : + result.contours.size() == 1 ? Outcome::Unique : Outcome::Multiple; + return result; +} + +Result Resolver::resolve(size_t layer, size_t contour, size_t vertex, int direction, double radius) const { + Result result; + if (direction != -1 && direction != 1) return result; + const Contour &source = m_layers.at(layer).at(contour); + if (!source.reliable) return {Outcome::None, Method::Local, {}, true}; + if (radius < 0.0) radius = source.width * m_options.radius_width_factor; + if (!std::isfinite(radius)) return result; + // Alternative seeds may have different widths; their actual KD search radii cannot share a cache entry. + const Key key(layer, contour, vertex, direction, radius); + const auto cached = m_cache.find(key); + if (cached != m_cache.end()) return cached->second; + const ptrdiff_t target = ptrdiff_t(layer) + direction; + if (target >= 0 && size_t(target) < m_layers.size() && source.points.size() >= 3) { + const Vec2d &p = source.points.at(vertex); + result = select(layer, contour, p, direction, radius, true); + } + m_cache.emplace(key, result); + return result; +} + +} // namespace Slic3r::SeamContour diff --git a/src/libslic3r/GCode/SeamContour.hpp b/src/libslic3r/GCode/SeamContour.hpp new file mode 100644 index 0000000000..032a8b20c6 --- /dev/null +++ b/src/libslic3r/GCode/SeamContour.hpp @@ -0,0 +1,61 @@ +#pragma once + +#include "libslic3r/Point.hpp" +#include "libslic3r/AABBTreeIndirect.hpp" +#include +#include +#include +#include +#include + +namespace Slic3r::SeamContour { + +// Geometry is immutable during string construction; finalized state is deliberately absent. +struct Contour { + std::vector points; + bool hole = false; + bool reliable = true; // Only closed extrusion loops provide a trustworthy boundary role. + double width = 0.4; + double nozzle = 0.4; + Vec2d min = Vec2d::Zero(); + Vec2d max = Vec2d::Zero(); +}; +using Layers = std::vector>; + +struct Options { + double bounds_nozzle_factor = 1.25; // One nozzle diameter plus a quarter-diameter reserve. + double radius_width_factor = 4.0; // Preserve the existing continuation radius. + double noise_width_factor = 0.125; + double normal_cosine = 0.5; // Up to 60 degrees for geometric admissibility. + double dominance_width_factor = 0.25; // Distance advantage required to discard another contour. + double dominance_angle_degrees = 5.0; // Normal agreement must also improve by this margin. +}; + +enum class Outcome { Unique, None, Multiple }; +enum class Method { Bounds, Local }; +struct Result { + Outcome outcome = Outcome::None; + Method method = Method::Local; + std::vector contours; // Empty means no geometric restriction on the legacy search. + bool uncertain = false; // Reverse checks must propagate unknown geometry, not reject one candidate. +}; + +class Resolver { +public: + explicit Resolver(Layers layers, Options options = {}, std::function throw_if_canceled = {}); + Result resolve(size_t layer, size_t contour, size_t vertex, int direction, double radius = -1.0) const; +private: + // Alternative string starts reuse the same geometric queries in both directions. + using Key = std::tuple; + Layers m_layers; + std::vector m_indices; + Options m_options; + mutable std::map m_cache; + std::vector query(size_t layer, const Vec2d &point, double reach) const; + bool in_material(size_t layer, const Vec2d &point) const; + bool near_boundary(size_t layer, const Vec2d &point, double noise) const; + Result select(size_t layer, size_t contour, const Vec2d &point, int direction, double radius, + bool check_reverse) const; +}; + +} // namespace Slic3r::SeamContour diff --git a/src/libslic3r/GCode/SeamPlacer.cpp b/src/libslic3r/GCode/SeamPlacer.cpp index 932f8fb99e..2de6be1df4 100644 --- a/src/libslic3r/GCode/SeamPlacer.cpp +++ b/src/libslic3r/GCode/SeamPlacer.cpp @@ -1,4 +1,5 @@ #include "SeamPlacer.hpp" +#include "SeamContour.hpp" #include "libslic3r/Point.hpp" #include "libslic3r/AABBTreeIndirect.hpp" @@ -16,9 +17,11 @@ #include "tbb/blocked_range.h" #include "tbb/parallel_reduce.h" #include +#include #include #include #include +#include #include #include #include @@ -29,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -317,6 +321,28 @@ struct CoordinateFunctor { } }; +// A paint boundary uses the same geometry for green preferences and red exclusions. +struct PaintedContour { + std::vector edges; + std::vector inward; + AABBTreeIndirect::Tree<3, double> tree; + + std::vector> crossings(double z, const Vec2d &min, const Vec2d &max) const { + std::vector> result; + const Eigen::AlignedBox box(Vec3d(min.x(), min.y(), z), Vec3d(max.x(), max.y(), z)); + AABBTreeIndirect::traverse(tree, AABBTreeIndirect::intersecting(box), [&](const auto &node) { + const Linef3 &edge = edges[node.idx]; + // Half-open in z counts a contour vertex on the plane once. + if ((edge.a.z() < z) != (edge.b.z() < z)) { + const Vec3d p = edge.intersect_plane(z); + result.emplace_back(p.head<2>(), inward[node.idx].template head<2>()); + } + return true; + }); + return result; + } +}; + // structure to store global information about the model - occlusion hits, enforcers, blockers struct GlobalModelInfo { TriangleSetSamples mesh_samples; @@ -327,8 +353,15 @@ struct GlobalModelInfo { indexed_triangle_set enforcers; indexed_triangle_set blockers; + // Non-green surface proves that missing paint ends do not mean full coverage. + indexed_triangle_set non_enforcers; AABBTreeIndirect::Tree<3, float> enforcers_tree; AABBTreeIndirect::Tree<3, float> blockers_tree; + AABBTreeIndirect::Tree<3, float> non_enforcers_tree; + // Contour of the painted enforcer region: edges of one enforcer triangle only, with the unit direction from + // each edge into the paint. + PaintedContour enforcer_contour; + PaintedContour blocker_contour; // Precise Seam modifiers: strong modifiers (CENTER/LEFT/RIGHT) determine exact seam placement std::vector precise_seam_strong_volumes; @@ -439,11 +472,17 @@ struct GlobalModelInfo { //Extract perimeter polygons of the given layer Polygons extract_perimeter_polygons(const Layer *layer, std::vector &corresponding_regions_out, + std::vector> &boundary_types_out, bool has_precise_seam_modifiers) { Polygons polygons; + const auto boundary_type = [](const ExtrusionEntity *entity) -> std::optional { + if (!entity->is_loop()) return std::nullopt; + return (static_cast(entity)->loop_role() & elrHole) != 0; + }; for (const LayerRegion *layer_region : layer->regions()) { for (const ExtrusionEntity *ex_entity : layer_region->perimeters.entities) { if (ex_entity->is_collection()) { //collection of inner, outer, and overhang perimeters + const size_t collection_begin = polygons.size(); // The fallback below applies per collection, not per layer. for (const ExtrusionEntity *perimeter : static_cast(ex_entity)->entities) { ExtrusionRole role = perimeter->role(); if (perimeter->is_loop()) { @@ -452,6 +491,9 @@ Polygons extract_perimeter_polygons(const Layer *layer, std::vectorinset_idx == 0) + role = ExtrusionRole::erExternalPerimeter; } if (role == ExtrusionRole::erExternalPerimeter) { @@ -459,19 +501,22 @@ Polygons extract_perimeter_polygons(const Layer *layer, std::vectorcollect_points(p); polygons.emplace_back(std::move(p)); corresponding_regions_out.push_back(layer_region); + boundary_types_out.push_back(boundary_type(perimeter)); } } - if (polygons.empty()) { + if (polygons.size() == collection_begin) { Points p; ex_entity->collect_points(p); polygons.emplace_back(std::move(p)); corresponding_regions_out.push_back(layer_region); + boundary_types_out.push_back(boundary_type(ex_entity)); } } else { Points p; ex_entity->collect_points(p); polygons.emplace_back(std::move(p)); corresponding_regions_out.push_back(layer_region); + boundary_types_out.push_back(boundary_type(ex_entity)); } } } @@ -492,18 +537,143 @@ Polygons extract_perimeter_polygons(const Layer *layer, std::vector &loop, double z, double reach, const GlobalModelInfo &info) { + if (loop.size() < 3 || info.enforcers.empty()) + return false; + if (info.non_enforcers.empty()) + return true; // Every relevant model surface is green, so paint adds no seam information. + if (reach <= enforced_end_tolerance) + return false; + Vec2d min = loop.front(), max = loop.front(); + for (const Vec2d &point : loop) { + min = min.cwiseMin(point); + max = max.cwiseMax(point); + } + // A conservative box also rejects tiny gaps and a nearby opposite unpainted wall. + const Eigen::AlignedBox box(Vec3f(float(min.x() - reach), float(min.y() - reach), float(z - reach)), + Vec3f(float(max.x() + reach), float(max.y() + reach), float(z + reach))); + bool non_green_nearby = false; + AABBTreeIndirect::traverse(info.non_enforcers_tree, AABBTreeIndirect::intersecting(box), [&](const auto &) { + non_green_nearby = true; + return false; // Stop on the first uncertain surface rather than infer a full painted ring. + }); + if (non_green_nearby) + return false; + const auto covered = [&](const auto &self, const Vec3d &a, const Vec3d &b, unsigned depth) -> bool { + const Vec3d middle = 0.5 * (a + b); + // A paint point this close to the midpoint covers the entire segment by the triangle inequality. + const double radius = reach - 0.5 * (b - a).norm() - enforced_end_tolerance; + if (radius > 0.0 && info.is_enforced(middle.cast(), float(radius))) + return true; + if (depth == 8) + return false; // A bounded proof failure preserves the existing conservative paint behavior. + return self(self, a, middle, depth + 1) && self(self, middle, b, depth + 1); + }; + for (size_t i = 0; i < loop.size(); ++i) { + const Vec2d &a = loop[i], &b = loop[(i + 1) % loop.size()]; + if (!covered(covered, Vec3d(a.x(), a.y(), z), Vec3d(b.x(), b.y(), z), 0)) + return false; + } + return true; +} + +// Painted ranges of a counterclockwise loop at height z, bounded exactly where the paint contour crosses the +// layer: each crossing within `reach` of the loop is moved to its closest loop point, and paint lies ahead of +// it or behind it along the loop. `arc` holds the length from the first vertex to each vertex, the loop length +// last. Empty if the contour does not cross near the loop or its crossings do not pair up into ranges. +std::vector exact_painted_intervals(const std::vector &loop, const std::vector &arc, + double z, double reach, const PaintedContour &contour) { + const size_t count = loop.size(); + if (count < 3 || contour.edges.empty()) + return {}; + Vec2d min = loop.front(), max = loop.front(); + for (const Vec2d &p : loop) { + min = min.cwiseMin(p); + max = max.cwiseMax(p); + } + const auto crossings = contour.crossings(z, min - Vec2d(reach, reach), max + Vec2d(reach, reach)); + // Direction of the first edge from edge i on, forward or backward, that is longer than the tolerance: loops + // repeat their first point and the shared ends of their paths. + const auto direction = [&](size_t i, bool forward) { + for (size_t step = 0; step < count; ++step, i = forward ? (i + 1) % count : (i + count - 1) % count) { + const Vec2d d = loop[(i + 1) % count] - loop[i]; + if (d.norm() >= enforced_end_tolerance) + return Vec2d(d.normalized()); + } + return Vec2d(Vec2d::Zero()); + }; + std::vector> ends; // Position along the loop; true if paint lies ahead. + for (const auto &[point, inward] : crossings) { + double best = std::numeric_limits::max(), position = 0.0; + Vec2d tangent = Vec2d::Zero(); + for (size_t i = 0; i < count; ++i) { + const Vec2d a = loop[i], ab = loop[(i + 1) % count] - a; + const double length2 = ab.squaredNorm(); + const double t = length2 > 0.0 ? std::clamp((point - a).dot(ab) / length2, 0.0, 1.0) : 0.0; + const double distance2 = (a + t * ab - point).squaredNorm(); + if (distance2 < best) { + best = distance2; + const double along = t * (arc[i + 1] - arc[i]); + position = arc[i] + along; + // At a vertex the loop turns, so its direction there is the mean of the two edges; a crossing at a + // corner may land a rounding error off the vertex, on either edge. + const size_t vertex = along < enforced_end_tolerance ? i : + arc[i + 1] - position < enforced_end_tolerance ? (i + 1) % count : + count; + tangent = vertex < count ? direction((vertex + count - 1) % count, false) + direction(vertex, true) : + direction(i, true); + } + } + if (best > reach * reach) + continue; + const double side = inward.dot(tangent); + if (std::abs(side) < 1e-6) + return {}; // The contour runs along the loop here: no clear end. + ends.emplace_back(position, side > 0.0); + } + if (ends.empty() || ends.size() % 2 != 0) + return {}; + std::sort(ends.begin(), ends.end()); + for (size_t i = 0; i < ends.size(); ++i) + if (ends[i].second == ends[(i + 1) % ends.size()].second) + return {}; // Paint must start and stop in turn along the loop. + const size_t first = ends.front().second ? 0 : 1; + std::vector intervals; + for (size_t i = first; i < first + ends.size(); i += 2) { + const double begin = ends[i % ends.size()].first; + double end = ends[(i + 1) % ends.size()].first; + if (end < begin) + end += arc.back(); + intervals.push_back({begin, end}); + } + return intervals; +} + // Build SeamCandidates for each vertex of the perimeter polygon and attach them to a shared Perimeter. // For each vertex: computes position, angle, and type (Enforcer / Blocker / Neutral). // When Precise Seam modifiers are present: inserts strong seam point, // oversamples enforcer edges, applies weak modifiers, marks one enforced point as central for alignment. void process_perimeter_polygon(const Polygon &orig_polygon, float z_coord, const LayerRegion *region, const GlobalModelInfo &global_model_info, PrintObjectSeamData::LayerSeams &result, - PreciseSeam::PreciseSeamWarnings* warnings = nullptr) { + PreciseSeam::PreciseSeamWarnings* warnings = nullptr, + std::optional boundary_hole = std::nullopt) { if (orig_polygon.size() == 0) { return; } @@ -549,6 +719,10 @@ void process_perimeter_polygon(const Polygon &orig_polygon, float z_coord, const result.perimeters.push_back( { }); Perimeter &perimeter = result.perimeters.back(); + // The loop role is independent of the configured printing direction. + perimeter.is_hole = boundary_hole.value_or(was_clockwise); + perimeter.contour_reliable = boundary_hole.has_value(); // Keep unknown roles out of geometric matching. + perimeter.contour_index = result.perimeters.size() - 1; std::queue orig_polygon_points { }; for (size_t index = 0; index < polygon.size(); ++index) { @@ -560,44 +734,144 @@ void process_perimeter_polygon(const Polygon &orig_polygon, float z_coord, const size_t orig_angle_index = 0; perimeter.start_index = result.points.size(); perimeter.flow_width = region != nullptr ? region->flow(FlowRole::frExternalPerimeter).width() : 0.0f; + + // Painted ranges bounded exactly by the paint contour crossing this layer; without them, points within + // flow_width of paint are Enforced. + std::vector loop_xy; + std::vector loop_arc { 0.0 }; + for (const Point &point : polygon.points) + loop_xy.push_back(unscale(point)); + for (size_t i = 0; i < loop_xy.size(); ++i) + loop_arc.push_back(loop_arc.back() + (loop_xy[(i + 1) % loop_xy.size()] - loop_xy[i]).norm()); + const double loop_length = loop_arc.back(); + const auto intervals = exact_painted_intervals(loop_xy, loop_arc, z_coord, perimeter.flow_width, + global_model_info.enforcer_contour); + const auto blocked_intervals = exact_painted_intervals(loop_xy, loop_arc, z_coord, perimeter.flow_width, + global_model_info.blocker_contour); + perimeter.exact_blocked_ends = !blocked_intervals.empty(); + const bool exact_marks = !intervals.empty() || perimeter.exact_blocked_ends; + // Keep active Precise Seam modifiers authoritative; normalize ordinary full paint only. + const bool ignore_full_paint = intervals.empty() && !inserted_seam_position && weak_segments.empty() && + fully_enforced_loop(loop_xy, z_coord, perimeter.flow_width, global_model_info); + if (ignore_full_paint) + BOOST_LOG_TRIVIAL(debug) << "[SeamPaint] full_perimeter z=" << z_coord << " normalized=true"; + perimeter.exact_enforced_ends = !intervals.empty(); + const auto in_interval = [&](double at, const std::vector &ranges) { + for (const PaintedInterval &interval : ranges) + for (const double s : { at, at + loop_length }) + if (s >= interval.begin - enforced_end_tolerance && s <= interval.end + enforced_end_tolerance) + return true; + return false; + }; + const auto point_at = [&](double s) { + const size_t i = std::min(size_t(std::upper_bound(loop_arc.begin(), loop_arc.end(), s) - loop_arc.begin()), + loop_xy.size()) - 1; + const double length = loop_arc[i + 1] - loop_arc[i]; + const Vec2d p = loop_xy[i] + (length > 0.0 ? (s - loop_arc[i]) / length : 0.0) * + (loop_xy[(i + 1) % loop_xy.size()] - loop_xy[i]); + return Vec3f(float(p.x()), float(p.y()), z_coord); + }; + // Green paint without exact ends: an edge whose start is within the edge length of paint gets a point every + // enforcer_oversampling_distance, passed to emit as its distance from the start. + const auto oversample_green = [&](const Vec3f &start, float length, const auto &emit) { + if (ignore_full_paint || !global_model_info.is_enforced(start, length)) + return; + for (float step = SeamPlacer::enforcer_oversampling_distance; step < length; + step += SeamPlacer::enforcer_oversampling_distance) + emit(step); + }; + // Points to insert: the range ends, middles and every enforcer_oversampling_distance from their begin, and the + // middle of each gap between ranges, which keeps neighboring ranges apart as patches; as sorted loop positions + // in [0, loop_length). + std::vector marks; + std::vector> interval_middles; // Middle point and length of each range. + for (size_t k = 0; k < intervals.size(); ++k) { + const PaintedInterval &interval = intervals[k]; + const double middle = 0.5 * (interval.begin + interval.end); + // Ranges come in loop order from the first vertex. + const double next_begin = k + 1 < intervals.size() ? intervals[k + 1].begin : intervals.front().begin + loop_length; + marks.insert(marks.end(), { interval.begin, interval.end, middle, 0.5 * (interval.end + next_begin) }); + for (double s = interval.begin + SeamPlacer::enforcer_oversampling_distance; s < interval.end - enforced_end_tolerance; + s += SeamPlacer::enforcer_oversampling_distance) + marks.push_back(s); + interval_middles.emplace_back(point_at(std::fmod(middle, loop_length)), interval.end - interval.begin); + } + for (size_t k = 0; k < blocked_intervals.size(); ++k) { + const auto &interval = blocked_intervals[k]; + const double next_begin = k + 1 < blocked_intervals.size() ? blocked_intervals[k + 1].begin : + blocked_intervals.front().begin + loop_length; + const double gap = next_begin - interval.end; + // Keep the boundary itself blocked, with a permitted sample just outside it. Both alignment and + // the iterative solvers stop at these samples, within 2 um of the geometric paint edge. + const double guard = std::min(2.0 * enforced_end_tolerance, 0.25 * gap); + marks.insert(marks.end(), {interval.begin, interval.end, 0.5 * (interval.begin + interval.end), + interval.end + guard, next_begin - guard, 0.5 * (interval.end + next_begin)}); + } + if (perimeter.exact_blocked_ends && !perimeter.exact_enforced_ends) { + // Red marks must not suppress legacy green oversampling when its boundary is uncertain. + for (size_t i = 0; i < loop_xy.size(); ++i) + oversample_green(point_at(loop_arc[i]), float(loop_arc[i + 1] - loop_arc[i]), + [&](float step) { marks.push_back(loop_arc[i] + step); }); + } + for (double &s : marks) + s = std::fmod(s, loop_length); + std::sort(marks.begin(), marks.end()); + // A mark closer than the tolerance to the last one kept is the same point. + size_t kept = 0; + for (size_t i = 0; i < marks.size(); ++i) + if (kept == 0 || marks[i] - marks[kept - 1] >= enforced_end_tolerance) + marks[kept++] = marks[i]; + marks.resize(kept); + + std::queue oversampled_arcs { }; // Loop positions of the inserted points with exact ranges. bool some_point_enforced = false; while (!orig_polygon_points.empty() || !oversampled_points.empty()) { EnforcedBlockedSeamPoint type = EnforcedBlockedSeamPoint::Neutral; Vec3f position; float local_ccw_angle = 0; bool orig_point = false; + double at = 0.0; // Loop position, used with exact ranges. if (!oversampled_points.empty()) { position = oversampled_points.front(); oversampled_points.pop(); + if (exact_marks) { + at = oversampled_arcs.front(); + oversampled_arcs.pop(); + } } else { position = orig_polygon_points.front(); orig_polygon_points.pop(); local_ccw_angle = was_clockwise ? -polygon_angles[orig_angle_index] : polygon_angles[orig_angle_index]; + at = loop_arc[orig_angle_index]; orig_angle_index++; orig_point = true; } - if (global_model_info.is_enforced(position, perimeter.flow_width)) { + // Projected ends bound paint but cannot prove that a detour between them stays near its surface. + if (!ignore_full_paint && (!perimeter.exact_enforced_ends || in_interval(at, intervals)) && + global_model_info.is_enforced(position, perimeter.flow_width)) { type = EnforcedBlockedSeamPoint::Enforced; } - if (global_model_info.is_blocked(position, perimeter.flow_width)) { + if ((!perimeter.exact_blocked_ends || in_interval(at, blocked_intervals)) && + global_model_info.is_blocked(position, perimeter.flow_width)) { type = EnforcedBlockedSeamPoint::Blocked; } some_point_enforced = some_point_enforced || type == EnforcedBlockedSeamPoint::Enforced; - if (orig_point) { - Vec3f pos_of_next = orig_polygon_points.empty() ? first : orig_polygon_points.front(); - float distance_to_next = (position - pos_of_next).norm(); - if (global_model_info.is_enforced(position, distance_to_next)) { - Vec3f vec_to_next = (pos_of_next - position).normalized(); - float step_size = SeamPlacer::enforcer_oversampling_distance; - float step = step_size; - while (step < distance_to_next) { - oversampled_points.push(position + vec_to_next * step); - step += step_size; - } + if (orig_point && exact_marks) { + // Marks strictly inside the edge from this vertex; one at a vertex is the vertex itself. + const double from = loop_arc[orig_angle_index - 1], to = loop_arc[orig_angle_index]; + for (auto it = std::upper_bound(marks.begin(), marks.end(), from + enforced_end_tolerance); + it != marks.end() && *it < to - enforced_end_tolerance; ++it) { + oversampled_points.push(point_at(*it)); + oversampled_arcs.push(*it); } + } else if (orig_point) { + const Vec3f pos_of_next = orig_polygon_points.empty() ? first : orig_polygon_points.front(); + const Vec3f vec_to_next = (pos_of_next - position).normalized(); + oversample_green(position, (position - pos_of_next).norm(), + [&](float step) { oversampled_points.push(position + vec_to_next * step); }); } result.points.emplace_back(position, perimeter, local_ccw_angle, type); @@ -672,6 +946,14 @@ void process_perimeter_polygon(const Polygon &orig_polygon, float z_coord, const assert(viable_points_indices.size() > 0); if (large_angle_points_indices.empty()) { size_t central_idx = viable_points_indices[viable_points_indices.size() / 2]; + // With exact ranges, the middle of the longest range in the patch. + double longest = -1.0; + for (const size_t idx : viable_points_indices) + for (const auto &[middle, length] : interval_middles) + if (length > longest && (result.points[idx].position - middle).norm() <= enforced_end_tolerance) { + central_idx = idx; + longest = length; + } result.points[central_idx].central_enforcer = true; } else { size_t central_idx = large_angle_points_indices.size() / 2; @@ -792,12 +1074,35 @@ void compute_global_occlusion(GlobalModelInfo &result, const PrintObject *po, #endif } +// Appends the contour of painted triangles without T-joints (shared vertices): their edges used by one +// triangle only. Paint lies to the left of an edge in the triangle's counterclockwise order. +void append_painted_contour(PaintedContour &result, const indexed_triangle_set &painted) { + const auto edge_key = [](int a, int b) { return (uint64_t(std::min(a, b)) << 32) | uint64_t(std::max(a, b)); }; + std::unordered_map uses; + for (const stl_triangle_vertex_indices &face : painted.indices) + for (int i = 0; i < 3; ++i) + ++uses[edge_key(face[i], face[(i + 1) % 3])]; + for (const stl_triangle_vertex_indices &face : painted.indices) { + const Vec3d v[3] = {painted.vertices[face[0]].cast(), painted.vertices[face[1]].cast(), + painted.vertices[face[2]].cast()}; + const Vec3d normal = (v[1] - v[0]).cross(v[2] - v[0]); + for (int i = 0; i < 3; ++i) { + const Vec3d inward = normal.cross(v[(i + 1) % 3] - v[i]); + if (uses[edge_key(face[i], face[(i + 1) % 3])] == 1 && inward.squaredNorm() > 0.0) { + result.edges.emplace_back(v[i], v[(i + 1) % 3]); + result.inward.emplace_back(inward.normalized()); + } + } + } +} + void gather_enforcers_blockers(GlobalModelInfo &result, const PrintObject *po) { BOOST_LOG_TRIVIAL(debug) << "SeamPlacer: build AABB trees for raycasting enforcers/blockers: start"; auto obj_transform = po->trafo_sliced(); + indexed_triangle_set painted_non_green; // Used only if the object has green paint. for (const ModelVolume *mv : po->model_object()->volumes) { // Collect painting only from model parts (what the gizmo edits) and negative volumes (the only way // to paint a hole's wall); painting left on modifiers and helpers after a type change is ignored. @@ -805,25 +1110,55 @@ void gather_enforcers_blockers(GlobalModelInfo &result, const PrintObject *po) { // making it editable also needs model_custom_seam_data_changed() to track it. if (!mv->is_model_part() && !mv->is_negative_volume()) continue; + const auto model_transformation = obj_transform * mv->get_matrix(); if (mv->is_seam_painted()) { - auto model_transformation = obj_transform * mv->get_matrix(); - - indexed_triangle_set enforcers = mv->seam_facets.get_facets(*mv, EnforcerBlockerType::ENFORCER); + // One selector serves every paint state; each FacetsAnnotation query would rebuild it from the mesh. + TriangleSelector selector(mv->mesh()); + selector.deserialize(mv->seam_facets.get_data(), false); + indexed_triangle_set enforcers = selector.get_facets(EnforcerBlockerType::ENFORCER); // ORCA fix (not related to Precise Seam): fix winding for mirrored transforms its_transform(enforcers, model_transformation, true); its_merge(result.enforcers, enforcers); - indexed_triangle_set blockers = mv->seam_facets.get_facets(*mv, EnforcerBlockerType::BLOCKER); + indexed_triangle_set painted = selector.get_facets_strict(EnforcerBlockerType::ENFORCER); + its_transform(painted, model_transformation, true); + append_painted_contour(result.enforcer_contour, painted); + + indexed_triangle_set blockers = selector.get_facets(EnforcerBlockerType::BLOCKER); // ORCA fix (not related to Precise Seam): fix winding for mirrored transforms its_transform(blockers, model_transformation, true); its_merge(result.blockers, blockers); + painted = selector.get_facets_strict(EnforcerBlockerType::BLOCKER); + its_transform(painted, model_transformation, true); + append_painted_contour(result.blocker_contour, painted); + + indexed_triangle_set non_green = selector.get_facets(EnforcerBlockerType::NONE); + its_transform(non_green, model_transformation, true); + its_merge(painted_non_green, non_green); } } + // Unpainted objects need no extra surface copy or tree; only green paint requires a coverage proof. + if (!result.enforcers.empty()) { + result.non_enforcers = std::move(painted_non_green); + for (const ModelVolume *mv : po->model_object()->volumes) { + if ((!mv->is_model_part() && !mv->is_negative_volume()) || mv->is_seam_painted()) + continue; + indexed_triangle_set non_green = mv->mesh().its; + its_transform(non_green, obj_transform * mv->get_matrix(), true); + its_merge(result.non_enforcers, non_green); + } + its_merge(result.non_enforcers, result.blockers); // Red paint must also prevent full-green normalization. + result.non_enforcers_tree = AABBTreeIndirect::build_aabb_tree_over_indexed_triangle_set(result.non_enforcers.vertices, + result.non_enforcers.indices); + } + result.enforcers_tree = AABBTreeIndirect::build_aabb_tree_over_indexed_triangle_set(result.enforcers.vertices, result.enforcers.indices); result.blockers_tree = AABBTreeIndirect::build_aabb_tree_over_indexed_triangle_set(result.blockers.vertices, result.blockers.indices); + result.enforcer_contour.tree = AABBTreeLines::build_aabb_tree_over_indexed_lines(result.enforcer_contour.edges); + result.blocker_contour.tree = AABBTreeLines::build_aabb_tree_over_indexed_lines(result.blocker_contour.edges); BOOST_LOG_TRIVIAL(debug) << "SeamPlacer: build AABB trees for raycasting enforcers/blockers: end"; @@ -1047,6 +1382,21 @@ void pick_random_seam_point(const std::vector &perimeter_points, }; std::vector viables; + const auto edge_from = [&](size_t index) -> Vec3f { + const size_t next = index == end_index - 1 ? start_index : index + 1; + // The exact green endpoint is Enforced, but its outgoing edge leaves the permitted painted run. + if (perimeter_points[index].perimeter.exact_enforced_ends && + perimeter_points[index].type == EnforcedBlockedSeamPoint::Enforced && + perimeter_points[next].type != EnforcedBlockedSeamPoint::Enforced) + return Vec3f::Zero(); + // Random samples the outgoing edge, not just the candidate; do not sample toward a closed red boundary. + if (perimeter_points[index].perimeter.exact_blocked_ends && + perimeter_points[index].type != EnforcedBlockedSeamPoint::Blocked && + perimeter_points[next].type == EnforcedBlockedSeamPoint::Blocked) + return Vec3f::Zero(); + return perimeter_points[next].position - perimeter_points[index].position; + }; + const Vec3f pseudornd_seed = perimeter_points[viable_example_index].position; float rand = std::abs(sin(pseudornd_seed.dot(Vec3f(12.9898f,78.233f, 133.3333f))) * 43758.5453f); rand = rand - (int) rand; @@ -1054,8 +1404,7 @@ void pick_random_seam_point(const std::vector &perimeter_points, for (size_t index = start_index; index < end_index; ++index) { if (comparator.are_similar(perimeter_points[index], perimeter_points[viable_example_index])) { // index ok, push info into viables - Vec3f edge_to_next { perimeter_points[index == end_index - 1 ? start_index : index + 1].position - - perimeter_points[index].position }; + Vec3f edge_to_next = edge_from(index); float dist_to_next = edge_to_next.norm(); viables.push_back( { index, dist_to_next, edge_to_next }); } else if (comparator.is_first_not_much_worse(perimeter_points[viable_example_index], @@ -1067,8 +1416,7 @@ void pick_random_seam_point(const std::vector &perimeter_points, viable_example_index = index; viables.clear(); - Vec3f edge_to_next = (perimeter_points[index == end_index - 1 ? start_index : index + 1].position - - perimeter_points[index].position); + Vec3f edge_to_next = edge_from(index); float dist_to_next = edge_to_next.norm(); viables.push_back( { index, dist_to_next, edge_to_next }); } @@ -1081,18 +1429,204 @@ void pick_random_seam_point(const std::vector &perimeter_points, float picked_len = len_sum * rand; size_t point_idx = 0; - while (picked_len - viables[point_idx].edge_length > 0) { + // Float accumulation can leave a positive residual after the final edge, including a zero-length edge. + while (point_idx + 1 < viables.size() && picked_len - viables[point_idx].edge_length > 0) { picked_len = picked_len - viables[point_idx].edge_length; point_idx++; } + picked_len = std::clamp(picked_len, 0.0f, viables[point_idx].edge_length); Perimeter &perimeter = perimeter_points[start_index].perimeter; perimeter.seam_index = viables[point_idx].index; perimeter.final_seam_position = perimeter_points[perimeter.seam_index].position - + viables[point_idx].edge.normalized() * picked_len; + + (viables[point_idx].edge_length > 0.f ? + Vec3f(viables[point_idx].edge.normalized() * picked_len) : Vec3f::Zero()); perimeter.finalized = true; } +// Seam alignment on the loop, see docs/HLSD/seam-alignment.md. +// A painted seam keeps its pull (t >= 0.4) toward the discrete candidate only near a measured corner; +// on a smooth contour that pull makes the seam jump between candidates from layer to layer. +constexpr float enforced_corner_angle_min = 15.0f * float(PI) / 180.0f; +constexpr float enforced_corner_angle_max = 30.0f * float(PI) / 180.0f; +// The corner influence fades out along the perimeter between R0 and this multiple of R0. +constexpr float enforced_corner_fade_factor = 2.0f; + +float smoothstep01(float x) { + x = std::clamp(x, 0.0f, 1.0f); + return x * x * (3.0f - 2.0f * x); +} + +// Strength in [0, 1] of the measured corners around the candidate: a corner of at least +// enforced_corner_angle_max within `protect` along the perimeter counts fully, then fades out by `fade_end`. +float enforced_corner_influence(const std::vector &points, size_t index, float protect, float fade_end) { + const Perimeter &perimeter = points[index].perimeter; + const size_t start = perimeter.start_index; + const size_t count = perimeter.end_index - start; + const auto contribution = [&](size_t i, float distance) { + const float corner = smoothstep01((std::abs(points[i].local_ccw_angle) - enforced_corner_angle_min) / + (enforced_corner_angle_max - enforced_corner_angle_min)); + const float weight = distance <= protect ? 1.0f : 1.0f - smoothstep01((distance - protect) / (fade_end - protect)); + return corner * weight; + }; + float influence = contribution(index, 0.0f); + for (const bool forward : { false, true }) { + size_t i = index; + float distance = 0.0f; + // At most count - 1 steps per direction, so short loops and zero-length edges terminate. + for (size_t step = 1; step < count && influence < 1.0f; ++step) { + const size_t j = start + (forward ? next_idx_modulo(i - start, count) : prev_idx_modulo(i - start, count)); + distance += (points[j].position - points[i].position).head<2>().norm(); + if (distance >= fade_end) + break; + influence = std::max(influence, contribution(j, distance)); + i = j; + } + } + return influence; +} + +// Unit normal of the edge from a to b, zero for a zero-length edge. +Vec2d edge_normal(const Vec2d &a, const Vec2d &b) { + const Vec2d d = b - a; + const double length = d.norm(); + return length > 0.0 ? Vec2d(-d.y() / length, d.x() / length) : Vec2d::Zero(); +} + +// Seam position on the loop for a `target`: the closest loop point to it whose normal passes through it, +// or, if that lies outside the arc allowed around the candidate at `index`, the arc end closer to that point. +Vec3f place_on_loop(const std::vector &points, size_t index, const Vec3f &target) { + const Perimeter &perimeter = points[index].perimeter; + const size_t start = perimeter.start_index; + const size_t count = perimeter.end_index - start; + if (count < 2) + return points[index].position; + const auto next = [&](size_t i) { return start + next_idx_modulo(i - start, count); }; + const auto prev = [&](size_t i) { return start + prev_idx_modulo(i - start, count); }; + const auto xy = [&](size_t i) { return Vec2d(points[i].position.head<2>().cast()); }; + // Nearest neighbor at a different position, so that duplicated points share one normal. + const auto distinct = [&](size_t i, bool forward) { + size_t j = i; + for (size_t step = 1; step < count; ++step) { + j = forward ? next(j) : prev(j); + if (xy(j) != xy(i)) + return j; + } + return i; + }; + const auto vertex_normal = [&](size_t i) { + const Vec2d sum = edge_normal(xy(distinct(i, false)), xy(i)) + edge_normal(xy(i), xy(distinct(i, true))); + return sum.squaredNorm() > 0.0 ? Vec2d(sum.normalized()) : Vec2d::Zero(); + }; + const auto cross = [](const Vec2d &a, const Vec2d &b) { return a.x() * b.y() - a.y() * b.x(); }; + + // Allowed arc on one side: the Enforced run for an Enforced candidate, plus the oversampling distance unless + // the run ends exactly at the paint; up to a Blocked candidate otherwise. Returns its length and end point; + // infinite length if unlimited. + const bool enforced = points[index].type == EnforcedBlockedSeamPoint::Enforced; + const bool blocked = points[index].type == EnforcedBlockedSeamPoint::Blocked; + const auto allowed_arc = [&](bool forward) { + double arc = 0.0; + double extension = enforced && !perimeter.exact_enforced_ends ? SeamPlacer::enforcer_oversampling_distance : 0.0; + bool in_run = true; + size_t i = index; + // All count edges, the closing one back to the candidate included, before the arc is unlimited. + for (size_t visited = 1; visited <= count; ++visited) { + const size_t j = forward ? next(i) : prev(i); + const EnforcedBlockedSeamPoint type = points[j].type; + if (in_run && (enforced ? type != EnforcedBlockedSeamPoint::Enforced : + !blocked && type == EnforcedBlockedSeamPoint::Blocked)) + in_run = false; + if (!in_run && (!enforced || type == EnforcedBlockedSeamPoint::Blocked)) + return std::make_pair(arc, xy(i)); // Only an Enforced run is extended, and never into a Blocked candidate. + const double length = (xy(j) - xy(i)).norm(); + if (!in_run) { + const double reach = std::min(length, extension); + extension -= reach; + if (reach < length) + return std::make_pair(arc + reach, Vec2d(xy(i) + (reach / length) * (xy(j) - xy(i)))); + } + arc += length; + i = j; + } + return std::make_pair(std::numeric_limits::infinity(), xy(index)); + }; + + // Closest solution over the whole loop, walking outward on the shorter side first so that solutions near + // the candidate prune the edges farther from the target than them. + const Vec2d p = target.head<2>().cast(); + std::optional best; + double best_distance = std::numeric_limits::infinity(); + bool best_forward = true; + double best_arc = 0.0; + double arc[2] = { 0.0, 0.0 }; // Walked arc behind and ahead of the candidate. + size_t cursor[2] = { index, index }; + for (size_t visited = 0; visited < count; ++visited) { + const bool forward = arc[1] <= arc[0]; + const size_t i = cursor[forward]; + const size_t j = forward ? next(i) : prev(i); + // The edge in index order; P(u) = xy(a) + u * d. + const size_t a = forward ? i : j; + const size_t b = forward ? j : i; + const Vec2d d = xy(b) - xy(a); + const double length = d.norm(); + const Vec2d g = p - xy(a); + const double u_closest = length > 0.0 ? std::clamp(g.dot(d) / (length * length), 0.0, 1.0) : 0.0; + if (length > 0.0 && (g - u_closest * d).squaredNorm() < best_distance) { + // Solve cross(p - P(u), N(u)) = 0 with the normal N blended linearly between the vertex normals. + Vec2d na = vertex_normal(a); + Vec2d nb = vertex_normal(b); + if (na.squaredNorm() == 0.0 || nb.squaredNorm() == 0.0) + na = nb = edge_normal(xy(a), xy(b)); + const Vec2d m = nb - na; + const double c0 = cross(g, na); + const double c1 = cross(g, m) - cross(d, na); + const double c2 = -cross(d, m); + const auto consider = [&](double u) { + if (u < 0.0 || u > 1.0) + return; + const double distance = (g - u * d).squaredNorm(); + if (distance < best_distance) { + best = Vec2d(xy(a) + u * d); + best_distance = distance; + best_forward = forward; + best_arc = arc[forward] + (forward ? u : 1.0 - u) * length; + } + }; + // Absolute threshold on the coefficients (mm), only to tell the degenerate equations apart. + constexpr double eps = 1e-12; + if (std::abs(c2) < eps && std::abs(c1) < eps) { + if (std::abs(c0) < eps) + consider(u_closest); // Every point is a solution. + } else if (std::abs(c2) < eps) { + consider(-c0 / c1); + } else { + const double discriminant = c1 * c1 - 4.0 * c2 * c0; + if (discriminant >= 0.0) { + const double root = std::sqrt(discriminant); + consider((-c1 - root) / (2.0 * c2)); + consider((-c1 + root) / (2.0 * c2)); + } + } + } + arc[forward] += length; + cursor[forward] = j; + } + if (!best) + return points[index].position; + + // A solution outside the allowed arc gives way to the arc end closer to it, so that a solution leaving + // the arc stays at the end it left through. + Vec2d result = *best; + const double loop_length = arc[0] + arc[1]; + const double ahead = best_forward ? best_arc : loop_length - best_arc; + const auto [ahead_limit, ahead_end] = allowed_arc(true); + const auto [behind_limit, behind_end] = allowed_arc(false); + if (ahead > ahead_limit && loop_length - ahead > behind_limit) + result = (ahead_end - *best).squaredNorm() <= (behind_end - *best).squaredNorm() ? ahead_end : behind_end; + return to_3d(Vec2f(result.cast()), points[index].position.z()); +} + } // namespace SeamPlacerImpl // Parallel process and extract each perimeter polygon of the given print object. @@ -1112,14 +1646,15 @@ void SeamPlacer::gather_seam_candidates(const PrintObject *po, const SeamPlacerI const Layer *layer = po->get_layer(layer_idx); auto unscaled_z = layer->slice_z; std::vector regions; + std::vector> boundary_types; //NOTE corresponding region ptr may be null, if the layer has zero perimeters const bool has_precise_seam_modifiers = !global_model_info.precise_seam_strong_volumes.empty() || !global_model_info.precise_seam_weak_volumes.empty(); - Polygons polygons = extract_perimeter_polygons(layer, regions, has_precise_seam_modifiers); + Polygons polygons = extract_perimeter_polygons(layer, regions, boundary_types, has_precise_seam_modifiers); for (size_t poly_index = 0; poly_index < polygons.size(); ++poly_index) { process_perimeter_polygon(polygons[poly_index], unscaled_z, regions[poly_index], global_model_info, layer_seams, - warnings); + warnings, boundary_types[poly_index]); } auto functor = SeamCandidateCoordinateFunctor { layer_seams.points }; seam_data.layers[layer_idx].points_tree = @@ -1205,23 +1740,40 @@ std::optional> SeamPlacer::find_next_seam_in_layer( const std::vector &layers, const Vec3f &projected_position, const size_t layer_idx, const float max_distance, - const SeamPlacerImpl::SeamComparator &comparator) const { + const SeamPlacerImpl::SeamComparator &comparator, + const SeamContour::Resolver *contours, + std::pair previous) const { using namespace SeamPlacerImpl; - std::vector nearby_points_indices = find_nearby_points(*layers[layer_idx].points_tree, projected_position, - max_distance); - - if (nearby_points_indices.empty()) { - return {}; + // Contours of the geometric continuation. Empty when there is no geometric match, which preserves the legacy radius + // search; occupancy never expands a known set. + std::vector continuation; + if (contours) { + const Perimeter &source = layers[previous.first].points[previous.second].perimeter; + const int direction = layer_idx > previous.first ? 1 : -1; + continuation = contours->resolve(previous.first, source.contour_index, + previous.second - source.start_index, direction, max_distance).contours; } - size_t best_nearby_point_index = nearby_points_indices[0]; - size_t nearest_point_index = nearby_points_indices[0]; - - // Now find best nearby point, nearest point, and corresponding indices - for (const size_t &nearby_point_index : nearby_points_indices) { + // Find the best nearby point and the nearest one. A layer of a fine relief has tens of thousands of candidates within + // the radius, so they are looked at as the search finds them rather than collected into a vector first. + constexpr size_t none = std::numeric_limits::max(); + size_t best_nearby_point_index = none; + size_t nearest_point_index = none; + visit_nearby_points(*layers[layer_idx].points_tree, projected_position, max_distance, + [&layers, &comparator, &projected_position, &continuation, layer_idx, &best_nearby_point_index, + &nearest_point_index](size_t nearby_point_index) { + // Points off the continuation are skipped before the first point is taken, as they were removed before the scan. + if (!continuation.empty() && + std::find(continuation.begin(), continuation.end(), + layers[layer_idx].points[nearby_point_index].perimeter.contour_index) == continuation.end()) + return; + if (best_nearby_point_index == none) { + // The first point found starts both, as the first of the collected ones did. + best_nearby_point_index = nearest_point_index = nearby_point_index; + } const SeamCandidate &point = layers[layer_idx].points[nearby_point_index]; if (point.perimeter.finalized) { - continue; // skip over finalized perimeters, try to find some that is not finalized + return; // skip over finalized perimeters, try to find some that is not finalized } if (comparator.is_first_better(point, layers[layer_idx].points[best_nearby_point_index], projected_position.head<2>()) @@ -1233,6 +1785,10 @@ std::optional> SeamPlacer::find_next_seam_in_layer( || layers[layer_idx].points[nearest_point_index].perimeter.finalized) { nearest_point_index = nearby_point_index; } + }); + + if (best_nearby_point_index == none) { + return {}; } const SeamCandidate &best_nearby_point = layers[layer_idx].points[best_nearby_point_index]; @@ -1266,7 +1822,8 @@ std::optional> SeamPlacer::find_next_seam_in_layer( } std::vector> SeamPlacer::find_seam_string(const PrintObject *po, - std::pair start_seam, const SeamPlacerImpl::SeamComparator &comparator) const { + std::pair start_seam, const SeamPlacerImpl::SeamComparator &comparator, + const SeamContour::Resolver *contours) const { const std::vector &layers = m_seam_per_object.find(po)->second.layers; int layer_idx = start_seam.first; @@ -1297,7 +1854,7 @@ std::vector> SeamPlacer::find_seam_string(const PrintO std::optional> maybe_next_seam = find_next_seam_in_layer(layers, projected_position, next_layer, - max_distance, comparator); + max_distance, comparator, contours, prev_point_index); if (maybe_next_seam.has_value()) { // For old macOS (pre 10.14), std::optional does not have .value() method, so the code is using operator*() instead. @@ -1306,10 +1863,9 @@ std::vector> SeamPlacer::find_seam_string(const PrintO //String added, prev_point_index updated } else { if (step == 1) { + // Continue right below the start seam; stepping now would skip that layer. reverse_lookup_direction(); - if (next_layer < 0) { - break; - } + continue; } else { break; } @@ -1323,8 +1879,9 @@ std::vector> SeamPlacer::find_seam_string(const PrintO // aligns the strings via polynomial fit // Does not change the positions of the SeamCandidates themselves, instead stores // the new aligned position into the shared Perimeter structure of each perimeter -// Note that this position does not necesarilly lay on the perimeter. -void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl::SeamComparator &comparator) { +// This position lies on the perimeter polygon; placement on the printed loop may still move it. +void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl::SeamComparator &comparator, + const std::function &throw_if_canceled) { using namespace SeamPlacerImpl; // Prepares Debug files for writing. @@ -1348,6 +1905,29 @@ void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl:: //gather vector of all seams on the print_object - pair of layer_index and seam__index within that layer const std::vector &layers = m_seam_per_object[po].layers; + // Share the largest nozzle diameter between contour bounds and corner protection. + double max_nozzle_diameter = 0.0; + for (double diameter : po->print()->config().nozzle_diameter.values) + max_nozzle_diameter = std::max(max_nozzle_diameter, diameter); + // Reuse immutable contour geometry across all alternative string starts. + std::unique_ptr contour_resolver; + { + SeamContour::Layers geometry(layers.size()); + for (size_t i = 0; i < layers.size(); ++i) { + throw_if_canceled(); // Geometry copies on dense multi-island objects must remain interruptible. + for (const Perimeter &perimeter : layers[i].perimeters) { + SeamContour::Contour contour; + contour.hole = perimeter.is_hole; + contour.reliable = perimeter.contour_reliable; + contour.width = perimeter.flow_width; + contour.nozzle = max_nozzle_diameter; + for (size_t j = perimeter.start_index; j < perimeter.end_index; ++j) + contour.points.push_back(layers[i].points[j].position.head<2>().cast()); + geometry[i].push_back(std::move(contour)); + } + } + contour_resolver = std::make_unique(std::move(geometry), SeamContour::Options{}, throw_if_canceled); + } std::vector> seams; for (size_t layer_idx = 0; layer_idx < layers.size(); ++layer_idx) { const std::vector &layer_perimeter_points = layers[layer_idx].points; @@ -1377,6 +1957,7 @@ void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl:: int global_index = 0; while (global_index < int(seams.size())) { + throw_if_canceled(); size_t layer_idx = seams[global_index].first; size_t seam_index = seams[global_index].second; global_index++; @@ -1385,14 +1966,16 @@ void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl:: // This perimeter is already aligned, skip seam continue; } else { - seam_string = this->find_seam_string(po, { layer_idx, seam_index }, comparator); + seam_string = this->find_seam_string(po, { layer_idx, seam_index }, comparator, contour_resolver.get()); size_t step_size = 1 + seam_string.size() / 20; for (size_t alternative_start = 0; alternative_start < seam_string.size(); alternative_start += step_size) { + throw_if_canceled(); size_t start_layer_idx = seam_string[alternative_start].first; size_t seam_idx = layers[start_layer_idx].points[seam_string[alternative_start].second].perimeter.seam_index; alternative_seam_string = this->find_seam_string(po, - std::pair(start_layer_idx, seam_idx), comparator); + std::pair(start_layer_idx, seam_idx), comparator, + contour_resolver.get()); if (alternative_seam_string.size() > seam_string.size()) { seam_string = std::move(alternative_seam_string); } @@ -1464,17 +2047,32 @@ void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl:: // Perimeter structure of the point; also set flag aligned to true for (size_t index = 0; index < seam_string.size(); ++index) { const auto &pair = seam_string[index]; - float t = std::min(1.0f, std::pow(std::abs(layers[pair.first].points[pair.second].local_ccw_angle) + const std::vector &points = layers[pair.first].points; + const SeamCandidate &candidate = points[pair.second]; + float t = std::min(1.0f, std::pow(std::abs(candidate.local_ccw_angle) / SeamPlacer::sharp_angle_snapping_threshold, 3.0f)); - if (layers[pair.first].points[pair.second].type == EnforcedBlockedSeamPoint::Enforced){ - t = std::max(0.4f, t); - } - Vec3f current_pos = layers[pair.first].points[pair.second].position; + Vec3f current_pos = candidate.position; Vec2f fitted_pos = curve.get_fitted_value(current_pos.z()); //interpolate between current and fitted position, prefer current pos for large weights. - Vec3f final_position = t * current_pos + (1.0f - t) * to_3d(fitted_pos, current_pos.z()); + Vec3f final_position; + if (candidate.type != EnforcedBlockedSeamPoint::Enforced) { + final_position = t >= 1.0f ? current_pos : + place_on_loop(points, pair.second, t * current_pos + (1.0f - t) * to_3d(fitted_pos, current_pos.z())); + } else if (t >= 1.0f) { + final_position = current_pos; + } else { + // Keep the 0.4 pull toward the candidate near a measured corner only, then keep the seam on the paint. + float protect = std::max(candidate.perimeter.flow_width, float(max_nozzle_diameter)); + if (protect <= 0.0f) + protect = 0.5f; + const float corner = std::abs(candidate.local_ccw_angle) >= enforced_corner_angle_max ? + 1.0f : enforced_corner_influence(points, pair.second, protect, enforced_corner_fade_factor * protect); + t = std::max(t, 0.4f * corner); + final_position = place_on_loop(points, pair.second, + t * current_pos + (1.0f - t) * to_3d(fitted_pos, current_pos.z())); + } Perimeter &perimeter = layers[pair.first].points[pair.second].perimeter; perimeter.seam_index = pair.second; @@ -1599,7 +2197,7 @@ void SeamPlacer::init(const Print &print, std::function throw_if_can if (configured_seam_preference == spAligned || configured_seam_preference == spRear || configured_seam_preference == spAlignedBack) { BOOST_LOG_TRIVIAL(debug) << "SeamPlacer: align_seam_points : start"; - align_seam_points(po, comparator); + align_seam_points(po, comparator, throw_if_canceled_func); BOOST_LOG_TRIVIAL(debug) << "SeamPlacer: align_seam_points : end"; } diff --git a/src/libslic3r/GCode/SeamPlacer.hpp b/src/libslic3r/GCode/SeamPlacer.hpp index 1c989cf155..779e333374 100644 --- a/src/libslic3r/GCode/SeamPlacer.hpp +++ b/src/libslic3r/GCode/SeamPlacer.hpp @@ -19,6 +19,7 @@ namespace Slic3r { class PrintObject; +namespace SeamContour { class Resolver; } namespace PreciseSeam { struct PreciseSeamWarnings; } class ExtrusionLoop; class Print; @@ -42,14 +43,21 @@ enum class EnforcedBlockedSeamPoint { // struct representing single perimeter loop struct Perimeter { + bool is_hole = false; // Preserve boundary type before candidate polygons become CCW. + bool contour_reliable = false; // Open paths must retain the legacy continuation search. + size_t contour_index = 0; size_t start_index{}; size_t end_index{}; //exclusive (one-past-the-end) size_t seam_index{}; float flow_width{}; + // Enforced candidates span the painted ranges exactly, their ends included, instead of reaching flow_width + // around the paint. + bool exact_enforced_ends = false; + // Red paint is reconstructed on the contour; its edge samples remain Blocked. + bool exact_blocked_ends = false; - // During alignment, a final position may be stored here. In that case, finalized is set to true. - // Note that final seam position is not limited to points of the perimeter loop. In theory it can be any position - // Random position also uses this flexibility to set final seam point position + // Alignment and Random may store a final position here, then set finalized. It lies on the perimeter polygon, + // though not necessarily at a candidate point. bool finalized = false; Vec3f final_seam_position = Vec3f::Zero(); @@ -91,6 +99,10 @@ struct SeamCandidateCoordinateFunctor { return seam_candidates[index].position[dim]; } }; + +// Seam alignment helpers, declared here for the tests. +float enforced_corner_influence(const std::vector &points, size_t index, float protect, float fade_end); +Vec3f place_on_loop(const std::vector &points, size_t index, const Vec3f &target); } // namespace SeamPlacerImpl struct PrintObjectSeamData @@ -165,15 +177,19 @@ private: void calculate_candidates_visibility(const PrintObject *po, const SeamPlacerImpl::GlobalModelInfo &global_model_info); void calculate_overhangs_and_layer_embedding(const PrintObject *po); - void align_seam_points(const PrintObject *po, const SeamPlacerImpl::SeamComparator &comparator); + void align_seam_points(const PrintObject *po, const SeamPlacerImpl::SeamComparator &comparator, + const std::function &throw_if_canceled); std::vector> find_seam_string(const PrintObject *po, std::pair start_seam, - const SeamPlacerImpl::SeamComparator &comparator) const; + const SeamPlacerImpl::SeamComparator &comparator, + const SeamContour::Resolver *contours = nullptr) const; std::optional> find_next_seam_in_layer( const std::vector &layers, const Vec3f& projected_position, const size_t layer_idx, const float max_distance, - const SeamPlacerImpl::SeamComparator &comparator) const; + const SeamPlacerImpl::SeamComparator &comparator, + const SeamContour::Resolver *contours = nullptr, + std::pair previous = {}) const; }; } // namespace Slic3r diff --git a/src/libslic3r/GCode/TimelapsePosPicker.cpp b/src/libslic3r/GCode/TimelapsePosPicker.cpp index 84b6677b94..2c18895d9a 100644 --- a/src/libslic3r/GCode/TimelapsePosPicker.cpp +++ b/src/libslic3r/GCode/TimelapsePosPicker.cpp @@ -98,9 +98,10 @@ namespace Slic3r { m_plate_height = unscale_(bed_bbox.max.y()); m_plate_width = unscale_(bed_bbox.max.x()); - Polygon bed_exclude_area; - for (size_t idx = 0; idx < config.bed_exclude_area.values.size(); ++idx) - bed_exclude_area.points.emplace_back(coord_t(scale_(config.bed_exclude_area.values[idx].x())), coord_t(scale_(config.bed_exclude_area.values[idx].y()))); + // Timelapse positions are selected in the bed plane. Use the resolved + // bed-level footprints instead of the legacy flat point array, which + // cannot represent multiple or per-nozzle exclusion polygons. + const Polygons bed_exclude_areas = get_bed_excluded_area(config); Point base_wp_pt = print->get_fake_wipe_tower().pos.cast(); base_wp_pt = Point{ scale_(base_wp_pt.x()),scale_(base_wp_pt.y()) }; @@ -120,7 +121,7 @@ namespace Slic3r { wipe_tower_area = expand_object_projection(wipe_tower_area, m_print_seq == PrintSequence::ByObject); for (size_t idx = 0; idx < extruder_count; ++idx) { - ExPolygons printable_area = diff_ex(diff(m_bed_polygon, bed_exclude_area), { wipe_tower_area }); + ExPolygons printable_area = diff_ex(diff(Polygons{ m_bed_polygon }, bed_exclude_areas), { wipe_tower_area }); if (idx < config.extruder_printable_area.size()) { Polygon extruder_printable_area; for (size_t j = 0; j < config.extruder_printable_area.values[idx].size(); ++j) @@ -681,4 +682,4 @@ namespace Slic3r { return true; } -} \ No newline at end of file +} diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 2ea34aef90..64b2151221 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -140,6 +140,29 @@ unsigned int LayerTools::internal_solid_filament_id(const PrintRegion ®ion) c return resolve_mixed(result); } +// 1 based filament of an island's extrusions; the tool ordering and the G-code export must agree on it. +static unsigned int region_filament(const ExtrusionEntityCollection &extrusions, const PrintRegionConfig &config) +{ + if (extrusions.has_infill()) { + if (!extrusions.has_solid_infill()) + return config.sparse_infill_filament_id.value; + // Orca: Gap fill takes the filament of the surface it fills. + ExtrusionRole role = erNone; + for (const ExtrusionEntity *ee : extrusions.entities) + if (const ExtrusionRole er = ee->role(); er != erGapFill) + role = (role == erNone || role == er) ? er : erMixed; + if (role == erTopSolidInfill || role == erIroning) + return config.top_surface_filament_id.value; + if (role == erBottomSurface) + return config.bottom_surface_filament_id.value; + return config.internal_solid_filament_id.value; + } + // Walls, and the gap fill between them. + const ExtrusionEntitiesPtr &walls = extrusions.entities; + return !walls.empty() && std::all_of(walls.begin(), walls.end(), [](const ExtrusionEntity *ee) { return is_inner_wall(*ee); }) ? + config.inner_wall_filament_id.value : config.outer_wall_filament_id.value; +} + // Returns a zero based extruder this eec should be printed with, according to PrintRegion config or extruder_override if overriden. unsigned int LayerTools::extruder(const ExtrusionEntityCollection &extrusions, const PrintRegion ®ion) const { @@ -149,30 +172,7 @@ unsigned int LayerTools::extruder(const ExtrusionEntityCollection &extrusions, c assert(region.config().top_surface_filament_id.value > 0); assert(region.config().bottom_surface_filament_id.value > 0); // 1 based extruder ID. - unsigned int extruder = 1; - if (this->extruder_override == 0) { - if (extrusions.has_infill()) { - if (extrusions.has_solid_infill()) { - ExtrusionRole role = extrusions.role(); - if (role == erTopSolidInfill || role == erIroning) - extruder = region.config().top_surface_filament_id; - else if (role == erBottomSurface) - extruder = region.config().bottom_surface_filament_id; - else - extruder = region.config().internal_solid_filament_id; - } else { - extruder = region.config().sparse_infill_filament_id; - } - } else { - const ExtrusionRole role = extrusions.role(); - if (role == erPerimeter) - extruder = region.config().inner_wall_filament_id.value; - else - extruder = region.config().outer_wall_filament_id.value; - } - } else - extruder = this->extruder_override; - + const unsigned int extruder = this->extruder_override == 0 ? region_filament(extrusions, region.config()) : this->extruder_override; unsigned int result = (extruder == 0) ? 0 : extruder - 1; return resolve_mixed(result); } @@ -855,7 +855,12 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto if (something_nonoverriddable){ layer_tools.extruders.emplace_back((extruder_override == 0) ? region.config().outer_wall_filament_id.value : extruder_override); - if (extruder_override == 0 && region.config().wall_loops.value > 1) + const ExtrusionEntitiesPtr &islands = layerm->perimeters.entities; + const bool has_inner_wall = std::any_of(islands.begin(), islands.end(), [](const ExtrusionEntity *island) { + const ExtrusionEntitiesPtr &walls = static_cast(island)->entities; + return std::any_of(walls.begin(), walls.end(), [](const ExtrusionEntity *ee) { return is_inner_wall(*ee); }); + }); + if (extruder_override == 0 && region.config().wall_loops.value > 1 && has_inner_wall) layer_tools.extruders.emplace_back(region.config().inner_wall_filament_id.value); if (layerCount == 0) { firstLayerExtruders.emplace_back((extruder_override == 0) ? region.config().outer_wall_filament_id.value : extruder_override); @@ -865,23 +870,13 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto layer_tools.has_object = true; } - bool has_infill = false; - bool has_internal_solid = false; - bool has_top_solid_surface = false; - bool has_bottom_surface = false; + std::vector fill_filaments; bool something_nonoverriddable = false; for (const ExtrusionEntity *ee : layerm->fills.entities) { // fill represents infill extrusions of a single island. const auto *fill = dynamic_cast(ee); - ExtrusionRole role = fill->entities.empty() ? erNone : fill->entities.front()->role(); - if (role == erTopSolidInfill || role == erIroning) - has_top_solid_surface = true; - else if (role == erBottomSurface) - has_bottom_surface = true; - else if (is_solid_infill(role)) - has_internal_solid = true; - else if (role != erNone) - has_infill = true; + if (! fill->entities.empty()) + fill_filaments.emplace_back(region_filament(*fill, region.config())); if (m_print_config_ptr) { if (! layer_tools.wiping_extrusions().is_overriddable_and_mark(*fill, *m_print_config_ptr, object, region)) @@ -890,19 +885,12 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto } if (something_nonoverriddable || !m_print_config_ptr) { - if (extruder_override == 0) { - if (has_internal_solid) - layer_tools.extruders.emplace_back(region.config().internal_solid_filament_id); - if (has_top_solid_surface) - layer_tools.extruders.emplace_back(region.config().top_surface_filament_id); - if (has_bottom_surface) - layer_tools.extruders.emplace_back(region.config().bottom_surface_filament_id); - if (has_infill) - layer_tools.extruders.emplace_back(region.config().sparse_infill_filament_id); - } else if (has_internal_solid || has_top_solid_surface || has_bottom_surface || has_infill) + if (extruder_override == 0) + append(layer_tools.extruders, fill_filaments); + else if (! fill_filaments.empty()) layer_tools.extruders.emplace_back(extruder_override); } - if (has_internal_solid || has_top_solid_surface || has_bottom_surface || has_infill) + if (! fill_filaments.empty()) layer_tools.has_object = true; } diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index b2ddc75a34..79998a7aa1 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -26,6 +26,7 @@ #include "ClipperUtils.hpp" #include "libslic3r/Line.hpp" #include "LocalesUtils.hpp" +#include "libslic3r/GCodeWriter.hpp" #include "libslic3r/PrintConfig.hpp" #include "libslic3r/Polygon.hpp" #include "libslic3r/Point.hpp" @@ -742,7 +743,7 @@ public: GCodeProcessor::s_IsBBLPrinter = true; // adds tag for analyzer: std::ostringstream str; - str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) << std::to_string(m_layer_height) << "\n"; // don't rely on GCodeAnalyzer knowing the layer height - it knows nothing at priming + str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) << Slic3r::float_to_string_decimal_point(m_layer_height, 6) << "\n"; // don't rely on GCodeAnalyzer knowing the layer height - it knows nothing at priming str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Role) << ExtrusionEntity::role_to_string(erWipeTower) << "\n"; m_gcode += str.str(); change_analyzer_line_width(line_width); @@ -751,7 +752,7 @@ public: WipeTowerWriter& change_analyzer_line_width(float line_width) { // adds tag for analyzer: std::stringstream str; - str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) << std::to_string(line_width) << "\n"; + str << ";" << GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) << Slic3r::float_to_string_decimal_point(line_width, 6) << "\n"; m_gcode += str.str(); return *this; } @@ -1057,11 +1058,11 @@ public: if (i == 1) { // using bridge flow in bridge area, and add notes for gcode-check when flow changed set_extrusion_flow(wipe_tower->extrusion_flow(0.2)); - append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(0.2) + "\n"); + append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(0.2, 6) + "\n"); flow_changed = true; } else if (i == 2 && flow_changed) { set_extrusion_flow(wipe_tower->get_extrusion_flow()); - append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n"); + append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(m_layer_height, 6) + "\n"); } } extrude(corners[i], f); @@ -1073,7 +1074,7 @@ public: bool need_change_flow = wipe_tower->need_thick_bridge_flow(p0.y()); if (need_change_flow) { set_extrusion_flow(wipe_tower->extrusion_flow(0.2)); - append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(0.2) + "\n"); + append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(0.2, 6) + "\n"); } if (abs(x() - p0.x()) > abs(x() - p1.x())) std::swap(p0, p1); travel(p0.x(), y()); @@ -1081,7 +1082,7 @@ public: extrude(p1, f); if (need_change_flow) { set_extrusion_flow(wipe_tower->get_extrusion_flow()); - append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n"); + append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(m_layer_height, 6) + "\n"); } return (*this); } @@ -1528,8 +1529,10 @@ private: gcode << "M204 P" << acceleration; } else if (m_gcode_flavor == gcfKlipper && m_accel_to_decel_enable) { - gcode << "SET_VELOCITY_LIMIT ACCEL_TO_DECEL=" << acceleration * m_accel_to_decel_factor / 100; - gcode << "\nM204 S" << acceleration; + // One line, so Klipper derives the limit from this acceleration rather than the previous one. + std::string limits = "SET_VELOCITY_LIMIT ACCEL=" + std::to_string(acceleration); + GCodeWriter::append_klipper_accel_to_decel(limits, acceleration, m_accel_to_decel_factor); + gcode << limits; } else { // M204: Set default acceleration @@ -2000,7 +2003,7 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi m_flat_ironing(config.prime_tower_flat_ironing.value), m_enable_tower_interface_features(config.enable_tower_interface_features.value), m_physical_extruder_map(config.physical_extruder_map.values), - m_enable_arc_fitting(config.enable_arc_fitting.value) + m_enable_arc_fitting(config.enable_arc_fitting.value == ArcFittingMode::Enabled) // Orca: has_filament_switcher is a device-set dynamic key, not a PrintConfig member; // it is pushed in from Print via set_has_filament_switcher() instead of read here. { @@ -2779,7 +2782,7 @@ void WipeTower::toolchange_Wipe( // BBS: add the note for gcode-check, when the flow changed, the width should follow the change if (is_first_layer()) { - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + std::to_string(m_first_layer_flow_ratio * m_perimeter_width) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + Slic3r::float_to_string_decimal_point(m_first_layer_flow_ratio * m_perimeter_width, 6) + "\n"); } const float& xl = cleaning_box.ld.x(); @@ -2827,7 +2830,7 @@ void WipeTower::toolchange_Wipe( // BBS: check the bridging area and use the bridge flow if (need_change_flow || need_thick_bridge_flow(writer.y())) { writer.set_extrusion_flow(extrusion_flow(0.2)); - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(0.2) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(0.2, 6) + "\n"); need_change_flow = true; } @@ -2839,7 +2842,7 @@ void WipeTower::toolchange_Wipe( // BBS: recover the flow in non-bridging area if (need_change_flow) { writer.set_extrusion_flow(m_extrusion_flow); - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(m_layer_height, 6) + "\n"); } if (!is_from_up && (writer.y() - float(EPSILON) > cleaning_box.lu.y())) @@ -2880,7 +2883,7 @@ void WipeTower::toolchange_Wipe( writer.set_extrusion_flow(m_extrusion_flow); // Reset the extrusion flow. // BBS: add the note for gcode-check when the flow changed if (is_first_layer()) { - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + std::to_string(m_perimeter_width) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + Slic3r::float_to_string_decimal_point(m_perimeter_width, 6) + "\n"); } } @@ -3346,7 +3349,7 @@ WipeTower::ToolChangeResult WipeTower::merge_tcr(ToolChangeResult &first, ToolCh WipeTower::ToolChangeResult out = first; if ((first.end_pos - second.start_pos).norm() > (float)EPSILON) { std::string travel_gcode = "G1 X" + Slic3r::float_to_string_decimal_point(second.start_pos.x(), 3) + " Y" + - Slic3r::float_to_string_decimal_point(second.start_pos.y(), 3) + " F" + std::to_string(m_max_speed) + "\n"; + Slic3r::float_to_string_decimal_point(second.start_pos.y(), 3) + " F" + Slic3r::float_to_string_decimal_point(m_max_speed, 6) + "\n"; bool need_insert_travel = true; if (second.is_tool_change && is_approx(second.start_pos.x(), second.tool_change_start_pos.x()) @@ -3710,7 +3713,7 @@ WipeTower::NozzleChangeResult WipeTower::ramming(int old_filament_id, int new_fi for (int i = 0; true; ++i) { if (need_thick_bridge_flow(writer.pos().y())) { writer.set_extrusion_flow(nozzle_change_extrusion_flow(0.2)); - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(0.2) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(0.2, 6) + "\n"); need_change_flow = true; } if (m_left_to_right) @@ -3722,14 +3725,14 @@ WipeTower::NozzleChangeResult WipeTower::ramming(int old_filament_id, int new_fi if ((writer.y() + dy - cleaning_box.ru.y()+(m_nozzle_change_perimeter_width+m_perimeter_width)/2) > (float)EPSILON) break; if (need_change_flow) { writer.set_extrusion_flow(nozzle_change_extrusion_flow(m_layer_height)); - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(m_layer_height, 6) + "\n"); need_change_flow = false; } writer.extrude(writer.x(), writer.y() + dy, nozzle_change_speed, LimitRamming); m_left_to_right = !m_left_to_right; } if (need_change_flow) { - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(m_layer_height, 6) + "\n"); } writer.set_extrusion_flow(nz_extrusion_flow); @@ -4223,7 +4226,7 @@ void WipeTower::toolchange_wipe_new(WipeTowerWriter &writer, const box_coordinat // BBS: add the note for gcode-check, when the flow changed, the width should follow the change if (is_first_layer()) { - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + std::to_string(m_first_layer_flow_ratio * m_perimeter_width) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + Slic3r::float_to_string_decimal_point(m_first_layer_flow_ratio * m_perimeter_width, 6) + "\n"); } //if (solid_tool_toolchange && m_filpar[m_current_tool].filament_tower_interface_print_temp != m_filpar[m_current_tool].nozzle_temperature) @@ -4326,7 +4329,7 @@ void WipeTower::toolchange_wipe_new(WipeTowerWriter &writer, const box_coordinat // BBS: check the bridging area and use the bridge flow if (need_change_flow) { writer.set_extrusion_flow(extrusion_flow(0.2)); - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(0.2) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(0.2, 6) + "\n"); } float flat_iron_area = m_filpar[m_current_tool].flat_iron_area; float ironing_length = 3.; @@ -4384,7 +4387,7 @@ void WipeTower::toolchange_wipe_new(WipeTowerWriter &writer, const box_coordinat // BBS: recover the flow in non-bridging area if (need_change_flow) { writer.set_extrusion_flow(m_extrusion_flow); - writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n"); + writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + Slic3r::float_to_string_decimal_point(m_layer_height, 6) + "\n"); } if (!is_from_up && (writer.y() + dy - float(EPSILON) >cleaning_box.lu.y() - m_perimeter_width)) @@ -4414,7 +4417,7 @@ void WipeTower::toolchange_wipe_new(WipeTowerWriter &writer, const box_coordinat writer.set_extrusion_flow(m_extrusion_flow); // Reset the extrusion flow. // BBS: add the note for gcode-check when the flow changed - if (is_first_layer()) { writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + std::to_string(m_perimeter_width) + "\n"); } + if (is_first_layer()) { writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + Slic3r::float_to_string_decimal_point(m_perimeter_width, 6) + "\n"); } } WipeTower::WipeTowerBlock * WipeTower::get_block_by_category(int filament_adhesiveness_category, bool create) diff --git a/src/libslic3r/GCode/WipeTower2.cpp b/src/libslic3r/GCode/WipeTower2.cpp index 21556e65ba..83729a72a1 100644 --- a/src/libslic3r/GCode/WipeTower2.cpp +++ b/src/libslic3r/GCode/WipeTower2.cpp @@ -1062,7 +1062,7 @@ WipeTower2::WipeTower2(const PrintConfig& config, const PrintRegionConfig& defau m_perimeter_speed(default_region_config.inner_wall_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool))), m_current_tool(initial_tool), wipe_volumes(wiping_matrix), m_wipe_tower_max_purge_speed(float(config.wipe_tower_max_purge_speed)), - m_enable_arc_fitting(config.enable_arc_fitting), + m_enable_arc_fitting(config.enable_arc_fitting.value == ArcFittingMode::Enabled), m_used_fillet(config.wipe_tower_fillet_wall), m_rib_width(config.wipe_tower_rib_width), m_extra_rib_length(config.wipe_tower_extra_rib_length), diff --git a/src/libslic3r/GCode/WipeTowerEstimate.cpp b/src/libslic3r/GCode/WipeTowerEstimate.cpp index e974f9351f..0be6a4acaa 100644 --- a/src/libslic3r/GCode/WipeTowerEstimate.cpp +++ b/src/libslic3r/GCode/WipeTowerEstimate.cpp @@ -3,15 +3,23 @@ #include "libslic3r/Polygon.hpp" #include "WipeTower.hpp" #include "WipeTower2.hpp" +#include "../ClipperUtils.hpp" #include "../Config.hpp" +#include "../ExPolygon.hpp" +#include "../Geometry/ConvexHull.hpp" +#include "../Line.hpp" #include "../FilamentMixer.hpp" +#include "../Point.hpp" #include "../PrintConfig.hpp" #include "../libslic3r.h" #include #include #include +#include +#include #include +#include #include #include "libslic3r/clonable_ptr.hpp" @@ -236,4 +244,44 @@ WipeTowerFootprint estimate_wipe_tower_footprint(const ConfigBase &config, WipeT return footprint; } +std::optional nearest_clear_wipe_tower_anchor(const BoundingBox &anchor_bounds, const Polygon &footprint, + const Polygons &obstacles, const Point &target) +{ + // The anchors that put the footprint on a convex obstacle form the obstacle grown by the + // reflected footprint. For two convex shapes that Minkowski sum is the hull of the + // differences of their vertices. + const Polygon tower = Geometry::convex_hull(footprint.points); + Polygons blocked; + blocked.reserve(obstacles.size()); + for (const Polygon &obstacle : obstacles) { + Points differences; + differences.reserve(obstacle.size() * tower.size()); + for (const Point &o : obstacle.points) + for (const Point &f : tower.points) + differences.emplace_back(o - f); + blocked.emplace_back(Geometry::convex_hull(std::move(differences))); + } + + // Grown by a hair so bounds pinned to one coordinate on a cramped plate still have an area. + BoundingBox bounds = anchor_bounds; + bounds.offset(SCALED_EPSILON); + const ExPolygons clear = diff_ex(Polygons{ bounds.polygon() }, blocked); + + std::optional nearest; + double nearest_distance = std::numeric_limits::max(); + for (const ExPolygon ®ion : clear) { + if (region.contains(target)) + return target; + for (const Line &edge : to_lines(region)) { + Point closest; + const double distance = edge.distance_to_squared(target, &closest); + if (distance < nearest_distance) { + nearest_distance = distance; + nearest = closest; + } + } + } + return nearest; +} + } // namespace Slic3r diff --git a/src/libslic3r/GCode/WipeTowerEstimate.hpp b/src/libslic3r/GCode/WipeTowerEstimate.hpp index 9dad82f51f..ff20c3a44d 100644 --- a/src/libslic3r/GCode/WipeTowerEstimate.hpp +++ b/src/libslic3r/GCode/WipeTowerEstimate.hpp @@ -1,7 +1,10 @@ #pragma once +#include #include +#include "../BoundingBox.hpp" +#include "../Point.hpp" #include "../Polygon.hpp" namespace Slic3r { @@ -59,4 +62,11 @@ WipeTowerFootprint estimate_wipe_tower_footprint(const ConfigBase // `config` only has to carry the print preset's own keys. bool prime_tower_is_printed(const ConfigBase &config, int used_filaments, int num_objects, bool has_mixed_filament); +// Where to put a tower whose saved position no longer fits: of the anchors (the tower's +// position) inside `anchor_bounds`, the one nearest `target` whose `footprint` touches none of +// the `obstacles`. `footprint` is relative to the anchor, brim included; an obstacle is taken +// as its convex hull. Empty when every anchor in bounds meets an obstacle. All coordinates scaled. +std::optional nearest_clear_wipe_tower_anchor(const BoundingBox &anchor_bounds, const Polygon &footprint, + const Polygons &obstacles, const Point &target); + } // namespace Slic3r diff --git a/src/libslic3r/GCodeReader.cpp b/src/libslic3r/GCodeReader.cpp index eff557d817..1b545f86b5 100644 --- a/src/libslic3r/GCodeReader.cpp +++ b/src/libslic3r/GCodeReader.cpp @@ -95,7 +95,7 @@ const char* GCodeReader::parse_line_internal(const char *ptr, const char *end, G if (pend != c && is_end_of_word(*pend)) { // The axis value has been parsed correctly. if (axis != UNKNOWN_AXIS) - gline.m_axis[int(axis)] = float(v); + gline.m_axis[int(axis)] = v; gline.m_mask |= 1 << int(axis); c = pend; } else diff --git a/src/libslic3r/GCodeReader.hpp b/src/libslic3r/GCodeReader.hpp index e65dff193c..97699a99e1 100644 --- a/src/libslic3r/GCodeReader.hpp +++ b/src/libslic3r/GCodeReader.hpp @@ -35,7 +35,8 @@ public: std::string_view axis_pos(char axis) const; void clear() { m_raw.clear(); } bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; } - float value(Axis axis) const { return m_axis[axis]; } + float value(Axis axis) const { return float(m_axis[axis]); } + double precise_value(Axis axis) const { return m_axis[axis]; } bool has(char axis) const; bool has_value(char axis, float &value) const; // Parse value of an axis from raw string starting at axis_pos. @@ -72,15 +73,15 @@ public: bool has_p() const { return this->has(P); } bool has_unknown_axis() const { return this->has(UNKNOWN_AXIS); } - float x() const { return m_axis[X]; } - float y() const { return m_axis[Y]; } - float z() const { return m_axis[Z]; } - float e() const { return m_axis[E]; } - float f() const { return m_axis[F]; } + float x() const { return float(m_axis[X]); } + float y() const { return float(m_axis[Y]); } + float z() const { return float(m_axis[Z]); } + float e() const { return float(m_axis[E]); } + float f() const { return float(m_axis[F]); } // BBS: add I J P axis - float i() const { return m_axis[I]; } - float j() const { return m_axis[J]; } - float p() const { return m_axis[P]; } + float i() const { return float(m_axis[I]); } + float j() const { return float(m_axis[J]); } + float p() const { return float(m_axis[P]); } static bool cmd_is(const std::string &gcode_line, const char *cmd_test) { const char *cmd = GCodeReader::skip_whitespaces(gcode_line.c_str()); @@ -100,7 +101,7 @@ public: } private: std::string m_raw; - float m_axis[NUM_AXES]; + double m_axis[NUM_AXES]; uint32_t m_mask; friend class GCodeReader; }; diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 62382f8214..4eed23d7d8 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -453,12 +453,11 @@ std::string GCodeWriter::set_acceleration_internal(Acceleration type, unsigned i gcode += separate_travel ? "M204 T" : "M204 P"; gcode += value; } else if (FLAVOR_IS(gcfKlipper)) { - gcode.reserve(96); + gcode.reserve(128); gcode += "SET_VELOCITY_LIMIT ACCEL="; gcode += value; if (this->config.accel_to_decel_enable) { - gcode += " ACCEL_TO_DECEL="; - gcode += float_to_string_decimal_point(acceleration * this->config.accel_to_decel_factor / 100); + append_klipper_accel_to_decel(gcode, acceleration, this->config.accel_to_decel_factor.value); if (GCodeWriter::full_gcode_comment) gcode += " ; adjust ACCEL_TO_DECEL"; } @@ -473,6 +472,14 @@ std::string GCodeWriter::set_acceleration_internal(Acceleration type, unsigned i return gcode; } +void GCodeWriter::append_klipper_accel_to_decel(std::string &gcode, unsigned int acceleration, double accel_to_decel_factor) +{ + gcode += " ACCEL_TO_DECEL="; + gcode += float_to_string_decimal_point(acceleration * accel_to_decel_factor / 100); + gcode += " MINIMUM_CRUISE_RATIO="; + gcode += float_to_string_decimal_point(1. - accel_to_decel_factor / 100); +} + std::string GCodeWriter::set_jerk_xy(double jerk) { if (jerk < 0.01 || is_approx(jerk, m_last_jerk)) @@ -548,15 +555,13 @@ std::string GCodeWriter::set_accel_and_jerk(unsigned int acceleration, double je return std::string(); std::string gcode; - gcode.reserve(96); + gcode.reserve(128); gcode += "SET_VELOCITY_LIMIT"; if (set_acceleration) { gcode += " ACCEL="; gcode += std::to_string(acceleration); - if (this->config.accel_to_decel_enable) { - gcode += " ACCEL_TO_DECEL="; - gcode += float_to_string_decimal_point(acceleration * this->config.accel_to_decel_factor / 100); - } + if (this->config.accel_to_decel_enable) + append_klipper_accel_to_decel(gcode, acceleration, this->config.accel_to_decel_factor.value); m_last_acceleration = acceleration; } if (set_jerk) { @@ -1135,6 +1140,19 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co return out_string; } +std::pair GCodeWriter::planned_travel_z(const Vec3d &point, const bool force_z) const +{ + double destination_z = point.z(); + if (std::abs(m_to_lift) > EPSILON) { + if ((!this->is_current_position_clear() || m_pos != point) && + m_to_lift + m_pos.z() > point.z()) + destination_z = m_to_lift + m_pos.z(); + } else if (!force_z && !this->will_move_z(point.z())) { + destination_z = m_pos.z(); + } + return { m_pos.z(), destination_z }; +} + std::string GCodeWriter::travel_to_z(double z, const std::string &comment, bool force) { /* If target Z is lower than current Z but higher than nominal Z @@ -1197,7 +1215,7 @@ std::string GCodeWriter::_spiral_travel_to_z(double z, const Vec2d &ij_offset, c : this->config.travel_speed.get_at(m_cached_extruder_idx); } - if (!this->config.enable_arc_fitting) { // Orca: if arc fitting is disabled, approximate the arc with small linear segments + if (this->config.enable_arc_fitting.value == ArcFittingMode::Disabled) { // Orca: if arc fitting is disabled, approximate the arc with small linear segments const double z_start = m_pos(2); // starting Z height const double px = m_pos(0) - m_x_offset; // take plate offset into consideration diff --git a/src/libslic3r/GCodeWriter.hpp b/src/libslic3r/GCodeWriter.hpp index 3c90a4e9e1..02562fa651 100644 --- a/src/libslic3r/GCodeWriter.hpp +++ b/src/libslic3r/GCodeWriter.hpp @@ -71,6 +71,10 @@ public: std::string set_jerk_xy(double jerk); // Orca: set acceleration and jerk in one command for Klipper std::string set_accel_and_jerk(unsigned int acceleration, double jerk); + // Orca: Klipper's accel_to_decel limit for `acceleration`, sent as the legacy ACCEL_TO_DECEL and as the + // equivalent MINIMUM_CRUISE_RATIO = 1 - ACCEL_TO_DECEL / ACCEL that replaced it. Klipper before 0.13 and + // vendor forks read only the first, current Klipper only the second, and 0.13 prefers the second. + static void append_klipper_accel_to_decel(std::string &gcode, unsigned int acceleration, double accel_to_decel_factor); std::string set_junction_deviation(double junction_deviation); std::string set_pressure_advance(double pa, int tool = -1) const; std::string set_input_shaping(char axis, float damp, float freq, std::string type) const; @@ -93,6 +97,9 @@ public: double get_current_speed() const { return m_current_speed;} std::string travel_to_xy(const Vec2d &point, const std::string &comment = std::string()); std::string travel_to_xyz(const Vec3d &point, const std::string &comment = std::string(), bool force_z = false); + // Physical Z range which travel_to_xyz() will emit without mutating writer state. + // This includes an existing lift or a pending lazy lift. + std::pair planned_travel_z(const Vec3d &point, bool force_z = false) const; std::string travel_to_z(double z, const std::string &comment = std::string(), bool force = false); bool will_move_z(double z) const; std::string extrude_to_xy(const Vec2d &point, double dE, const std::string &comment = std::string(), bool force_no_extrusion = false); diff --git a/src/libslic3r/KDTreeIndirect.hpp b/src/libslic3r/KDTreeIndirect.hpp index d334a2ad64..3bf3d938e6 100644 --- a/src/libslic3r/KDTreeIndirect.hpp +++ b/src/libslic3r/KDTreeIndirect.hpp @@ -318,6 +318,36 @@ std::vector find_nearby_points(const KDTreeIndirectType &kdtree, const P return visitor.result; } +// Visits the points within max_distance of center, in the order find_nearby_points() would collect them, and hands +// each of them to `visitor_fn` instead of returning them all: a search over a dense set spends more on collecting the +// points into a vector than on the search itself, and its caller usually keeps only a few of them. +template +void visit_nearby_points(const KDTreeIndirectType &kdtree, const PointType ¢er, + const typename KDTreeIndirectType::CoordType &max_distance, VisitorFn visitor_fn) +{ + using CoordType = typename KDTreeIndirectType::CoordType; + + struct Visitor { + const KDTreeIndirectType &kdtree; + const PointType center; + const CoordType max_distance_squared; + VisitorFn visitor_fn; + + unsigned int operator()(size_t idx, size_t dimension) { + auto dist = CoordType(0); + for (size_t i = 0; i < KDTreeIndirectType::NumDimensions; ++i) { + CoordType d = center[i] - kdtree.coordinate(idx, i); + dist += d * d; + } + if (dist < max_distance_squared) + visitor_fn(idx); + return kdtree.descent_mask(center[dimension], max_distance_squared, idx, dimension); + } + } visitor { kdtree, center, max_distance * max_distance, visitor_fn }; + + kdtree.visit(visitor); +} + template std::vector find_nearby_points(const KDTreeIndirectType &kdtree, const PointType ¢er, const typename KDTreeIndirectType::CoordType& max_distance) diff --git a/src/libslic3r/LayOnFace.cpp b/src/libslic3r/LayOnFace.cpp index a66139a17b..f567645eb7 100644 --- a/src/libslic3r/LayOnFace.cpp +++ b/src/libslic3r/LayOnFace.cpp @@ -213,13 +213,29 @@ int find_plane_at_point(const std::vector &planes, const Transfo return -1; } +Transform3d lay_on_face_rotation(const Vec3d &normal, const Transform3d &instance_matrix_no_offset) +{ + // Normal in instance coordinates: a normal transforms by the inverse transpose. + const Vec3d tnormal = (instance_matrix_no_offset.matrix().block(0, 0, 3, 3).inverse().transpose() * normal).normalized(); + const Vec3d down = -Vec3d::UnitZ(); + + // A face already pointing straight up needs a half turn, and every horizontal axis does + // that equally well. setFromTwoVectors() resolves the choice through an SVD whose null + // space is the whole XY plane, so the axis follows rounding noise and the object lands at + // an arbitrary angle in the plate plane. Turn it over about X instead, which keeps the + // footprint the object already had. + if (tnormal.dot(down) < -1. + 1e-9) + return Transform3d(Eigen::AngleAxisd(PI, Vec3d::UnitX())); + + return Transform3d(Eigen::Quaterniond().setFromTwoVectors(tnormal, down)); +} + void lay_on_face(ModelObject &object, size_t instance_idx, const Vec3d &normal) { ModelInstance &instance = *object.instances[instance_idx]; const Geometry::Transformation &trafo = instance.get_transformation(); - // Same rotation as Selection::flattening_rotate(): turn the transformed normal to point down. - const Vec3d tnormal = trafo.get_matrix().matrix().block(0, 0, 3, 3).inverse().transpose() * normal; - const Transform3d rotation = Transform3d(Eigen::Quaterniond().setFromTwoVectors(tnormal, -Vec3d::UnitZ())); + // Same rotation as Selection::flattening_rotate(), which the gizmo uses. + const Transform3d rotation = lay_on_face_rotation(normal, trafo.get_matrix_no_offset()); instance.set_transformation(Geometry::Transformation(trafo.get_offset_matrix() * rotation * trafo.get_matrix_no_offset())); // Drop this instance only: ensure_on_bed() skips instances without auto_drop and measures the first instance. object.translate_instance(instance_idx, -object.instance_bounding_box(instance_idx).min.z() * Vec3d::UnitZ()); diff --git a/src/libslic3r/LayOnFace.hpp b/src/libslic3r/LayOnFace.hpp index 6a9242e5c6..c02c9f6eeb 100644 --- a/src/libslic3r/LayOnFace.hpp +++ b/src/libslic3r/LayOnFace.hpp @@ -46,4 +46,10 @@ int find_plane_at_point(const std::vector &planes, const Transfo // the gizmo applies, then drops the instance so its lowest point is at z = 0. void lay_on_face(ModelObject &object, size_t instance_idx, const Vec3d &normal); +// The rotation that turns `normal` (object coordinates) to point down, given the instance's +// rotation, scale and mirror. A face that already points straight up is turned over about X: +// the axis setFromTwoVectors() picks there is arbitrary, and it lands the object at a random +// angle in the plate plane. +Transform3d lay_on_face_rotation(const Vec3d &normal, const Transform3d &instance_matrix_no_offset); + } // namespace Slic3r diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index 20eff0446f..849b57e4b3 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -380,7 +380,7 @@ void Layer::simplify_support_path(ExtrusionPath * path) { const auto &print_config = this->object()->print()->config(); const bool spiral_mode = print_config.spiral_mode; - const bool enable_arc_fitting = print_config.enable_arc_fitting; + const bool enable_arc_fitting = print_config.enable_arc_fitting.value == ArcFittingMode::Enabled; const auto scaled_resolution = scaled(print_config.resolution.value); if (enable_arc_fitting && @@ -395,7 +395,7 @@ void Layer::simplify_support_multi_path(ExtrusionMultiPath* multipath) { const auto &print_config = this->object()->print()->config(); const bool spiral_mode = print_config.spiral_mode; - const bool enable_arc_fitting = print_config.enable_arc_fitting; + const bool enable_arc_fitting = print_config.enable_arc_fitting.value == ArcFittingMode::Enabled; const auto scaled_resolution = scaled(print_config.resolution.value); for (size_t i = 0; i < multipath->paths.size(); ++i) { @@ -412,7 +412,7 @@ void Layer::simplify_support_loop(ExtrusionLoop* loop) { const auto &print_config = this->object()->print()->config(); const bool spiral_mode = print_config.spiral_mode; - const bool enable_arc_fitting = print_config.enable_arc_fitting; + const bool enable_arc_fitting = print_config.enable_arc_fitting.value == ArcFittingMode::Enabled; const auto scaled_resolution = scaled(print_config.resolution.value); for (size_t i = 0; i < loop->paths.size(); ++i) { @@ -443,8 +443,8 @@ coordf_t Layer::get_sparse_infill_max_void_area() if (density == 0.) return -1; // Orca: the adaptive TPMS infill is as sparse as its interior density. - if (density < 100.f && config.tpms_adaptive != TpmsAdaptiveMode::Disabled && is_tpms_adaptive_pattern(pattern)) - density = std::min(density, std::max(1.f, float(config.tpms_interior_density))); + if (density < 100.f && config.adaptive_infill_mode != AdaptiveInfillMode::Disabled && is_adaptive_infill_pattern(pattern)) + density = std::min(density, std::max(1.f, float(config.adaptive_infill_interior_density))); //BBS: rough estimation and need to be optimized double spacing = flow.scaled_spacing() * (100 - density) / density; diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index c20cebc641..74ef2b7494 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -99,10 +99,11 @@ void LayerRegion::slices_to_fill_surfaces_clipped() by_surface[size_t(surface.surface_type)].emplace_back(&surface); // Trim surfaces by the fill_boundaries. this->fill_surfaces.surfaces.clear(); + const Polygons fill_boundaries = to_polygons(this->fill_expolygons); for (size_t surface_type = 0; surface_type < size_t(stCount); ++ surface_type) { const SurfacesPtr &this_surfaces = by_surface[surface_type]; if (! this_surfaces.empty()) - this->fill_surfaces.append(intersection_ex(this_surfaces, this->fill_expolygons), SurfaceType(surface_type)); + this->fill_surfaces.append(intersection_ex_by_piece(to_expolygons(this_surfaces), fill_boundaries), SurfaceType(surface_type)); } } @@ -1100,16 +1101,13 @@ void LayerRegion::simplify_entity_collection(ExtrusionEntityCollection* entity_c void LayerRegion::simplify_path(ExtrusionPath* path) { const auto &print_config = this->layer()->object()->print()->config(); - const bool spiral_mode = print_config.spiral_mode; - const bool enable_arc_fitting = print_config.enable_arc_fitting; + const ArcFittingMode arc_fitting = print_config.enable_arc_fitting.value; + const bool is_sparse_infill = path->role() == erInternalInfill; const auto scaled_resolution = scaled(print_config.resolution.value); - if (enable_arc_fitting && - !spiral_mode) { - if (path->role() == erInternalInfill) - path->simplify_by_fitting_arc(SCALED_SPARSE_INFILL_RESOLUTION); - else - path->simplify_by_fitting_arc(scaled_resolution); + if (!print_config.spiral_mode && + (arc_fitting == ArcFittingMode::Enabled || (arc_fitting == ArcFittingMode::SparseInfill && is_sparse_infill))) { + path->simplify_by_fitting_arc(is_sparse_infill ? SCALED_SPARSE_INFILL_RESOLUTION : scaled_resolution); } else { path->simplify(scaled_resolution); } @@ -1117,42 +1115,14 @@ void LayerRegion::simplify_path(ExtrusionPath* path) void LayerRegion::simplify_multi_path(ExtrusionMultiPath* multipath) { - const auto &print_config = this->layer()->object()->print()->config(); - const bool spiral_mode = print_config.spiral_mode; - const bool enable_arc_fitting = print_config.enable_arc_fitting; - const auto scaled_resolution = scaled(print_config.resolution.value); - - for (size_t i = 0; i < multipath->paths.size(); ++i) { - if (enable_arc_fitting && - !spiral_mode) { - if (multipath->paths[i].role() == erInternalInfill) - multipath->paths[i].simplify_by_fitting_arc(SCALED_SPARSE_INFILL_RESOLUTION); - else - multipath->paths[i].simplify_by_fitting_arc(scaled_resolution); - } else { - multipath->paths[i].simplify(scaled_resolution); - } - } + for (ExtrusionPath &path : multipath->paths) + this->simplify_path(&path); } void LayerRegion::simplify_loop(ExtrusionLoop* loop) { - const auto &print_config = this->layer()->object()->print()->config(); - const bool spiral_mode = print_config.spiral_mode; - const bool enable_arc_fitting = print_config.enable_arc_fitting; - const auto scaled_resolution = scaled(print_config.resolution.value); - - for (size_t i = 0; i < loop->paths.size(); ++i) { - if (enable_arc_fitting && - !spiral_mode) { - if (loop->paths[i].role() == erInternalInfill) - loop->paths[i].simplify_by_fitting_arc(SCALED_SPARSE_INFILL_RESOLUTION); - else - loop->paths[i].simplify_by_fitting_arc(scaled_resolution); - } else { - loop->paths[i].simplify(scaled_resolution); - } - } + for (ExtrusionPath &path : loop->paths) + this->simplify_path(&path); } } diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index aea1b2be36..c4cff42a64 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -17,6 +17,7 @@ #include "SLA/SupportPoint.hpp" #include "TextureDisplacement.hpp" #include "libslic3r.h" +#include "AABBTreeIndirect.hpp" #include "BuildVolume.hpp" #include "TexturePainting.hpp" #include "Format/AssimpImport.hpp" @@ -29,6 +30,7 @@ #include "TriangleMeshSlicer.hpp" #include "TriangleSelector.hpp" #include "MaterialType.hpp" +#include "Tesselate.hpp" #include "MeshRepair.hpp" #include "Format/AMF.hpp" @@ -39,6 +41,7 @@ #include "FaceDetector.hpp" #include "libslic3r/Geometry/ConvexHull.hpp" +#include "ClipperUtils.hpp" #include #include @@ -61,6 +64,7 @@ #include "SVG.hpp" #include +#include #include #include #include @@ -3241,6 +3245,9 @@ void Model::setPrintSpeedTable(const DynamicPrintConfig& config, const PrintConf //auto print_config = print.config(); //printSpeedMap.bed_poly.points = get_bed_shape(*(wxGetApp().plater()->config())); printSpeedMap.bed_poly.points = get_bed_shape(config); + // Collision volumes are additive to the legacy bed keep-out. Preserve the + // established printable-bed polygon so bed-edge and legacy-area brim + // clipping continue to work when collision volumes are also configured. Pointfs excluse_area_points = print_config.bed_exclude_area.values; Polygons exclude_polys; Polygon exclude_poly; @@ -3252,7 +3259,8 @@ void Model::setPrintSpeedTable(const DynamicPrintConfig& config, const PrintConf exclude_poly.points.clear(); } } - printSpeedMap.bed_poly = diff({ printSpeedMap.bed_poly }, exclude_polys)[0]; + if (!exclude_polys.empty()) + printSpeedMap.bed_poly = diff({ printSpeedMap.bed_poly }, exclude_polys)[0]; } // find temperature of heatend and bed and matierial of an given extruder @@ -3548,6 +3556,316 @@ Polygon ModelInstance::convex_hull_2d() return convex_hull; } +namespace { + +struct ExclusionPrismFootprintTriangle +{ + std::array vertices; + Vec2d min = Vec2d::Zero(); + Vec2d max = Vec2d::Zero(); +}; + +static double cross_2d(const Vec2d &a, const Vec2d &b) +{ + return a.x() * b.y() - a.y() * b.x(); +} + +template +static std::vector clip_polygon_by_signed_distance(const std::vector &input, DistanceFn distance) +{ + constexpr double clip_epsilon = 1e-8; + constexpr double duplicate_epsilon_sq = 1e-16; + + std::vector output; + if (input.empty()) + return output; + + auto append_point = [&output](const Vec3d &point) { + if (output.empty() || (output.back() - point).squaredNorm() > duplicate_epsilon_sq) + output.emplace_back(point); + }; + + Vec3d prev = input.back(); + double prev_distance = distance(prev); + bool prev_inside = prev_distance >= -clip_epsilon; + for (const Vec3d &curr : input) { + const double curr_distance = distance(curr); + const bool curr_inside = curr_distance >= -clip_epsilon; + + if (curr_inside != prev_inside) { + const double denom = prev_distance - curr_distance; + if (std::abs(denom) > clip_epsilon) { + const double t = prev_distance / denom; + append_point(prev + t * (curr - prev)); + } + } + if (curr_inside) + append_point(curr); + + prev = curr; + prev_distance = curr_distance; + prev_inside = curr_inside; + } + + if (output.size() > 1 && (output.front() - output.back()).squaredNorm() <= duplicate_epsilon_sq) + output.pop_back(); + + return output; +} + +static std::vector triangulated_prism_footprints(const Polygon &polygon) +{ + std::vector out; + if (polygon.points.size() < 3) + return out; + + ExPolygon expolygon; + expolygon.contour = polygon; + expolygon.contour.make_counter_clockwise(); + + std::vector triangles = triangulate_expolygon_2d(expolygon, NORMALS_UP); + if (triangles.empty()) { + triangles.reserve((polygon.points.size() - 2) * 3); + const Vec2d first(unscale(polygon.points.front().x()), unscale(polygon.points.front().y())); + for (size_t i = 1; i + 1 < polygon.points.size(); ++i) { + triangles.emplace_back(first); + triangles.emplace_back(unscale(polygon.points[i].x()), unscale(polygon.points[i].y())); + triangles.emplace_back(unscale(polygon.points[i + 1].x()), unscale(polygon.points[i + 1].y())); + } + } + + out.reserve(triangles.size() / 3); + for (size_t i = 0; i + 2 < triangles.size(); i += 3) { + ExclusionPrismFootprintTriangle tri; + tri.vertices = { triangles[i], triangles[i + 1], triangles[i + 2] }; + + const double area = cross_2d(tri.vertices[1] - tri.vertices[0], tri.vertices[2] - tri.vertices[0]); + if (std::abs(area) <= EPSILON) + continue; + if (area < 0.0) + std::swap(tri.vertices[1], tri.vertices[2]); + + tri.min = tri.vertices[0].cwiseMin(tri.vertices[1]).cwiseMin(tri.vertices[2]); + tri.max = tri.vertices[0].cwiseMax(tri.vertices[1]).cwiseMax(tri.vertices[2]); + out.emplace_back(std::move(tri)); + } + + return out; +} + +static bool triangle_bbox_intersects_prism_footprint(const Vec3d &p0, const Vec3d &p1, const Vec3d &p2, const ExclusionPrismFootprintTriangle &footprint) +{ + constexpr double bbox_epsilon = 1e-8; + const double tri_min_x = std::min({ p0.x(), p1.x(), p2.x() }); + const double tri_max_x = std::max({ p0.x(), p1.x(), p2.x() }); + const double tri_min_y = std::min({ p0.y(), p1.y(), p2.y() }); + const double tri_max_y = std::max({ p0.y(), p1.y(), p2.y() }); + + return tri_max_x >= footprint.min.x() - bbox_epsilon && + tri_min_x <= footprint.max.x() + bbox_epsilon && + tri_max_y >= footprint.min.y() - bbox_epsilon && + tri_min_y <= footprint.max.y() + bbox_epsilon; +} + +static std::vector clip_model_triangle_to_prism( + const Vec3d &p0, + const Vec3d &p1, + const Vec3d &p2, + const double z_min, + const double z_max, + const ExclusionPrismFootprintTriangle &footprint) +{ + std::vector clipped = { p0, p1, p2 }; + clipped = clip_polygon_by_signed_distance(clipped, [z_min](const Vec3d &p) { return p.z() - z_min; }); + clipped = clip_polygon_by_signed_distance(clipped, [z_max](const Vec3d &p) { return z_max - p.z(); }); + + for (size_t i = 0; i < footprint.vertices.size() && clipped.size() >= 3; ++i) { + const Vec2d &a = footprint.vertices[i]; + const Vec2d &b = footprint.vertices[(i + 1) % footprint.vertices.size()]; + const Vec2d edge = b - a; + clipped = clip_polygon_by_signed_distance(clipped, [a, edge](const Vec3d &p) { + return cross_2d(edge, Vec2d(p.x() - a.x(), p.y() - a.y())); + }); + } + + return clipped; +} + +static double polygon_3d_area2(const std::vector &polygon) +{ + if (polygon.size() < 3) + return 0.0; + + Vec3d normal = Vec3d::Zero(); + for (size_t i = 1; i + 1 < polygon.size(); ++i) + normal += (polygon[i] - polygon.front()).cross(polygon[i + 1] - polygon.front()); + return normal.norm(); +} + +static void append_clipped_polygon(indexed_triangle_set &out, const std::vector &polygon) +{ + if (polygon.size() < 3) + return; + + // Do not reserve exact capacity here. This helper may be called for many + // clipped fragments, so let std::vector grow amortized through emplace_back. + const int base = int(out.vertices.size()); + for (const Vec3d &point : polygon) + out.vertices.emplace_back(point.cast()); + + for (size_t i = 1; i + 1 < polygon.size(); ++i) { + stl_triangle_vertex_indices tri; + tri << base, base + int(i), base + int(i + 1); + out.indices.emplace_back(tri); + } +} + +static bool mesh_contains_point_linear(const indexed_triangle_set &its, const Vec3d &point) +{ + constexpr double ray_epsilon = 1e-6; + const Vec3d ray_direction = Vec3d::UnitX(); + double nearest_hit_distance = std::numeric_limits::infinity(); + size_t nearest_face = size_t(-1); + + for (size_t face_id = 0; face_id < its.indices.size(); ++face_id) { + const stl_triangle_vertex_indices &face = its.indices[face_id]; + double distance; + double u; + double v; + if (AABBTreeIndirect::detail::intersect_triangle( + point, ray_direction, + its.vertices[face[0]], its.vertices[face[1]], its.vertices[face[2]], + distance, u, v, ray_epsilon) && + distance > 0.0 && distance < nearest_hit_distance) { + nearest_hit_distance = distance; + nearest_face = face_id; + } + } + + // This matches AABBMesh::hit_result::is_inside(): for a consistently + // oriented closed mesh, the nearest face points along a ray leaving it. + return nearest_face != size_t(-1) && + its_unnormalized_normal(its, nearest_face).cast().dot(ray_direction) > 0.0; +} + +} // namespace + +bool ModelInstance::intersects_bed_exclude_region(const BedExcludeRegion ®ion, indexed_triangle_set *intersection_mesh) const +{ + // With no output mesh this is a fast yes/no test and returns on the first + // hit. With an output mesh it collects all clipped fragments for the red + // GUI intersection preview. + if (intersection_mesh != nullptr) + intersection_mesh->clear(); + + if (region.polygon.points.size() < 3) + return false; + + double z_min = region.z_min; + double z_max = region.z_max; + if (z_min > z_max) + std::swap(z_min, z_max); + if (z_max <= z_min + EPSILON) + return false; + + const std::vector footprints = triangulated_prism_footprints(region.polygon); + if (footprints.empty()) + return false; + + bool intersects = false; + const ModelObject *model_object = get_object(); + const Transform3d instance_matrix = get_matrix(); + + for (const ModelVolume *volume : model_object->volumes) { + if (! volume->is_model_part()) + continue; + + const indexed_triangle_set &its = volume->mesh().its; + if (its.vertices.empty() || its.indices.empty()) + continue; + + const Transform3d volume_matrix = instance_matrix * volume->get_matrix(); + bool volume_surface_intersects = false; + for (const stl_triangle_vertex_indices &face : its.indices) { + const Vec3d p0 = volume_matrix * its.vertices[face[0]].cast(); + const Vec3d p1 = volume_matrix * its.vertices[face[1]].cast(); + const Vec3d p2 = volume_matrix * its.vertices[face[2]].cast(); + + const double tri_min_z = std::min({ p0.z(), p1.z(), p2.z() }); + const double tri_max_z = std::max({ p0.z(), p1.z(), p2.z() }); + if (tri_max_z < z_min || tri_min_z > z_max) + continue; + + for (const ExclusionPrismFootprintTriangle &footprint : footprints) { + if (! triangle_bbox_intersects_prism_footprint(p0, p1, p2, footprint)) + continue; + + std::vector clipped = clip_model_triangle_to_prism(p0, p1, p2, z_min, z_max, footprint); + if (polygon_3d_area2(clipped) <= 1e-8) + continue; + + volume_surface_intersects = true; + intersects = true; + if (intersection_mesh == nullptr) + return true; + + append_clipped_polygon(*intersection_mesh, clipped); + } + } + + if (!volume_surface_intersects && !intersects) { + // Surface clipping cannot detect a prism wholly enclosed by a + // solid. In that topology, with no boundary crossing, one point + // inside the connected prism is sufficient to test containment. + const ExclusionPrismFootprintTriangle &footprint = footprints.front(); + const Vec2d probe_xy = (footprint.vertices[0] + footprint.vertices[1] + footprint.vertices[2]) / 3.0; + const Vec3d probe_world(probe_xy.x(), probe_xy.y(), z_min + 0.5 * (z_max - z_min)); + const Vec3d probe_local = volume_matrix.inverse() * probe_world; + + // A linear ray scan keeps this one-off fallback O(n) without + // adding ray tests to the usual surface-intersection path. + if (volume->mesh().bounding_box().contains(probe_local) && mesh_contains_point_linear(its, probe_local)) { + intersects = true; + if (intersection_mesh == nullptr) + return true; + } + } + } + + return intersects; +} + +bool ModelInstance::intersects_bed_exclude_regions( + const std::vector ®ions, + indexed_triangle_set *intersection_mesh) const +{ + if (intersection_mesh != nullptr) + intersection_mesh->clear(); + if (regions.empty()) + return false; + + const Polygon hull = const_cast(this)->convex_hull_2d(); + bool intersects = false; + for (const BedExcludeRegion ®ion : regions) { + if (intersection(Polygons{ region.polygon }, Polygons{ hull }).empty()) + continue; + + if (intersection_mesh == nullptr) { + if (intersects_bed_exclude_region(region)) + return true; + continue; + } + + indexed_triangle_set region_intersection; + if (intersects_bed_exclude_region(region, ®ion_intersection)) { + intersects = true; + if (!region_intersection.empty()) + its_merge(*intersection_mesh, region_intersection); + } + } + return intersects; +} + //BBS: invalidate instance's convex_hull_2d void ModelInstance::invalidate_convex_hull_2d() { diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index ea0a02cbe0..6d9797ff67 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -1519,6 +1519,8 @@ public: double get_auto_brim_width() const; // BBS Polygon convex_hull_2d(); + bool intersects_bed_exclude_region(const BedExcludeRegion ®ion, indexed_triangle_set *intersection_mesh = nullptr) const; + bool intersects_bed_exclude_regions(const std::vector ®ions, indexed_triangle_set *intersection_mesh = nullptr) const; void invalidate_convex_hull_2d(); // Getting the input polygon for arrange diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index c5c952577c..3db5d38258 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -192,8 +192,11 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r:: ap.has_tree_support = true; } - auto size = obj->instance_convex_hull_bounding_box(instance).size(); - ap.height = size.z(); + const BoundingBoxf3 bbox = obj->instance_convex_hull_bounding_box(instance); + ap.height = bbox.size().z(); + ap.z_min = bbox.min.z(); + ap.z_max = bbox.max.z(); + ap.has_z_range = bbox.defined; ap.name = obj->name; return ap; } diff --git a/src/libslic3r/MultiMaterialSegmentation.cpp b/src/libslic3r/MultiMaterialSegmentation.cpp index dc3af43de4..651d815144 100644 --- a/src/libslic3r/MultiMaterialSegmentation.cpp +++ b/src/libslic3r/MultiMaterialSegmentation.cpp @@ -22,6 +22,7 @@ #include "Surface.hpp" #include "libslic3r.h" +#include #include #include #include @@ -1236,6 +1237,12 @@ double resolve_outer_wall_line_width(const PrintRegionConfig ®ion_config, con return width.get_abs_value(nozzle_diameter); } +// Layers a painted top or bottom surface colors; 0 follows the shell layer count. +static int color_penetration_layers(const ConfigOptionInt &penetration_layers, const ConfigOptionInt &shell_layers) +{ + return penetration_layers.value > 0 ? penetration_layers.value : shell_layers.value; +} + // Returns segmentation of top and bottom layers based on painting in segmentation gizmos. static inline std::vector> segmentation_top_and_bottom_layers(const PrintObject &print_object, const std::vector &input_expolygons, @@ -1251,8 +1258,8 @@ static inline std::vector> segmentation_top_and_bottom_l int max_bottom_layers = 0; for (size_t i = 0; i < print_object.num_printing_regions(); ++ i) { const PrintRegionConfig &config = print_object.printing_region(i).config(); - max_top_layers = std::max(max_top_layers, config.top_shell_layers.value); - max_bottom_layers = std::max(max_bottom_layers, config.bottom_shell_layers.value); + max_top_layers = std::max(max_top_layers, color_penetration_layers(config.top_color_penetration_layers, config.top_shell_layers)); + max_bottom_layers = std::max(max_bottom_layers, color_penetration_layers(config.bottom_color_penetration_layers, config.bottom_shell_layers)); } // Project upwards pointing painted triangles over top surfaces, @@ -1288,8 +1295,8 @@ static inline std::vector> segmentation_top_and_bottom_l slicing_params.trafo = volume_trafo; Polygons bottom_slice = slice_mesh(painted, zs[0], slicing_params); - // Only the requested projections exist: with - // top_shell_layers = 0 `top` is empty and erasing its begin() was + // Only the requested projections exist: with no top + // penetration layers `top` is empty and erasing its begin() was // undefined (found by fuzzing: a sunk, painted object crashed here). if (! top.empty()) top.erase(top.begin()); @@ -1361,10 +1368,15 @@ static inline std::vector> segmentation_top_and_bottom_l } #endif // MM_SEGMENTATION_DEBUG_TOP_BOTTOM - // When the upper surface of an object is occluded, it should no longer be considered the upper surface + // When the upper surface of an object is occluded, it should no longer be considered the upper surface. + // Every (colour, layer) pair is trimmed on its own, so they all run at once: the painted faces of a finely + // textured part project hundreds of thousands of triangles onto one layer, which used to be trimmed serially. { - for (size_t extruder_idx = 0; extruder_idx < num_facets_states; ++extruder_idx) { - for (size_t layer_idx = 0; layer_idx < layers.size(); ++layer_idx) { + const size_t occluded_pairs = num_facets_states * layers.size(); + tbb::parallel_for(tbb::blocked_range(0, occluded_pairs), [&](const tbb::blocked_range &range) { + for (size_t pair_idx = range.begin(); pair_idx < range.end(); ++pair_idx) { + const size_t extruder_idx = pair_idx / layers.size(); + const size_t layer_idx = pair_idx % layers.size(); if (!top_raw[extruder_idx].empty() && !top_raw[extruder_idx][layer_idx].empty() && layer_idx + 1 < layers.size()) { top_raw[extruder_idx][layer_idx] = diff(top_raw[extruder_idx][layer_idx], input_expolygons[layer_idx + 1]); } @@ -1372,7 +1384,7 @@ static inline std::vector> segmentation_top_and_bottom_l bottom_raw[extruder_idx][layer_idx] = diff(bottom_raw[extruder_idx][layer_idx], input_expolygons[layer_idx - 1]); } } - } + }); } std::vector> triangles_by_color_bottom(num_facets_states); @@ -1396,9 +1408,9 @@ static inline std::vector> segmentation_top_and_bottom_l // Minimum radius of a region to be printable. Used to filter regions by morphological opening. float small_region_threshold { 0.f }; // Maximum number of top layers for a queried color. - int top_shell_layers { 0 }; + int top_penetration_layers { 0 }; // Maximum number of bottom layers for a queried color. - int bottom_shell_layers { 0 }; + int bottom_penetration_layers { 0 }; //BBS: spacing according to width and layer height float extrusion_spacing{ 0.f }; }; @@ -1413,8 +1425,8 @@ static inline std::vector> segmentation_top_and_bottom_l //BBS: the extrusion line width is outer wall rather than inner wall double outer_wall_line_width = resolve_outer_wall_line_width(config, print_object.config(), print_object.print()->config()); out.extrusion_width = std::max(out.extrusion_width, outer_wall_line_width); - out.top_shell_layers = std::max(out.top_shell_layers, config.top_shell_layers); - out.bottom_shell_layers = std::max(out.bottom_shell_layers, config.bottom_shell_layers); + out.top_penetration_layers = std::max(out.top_penetration_layers, color_penetration_layers(config.top_color_penetration_layers, config.top_shell_layers)); + out.bottom_penetration_layers = std::max(out.bottom_penetration_layers, color_penetration_layers(config.bottom_color_penetration_layers, config.bottom_shell_layers)); out.small_region_threshold = config.gap_infill_speed.get_at(print_object.print()->get_extruder_id(config.outer_wall_filament_id - 1)) > 0 ? // Gap fill enabled. Enable a single line of 1/2 extrusion width. 0.5f * outer_wall_line_width : @@ -1430,11 +1442,58 @@ static inline std::vector> segmentation_top_and_bottom_l return out; }; + // Projects a painted top or bottom face `ex` of layer `layer_idx` onto the shell layers below or above it (in + // `shell_layers`, nearest first), one more perimeter in on each, stopping at the first layer where nothing is left. + // Only the slices within the deepest offset of `ex` (three times that with the miter joins) decide the result, so the + // work is done per tile of `ex`'s ExPolygons on the slices cut to the tile's box grown by that much: the same result, but + // each Clipper call stays the size of a tile rather than of a layer cut through a fine relief, and the tiles run in + // parallel. + const auto project_to_shells = [&input_expolygons](const ExPolygons &ex, size_t layer_idx, const std::vector &shell_layers, + const LayerColorStat &stat, ShellProjections &dst) { + std::vector offsets(shell_layers.size()); + float offset = 0.f; + for (size_t i = 0; i < shell_layers.size(); ++i) { + //BBS: offset width should be 2*spacing to avoid too narrow area which has overlap of wall line + offset -= (stat.extrusion_spacing + stat.extrusion_width); + offsets[i] = offset; + } + if (offsets.empty()) + return; + const coord_t reach = coord_t(std::ceil(DefaultMiterLimit * std::abs(offsets.back()))) + 10 * SCALED_EPSILON; + const std::vector tiles = ClipperUtils::tile_expolygons(ex, 16); + // [shell layer][tile] + std::vector> shells(shell_layers.size(), std::vector(tiles.size())); + tbb::parallel_for(size_t(0), tiles.size(), [&](size_t tile_idx) { + const ClipperUtils::ExPolygonsTile &tile = tiles[tile_idx]; + const BoundingBox bbox = tile.bbox.inflated(reach); + ExPolygons tile_ex; + tile_ex.reserve(tile.members.size()); + for (size_t i : tile.members) + tile_ex.emplace_back(ex[i]); + Polygons layer_slices_trimmed = ClipperUtils::clip_clipper_polygons_with_subject_bbox(input_expolygons[layer_idx], bbox); + for (size_t i = 0; i < shell_layers.size() && ! layer_slices_trimmed.empty(); ++i) { + const ExPolygons trimmed = intersection_ex(layer_slices_trimmed, ClipperUtils::clip_clipper_polygons_with_subject_bbox(input_expolygons[shell_layers[i]], bbox)); + shells[i][tile_idx] = opening_ex(intersection_ex(tile_ex, offset_ex(trimmed, offsets[i])), stat.small_region_threshold); + layer_slices_trimmed = to_polygons(trimmed); + } + }); + for (size_t i = 0; i < shell_layers.size(); ++i) { + ExPolygons shell; + for (ExPolygons &tile_shell : shells[i]) + append(shell, std::move(tile_shell)); + if (shell.empty()) + break; + dst.emplace_back(shell_layers[i], std::move(shell)); + } + }; + tbb::parallel_for(tbb::blocked_range(0, num_layers), [&num_layers, &num_facets_states, &layer_color_stat, &top_raw, &triangles_by_color_top, - &throw_on_cancel_callback, &input_expolygons, &bottom_raw, &triangles_by_color_bottom, + &throw_on_cancel_callback, &bottom_raw, &triangles_by_color_bottom, &project_to_shells, &shell_triangles_by_color_top, &shell_triangles_by_color_bottom](const tbb::blocked_range &range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) { - for (size_t color_idx = 0; color_idx < num_facets_states; ++color_idx) { + // Each colour writes only its own vectors, so the colours run in parallel: a painted top or bottom face + // projects onto a single layer, which otherwise did all of its colours on one thread. + tbb::parallel_for(size_t(0), size_t(num_facets_states), [&](size_t color_idx) { throw_on_cancel_callback(); LayerColorStat stat = layer_color_stat(layer_idx, color_idx); if (std::vector &top = top_raw[color_idx]; ! top.empty() && ! top[layer_idx].empty()) @@ -1443,18 +1502,10 @@ static inline std::vector> segmentation_top_and_bottom_l top_ex = opening_ex(top_ex, stat.small_region_threshold); if (! top_ex.empty()) { append(triangles_by_color_top[color_idx][layer_idx], top_ex); - float offset = 0.f; - ExPolygons layer_slices_trimmed = input_expolygons[layer_idx]; - for (int last_idx = int(layer_idx) - 1; last_idx > std::max(int(layer_idx - stat.top_shell_layers), int(0)); --last_idx) { - //BBS: offset width should be 2*spacing to avoid too narrow area which has overlap of wall line - //offset -= stat.extrusion_width ; - offset -= (stat.extrusion_spacing + stat.extrusion_width); - layer_slices_trimmed = intersection_ex(layer_slices_trimmed, input_expolygons[last_idx]); - ExPolygons last = opening_ex(intersection_ex(top_ex, offset_ex(layer_slices_trimmed, offset)), stat.small_region_threshold); - if (last.empty()) - break; - shell_triangles_by_color_top[color_idx][layer_idx].emplace_back(size_t(last_idx), std::move(last)); - } + std::vector shell_layers; + for (int last_idx = int(layer_idx) - 1; last_idx > std::max(int(layer_idx - stat.top_penetration_layers), int(0)); --last_idx) + shell_layers.emplace_back(size_t(last_idx)); + project_to_shells(top_ex, layer_idx, shell_layers, stat, shell_triangles_by_color_top[color_idx][layer_idx]); } } if (std::vector &bottom = bottom_raw[color_idx]; ! bottom.empty() && ! bottom[layer_idx].empty()) @@ -1463,21 +1514,13 @@ static inline std::vector> segmentation_top_and_bottom_l bottom_ex = opening_ex(bottom_ex, stat.small_region_threshold); if (! bottom_ex.empty()) { append(triangles_by_color_bottom[color_idx][layer_idx], bottom_ex); - float offset = 0.f; - ExPolygons layer_slices_trimmed = input_expolygons[layer_idx]; - for (size_t last_idx = layer_idx + 1; last_idx < std::min(layer_idx + stat.bottom_shell_layers, num_layers); ++last_idx) { - //BBS: offset width should be 2*spacing to avoid too narrow area which has overlap of wall line - //offset -= stat.extrusion_width; - offset -= (stat.extrusion_spacing + stat.extrusion_width); - layer_slices_trimmed = intersection_ex(layer_slices_trimmed, input_expolygons[last_idx]); - ExPolygons last = opening_ex(intersection_ex(bottom_ex, offset_ex(layer_slices_trimmed, offset)), stat.small_region_threshold); - if (last.empty()) - break; - shell_triangles_by_color_bottom[color_idx][layer_idx].emplace_back(last_idx, std::move(last)); - } + std::vector shell_layers; + for (size_t last_idx = layer_idx + 1; last_idx < std::min(layer_idx + stat.bottom_penetration_layers, num_layers); ++last_idx) + shell_layers.emplace_back(last_idx); + project_to_shells(bottom_ex, layer_idx, shell_layers, stat, shell_triangles_by_color_bottom[color_idx][layer_idx]); } } - } + }); } }); @@ -1498,20 +1541,23 @@ static inline std::vector> segmentation_top_and_bottom_l &shell_top_by_layer, &shell_bottom_by_layer](const tbb::blocked_range &range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) { throw_on_cancel_callback(); - ExPolygons painted_exploys; - for (size_t color_idx = 0; color_idx < triangles_by_color_merged.size(); ++color_idx) { + // The per-colour unions below are independent of each other, so they run in parallel (a painted top or + // bottom face puts all of its colours on one layer); whatever combines the colours stays in colour order. + const auto merge_colour_union = [&](size_t color_idx) { auto &self = triangles_by_color_merged[color_idx][layer_idx]; append(self, std::move(triangles_by_color_bottom[color_idx][layer_idx])); append(self, std::move(triangles_by_color_top[color_idx][layer_idx])); self = union_ex(self); + }; + tbb::parallel_for(size_t(0), triangles_by_color_merged.size(), merge_colour_union); - append(painted_exploys, self); - } - + ExPolygons painted_exploys; + for (size_t color_idx = 0; color_idx < triangles_by_color_merged.size(); ++color_idx) + append(painted_exploys, triangles_by_color_merged[color_idx][layer_idx]); painted_exploys = union_ex(painted_exploys); //BBS: merge the top and bottom shell layers - for (size_t color_idx = 0; color_idx < triangles_by_color_merged.size(); ++color_idx) { + tbb::parallel_for(size_t(0), triangles_by_color_merged.size(), [&](size_t color_idx) { auto &self = triangles_by_color_merged[color_idx][layer_idx]; auto top_area = diff_ex(union_ex(shell_top_by_layer[color_idx][layer_idx]), painted_exploys); @@ -1520,7 +1566,7 @@ static inline std::vector> segmentation_top_and_bottom_l append(self, top_area); append(self, bottom_area); self = union_ex(self); - } + }); // Trim one region by the other if some of the regions overlap. ExPolygons painted_regions; for (size_t color_idx = 1; color_idx < triangles_by_color_merged.size(); ++color_idx) { @@ -1887,7 +1933,71 @@ static void remove_multiple_edges_in_vertices(MMU_Graph &graph, const std::vecto } } -static std::vector> merge_segmented_layers(const std::vector> &segmented_regions, + +namespace { +// Finds the islands (layer ExPolygons) a region piece overlaps. A top or bottom region is projected from the neighbouring +// layers and may reach past the island it belongs to, or over several islands. +class IslandLocator +{ +public: + explicit IslandLocator(const ExPolygons &islands) : m_islands(islands) + { + m_bboxes.reserve(islands.size()); + for (const ExPolygon &island : islands) { + m_bboxes.emplace_back(get_extents(island)); + m_extent.merge(m_bboxes.back()); + } + if (!m_extent.defined) + return; + const Point size = m_extent.size(); + m_cell_w = std::max(1, size.x() / GRID + 1); + m_cell_h = std::max(1, size.y() / GRID + 1); + m_grid.assign(GRID * GRID, {}); + for (size_t i = 0; i < m_bboxes.size(); ++i) + for_cells(m_bboxes[i], [&](int cell) { m_grid[cell].emplace_back(i); }); + } + + void find(const ExPolygon &piece, std::vector &out) const + { + out.clear(); + const BoundingBox bbox = get_extents(piece); + if (!m_extent.defined || !m_extent.overlap(bbox)) + return; + for_cells(bbox, [&](int cell) { + for (size_t i : m_grid[cell]) + if (m_bboxes[i].overlap(bbox)) + out.emplace_back(i); + }); + sort_remove_duplicates(out); + if (out.size() > 1) + out.erase(std::remove_if(out.begin(), out.end(), [&](size_t i) { + const BoundingBox common(m_bboxes[i].min.cwiseMax(bbox.min), m_bboxes[i].max.cwiseMin(bbox.max)); + return intersection(ClipperUtils::clip_clipper_polygons_with_subject_bbox(piece, common.inflated(SCALED_EPSILON)), + ClipperUtils::clip_clipper_polygons_with_subject_bbox(m_islands[i], common.inflated(SCALED_EPSILON))).empty(); + }), out.end()); + } + +private: + static constexpr int GRID = 64; + template void for_cells(const BoundingBox &bb, Fn &&fn) const + { + const int x0 = std::clamp(int((bb.min.x() - m_extent.min.x()) / m_cell_w), 0, GRID - 1), x1 = std::clamp(int((bb.max.x() - m_extent.min.x()) / m_cell_w), 0, GRID - 1); + const int y0 = std::clamp(int((bb.min.y() - m_extent.min.y()) / m_cell_h), 0, GRID - 1), y1 = std::clamp(int((bb.max.y() - m_extent.min.y()) / m_cell_h), 0, GRID - 1); + for (int y = y0; y <= y1; ++y) + for (int x = x0; x <= x1; ++x) + fn(y * GRID + x); + } + + const ExPolygons &m_islands; + std::vector m_bboxes; + BoundingBox m_extent; + coord_t m_cell_w = 1, m_cell_h = 1; + std::vector> m_grid; +}; +} // namespace + +static std::vector> merge_segmented_layers(const std::vector &input_expolygons, + const std::vector> &segmented_regions, std::vector> &&top_and_bottom_layers, const size_t num_facets_states, const std::function &throw_on_cancel_callback) @@ -1898,33 +2008,91 @@ static std::vector> merge_segmented_layers(const std::ve assert(!top_and_bottom_layers.size() || num_facets_states == top_and_bottom_layers.size()); BOOST_LOG_TRIVIAL(debug) << "Print object segmentation - Merging segmented layers in parallel - Begin"; - tbb::parallel_for(tbb::blocked_range(0, num_layers), [&segmented_regions, &top_and_bottom_layers, &segmented_regions_merged, &num_facets_states, &throw_on_cancel_callback](const tbb::blocked_range &range) { + // Every region of a layer is merged together with the regions of the islands it overlaps, and the islands are further + // apart than the dimple removal below reaches, so this gives the same result as merging the layer at once. On a layer + // cut through a fine relief every region shares thousands of hole contours with every other, and Clipper, splitting + // and re-linking one huge polygon over and over, took anything up to half an hour for a layer; per island each operation + // stays the size of the island, and the islands run in parallel. + tbb::parallel_for(tbb::blocked_range(0, num_layers), [&](const tbb::blocked_range &range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { assert(segmented_regions[layer_idx].size() == num_facets_states); - // Zero is skipped because it is the default color of the volume + throw_on_cancel_callback(); + // Group the islands joined by a region overlapping several of them; the last group takes the regions lying + // outside every island. + const ExPolygons &islands = input_expolygons[layer_idx]; + const IslandLocator locator(islands); + std::vector parent(islands.size() + 1); + std::iota(parent.begin(), parent.end(), 0); + const auto root = [&parent](size_t i) { + while (parent[i] != i) + i = parent[i] = parent[parent[i]]; + return i; + }; + // Islands of every piece: side regions of colours 1.., then top/bottom regions of colours 0.. + std::vector pieces; + for (size_t extruder_id = 1; extruder_id < num_facets_states; ++extruder_id) + for (const ExPolygon &piece : segmented_regions[layer_idx][extruder_id]) + pieces.emplace_back(&piece); + if (!top_and_bottom_layers.empty()) + for (size_t color_idx = 0; color_idx < num_facets_states; ++color_idx) + for (const ExPolygon &piece : top_and_bottom_layers[color_idx][layer_idx]) + pieces.emplace_back(&piece); + std::vector> overlapped(pieces.size()); + tbb::parallel_for(size_t(0), pieces.size(), [&](size_t i) { locator.find(*pieces[i], overlapped[i]); }); + std::vector piece_island(pieces.size()); + for (size_t i = 0; i < pieces.size(); ++i) { + piece_island[i] = overlapped[i].empty() ? islands.size() : overlapped[i].front(); + for (size_t island : overlapped[i]) + parent[root(island)] = root(piece_island[i]); + } + std::vector bucket_of(parent.size(), size_t(-1)); + size_t num_buckets = 0; + for (size_t i = 0; i < parent.size(); ++i) + if (size_t &b = bucket_of[root(i)]; b == size_t(-1)) + b = num_buckets++; + + // [bucket][colour] + std::vector> sides(num_buckets, std::vector(num_facets_states)); + std::vector> tops(num_buckets, std::vector(num_facets_states)); + size_t piece_idx = 0; + for (size_t extruder_id = 1; extruder_id < num_facets_states; ++extruder_id) + for (const ExPolygon &piece : segmented_regions[layer_idx][extruder_id]) + sides[bucket_of[root(piece_island[piece_idx++])]][extruder_id].emplace_back(piece); + if (!top_and_bottom_layers.empty()) + for (size_t color_idx = 0; color_idx < num_facets_states; ++color_idx) + for (const ExPolygon &piece : top_and_bottom_layers[color_idx][layer_idx]) + tops[bucket_of[root(piece_island[piece_idx++])]][color_idx].emplace_back(piece); + + // Side regions minus the top/bottom regions of every colour. + std::vector> merged(num_buckets, std::vector(num_facets_states)); + tbb::parallel_for(size_t(0), num_buckets, [&](size_t bucket) { + Polygons tops_all; + for (const ExPolygons &t : tops[bucket]) + polygons_append(tops_all, t); + for (size_t extruder_id = 1; extruder_id < num_facets_states; ++extruder_id) + if (!sides[bucket][extruder_id].empty()) + merged[bucket][extruder_id] = tops_all.empty() ? std::move(sides[bucket][extruder_id]) : + diff_ex_by_piece(sides[bucket][extruder_id], tops_all); + }); + + // Then this colour's top/bottom regions, with the dimples removed (#7235) when the layer has side regions left. for (size_t extruder_id = 1; extruder_id < num_facets_states; ++extruder_id) { - throw_on_cancel_callback(); - if (!segmented_regions[layer_idx][extruder_id].empty()) { - ExPolygons segmented_regions_trimmed = segmented_regions[layer_idx][extruder_id]; - if (!top_and_bottom_layers.empty()) { - for (const std::vector &top_and_bottom_by_extruder : top_and_bottom_layers) { - if (!top_and_bottom_by_extruder[layer_idx].empty() && !segmented_regions_trimmed.empty()) { - segmented_regions_trimmed = diff_ex(segmented_regions_trimmed, top_and_bottom_by_extruder[layer_idx]); - } - } - } - - segmented_regions_merged[layer_idx][extruder_id - 1] = std::move(segmented_regions_trimmed); - } - - if (!top_and_bottom_layers.empty() && !top_and_bottom_layers[extruder_id][layer_idx].empty()) { - bool was_top_and_bottom_empty = segmented_regions_merged[layer_idx][extruder_id - 1].empty(); - append(segmented_regions_merged[layer_idx][extruder_id - 1], top_and_bottom_layers[extruder_id][layer_idx]); - - // Remove dimples (#7235) appearing after merging side segmentation of the model with tops and bottoms painted layers. - if (!was_top_and_bottom_empty) - segmented_regions_merged[layer_idx][extruder_id - 1] = offset2_ex(union_ex(segmented_regions_merged[layer_idx][extruder_id - 1]), float(SCALED_EPSILON), -float(SCALED_EPSILON)); + if (top_and_bottom_layers.empty() || top_and_bottom_layers[extruder_id][layer_idx].empty()) { + for (size_t bucket = 0; bucket < num_buckets; ++bucket) + append(segmented_regions_merged[layer_idx][extruder_id - 1], std::move(merged[bucket][extruder_id])); + continue; } + bool was_top_and_bottom_empty = true; + for (size_t bucket = 0; bucket < num_buckets && was_top_and_bottom_empty; ++bucket) + was_top_and_bottom_empty = merged[bucket][extruder_id].empty(); + tbb::parallel_for(size_t(0), num_buckets, [&](size_t bucket) { + ExPolygons ®ion = merged[bucket][extruder_id]; + append(region, tops[bucket][extruder_id]); + if (!was_top_and_bottom_empty && !region.empty()) + region = offset2_ex(union_ex(region), float(SCALED_EPSILON), -float(SCALED_EPSILON)); + }); + for (size_t bucket = 0; bucket < num_buckets; ++bucket) + append(segmented_regions_merged[layer_idx][extruder_id - 1], std::move(merged[bucket][extruder_id])); } } }); // end of parallel_for @@ -2212,16 +2380,56 @@ std::vector> segmentation_by_painting(const PrintObject assert(!color_poly.empty()); assert(!color_poly.front().empty()); - if (has_layer_only_one_color(color_poly)) { - // If the whole layer is painted using the same color, it is not needed to construct a Voronoi diagram for the segmentation of this layer. - segmented_regions[layer_idx][size_t(color_poly.front().front().color)] = input_expolygons[layer_idx]; - } else { - MMU_Graph graph = build_graph(layer_idx, color_poly); - remove_multiple_edges_in_vertices(graph, color_poly); - graph.remove_nodes_with_one_arc(); - segmented_regions[layer_idx] = extract_colored_segments(graph, num_facets_states); - //segmented_regions[layer_idx] = extract_colored_segments(color_poly, num_extruders, layer_idx); + // Each island (an ExPolygon with its holes) is segmented on its own. Any point of an island is closer to + // that island's contours than to any other island's - the way out crosses its own boundary first - so its + // Voronoi cells, and with them its colour regions, depend on nothing else. A layer cut through a fine relief + // has thousands of islands, and one Voronoi diagram over all of them degenerated into overlapping regions + // that every boolean afterwards had to untangle. Per island the diagrams stay small and the islands run in + // parallel; an island in a single colour needs no diagram at all. + const ExPolygons &islands = input_expolygons[layer_idx]; + std::vector> island_contours(islands.size()); // [first, last) into color_poly + { + // The same order EdgeGrid::Grid::create() lists the contours in, and so colorize_contours(). + size_t idx = 0; + for (size_t island_idx = 0; island_idx < islands.size(); ++island_idx) { + const size_t first = idx; + if (!islands[island_idx].contour.empty()) + ++idx; + for (const Polygon &hole : islands[island_idx].holes) + if (!hole.empty()) + ++idx; + island_contours[island_idx] = {first, idx}; + } + assert(idx == color_poly.size()); } + std::vector> island_regions(islands.size()); + tbb::parallel_for(size_t(0), islands.size(), [&](size_t island_idx) { + const auto [first, last] = island_contours[island_idx]; + if (first == last) + return; + const std::vector island_poly(color_poly.begin() + first, color_poly.begin() + last); + std::vector ®ions = island_regions[island_idx]; + if (has_layer_only_one_color(island_poly)) { + regions.assign(num_facets_states, ExPolygons()); + regions[size_t(island_poly.front().front().color)].emplace_back(islands[island_idx]); + } else { + MMU_Graph graph = build_graph(layer_idx, island_poly); + remove_multiple_edges_in_vertices(graph, island_poly); + graph.remove_nodes_with_one_arc(); + regions = extract_colored_segments(graph, num_facets_states); + // The faces of one colour tile it without overlapping; merged here, where an island is small, + // every later boolean gets a few regions instead of thousands of faces sharing their edges. An + // island with many holes keeps its faces: merged, each colour would be one region with thousands + // of holes, and subtracting from that is far slower than from the faces one at a time. + if (island_poly.size() <= 64) + for (ExPolygons &faces : regions) + if (faces.size() > 1) + faces = union_ex(faces); + } + }); + for (std::vector ®ions : island_regions) + for (size_t color_idx = 0; color_idx < regions.size(); ++color_idx) + append(segmented_regions[layer_idx][color_idx], std::move(regions[color_idx])); #ifdef MM_SEGMENTATION_DEBUG_REGIONS export_regions_to_svg(debug_out_path("3-mm-regions-sides-%d-%d.svg", layer_idx, iRun), segmented_regions[layer_idx], input_expolygons[layer_idx]); @@ -2244,7 +2452,7 @@ std::vector> segmentation_by_painting(const PrintObject throw_on_cancel_callback(); } - std::vector> segmented_regions_merged = merge_segmented_layers(segmented_regions, std::move(top_and_bottom_layers), num_facets_states, throw_on_cancel_callback); + std::vector> segmented_regions_merged = merge_segmented_layers(input_expolygons, segmented_regions, std::move(top_and_bottom_layers), num_facets_states, throw_on_cancel_callback); throw_on_cancel_callback(); #ifdef MM_SEGMENTATION_DEBUG_REGIONS diff --git a/src/libslic3r/MultiPoint.hpp b/src/libslic3r/MultiPoint.hpp index 82d6d5884b..772085b3be 100644 --- a/src/libslic3r/MultiPoint.hpp +++ b/src/libslic3r/MultiPoint.hpp @@ -23,11 +23,15 @@ public: MultiPoint() {} MultiPoint(const MultiPoint &other) : points(other.points) {} - MultiPoint(MultiPoint &&other) : points(std::move(other.points)) {} + MultiPoint(MultiPoint &&other) noexcept : points(std::move(other.points)) {} MultiPoint(std::initializer_list list) : points(list) {} explicit MultiPoint(const Points &_points) : points(_points) {} + // Without it, the derived classes' move constructors passing std::move(points) here copied them, which + // also means a moved-from Polygon or Polyline is now really empty where it used to silently keep its + // points: a use-after-move anywhere in the tree that happened to work before now sees nothing. + explicit MultiPoint(Points &&_points) noexcept : points(std::move(_points)) {} MultiPoint& operator=(const MultiPoint &other) { points = other.points; return *this; } - MultiPoint& operator=(MultiPoint &&other) { points = std::move(other.points); return *this; } + MultiPoint& operator=(MultiPoint &&other) noexcept { points = std::move(other.points); return *this; } virtual ~MultiPoint() = default; void scale(double factor); void scale(double factor_x, double factor_y); diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index eed1adcf78..6f86022ced 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include "libslic3r.h" #include @@ -590,12 +592,13 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p assert(std::prev(it)->polyline.last_point() == it->polyline.first_point()); } ExtrusionMultiPath multi_path; + multi_path.inset_idx = extrusion->inset_idx; multi_path.paths.emplace_back(std::move(paths.front())); for (auto it_path = std::next(paths.begin()); it_path != paths.end(); ++it_path) { if (multi_path.paths.back().last_point() != it_path->first_point()) { extrusion_coll.append(ExtrusionMultiPath(std::move(multi_path))); - multi_path = ExtrusionMultiPath(); + multi_path.paths.clear(); } multi_path.paths.emplace_back(std::move(*it_path)); } @@ -1525,7 +1528,7 @@ void PerimeterGenerator::process_classic() process_no_bridge(all_surfaces, perimeter_spacing, ext_perimeter_width); // BBS: don't simplify too much which influence arc fitting when export gcode if arc_fitting is enabled - double surface_simplify_resolution = (print_config->enable_arc_fitting && !this->has_fuzzy_skin) ? 0.2 * m_scaled_resolution : m_scaled_resolution; + double surface_simplify_resolution = (print_config->enable_arc_fitting.value == ArcFittingMode::Enabled && !this->has_fuzzy_skin) ? 0.2 * m_scaled_resolution : m_scaled_resolution; //BBS: reorder the surface to reduce the travel time ExPolygons surface_exp; for (const Surface &surface : all_surfaces) @@ -2575,7 +2578,7 @@ void PerimeterGenerator::process_arachne() process_no_bridge(all_surfaces, perimeter_spacing, ext_perimeter_width); // BBS: don't simplify too much which influence arc fitting when export gcode if arc_fitting is enabled - double surface_simplify_resolution = (print_config->enable_arc_fitting && !this->has_fuzzy_skin) ? 0.2 * m_scaled_resolution : m_scaled_resolution; + double surface_simplify_resolution = (print_config->enable_arc_fitting.value == ArcFittingMode::Enabled && !this->has_fuzzy_skin) ? 0.2 * m_scaled_resolution : m_scaled_resolution; // ORCA: neither one-wall option has a surface to act on without the shell behind it, see // has_top_shell_layers() / has_bottom_shell_layers(). Gated here so every use below - including the // topmost and first layers - sees the same answer. @@ -2583,467 +2586,490 @@ void PerimeterGenerator::process_arachne() const bool only_one_wall_first_layer = this->config->only_one_wall_first_layer && has_bottom_shell_layers(*this->config); // we need to process each island separately because we might have different // extra perimeters for each one - for (const Surface& surface : all_surfaces) { - coord_t bead_width_0 = ext_perimeter_spacing; - // detect how many perimeters must be generated for this island - int loop_number = this->config->wall_loops + surface.extra_perimeters - 1; // 0-indexed loops - int sparse_infill_density = this->config->sparse_infill_density.value; - if (this->config->alternate_extra_wall && this->layer_id % 2 == 1 && !m_spiral_vase && sparse_infill_density > 0) // add alternating extra wall - loop_number++; + // Each island is independent up to its outputs, so they are generated in parallel - a layer split into thousands + // of islands (e.g. by colour painting) otherwise ran on one thread - and the outputs are then committed in the + // original island order, which is what the extra overhang perimeters (applied to the last island's loops and to + // all fill surfaces so far) depend on. + struct ArachneSurfaceResult + { + ExtrusionEntityCollection loops; + bool has_loops = false; + ExPolygons infill; + ExPolygons no_overlap; + }; + std::vector results(all_surfaces.size()); + tbb::parallel_for(tbb::blocked_range(0, all_surfaces.size()), [&](const tbb::blocked_range &range) { + for (size_t surface_idx = range.begin(); surface_idx < range.end(); ++surface_idx) { + const Surface &surface = all_surfaces[surface_idx]; + ArachneSurfaceResult &result = results[surface_idx]; + coord_t bead_width_0 = ext_perimeter_spacing; + // detect how many perimeters must be generated for this island + int loop_number = this->config->wall_loops + surface.extra_perimeters - 1; // 0-indexed loops + int sparse_infill_density = this->config->sparse_infill_density.value; + if (this->config->alternate_extra_wall && this->layer_id % 2 == 1 && !m_spiral_vase && sparse_infill_density > 0) // add alternating extra wall + loop_number++; - // Set the bottommost layer to be one wall - const bool is_bottom_layer = (this->layer_id == object_config->raft_layers) ? true : false; - if (is_bottom_layer && only_one_wall_first_layer) - loop_number = 0; + // Set the bottommost layer to be one wall + const bool is_bottom_layer = (this->layer_id == object_config->raft_layers) ? true : false; + if (is_bottom_layer && only_one_wall_first_layer) + loop_number = 0; - // Orca: set the topmost layer to be one wall according to the config - const bool is_topmost_layer = (this->upper_slices == nullptr) ? true : false; - if (is_topmost_layer && loop_number > 0 && only_one_wall_top) - loop_number = 0; + // Orca: set the topmost layer to be one wall according to the config + const bool is_topmost_layer = (this->upper_slices == nullptr) ? true : false; + if (is_topmost_layer && loop_number > 0 && only_one_wall_top) + loop_number = 0; - auto apply_precise_outer_wall = config->precise_outer_wall && config->wall_sequence == WallSequence::InnerOuter; - // Orca: properly adjust offset for the outer wall if precise_outer_wall is enabled. - ExPolygons last = offset_ex(surface.expolygon.simplify_p(surface_simplify_resolution), - apply_precise_outer_wall? -float(ext_perimeter_width - ext_perimeter_spacing ) - : -float(ext_perimeter_width / 2. - ext_perimeter_spacing / 2.)); + auto apply_precise_outer_wall = config->precise_outer_wall && config->wall_sequence == WallSequence::InnerOuter; + // Orca: properly adjust offset for the outer wall if precise_outer_wall is enabled. + ExPolygons last = offset_ex(surface.expolygon.simplify_p(surface_simplify_resolution), + apply_precise_outer_wall? -float(ext_perimeter_width - ext_perimeter_spacing ) + : -float(ext_perimeter_width / 2. - ext_perimeter_spacing / 2.)); - Arachne::WallToolPathsParams input_params = Arachne::make_paths_params(this->layer_id, *object_config, *print_config); - // Set params is_top_or_bottom_layer for adjusting short-wall removal sensitivity. - input_params.is_top_or_bottom_layer = (is_bottom_layer || is_topmost_layer) ? true : false; + Arachne::WallToolPathsParams input_params = Arachne::make_paths_params(this->layer_id, *object_config, *print_config); + // Set params is_top_or_bottom_layer for adjusting short-wall removal sensitivity. + input_params.is_top_or_bottom_layer = (is_bottom_layer || is_topmost_layer) ? true : false; - coord_t wall_0_inset = 0; - if (apply_precise_outer_wall) - wall_0_inset = -coord_t(ext_perimeter_width / 2 - ext_perimeter_spacing / 2); + coord_t wall_0_inset = 0; + if (apply_precise_outer_wall) + wall_0_inset = -coord_t(ext_perimeter_width / 2 - ext_perimeter_spacing / 2); - //PS: One wall top surface for Arachne - ExPolygons top_expolygons; - // Calculate how many inner loops remain when TopSurfaces is selected. - const int inner_loop_number = (only_one_wall_top && upper_slices != nullptr) ? loop_number - 1 : -1; + //PS: One wall top surface for Arachne + ExPolygons top_expolygons; + // Calculate how many inner loops remain when TopSurfaces is selected. + const int inner_loop_number = (only_one_wall_top && upper_slices != nullptr) ? loop_number - 1 : -1; - // Set one perimeter when TopSurfaces is selected. - if (only_one_wall_top && loop_number > 0) - loop_number = 0; + // Set one perimeter when TopSurfaces is selected. + if (only_one_wall_top && loop_number > 0) + loop_number = 0; - Arachne::WallToolPathsParams input_params_tmp = input_params; + Arachne::WallToolPathsParams input_params_tmp = input_params; - Polygons last_p = to_polygons(last); - Arachne::WallToolPaths wallToolPaths(last_p, bead_width_0, perimeter_spacing, coord_t(loop_number + 1), - wall_0_inset, layer_height, input_params_tmp); - std::vector perimeters = wallToolPaths.getToolPaths(); - ExPolygons infill_contour = union_ex(wallToolPaths.getInnerContour()); + Polygons last_p = to_polygons(last); + Arachne::WallToolPaths wallToolPaths(last_p, bead_width_0, perimeter_spacing, coord_t(loop_number + 1), + wall_0_inset, layer_height, input_params_tmp); + std::vector perimeters = wallToolPaths.getToolPaths(); + ExPolygons infill_contour = union_ex(wallToolPaths.getInnerContour()); - // Check if there are some remaining perimeters to generate (the number of perimeters - // is greater than one together with enabled the single perimeter on top surface feature). - if (inner_loop_number >= 0) { - assert(upper_slices != nullptr); + // Check if there are some remaining perimeters to generate (the number of perimeters + // is greater than one together with enabled the single perimeter on top surface feature). + if (inner_loop_number >= 0) { + assert(upper_slices != nullptr); - coord_t perimeter_width = this->perimeter_flow.scaled_width(); + coord_t perimeter_width = this->perimeter_flow.scaled_width(); - // Filter out areas that are too thin and expand top surface polygons a bit to hide the wall line. - // ORCA: skip if the top surface area is smaller than "min_width_top_surface" - const float top_surface_min_width = std::max(float(ext_perimeter_spacing) / 4.f + scaled(0.00001), float(scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width)))) / 4.f); + // Filter out areas that are too thin and expand top surface polygons a bit to hide the wall line. + // ORCA: skip if the top surface area is smaller than "min_width_top_surface" + const float top_surface_min_width = std::max(float(ext_perimeter_spacing) / 4.f + scaled(0.00001), float(scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width)))) / 4.f); - // Get top ExPolygons from the given contour. uncovered reports whether the upper layer leaves any of the - // contour uncovered, before bridges and too thin areas are filtered out. - auto get_top_expolygons = [&](const ExPolygons &contour, bool &uncovered) { - // Contour bounding box. - BoundingBox contour_bbox = get_extents(contour); - contour_bbox.offset(SCALED_EPSILON); + // Get top ExPolygons from the given contour. uncovered reports whether the upper layer leaves any of the + // contour uncovered, before bridges and too thin areas are filtered out. + auto get_top_expolygons = [&](const ExPolygons &contour, bool &uncovered) { + // Contour bounding box. + BoundingBox contour_bbox = get_extents(contour); + contour_bbox.offset(SCALED_EPSILON); - Polygons upper_slices_clipped; - if (object_config->interface_shells) { - auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces); - upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, contour_bbox); - } else - upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, contour_bbox); + Polygons upper_slices_clipped; + if (object_config->interface_shells) { + auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces); + upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, contour_bbox); + } else + upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, contour_bbox); - ExPolygons top = diff_ex(contour, upper_slices_clipped); - uncovered = !top.empty(); - if (top.empty()) - return top; + ExPolygons top = diff_ex(contour, upper_slices_clipped); + uncovered = !top.empty(); + if (top.empty()) + return top; - if (lower_slices != nullptr) { - const float bridge_offset = float(std::max(ext_perimeter_spacing, perimeter_width)); - const Polygons lower_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*lower_slices, contour_bbox); - const ExPolygons current_slices_bridges = offset_ex(diff_ex(top, lower_slices_clipped), bridge_offset); + if (lower_slices != nullptr) { + const float bridge_offset = float(std::max(ext_perimeter_spacing, perimeter_width)); + const Polygons lower_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*lower_slices, contour_bbox); + const ExPolygons current_slices_bridges = offset_ex(diff_ex(top, lower_slices_clipped), bridge_offset); - // Remove bridges from top surface polygons. - top = diff_ex(top, current_slices_bridges); + // Remove bridges from top surface polygons. + top = diff_ex(top, current_slices_bridges); + } + + // Shrink the polygon to remove the small areas, then expand it back out plus a maragin to hide the wall line a little. + // ORCA: Expand the polygon with half the perimeter width in addition to the contracted amount, + // not the full perimeter width as PS does, to enable thin lettering to print on the top surface without nozzle collisions + // due to thin lines being generated + top = offset2_ex(top, -top_surface_min_width, top_surface_min_width + float(perimeter_width * 0.85)); + + // Get final top ExPolygons (bridges were excluded above, so they stay walled). + return intersection_ex(top, contour); + }; + + // Walls with the full count, as generated when the single perimeter feature is disabled. Generated on first use. + std::vector full_perimeters; + Polygons full_inner_contour; + bool full_perimeters_generated = false; + auto generate_full_perimeters = [&]() { + if (full_perimeters_generated) + return; + Arachne::WallToolPaths full_tool_paths(last_p, bead_width_0, perimeter_spacing, coord_t(inner_loop_number + 2), wall_0_inset, layer_height, input_params_tmp); + full_perimeters = full_tool_paths.getToolPaths(); + full_inner_contour = full_tool_paths.getInnerContour(); + full_perimeters_generated = true; + }; + + // ORCA: the single wall pass allows Arachne 2 beads across a wall, so it fills a wall narrower than 3 outer wall + // widths by widening both, where the full pass adds a middle bead. Over the top surface that is the intent; + // anywhere else it leaves no room for the inner walls. When the single wall pass's outer walls run away from + // the full pass's outside the top surface, take the full pass's outer walls and the area inside them instead. + // Walls closer than outer_wall_tolerance count as the same wall: a widened bead's centerline moves by half + // the width added, and only beads widened by more than twice the tolerance are looked for. + const coord_t outer_wall_tolerance = bead_width_0 / 10; + if (widest_bead(perimeters) > bead_width_0 + 2 * outer_wall_tolerance) { + // The single wall pass's inner contour where it widens no bead: inside nominal width outer walls. + const ExPolygons nominal_infill_contour = offset_ex(last, -float(bead_width_0 + wall_0_inset)); + bool nominal_uncovered = false; + // Grown by an outer wall width to take in the outer walls bordering the top surface. + const ExPolygons top_zone = offset_ex(get_top_expolygons(nominal_infill_contour, nominal_uncovered), float(bead_width_0)); + if (nominal_uncovered) { + generate_full_perimeters(); + if (! full_perimeters.empty() && ! full_perimeters.front().empty() && + length_off_reference(perimeters, full_perimeters.front(), top_zone, outer_wall_tolerance) > double(perimeter_width)) { + perimeters = { full_perimeters.front() }; + infill_contour = diff_ex(nominal_infill_contour, walls_footprint(full_perimeters.front()), ApplySafetyOffset::Yes); + } + } } - // Shrink the polygon to remove the small areas, then expand it back out plus a maragin to hide the wall line a little. - // ORCA: Expand the polygon with half the perimeter width in addition to the contracted amount, - // not the full perimeter width as PS does, to enable thin lettering to print on the top surface without nozzle collisions - // due to thin lines being generated - top = offset2_ex(top, -top_surface_min_width, top_surface_min_width + float(perimeter_width * 0.85)); + bool uncovered = false; + top_expolygons = get_top_expolygons(infill_contour, uncovered); - // Get final top ExPolygons (bridges were excluded above, so they stay walled). - return intersection_ex(top, contour); - }; + if (uncovered) { + // ORCA: onion the real region (inside the outer wall) so the remaining walls follow the actual + // geometry, then cut away the parts over the top surface. Re-onioning the non-top complement + // instead - the fallback when there is no top fill - walls the top/non-top interface and rings + // top-surface islands with inner walls that don't exist when the feature is disabled. + const bool clip_walls_over_top = top_fill_replaces_inner_walls(*this->config); + const Polygons inner_region = to_polygons(offset_ex(clip_walls_over_top ? infill_contour + : diff_ex(infill_contour, top_expolygons), + wall_0_inset)); + Arachne::WallToolPaths inner_wall_tool_paths(inner_region, perimeter_spacing, perimeter_spacing, coord_t(inner_loop_number + 1), 0, layer_height, input_params_tmp); + std::vector inner_perimeters = inner_wall_tool_paths.getToolPaths(); - // Walls with the full count, as generated when the single perimeter feature is disabled. Generated on first use. - std::vector full_perimeters; - Polygons full_inner_contour; - bool full_perimeters_generated = false; - auto generate_full_perimeters = [&]() { - if (full_perimeters_generated) - return; - Arachne::WallToolPaths full_tool_paths(last_p, bead_width_0, perimeter_spacing, coord_t(inner_loop_number + 2), wall_0_inset, layer_height, input_params_tmp); - full_perimeters = full_tool_paths.getToolPaths(); - full_inner_contour = full_tool_paths.getInnerContour(); - full_perimeters_generated = true; - }; + if (clip_walls_over_top) { + Polygons kept_over_top; + clip_inner_walls_over_top(inner_perimeters, top_expolygons, perimeter_width, kept_over_top); + // Route the top fill around the walls kept despite grazing the top. + if (! kept_over_top.empty()) + top_expolygons = diff_ex(top_expolygons, kept_over_top); + } - // ORCA: the single wall pass allows Arachne 2 beads across a wall, so it fills a wall narrower than 3 outer wall - // widths by widening both, where the full pass adds a middle bead. Over the top surface that is the intent; - // anywhere else it leaves no room for the inner walls. When the single wall pass's outer walls run away from - // the full pass's outside the top surface, take the full pass's outer walls and the area inside them instead. - // Walls closer than outer_wall_tolerance count as the same wall: a widened bead's centerline moves by half - // the width added, and only beads widened by more than twice the tolerance are looked for. - const coord_t outer_wall_tolerance = bead_width_0 / 10; - if (widest_bead(perimeters) > bead_width_0 + 2 * outer_wall_tolerance) { - // The single wall pass's inner contour where it widens no bead: inside nominal width outer walls. - const ExPolygons nominal_infill_contour = offset_ex(last, -float(bead_width_0 + wall_0_inset)); - bool nominal_uncovered = false; - // Grown by an outer wall width to take in the outer walls bordering the top surface. - const ExPolygons top_zone = offset_ex(get_top_expolygons(nominal_infill_contour, nominal_uncovered), float(bead_width_0)); - if (nominal_uncovered) { + // Recalculate indexes of inner perimeters before merging them: they come after the single outer wall. + if (!perimeters.empty()) + for (Arachne::VariableWidthLines &inner_perimeter : inner_perimeters) + for (Arachne::ExtrusionLine &el : inner_perimeter) + ++el.inset_idx; + + perimeters.insert(perimeters.end(), inner_perimeters.begin(), inner_perimeters.end()); + infill_contour = union_ex(top_expolygons, inner_wall_tool_paths.getInnerContour()); + } else { + // There is no top surface ExPolygon, so use the walls generated like when the single perimeter + // feature is disabled. generate_full_perimeters(); - if (! full_perimeters.empty() && ! full_perimeters.front().empty() && - length_off_reference(perimeters, full_perimeters.front(), top_zone, outer_wall_tolerance) > double(perimeter_width)) { - perimeters = { full_perimeters.front() }; - infill_contour = diff_ex(nominal_infill_contour, walls_footprint(full_perimeters.front()), ApplySafetyOffset::Yes); - } + perimeters = std::move(full_perimeters); + infill_contour = union_ex(full_inner_contour); } } + //PS - bool uncovered = false; - top_expolygons = get_top_expolygons(infill_contour, uncovered); + loop_number = int(perimeters.size()) - 1; - if (uncovered) { - // ORCA: onion the real region (inside the outer wall) so the remaining walls follow the actual - // geometry, then cut away the parts over the top surface. Re-onioning the non-top complement - // instead - the fallback when there is no top fill - walls the top/non-top interface and rings - // top-surface islands with inner walls that don't exist when the feature is disabled. - const bool clip_walls_over_top = top_fill_replaces_inner_walls(*this->config); - const Polygons inner_region = to_polygons(offset_ex(clip_walls_over_top ? infill_contour - : diff_ex(infill_contour, top_expolygons), - wall_0_inset)); - Arachne::WallToolPaths inner_wall_tool_paths(inner_region, perimeter_spacing, perimeter_spacing, coord_t(inner_loop_number + 1), 0, layer_height, input_params_tmp); - std::vector inner_perimeters = inner_wall_tool_paths.getToolPaths(); - - if (clip_walls_over_top) { - Polygons kept_over_top; - clip_inner_walls_over_top(inner_perimeters, top_expolygons, perimeter_width, kept_over_top); - // Route the top fill around the walls kept despite grazing the top. - if (! kept_over_top.empty()) - top_expolygons = diff_ex(top_expolygons, kept_over_top); - } - - // Recalculate indexes of inner perimeters before merging them: they come after the single outer wall. - if (!perimeters.empty()) - for (Arachne::VariableWidthLines &inner_perimeter : inner_perimeters) - for (Arachne::ExtrusionLine &el : inner_perimeter) - ++el.inset_idx; - - perimeters.insert(perimeters.end(), inner_perimeters.begin(), inner_perimeters.end()); - infill_contour = union_ex(top_expolygons, inner_wall_tool_paths.getInnerContour()); - } else { - // There is no top surface ExPolygon, so use the walls generated like when the single perimeter - // feature is disabled. - generate_full_perimeters(); - perimeters = std::move(full_perimeters); - infill_contour = union_ex(full_inner_contour); + #ifdef ARACHNE_DEBUG + { + static int iRun = 0; + export_perimeters_to_svg(debug_out_path("arachne-perimeters-%d-%d.svg", layer_id, iRun++), to_polygons(last), perimeters, union_ex(wallToolPaths.getInnerContour())); } - } - //PS + #endif - loop_number = int(perimeters.size()) - 1; + // All closed ExtrusionLine should have the same the first and the last point. + // But in rare cases, Arachne produce ExtrusionLine marked as closed but without + // equal the first and the last point. + assert([&perimeters = std::as_const(perimeters)]() -> bool { + for (const Arachne::VariableWidthLines& perimeter : perimeters) + for (const Arachne::ExtrusionLine& el : perimeter) + if (el.is_closed && el.junctions.front().p != el.junctions.back().p) + return false; + return true; + }()); - #ifdef ARACHNE_DEBUG - { - static int iRun = 0; - export_perimeters_to_svg(debug_out_path("arachne-perimeters-%d-%d.svg", layer_id, iRun++), to_polygons(last), perimeters, union_ex(wallToolPaths.getInnerContour())); - } -#endif + int start_perimeter = int(perimeters.size()) - 1; + int end_perimeter = -1; + int direction = -1; - // All closed ExtrusionLine should have the same the first and the last point. - // But in rare cases, Arachne produce ExtrusionLine marked as closed but without - // equal the first and the last point. - assert([&perimeters = std::as_const(perimeters)]() -> bool { - for (const Arachne::VariableWidthLines& perimeter : perimeters) - for (const Arachne::ExtrusionLine& el : perimeter) - if (el.is_closed && el.junctions.front().p != el.junctions.back().p) - return false; - return true; - }()); - - int start_perimeter = int(perimeters.size()) - 1; - int end_perimeter = -1; - int direction = -1; - - bool is_outer_wall_first = - this->config->wall_sequence == WallSequence::OuterInner || - this->config->wall_sequence == WallSequence::InnerOuterInner; + bool is_outer_wall_first = + this->config->wall_sequence == WallSequence::OuterInner || + this->config->wall_sequence == WallSequence::InnerOuterInner; - if (layer_id == 0){ // disable inner outer inner algorithm after the first layer - is_outer_wall_first = - this->config->wall_sequence == WallSequence::OuterInner || this->outer_walls_first_for_brim(); - } - if (is_outer_wall_first) { - start_perimeter = 0; - end_perimeter = int(perimeters.size()); - direction = 1; - } - - std::vector all_extrusions; - for (int perimeter_idx = start_perimeter; perimeter_idx != end_perimeter; perimeter_idx += direction) { - if (perimeters[perimeter_idx].empty()) - continue; - for (Arachne::ExtrusionLine& wall : perimeters[perimeter_idx]) - all_extrusions.emplace_back(&wall); - } - - // Find topological order with constraints from extrusions_constrains. - std::vector blocked(all_extrusions.size(), 0); // Value indicating how many extrusions it is blocking (preceding extrusions) an extrusion. - std::vector> blocking(all_extrusions.size()); // Each extrusion contains a vector of extrusions that are blocked by this extrusion. - std::unordered_map map_extrusion_to_idx; - for (size_t idx = 0; idx < all_extrusions.size(); idx++) - map_extrusion_to_idx.emplace(all_extrusions[idx], idx); - - auto extrusions_constrains = Arachne::WallToolPaths::getRegionOrder(all_extrusions, is_outer_wall_first); - for (auto [before, after] : extrusions_constrains) { - auto after_it = map_extrusion_to_idx.find(after); - ++blocked[after_it->second]; - blocking[map_extrusion_to_idx.find(before)->second].emplace_back(after_it->second); - } - - std::vector processed(all_extrusions.size(), false); // Indicate that the extrusion was already processed. - Point current_position = all_extrusions.empty() ? Point::Zero() : all_extrusions.front()->junctions.front().p; // Some starting position. - std::vector ordered_extrusions; // To store our result in. At the end we'll std::swap. - ordered_extrusions.reserve(all_extrusions.size()); - - while (ordered_extrusions.size() < all_extrusions.size()) { - size_t best_candidate = 0; - double best_distance_sqr = std::numeric_limits::max(); - bool is_best_closed = false; - - std::vector available_candidates; - for (size_t candidate = 0; candidate < all_extrusions.size(); ++candidate) { - if (processed[candidate] || blocked[candidate]) - continue; // Not a valid candidate. - available_candidates.push_back(candidate); + if (layer_id == 0){ // disable inner outer inner algorithm after the first layer + is_outer_wall_first = + this->config->wall_sequence == WallSequence::OuterInner || this->outer_walls_first_for_brim(); + } + if (is_outer_wall_first) { + start_perimeter = 0; + end_perimeter = int(perimeters.size()); + direction = 1; } - std::sort(available_candidates.begin(), available_candidates.end(), [&all_extrusions](const size_t a_idx, const size_t b_idx) -> bool { - return all_extrusions[a_idx]->is_closed < all_extrusions[b_idx]->is_closed; - }); - - for (const size_t candidate_path_idx : available_candidates) { - auto& path = all_extrusions[candidate_path_idx]; - - if (path->junctions.empty()) { // No vertices in the path. Can't find the start position then or really plan it in. Put that at the end. - if (best_distance_sqr == std::numeric_limits::max()) { - best_candidate = candidate_path_idx; - is_best_closed = path->is_closed; - } + std::vector all_extrusions; + for (int perimeter_idx = start_perimeter; perimeter_idx != end_perimeter; perimeter_idx += direction) { + if (perimeters[perimeter_idx].empty()) continue; + for (Arachne::ExtrusionLine& wall : perimeters[perimeter_idx]) + all_extrusions.emplace_back(&wall); + } + + // Find topological order with constraints from extrusions_constrains. + std::vector blocked(all_extrusions.size(), 0); // Value indicating how many extrusions it is blocking (preceding extrusions) an extrusion. + std::vector> blocking(all_extrusions.size()); // Each extrusion contains a vector of extrusions that are blocked by this extrusion. + std::unordered_map map_extrusion_to_idx; + for (size_t idx = 0; idx < all_extrusions.size(); idx++) + map_extrusion_to_idx.emplace(all_extrusions[idx], idx); + + auto extrusions_constrains = Arachne::WallToolPaths::getRegionOrder(all_extrusions, is_outer_wall_first); + for (auto [before, after] : extrusions_constrains) { + auto after_it = map_extrusion_to_idx.find(after); + ++blocked[after_it->second]; + blocking[map_extrusion_to_idx.find(before)->second].emplace_back(after_it->second); + } + + std::vector processed(all_extrusions.size(), false); // Indicate that the extrusion was already processed. + Point current_position = all_extrusions.empty() ? Point::Zero() : all_extrusions.front()->junctions.front().p; // Some starting position. + std::vector ordered_extrusions; // To store our result in. At the end we'll std::swap. + ordered_extrusions.reserve(all_extrusions.size()); + + while (ordered_extrusions.size() < all_extrusions.size()) { + size_t best_candidate = 0; + double best_distance_sqr = std::numeric_limits::max(); + bool is_best_closed = false; + + std::vector available_candidates; + for (size_t candidate = 0; candidate < all_extrusions.size(); ++candidate) { + if (processed[candidate] || blocked[candidate]) + continue; // Not a valid candidate. + available_candidates.push_back(candidate); } - const Point candidate_position = path->junctions.front().p; - double distance_sqr = (current_position - candidate_position).cast().norm(); - if (distance_sqr < best_distance_sqr) { // Closer than the best candidate so far. - if (path->is_closed || (!path->is_closed && best_distance_sqr != std::numeric_limits::max()) || (!path->is_closed && !is_best_closed)) { - best_candidate = candidate_path_idx; - best_distance_sqr = distance_sqr; - is_best_closed = path->is_closed; + std::sort(available_candidates.begin(), available_candidates.end(), [&all_extrusions](const size_t a_idx, const size_t b_idx) -> bool { + return all_extrusions[a_idx]->is_closed < all_extrusions[b_idx]->is_closed; + }); + + for (const size_t candidate_path_idx : available_candidates) { + auto& path = all_extrusions[candidate_path_idx]; + + if (path->junctions.empty()) { // No vertices in the path. Can't find the start position then or really plan it in. Put that at the end. + if (best_distance_sqr == std::numeric_limits::max()) { + best_candidate = candidate_path_idx; + is_best_closed = path->is_closed; + } + continue; } + + const Point candidate_position = path->junctions.front().p; + double distance_sqr = (current_position - candidate_position).cast().norm(); + if (distance_sqr < best_distance_sqr) { // Closer than the best candidate so far. + if (path->is_closed || (!path->is_closed && best_distance_sqr != std::numeric_limits::max()) || (!path->is_closed && !is_best_closed)) { + best_candidate = candidate_path_idx; + best_distance_sqr = distance_sqr; + is_best_closed = path->is_closed; + } + } + } + + auto& best_path = all_extrusions[best_candidate]; + ordered_extrusions.push_back({ best_path, best_path->is_contour() }); + processed[best_candidate] = true; + for (size_t unlocked_idx : blocking[best_candidate]) + blocked[unlocked_idx]--; + + if (!best_path->junctions.empty()) { //If all paths were empty, the best path is still empty. We don't upate the current position then. + if (best_path->is_closed) + current_position = best_path->junctions[0].p; //We end where we started. + else + current_position = best_path->junctions.back().p; //Pick the other end from where we started. } } - auto& best_path = all_extrusions[best_candidate]; - ordered_extrusions.push_back({ best_path, best_path->is_contour() }); - processed[best_candidate] = true; - for (size_t unlocked_idx : blocking[best_candidate]) - blocked[unlocked_idx]--; + // printf("New Layer: Layer ID %d\n",layer_id); //debug - new layer + if (this->config->wall_sequence == WallSequence::InnerOuterInner && layer_id > 0) { // only enable inner outer inner algorithm after first layer + if (ordered_extrusions.size() > 2) { // 3 walls minimum needed to do inner outer inner ordering + int position = 0; // index to run the re-ordering for multiple external perimeters in a single island. + int arr_i, arr_j = 0; // indexes to run through the walls in the for loops + int outer, first_internal, second_internal, max_internal, current_perimeter; // allocate index values + + // To address any remaining scenarios where the outer perimeter contour is not first on the list as arachne sometimes reorders the perimeters when clustering + // for OI mode that is used the basis for IOI + bringContoursToFront(ordered_extrusions); + std::vector reordered_extrusions; + + // Debug statement to print spacing values: + //printf("External threshold - Ext perimeter: %d Ext spacing: %d Int perimeter: %d Int spacing: %d\n", this->ext_perimeter_flow.scaled_width(),this->ext_perimeter_flow.scaled_spacing(),this->perimeter_flow.scaled_width(), this->perimeter_flow.scaled_spacing()); - if (!best_path->junctions.empty()) { //If all paths were empty, the best path is still empty. We don't upate the current position then. - if (best_path->is_closed) - current_position = best_path->junctions[0].p; //We end where we started. - else - current_position = best_path->junctions.back().p; //Pick the other end from where we started. - } - } - - // printf("New Layer: Layer ID %d\n",layer_id); //debug - new layer - if (this->config->wall_sequence == WallSequence::InnerOuterInner && layer_id > 0) { // only enable inner outer inner algorithm after first layer - if (ordered_extrusions.size() > 2) { // 3 walls minimum needed to do inner outer inner ordering - int position = 0; // index to run the re-ordering for multiple external perimeters in a single island. - int arr_i, arr_j = 0; // indexes to run through the walls in the for loops - int outer, first_internal, second_internal, max_internal, current_perimeter; // allocate index values + // Get searching thresholds. For an external perimeter we take the external perimeter spacing/2 plus the internal perimeter spacing/2 and expand by the factor + // rounding errors. When precise wall is enabled, the external perimeter full spacing is used. + coord_t threshold_external = (apply_precise_outer_wall) + // Precise outer wall: use the full external spacing + ? ( this->ext_perimeter_flow.scaled_spacing() + + this->perimeter_flow.scaled_spacing()/2.0 ) + // Normal: half ext spacing plus half int spacing + : ( this->ext_perimeter_flow.scaled_spacing()/2.0 + + this->perimeter_flow.scaled_spacing()/2.0 ); - // To address any remaining scenarios where the outer perimeter contour is not first on the list as arachne sometimes reorders the perimeters when clustering - // for OI mode that is used the basis for IOI - bringContoursToFront(ordered_extrusions); - std::vector reordered_extrusions; + // For the intenal perimeter threshold, the distance is the internal perimeter spacing expanded by the factor to cover rounding errors. + coord_t threshold_internal = this->perimeter_flow.scaled_spacing(); - // Debug statement to print spacing values: - //printf("External threshold - Ext perimeter: %d Ext spacing: %d Int perimeter: %d Int spacing: %d\n", this->ext_perimeter_flow.scaled_width(),this->ext_perimeter_flow.scaled_spacing(),this->perimeter_flow.scaled_width(), this->perimeter_flow.scaled_spacing()); - - // Get searching thresholds. For an external perimeter we take the external perimeter spacing/2 plus the internal perimeter spacing/2 and expand by the factor - // rounding errors. When precise wall is enabled, the external perimeter full spacing is used. - coord_t threshold_external = (apply_precise_outer_wall) - // Precise outer wall ⇒ use “full external spacing” - ? ( this->ext_perimeter_flow.scaled_spacing() - + this->perimeter_flow.scaled_spacing()/2.0 ) - // Normal ⇒ half ext spacing + half int spacing - : ( this->ext_perimeter_flow.scaled_spacing()/2.0 - + this->perimeter_flow.scaled_spacing()/2.0 ); + // Re-order extrusions based on distance + // Alorithm will aggresively optimise for the appearance of the outermost perimeter + ordered_extrusions = reorderPerimetersByProximity(ordered_extrusions,threshold_external,threshold_internal ); + reordered_extrusions = ordered_extrusions; // copy them into the reordered extrusions vector to allow for IOI operations to be performed below without altering the base ordered extrusions list. - // For the intenal perimeter threshold, the distance is the internal perimeter spacing expanded by the factor to cover rounding errors. - coord_t threshold_internal = this->perimeter_flow.scaled_spacing(); - - // Re-order extrusions based on distance - // Alorithm will aggresively optimise for the appearance of the outermost perimeter - ordered_extrusions = reorderPerimetersByProximity(ordered_extrusions,threshold_external,threshold_internal ); - reordered_extrusions = ordered_extrusions; // copy them into the reordered extrusions vector to allow for IOI operations to be performed below without altering the base ordered extrusions list. - - // Now start the sandwich mode wall re-ordering using the reordered_extrusions as the basis - // scan to find the external perimeter, first internal, second internal and last perimeter in the island. - // We then advance the position index to move to the second island and continue until there are no more - // perimeters left. - while (position < reordered_extrusions.size()) { - outer = first_internal = second_internal = current_perimeter = -1; // initialise all index values to -1 - max_internal = reordered_extrusions.size()-1; // initialise the maximum internal perimeter to the last perimeter on the extrusion list - // run through the walls to get the index values that need re-ordering until the first one for each - // is found. Start at "position" index to enable the for loop to iterate for multiple external - // perimeters in a single island - // printf("Reorder Loop. Position %d, extrusion list size: %d, Outer index %d, inner index %d, second inner index %d\n", position, reordered_extrusions.size(),outer,first_internal,second_internal); - for (arr_i = position; arr_i < reordered_extrusions.size(); ++arr_i) { - // printf("Perimeter: extrusion inset index %d, ordered extrusions array position %d\n",reordered_extrusions[arr_i].extrusion->inset_idx, arr_i); - switch (reordered_extrusions[arr_i].extrusion->inset_idx) { - case 0: // external perimeter - if (outer == -1) - outer = arr_i; - break; - case 1: // first internal wall - if (first_internal==-1 && arr_i>outer && outer!=-1){ - first_internal = arr_i; - } - break; - case 2: // second internal wall - if (second_internal == -1 && arr_i > first_internal && outer!=-1){ - second_internal = arr_i; - } - break; - } - if(outer >-1 && first_internal>-1 && reordered_extrusions[arr_i].extrusion->inset_idx == 0){ // found a new external perimeter after we've found at least a first internal perimeter to re-order. - // This means we entered a new island. - arr_i=arr_i-1; //step back one perimeter - max_internal = arr_i; // new maximum internal perimeter is now this as we have found a new external perimeter, hence a new island. - break; // exit the for loop - } - } - - // printf("Layer ID %d, Outer index %d, inner index %d, second inner index %d, maximum internal perimeter %d \n",layer_id,outer,first_internal,second_internal, max_internal); - if (outer > -1 && first_internal > -1 && second_internal > -1) { // found all three perimeters to re-order? If not the perimeters will be processed outside in. - std::vector inner_outer_extrusions; // temporary array to hold extrusions for reordering - inner_outer_extrusions.resize(max_internal - position + 1); // reserve array containing the number of perimeters before a new island. Variables are array indexes hence need to add +1 to convert to position allocations - // printf("Allocated array size %d, max_internal index %d, start position index %d \n",max_internal-position+1,max_internal,position); - - for (arr_j = max_internal; arr_j >=position; --arr_j){ // go inside out towards the external perimeter (perimeters in reverse order) and store all internal perimeters until the first one identified with inset index 2 - if(arr_j >= second_internal){ - //printf("Inside out loop: Mapped perimeter index %d to array position %d\n", arr_j, max_internal-arr_j); - inner_outer_extrusions[max_internal-arr_j] = reordered_extrusions[arr_j]; - current_perimeter++; + // Now start the sandwich mode wall re-ordering using the reordered_extrusions as the basis + // scan to find the external perimeter, first internal, second internal and last perimeter in the island. + // We then advance the position index to move to the second island and continue until there are no more + // perimeters left. + while (position < reordered_extrusions.size()) { + outer = first_internal = second_internal = current_perimeter = -1; // initialise all index values to -1 + max_internal = reordered_extrusions.size()-1; // initialise the maximum internal perimeter to the last perimeter on the extrusion list + // run through the walls to get the index values that need re-ordering until the first one for each + // is found. Start at "position" index to enable the for loop to iterate for multiple external + // perimeters in a single island + // printf("Reorder Loop. Position %d, extrusion list size: %d, Outer index %d, inner index %d, second inner index %d\n", position, reordered_extrusions.size(),outer,first_internal,second_internal); + for (arr_i = position; arr_i < reordered_extrusions.size(); ++arr_i) { + // printf("Perimeter: extrusion inset index %d, ordered extrusions array position %d\n",reordered_extrusions[arr_i].extrusion->inset_idx, arr_i); + switch (reordered_extrusions[arr_i].extrusion->inset_idx) { + case 0: // external perimeter + if (outer == -1) + outer = arr_i; + break; + case 1: // first internal wall + if (first_internal==-1 && arr_i>outer && outer!=-1){ + first_internal = arr_i; + } + break; + case 2: // second internal wall + if (second_internal == -1 && arr_i > first_internal && outer!=-1){ + second_internal = arr_i; + } + break; + } + if(outer >-1 && first_internal>-1 && reordered_extrusions[arr_i].extrusion->inset_idx == 0){ // found a new external perimeter after we've found at least a first internal perimeter to re-order. + // This means we entered a new island. + arr_i=arr_i-1; //step back one perimeter + max_internal = arr_i; // new maximum internal perimeter is now this as we have found a new external perimeter, hence a new island. + break; // exit the for loop } } + + // printf("Layer ID %d, Outer index %d, inner index %d, second inner index %d, maximum internal perimeter %d \n",layer_id,outer,first_internal,second_internal, max_internal); + if (outer > -1 && first_internal > -1 && second_internal > -1) { // found all three perimeters to re-order? If not the perimeters will be processed outside in. + std::vector inner_outer_extrusions; // temporary array to hold extrusions for reordering + inner_outer_extrusions.resize(max_internal - position + 1); // reserve array containing the number of perimeters before a new island. Variables are array indexes hence need to add +1 to convert to position allocations + // printf("Allocated array size %d, max_internal index %d, start position index %d \n",max_internal-position+1,max_internal,position); - for (arr_j = position; arr_j < second_internal; ++arr_j){ // go outside in and map the remaining perimeters (external and first internal wall(s)) using the outside in wall order - // printf("Outside in loop: Mapped perimeter index %d to array position %d\n", arr_j, current_perimeter+1); - inner_outer_extrusions[++current_perimeter] = reordered_extrusions[arr_j]; + for (arr_j = max_internal; arr_j >=position; --arr_j){ // go inside out towards the external perimeter (perimeters in reverse order) and store all internal perimeters until the first one identified with inset index 2 + if(arr_j >= second_internal){ + //printf("Inside out loop: Mapped perimeter index %d to array position %d\n", arr_j, max_internal-arr_j); + inner_outer_extrusions[max_internal-arr_j] = reordered_extrusions[arr_j]; + current_perimeter++; + } + } + + for (arr_j = position; arr_j < second_internal; ++arr_j){ // go outside in and map the remaining perimeters (external and first internal wall(s)) using the outside in wall order + // printf("Outside in loop: Mapped perimeter index %d to array position %d\n", arr_j, current_perimeter+1); + inner_outer_extrusions[++current_perimeter] = reordered_extrusions[arr_j]; + } + + for(arr_j = position; arr_j <= max_internal; ++arr_j) // replace perimeter array with the new re-ordered array + ordered_extrusions[arr_j] = inner_outer_extrusions[arr_j-position]; } - - for(arr_j = position; arr_j <= max_internal; ++arr_j) // replace perimeter array with the new re-ordered array - ordered_extrusions[arr_j] = inner_outer_extrusions[arr_j-position]; + // go to the next perimeter from the current position to continue scanning for external walls in the same island + position = arr_i + 1; } - // go to the next perimeter from the current position to continue scanning for external walls in the same island - position = arr_i + 1; } } - } - bool steep_overhang_contour = false; - bool steep_overhang_hole = false; - if (!config->overhang_reverse) { - // Skip steep overhang detection no reverse is specified - steep_overhang_contour = true; - steep_overhang_hole = true; - } - if (ExtrusionEntityCollection extrusion_coll = traverse_extrusions(*this, ordered_extrusions, steep_overhang_contour, steep_overhang_hole); !extrusion_coll.empty()) { - if (config->overhang_reverse) { - reorient_perimeters(extrusion_coll, steep_overhang_contour, steep_overhang_hole, - this->config->overhang_reverse_internal_only); + bool steep_overhang_contour = false; + bool steep_overhang_hole = false; + if (!config->overhang_reverse) { + // Skip steep overhang detection no reverse is specified + steep_overhang_contour = true; + steep_overhang_hole = true; + } + if (ExtrusionEntityCollection extrusion_coll = traverse_extrusions(*this, ordered_extrusions, steep_overhang_contour, steep_overhang_hole); !extrusion_coll.empty()) { + if (config->overhang_reverse) { + reorient_perimeters(extrusion_coll, steep_overhang_contour, steep_overhang_hole, + this->config->overhang_reverse_internal_only); + } + defer_unsupported_loops(*this, extrusion_coll); + result.loops = std::move(extrusion_coll); + result.has_loops = true; } - defer_unsupported_loops(*this, extrusion_coll); - this->loops->append(extrusion_coll); - } - const coord_t spacing = (perimeters.size() == 1) ? ext_perimeter_spacing2 : perimeter_spacing; + const coord_t spacing = (perimeters.size() == 1) ? ext_perimeter_spacing2 : perimeter_spacing; - if (offset_ex(infill_contour, -float(spacing / 2.)).empty()) - infill_contour.clear(); // Infill region is too small, so let's filter it out. + if (offset_ex(infill_contour, -float(spacing / 2.)).empty()) + infill_contour.clear(); // Infill region is too small, so let's filter it out. - // create one more offset to be used as boundary for fill - // we offset by half the perimeter spacing (to get to the actual infill boundary) - // and then we offset back and forth by half the infill spacing to only consider the - // non-collapsing regions - coord_t inset = - (loop_number < 0) ? 0 : - (loop_number == 0) ? - // one loop - ext_perimeter_spacing : - // two or more loops? - perimeter_spacing; - coord_t top_inset = inset; + // create one more offset to be used as boundary for fill + // we offset by half the perimeter spacing (to get to the actual infill boundary) + // and then we offset back and forth by half the infill spacing to only consider the + // non-collapsing regions + coord_t inset = + (loop_number < 0) ? 0 : + (loop_number == 0) ? + // one loop + ext_perimeter_spacing : + // two or more loops? + perimeter_spacing; + coord_t top_inset = inset; - top_inset = coord_t(scale_(this->config->top_bottom_infill_wall_overlap.get_abs_value(unscale(inset)))); - if(is_topmost_layer || is_bottom_layer) - inset = coord_t(scale_(this->config->top_bottom_infill_wall_overlap.get_abs_value(unscale(inset)))); - else - inset = coord_t(scale_(this->config->infill_wall_overlap.get_abs_value(unscale(inset)))); + top_inset = coord_t(scale_(this->config->top_bottom_infill_wall_overlap.get_abs_value(unscale(inset)))); + if(is_topmost_layer || is_bottom_layer) + inset = coord_t(scale_(this->config->top_bottom_infill_wall_overlap.get_abs_value(unscale(inset)))); + else + inset = coord_t(scale_(this->config->infill_wall_overlap.get_abs_value(unscale(inset)))); - // simplify infill contours according to resolution - Polygons pp; - for (ExPolygon& ex : infill_contour) - ex.simplify_p(m_scaled_resolution, &pp); - ExPolygons not_filled_exp = union_ex(pp); - // collapse too narrow infill areas - const auto min_perimeter_infill_spacing = coord_t(solid_infill_spacing * (1. - INSET_OVERLAP_TOLERANCE)); + // simplify infill contours according to resolution + Polygons pp; + for (ExPolygon& ex : infill_contour) + ex.simplify_p(m_scaled_resolution, &pp); + ExPolygons not_filled_exp = union_ex(pp); + // collapse too narrow infill areas + const auto min_perimeter_infill_spacing = coord_t(solid_infill_spacing * (1. - INSET_OVERLAP_TOLERANCE)); - ExPolygons infill_exp = offset2_ex( - not_filled_exp, - float(-min_perimeter_infill_spacing / 2.), - float(inset + min_perimeter_infill_spacing / 2.)); - // append infill areas to fill_surfaces - if (!top_expolygons.empty()) { - infill_exp = union_ex(infill_exp, offset_ex(top_expolygons, double(top_inset))); - } - this->fill_surfaces->append(infill_exp, stInternal); - - apply_extra_perimeters(infill_exp); - - // BBS: get the no-overlap infill expolygons - { - ExPolygons polyWithoutOverlap; - polyWithoutOverlap = offset2_ex( + ExPolygons infill_exp = offset2_ex( not_filled_exp, float(-min_perimeter_infill_spacing / 2.), - float(+min_perimeter_infill_spacing / 2.)); - if (!top_expolygons.empty()) - polyWithoutOverlap = union_ex(polyWithoutOverlap, top_expolygons); - this->fill_no_overlap->insert(this->fill_no_overlap->end(), polyWithoutOverlap.begin(), polyWithoutOverlap.end()); - } + float(inset + min_perimeter_infill_spacing / 2.)); + // append infill areas to fill_surfaces + if (!top_expolygons.empty()) { + infill_exp = union_ex(infill_exp, offset_ex(top_expolygons, double(top_inset))); + } + result.infill = std::move(infill_exp); + + // BBS: get the no-overlap infill expolygons + { + ExPolygons polyWithoutOverlap; + polyWithoutOverlap = offset2_ex( + not_filled_exp, + float(-min_perimeter_infill_spacing / 2.), + float(+min_perimeter_infill_spacing / 2.)); + if (!top_expolygons.empty()) + polyWithoutOverlap = union_ex(polyWithoutOverlap, top_expolygons); + result.no_overlap = std::move(polyWithoutOverlap); + } + } + }); + for (ArachneSurfaceResult &result : results) { + if (result.has_loops) + // Moved, not copied: append(const ExtrusionEntity &) clones the whole wall tree of the island. + this->loops->append(std::move(result.loops)); + this->fill_surfaces->append(result.infill, stInternal); + apply_extra_perimeters(result.infill); + append(*this->fill_no_overlap, std::move(result.no_overlap)); } } diff --git a/src/libslic3r/PlaceholderParser.cpp b/src/libslic3r/PlaceholderParser.cpp index 5354e93480..a25cb4492b 100644 --- a/src/libslic3r/PlaceholderParser.cpp +++ b/src/libslic3r/PlaceholderParser.cpp @@ -243,7 +243,7 @@ namespace client struct expr { expr() {} - expr(const expr &rhs) : m_type(rhs.type()), it_range(rhs.it_range) + expr(const expr &rhs) : m_type(rhs.type()), it_range(rhs.it_range), m_deferred(rhs.m_deferred) { if (rhs.type() == TYPE_STRING) m_data.s = new std::string(*rhs.m_data.s); else m_data.set(rhs.m_data); } expr(expr &&rhs) : expr(std::move(rhs), rhs.it_range.begin(), rhs.it_range.end()) {} @@ -258,13 +258,16 @@ namespace client explicit expr(std::string &&s) : m_type(TYPE_STRING) { m_data.s = new std::string(std::move(s)); } explicit expr(const std::string &s, const Iterator &it_begin, const Iterator &it_end) : m_type(TYPE_STRING), it_range(it_begin, it_end) { m_data.s = new std::string(s); } - explicit expr(expr &&rhs, const Iterator &it_begin, const Iterator &it_end) : m_type(rhs.type()), it_range{ it_begin, it_end } + explicit expr(expr &&rhs, const Iterator &it_begin, const Iterator &it_end) : m_type(rhs.type()), it_range{ it_begin, it_end }, m_deferred(rhs.m_deferred) { m_data.set(rhs.m_data); - rhs.m_type = TYPE_EMPTY; + rhs.m_type = TYPE_EMPTY; + rhs.m_deferred = Deferred::None; } expr &operator=(const expr &rhs) { + // set_s() clears m_deferred, which is also rhs.m_deferred on a self-assignment. + const Deferred deferred = rhs.m_deferred; if (rhs.type() == TYPE_STRING) { this->set_s(rhs.s()); } else { @@ -272,6 +275,7 @@ namespace client m_data.set(rhs.m_data); } this->it_range = rhs.it_range; + m_deferred = deferred; return *this; } @@ -281,8 +285,10 @@ namespace client this->reset(); m_type = rhs.type(); this->it_range = rhs.it_range; + m_deferred = rhs.m_deferred; m_data.set(rhs.m_data); rhs.m_type = TYPE_EMPTY; + rhs.m_deferred = Deferred::None; } return *this; } @@ -291,7 +297,8 @@ namespace client { if (this->type() == TYPE_STRING) delete m_data.s; - m_type = TYPE_EMPTY; + m_type = TYPE_EMPTY; + m_deferred = Deferred::None; } ~expr() { reset(); } @@ -304,6 +311,10 @@ namespace client }; Type type() const { return m_type; } bool numeric_type() const { return m_type == TYPE_INT || m_type == TYPE_DOUBLE; } + // A deferred string is either one deferred value or text that contains at least one. + enum class Deferred : unsigned char { None, Value, Text }; + bool deferred() const { return m_deferred != Deferred::None; } + void set_deferred(Deferred deferred) { m_deferred = deferred; } bool& b() { return m_data.b; } bool b() const { return m_data.b; } @@ -323,18 +334,21 @@ namespace client std::string& s() { return *m_data.s; } const std::string& s() const { return *m_data.s; } void set_s(const std::string &s) { + m_deferred = Deferred::None; if (this->type() == TYPE_STRING) *m_data.s = s; else this->set_s_take_ownership(new std::string(s)); } void set_s(std::string &&s) { + m_deferred = Deferred::None; if (this->type() == TYPE_STRING) *m_data.s = std::move(s); else this->set_s_take_ownership(new std::string(std::move(s))); } void set_s(const char *s) { + m_deferred = Deferred::None; if (this->type() == TYPE_STRING) *m_data.s = s; else @@ -478,12 +492,21 @@ namespace client { if (this->type() == TYPE_EMPTY) { // Inside an if / else block to be skipped. + } else if (m_deferred == Deferred::Value && (rhs.type() != TYPE_STRING || rhs.m_deferred == Deferred::Value)) { + // A deferred value added to a number or to another deferred value is meant as a sum. + this->throw_if_deferred(); + } else if (rhs.m_deferred == Deferred::Value && this->type() != TYPE_STRING) { + rhs.throw_if_deferred(); } else if (this->type() == TYPE_STRING) { // Convert the right hand side to string and append. *m_data.s += rhs.to_string(); + if (this->deferred() || rhs.deferred()) + m_deferred = Deferred::Text; } else if (rhs.type() == TYPE_STRING) { // Conver the left hand side to string, append rhs. this->set_s(this->to_string() + rhs.s()); + if (rhs.deferred()) + m_deferred = Deferred::Text; } else { const char *err_msg = L("Cannot add non-numeric types."); this->throw_if_not_numeric(err_msg); @@ -602,6 +625,8 @@ namespace client if (lhs.type() == TYPE_EMPTY) // Inside an if / else block to be skipped return; + lhs.throw_if_deferred(); + rhs.throw_if_deferred(); bool value = false; if (lhs.numeric_type() && rhs.numeric_type()) { // Both types are numeric. @@ -731,6 +756,7 @@ namespace client if (lhs.type() == TYPE_EMPTY) // Inside an if / else block to be skipped return; + lhs.throw_if_deferred(); const std::string *subject = nullptr; if (lhs.type() == TYPE_STRING) { // One type is string, the other could be converted to string. @@ -761,6 +787,7 @@ namespace client if (subject.type() == TYPE_EMPTY) // Inside an if / else block to be skipped return; + subject.throw_if_deferred(); if (subject.type() != TYPE_STRING) subject.throw_exception(L("regex_replace() first parameter must be a string.")); try { @@ -785,6 +812,8 @@ namespace client return; } if (! out.b()) { + match.throw_if_deferred(); + pattern.throw_if_deferred(); if (match.type() != TYPE_STRING) match.throw_exception(L("one_of(): First parameter (the string to match against) has to be a string value")); if (pattern.type() != TYPE_STRING) @@ -818,6 +847,8 @@ namespace client if (lhs.type() == TYPE_EMPTY) // Inside an if / else block to be skipped return; + lhs.throw_if_deferred(); + rhs.throw_if_deferred(); bool value = false; if (lhs.type() == TYPE_BOOL && rhs.type() == TYPE_BOOL) { value = (op == '|') ? (lhs.b() || rhs.b()) : (lhs.b() && rhs.b()); @@ -830,8 +861,16 @@ namespace client static void logical_or (expr &lhs, expr &rhs) { logical_op(lhs, rhs, '|'); } static void logical_and(expr &lhs, expr &rhs) { logical_op(lhs, rhs, '&'); } + static const char* deferred_message() + { + return L("This value is known only after the G-code is generated. It can be printed, but not used in a calculation or a comparison."); + } + + // Reports the deferred message for a type error on a deferred value, since it holds a tag in place of the value. void throw_exception(const char *message) const { + if (this->deferred()) + message = deferred_message(); boost::throw_exception(qi::expectation_failure( this->it_range.begin(), this->it_range.end(), spirit::info(std::string("*") + message))); } @@ -842,11 +881,18 @@ namespace client this->throw_exception(message); } + void throw_if_deferred() const + { + if (this->deferred()) + this->throw_exception(deferred_message()); + } + private: // This object will take ownership of the parameter string object "s". void set_s_take_ownership(std::string* s) { assert(this->type() != TYPE_STRING); Data tmp; tmp.s = s; m_data.set(tmp); m_type = TYPE_STRING; } Type m_type = TYPE_EMPTY; + Deferred m_deferred = Deferred::None; union Data { bool b; @@ -895,6 +941,8 @@ namespace client std::string error_message; // Local variables declared in {if} branches that were not taken, see PlaceholderParser::check_inactive_branches. mutable std::set inactive_local_variables; + // Tags of PlaceholderParser::set_deferred(), matched by value so that a copy in a variable is deferred too. + const std::set *deferred_tags = nullptr; // Table to translate symbol tag to a human readable error message. static std::map tag_to_error_message; @@ -970,6 +1018,18 @@ namespace client } else this->config_local.set_key_value(opt_key, opt.release()); } + void mark_deferred(expr &output) const { + if (output.type() != expr::TYPE_STRING) + return; + expr::Deferred deferred = expr::Deferred::None; + if (deferred_tags != nullptr && output.s().find('@') != std::string::npos) + for (const std::string &tag : *deferred_tags) + if (output.s().find(tag) != std::string::npos) { + deferred = output.s() == tag ? expr::Deferred::Value : expr::Deferred::Text; + break; + } + output.set_deferred(deferred); + } static void legacy_variable_expansion(const MyContext *ctx, IteratorRange &opt_key, std::string &output) { @@ -1430,6 +1490,7 @@ namespace client vector_element_to_expr(ctx, opt, output); else scalar_variable_to_expr(ctx, opt, output); + ctx->mark_deferred(output); } output.it_range = opt.it_range; } @@ -1516,7 +1577,7 @@ namespace client if (ctx->skipping()) { } else if (lhs.opt) { if (lhs.opt->is_vector()) - rhs.throw_exception(L("Cannot assign a scalar value to a vector variable.")); + ctx->throw_exception(L("Cannot assign a scalar value to a vector variable."), rhs.it_range); OptWithPos lhs_opt{ lhs.opt, lhs.it_range, true }; scalar_variable_assign_scalar(ctx, lhs_opt, rhs); } else { @@ -1542,7 +1603,7 @@ namespace client if (ctx->skipping()) { } else if (lhs.opt) { if (lhs.opt->is_scalar()) - rhs_value.throw_exception(L("Cannot assign a vector value to a scalar variable.")); + ctx->throw_exception(L("Cannot assign a vector value to a scalar variable."), rhs_value.it_range); OptWithPos lhs_opt{ lhs.opt, lhs.it_range, true }; vector_variable_assign_expr_with_count(ctx, lhs_opt, rhs_count, rhs_value); } else { @@ -1568,7 +1629,7 @@ namespace client if (! ctx->skipping()) { check_writable(ctx, lhs); if (lhs.opt->is_scalar()) - rhs_value.throw_exception(L("Cannot assign a vector value to a scalar variable.")); + ctx->throw_exception(L("Cannot assign a vector value to a scalar variable."), rhs_value.it_range); vector_variable_assign_expr_with_count(ctx, lhs, rhs_count, rhs_value); } } @@ -1803,10 +1864,21 @@ namespace client static void filament_change(const MyContext* ctx, expr& param) { + if (param.type() == expr::TYPE_EMPTY) + // Inside an if / else block to be skipped + return; MyContext *context = const_cast(ctx); + param.throw_if_deferred(); context->current_extruder_id = param.as_i(); } + // The replacement may put a deferred tag into the result. + static void regex_replace(const MyContext *ctx, expr &subject, IteratorRange &pattern, expr &replacement) + { + expr::regex_replace(subject, pattern, replacement); + ctx->mark_deferred(subject); + } + static void throw_exception(const std::string &msg, const IteratorRange &it_range) { // An asterix is added to the start of the string to differentiate the boost::spirit::info::tag content @@ -2409,7 +2481,7 @@ namespace client | (kw["zdigits"] > '(' > conditional_expression(_r1) [_val = _1] > ',' > conditional_expression(_r1) > optional_parameter(_r1)) [ px::bind(&expr::digits, _val, _2, _3) ] | (kw["regex_replace"] > '(' > conditional_expression(_r1) [_val = _1] > ',' > regular_expression > ',' > conditional_expression(_r1) > ')') - [ px::bind(&expr::regex_replace, _val, _2, _3) ] + [ px::bind(&MyContext::regex_replace, _r1, _val, _2, _3) ] | (kw["int"] > '(' > conditional_expression(_r1) > ')') [ px::bind(&FactorActions::to_int, _1, _val) ] | (kw["round"] > '(' > conditional_expression(_r1) > ')') [ px::bind(&FactorActions::round, _1, _val) ] | (kw["ceil"] > '(' > conditional_expression(_r1) > ')') [ px::bind(&FactorActions::ceil, _1, _val) ] @@ -2614,6 +2686,7 @@ std::string PlaceholderParser::process(const std::string &templ, unsigned int cu context.config = &this->config(); context.config_override = config_override; context.config_outputs = config_outputs; + context.deferred_tags = &m_deferred_tags; context.current_extruder_id = current_extruder_id; context.context_data = context_data; return process_macro(templ, context); diff --git a/src/libslic3r/PlaceholderParser.hpp b/src/libslic3r/PlaceholderParser.hpp index 1ac758267b..c8094011c0 100644 --- a/src/libslic3r/PlaceholderParser.hpp +++ b/src/libslic3r/PlaceholderParser.hpp @@ -60,6 +60,9 @@ public: void set(const std::string &key, double value) { this->set(key, new ConfigOptionFloat(value)); } void set(const std::string &key, const std::vector &values) { this->set(key, new ConfigOptionStrings(values)); } void set(const std::string &key, ConfigOption *opt) { m_config.set_key_value(key, opt); } + // Orca: sets a value known only after the G-code is generated, as a tag that post-processing replaces. + // A template may print it or join it to text, and a calculation or a comparison on it throws. + void set_deferred(const std::string &key, const std::string &tag) { this->set(key, tag); m_deferred_tags.insert(tag); } DynamicConfig& config_writable() { return m_config; } const DynamicConfig& config() const { return m_config; } const ConfigOption* option(const std::string &key) const { return m_config.option(key); } @@ -88,6 +91,7 @@ private: // config has a higher priority than external_config when looking up a symbol. DynamicConfig m_config; const DynamicConfig *m_external_config; + std::set m_deferred_tags; }; } diff --git a/src/libslic3r/Polygon.hpp b/src/libslic3r/Polygon.hpp index 8e7ca2ed91..9c5801985e 100644 --- a/src/libslic3r/Polygon.hpp +++ b/src/libslic3r/Polygon.hpp @@ -34,7 +34,7 @@ public: explicit Polygon(const Points &points) : MultiPoint(points) {} Polygon(std::initializer_list points) : MultiPoint(points) {} Polygon(const Polygon &other) : MultiPoint(other.points) {} - Polygon(Polygon &&other) : MultiPoint(std::move(other.points)) {} + Polygon(Polygon &&other) noexcept : MultiPoint(std::move(other.points)) {} static Polygon new_scale(const std::vector &points) { Polygon pgn; pgn.points.reserve(points.size()); @@ -43,7 +43,7 @@ public: return pgn; } Polygon& operator=(const Polygon &other) { points = other.points; return *this; } - Polygon& operator=(Polygon &&other) { points = std::move(other.points); return *this; } + Polygon& operator=(Polygon &&other) noexcept { points = std::move(other.points); return *this; } Point& operator[](Points::size_type idx) { return this->points[idx]; } const Point& operator[](Points::size_type idx) const { return this->points[idx]; } diff --git a/src/libslic3r/Polyline.hpp b/src/libslic3r/Polyline.hpp index 29c795db33..3b59ab6c4c 100644 --- a/src/libslic3r/Polyline.hpp +++ b/src/libslic3r/Polyline.hpp @@ -26,7 +26,7 @@ class Polyline : public MultiPoint { public: Polyline() {}; Polyline(const Polyline& other) : MultiPoint(other.points), fitting_result(other.fitting_result) {} - Polyline(Polyline &&other) : MultiPoint(std::move(other.points)), fitting_result(std::move(other.fitting_result)) {} + Polyline(Polyline &&other) noexcept : MultiPoint(std::move(other.points)), fitting_result(std::move(other.fitting_result)) {} Polyline(std::initializer_list list) : MultiPoint(list) { fitting_result.clear(); } @@ -47,7 +47,7 @@ public: fitting_result = other.fitting_result; return *this; } - Polyline& operator=(Polyline&& other) { + Polyline& operator=(Polyline&& other) noexcept { points = std::move(other.points); fitting_result = std::move(other.fitting_result); return *this; diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 9135f8fd2e..af8a29d2d1 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -797,7 +797,7 @@ bool Preset::save(DynamicPrintConfig* parent_config) { ConfigOption *opt_src = config.option(option); ConfigOption *opt_dst = temp_config.option(option, true); - if (opt_dst->is_scalar() || !(opt_dst->nullable())) + if (opt_dst->is_scalar() || !(opt_dst->nullable()) || is_filament_extruder_override_key(option)) opt_dst->set(opt_src); else { ConfigOptionVectorBase* opt_vec_src = static_cast(opt_src); @@ -1163,10 +1163,12 @@ static std::vector s_Preset_print_options{ "slicing_mode", "top_shell_layers", "top_shell_thickness", + "top_color_penetration_layers", "top_surface_density", "bottom_surface_density", "bottom_shell_layers", "bottom_shell_thickness", + "bottom_color_penetration_layers", "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", @@ -1183,9 +1185,9 @@ static std::vector s_Preset_print_options{ "is_infill_first", "sparse_infill_density", "fill_multiline", - "tpms_adaptive", - "tpms_interior_density", - "tpms_adaptive_gradient", + "adaptive_infill_mode", + "adaptive_infill_interior_density", + "adaptive_infill_gradient", "gyroid_optimized", "sparse_infill_pattern", "sparse_infill_smooth_factor", @@ -1575,6 +1577,7 @@ static std::vector s_Preset_printer_options { "belt_frame_tilt_decouple", "belt_frame_tilt_angle", "belt_support_floor_offset", "enable_belt_purge_tower", + "bed_exclude_volumes", "bed_exclude_volume_mode", "extruder_bed_exclude_volumes", "gcode_flavor", "gcode_skip_config_block", "fan_kickstart", "part_cooling_fan_min_pwm", "fan_speedup_time", "fan_speedup_overhangs", "single_extruder_multi_material", "manual_filament_change", "file_start_gcode", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "printing_by_object_gcode", "layer_change_gcode", "time_lapse_gcode", "wrapping_detection_gcode", "change_filament_gcode", "change_extrusion_role_gcode", @@ -1582,7 +1585,6 @@ static std::vector s_Preset_printer_options { "printable_height", "extruder_printable_height", "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", "extruder_clearance_dist_to_rod", "nozzle_height", "master_extruder_id", "default_print_profile", "inherits", - "silent_mode", "scan_first_layer", "enable_power_loss_recovery", "wrapping_detection_layers", "wrapping_exclude_area", "machine_load_filament_time", "machine_unload_filament_time", "machine_tool_change_time", "time_cost", "machine_pause_gcode", "template_custom_gcode", "nozzle_type", "nozzle_hrc","auxiliary_fan", "fan_direction", "nozzle_volume","upward_compatible_machine", "z_hop_types", "travel_slope", "retract_lift_enforce","support_chamber_temp_control","support_air_filtration","support_cooling_filter","cooling_filter_enabled","printer_structure","farthest_point_timelapse", "best_object_pos", "head_wrap_detect_zone", @@ -2132,7 +2134,7 @@ Preset* PresetCollection::get_preset_differed_for_save(Preset& preset) { ConfigOption *opt_src = preset.config.option(option); ConfigOption *opt_dst = temp_config.option(option, true); - if (opt_dst->is_scalar() || !(opt_dst->nullable())) + if (opt_dst->is_scalar() || !(opt_dst->nullable()) || is_filament_extruder_override_key(option)) opt_dst->set(opt_src); else { ConfigOptionVectorBase* opt_vec_src = static_cast(opt_src); @@ -2199,9 +2201,12 @@ int PresetCollection::get_differed_values_to_update(Preset& preset, std::map 100%), silently // resurrecting an override the user turned off. See GitHub issue on Retract Before Wipe. if (m_type == Preset::TYPE_FILAMENT) { - for (const std::string& opt_key : filament_extruder_override_keys) { - if (key_values.count(opt_key)) - continue; // already carried by the diff + for (const std::string& opt_key : preset.config.keys()) { + if (!is_filament_extruder_override_key(opt_key) || key_values.count(opt_key)) + continue; // not an override, or already carried by the diff + const ConfigOptionDef *def = print_config_def.get(opt_key); + if (def == nullptr || !def->default_value || def->default_value->is_nil()) + continue; // the option's default is nil too, so an absent key cannot come back as a value const auto* opt_vec = dynamic_cast(preset.config.option(opt_key)); if (opt_vec == nullptr) continue; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index e9f741b890..38c250c0ac 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -61,6 +61,7 @@ #include "BoundingBox.hpp" #include "Brim.hpp" #include "ClipperUtils.hpp" +#include "ExclusionVolumeGeometry.hpp" #include "Extruder.hpp" #include "FilamentMixer.hpp" #include "Flow.hpp" @@ -87,6 +88,7 @@ #include #include #include +#include #include #include #include @@ -127,6 +129,98 @@ template class PrintState; PrintRegion::PrintRegion(const PrintRegionConfig &config) : PrintRegion(config, config.hash()) {} PrintRegion::PrintRegion(PrintRegionConfig &&config) : PrintRegion(std::move(config), config.hash()) {} +static std::vector translated_bed_exclusion_volumes(const Print &print) +{ + std::vector regions = get_bed_excluded_regions(print.config()); + const Point print_origin(scale_(print.get_plate_origin().x()), scale_(print.get_plate_origin().y())); + + for (BedExcludeRegion ®ion : regions) + region.polygon.translate(print_origin); + + return regions; +} + +static std::vector> translated_bed_exclusion_volumes_by_extruder(const Print &print) +{ + std::vector> regions_by_extruder = get_bed_excluded_regions_by_extruder(print.config()); + const Point print_origin(scale_(print.get_plate_origin().x()), scale_(print.get_plate_origin().y())); + for (std::vector ®ions : regions_by_extruder) + for (BedExcludeRegion ®ion : regions) + region.polygon.translate(print_origin); + return regions_by_extruder; +} + +struct BedExclusionCollision +{ + size_t extruder_id; + bool collision_volume; +}; + +static bool intersects_bed_exclusion_purpose( + const ModelInstance &instance, + const std::vector ®ions, + const bool collision_volume) +{ + return std::any_of(regions.begin(), regions.end(), [&](const BedExcludeRegion ®ion) { + return region.is_collision_volume() == collision_volume && + instance.intersects_bed_exclude_region(region); + }); +} + +static std::optional colliding_bed_exclusion( + const Print &print, + const PrintObject &print_object, + const ModelInstance &instance, + const std::vector> ®ions_by_extruder) +{ + if (regions_by_extruder.empty()) + return std::nullopt; + + // The legacy area is shared by every nozzle. Report it with Orca's + // established wording even when opt-in collision volumes coexist. + if (intersects_bed_exclusion_purpose(instance, regions_by_extruder.front(), false)) + return BedExclusionCollision{ 0, false }; + + const bool automatic = is_auto_filament_map_mode(print.get_filament_map_mode()); + if (automatic && print.is_BBL_printer()) { + // Bambu automatic grouping owns the concrete filament assignment and + // the config starts with a non-authoritative [1, 1, ...] seed. Its + // geometric-unprintable input steers individual filaments away from + // colliding nozzles; validation only blocks an object when no nozzle + // can print it. + std::optional first_collision; + for (size_t extruder_id = 0; extruder_id < regions_by_extruder.size(); ++extruder_id) { + if (!intersects_bed_exclusion_purpose(instance, regions_by_extruder[extruder_id], true)) + return std::nullopt; + if (!first_collision.has_value()) + first_collision = extruder_id; + } + return first_collision.has_value() ? + std::optional(BedExclusionCollision{ *first_collision, true }) : std::nullopt; + } + + for (const unsigned int filament_id : print_object.printing_extruders()) { + const int resolved_extruder = bed_exclusion_extruder_for_filament( + filament_id, print.get_filament_maps(), print.get_filament_map_mode(), print.is_BBL_printer(), + true, regions_by_extruder.size()); + if (resolved_extruder < 0) + continue; + const size_t extruder_id = size_t(resolved_extruder); + if (intersects_bed_exclusion_purpose(instance, regions_by_extruder[extruder_id], true)) + return BedExclusionCollision{ extruder_id, true }; + } + return std::nullopt; +} + +static Polygons full_height_bed_exclusion_polygons(const std::vector ®ions) +{ + Polygons out; + for (const BedExcludeRegion ®ion : regions) + if (! region.has_z_range) + out.emplace_back(region.polygon); + return out; +} + //BBS // ORCA: Now this is a parameter //float Print::min_skirt_length = 0; @@ -187,8 +281,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "reduce_crossing_wall", "max_travel_detour_distance", "printable_area", - //BBS: add bed_exclude_area - "bed_exclude_area", "thumbnail_size", "before_layer_change_gcode", "enable_pressure_advance", @@ -212,7 +304,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "extruder_clearance_radius", "nozzle_height", "extruder_colour", - "extruder_offset", "filament_flow_ratio", "reduce_fan_stop_start_freq", "dont_slow_down_outer_wall", @@ -337,13 +428,27 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n }; static std::unordered_set steps_ignore; + static const std::unordered_set steps_exclusion_geometry = { + "bed_exclude_area", + "bed_exclude_volumes", + "bed_exclude_volume_mode", + "extruder_bed_exclude_volumes", + "extruder_offset" + }; std::vector steps; std::vector osteps; bool invalidated = false; for (const t_config_option_key &opt_key : opt_keys) { - if (steps_gcode.find(opt_key) != steps_gcode.end()) { + if (steps_exclusion_geometry.find(opt_key) != steps_exclusion_geometry.end()) { + // Exclusions are consumed while generating brims, support, tree + // support and wipe-tower geometry, not only during final export. + steps.emplace_back(psWipeTower); + steps.emplace_back(psSkirtBrim); + osteps.emplace_back(posSupportMaterial); + osteps.emplace_back(posSimplifySupportPath); + } else if (steps_gcode.find(opt_key) != steps_gcode.end()) { // These options only affect G-code export or they are just notes without influence on the generated G-code, // so there is nothing to invalidate. steps.emplace_back(psGCodeExport); @@ -787,10 +892,8 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print { StringObjectException single_object_exception; const auto& print_config = print.config(); - Polygons exclude_polys = get_bed_excluded_area(print_config); const Vec3d print_origin = print.get_plate_origin(); - std::for_each(exclude_polys.begin(), exclude_polys.end(), - [&print_origin](Polygon& p) { p.translate(scale_(print_origin.x()), scale_(print_origin.y())); }); + const std::vector> exclusion_volumes = translated_bed_exclusion_volumes_by_extruder(print); struct print_instance_info { @@ -841,22 +944,24 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print // Convert the shift from the PrintObject's coordinates into ModelObject's coordinates by removing the centering offset. convex_hull.translate(instance.shift - print_object->center_offset()); } - convex_hull_no_offset.translate(instance.shift - print_object->center_offset()); - //juedge the exclude area - if (!intersection(exclude_polys, convex_hull_no_offset).empty()) { + const std::optional exclusion_collision = colliding_bed_exclusion( + print, *print_object, *instance.model_instance, exclusion_volumes); + if (exclusion_collision.has_value()) { + const std::string collision_message = !exclusion_collision->collision_volume ? + (boost::format(L("%1% is too close to exclusion area. There may be collisions when printing.")) % instance.model_instance->get_object()->name).str() : + is_auto_filament_map_mode(print.get_filament_map_mode()) && print.is_BBL_printer() ? + (boost::format(L("%1% intersects collision volumes for every available extruder.")) % instance.model_instance->get_object()->name).str() : + (boost::format(L("%1% intersects a collision volume for extruder %2%.")) % instance.model_instance->get_object()->name % (exclusion_collision->extruder_id + 1)).str(); if (single_object_exception.string.empty()) { - single_object_exception.string = (boost::format(L("%1% is too close to exclusion area. There may be collisions when printing.")) %instance.model_instance->get_object()->name).str(); + single_object_exception.string = collision_message; // single_object_exception.object = instance.model_instance->get_object(); //ORCA: Pass ModelInstance instead of ModelObject single_object_exception.object = instance.model_instance; } else { - single_object_exception.string += "\n"+(boost::format(L("%1% is too close to exclusion area. There may be collisions when printing.")) %instance.model_instance->get_object()->name).str(); + single_object_exception.string += "\n" + collision_message; single_object_exception.object = nullptr; } - //if (polygons) { - // intersecting_idxs.emplace_back(convex_hulls_other.size()); - //} } // if output needed, collect indices (inside convex_hulls_other) of intersecting hulls @@ -1480,10 +1585,9 @@ static StringObjectException layered_print_cleareance_valid(const Print &print, return {}; const auto& print_config = print.config(); - Polygons exclude_polys = get_bed_excluded_area(print_config); const Vec3d print_origin = print.get_plate_origin(); - std::for_each(exclude_polys.begin(), exclude_polys.end(), - [&print_origin](Polygon& p) { p.translate(scale_(print_origin.x()), scale_(print_origin.y())); }); + const std::vector> exclusion_volumes = translated_bed_exclusion_volumes_by_extruder(print); + const Polygons prime_tower_exclude_polys = full_height_bed_exclusion_polygons(translated_bed_exclusion_volumes(print)); Pointfs wrapping_detection_area = print_config.wrapping_exclude_area.values; Polygon wrapping_poly; @@ -1503,14 +1607,6 @@ static StringObjectException layered_print_cleareance_valid(const Print &print, inst->model_instance->get_scaling_factor(), inst->model_instance->get_mirror())); volume_hull.translate(inst->shift - inst->print_object->center_offset()); - if (!intersection(exclude_polys, volume_hull).empty()) { - // return {inst->model_instance->get_object()->name + L(" is too close to exclusion area, there may be collisions when printing.") + "\n", - // inst->model_instance->get_object()}; - //ORCA: Pass ModelInstance instead of ModelObject - return {(boost::format(L("%1% is too close to exclusion area. There may be collisions when printing.")) % inst->model_instance->get_object()->name).str() + "\n", - inst->model_instance}; - } - if (print_config.enable_wrapping_detection.value && !intersection(wrapping_poly, volume_hull).empty()) { // return {inst->model_instance->get_object()->name + L(" is too close to clumping detection area, there may be collisions when printing.") + "\n", // inst->model_instance->get_object()}; @@ -1520,6 +1616,15 @@ static StringObjectException layered_print_cleareance_valid(const Print &print, } current_instance_hulls.emplace_back(volume_hull); } + if (const std::optional exclusion_collision = colliding_bed_exclusion( + print, *inst->print_object, *inst->model_instance, exclusion_volumes); exclusion_collision.has_value()) { + const std::string message = !exclusion_collision->collision_volume ? + (boost::format(L("%1% is too close to exclusion area. There may be collisions when printing.")) % inst->model_instance->get_object()->name).str() : + is_auto_filament_map_mode(print.get_filament_map_mode()) && print.is_BBL_printer() ? + (boost::format(L("%1% intersects collision volumes for every available extruder.")) % inst->model_instance->get_object()->name).str() : + (boost::format(L("%1% intersects a collision volume for extruder %2%.")) % inst->model_instance->get_object()->name % (exclusion_collision->extruder_id + 1)).str(); + return {message + "\n", inst->model_instance}; + } if (!intersection(convex_hulls_other, current_instance_hulls).empty()) { if (warning) { @@ -1603,13 +1708,13 @@ static StringObjectException layered_print_cleareance_valid(const Print &print, warning->string += L("Prime tower is too close to others, and collisions may be caused.\n"); } } - if (!intersection(exclude_polys, tower_polys_checked).empty()) { + if (!intersection(prime_tower_exclude_polys, tower_polys_checked).empty()) { return {L("Prime tower is too close to an exclusion area, and collisions will be caused.\n")}; } if (print_config.enable_wrapping_detection.value && !intersection({wrapping_poly}, tower_polys_checked).empty()) { return {L("Prime tower is too close to the clumping detection area, and collisions will be caused.\n")}; } - if (warning && !intersection(exclude_polys, tower_polys_estimated).empty()) { + if (warning && !intersection(prime_tower_exclude_polys, tower_polys_estimated).empty()) { warning->string += L("Prime tower is too close to an exclusion area. There may be collisions when printing.") + "\n"; } if (warning && print_config.enable_wrapping_detection.value && !intersection({wrapping_poly}, tower_polys_estimated).empty()) { @@ -3724,7 +3829,11 @@ void Print::process(long long *time_cost_with_cache, bool use_cache) // Orca: Build both the old object-keyed brim map and the per-instance // maps used by skirt/brim groups. m_brimMap.clear(); + m_brimFilamentMap.clear(); m_brimMapByInstance.clear(); + for (const auto& [object_id, filament] : objPrintVec) + if (filament > 0) + m_brimFilamentMap.emplace(object_id, filament - 1); m_first_layer_convex_hull.points.clear(); if (this->has_brim()) { Polygons islands_area; @@ -4152,7 +4261,22 @@ void Print::_make_skirt() } } - auto make_brims_for_skirt_brim_group = [this](const std::vector& group_instances) { + std::vector> brim_exclusion_regions; + if (has_bed_exclude_volumes(m_config)) { + brim_exclusion_regions = translated_bed_exclusion_volumes_by_extruder(*this); + for (std::vector ®ions : brim_exclusion_regions) + regions.erase(std::remove_if(regions.begin(), regions.end(), + [](const BedExcludeRegion ®ion) { return !region.is_collision_volume(); }), regions.end()); + } + const bool has_brim_exclusions = std::any_of( + brim_exclusion_regions.begin(), brim_exclusion_regions.end(), + [](const std::vector ®ions) { return !regions.empty(); }); + const bool has_nozzle_specific_brim_exclusions = has_brim_exclusions && + active_bed_exclude_volume_mode(m_config) != BedExcludeVolumeMode::Shared; + + auto make_brims_for_skirt_brim_group = + [this, &brim_exclusion_regions, has_nozzle_specific_brim_exclusions] + (const std::vector& group_instances) { std::vector brims; std::vector brim_instances; for (const ObjectInstanceID& instance : group_instances) { @@ -4161,10 +4285,31 @@ void Print::_make_skirt() brim_instances.push_back(instance); } + auto brim_filament = [this](const ObjectInstanceID& instance) -> std::optional { + const auto it = m_brimFilamentMap.find(instance.object_id); + return it == m_brimFilamentMap.end() ? std::nullopt : + std::optional(it->second); + }; + auto compatible_brim_nozzles = + [this, &brim_filament, &brim_exclusion_regions, has_nozzle_specific_brim_exclusions] + (const ObjectInstanceID& first, const ObjectInstanceID& second) { + if (!has_nozzle_specific_brim_exclusions) + return true; + const std::optional first_filament = brim_filament(first); + const std::optional second_filament = brim_filament(second); + return first_filament.has_value() && second_filament.has_value() && + bed_exclusion_physical_extruders( + *this, { *first_filament, *second_filament }, + brim_exclusion_regions.size(), 0).size() == 1; + }; + const bool combine_group_brims = m_config.combine_brims && brim_instances.size() > 1; if (!combine_group_brims) { - for (const ObjectInstanceID& instance : brim_instances) - brims.push_back({ m_brimMapByInstance.at(instance), { instance } }); + for (const ObjectInstanceID& instance : brim_instances) { + const std::optional filament = brim_filament(instance); + if (filament.has_value()) + brims.push_back({ m_brimMapByInstance.at(instance), { instance }, *filament }); + } return brims; } @@ -4192,6 +4337,7 @@ void Print::_make_skirt() for (size_t j = i + 1; j < brim_instances.size(); ++j) { const auto area_j = m_objectBrimAreasByInstance.find(brim_instances[j]); if (area_j != m_objectBrimAreasByInstance.end() && + compatible_brim_nozzles(brim_instances[i], brim_instances[j]) && !intersection_ex(offset_ex(area_i->second, brim_contact_distance, jtRound, SCALED_RESOLUTION), area_j->second).empty()) unite_brims(i, j); } @@ -4202,9 +4348,12 @@ void Print::_make_skirt() combined_brim_ids[find_brim_parent(i)].push_back(brim_instances[i]); for (const auto& [_, instances] : combined_brim_ids) { + const std::optional filament = brim_filament(instances.front()); + if (!filament.has_value()) + continue; if (instances.size() == 1) { const ObjectInstanceID& instance = instances.front(); - brims.push_back({ m_brimMapByInstance.at(instance), { instance } }); + brims.push_back({ m_brimMapByInstance.at(instance), { instance }, *filament }); continue; } @@ -4216,8 +4365,26 @@ void Print::_make_skirt() const float brim_cleanup_delta = std::max(scaled_resolution, float(SCALED_EPSILON)); combined_area = offset2_ex(combined_area, brim_cleanup_delta, -brim_cleanup_delta, jtRound, scaled_resolution); + // The group has one known physical nozzle. Clip after union and + // cleanup so the geometry consumed by path generation remains + // valid for the exact filament recorded on the combined brim. + const std::vector physical_extruders = bed_exclusion_physical_extruders( + *this, { *filament }, brim_exclusion_regions.size(), 0); + const coord_t width_spacing_delta = std::max( + 0, brim_flow().scaled_width() - brim_flow().scaled_spacing()); + const coord_t exclusion_clearance = + (width_spacing_delta + 1) / 2 + coord_t(SCALED_EPSILON); + const ExPolygons exclusions = active_bed_exclusion_footprints( + brim_exclusion_regions, physical_extruders, 0.0, + std::max(0.0, skirt_first_layer_height()), Point(0, 0), exclusion_clearance); + if (!exclusions.empty()) + combined_area = diff_ex(combined_area, exclusions); + if (combined_area.empty()) + continue; + Polygons islands_area; - brims.push_back({ makeBrimInfillFromPlateCoordinates(combined_area, *this, islands_area), instances }); + brims.push_back({ makeBrimInfillFromPlateCoordinates(combined_area, *this, islands_area), + instances, *filament }); } return brims; @@ -4289,9 +4456,11 @@ Points Print::first_layer_wipe_tower_corners(bool check_wipe_tower_existance) co Vec2d(pt0.x(),pt0.y()+depth) }; - // Now the stabilization cone. + // Now the stabilization cone, which only a Type2 tower with a cone wall prints. Vec2d center = (pts[0] + pts[2])/2.; - const auto [cone_R, cone_x_scale] = WipeTower2::get_wipe_tower_cone_base(m_config.prime_tower_width, m_wipe_tower_data.height, m_wipe_tower_data.depth, m_config.wipe_tower_cone_angle); + const bool has_cone = wipe_tower_type() == WipeTowerType::Type2 && m_config.wipe_tower_wall_type.value == WipeTowerWallType::wtwCone; + const double cone_angle = has_cone ? m_config.wipe_tower_cone_angle.value : 0.; + const auto [cone_R, cone_x_scale] = WipeTower2::get_wipe_tower_cone_base(m_config.prime_tower_width, m_wipe_tower_data.height, m_wipe_tower_data.depth, cone_angle); double r = cone_R + m_wipe_tower_data.brim_width; for (double alpha = 0.; alpha<2*M_PI; alpha += M_PI/20.) pts.emplace_back(center + r*Vec2d(std::cos(alpha)/cone_x_scale, std::sin(alpha))); @@ -5406,13 +5575,14 @@ void Print::_make_wipe_tower() m_wipe_tower_data.used_filament = wipe_tower.get_used_filament(); m_wipe_tower_data.number_of_toolchanges = wipe_tower.get_number_of_toolchanges(); + // Only a cone wall prints the stabilization cone, whatever cone angle the config holds. + const float cone_angle = config().wipe_tower_wall_type.value == WipeTowerWallType::wtwCone ? + static_cast(config().wipe_tower_cone_angle.value) : 0.f; m_wipe_tower_data.construct_mesh(wipe_tower.width(), wipe_tower.get_depth(), wipe_tower.get_wipe_tower_height(), wipe_tower.get_brim_width(), config().wipe_tower_wall_type.value == WipeTowerWallType::wtwRib, wipe_tower.get_rib_width(), wipe_tower.get_rib_length(), - config().wipe_tower_fillet_wall.value, - config().wipe_tower_wall_type.value == WipeTowerWallType::wtwCone ? - (float) config().wipe_tower_cone_angle.value : 0.f); + config().wipe_tower_fillet_wall.value, cone_angle); const Vec3d origin = Vec3d::Zero(); // FakeWipeTower::pos is a bed-frame translation applied after rotation // (getFakeExtrusionPathsFromWipeTower2 rotates about the local origin), so the @@ -5422,7 +5592,7 @@ void Print::_make_wipe_tower() m_fake_wipe_tower.set_fake_extrusion_data(wipe_tower.position() + m_fake_wipe_tower.rib_offset, wipe_tower.width(), wipe_tower.get_wipe_tower_height(), config().initial_layer_print_height, m_wipe_tower_data.depth, m_wipe_tower_data.z_and_depth_pairs, m_wipe_tower_data.brim_width, - config().wipe_tower_rotation_angle, config().wipe_tower_cone_angle, + config().wipe_tower_rotation_angle, cone_angle, {scale_(origin.x()), scale_(origin.y())}); } @@ -5539,6 +5709,7 @@ void Print::export_gcode_from_previous_file(const std::string& file, GCodeProces // (via ensure_nozzle_group_result), so the multi-nozzle send/monitor mapping survives here. if (result != nullptr && result->nozzle_group_result) processor.initialize_from_context(result->nozzle_group_result); + processor.configure_exclusion_volume_path_check(this->config()); //processor.enable_producers(true); processor.process_file(file); diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 11de1d80e4..8d214da02a 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -12,7 +12,7 @@ #include "PrintBase.hpp" #include "Fill/FillAdaptive.hpp" #include "Fill/FillLightning.hpp" -#include "Fill/FillTpmsAdaptive.hpp" +#include "Fill/AdaptiveInfillField.hpp" #include "BoundingBox.hpp" #include "ExtrusionEntityCollection.hpp" @@ -407,7 +407,7 @@ public: double max_z() const { return m_max_z; } // Centering offset of the sliced mesh from the scaled and rotated mesh of the model. const Point& center_offset() const { return m_center_offset; } - const TpmsRadialField* tpms_radial_field(TpmsAdaptiveMode mode) const { return m_tpms_radial_fields[size_t(mode)].get(); } + const AdaptiveInfillField* adaptive_infill_field(AdaptiveInfillMode mode) const { return m_adaptive_infill_fields[size_t(mode)].get(); } // BBS void generate_support_preview(); @@ -516,6 +516,7 @@ public: // returns 0-based indices of extruders used to print the object (without brim, support and other helper extrusions) std::vector object_extruders() const; + std::vector printing_extruders() const; // Called by make_perimeters() void slice(); @@ -655,7 +656,7 @@ private: FillAdaptive::RegionOctrees prepare_adaptive_infill_data( const std::vector>& surfaces_w_layer) const; FillLightning::GeneratorPtr prepare_lightning_infill_data(); - TpmsRadialFields prepare_tpms_radial_fields() const; + AdaptiveInfillFields prepare_adaptive_infill_fields() const; // BBS SupportNecessaryType is_support_necessary(); @@ -706,7 +707,7 @@ private: FillAdaptive::RegionOctrees m_adaptive_fill_octrees; std::vector m_separated_body_bboxes; FillLightning::GeneratorPtr m_lightning_generator; - TpmsRadialFields m_tpms_radial_fields; + AdaptiveInfillFields m_adaptive_infill_fields; std::vector < VolumeSlices > firstLayerObjSliceByVolume; std::vector firstLayerObjSliceByGroups; @@ -1156,6 +1157,8 @@ public: struct Brim { ExtrusionEntityCollection brim; std::vector instances; + // Zero-based logical filament selected when the brim was planned. + unsigned int filament_id { unsigned(-1) }; }; ExtrusionEntityCollection skirt; @@ -1511,6 +1514,8 @@ private: bool m_has_shared_per_object_skirt { false }; // Orca: Object-keyed brim paths kept for existing code. std::map m_brimMap; + // Zero-based logical filament selected for each object's brim. + std::map m_brimFilamentMap; // Orca: Actual brim paths keyed by object instance. std::map m_brimMapByInstance; // Orca: Translated brim areas keyed by instance, used to find touching brims. diff --git a/src/libslic3r/PrintBase.hpp b/src/libslic3r/PrintBase.hpp index 7e2b17e48f..f3c40102f8 100644 --- a/src/libslic3r/PrintBase.hpp +++ b/src/libslic3r/PrintBase.hpp @@ -70,6 +70,7 @@ public: SlicingNeedSupportOn, SlicingEmptyGcodeLayers, SlicingGcodeOverlap, + SlicingExclusionVolumeToolpath, SlicingPreciseSeamWarning }; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 1d9316e8df..ae05bde2a0 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -10,21 +10,23 @@ #include "FilamentMixer.hpp" #include "MaterialType.hpp" #include "I18N.hpp" -#include "enum_bitmask.hpp" +#include "LocalesUtils.hpp" #include "format.hpp" #include "GCode/Thumbnails.hpp" +#include +#include +#include +#include +#include "enum_bitmask.hpp" #include #include -#include #include #include #include -#include #include #include "libslic3r.h" #include -#include #include #include #include @@ -33,6 +35,8 @@ #include #include #include +#include +#include #include #include #include @@ -119,12 +123,18 @@ const std::vector filament_extruder_override_keys = { }; // Some filament override parameters are generated from filament_extruder_override_keys, -// while filament_retract_length_nc is defined separately. Keep the generator list -// unchanged and use this helper for behavior checks that need the full override set. +// while filament_retract_length_nc and the ironing overrides are defined separately. +// Keep the generator list unchanged and use this helper for behavior checks that need +// the full override set. A nil in one of these keys means the override is disabled, so +// child presets store and load it verbatim instead of treating nil as "inherit". bool is_filament_extruder_override_key(const std::string &opt_key) { return std::find(filament_extruder_override_keys.begin(), filament_extruder_override_keys.end(), opt_key) != filament_extruder_override_keys.end() || - opt_key == "filament_retract_length_nc"; + opt_key == "filament_retract_length_nc" || + opt_key == "filament_ironing_flow" || + opt_key == "filament_ironing_spacing" || + opt_key == "filament_ironing_inset" || + opt_key == "filament_ironing_speed"; } size_t get_extruder_index(const GCodeConfig& config, unsigned int filament_id) @@ -242,6 +252,14 @@ static t_config_enum_values s_keys_map_PowerLossRecoveryMode { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PowerLossRecoveryMode) +// Orca +static t_config_enum_values s_keys_map_ArcFittingMode { + { "disabled", int(ArcFittingMode::Disabled) }, + { "enabled", int(ArcFittingMode::Enabled) }, + { "sparse_infill", int(ArcFittingMode::SparseInfill) } +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ArcFittingMode) + static t_config_enum_values s_keys_map_CenterOfSurfacePattern{ {"each_surface", int(CenterOfSurfacePattern::Each_Surface)}, {"each_model", int(CenterOfSurfacePattern::Each_Model)}, @@ -366,24 +384,24 @@ static t_config_enum_values s_keys_map_SurfaceFillOrder{ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SurfaceFillOrder) //Orca -static t_config_enum_values s_keys_map_TpmsAdaptiveMode{ - { "disabled", int(TpmsAdaptiveMode::Disabled) }, - { "distance_warp", int(TpmsAdaptiveMode::DistanceWarp) }, - { "smooth_blend", int(TpmsAdaptiveMode::SmoothBlend) }, - { "stepped_shells", int(TpmsAdaptiveMode::SteppedShells) }, - { "lobes", int(TpmsAdaptiveMode::Lobes) }, - { "normal_z", int(TpmsAdaptiveMode::NormalZ) }, - { "normal_y", int(TpmsAdaptiveMode::NormalY) }, - { "normal_x", int(TpmsAdaptiveMode::NormalX) }, +static t_config_enum_values s_keys_map_AdaptiveInfillMode{ + { "disabled", int(AdaptiveInfillMode::Disabled) }, + { "distance_warp", int(AdaptiveInfillMode::DistanceWarp) }, + { "smooth_blend", int(AdaptiveInfillMode::SmoothBlend) }, + { "stepped_shells", int(AdaptiveInfillMode::SteppedShells) }, + { "lobes", int(AdaptiveInfillMode::Lobes) }, + { "normal_z", int(AdaptiveInfillMode::NormalZ) }, + { "normal_y", int(AdaptiveInfillMode::NormalY) }, + { "normal_x", int(AdaptiveInfillMode::NormalX) }, }; -CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TpmsAdaptiveMode) +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(AdaptiveInfillMode) -static t_config_enum_values s_keys_map_TpmsAdaptiveGradient{ - { "linear", int(TpmsAdaptiveGradient::Linear) }, - { "quadratic", int(TpmsAdaptiveGradient::Quadratic) }, - { "exponential", int(TpmsAdaptiveGradient::Exponential) }, +static t_config_enum_values s_keys_map_AdaptiveInfillGradient{ + { "linear", int(AdaptiveInfillGradient::Linear) }, + { "quadratic", int(AdaptiveInfillGradient::Quadratic) }, + { "exponential", int(AdaptiveInfillGradient::Exponential) }, }; -CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TpmsAdaptiveGradient) +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(AdaptiveInfillGradient) //BBS static t_config_enum_values s_keys_map_PrintSequence { @@ -721,6 +739,13 @@ static const t_config_enum_values s_keys_map_FilamentMapMode = { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(FilamentMapMode) +static const t_config_enum_values s_keys_map_BedExcludeVolumeMode = { + { "shared", int(BedExcludeVolumeMode::Shared) }, + { "toolhead_offset", int(BedExcludeVolumeMode::ToolheadOffset) }, + { "per_extruder", int(BedExcludeVolumeMode::PerExtruder) } +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(BedExcludeVolumeMode) + // IMEX: keep the legacy hyphenated wire strings so existing presets / 3MFs // deserialize unchanged after the coString -> coEnum migration. static const t_config_enum_values s_keys_map_ImexToolLayout = { @@ -1029,11 +1054,38 @@ void PrintConfigDef::init_common_params() def = this->add("bed_exclude_area", coPoints); def->label = L("Excluded bed area"); def->tooltip = L("Unprintable area in XY plane. For example, X1 Series printers use the front left corner to cut filament during filament change. " - "The area is expressed as polygon by points in following format: \"XxY, XxY, ...\""); + "The area is expressed as a polygon in the format \"XxY, XxY, ...\". It constrains material and model placement, " + "but allows machine travel. Configure toolhead collision volumes separately for G-code checking and travel avoidance."); def->mode = comAdvanced; def->gui_type = ConfigOptionDef::GUIType::one_string; def->set_default_value(new ConfigOptionPoints{ Vec2d(0, 0) }); + def = this->add("bed_exclude_volumes", coString); + def->label = L("Toolhead collision volumes"); + def->tooltip = L("Collision volumes used for model and generated-material exclusion, G-code checking, and travel avoidance. " + "Use \"XxY, XxY, ...\" for a full-height polygon or \"ZMIN..ZMAX;XxY, XxY, ...\" for a Z-limited volume. " + "Separate multiple volumes with \"|\". These volumes are additional to the excluded bed area. " + "Automatic arrangement conservatively uses the bounding box of a non-convex volume."); + def->mode = comAdvanced; + def->gui_type = ConfigOptionDef::GUIType::one_string; + def->set_default_value(new ConfigOptionString()); + + def = this->add("bed_exclude_volume_mode", coEnum); + def->label = L("Collision volume behavior"); + def->tooltip = L("Choose whether all nozzles use the same collision volumes, derive toolhead-relative volumes from each nozzle's XY offset, or configure independent volumes for every extruder. In individual mode, select each extruder on the Extruder page to configure its volumes."); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values = { "shared", "toolhead_offset", "per_extruder" }; + def->enum_labels = { L("Shared"), L("Toolhead-relative (nozzle offsets)"), L("Individual per extruder") }; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionEnum(BedExcludeVolumeMode::Shared)); + + def = this->add("extruder_bed_exclude_volumes", coStrings); + def->label = L("Extruder collision volumes"); + def->tooltip = L("Collision volumes used only by this extruder in individual mode. Use the same polygon and optional Z-range format as the shared collision volumes. Leave empty for no collision volumes on this extruder. Automatic arrangement conservatively uses the bounding box of a non-convex volume."); + def->mode = comAdvanced; + def->gui_type = ConfigOptionDef::GUIType::one_string; + def->set_default_value(new ConfigOptionStrings{ "" }); + def = this->add("bed_custom_texture", coString); def->label = L("Bed custom texture"); def->mode = comAdvanced; @@ -1489,6 +1541,17 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->set_default_value(new ConfigOptionFloat(0.)); + def = this->add("bottom_color_penetration_layers", coInt); + def->label = L("Bottom paint penetration layers"); + def->category = L("Strength"); + def->sidetext = L("layers"); + def->tooltip = L("The number of layers, including the bottom surface layer, that take the color painted on a bottom surface. " + "Set to 0 to use the bottom shell layers. A value larger than the bottom shell also colors the sparse " + "infill above the painted area."); + def->min = 0; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("gap_fill_target", coEnum); def->label = L("Apply gap fill"); def->category = L("Strength"); @@ -3660,7 +3723,7 @@ void PrintConfigDef::init_fff_params() def->max = 10; // Maximum number of lines for infill pattern def->set_default_value(new ConfigOptionInt(1)); - def = this->add("tpms_adaptive", coEnum); + def = this->add("adaptive_infill_mode", coEnum); def->label = L("Adaptive density (experimental)"); def->category = L("Strength"); def->tooltip = L("Grades the Gyroid and TPMS infill inside the object: its cells grow from the surface of the " @@ -3678,7 +3741,7 @@ void PrintConfigDef::init_fff_params() "joined to the rest by a narrower neck, is graded towards its own center.\n" " - Normal Z, Y or X: follows the sections of the object normal to that axis, so the density " "does not change along it."); - def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->enum_values.push_back("disabled"); def->enum_values.push_back("distance_warp"); def->enum_values.push_back("smooth_blend"); @@ -3696,9 +3759,9 @@ void PrintConfigDef::init_fff_params() def->enum_labels.push_back(L("Normal Y")); def->enum_labels.push_back(L("Normal X")); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionEnum(TpmsAdaptiveMode::Disabled)); + def->set_default_value(new ConfigOptionEnum(AdaptiveInfillMode::Disabled)); - def = this->add("tpms_interior_density", coPercent); + def = this->add("adaptive_infill_interior_density", coPercent); def->label = L("Interior density"); def->category = L("Strength"); def->tooltip = L("Density of the adaptive infill at the center of the object."); @@ -3708,7 +3771,7 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionPercent(5)); - def = this->add("tpms_adaptive_gradient", coEnum); + def = this->add("adaptive_infill_gradient", coEnum); def->label = L("Adaptive gradient"); def->category = L("Strength"); def->tooltip = L("How the density changes from the surface to the center of the object.\n" @@ -3717,7 +3780,7 @@ void PrintConfigDef::init_fff_params() "changes faster towards the center.\n" "Exponential: the density changes quickly just below the surface and levels off towards " "the center."); - def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->enum_values.push_back("linear"); def->enum_values.push_back("quadratic"); def->enum_values.push_back("exponential"); @@ -3725,7 +3788,7 @@ void PrintConfigDef::init_fff_params() def->enum_labels.push_back(L("Quadratic")); def->enum_labels.push_back(L("Exponential")); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionEnum(TpmsAdaptiveGradient::Linear)); + def->set_default_value(new ConfigOptionEnum(AdaptiveInfillGradient::Linear)); // Z-buckling bias optimization (experimental). Tightens the gyroid wave along the Z // (vertical) axis at low infill density to shorten the effective column length under @@ -4357,16 +4420,25 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionBool(0)); // BBS - def = this->add("enable_arc_fitting", coBool); + def = this->add("enable_arc_fitting", coEnum); def->label = L("Arc fitting"); - def->tooltip = L("Enable this to get a G-code file which has G2 and G3 moves. " - "The fitting tolerance is same as the resolution.\n\n" - "Note: For Klipper machines, this option is recommended to be disabled. Klipper does not benefit from " - "arc commands as these are split again into line segments by the firmware. This results in a reduction " - "in surface quality as line segments are converted to arcs by the slicer and then back to line segments " - "by the firmware."); + def->tooltip = L("Fit G2 and G3 arc moves to the toolpaths. Walls and surfaces are fitted within the resolution, while " + "sparse infill, supports and the wipe tower use fixed tolerances.\n" + " - Disabled: only straight G1 moves are used.\n" + " - Enabled: arcs are fitted to all toolpaths.\n" + " - Sparse infill only: arcs are fitted to the sparse infill only, which shortens the G-code of " + "curved infill patterns without affecting the walls and surfaces.\n\n" + "Note: For Klipper machines, Disabled is recommended. Klipper splits arcs back into line segments, " + "which lowers the surface quality and can increase the print time."); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.push_back("disabled"); + def->enum_values.push_back("enabled"); + def->enum_values.push_back("sparse_infill"); + def->enum_labels.push_back(L("Disabled")); + def->enum_labels.push_back(L("Enabled")); + def->enum_labels.push_back(L("Sparse infill only")); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionBool(0)); + def->set_default_value(new ConfigOptionEnum(ArcFittingMode::Disabled)); // BBS def = this->add("gcode_add_line_number", coBool); def->label = L("Add line number"); @@ -5229,12 +5301,6 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionString("")); - def = this->add("silent_mode", coBool); - def->label = L("Silent Mode"); - def->tooltip = L("Whether the machine supports silent mode in which machine uses lower acceleration to print more quietly"); - def->mode = comDevelop; - def->set_default_value(new ConfigOptionBool(false)); - def = this->add("emit_machine_limits_to_gcode", coBool); def->label = L("Emit limits to G-code"); def->category = L("Machine limits"); @@ -6453,7 +6519,7 @@ void PrintConfigDef::init_fff_params() def->label = L("Seam gap"); def->category = L("Quality"); def->tooltip = L("In order to reduce the visibility of the seam in a closed loop extrusion, the loop is interrupted and shortened by a specified amount.\n" - "This amount can be specified in millimeters or as a percentage of the current extruder diameter. The default value for this parameter is 10%."); + "This amount can be specified in millimeters or as a percentage of the nozzle diameter. The default value for this parameter is 10%."); def->sidetext = L("mm or %"); def->min = 0; def->mode = comAdvanced; @@ -8079,6 +8145,17 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->set_default_value(new ConfigOptionFloat(0.6)); + def = this->add("top_color_penetration_layers", coInt); + def->label = L("Top paint penetration layers"); + def->category = L("Strength"); + def->sidetext = L("layers"); + def->tooltip = L("The number of layers, including the top surface layer, that take the color painted on a top surface. " + "Set to 0 to use the top shell layers. A value larger than the top shell also colors the sparse " + "infill below the painted area."); + def->min = 0; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("separated_infills", coBool); def->label = L("Separated infills"); def->category = L("Strength"); @@ -9665,6 +9742,12 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va opt_key = "change_filament_gcode"; } else if (opt_key == "bridge_fan_speed") { opt_key = "overhang_fan_speed"; + } else if (opt_key == "tpms_adaptive") { + opt_key = "adaptive_infill_mode"; + } else if (opt_key == "tpms_interior_density") { + opt_key = "adaptive_infill_interior_density"; + } else if (opt_key == "tpms_adaptive_gradient") { + opt_key = "adaptive_infill_gradient"; } else if (opt_key == "infill_extruder" || opt_key == "sparse_infill_filament") { // ORCA: legacy feature-filament selector. Pre-2.4.0-dev these keys were 1-based and the // default value "1" meant "the first/active filament". The current scheme uses a dedicated @@ -9783,6 +9866,13 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va value = "disable"; } } + else if (opt_key == "enable_arc_fitting") { + if (value == "1" || boost::iequals(value, "true")) { + value = "enabled"; + } else if (value == "0" || boost::iequals(value, "false")) { + value = "disabled"; + } + } else if(opt_key == "ensure_vertical_shell_thickness") { if(value == "1") { value = "ensure_all"; @@ -10119,6 +10209,7 @@ std::set printer_extruder_options = { "nozzle_diameter", "default_nozzle_volume_type", "extruder_printable_area", + "extruder_bed_exclude_volumes", "extruder_printable_height", "min_layer_height", "max_layer_height", @@ -12266,7 +12357,8 @@ void DynamicPrintConfig::update_diff_values_to_child_config(DynamicPrintConfig& opt_src->set(opt_target); } else - opt_vec_src->set_only_diff(opt_vec_dest, variant_index, stride); + // An override's nil means "disabled" and is the child's value; every other nil column inherits. + opt_vec_src->set_only_diff(opt_vec_dest, variant_index, stride, is_filament_extruder_override_key(opt)); } } } @@ -12362,6 +12454,25 @@ std::map validate(const FullPrintConfig &cfg, bool und break; } + const bool collision_volumes_enabled = has_bed_exclude_volumes(cfg); + if (cfg.bed_exclude_volume_mode.value != BedExcludeVolumeMode::PerExtruder && + !cfg.bed_exclude_volumes.value.empty() && + !is_valid_bed_exclude_volumes_string(cfg.bed_exclude_volumes.value, cfg.printable_height.value)) { + error_message.emplace("bed_exclude_volumes", L("Invalid collision volume definition.")); + } + if (collision_volumes_enabled && cfg.bed_exclude_volume_mode.value == BedExcludeVolumeMode::ToolheadOffset && + cfg.extruder_offset.size() < cfg.nozzle_diameter.size()) { + error_message.emplace("extruder_offset", L("A nozzle offset is required for every extruder when toolhead-relative collision volumes are enabled.")); + } + if (collision_volumes_enabled && cfg.bed_exclude_volume_mode.value == BedExcludeVolumeMode::PerExtruder) { + for (const std::string &entry : cfg.extruder_bed_exclude_volumes.values) { + if (!is_valid_bed_exclude_volumes_string(entry, cfg.printable_height.value)) { + error_message.emplace("extruder_bed_exclude_volumes", L("Invalid per-extruder collision volume definition.")); + break; + } + } + } + // --perimeters if (cfg.wall_loops.value < 0) { error_message.emplace("wall_loops", _u8L("invalid value ") + std::to_string(cfg.wall_loops.value)); @@ -13320,8 +13431,8 @@ PrintStatisticsConfigDef::PrintStatisticsConfigDef() def->tooltip = L("Total cost of the material wasted on the wipe tower. Calculated from filament_cost value in Filament Settings."); def = this->add("total_wipe_tower_filament", coFloat); - def->label = L("Wipe tower volume"); - def->tooltip = L("Total filament volume extruded on the wipe tower."); + def->label = L("Total wipe tower filament"); + def->tooltip = L("Total length of filament used on the wipe tower, in mm."); def = this->add("used_filament", coFloat); def->label = L("Used filament"); @@ -13487,12 +13598,30 @@ static std::map s_CustomGcodeSpecificP // Machine G-code {"file_start_gcode", {}}, {"machine_start_gcode", {}}, - {"machine_end_gcode", {"layer_num", "layer_z", "max_layer_z", "filament_extruder_id"}}, + {"machine_end_gcode", {"layer_num", "layer_z", "max_layer_z", "filament_extruder_id", + "current_filament_id", "current_extruder_id", "current_nozzle_id", + "nozzle_diameter_at_nozzle_id", "nozzle_volume_types"}}, {"before_layer_change_gcode", {"layer_num", "layer_z", "max_layer_z"}}, - {"layer_change_gcode", {"layer_num", "layer_z", "max_layer_z"}}, - {"timelapse_gcode", {"layer_num", "layer_z", "max_layer_z"}}, - {"change_filament_gcode", {"layer_num", "layer_z", "max_layer_z", "next_extruder", "previous_extruder", "fan_speed", + {"layer_change_gcode", {"layer_num", "layer_z", "max_layer_z", "most_used_physical_extruder_id", + "current_filament_id", "current_nozzle_id", "curr_y_acceleration_limit", + "curr_accumulated_mass", "curr_layer_mass"}}, + {"time_lapse_gcode", {"layer_num", "layer_z", "max_layer_z", "most_used_physical_extruder_id", + "curr_physical_extruder_id", "timelapse_pos_x", "timelapse_pos_y", + "has_timelapse_safe_pos", "timelapse_inline_photo", + "farthest_point_timelapse_enabled", "clear_to_x0"}}, + {"wrapping_detection_gcode", {"layer_num", "layer_z", "max_layer_z", "most_used_physical_extruder_id", + "curr_physical_extruder_id"}}, + {"change_filament_gcode", {"layer_num", "layer_z", "max_layer_z", "next_extruder", "previous_extruder", + "current_hotend", "next_hotend", "current_nozzle_id", "next_nozzle_id", + "current_filament_id", "next_filament_id", "old_extruder_variant", "new_extruder_variant", + "nozzle_diameter_at_nozzle_id", "nozzle_volume_types", "filament_retract_length_nc", + "new_extruder_retracted_length", "outer_wall_volumetric_speed", "fan_speed", "first_flush_volume", "flush_length_1", "flush_length_2", "flush_length_3", "flush_length_4", + "flush_length", "flush_volumetric_speeds", "flush_temperatures", "filament_cooling_before_tower", + "wipe_avoid_perimeter", "wipe_avoid_pos_x", "is_prime_tower_interface", + "filament_tower_interface_purge_volume", "filament_tower_interface_print_temp", + "wipe_tower_center_pos_x", "wipe_tower_center_pos_y", "wipe_tower_center_pos_valid", + "temperature", "nozzle_temperature", "first_layer_temperature", "nozzle_temperature_initial_layer", "new_filament_e_feedrate", "new_filament_temp", "new_retract_length", "new_retract_length_toolchange", "old_filament_e_feedrate", "old_filament_temp", "old_retract_length", "old_retract_length_toolchange", "relative_e_axis", "second_flush_volume", "toolchange_count", "toolchange_z", @@ -13505,8 +13634,18 @@ static std::map s_CustomGcodeSpecificP {"machine_pause_gcode", {}}, {"template_custom_gcode", {}}, // Filament G-code - {"filament_start_gcode", {"filament_extruder_id"}}, - {"filament_end_gcode", {"layer_num", "layer_z", "max_layer_z", "filament_extruder_id"}}, + {"filament_start_gcode", {"layer_num", "layer_z", "max_layer_z", "filament_extruder_id", + "current_filament_id", "current_extruder_id", "current_nozzle_id", + "nozzle_diameter_at_nozzle_id", "nozzle_volume_types", + "retraction_distance_when_cut", "long_retraction_when_cut", + "temperature", "nozzle_temperature", "first_layer_temperature", + "nozzle_temperature_initial_layer"}}, + {"filament_end_gcode", {"layer_num", "layer_z", "max_layer_z", "filament_extruder_id", + "current_filament_id", "current_extruder_id", "current_nozzle_id", + "nozzle_diameter_at_nozzle_id", "nozzle_volume_types", + "retraction_distance_when_cut", "long_retraction_when_cut", + "temperature", "nozzle_temperature", "first_layer_temperature", + "nozzle_temperature_initial_layer"}}, }; const std::map& custom_gcode_specific_placeholders() @@ -13521,7 +13660,8 @@ CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef() // Common Defs def = this->add("layer_num", coInt); def->label = L("Layer number"); - def->tooltip = L("Index of the current layer. Zero-based (i.e. first layer is number 0), except in extrusion role change G-code, where it is one-based."); + def->tooltip = L("Index of the current layer. The index is zero-based (first layer has index 0). Before the first " + "layer starts, it is -1. In extrusion role change G-code, the index is one-based (first layer has index 1)."); def = this->add("layer_z", coFloat); def->label = L("Layer Z"); @@ -13533,13 +13673,50 @@ CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef() def = this->add("filament_extruder_id", coInt); def->label = L("Filament extruder ID"); - def->tooltip = L("The current extruder ID. The same as current_extruder."); + def->tooltip = L("In filament start G-code, the index of the filament that is being loaded. In filament end G-code, " + "the index of the filament that is being unloaded. The index is zero-based (first filament has " + "index 0). At a tool change, filament end G-code gets the extruder index instead, unless the Type 1 " + "wipe tower does the tool change. Machine end G-code gets the value from the last filament end " + "G-code at the end of the print."); + + new_def("current_filament_id", coInt, L("Current filament ID"), L("Index of the currently active filament. The index is zero-based (first filament has index 0).")); + new_def("current_extruder_id", coInt, L("Current extruder ID"), L("Index of the currently active physical extruder. The index is zero-based (first extruder has index 0).")); + new_def("current_nozzle_id", coInt, L("Current nozzle ID"), L("Index of the currently active nozzle. The index is zero-based (first nozzle has index 0).")); + new_def("nozzle_diameter_at_nozzle_id", coFloats, L("Nozzle diameters"), L("Nozzle diameters indexed by nozzle ID.")); + new_def("nozzle_volume_types", coStrings, L("Nozzle volume types"), L("Nozzle volume variants indexed by nozzle ID.")); + new_def("retraction_distance_when_cut", coFloat, L("Retraction distance when cut"), L("Retraction distance used when cutting filament.")); + new_def("long_retraction_when_cut", coBool, L("Long retraction when cut"), L("Whether long retraction is used when cutting filament.")); + +// layer_change_gcode + new_def("most_used_physical_extruder_id", coInt, L("Most-used physical extruder ID"), L("Index of the physical extruder used most often on the current layer. The index is zero-based (first extruder has index 0).")); + new_def("curr_y_acceleration_limit", coFloat, L("Current Y acceleration limit"), L("Current Y-axis acceleration limit after the bed-mass adjustment.")); + new_def("curr_accumulated_mass", coFloat, L("Current accumulated mass"), L("Accumulated printed mass at the current layer.")); + new_def("curr_layer_mass", coFloat, L("Current layer mass"), L("Printed mass of the previous layer.")); + +// time_lapse_gcode + new_def("curr_physical_extruder_id", coInt, L("Current physical extruder ID"), L("Index of the physical extruder active for the current layer. The index is zero-based (first extruder has index 0).")); + new_def("timelapse_pos_x", coInt, L("Timelapse position X"), L("Selected X position for timelapse capture.")); + new_def("timelapse_pos_y", coInt, L("Timelapse position Y"), L("Selected Y position for timelapse capture.")); + new_def("has_timelapse_safe_pos", coBool, L("Has timelapse safe position"), L("Whether a safe timelapse position was found.")); + new_def("timelapse_inline_photo", coBool, L("Timelapse inline photo"), L("Whether the timelapse photo is captured at the inline position.")); + new_def("farthest_point_timelapse_enabled", coBool, L("Farthest-point timelapse enabled"), L("Whether farthest-point timelapse positioning is active.")); + new_def("clear_to_x0", coBool, L("Clear to X0"), L("Whether the timelapse move is clear to X0.")); // change_filament_gcode - new_def("previous_extruder", coInt, L("Previous extruder"), L("Index of the extruder that is being unloaded. The index is zero based (first extruder has index 0).")); - new_def("next_extruder", coInt, L("Next extruder"), L("Index of the extruder that is being loaded. The index is zero based (first extruder has index 0).")); + new_def("previous_extruder", coInt, L("Previous extruder"), L("Index of the filament that is being unloaded. The index is zero-based (first filament has index 0). At the start of the print, when no filament is loaded yet, it is -1.")); + new_def("next_extruder", coInt, L("Next extruder"), L("Index of the filament that is being loaded. The index is zero-based (first filament has index 0).")); + new_def("current_hotend", coInt, L("Current hotend"), L("Zero-based extruder index of the outgoing filament. On Bambu printers it is -1, or the nozzle ID when a filament moves between nozzles across layers.")); + new_def("next_hotend", coInt, L("Next hotend"), L("Zero-based extruder index of the incoming filament. On Bambu printers it is -1, or the nozzle ID when a filament moves between nozzles across layers.")); + new_def("next_nozzle_id", coInt, L("Next nozzle ID"), L("Index of the nozzle associated with the incoming filament. The index is zero-based (first nozzle has index 0).")); + new_def("next_filament_id", coInt, L("Next filament ID"), L("Index of the incoming filament. The index is zero-based (first filament has index 0).")); + new_def("old_extruder_variant", coString, L("Old extruder variant"), L("Nozzle-volume variant of the outgoing extruder.")); + new_def("new_extruder_variant", coString, L("New extruder variant"), L("Nozzle-volume variant of the incoming extruder.")); + new_def("filament_retract_length_nc", coFloat, L("Filament nozzle-change retract length"), L("Nozzle-change retraction length of the outgoing filament.")); + new_def("new_extruder_retracted_length", coFloat, L("New extruder retracted length"), L("Currently parked retraction length of the incoming extruder.")); + new_def("outer_wall_volumetric_speed", coFloat, L("Outer wall volumetric speed"), L("Volumetric speed used for the outer wall.")); new_def("relative_e_axis", coBool, L("Relative e-axis"), L("Indicates if relative positioning is being used.")); new_def("toolchange_count", coInt, L("Toolchange count"), L("The number of toolchanges throughout the print.")); + new_def("toolchange_z", coFloat, L("Toolchange Z"), L("The Z position during the toolchange.")); new_def("fan_speed", coNone, "", ""); //Option is no longer used and is zeroed by placeholder parser for compatability new_def("old_retract_length", coFloat, L("Old retract length"), L("The retraction length of the previous filament.")); new_def("new_retract_length", coFloat, L("New retract length"), L("The retraction length of the new filament.")); @@ -13564,6 +13741,22 @@ CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef() new_def("flush_length_2", coFloat, L("Flush Length 2"), L("The second flush length.")); new_def("flush_length_3", coFloat, L("Flush Length 3"), L("The third flush length.")); new_def("flush_length_4", coFloat, L("Flush Length 4"), L("The fourth flush length.")); + new_def("flush_length", coFloat, L("Flush length"), L("Total flush length.")); + new_def("flush_volumetric_speeds", coFloats, L("Flush volumetric speeds"), L("Flush volumetric speeds for each filament.")); + new_def("flush_temperatures", coInts, L("Flush temperatures"), L("Flush temperatures for each filament.")); + new_def("filament_cooling_before_tower", coFloats, L("Filament cooling before tower"), L("Temperature drop before entering filament tower")); + new_def("wipe_avoid_perimeter", coBool, L("Avoid wipe perimeter"), L("Whether travel should avoid the wipe perimeter.")); + new_def("wipe_avoid_pos_x", coFloat, L("Wipe avoidance X"), L("X position used to avoid the wipe area.")); + new_def("is_prime_tower_interface", coBool, L("Prime tower interface"), L("Whether the current purge is for a prime-tower interface.")); + new_def("filament_tower_interface_purge_volume", coFloat, L("Interface layer purge length"), L("Purge length for prime tower interface layer (where different materials meet).")); + new_def("filament_tower_interface_print_temp", coInt, L("Filament tower interface print temperature"), L("Print temperature used for the filament tower interface.")); + new_def("wipe_tower_center_pos_x", coFloat, L("Wipe tower center X"), L("X coordinate of the nozzle's wipe-tower wait position, 2 mm outside the tower edge.")); + new_def("wipe_tower_center_pos_y", coFloat, L("Wipe tower center Y"), L("Y coordinate of the nozzle's wipe-tower wait position.")); + new_def("wipe_tower_center_pos_valid", coBool, L("Wipe tower center position valid"), L("Whether the print has a wipe tower.")); + new_def("temperature", coInts, L("Temperature"), L("Nozzle temperatures indexed by filament.")); + new_def("nozzle_temperature", coInts, L("Nozzle temperature"), L("Nozzle temperatures indexed by filament.")); + new_def("first_layer_temperature", coInts, L("First layer temperature"), L("First-layer nozzle temperatures indexed by filament.")); + new_def("nozzle_temperature_initial_layer", coInts, L("Nozzle temperature initial layer"), L("First-layer nozzle temperatures indexed by filament.")); // change_extrusion_role_gcode // The whole tooltip is one literal so that the GUI can look it up in the catalog. @@ -13661,31 +13854,513 @@ Points get_bed_shape(const PrintConfig &cfg, bool use_share) Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(make_counter_clockwise(cfg.printable_area.values)); } -Polygons get_bed_excluded_area(const PrintConfig& cfg) +namespace { + +static bool looks_like_bed_exclusion_volume_syntax(const std::string &value) { - const Pointfs exclude_area_points = cfg.bed_exclude_area.values; + return value.find('|') != std::string::npos || (value.find("..") != std::string::npos && value.find(';') != std::string::npos); +} - // Belt printer: project exclusion zone points from the belt surface to machine-frame XY. - // On the belt surface Z=0, so the in-plane axis foreshortens by cos(tilt). The tilt - // axis decides which bed axis foreshortens: tilt about X (belt along Y) scales Y, - // tilt about Y (belt along X) scales X. Derived from belt_slice_rotation. - const bool is_belt = cfg.belt_printer.value; - const auto tilt = BeltTransformPipeline::physical_tilt( - cfg.belt_slice_rotation.value, cfg.belt_slice_rotation_angle.value); - const double cos_x = is_belt ? std::cos(Geometry::deg2rad(tilt.tilt_x_deg)) : 1.0; // foreshortens Y - const double cos_y = is_belt ? std::cos(Geometry::deg2rad(tilt.tilt_y_deg)) : 1.0; // foreshortens X +static bool parse_double_token(const std::string &text, double &out) +{ + std::string token = text; + boost::trim(token); + if (token.empty()) + return false; - Polygon exclude_poly; - for (int i = 0; i < exclude_area_points.size(); i++) { - auto pt = exclude_area_points[i]; - double x = is_belt ? pt.x() * cos_y : pt.x(); - double y = is_belt ? pt.y() * cos_x : pt.y(); - exclude_poly.points.emplace_back(scale_(x), scale_(y)); + size_t parsed = 0; + out = string_to_double_decimal_point(token, &parsed); + return parsed == token.size() && std::isfinite(out); +} + +static bool parse_z_range_token( + const std::string &token_in, + const double printable_height, + double &z_min, + double &z_max, + bool &has_z) +{ + std::string token = token_in; + boost::trim(token); + if (token.empty()) + return false; + + size_t range_pos = token.find(".."); + if (range_pos == std::string::npos) + return false; + + std::string min_token = token.substr(0, range_pos); + std::string max_token = token.substr(range_pos + 2); + boost::trim(min_token); + boost::trim(max_token); + + double parsed_min = 0.0; + double parsed_max = printable_height; + if (! min_token.empty() && ! parse_double_token(min_token, parsed_min)) + return false; + if (! max_token.empty() && ! parse_double_token(max_token, parsed_max)) + return false; + + z_min = std::clamp(parsed_min, 0.0, printable_height); + z_max = std::clamp(parsed_max, 0.0, printable_height); + has_z = true; + // A range wholly outside the printable height clamps to a plane, which is + // not a volume and must not participate in conservative unknown-Z checks. + return z_min < z_max; +} + +static std::optional parse_exclude_polygon_points(const std::string &points_str) +{ + Pointfs points; + std::vector point_tokens; + boost::split(point_tokens, points_str, boost::is_any_of(",")); + points.reserve(point_tokens.size()); + for (std::string point_token : point_tokens) { + boost::trim(point_token); + const size_t separator = point_token.find('x'); + if (separator == std::string::npos || point_token.find('x', separator + 1) != std::string::npos) + return std::nullopt; + + double x = 0.0; + double y = 0.0; + if (!parse_double_token(point_token.substr(0, separator), x) || + !parse_double_token(point_token.substr(separator + 1), y) || + !std::isfinite(x) || !std::isfinite(y)) + return std::nullopt; + points.emplace_back(x, y); + } + if (points.size() < 3) + return std::nullopt; + + Polygon polygon; + polygon.points.reserve(points.size()); + for (const Vec2d &pt : points) + polygon.points.emplace_back(scale_(pt.x()), scale_(pt.y())); + if (polygon.area() == 0.0) + return std::nullopt; + polygon.make_counter_clockwise(); + return polygon; +} + +static void append_legacy_bed_exclude_regions( + std::vector &out, + const Pointfs &legacy_points, + const double printable_height) +{ + if (legacy_points.size() < 3) + return; + + Polygon polygon; + polygon.points.reserve(legacy_points.size()); + for (const Vec2d &pt : legacy_points) + polygon.points.emplace_back(scale_(pt.x()), scale_(pt.y())); + polygon.make_counter_clockwise(); + + out.push_back({ std::move(polygon), 0.0, printable_height, + BedExcludeRegion::Purpose::MaterialKeepout, false }); +} + +static void append_bed_exclusion_volume_regions( + std::vector &out, + const std::string ®ion_specs_raw, + const double printable_height) +{ + std::vector region_specs; + boost::split(region_specs, region_specs_raw, boost::is_any_of("|\n")); + + for (const std::string &spec_raw : region_specs) { + std::string spec = spec_raw; + boost::trim(spec); + if (spec.empty()) + continue; + + std::vector fields; + boost::split(fields, spec, boost::is_any_of(";")); + + double z_min = 0.0; + double z_max = printable_height; + bool has_z_range = false; + std::string points_field; + bool invalid_z = false; + + for (std::string field : fields) { + boost::trim(field); + if (field.empty()) + continue; + + bool parsed_z_range = parse_z_range_token(field, printable_height, z_min, z_max, has_z_range); + if (parsed_z_range) + continue; + + if (field.find("..") != std::string::npos && field.find('x') == std::string::npos) { + invalid_z = true; + break; + } + + if (boost::algorithm::istarts_with(field, "points=")) + field = field.substr(std::string("points=").size()); + else if (boost::algorithm::istarts_with(field, "polygon=")) + field = field.substr(std::string("polygon=").size()); + + points_field = field; + } + + if (invalid_z) + continue; + + if (! has_z_range) { + z_min = 0.0; + z_max = printable_height; + } + + if (z_min >= z_max) + continue; + + std::optional polygon = parse_exclude_polygon_points(points_field); + if (! polygon) + continue; + + out.push_back({ std::move(*polygon), z_min, z_max, + BedExcludeRegion::Purpose::CollisionVolume, has_z_range }); + } +} + +static bool has_nonempty_string(const std::string &value) +{ + return std::any_of(value.begin(), value.end(), [](const char c) { return !std::isspace(static_cast(c)); }); +} + +static bool collision_volumes_configured( + const std::string &shared_specs, + const BedExcludeVolumeMode mode, + const std::vector &per_extruder_specs) +{ + if (mode == BedExcludeVolumeMode::PerExtruder) + return std::any_of(per_extruder_specs.begin(), per_extruder_specs.end(), has_nonempty_string); + return has_nonempty_string(shared_specs); +} + +static std::vector parse_master_bed_excluded_regions( + const Pointfs &legacy_points, + const std::string &shared_specs, + const bool use_collision_volumes, + const BedExcludeVolumeMode mode, + const double printable_height) +{ + std::vector regions; + const double height = std::max(0.0, printable_height); + // Legacy excluded areas remain a shared material/placement keep-out even + // when collision volumes are configured. Collision volumes add constraints; + // they do not silently remove the printer profile's established area. + append_legacy_bed_exclude_regions(regions, legacy_points, height); + if (use_collision_volumes && mode != BedExcludeVolumeMode::PerExtruder) + append_bed_exclusion_volume_regions(regions, shared_specs, height); + return regions; +} + +static void project_bed_material_keepouts(std::vector ®ions, const ConfigBase &cfg) +{ + const auto *belt = cfg.option("belt_printer"); + if (belt == nullptr || !belt->value) + return; + + const auto *axis = cfg.option>("belt_slice_rotation"); + const auto *angle = cfg.option("belt_slice_rotation_angle"); + if (axis == nullptr || angle == nullptr) + return; + + const auto tilt = BeltTransformPipeline::physical_tilt(axis->value, angle->value); + const double cos_x = std::cos(Geometry::deg2rad(tilt.tilt_x_deg)); + const double cos_y = std::cos(Geometry::deg2rad(tilt.tilt_y_deg)); + // Resolve bed-surface coordinates once, before any placement or tower + // consumer sees them. Collision volumes already use model coordinates. + for (BedExcludeRegion ®ion : regions) + if (!region.is_collision_volume()) + for (Point &point : region.polygon.points) + point = Point(scale_(unscale(point.x()) * cos_y), scale_(unscale(point.y()) * cos_x)); +} + +static std::vector resolve_bed_excluded_regions( + const std::vector &master_regions, + const BedExcludeVolumeMode mode, + const std::vector &per_extruder_specs, + const std::vector &extruder_offsets, + const size_t reference_extruder, + const size_t extruder_id, + const double printable_height) +{ + if (mode == BedExcludeVolumeMode::Shared) + return master_regions; + + if (mode == BedExcludeVolumeMode::PerExtruder) { + std::vector regions = master_regions; + if (extruder_id < per_extruder_specs.size()) + append_bed_exclusion_volume_regions( + regions, per_extruder_specs[extruder_id], std::max(0.0, printable_height)); + return regions; } - exclude_poly.make_counter_clockwise(); + std::vector regions = master_regions; + if (extruder_id >= extruder_offsets.size() || extruder_offsets.empty()) + return regions; - return {exclude_poly}; + const size_t clamped_reference = std::min(reference_extruder, extruder_offsets.size() - 1); + // A model-space point is emitted as model_position - extruder_offset. Therefore a + // carriage/toolhead obstacle described through the reference nozzle appears in another + // nozzle's model space translated by (other_offset - reference_offset). + const Vec2d delta = extruder_offsets[extruder_id] - extruder_offsets[clamped_reference]; + const Point translation(scale_(delta.x()), scale_(delta.y())); + for (BedExcludeRegion ®ion : regions) { + // Toolhead-relative offsets apply only to opt-in collision volumes. + // A legacy material keep-out is bed-fixed and shared by every nozzle. + if (region.is_collision_volume()) + region.polygon.translate(translation); + } + return regions; +} + +static size_t bed_exclusion_extruder_count( + const size_t nozzle_count, + const size_t offset_count, + const size_t per_extruder_count) +{ + return std::max(1, std::max({ nozzle_count, offset_count, per_extruder_count })); +} + +static std::vector flatten_bed_excluded_regions( + const BedExcludeVolumeMode mode, + std::vector> regions_by_extruder) +{ + if (regions_by_extruder.empty()) + return {}; + if (mode == BedExcludeVolumeMode::Shared) + return std::move(regions_by_extruder.front()); + + std::vector flattened; + // A shared legacy area is present in every resolved nozzle group so object + // validation sees it for every tool. Flatten it only once, while retaining + // every nozzle-specific collision volume. + bool material_keepout_added = false; + for (std::vector ®ions : regions_by_extruder) { + for (BedExcludeRegion ®ion : regions) { + if (!region.is_collision_volume()) { + if (material_keepout_added) + continue; + material_keepout_added = true; + } + flattened.emplace_back(std::move(region)); + } + } + return flattened; +} + +} // namespace + +int bed_exclusion_extruder_for_filament( + const size_t filament_id, const std::vector &configured_map, const FilamentMapMode map_mode, + const bool is_bambu, const bool automatic_map_resolved, const size_t extruder_count) +{ + if (extruder_count == 0) + return -1; + + const bool automatic = is_auto_filament_map_mode(map_mode); + if (automatic && is_bambu && !automatic_map_resolved) + return -1; + + // Generic multi-tool printers use filament ids as tool ids. Their global + // filament_map still carries the Bambu grouping seed [1, 1, ...], which is + // not a meaningful assignment for these machines. + if (automatic && !is_bambu && filament_id < extruder_count) + return int(filament_id); + + if (filament_id < configured_map.size() && configured_map[filament_id] > 0 && + size_t(configured_map[filament_id]) <= extruder_count) + return configured_map[filament_id] - 1; + + return filament_id < extruder_count ? int(filament_id) : -1; +} + +std::vector> get_bed_excluded_regions_by_extruder(const DynamicPrintConfig &cfg) +{ + const ConfigOptionFloat *height_option = cfg.opt("printable_height"); + const double printable_height = height_option != nullptr ? height_option->value : 0.0; + const ConfigOptionPoints *legacy_option = cfg.opt("bed_exclude_area"); + const ConfigOptionString *shared_option = cfg.opt("bed_exclude_volumes"); + const BedExcludeVolumeMode configured_mode = cfg.has("bed_exclude_volume_mode") ? + cfg.opt_enum("bed_exclude_volume_mode") : BedExcludeVolumeMode::Shared; + const ConfigOptionStrings *per_extruder_option = cfg.opt("extruder_bed_exclude_volumes"); + const ConfigOptionPoints *offset_option = cfg.opt("extruder_offset"); + const ConfigOptionFloats *nozzle_option = cfg.opt("nozzle_diameter"); + const ConfigOptionInt *reference_option = cfg.opt("master_extruder_id"); + + const Pointfs legacy_points = legacy_option != nullptr ? legacy_option->values : Pointfs{}; + const std::string shared_specs = shared_option != nullptr ? shared_option->value : std::string{}; + const std::vector per_extruder_specs = per_extruder_option != nullptr ? per_extruder_option->values : std::vector{}; + const bool use_collision_volumes = collision_volumes_configured(shared_specs, configured_mode, per_extruder_specs); + const BedExcludeVolumeMode active_mode = use_collision_volumes ? configured_mode : BedExcludeVolumeMode::Shared; + std::vector master_regions = parse_master_bed_excluded_regions( + legacy_points, shared_specs, use_collision_volumes, active_mode, printable_height); + project_bed_material_keepouts(master_regions, cfg); + const std::vector offsets = offset_option != nullptr ? offset_option->values : std::vector{}; + const size_t count = bed_exclusion_extruder_count( + nozzle_option != nullptr ? nozzle_option->size() : 0, + offsets.size(), per_extruder_specs.size()); + const size_t reference = reference_option != nullptr && reference_option->value > 0 ? size_t(reference_option->value - 1) : 0; + + std::vector> result; + result.reserve(count); + for (size_t extruder_id = 0; extruder_id < count; ++extruder_id) + result.emplace_back(resolve_bed_excluded_regions(master_regions, active_mode, per_extruder_specs, offsets, reference, extruder_id, printable_height)); + return result; +} + +std::vector> get_bed_excluded_regions_by_extruder(const PrintConfig &cfg) +{ + const double printable_height = cfg.printable_height.value; + const bool use_collision_volumes = collision_volumes_configured( + cfg.bed_exclude_volumes.value, cfg.bed_exclude_volume_mode.value, + cfg.extruder_bed_exclude_volumes.values); + const BedExcludeVolumeMode active_mode = use_collision_volumes ? + cfg.bed_exclude_volume_mode.value : BedExcludeVolumeMode::Shared; + std::vector master_regions = parse_master_bed_excluded_regions( + cfg.bed_exclude_area.values, cfg.bed_exclude_volumes.value, use_collision_volumes, + active_mode, printable_height); + project_bed_material_keepouts(master_regions, cfg); + const size_t count = bed_exclusion_extruder_count( + cfg.nozzle_diameter.size(), cfg.extruder_offset.size(), cfg.extruder_bed_exclude_volumes.size()); + const size_t reference = cfg.master_extruder_id.value > 0 ? size_t(cfg.master_extruder_id.value - 1) : 0; + + std::vector> result; + result.reserve(count); + for (size_t extruder_id = 0; extruder_id < count; ++extruder_id) { + result.emplace_back(resolve_bed_excluded_regions( + master_regions, active_mode, cfg.extruder_bed_exclude_volumes.values, + cfg.extruder_offset.values, reference, extruder_id, printable_height)); + } + return result; +} + +std::vector get_bed_excluded_regions(const DynamicPrintConfig &cfg, const size_t extruder_id) +{ + std::vector> regions = get_bed_excluded_regions_by_extruder(cfg); + return extruder_id < regions.size() ? std::move(regions[extruder_id]) : std::vector{}; +} + +std::vector get_bed_excluded_regions(const PrintConfig &cfg, const size_t extruder_id) +{ + std::vector> regions = get_bed_excluded_regions_by_extruder(cfg); + return extruder_id < regions.size() ? std::move(regions[extruder_id]) : std::vector{}; +} + +std::vector get_bed_excluded_regions(const DynamicPrintConfig &cfg) +{ + return flatten_bed_excluded_regions(active_bed_exclude_volume_mode(cfg), get_bed_excluded_regions_by_extruder(cfg)); +} + +std::vector get_bed_excluded_regions(const PrintConfig &cfg) +{ + return flatten_bed_excluded_regions(active_bed_exclude_volume_mode(cfg), get_bed_excluded_regions_by_extruder(cfg)); +} + +bool is_bed_exclusion_volume_syntax(const std::string &value) +{ + return looks_like_bed_exclusion_volume_syntax(value); +} + +bool is_valid_bed_exclude_volumes_string(const std::string &value, const double printable_height) +{ + if (value.empty()) + return true; + + std::vector specs; + boost::split(specs, value, boost::is_any_of("|\n")); + bool found_nonempty = false; + for (std::string spec : specs) { + boost::trim(spec); + if (spec.empty()) + continue; + found_nonempty = true; + std::vector parsed; + append_bed_exclusion_volume_regions(parsed, spec, std::max(0.0, printable_height)); + if (parsed.size() != 1) + return false; + } + return found_nonempty; +} + +void append_bed_exclude_volumes(DynamicPrintConfig &config, const std::string &definition) +{ + if (definition.empty()) + return; + + const auto append = [&definition](const std::string ¤t) { + return current.empty() ? definition : current + '|' + definition; + }; + const BedExcludeVolumeMode mode = config.has("bed_exclude_volume_mode") ? + config.opt_enum("bed_exclude_volume_mode") : BedExcludeVolumeMode::Shared; + if (mode == BedExcludeVolumeMode::PerExtruder) { + const ConfigOptionStrings *current = config.option("extruder_bed_exclude_volumes"); + std::vector definitions = current != nullptr ? current->values : std::vector{}; + const ConfigOptionFloats *nozzles = config.option("nozzle_diameter"); + const size_t extruder_count = std::max(1, nozzles != nullptr ? nozzles->size() : 0); + definitions.resize(std::max(definitions.size(), extruder_count)); + for (size_t extruder_id = 0; extruder_id < extruder_count; ++extruder_id) + definitions[extruder_id] = append(definitions[extruder_id]); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings(std::move(definitions))); + return; + } + + const ConfigOptionString *current = config.option("bed_exclude_volumes"); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString( + append(current != nullptr ? current->value : std::string{}))); +} + +bool has_bed_exclude_volumes(const DynamicPrintConfig &cfg) +{ + const ConfigOptionString *shared = cfg.opt("bed_exclude_volumes"); + const ConfigOptionStrings *per_extruder = cfg.opt("extruder_bed_exclude_volumes"); + const BedExcludeVolumeMode mode = cfg.has("bed_exclude_volume_mode") ? + cfg.opt_enum("bed_exclude_volume_mode") : BedExcludeVolumeMode::Shared; + return collision_volumes_configured( + shared != nullptr ? shared->value : std::string{}, mode, + per_extruder != nullptr ? per_extruder->values : std::vector{}); +} + +bool has_bed_exclude_volumes(const PrintConfig &cfg) +{ + return collision_volumes_configured( + cfg.bed_exclude_volumes.value, cfg.bed_exclude_volume_mode.value, + cfg.extruder_bed_exclude_volumes.values); +} + +BedExcludeVolumeMode active_bed_exclude_volume_mode(const DynamicPrintConfig &cfg) +{ + if (!has_bed_exclude_volumes(cfg) || !cfg.has("bed_exclude_volume_mode")) + return BedExcludeVolumeMode::Shared; + return cfg.opt_enum("bed_exclude_volume_mode"); +} + +BedExcludeVolumeMode active_bed_exclude_volume_mode(const PrintConfig &cfg) +{ + return has_bed_exclude_volumes(cfg) ? cfg.bed_exclude_volume_mode.value : BedExcludeVolumeMode::Shared; +} + +Polygons get_bed_excluded_area(const PrintConfig& cfg) +{ + const std::vector regions = get_bed_excluded_regions(cfg); + Polygons excluded_polygons; + excluded_polygons.reserve(regions.size()); + + for (const BedExcludeRegion ®ion : regions) { + if (region.has_z_range && region.z_min > EPSILON) + continue; + if (region.z_max <= EPSILON) + continue; + + excluded_polygons.emplace_back(region.polygon); + } + + return excluded_polygons; } Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg, bool use_share) diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index ed793ec3cc..98082bc52c 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -172,8 +172,8 @@ inline bool is_separable_infill_pattern(InfillPattern pattern) // Orca: Infill patterns laid out by an octree, which each connected body always gets of its own. inline bool is_octree_infill_pattern(InfillPattern pattern) { return pattern == ipAdaptiveCubic || pattern == ipSupportCubic; } -// Orca: Infill patterns graded by the "tpms_adaptive" option. -inline bool is_tpms_adaptive_pattern(InfillPattern pattern) { return pattern == ipGyroid || pattern == ipTpmsD || pattern == ipTpmsFK; } +// Orca: Infill patterns graded by the "adaptive_infill_mode" option. +inline bool is_adaptive_infill_pattern(InfillPattern pattern) { return pattern == ipGyroid || pattern == ipTpmsD || pattern == ipTpmsFK; } // Orca: Infill patterns that round their corners by the "sparse_infill_smooth_factor" option. // Grid, Triangles and Tri-hexagon only do so in their trapezoidal form, which is generated with more @@ -234,6 +234,13 @@ enum class PowerLossRecoveryMode { Disable, }; +// Orca +enum class ArcFittingMode { + Disabled, + Enabled, + SparseInfill, +}; + // BBS enum class WallSequence { InnerOuter, @@ -279,8 +286,8 @@ enum class SurfaceFillOrder { Count, }; -// Orca: what the adaptive TPMS density follows: the 3D shape of the object, or its 2D sections normal to an axis. -enum class TpmsAdaptiveMode { +// Orca: what the adaptive infill density follows: the 3D shape of the object, or its 2D sections normal to an axis. +enum class AdaptiveInfillMode { Disabled, DistanceWarp, SmoothBlend, @@ -292,8 +299,8 @@ enum class TpmsAdaptiveMode { Count, }; -// Orca: how the adaptive TPMS density changes from the object surface to its deepest point. -enum class TpmsAdaptiveGradient { +// Orca: how the adaptive infill density changes from the object surface to its deepest point. +enum class AdaptiveInfillGradient { Linear, Quadratic, Exponential, @@ -630,6 +637,14 @@ enum FilamentMapMode { fmmDefault }; +// Defines how bed exclusion volumes are resolved for printers with multiple +// independently positioned nozzles/toolheads. +enum class BedExcludeVolumeMode { + Shared = 0, + ToolheadOffset, + PerExtruder +}; + // All auto modes are ordered before fmmManual (see the enum ordering note above). inline bool is_auto_filament_map_mode(FilamentMapMode mode) { return mode < fmmManual; @@ -815,9 +830,10 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(WipeTowerWallType) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(ToolChangeOrderingType) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PowerLossRecoveryMode) +CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(ArcFittingMode) CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(SurfaceFillOrder) -CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(TpmsAdaptiveMode) -CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(TpmsAdaptiveGradient) +CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(AdaptiveInfillMode) +CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(AdaptiveInfillGradient) #undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS @@ -1433,6 +1449,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionStrings, print_extruder_variant)) ((ConfigOptionInt, bottom_shell_layers)) ((ConfigOptionFloat, bottom_shell_thickness)) + ((ConfigOptionInt, bottom_color_penetration_layers)) ((ConfigOptionFloat, bridge_angle)) ((ConfigOptionFloat, internal_bridge_angle)) // ORCA: Internal bridge angle override ((ConfigOptionBool, relative_bridge_angle)) // ORCA: Relative bridge angle flag @@ -1501,9 +1518,9 @@ PRINT_CONFIG_CLASS_DEFINE( // Orca: ((ConfigOptionFloatOrPercent, infill_combination_max_layer_height)) ((ConfigOptionInt, fill_multiline)) - ((ConfigOptionEnum, tpms_adaptive)) - ((ConfigOptionPercent, tpms_interior_density)) - ((ConfigOptionEnum, tpms_adaptive_gradient)) + ((ConfigOptionEnum, adaptive_infill_mode)) + ((ConfigOptionPercent, adaptive_infill_interior_density)) + ((ConfigOptionEnum, adaptive_infill_gradient)) ((ConfigOptionBool, gyroid_optimized)) // Ironing options ((ConfigOptionEnum, ironing_type)) @@ -1541,6 +1558,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloatOrPercent, top_surface_line_width)) ((ConfigOptionInt, top_shell_layers)) ((ConfigOptionFloat, top_shell_thickness)) + ((ConfigOptionInt, top_color_penetration_layers)) ((ConfigOptionFloat, top_surface_expansion)) ((ConfigOptionFloat, top_surface_expansion_margin)) ((ConfigOptionEnum, top_surface_expansion_direction)) @@ -1685,7 +1703,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionString, printing_by_object_gcode)) ((ConfigOptionFloats, deretraction_speed)) //BBS - ((ConfigOptionBool, enable_arc_fitting)) + ((ConfigOptionEnum, enable_arc_fitting)) ((ConfigOptionString, machine_end_gcode)) ((ConfigOptionStrings, filament_end_gcode)) ((ConfigOptionFloatsNullable, filament_flow_ratio)) @@ -1820,7 +1838,6 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionStrings, filament_change_extrusion_role_gcode)) ((ConfigOptionFloatsNullable, travel_speed)) ((ConfigOptionFloatsNullable, travel_speed_z)) - ((ConfigOptionBool, silent_mode)) ((ConfigOptionString, machine_pause_gcode)) ((ConfigOptionString, template_custom_gcode)) //BBS @@ -1973,6 +1990,9 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionStrings, parallel_printheads_bed_exclude_areas)) //BBS: add bed_exclude_area ((ConfigOptionPoints, bed_exclude_area)) + ((ConfigOptionString, bed_exclude_volumes)) + ((ConfigOptionEnum, bed_exclude_volume_mode)) + ((ConfigOptionStrings, extruder_bed_exclude_volumes)) ((ConfigOptionPoints, head_wrap_detect_zone)) // BBS ((ConfigOptionString, bed_custom_texture)) @@ -2521,6 +2541,42 @@ Polygon get_shared_poly(const std::vector& extruder_polys); Points get_bed_shape(const DynamicPrintConfig &cfg, bool use_share = true); Points get_bed_shape(const PrintConfig &cfg, bool use_share = false); Points get_bed_shape(const SLAPrinterConfig &cfg); +struct BedExcludeRegion { + enum class Purpose { + MaterialKeepout, + CollisionVolume + }; + + Polygon polygon; + double z_min { 0.0 }; + double z_max { 0.0 }; + Purpose purpose { Purpose::MaterialKeepout }; + bool has_z_range { false }; + + bool is_collision_volume() const { return purpose == Purpose::CollisionVolume; } +}; +std::vector get_bed_excluded_regions(const DynamicPrintConfig& cfg); +std::vector get_bed_excluded_regions(const PrintConfig& cfg); +std::vector get_bed_excluded_regions(const DynamicPrintConfig &cfg, size_t extruder_id); +std::vector get_bed_excluded_regions(const PrintConfig &cfg, size_t extruder_id); +std::vector> get_bed_excluded_regions_by_extruder(const DynamicPrintConfig &cfg); +std::vector> get_bed_excluded_regions_by_extruder(const PrintConfig &cfg); +// Resolve the nozzle whose exclusion regions apply to a filament. Filament +// and return ids are 0-based. Returns -1 while Bambu automatic grouping has +// no concrete assignment. +int bed_exclusion_extruder_for_filament(size_t filament_id, const std::vector &configured_map, + FilamentMapMode map_mode, bool is_bambu, bool automatic_map_resolved, + size_t extruder_count); +bool is_bed_exclusion_volume_syntax(const std::string &value); +bool is_valid_bed_exclude_volumes_string(const std::string &value, double printable_height); +// Add shared definitions without replacing existing volumes or changing the +// configured multi-nozzle mode. In individual mode the new definitions are +// applied to every physical extruder. +void append_bed_exclude_volumes(DynamicPrintConfig &config, const std::string &definition); +bool has_bed_exclude_volumes(const DynamicPrintConfig &cfg); +bool has_bed_exclude_volumes(const PrintConfig &cfg); +BedExcludeVolumeMode active_bed_exclude_volume_mode(const DynamicPrintConfig &cfg); +BedExcludeVolumeMode active_bed_exclude_volume_mode(const PrintConfig &cfg); Slic3r::Polygons get_bed_excluded_area(const PrintConfig& cfg); Slic3r::Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg, bool use_share = false); bool has_skirt(const DynamicPrintConfig& cfg); diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 7e9b21ccdf..634d2ed291 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -33,7 +33,7 @@ #include "Fill/FillAdaptive.hpp" #include "Fill/Fill.hpp" #include "Fill/FillLightning.hpp" -#include "Fill/FillTpmsAdaptive.hpp" +#include "Fill/AdaptiveInfillField.hpp" #include "format.hpp" #include "AABBTreeIndirect.hpp" #include "AABBTreeLines.hpp" @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ #include #include +#include #include #include @@ -352,6 +354,23 @@ std::vector> PrintObject::detect_extruder_geometric_unprintables() std::vector> geometric_unprintables(extruder_size); // the container to return + std::vector> exclusion_regions = get_bed_excluded_regions_by_extruder(m_print->config()); + exclusion_regions.resize(extruder_size); + const Point plate_origin(scale_(m_print->get_plate_origin().x()), scale_(m_print->get_plate_origin().y())); + for (std::vector ®ions : exclusion_regions) + for (BedExcludeRegion ®ion : regions) + region.polygon.translate(plate_origin); + + const std::vector used_filaments = printing_extruders(); + for (size_t extruder_id = 0; extruder_id < exclusion_regions.size(); ++extruder_id) { + const bool collision = std::any_of(m_instances.begin(), m_instances.end(), [&](const PrintInstance &instance) { + return instance.model_instance != nullptr && + instance.model_instance->intersects_bed_exclude_regions(exclusion_regions[extruder_id]); + }); + if (collision) + geometric_unprintables[extruder_id].insert(used_filaments.begin(), used_filaments.end()); + } + std::vector printable_height_per_extruder = m_print->config().extruder_printable_height.values; assert(printable_height_per_extruder.size() == extruder_size); @@ -1252,19 +1271,19 @@ FillLightning::GeneratorPtr PrintObject::prepare_lightning_infill_data() return has_lightning_infill ? FillLightning::build_generator(std::as_const(*this), [this]() -> void { this->throw_if_canceled(); }) : FillLightning::GeneratorPtr(); } -TpmsRadialFields PrintObject::prepare_tpms_radial_fields() const +AdaptiveInfillFields PrintObject::prepare_adaptive_infill_fields() const { - TpmsRadialFields fields; - std::array modes{}; + AdaptiveInfillFields fields; + std::array modes{}; for (size_t region_id = 0; region_id < this->num_printing_regions(); ++region_id) if (const PrintRegionConfig &config = this->printing_region(region_id).config(); - config.sparse_infill_density > 0 && config.sparse_infill_density < 100 && is_tpms_adaptive_pattern(config.sparse_infill_pattern)) - modes[size_t(config.tpms_adaptive.value)] = true; - modes[size_t(TpmsAdaptiveMode::Disabled)] = false; + config.sparse_infill_density > 0 && config.sparse_infill_density < 100 && is_adaptive_infill_pattern(config.sparse_infill_pattern)) + modes[size_t(config.adaptive_infill_mode.value)] = true; + modes[size_t(AdaptiveInfillMode::Disabled)] = false; if (std::find(modes.begin(), modes.end(), true) == modes.end() || m_layers.empty()) return fields; - std::vector slices; + std::vector slices; slices.reserve(m_layers.size()); BoundingBox bbox; for (const Layer *layer : m_layers) { @@ -1277,7 +1296,7 @@ TpmsRadialFields PrintObject::prepare_tpms_radial_fields() const if (!modes[mode]) continue; // Without a field, the infill falls back to the regular pattern. - auto field = std::make_unique(slices, bbox, TpmsAdaptiveMode(mode), [this]() { m_print->throw_if_canceled(); }); + auto field = std::make_unique(slices, bbox, AdaptiveInfillMode(mode), [this]() { m_print->throw_if_canceled(); }); if (!field->empty()) fields[mode] = std::move(field); } @@ -1615,7 +1634,9 @@ bool PrintObject::invalidate_state_by_config_options( steps.emplace_back(posSupportMaterial); } else if ( opt_key == "bottom_shell_layers" - || opt_key == "top_shell_layers") { + || opt_key == "top_shell_layers" + || opt_key == "top_color_penetration_layers" + || opt_key == "bottom_color_penetration_layers") { steps.emplace_back(posSlice); #if (0) @@ -1685,9 +1706,9 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "infill_overhang_angle") { steps.emplace_back(posInfill); } else if (opt_key == "sparse_infill_pattern" - || opt_key == "tpms_adaptive" - || opt_key == "tpms_interior_density" - || opt_key == "tpms_adaptive_gradient" + || opt_key == "adaptive_infill_mode" + || opt_key == "adaptive_infill_interior_density" + || opt_key == "adaptive_infill_gradient" // Orca: Body centering now also determines bridge anchors during preparation. // Invalidating preparation also invalidates infill, including top/bottom surfaces. || opt_key == "center_of_surface_pattern" @@ -1930,7 +1951,9 @@ void PrintObject::detect_surfaces_type() bool interface_shells = ! spiral_mode && m_config.interface_shells.value; size_t num_layers = spiral_mode ? std::min(size_t(this->printing_region(0).config().bottom_shell_layers), m_layers.size()) : m_layers.size(); - for (size_t region_id = 0; region_id < this->num_printing_regions(); ++ region_id) { + // The regions of a layer do not see each other here, and a layer cut through a fine relief takes far longer than the + // others, so the regions run next to each other instead of one after another, each still over all layers. + tbb::parallel_for(size_t(0), this->num_printing_regions(), [&](size_t region_id) { BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << region_id << " in parallel - start"; #ifdef SLIC3R_DEBUG_SLICE_PROCESSING for (Layer *layer : m_layers) @@ -1988,7 +2011,7 @@ void PrintObject::detect_surfaces_type() if (upper_layer) { ExPolygons upper_slices = interface_shells ? diff_ex(layerm_slices_surfaces, upper_layer->m_regions[region_id]->slices.surfaces, ApplySafetyOffset::Yes) : - diff_ex(layerm_slices_surfaces, upper_layer->lslices, ApplySafetyOffset::Yes); + diff_ex_by_piece(layerm_slices_surfaces, to_polygons(upper_layer->lslices), ApplySafetyOffset::Yes); surfaces_append(top, opening_ex(upper_slices, offset), stTop); } else { // if no upper layer, all surfaces of this one are solid @@ -2014,7 +2037,7 @@ void PrintObject::detect_surfaces_type() surfaces_append( bottom, opening_ex( - diff_ex(layerm_slices_surfaces, lower_layer->lslices, ApplySafetyOffset::Yes), + diff_ex_by_piece(layerm_slices_surfaces, to_polygons(lower_layer->lslices), ApplySafetyOffset::Yes), offset), surface_type_bottom_other); // if user requested internal shells, we need to identify surfaces @@ -2045,34 +2068,44 @@ void PrintObject::detect_surfaces_type() // and top surfaces; let's do an intersection to discover them and consider them // as bottom surfaces (to allow for bridge detection) if (! top.empty() && ! bottom.empty()) { - const auto cracks = intersection_ex(top, bottom); + const auto cracks = intersection_ex_by_piece(to_expolygons(top), to_polygons(bottom)); if (!cracks.empty()) { if (lower_layer) { // Only detect small cracks for non-first layer, because first layer should always be bottom const float small_crack_threshold = -layerm->flow(frExternalPerimeter).scaled_width() * 1.5; + // Only the bottom surfaces near a crack can take part: one that contains it must contain its box, + // and one whose box misses the grown crack is left unchanged by removing it. A layer cut through + // a fine relief has thousands of both, which made this loop quadratic. for (const auto& crack : cracks) { if (offset_ex(crack, small_crack_threshold).empty()) { // For small cracks, if it's part of a large bottom surface, then it should be added to bottom as well - if (std::any_of(bottom.begin(), bottom.end(), [&crack, small_crack_threshold](const Surface& s) { + const BoundingBox crack_bbox = get_extents(crack); + if (std::any_of(bottom.begin(), bottom.end(), [&crack, &crack_bbox, small_crack_threshold](const Surface& s) { const auto& se = s.expolygon; - return diff_ex(crack, se, ApplySafetyOffset::Yes).empty() + return get_extents(se).inflated(SCALED_EPSILON).contains(crack_bbox) + && diff_ex(crack, se, ApplySafetyOffset::Yes).empty() && se.area() > crack.area() * 2 && !offset_ex(diff_ex(se, crack), small_crack_threshold).empty(); })) continue; // Crack too small, leave it as part of the top surface, remove it from bottom surfaces + const ExPolygons grown_crack = offset_ex(crack, -small_crack_threshold); + const BoundingBox grown_bbox = get_extents(grown_crack); Surfaces bot_tmp; for (auto& b : bottom) { - surfaces_append(bot_tmp, diff_ex(b.expolygon, offset_ex(crack, -small_crack_threshold)), b.surface_type); + if (get_extents(b.expolygon).overlap(grown_bbox)) + surfaces_append(bot_tmp, diff_ex(b.expolygon, grown_crack), b.surface_type); + else + bot_tmp.emplace_back(std::move(b)); } bottom = std::move(bot_tmp); } } } - Polygons top_polygons = to_polygons(std::move(top)); + ExPolygons top_expolygons = to_expolygons(std::move(top)); top.clear(); - surfaces_append(top, diff_ex(top_polygons, bottom), stTop); + surfaces_append(top, diff_ex_by_piece(top_expolygons, to_polygons(bottom)), stTop); } } @@ -2163,7 +2196,7 @@ void PrintObject::detect_surfaces_type() { Polygons topbottom = to_polygons(top); polygons_append(topbottom, to_polygons(bottom)); - surfaces_append(surfaces_out, diff_ex(surfaces_prev_expolys, topbottom), stInternal); + surfaces_append(surfaces_out, diff_ex_by_piece(surfaces_prev_expolys, topbottom), stInternal); } surfaces_append(surfaces_out, std::move(top)); @@ -2340,29 +2373,31 @@ void PrintObject::detect_surfaces_type() } } ); - // ============================================================================================================== - // === ORCA: Interim workaround - for now the new stInternalAfterExternalBridge surfaace is re-classified ============== - // === back to a bottom bridge. As a starting point, this improves bridging reliability as it extrudes ========== - // === two external bridge layers. However, TODO: Implement a new surface type throughout the codebase ========== - // ============================================================================================================== - for (size_t region_id = 0; region_id < this->num_printing_regions(); ++region_id) { - tbb::parallel_for( tbb::blocked_range(0, m_layers.size()), [this, region_id](const tbb::blocked_range &range) { - for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++idx_layer) { - Surfaces &surfs = m_layers[idx_layer]->m_regions[region_id]->slices.surfaces; - for (Surface &s : surfs) { - if (s.surface_type == stInternalAfterExternalBridge) { - s.surface_type = stBottomBridge; - } - } - } - } - ); - } } // ============================================================================================================== // === ORCA: End of second external bridge layer changes ======================================================= // ============================================================================================================== + }); // for each this->print->region_count + + // ============================================================================================================== + // === ORCA: Interim workaround - for now the new stInternalAfterExternalBridge surfaace is re-classified ============== + // === back to a bottom bridge. As a starting point, this improves bridging reliability as it extrudes ========== + // === two external bridge layers. However, TODO: Implement a new surface type throughout the codebase ========== + // ============================================================================================================== + // Once all the regions have their second bridge layer, and before their slices are trimmed into fill surfaces below. + if ((this->config().enable_extra_bridge_layer.value == eblApplyToAll) || (this->config().enable_extra_bridge_layer.value == eblExternalBridgeOnly)) { + tbb::parallel_for(tbb::blocked_range(0, m_layers.size()), [this](const tbb::blocked_range &range) { + for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++idx_layer) + for (LayerRegion *layerm : m_layers[idx_layer]->regions()) + for (Surface &s : layerm->slices.surfaces) + if (s.surface_type == stInternalAfterExternalBridge) + s.surface_type = stBottomBridge; + }); + m_print->throw_if_canceled(); + } + + tbb::parallel_for(size_t(0), this->num_printing_regions(), [&](size_t region_id) { BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << region_id << " - clipping in parallel - start"; // Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces. tbb::parallel_for( @@ -2379,7 +2414,7 @@ void PrintObject::detect_surfaces_type() }); m_print->throw_if_canceled(); BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << region_id << " - clipping in parallel - end"; - } // for each this->print->region_count + }); // Mark the object to have the region slices classified (typed, which also means they are split based on whether they are supported, bridging, top layers etc.) m_typed_slices = true; @@ -2446,8 +2481,10 @@ void PrintObject::process_external_surfaces() BOOST_LOG_TRIVIAL(debug) << "Collecting surfaces covered with extrusions in parallel - end"; } - for (size_t region_id = 0; region_id < this->num_printing_regions(); ++region_id) { - BOOST_LOG_TRIVIAL(debug) << "Processing external surfaces for region " << region_id << " in parallel - start"; + BOOST_LOG_TRIVIAL(debug) << "Processing external surfaces in parallel - start"; + // The regions of a layer do not see each other here, and a layer cut through a fine relief takes far longer than the + // others, so the regions run next to each other instead of one after another, each still over all layers. + tbb::parallel_for(size_t(0), this->num_printing_regions(), [this, &surfaces_covered](size_t region_id) { tbb::parallel_for( tbb::blocked_range(0, m_layers.size()), [this, &surfaces_covered, region_id](const tbb::blocked_range& range) { @@ -2462,9 +2499,9 @@ void PrintObject::process_external_surfaces() } } ); - m_print->throw_if_canceled(); - BOOST_LOG_TRIVIAL(debug) << "Processing external surfaces for region " << region_id << " in parallel - end"; - } + }); + m_print->throw_if_canceled(); + BOOST_LOG_TRIVIAL(debug) << "Processing external surfaces in parallel - end"; } void PrintObject::discover_vertical_shells() @@ -2503,10 +2540,10 @@ void PrintObject::discover_vertical_shells() // The "ensure vertical wall thickness" feature is not applicable to any of the regions. Quit. return; BOOST_LOG_TRIVIAL(debug) << "Discovering vertical shells in parallel - start : cache top / bottom"; - //FIXME Improve the heuristics for a grain size. - size_t grain_size = std::max(num_layers / 16, size_t(1)); + // One layer per task: on a layer cut through a fine relief the unions below take far longer than elsewhere, and a + // few such layers next to each other must not end up in one task. tbb::parallel_for( - tbb::blocked_range(0, num_layers, grain_size), + tbb::blocked_range(0, num_layers, 1), [this, &cache_top_botom_regions](const tbb::blocked_range& range) { const std::initializer_list surfaces_bottom { stBottom, stBottomBridge }; const size_t num_regions = this->num_printing_regions(); @@ -2514,67 +2551,198 @@ void PrintObject::discover_vertical_shells() m_print->throw_if_canceled(); const Layer &layer = *m_layers[idx_layer]; DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[idx_layer]; - // Simulate single set of perimeters over all merged regions. - float perimeter_offset = 0.f; - float perimeter_min_spacing = FLT_MAX; + const auto top_bottom_expansion = [&layer](size_t region_id) { + return float(layer.m_regions[region_id]->flow(frSolidInfill).scaled_spacing()) * top_bottom_expansion_coeff; + }; #ifdef SLIC3R_DEBUG_SLICE_PROCESSING static size_t debug_idx = 0; ++ debug_idx; #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ - for (size_t region_id = 0; region_id < num_regions; ++ region_id) { - LayerRegion &layerm = *layer.m_regions[region_id]; - float top_bottom_expansion = float(layerm.flow(frSolidInfill).scaled_spacing()) * top_bottom_expansion_coeff; - // Top surfaces. - append(cache.top_surfaces, offset(layerm.slices.filter_by_type(stTop), top_bottom_expansion)); -// append(cache.top_surfaces, offset(layerm.fill_surfaces.filter_by_type(stTop), top_bottom_expansion)); - // Bottom surfaces. - append(cache.bottom_surfaces, offset(layerm.slices.filter_by_types(surfaces_bottom), top_bottom_expansion)); -// append(cache.bottom_surfaces, offset(layerm.fill_surfaces.filter_by_types(surfaces_bottom), top_bottom_expansion)); - // Calculate the maximum perimeter offset as if the slice was extruded with a single extruder only. - // First find the maxium number of perimeters per region slice. - unsigned int perimeters = 0; - for (Surface &s : layerm.slices.surfaces) - perimeters = std::max(perimeters, s.extra_perimeters); - perimeters += layerm.region().config().wall_loops.value; - // Then calculate the infill offset. - if (perimeters > 0) { - Flow extflow = layerm.flow(frExternalPerimeter); - Flow flow = layerm.flow(frPerimeter); - perimeter_offset = std::max(perimeter_offset, - 0.5f * float(extflow.scaled_width() + extflow.scaled_spacing()) + (float(perimeters) - 1.f) * flow.scaled_spacing()); - perimeter_min_spacing = std::min(perimeter_min_spacing, float(std::min(extflow.scaled_spacing(), flow.scaled_spacing()))); - } - polygons_append(cache.holes, to_polygons(layerm.fill_expolygons)); - } - // Save some computing time by reducing the number of polygons. - cache.top_surfaces = union_(cache.top_surfaces); - cache.bottom_surfaces = union_(cache.bottom_surfaces); - // For a multi-material print, simulate perimeter / infill split as if only a single extruder has been used for the whole print. - if (perimeter_offset > 0.) { - // The layer.lslices are forced to merge by expanding them first. - polygons_append(cache.holes, offset2(layer.lslices, 0.3f * perimeter_min_spacing, - perimeter_offset - 0.3f * perimeter_min_spacing)); + // The top surfaces, the bottom surfaces and the holes are independent of each other. + tbb::parallel_invoke( + [&]() { + for (size_t region_id = 0; region_id < num_regions; ++ region_id) + append(cache.top_surfaces, offset(layer.m_regions[region_id]->slices.filter_by_type(stTop), top_bottom_expansion(region_id))); +// append(cache.top_surfaces, offset(layerm.fill_surfaces.filter_by_type(stTop), top_bottom_expansion)); + // Save some computing time by reducing the number of polygons. + cache.top_surfaces = union_(cache.top_surfaces); + }, + [&]() { + for (size_t region_id = 0; region_id < num_regions; ++ region_id) + append(cache.bottom_surfaces, offset(layer.m_regions[region_id]->slices.filter_by_types(surfaces_bottom), top_bottom_expansion(region_id))); +// append(cache.bottom_surfaces, offset(layerm.fill_surfaces.filter_by_types(surfaces_bottom), top_bottom_expansion)); + cache.bottom_surfaces = union_(cache.bottom_surfaces); + }, + [&]() { + // Simulate single set of perimeters over all merged regions. + float perimeter_offset = 0.f; + float perimeter_min_spacing = FLT_MAX; + for (size_t region_id = 0; region_id < num_regions; ++ region_id) { + const LayerRegion &layerm = *layer.m_regions[region_id]; + // Calculate the maximum perimeter offset as if the slice was extruded with a single extruder only. + // First find the maxium number of perimeters per region slice. + unsigned int perimeters = 0; + for (const Surface &s : layerm.slices.surfaces) + perimeters = std::max(perimeters, s.extra_perimeters); + perimeters += layerm.region().config().wall_loops.value; + // Then calculate the infill offset. + if (perimeters > 0) { + Flow extflow = layerm.flow(frExternalPerimeter); + Flow flow = layerm.flow(frPerimeter); + perimeter_offset = std::max(perimeter_offset, + 0.5f * float(extflow.scaled_width() + extflow.scaled_spacing()) + (float(perimeters) - 1.f) * flow.scaled_spacing()); + perimeter_min_spacing = std::min(perimeter_min_spacing, float(std::min(extflow.scaled_spacing(), flow.scaled_spacing()))); + } + polygons_append(cache.holes, to_polygons(layerm.fill_expolygons)); + } + // For a multi-material print, simulate perimeter / infill split as if only a single extruder has been used for the whole print. + if (perimeter_offset > 0.) { + // The layer.lslices are forced to merge by expanding them first. + polygons_append(cache.holes, offset2(layer.lslices, 0.3f * perimeter_min_spacing, - perimeter_offset - 0.3f * perimeter_min_spacing)); #ifdef SLIC3R_DEBUG_SLICE_PROCESSING - { - Slic3r::SVG svg(debug_out_path("discover_vertical_shells-extra-holes-%d.svg", debug_idx), get_extents(layer.lslices)); - svg.draw(layer.lslices, "blue"); - svg.draw(union_ex(cache.holes), "red"); - svg.draw_outline(union_ex(cache.holes), "black", "blue", scale_(0.05)); - svg.Close(); - } + { + Slic3r::SVG svg(debug_out_path("discover_vertical_shells-extra-holes-%d.svg", debug_idx), get_extents(layer.lslices)); + svg.draw(layer.lslices, "blue"); + svg.draw(union_ex(cache.holes), "red"); + svg.draw_outline(union_ex(cache.holes), "black", "blue", scale_(0.05)); + svg.Close(); + } #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ - } - cache.holes = union_(cache.holes); + } + cache.holes = union_(cache.holes); + }); } }); m_print->throw_if_canceled(); BOOST_LOG_TRIVIAL(debug) << "Discovering vertical shells in parallel - end : cache top / bottom"; } - for (size_t region_id = 0; region_id < this->num_printing_regions(); ++ region_id) { + // With one top/bottom cache for all regions, the shell and hole accumulation in the loop below depends on nothing + // region-specific but the shell settings and the external perimeter spacing, so a region sharing them with an earlier + // one reuses its result instead of repeating it: that accumulation is a union over several layers of top/bottom + // surfaces, and a multi-material print has a region per filament. + using AccumulationKey = std::array; + struct ShellAccumulation + { + AccumulationKey key; + Polygons shell; + Polygons holes; + }; + const auto accumulation_key = [](const PrintRegionConfig ®ion_config, const LayerRegion *layerm) { + return AccumulationKey{ double(region_config.top_shell_layers.value), region_config.top_shell_thickness.value, + double(region_config.bottom_shell_layers.value), region_config.bottom_shell_thickness.value, + double(layerm->flow(frExternalPerimeter).scaled_spacing()) }; + }; + const auto accumulate_shell = [this, &cache_top_botom_regions](size_t idx_layer, const PrintRegionConfig ®ion_config, + const LayerRegion *layerm, Polygons &shell, Polygons &holes) { + const Layer *layer = m_layers[idx_layer]; + polygons_append(holes, cache_top_botom_regions[idx_layer].holes); + auto combine_holes = [&holes](const Polygons &holes2) { + if (holes.empty() || holes2.empty()) + holes.clear(); + else + holes = intersection(holes, holes2); + }; + auto combine_shells = [&shell](const Polygons &shells2) { + if (shell.empty()) + shell = std::move(shells2); + else if (! shells2.empty()) { + polygons_append(shell, shells2); + // Running the union_ using the Clipper library piece by piece is cheaper + // than running the union_ all at once. + shell = union_(shell); + } + }; + static constexpr const bool one_more_layer_below_top_bottom_surfaces = false; + if (int n_top_layers = region_config.top_shell_layers.value; n_top_layers > 0) { + // Gather top regions projected to this layer. + coordf_t print_z = layer->print_z; + int i = int(idx_layer) + 1; + int itop = int(idx_layer) + n_top_layers; + bool at_least_one_top_projected = false; + for (; i < int(cache_top_botom_regions.size()) && + (i < itop || m_layers[i]->print_z - print_z < region_config.top_shell_thickness - EPSILON); + ++ i) { + at_least_one_top_projected = true; + const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[i]; + combine_holes(cache.holes); + combine_shells(cache.top_surfaces); + } + if (!at_least_one_top_projected && i < int(cache_top_botom_regions.size())) { + // Lets consider this a special case - with only 1 top solid and minimal shell thickness settings, the + // boundaries of solid layers are not anchored over/under perimeters, so lets fix it by adding at least one + // perimeter width of area + Polygons anchor_area = intersection(expand(cache_top_botom_regions[idx_layer].top_surfaces, + layerm->flow(frExternalPerimeter).scaled_spacing()), + to_polygons(m_layers[i]->lslices)); + combine_shells(anchor_area); + } + + if (one_more_layer_below_top_bottom_surfaces) + if (i < int(cache_top_botom_regions.size()) && + (i <= itop || m_layers[i]->bottom_z() - print_z < region_config.top_shell_thickness - EPSILON)) + combine_holes(cache_top_botom_regions[i].holes); + } + if (int n_bottom_layers = region_config.bottom_shell_layers.value; n_bottom_layers > 0) { + // Gather bottom regions projected to this layer. + coordf_t bottom_z = layer->bottom_z(); + int i = int(idx_layer) - 1; + int ibottom = int(idx_layer) - n_bottom_layers; + bool at_least_one_bottom_projected = false; + for (; i >= 0 && + (i > ibottom || bottom_z - m_layers[i]->bottom_z() < region_config.bottom_shell_thickness - EPSILON); + -- i) { + at_least_one_bottom_projected = true; + const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[i]; + combine_holes(cache.holes); + combine_shells(cache.bottom_surfaces); + } + + if (!at_least_one_bottom_projected && i >= 0) { + Polygons anchor_area = intersection(expand(cache_top_botom_regions[idx_layer].bottom_surfaces, + layerm->flow(frExternalPerimeter).scaled_spacing()), + to_polygons(m_layers[i]->lslices)); + combine_shells(anchor_area); + } + + if (one_more_layer_below_top_bottom_surfaces) + if (i >= 0 && + (i > ibottom || bottom_z - m_layers[i]->print_z < region_config.bottom_shell_thickness - EPSILON)) + combine_holes(cache_top_botom_regions[i].holes); + } + }; + std::vector> shell_accumulations(top_bottom_surfaces_all_regions ? num_layers : 0); + if (! shell_accumulations.empty()) { + // Every (layer, key) pair is accumulated once, before the regions, so that nothing in the loop below is shared + // between them and they can run next to each other. + std::vector> todo; // layer, its slot, a region holding the key + for (size_t idx_layer = 0; idx_layer < num_layers; ++ idx_layer) { + std::vector &accumulations = shell_accumulations[idx_layer]; + for (size_t region_id = 0; region_id < this->num_printing_regions(); ++ region_id) { + if (this->printing_region(region_id).config().ensure_vertical_shell_thickness.value != evstAll) + continue; + const LayerRegion *layerm = m_layers[idx_layer]->m_regions[region_id]; + const AccumulationKey key = accumulation_key(layerm->region().config(), layerm); + if (std::none_of(accumulations.begin(), accumulations.end(), [&key](const ShellAccumulation &a) { return a.key == key; })) { + todo.push_back({ idx_layer, accumulations.size(), region_id }); + accumulations.push_back({ key, {}, {} }); + } + } + } + tbb::parallel_for(size_t(0), todo.size(), [this, &todo, &shell_accumulations, &accumulate_shell](size_t i) { + m_print->throw_if_canceled(); + const LayerRegion *layerm = m_layers[todo[i][0]]->m_regions[todo[i][2]]; + ShellAccumulation &out = shell_accumulations[todo[i][0]][todo[i][1]]; + accumulate_shell(todo[i][0], layerm->region().config(), layerm, out.shell, out.holes); + }); + m_print->throw_if_canceled(); + } + + const auto process_region = [&](size_t region_id) { const PrintRegion ®ion = this->printing_region(region_id); if (region.config().ensure_vertical_shell_thickness.value != evstAll ) // This region will be handled by discover_horizontal_shells(). - continue; + return; //FIXME Improve the heuristics for a grain size. size_t grain_size = std::max(num_layers / 16, size_t(1)); @@ -2614,7 +2782,7 @@ void PrintObject::discover_vertical_shells() grain_size = 1; tbb::parallel_for( tbb::blocked_range(0, num_layers, grain_size), - [this, region_id, &cache_top_botom_regions] + [this, region_id, &shell_accumulations, &accumulation_key, &accumulate_shell] (const tbb::blocked_range& range) { // printf("discover_vertical_shells from %d to %d\n", range.begin(), range.end()); for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) { @@ -2664,80 +2832,19 @@ void PrintObject::discover_vertical_shells() } } #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ - polygons_append(holes, cache_top_botom_regions[idx_layer].holes); - auto combine_holes = [&holes](const Polygons &holes2) { - if (holes.empty() || holes2.empty()) - holes.clear(); - else - holes = intersection(holes, holes2); - }; - auto combine_shells = [&shell](const Polygons &shells2) { - if (shell.empty()) - shell = std::move(shells2); - else if (! shells2.empty()) { - polygons_append(shell, shells2); - // Running the union_ using the Clipper library piece by piece is cheaper - // than running the union_ all at once. - shell = union_(shell); - } - }; - static constexpr const bool one_more_layer_below_top_bottom_surfaces = false; - if (int n_top_layers = region_config.top_shell_layers.value; n_top_layers > 0) { - // Gather top regions projected to this layer. - coordf_t print_z = layer->print_z; - int i = int(idx_layer) + 1; - int itop = int(idx_layer) + n_top_layers; - bool at_least_one_top_projected = false; - for (; i < int(cache_top_botom_regions.size()) && - (i < itop || m_layers[i]->print_z - print_z < region_config.top_shell_thickness - EPSILON); - ++ i) { - at_least_one_top_projected = true; - const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[i]; - combine_holes(cache.holes); - combine_shells(cache.top_surfaces); - } - if (!at_least_one_top_projected && i < int(cache_top_botom_regions.size())) { - // Lets consider this a special case - with only 1 top solid and minimal shell thickness settings, the - // boundaries of solid layers are not anchored over/under perimeters, so lets fix it by adding at least one - // perimeter width of area - Polygons anchor_area = intersection(expand(cache_top_botom_regions[idx_layer].top_surfaces, - layerm->flow(frExternalPerimeter).scaled_spacing()), - to_polygons(m_layers[i]->lslices)); - combine_shells(anchor_area); - } - - if (one_more_layer_below_top_bottom_surfaces) - if (i < int(cache_top_botom_regions.size()) && - (i <= itop || m_layers[i]->bottom_z() - print_z < region_config.top_shell_thickness - EPSILON)) - combine_holes(cache_top_botom_regions[i].holes); - } - if (int n_bottom_layers = region_config.bottom_shell_layers.value; n_bottom_layers > 0) { - // Gather bottom regions projected to this layer. - coordf_t bottom_z = layer->bottom_z(); - int i = int(idx_layer) - 1; - int ibottom = int(idx_layer) - n_bottom_layers; - bool at_least_one_bottom_projected = false; - for (; i >= 0 && - (i > ibottom || bottom_z - m_layers[i]->bottom_z() < region_config.bottom_shell_thickness - EPSILON); - -- i) { - at_least_one_bottom_projected = true; - const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[i]; - combine_holes(cache.holes); - combine_shells(cache.bottom_surfaces); - } - - if (!at_least_one_bottom_projected && i >= 0) { - Polygons anchor_area = intersection(expand(cache_top_botom_regions[idx_layer].bottom_surfaces, - layerm->flow(frExternalPerimeter).scaled_spacing()), - to_polygons(m_layers[i]->lslices)); - combine_shells(anchor_area); - } - - if (one_more_layer_below_top_bottom_surfaces) - if (i >= 0 && - (i > ibottom || bottom_z - m_layers[i]->print_z < region_config.bottom_shell_thickness - EPSILON)) - combine_holes(cache_top_botom_regions[i].holes); - } + const AccumulationKey key = accumulation_key(region_config, layerm); + const ShellAccumulation *reused = shell_accumulations.empty() ? nullptr : + [&]() -> const ShellAccumulation * { + for (const ShellAccumulation &a : shell_accumulations[idx_layer]) + if (a.key == key) + return &a; + return nullptr; + }(); + if (reused != nullptr) { + shell = reused->shell; + holes = reused->holes; + } else + accumulate_shell(idx_layer, region_config, layerm, shell, holes); #ifdef SLIC3R_DEBUG_SLICE_PROCESSING { Slic3r::SVG svg(debug_out_path("discover_vertical_shells-perimeters-before-union-%d.svg", debug_idx), get_extents(shell)); @@ -2831,11 +2938,8 @@ void PrintObject::discover_vertical_shells() Polygons object_volume; Polygons internal_volume; { - Polygons shrinked_bottom_slice = idx_layer > 0 ? to_polygons(m_layers[idx_layer - 1]->lslices) : Polygons{}; - Polygons shrinked_upper_slice = (idx_layer + 1) < m_layers.size() ? - to_polygons(m_layers[idx_layer + 1]->lslices) : - Polygons{}; - object_volume = intersection(shrinked_bottom_slice, shrinked_upper_slice); + if (idx_layer > 0 && idx_layer + 1 < m_layers.size()) + object_volume = to_polygons(intersection_ex_by_piece(m_layers[idx_layer - 1]->lslices, to_polygons(m_layers[idx_layer + 1]->lslices))); internal_volume = closing(polygonsInternal, SCALED_EPSILON); } @@ -2846,15 +2950,34 @@ void PrintObject::discover_vertical_shells() // the in-model condition is there due to small sloping surfaces, e.g. top of the hull of the benchy // 2. the area does not fully cover an internal polygon // This is there mainly for a very thin parts, where the solid layers would be missing if the part area is quite small + // Both tests below compare a small piece against the whole layer. Done literally, that is + // quadratic in the number of pieces, which is what a layer split up by colour painting has, + // so each is restricted to the part of the layer near the piece with an identical result: + // object_volume is clipped to the piece's box, and only the internal polygons whose box meets + // the expanded piece take part in the count, since the others pass through the difference + // unchanged and add the same number to both sides of it. + std::vector internal_bboxes; + internal_bboxes.reserve(internal_volume.size()); + for (const Polygon &poly : internal_volume) + internal_bboxes.emplace_back(get_extents(poly)); regularized_shell.erase(std::remove_if(regularized_shell.begin(), regularized_shell.end(), - [&internal_volume, &min_perimeter_infill_spacing, + [&internal_volume, &internal_bboxes, &min_perimeter_infill_spacing, &object_volume](const ExPolygon &p) { - return (p.area() < min_perimeter_infill_spacing * scaled(1.5) || - (p.area() < min_perimeter_infill_spacing * scaled(8.0) && - diff(to_polygons(p), object_volume).empty())) && - diff(internal_volume, - expand(to_polygons(p), min_perimeter_infill_spacing)) - .size() >= internal_volume.size(); + const bool small = p.area() < min_perimeter_infill_spacing * scaled(1.5) || + (p.area() < min_perimeter_infill_spacing * scaled(8.0) && + diff(to_polygons(p), + ClipperUtils::clip_clipper_polygons_with_subject_bbox( + object_volume, get_extents(p).inflated(SCALED_EPSILON))) + .empty()); + if (!small) + return false; + const Polygons expanded = expand(to_polygons(p), min_perimeter_infill_spacing); + const BoundingBox bbox = get_extents(expanded); + Polygons nearby; + for (size_t i = 0; i < internal_volume.size(); ++i) + if (internal_bboxes[i].overlap(bbox)) + nearby.emplace_back(internal_volume[i]); + return diff(nearby, expanded).size() >= nearby.size(); }), regularized_shell.end()); } @@ -2876,8 +2999,9 @@ void PrintObject::discover_vertical_shells() #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ // Trim the internal & internalvoid by the shell. - Slic3r::ExPolygons new_internal = diff_ex(layerm->fill_surfaces.filter_by_type(stInternal), regularized_shell); - Slic3r::ExPolygons new_internal_void = diff_ex(layerm->fill_surfaces.filter_by_type(stInternalVoid), regularized_shell); + const Polygons regularized_shell_polygons = to_polygons(regularized_shell); + Slic3r::ExPolygons new_internal = diff_ex_by_piece(to_expolygons(layerm->fill_surfaces.filter_by_type(stInternal)), regularized_shell_polygons); + Slic3r::ExPolygons new_internal_void = diff_ex_by_piece(to_expolygons(layerm->fill_surfaces.filter_by_type(stInternalVoid)), regularized_shell_polygons); #ifdef SLIC3R_DEBUG_SLICE_PROCESSING { @@ -2904,7 +3028,15 @@ void PrintObject::discover_vertical_shells() layerm->export_region_fill_surfaces_to_svg_debug("3_discover_vertical_shells-final"); } #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ - } // for each region + }; // for each region + if (top_bottom_surfaces_all_regions) + // Nothing is shared between the regions, and a layer cut through a fine relief takes far longer than the others, + // so they run next to each other instead of one after another. + tbb::parallel_for(size_t(0), this->num_printing_regions(), process_region); + else + // Here every region fills the one top/bottom cache with its own surfaces first. + for (size_t region_id = 0; region_id < this->num_printing_regions(); ++ region_id) + process_region(region_id); } // void PrintObject::discover_vertical_shells() // #define DEBUG_BRIDGE_OVER_INFILL @@ -2926,6 +3058,32 @@ template void debug_draw(std::string name, const T& a, const T& b, c } #endif +// Whether a fill surface of the layer with the given id prints at full density, by the density Fill.cpp gives its type, once +// bridge_over_infill() and combine_infill() have run. +static bool prints_dense(const Surface &surface, const PrintRegionConfig ®ion_config, const PrintObjectConfig &object_config, size_t layer_id) +{ + switch (surface.surface_type) { + case stInternal: return region_config.sparse_infill_density.value == 100; + case stTop: return region_config.top_surface_density.value == 100; + case stBottom: return region_config.bottom_surface_density.value == 100; + case stBottomBridge: return region_config.bridge_density.value == 100; + case stInternalSolid: + // Elephant foot compensation thins it on the layers just above the first, and combining infill leaves voids below + // the top layer of each group. + if (region_config.infill_combination.value || + (object_config.elefant_foot_layers_density.value < 100 && layer_id > 0 && + layer_id <= size_t(object_config.elefant_foot_compensation_layers.value))) + return false; + // Where it lies over sparse infill, bridge_over_infill() turns it into an internal bridge. + [[fallthrough]]; + case stInternalBridge: + case stSecondInternalBridge: + case stInternalAfterExternalBridge: + return region_config.bridge_density.value == 100 && object_config.internal_bridge_density.value == 100; + default: return false; + } +} + // This method applies bridge flow to the first internal solid layer above sparse infill. void PrintObject::bridge_over_infill() { @@ -2975,6 +3133,9 @@ void PrintObject::bridge_over_infill() // unsupported area will serve as a filter for polygons worth bridging. Polygons unsupported_area; Polygons lower_layer_solids; + // Whether every fill surface of the lower layer prints at full density, which the early-out below needs. Kept + // apart from the unchanged rule for what counts as a solid to expand. + bool dense_below = true; for (const LayerRegion *region : layer->lower_layer->regions()) { Polygons fill_polys = to_polygons(region->fill_expolygons); // initially consider the whole layer unsupported, but also gather solid layers to later cut off supported parts @@ -2984,6 +3145,7 @@ void PrintObject::bridge_over_infill() Polygons p = to_polygons(surface.expolygon); lower_layer_solids.insert(lower_layer_solids.end(), p.begin(), p.end()); } + dense_below = dense_below && prints_dense(surface, region->region().config(), po->config(), layer->lower_layer->id()); } } unsupported_area = closing(unsupported_area, float(SCALED_EPSILON)); @@ -2997,10 +3159,15 @@ void PrintObject::bridge_over_infill() // By expanding the lower layer solids, we avoid making bridges from the tiny internal overhangs that are (very likely) supported by previous layer solids // NOTE that we cannot filter out polygons worth bridging by their area, because sometimes there is a very small internal island that will grow into large hole lower_layer_solids = shrink(lower_layer_solids, 1 * spacing); // first remove thin regions that will not support anything - lower_layer_solids = expand(lower_layer_solids, (1 + expansion_multiplier) * spacing); // then expand back (opening), and further for parts supported by internal solids // By shrinking the unsupported area, we avoid making bridges from narrow ensuring region along perimeters. unsupported_area = shrink(unsupported_area, expansion_multiplier * spacing); - unsupported_area = diff(unsupported_area, lower_layer_solids); + // Then expand the solids back (opening), and further for parts supported by internal solids. Over a lower layer + // printed at full density the expansion nearly always covers everything, which diff_expanded() proves at a + // fraction of the cost. Where Clipper's own offset decimation folds a sliver of solid thinner than about 0.01 + // of the reach, about 16 µm here, its result may differ from the full expansion's; that is accepted. + const float reach = float((1 + expansion_multiplier) * spacing); + unsupported_area = dense_below ? diff_expanded(unsupported_area, lower_layer_solids, reach) : + diff(unsupported_area, expand(lower_layer_solids, reach)); for (const LayerRegion *region : layer->regions()) { SurfacesPtr region_internal_solids = region->fill_surfaces.filter_by_type(stInternalSolid); @@ -3195,7 +3362,7 @@ void PrintObject::bridge_over_infill() } this->m_adaptive_fill_octrees = this->prepare_adaptive_infill_data(surfaces_w_layer); - this->m_tpms_radial_fields = this->prepare_tpms_radial_fields(); + this->m_adaptive_infill_fields = this->prepare_adaptive_infill_fields(); std::vector layers_to_generate_infill; for (const auto &pair : surfaces_by_layer) { @@ -3425,6 +3592,16 @@ void PrintObject::bridge_over_infill() vertical_lines[i].b = Point{x, y_max}; } + // The vertical lines only span the bridged area's x range, so anchors entirely outside it can never be + // hit. Leaving them out gives the same intersections without building a tree over the whole layer's + // boundary for every bridge. + const coord_t scan_x_min = bb_x.min.x(); + const coord_t scan_x_max = bb_x.min.x() + coord_t(n_vlines) * scan_spacing; + anchors.erase(std::remove_if(anchors.begin(), anchors.end(), + [scan_x_min, scan_x_max](const Line &l) { + return std::max(l.a.x(), l.b.x()) < scan_x_min || std::min(l.a.x(), l.b.x()) > scan_x_max; + }), + anchors.end()); auto anchors_and_walls_tree = AABBTreeLines::LinesDistancer{std::move(anchors)}; auto bridged_area_tree = AABBTreeLines::LinesDistancer{to_lines(bridged_area)}; @@ -3669,26 +3846,58 @@ void PrintObject::bridge_over_infill() std::vector expanded_surfaces; expanded_surfaces.reserve(surfaces_by_layer[lidx].size()); + // The expanded fill boundary depends only on the bridging flow, and total_fill_area is not + // modified below, so build it once per spacing rather than once per candidate. A layer split + // into many candidates (e.g. by colour painting) otherwise repeats a layer-wide offset for each. + std::map boundary_by_spacing; + // expansion_area is a clean, non-overlapping set, so cutting a bridge out of it only changes the + // polygons near that bridge. The rest are passed through untouched instead of being fed to Clipper + // with the whole layer again for every candidate. + // Not `near`/`far`: the Windows headers still define those as macros, and they expand to + // nothing, which turns the declaration below into an empty one. + const auto split_near = [](const Polygons &polys, const BoundingBox &bbox, Polygons &rest) { + Polygons nearby; + for (const Polygon &p : polys) + (get_extents(p).overlap(bbox) ? nearby : rest).emplace_back(p); + return nearby; + }; for (const CandidateSurface &candidate : surfaces_by_layer[lidx]) { const auto ®ion_config = candidate.region->region().config(); const bool turning_pattern = region_config.sparse_infill_pattern == ipHilbertCurve || region_config.sparse_infill_pattern == ipOctagramSpiral; const Flow &flow = candidate.region->bridging_flow(frSolidInfill, true); - ExPolygons bridge_components = intersection_ex(expand(candidate.new_polys, flow.scaled_spacing()), deep_infill_area); + const Polygons expanded_polys = expand(candidate.new_polys, flow.scaled_spacing()); + // deep_infill_area and internal_unsupported_area cover the whole layer; only their part under + // this candidate can change the results, so they are clipped to its box first. + ExPolygons bridge_components; + if (!expanded_polys.empty()) + bridge_components = intersection_ex(expanded_polys, + ClipperUtils::clip_clipper_polygons_with_subject_bbox( + deep_infill_area, get_extents(expanded_polys).inflated(SCALED_EPSILON))); // Orca: Filter whole bridge areas so their holes remain holes. bridge_components.erase(std::remove_if(bridge_components.begin(), bridge_components.end(), [&internal_unsupported_area](const ExPolygon &component) { - return intersection_ex(component, internal_unsupported_area).empty(); + return intersection_ex(component, ClipperUtils::clip_clipper_polygons_with_subject_bbox( + internal_unsupported_area, + get_extents(component).inflated(SCALED_EPSILON))) + .empty(); }), bridge_components.end()); Polygons area_to_be_bridge = to_polygons(std::move(bridge_components)); - Polygons limiting_area = union_(area_to_be_bridge, expansion_area); - if (area_to_be_bridge.empty()) continue; - Polylines boundary_plines = to_polylines(expand(total_fill_area, 1.3f * flow.scaled_spacing())); + // Not split like the cut of expansion_area below: the whole limiting area is grown by 30% of the spacing, + // which merges neighbouring polygons, and any of its boundary can anchor the bridge. + Polygons limiting_area = union_(area_to_be_bridge, expansion_area); + + auto boundary_it = boundary_by_spacing.find(flow.scaled_spacing()); + if (boundary_it == boundary_by_spacing.end()) + boundary_it = boundary_by_spacing + .emplace(flow.scaled_spacing(), to_polylines(expand(total_fill_area, 1.3f * flow.scaled_spacing()))) + .first; + Polylines boundary_plines = boundary_it->second; { Polylines limiting_plines = to_polylines(expand(limiting_area, 0.3f * flow.scaled_spacing())); boundary_plines.insert(boundary_plines.end(), limiting_plines.begin(), limiting_plines.end()); @@ -3764,9 +3973,12 @@ void PrintObject::bridge_over_infill() // Check collision with other expanded surfaces { bool reconstruct = false; - Polygons tmp_expanded_area = expand(bridging_area, 3.0f * flow.scaled_spacing()); + Polygons tmp_expanded_area = expand(bridging_area, 3.0 * flow.scaled_spacing()); + const BoundingBox tmp_expanded_bbox = get_extents(tmp_expanded_area); for (const CandidateSurface &s : expanded_surfaces) { - if (!intersection(s.new_polys, tmp_expanded_area).empty()) { + // Surfaces whose boxes miss each other cannot intersect, which is most pairs on a busy layer. + if (get_extents(s.new_polys).overlap(tmp_expanded_bbox) && + !intersection(s.new_polys, tmp_expanded_area).empty()) { bridging_angle = s.bridge_angle; reconstruct = true; break; @@ -3790,10 +4002,20 @@ void PrintObject::bridge_over_infill() bridging_area = union_(bridging_area, construct_anchored_polygon(bridging_area, to_lines(boundary_plines), flow, bridging_angle, scan_spacing, true)); } - bridging_area = intersection(bridging_area, limiting_area); - bridging_area = intersection(bridging_area, total_fill_area); - bridging_area = diff(bridging_area, total_top_area); - expansion_area = diff(expansion_area, bridging_area); + // Each of these meets one bridge with the whole layer, so the layer side is first cut down to the + // bridge's box (and expansion_area split as above); the result is the same. + if (!bridging_area.empty()) { + const BoundingBox bridging_bbox = get_extents(bridging_area).inflated(SCALED_EPSILON); + bridging_area = intersection(bridging_area, ClipperUtils::clip_clipper_polygons_with_subject_bbox(limiting_area, bridging_bbox)); + bridging_area = intersection(bridging_area, ClipperUtils::clip_clipper_polygons_with_subject_bbox(total_fill_area, bridging_bbox)); + bridging_area = diff(bridging_area, ClipperUtils::clip_clipper_polygons_with_subject_bbox(total_top_area, bridging_bbox)); + } + if (!bridging_area.empty()) { + Polygons kept; + const Polygons cut = split_near(expansion_area, get_extents(bridging_area).inflated(SCALED_EPSILON), kept); + append(kept, diff(cut, bridging_area)); + expansion_area = std::move(kept); + } #ifdef DEBUG_BRIDGE_OVER_INFILL debug_draw(std::to_string(lidx) + "_" + std::to_string(cluster_idx) + "_" + std::to_string(job_idx) + "_" + "_expanded_bridging" + std::to_string(r), @@ -4358,6 +4580,24 @@ std::vector PrintObject::object_extruders() const return extruders; } +std::vector PrintObject::printing_extruders() const +{ + std::vector extruders = object_extruders(); + if (has_support_material()) { + const size_t filament_count = print()->config().filament_diameter.size(); + auto append_fixed_filament = [&](const int filament_id) { + if (filament_id > 0) + extruders.emplace_back(std::min(size_t(filament_id - 1), filament_count > 0 ? filament_count - 1 : 0)); + }; + append_fixed_filament(config().support_filament.value); + append_fixed_filament(config().support_interface_filament.value); + } + if (extruders.empty()) + extruders.emplace_back(0); + sort_remove_duplicates(extruders); + return extruders; +} + bool PrintObject::update_layer_height_profile(const ModelObject &model_object, const SlicingParameters &slicing_parameters, std::vector &layer_height_profile) { bool updated = false; diff --git a/src/libslic3r/PrintObjectSlice.cpp b/src/libslic3r/PrintObjectSlice.cpp index c4b250bac4..e2f2c1af8a 100644 --- a/src/libslic3r/PrintObjectSlice.cpp +++ b/src/libslic3r/PrintObjectSlice.cpp @@ -551,7 +551,11 @@ static std::vector> slices_to_regions( } //BBS: justify whether a volume is connected to another one -bool doesVolumeIntersect(VolumeSlices& vs1, VolumeSlices& vs2) +// bboxes1 and bboxes2 hold the extents of each layer's slices. Slices whose boxes are disjoint cannot overlap, so +// the Clipper test runs only for slices that are close. The layers are scanned serially because this is called +// for every pair of volumes: a parallel_for per call costs far more in thread wake-ups than the scan itself. +static bool doesVolumeIntersect(const VolumeSlices& vs1, const std::vector& bboxes1, + const VolumeSlices& vs2, const std::vector& bboxes2) { if (vs1.volume_id == vs2.volume_id) return true; // two volumes in the same object should have same number of layers, otherwise the slicing is incorrect. @@ -559,28 +563,17 @@ bool doesVolumeIntersect(VolumeSlices& vs1, VolumeSlices& vs2) auto& vs1s = vs1.slices; auto& vs2s = vs2.slices; - bool is_intersect = false; + auto layers_overlap = [&](size_t i, size_t j) { + return bboxes1[i].defined && bboxes2[j].defined && bboxes1[i].overlap(bboxes2[j]) && overlaps(vs1s[i], vs2s[j]); + }; - tbb::parallel_for(tbb::blocked_range(0, vs1s.size()), - [&vs1s, &vs2s, &is_intersect](const tbb::blocked_range& range) { - for (auto i = range.begin(); i != range.end(); ++i) { - if (vs1s[i].empty()) continue; - - if (overlaps(vs1s[i], vs2s[i])) { - is_intersect = true; - break; - } - if (i + 1 != vs2s.size() && overlaps(vs1s[i], vs2s[i + 1])) { - is_intersect = true; - break; - } - if (i - 1 >= 0 && overlaps(vs1s[i], vs2s[i - 1])) { - is_intersect = true; - break; - } - } - }); - return is_intersect; + for (size_t i = 0; i < vs1s.size(); ++i) { + if (layers_overlap(i, i) || + (i + 1 < vs2s.size() && layers_overlap(i, i + 1)) || + (i > 0 && layers_overlap(i, i - 1))) + return true; + } + return false; } //BBS: grouping the volumes of an object according to their connection relationship @@ -590,7 +583,10 @@ bool groupingVolumes(std::vector objSliceByVolume, std::vector> osvIndex; + // Extents of each volume's offset slices per layer, for the prefilter in doesVolumeIntersect(). + std::vector> bboxes(objSliceByVolume.size()); for (int i = 0; i != objSliceByVolume.size(); ++i) { + bboxes[i].resize(objSliceByVolume[i].slices.size()); for (int j = 0; j != objSliceByVolume[i].slices.size(); ++j) { osvIndex.push_back({ i,j }); } @@ -605,9 +601,10 @@ bool groupingVolumes(std::vector objSliceByVolume, std::vector(0, osvIndex.size()), - [&osvIndex, &objSliceByVolume,&offsetValue](const tbb::blocked_range& range) { + [&osvIndex, &objSliceByVolume,&offsetValue, &bboxes](const tbb::blocked_range& range) { for (auto k = range.begin(); k != range.end(); ++k) { objSliceByVolume[osvIndex[k][0]].slices[osvIndex[k][1]] = offset_ex(objSliceByVolume[osvIndex[k][0]].slices[osvIndex[k][1]], offsetValue); + bboxes[osvIndex[k][0]][osvIndex[k][1]] = get_extents(objSliceByVolume[osvIndex[k][0]].slices[osvIndex[k][1]]); } }); @@ -616,7 +613,7 @@ bool groupingVolumes(std::vector objSliceByVolume, std::vector #include #include +#include #include "MultiMaterialSegmentation.hpp" namespace Slic3r { @@ -96,6 +98,46 @@ std::vector> chain_segments_closest_point(std::vector> chain_segments_exact(const std::vector &end_points, const std::vector &could_reverse, const Vec2d *start) +{ + const size_t n = could_reverse.size(); + assert(n >= 1 && n <= 12 && end_points.size() == 2 * n); + // State (mask * n + j) * 2 + o: the segments of mask visited, the last one j, flipped when o. + const size_t num_states = (size_t(1) << n) * n * 2; + std::vector cost(num_states, std::numeric_limits::max()); + std::vector from(num_states, size_t(-1)); + auto entry = [&end_points](size_t j, size_t o) -> const Vec2d & { return end_points[2 * j + o]; }; + auto exit = [&end_points](size_t j, size_t o) -> const Vec2d & { return end_points[2 * j + 1 - o]; }; + for (size_t j = 0; j < n; ++ j) + for (size_t o = 0; o <= size_t(could_reverse[j] != 0); ++ o) + cost[((size_t(1) << j) * n + j) * 2 + o] = start == nullptr ? 0. : (entry(j, o) - *start).norm(); + for (size_t mask = 1; mask < (size_t(1) << n); ++ mask) + for (size_t s = mask * n * 2; s < (mask + 1) * n * 2; ++ s) + if (cost[s] < std::numeric_limits::max()) + for (size_t k = 0; k < n; ++ k) + if (! (mask >> k & 1)) + for (size_t o = 0; o <= size_t(could_reverse[k] != 0); ++ o) { + const size_t next = (((mask | size_t(1) << k) * n) + k) * 2 + o; + const double c = cost[s] + (entry(k, o) - exit(s / 2 % n, s & 1)).norm(); + if (c < cost[next]) { + cost[next] = c; + from[next] = s; + } + } + const size_t full = (size_t(1) << n) - 1; + size_t best = full * n * 2; + for (size_t s = best; s < num_states; ++ s) + if (cost[s] < cost[best]) + best = s; + std::vector> out(n); + for (size_t s = best, k = n; k -- > 0; s = from[s]) + out[k] = { s / 2 % n, (s & 1) != 0 }; + return out; +} + // Chain perimeters (always closed) and thin fills (closed or open) using a greedy algorithm. // Solving a Traveling Salesman Problem (TSP) with the modification, that the sites are not always points, but points and segments. // Solving using a greedy algorithm, where a shortest edge is added to the solution if it does not produce a bifurcation or a cycle. @@ -104,6 +146,7 @@ std::vector> chain_segments_closest_point(std::vector std::vector> chain_segments_greedy_constrained_reversals_(SegmentEndPointFunc end_point_func, CouldReverseFunc could_reverse_func, size_t num_segments, const PointType *start_near) { @@ -118,6 +161,19 @@ std::vector> chain_segments_greedy_constrained_reversals out.emplace_back(0, could_reverse_func(0) && start_near != nullptr && (end_point_func(0, false) - *start_near).template cast().squaredNorm() < (end_point_func(0, true) - *start_near).template cast().squaredNorm()); } + else if (num_segments <= 4) + { + // Orca: so few segments are cheap to chain exactly. The first one is then not always the one nearest start_near. + std::vector end_points(2 * num_segments); + std::vector could_reverse(num_segments); + for (size_t i = 0; i < num_segments; ++ i) { + end_points[2 * i] = end_point_func(i, true).template cast(); + end_points[2 * i + 1] = end_point_func(i, false).template cast(); + could_reverse[i] = could_reverse_func(i); + } + const Vec2d start = start_near != nullptr ? Vec2d(start_near->template cast()) : Vec2d::Zero(); + out = chain_segments_exact(end_points, could_reverse, start_near != nullptr ? &start : nullptr); + } else { // End points of segments for the KD tree closest point search. @@ -1039,12 +1095,370 @@ std::vector> chain_segments_greedy2(SegmentEndPointFunc return chain_segments_greedy_constrained_reversals2_(end_point_func, could_reverse_func, num_segments, start_near); } +// The K points nearest to a query, nearest first, ties by index, from a uniform grid of about two points per cell. +template +class NearestPoints +{ +public: + static constexpr size_t npos = size_t(-1); + + explicit NearestPoints(const std::vector &points) : m_points(points) + { + BoundingBoxf bbox; + for (const Vec2d &p : points) + bbox.merge(p); + const Vec2d size = bbox.size(); + const double count = double(std::max(points.size(), 1)); + m_cell = std::max(std::sqrt(2. * size.x() * size.y() / count), std::max(size.x(), size.y()) / count); + if (m_cell <= 0.) + m_cell = 1.; + m_origin = bbox.min; + m_cols = int(size.x() / m_cell) + 1; + m_rows = int(size.y() / m_cell) + 1; + m_first.assign(size_t(m_cols) * m_rows + 1, 0); + for (const Vec2d &p : points) + ++ m_first[cell(p) + 1]; + for (size_t c = 1; c < m_first.size(); ++ c) + m_first[c] += m_first[c - 1]; + m_index.resize(points.size()); + std::vector next(m_first.begin(), m_first.end() - 1); + for (size_t i = 0; i < points.size(); ++ i) + m_index[next[cell(points[i])] ++] = i; + } + + // Indices of the nearest points that filter accepts, npos past the last one. + template + std::array query(const Vec2d &q, Filter filter) const + { + std::array, K> best; + size_t found = 0; + const int cx = int(std::clamp(std::floor((q.x() - m_origin.x()) / m_cell), 0., double(m_cols - 1))); + const int cy = int(std::clamp(std::floor((q.y() - m_origin.y()) / m_cell), 0., double(m_rows - 1))); + auto visit = [&](int x, int y) { + if (x < 0 || y < 0 || x >= m_cols || y >= m_rows) + return; + const size_t c = size_t(y) * m_cols + x; + for (size_t k = m_first[c]; k < m_first[c + 1]; ++ k) { + const size_t i = m_index[k]; + if (! filter(i)) + continue; + const std::pair candidate((m_points[i] - q).squaredNorm(), i); + if (found == K && ! (candidate < best[K - 1])) + continue; + auto it = std::upper_bound(best.begin(), best.begin() + found, candidate); + std::move_backward(it, best.begin() + std::min(found, K - 1), best.begin() + std::min(found + 1, K)); + *it = candidate; + found = std::min(found + 1, K); + } + }; + // Points beyond ring r are at least r cells away. + for (int r = 0; r <= std::max(m_cols, m_rows); ++ r) { + if (r == 0) + visit(cx, cy); + for (int d = -r; d <= r && r > 0; ++ d) { + visit(cx + d, cy - r); + visit(cx + d, cy + r); + if (d != -r && d != r) { + visit(cx - r, cy + d); + visit(cx + r, cy + d); + } + } + if (found == K && best[K - 1].first <= sqr(r * m_cell)) + break; + } + std::array out; + out.fill(npos); + for (size_t k = 0; k < found; ++ k) + out[k] = best[k].second; + return out; + } + +private: + size_t cell(const Vec2d &p) const + { + const int x = std::clamp(int((p.x() - m_origin.x()) / m_cell), 0, m_cols - 1); + const int y = std::clamp(int((p.y() - m_origin.y()) / m_cell), 0, m_rows - 1); + return size_t(y) * m_cols + x; + } + + const std::vector &m_points; + Vec2d m_origin; + double m_cell; + int m_cols; + int m_rows; + std::vector m_first; + std::vector m_index; +}; + +// Shortens the travel of a chain with 2-opt moves (reversing a run of segments) and or-opt moves (moving a run of up to +// three segments elsewhere, or a longer one to the front, flipped or not). end_points holds the first and the last point +// of each segment. The chain starts at start_near when given, and its end is free. A move that would flip a segment that +// cannot reverse is skipped. Moves only create links between nearest neighbor end points, and after a move only the +// segments next to a changed link are examined again, until a sweep of all segments finds no move. This keeps the search +// close to linear. +static void improve_chain_by_local_search(std::vector> &chain, const std::vector &end_points, + const std::vector &could_reverse, const Vec2d *start_near) +{ + const size_t n = chain.size(); + if (n < 2) + return; + assert(end_points.size() == 2 * n && could_reverse.size() == n); + + std::vector order(n), pos(n), fixed_before(n + 1, 0); + std::vector flipped(n); + for (size_t k = 0; k < n; ++ k) { + order[k] = chain[k].first; + flipped[order[k]] = chain[k].second; + } + // Updates positions lo..hi after a move, which keeps the number of segments that cannot reverse past hi. + auto refresh = [&](size_t lo, size_t hi) { + for (size_t k = lo; k <= hi; ++ k) { + pos[order[k]] = k; + fixed_before[k + 1] = fixed_before[k] + ! could_reverse[order[k]]; + } + }; + refresh(0, n - 1); + auto entry_idx = [&](size_t k) { return 2 * order[k] + flipped[order[k]]; }; + auto exit_idx = [&](size_t k) { return 2 * order[k] + 1 - flipped[order[k]]; }; + auto entry = [&](size_t k) -> const Vec2d& { return end_points[entry_idx(k)]; }; + auto exit = [&](size_t k) -> const Vec2d& { return end_points[exit_idx(k)]; }; + auto is_exit = [&](size_t e) { return char(e & 1) != flipped[e >> 1]; }; + auto reversible = [&](size_t i, size_t j) { return fixed_before[j + 1] == fixed_before[i]; }; + auto dist = [](const Vec2d *a, const Vec2d *b) { return a == nullptr || b == nullptr ? 0. : (*a - *b).norm(); }; + // Travel end points around position k, null where the chain is open. + auto prev_exit = [&](size_t k) -> const Vec2d* { return k > 0 ? &exit(k - 1) : start_near; }; + auto next_entry = [&](size_t k) -> const Vec2d* { return k + 1 < n ? &entry(k + 1) : nullptr; }; + + // The 32 nearest end points are the candidates, which covers every move on short chains; 8 missed much of the gain. + static constexpr size_t K = 32; + static constexpr size_t npos = NearestPoints::npos; + const NearestPoints nearest(end_points); + std::vector> neighbors(end_points.size()); + for (size_t e = 0; e < end_points.size(); ++ e) + neighbors[e] = nearest.query(end_points[e], [e](size_t idx) { return (idx >> 1) != (e >> 1); }); + std::array start_neighbors; + start_neighbors.fill(npos); + if (start_near != nullptr) + start_neighbors = nearest.query(*start_near, [](size_t) { return true; }); + + // Segments to examine, by id, each queued once. + std::deque queue; + std::vector queued(n, 0); + auto enqueue = [&](size_t k) { + if (k < n && ! queued[order[k]]) { + queued[order[k]] = 1; + queue.push_back(order[k]); + } + }; + + const double min_gain = SCALED_EPSILON; + // Reverses positions i..j if that shortens the chain. + auto try_2opt = [&](size_t i, size_t j) { + if (! reversible(i, j)) + return false; + const Vec2d *a = prev_exit(i), *b = next_entry(j); + if (dist(a, &exit(j)) + dist(&entry(i), b) > dist(a, &entry(i)) + dist(&exit(j), b) - min_gain) + return false; + std::reverse(order.begin() + i, order.begin() + j + 1); + for (size_t k = i; k <= j; ++ k) + flipped[order[k]] ^= 1; + refresh(i, j); + for (size_t k : { i - 1, i, j, j + 1 }) + enqueue(k); + return true; + }; + // Moves positions i..last after position gap (size_t(-1) for the front) if that shortens the chain. + auto try_oropt = [&](size_t i, size_t last, size_t gap) { + if (gap + 1 == i || (gap >= i && gap <= last)) + return false; + const Vec2d *a = gap == size_t(-1) ? start_near : &exit(gap); + const Vec2d *b = gap + 1 < n ? &entry(gap + 1) : nullptr; + const double removal_gain = dist(prev_exit(i), &entry(i)) + dist(&exit(last), next_entry(last)) - dist(prev_exit(i), next_entry(last)); + const double base = dist(a, b); + const double cost_kept = dist(a, &entry(i)) + dist(&exit(last), b) - base; + const double cost_flipped = reversible(i, last) ? dist(a, &exit(last)) + dist(&entry(i), b) - base : std::numeric_limits::max(); + if (std::min(cost_kept, cost_flipped) > removal_gain - min_gain) + return false; + const size_t len = last - i + 1; + // The run lands on first..first+len-1; lo..hi spans every position that changed. + const bool forward = gap > last && gap != size_t(-1); + const size_t first = forward ? gap + 1 - len : gap + 1; + const size_t lo = forward ? i : first; + const size_t hi = forward ? gap : last; + if (forward) + std::rotate(order.begin() + i, order.begin() + last + 1, order.begin() + gap + 1); + else + std::rotate(order.begin() + first, order.begin() + i, order.begin() + last + 1); + if (cost_flipped < cost_kept) { + std::reverse(order.begin() + first, order.begin() + first + len); + for (size_t k = first; k < first + len; ++ k) + flipped[order[k]] ^= 1; + } + refresh(lo, hi); + // The links around the run's new place, and the link closing its old place. + for (size_t k : { first - 1, first, first + len - 1, first + len, forward ? i - 1 : last, forward ? i : last + 1 }) + enqueue(k); + return true; + }; + // The gap before position k of the chain with positions i..last taken out. + auto gap_before = [](size_t k, size_t i, size_t last) { return k == last + 1 ? i - 1 : k - 1; }; + + // Applies the first move found that breaks a link next to position p. + // Candidates are tried nearest first, while closer than the link the move would replace at that end point. + auto closer = [&](const Vec2d &at, size_t q, double limit) { return q != npos && (end_points[q] - at).norm() < limit; }; + auto improve_at = [&](size_t p) { + // 2-opt breaking the link into p, as the first or the last link of the reversed run. + if (const Vec2d *a = prev_exit(p); a != nullptr) { + const double old_link = dist(a, &entry(p)); + for (size_t q : p > 0 ? neighbors[exit_idx(p - 1)] : start_neighbors) { + if (! closer(*a, q, old_link)) + break; + if (is_exit(q) && pos[q >> 1] >= p && try_2opt(p, pos[q >> 1])) + return true; + } + if (p > 0) + for (size_t q : neighbors[entry_idx(p)]) { + if (! closer(entry(p), q, old_link)) + break; + if (! is_exit(q) && pos[q >> 1] < p && try_2opt(pos[q >> 1], p - 1)) + return true; + } + } + // 2-opt breaking the link out of p. + if (p + 1 < n) { + const double old_link = dist(&exit(p), &entry(p + 1)); + for (size_t q : neighbors[exit_idx(p)]) { + if (! closer(exit(p), q, old_link)) + break; + if (is_exit(q) && pos[q >> 1] > p && try_2opt(p + 1, pos[q >> 1])) + return true; + } + for (size_t q : neighbors[entry_idx(p + 1)]) { + if (! closer(entry(p + 1), q, old_link)) + break; + if (! is_exit(q) && pos[q >> 1] <= p && try_2opt(pos[q >> 1], p)) + return true; + } + } + // A run of any length that starts or ends next to the start point moves to the front. + if (p == 0) + for (size_t q : start_neighbors) { + if (q == npos) + break; + const size_t m = pos[q >> 1]; + if (m == 0) + continue; + // Runs m..k enter next to the start, runs k..m leave there and go flipped. + const bool exit_near = is_exit(q); + for (size_t k = exit_near ? 1 : m; k < (exit_near ? m + 1 : n); ++ k) + if (try_oropt(exit_near ? k : m, exit_near ? m : k, size_t(-1))) + return true; + } + // Or-opt of the runs starting at p: next to an exit a run goes after that segment, next to an entry before it. + for (size_t last = p; last < std::min(p + 3, n); ++ last) { + if (try_oropt(p, last, size_t(-1))) + return true; + const double removal_gain = dist(prev_exit(p), &entry(p)) + dist(&exit(last), next_entry(last)) - dist(prev_exit(p), next_entry(last)); + for (size_t e : { entry_idx(p), exit_idx(last) }) + for (size_t q : neighbors[e]) { + if (! closer(end_points[e], q, removal_gain)) + break; + const size_t m = pos[q >> 1]; + if ((m < p || m > last) && try_oropt(p, last, is_exit(q) ? m : gap_before(m, p, last))) + return true; + } + } + return false; + }; + + // A new link can make room for a run that sits elsewhere, hence the sweeps until one finds no move. Every move shortens + // the chain, so the search ends; the cap only bounds its time. + for (size_t k = 0; k < n; ++ k) + enqueue(k); + bool moved_since_sweep = false; + for (size_t moves = 0; moves < 50 * n;) { + if (queue.empty()) { + if (! moved_since_sweep) + break; + moved_since_sweep = false; + for (size_t k = 0; k < n; ++ k) + enqueue(k); + } + const size_t segment = queue.front(); + queue.pop_front(); + queued[segment] = 0; + if (improve_at(pos[segment])) { + ++ moves; + moved_since_sweep = true; + enqueue(pos[segment]); + } + } + + for (size_t k = 0; k < n; ++ k) + chain[k] = { order[k], flipped[order[k]] != 0 }; +} + +// Chain that always goes on to the nearest free end point, from start. +static std::vector> chain_nearest_next(const std::vector &end_points, const std::vector &could_reverse, const Vec2d &start) +{ + const NearestPoints<1> nearest(end_points); + std::vector taken(could_reverse.size(), 0); + std::vector> out; + out.reserve(could_reverse.size()); + for (Vec2d at = start; out.size() < could_reverse.size();) { + const size_t e = nearest.query(at, [&](size_t idx) { return ! taken[idx >> 1] && ((idx & 1) == 0 || could_reverse[idx >> 1]); })[0]; + taken[e >> 1] = 1; + out.emplace_back(e >> 1, (e & 1) != 0); + at = end_points[e ^ 1]; + } + return out; +} + +static double chain_travel(const std::vector> &chain, const std::vector &end_points, const Vec2d &start) +{ + double travel = 0.; + Vec2d at = start; + for (const std::pair &segment : chain) { + travel += (end_points[2 * segment.first + segment.second] - at).norm(); + at = end_points[2 * segment.first + 1 - segment.second]; + } + return travel; +} + template -static std::vector> chain_extrusion_entities_impl(const std::vector &entities, const Point *start_near) +static std::vector> chain_extrusion_entities_impl(const std::vector &entities, const Point *start_near, bool improve = false) { auto segment_end_point = [&entities](size_t idx, bool first_point) -> Point { return first_point ? entities[idx]->first_point() : entities[idx]->last_point(); }; auto could_reverse = [&entities](size_t idx) { const ExtrusionEntity *ee = entities[idx]; return ee->is_loop() || ee->can_reverse(); }; std::vector> out = chain_segments_greedy_constrained_reversals(segment_end_point, could_reverse, entities.size(), start_near); + if (improve && out.size() > 1) { + std::vector end_points; + std::vector reversible; + end_points.reserve(2 * entities.size()); + reversible.reserve(entities.size()); + for (size_t idx = 0; idx < entities.size(); ++ idx) { + end_points.emplace_back(segment_end_point(idx, true).template cast()); + end_points.emplace_back(segment_end_point(idx, false).template cast()); + reversible.emplace_back(could_reverse(idx)); + } + Vec2d start = Vec2d::Zero(); + if (start_near != nullptr) + start = start_near->cast(); + if (entities.size() <= 8) { + // Few paths are chained exactly; the local search below can stop short of the shortest chain. + out = chain_segments_exact(end_points, reversible, start_near != nullptr ? &start : nullptr); + } else { + improve_chain_by_local_search(out, end_points, reversible, start_near != nullptr ? &start : nullptr); + if (start_near != nullptr) { + // The greedy chain can settle into a sweep that local moves cannot undo, which a nearest-next chain may avoid. + std::vector> nearest_next = chain_nearest_next(end_points, reversible, start); + if (chain_travel(nearest_next, end_points, start) < chain_travel(out, end_points, start) - SCALED_EPSILON) { + improve_chain_by_local_search(nearest_next, end_points, reversible, &start); + out = std::move(nearest_next); + } + } + } + } for (std::pair &segment : out) { const ExtrusionEntity *ee = entities[segment.first]; if (ee->is_loop()) @@ -1086,7 +1500,8 @@ void reorder_extrusion_entities(std::vector &entities, const s void chain_and_reorder_extrusion_entities(std::vector &entities, const Point &start_near) { - chain_and_reorder_extrusion_entities(entities, &start_near); + remove_entities_without_endpoints(entities); + reorder_extrusion_entities(entities, chain_extrusion_entities_impl(entities, &start_near, true)); } void chain_and_reorder_extrusion_entities(std::vector &entities, const Point *start_near) @@ -1101,7 +1516,7 @@ void chain_and_reorder_extrusion_entities(std::vector &e remove_entities_without_endpoints(entities); std::vector out; out.reserve(entities.size()); - for (const auto &[idx, reverse] : chain_extrusion_entities_impl(entities, &start_near)) { + for (const auto &[idx, reverse] : chain_extrusion_entities_impl(entities, &start_near, true)) { if (reverse) { ExtrusionEntity *clone = reversed_clones.emplace_back(entities[idx]->clone()).get(); clone->reverse(); @@ -1159,16 +1574,74 @@ std::vector chain_points(const Points &points, const Point *start_near) return out; } +// Moves runs of up to three points of the cycle next to one of the 8 points nearest to an end of the run, reversed or not, +// while that shortens the cycle. path[0] stays first. Returns true if any move was made. +static bool improve_cycle_by_or_opt(std::vector &path, const Points &points) +{ + const size_t pn = path.size(); + if (pn < 5) + return false; + std::vector coords(points.size()); + for (size_t i = 0; i < points.size(); ++ i) + coords[i] = points[i].cast(); + const NearestPoints<8> grid(coords); + std::vector pos(points.size()); + auto refresh = [&]() { for (size_t k = 0; k < pn; ++ k) pos[path[k]] = k; }; + refresh(); + auto dist = [&](size_t a, size_t b) { return (coords[path[a % pn]] - coords[path[b % pn]]).norm(); }; + bool improved = false; + for (bool moved = true; moved;) { + moved = false; + for (size_t len = 1; len <= 3; ++ len) + for (size_t i = 1; i + len <= pn; ++ i) { + // The run path[i..last] goes between path[k] and path[k + 1]. + const size_t last = i + len - 1; + const double removal = dist(i - 1, i) + dist(last, last + 1) - dist(i - 1, last + 1); + bool applied = removal <= SCALED_EPSILON; + for (size_t end : { path[i], path[last] }) + for (size_t q : grid.query(coords[end], [end](size_t idx) { return idx != end; })) + for (size_t k : { q == NearestPoints<8>::npos ? pn : (pos[q] + pn - 1) % pn, q == NearestPoints<8>::npos ? pn : pos[q] }) { + if (applied || k == pn || (k + 1 >= i && k <= last)) + continue; + const double base = dist(k, k + 1); + const double kept = dist(k, i) + dist(last, k + 1) - base; + const double reversed = dist(k, last) + dist(i, k + 1) - base; + if (std::min(kept, reversed) > removal - SCALED_EPSILON) + continue; + std::vector run(path.begin() + i, path.begin() + last + 1); + if (reversed < kept) + std::reverse(run.begin(), run.end()); + path.erase(path.begin() + i, path.begin() + last + 1); + path.insert(path.begin() + (k < i ? k + 1 : k + 1 - len), run.begin(), run.end()); + refresh(); + applied = moved = improved = true; + } + } + } + return improved; +} + std::vector chain_points_with_postprocessing(const Points &points, const Point *start_near) { - std::vector path = chain_points(points, start_near); - // Alternate 2-opt and crossing removal until convergence. - // 2-opt can create new crossings, and crossing removal can create new - // opportunities for 2-opt improvement. Break early if neither improves. - for (int iter = 0; iter < 3; ++iter) { - bool improved = tsp_2opt_improve(path, points); - improved |= tsp_remove_crossings(path, points); - if (!improved) break; + std::vector path; + if (points.size() <= 10) { + // Orca: few points are toured exactly, from the point nearest start_near toward its nearer neighbor. + path = tsp_exact_cycle(points); + if (start_near != nullptr && path.size() > 2) { + auto dist = [&points](size_t a, const Point &b) { return (points[a] - b).cast().squaredNorm(); }; + std::rotate(path.begin(), std::min_element(path.begin(), path.end(), [&](size_t a, size_t b) { return dist(a, *start_near) < dist(b, *start_near); }), path.end()); + if (dist(path.back(), points[path.front()]) < dist(path[1], points[path.front()])) + std::reverse(path.begin() + 1, path.end()); + } + } else { + path = chain_points(points, start_near); + // Alternate 2-opt, or-opt and crossing removal: each can open moves for the others. Break early if none improves. + for (int iter = 0; iter < 3; ++iter) { + bool improved = tsp_2opt_improve(path, points); + improved |= improve_cycle_by_or_opt(path, points); + improved |= tsp_remove_crossings(path, points); + if (!improved) break; + } } if (start_near == nullptr) tsp_rotate_minimize_closing(path, points); diff --git a/src/libslic3r/ShortestPath.hpp b/src/libslic3r/ShortestPath.hpp index 53ec00f9e4..34127fdb9a 100644 --- a/src/libslic3r/ShortestPath.hpp +++ b/src/libslic3r/ShortestPath.hpp @@ -23,9 +23,12 @@ std::vector chain_expolygons(const ExPolygons &input_exploy); std::vector> chain_extrusion_entities(std::vector &entities, const Point *start_near = nullptr); void reorder_extrusion_entities(std::vector &entities, const std::vector> &chain); +// From start_near, the greedy chain is refined by 2-opt and or-opt moves, which shortens the travel at some extra cost. void chain_and_reorder_extrusion_entities(std::vector &entities, const Point &start_near); +// The greedy chain only. void chain_and_reorder_extrusion_entities(std::vector &entities, const Point *start_near = nullptr); -// Each entity the chain reverses is replaced by a reversed clone that reversed_clones owns, so the originals stay unchanged. +// Refined as above. Each entity the chain reverses is replaced by a reversed clone that reversed_clones owns, so the +// originals stay unchanged. void chain_and_reorder_extrusion_entities(std::vector &entities, const Point &start_near, std::vector> &reversed_clones); diff --git a/src/libslic3r/Support/SupportCommon.cpp b/src/libslic3r/Support/SupportCommon.cpp index dddbfcf189..0cca31adca 100644 --- a/src/libslic3r/Support/SupportCommon.cpp +++ b/src/libslic3r/Support/SupportCommon.cpp @@ -1,4 +1,5 @@ #include "../ClipperUtils.hpp" +#include "../ExclusionVolumeGeometry.hpp" #include "../ClipperZUtils.hpp" #include "../ExtrusionEntityCollection.hpp" #include "../Layer.hpp" @@ -55,6 +56,132 @@ namespace Slic3r { +namespace { + +int object_layer_id_at_z(const PrintObject &object, const coordf_t print_z) +{ + const ConstLayerPtrsAdaptor layers = object.layers(); + if (layers.empty()) + return -1; + const auto it = std::lower_bound(layers.begin(), layers.end(), print_z - EPSILON, + [](const Layer *layer, const coordf_t z) { return layer->print_z < z; }); + return int(it == layers.end() ? layers.size() - 1 : size_t(it - layers.begin())); +} + +bool support_layer_uses_interface_material(const SupportGeneratorLayer &layer) +{ + return one_of(layer.layer_type, { + SupporLayerType::RaftInterface, + SupporLayerType::BottomContact, + SupporLayerType::BottomInterface, + SupporLayerType::TopContact, + SupporLayerType::TopInterface }); +} + +void trim_polygons(Polygons &polygons, const Polygons &excluded) +{ + if (!polygons.empty() && !excluded.empty()) + polygons = diff(polygons, excluded, ApplySafetyOffset::Yes); +} + +} // namespace + +std::vector support_exclusion_filaments( + const PrintObject &object, + const bool interface_material) +{ + const int configured = interface_material ? object.config().support_interface_filament.value : + object.config().support_filament.value; + if (configured > 0) + return { unsigned(configured - 1) }; + + // "Current filament" is assigned during tool ordering, not from the + // supported object. It may therefore use a filament from another object, + // or one selected for flush-into-support, on any particular layer. + return object.print() == nullptr ? object.object_extruders() : object.print()->extruders(false); +} + +std::vector support_exclusion_areas_for_layers( + const PrintObject &object, + const std::vector> &layer_z_ranges, + const bool interface_material) +{ + std::vector result(layer_z_ranges.size()); + if (layer_z_ranges.empty() || object.print() == nullptr) + return result; + + const Print &print = *object.print(); + // Preserve established support output for legacy bed-exclude areas. Support + // avoidance is an opt-in property of explicit collision volumes. + if (!has_bed_exclude_volumes(print.config())) + return result; + + std::vector> regions_by_extruder = + get_bed_excluded_regions_by_extruder(print.config()); + for (std::vector ®ions : regions_by_extruder) + regions.erase(std::remove_if(regions.begin(), regions.end(), + [](const BedExcludeRegion ®ion) { return !region.is_collision_volume(); }), regions.end()); + if (regions_by_extruder.empty() || + std::all_of(regions_by_extruder.begin(), regions_by_extruder.end(), + [](const std::vector ®ions) { return regions.empty(); })) + return result; + + const std::vector filaments = support_exclusion_filaments(object, interface_material); + for (size_t idx = 0; idx < layer_z_ranges.size(); ++idx) { + const auto [z_min, z_max] = layer_z_ranges[idx]; + const int layer_id = object_layer_id_at_z(object, z_max); + const std::vector physical_extruders = bed_exclusion_physical_extruders( + print, filaments, regions_by_extruder.size(), layer_id); + result[idx] = to_polygons(active_bed_exclusion_footprints_for_object( + object, regions_by_extruder, physical_extruders, z_min, z_max, coord_t(SCALED_EPSILON))); + } + return result; +} + +void trim_support_layers_by_exclusion_volumes( + const PrintObject &object, + const SupportGeneratorLayersPtr &raft_layers, + const SupportGeneratorLayersPtr &bottom_contacts, + const SupportGeneratorLayersPtr &top_contacts, + const SupportGeneratorLayersPtr &intermediate_layers, + const SupportGeneratorLayersPtr &interface_layers, + const SupportGeneratorLayersPtr &base_interface_layers) +{ + SupportGeneratorLayersPtr layers; + layers.reserve(raft_layers.size() + bottom_contacts.size() + top_contacts.size() + + intermediate_layers.size() + interface_layers.size() + base_interface_layers.size()); + for (const SupportGeneratorLayersPtr *source : { + &raft_layers, &bottom_contacts, &top_contacts, &intermediate_layers, + &interface_layers, &base_interface_layers }) + append(layers, *source); + std::sort(layers.begin(), layers.end()); + layers.erase(std::unique(layers.begin(), layers.end()), layers.end()); + + for (const bool interface_material : { false, true }) { + SupportGeneratorLayersPtr selected; + std::vector> z_ranges; + for (SupportGeneratorLayer *layer : layers) { + if (layer != nullptr && support_layer_uses_interface_material(*layer) == interface_material) { + selected.emplace_back(layer); + z_ranges.emplace_back(layer->bottom_print_z(), layer->print_z); + } + } + + const std::vector excluded = + support_exclusion_areas_for_layers(object, z_ranges, interface_material); + for (size_t idx = 0; idx < selected.size(); ++idx) { + SupportGeneratorLayer &layer = *selected[idx]; + trim_polygons(layer.polygons, excluded[idx]); + if (layer.contact_polygons) + trim_polygons(*layer.contact_polygons, excluded[idx]); + if (layer.overhang_polygons) + trim_polygons(*layer.overhang_polygons, excluded[idx]); + if (layer.enforcer_polygons) + trim_polygons(*layer.enforcer_polygons, excluded[idx]); + } + } +} + // how much we extend support around the actual contact area //FIXME this should be dependent on the nozzle diameter! #define SUPPORT_MATERIAL_MARGIN 1.5 diff --git a/src/libslic3r/Support/SupportCommon.hpp b/src/libslic3r/Support/SupportCommon.hpp index ca91ecc5ae..f50c2d7a6c 100644 --- a/src/libslic3r/Support/SupportCommon.hpp +++ b/src/libslic3r/Support/SupportCommon.hpp @@ -56,6 +56,32 @@ void tree_supports_generate_paths(ExtrusionEntitiesPtr &dst, const Polygons &pol void fill_expolygons_with_sheath_generate_paths( ExtrusionEntitiesPtr &dst, const Polygons &polygons, Fill *filler, float density, ExtrusionRole role, const Flow &flow, const SupportParameters& support_params, bool with_sheath, bool no_sort); +// Return every logical filament which may be selected for this support role. +// An explicit assignment has one result; "current filament" is intentionally +// print-wide because Orca resolves it later while ordering tools and wiping. +std::vector support_exclusion_filaments( + const PrintObject &object, + bool interface_material); + +// Build conservative, object-local exclusion masks for generated support. +// `interface_material` selects the support-interface filament; false selects +// the base support filament. Each pair describes the actual extrusion slab. +std::vector support_exclusion_areas_for_layers( + const PrintObject &object, + const std::vector> &layer_z_ranges, + bool interface_material); + +// Remove exclusion volumes from every support and raft polygon category before +// SupportLayer installation and toolpath generation. +void trim_support_layers_by_exclusion_volumes( + const PrintObject &object, + const SupportGeneratorLayersPtr &raft_layers, + const SupportGeneratorLayersPtr &bottom_contacts, + const SupportGeneratorLayersPtr &top_contacts, + const SupportGeneratorLayersPtr &intermediate_layers, + const SupportGeneratorLayersPtr &interface_layers, + const SupportGeneratorLayersPtr &base_interface_layers); + // returns sorted layers SupportGeneratorLayersPtr generate_support_layers( PrintObject &object, diff --git a/src/libslic3r/Support/SupportMaterial.cpp b/src/libslic3r/Support/SupportMaterial.cpp index 813acecec4..54a1de8a2c 100644 --- a/src/libslic3r/Support/SupportMaterial.cpp +++ b/src/libslic3r/Support/SupportMaterial.cpp @@ -553,6 +553,10 @@ void PrintObjectSupportMaterial::generate(PrintObject &object) BOOST_LOG_TRIVIAL(info) << "Support generator - Creating layers"; + trim_support_layers_by_exclusion_volumes( + object, raft_layers, bottom_contacts, top_contacts, intermediate_layers, + interface_layers, base_interface_layers); + // For debugging purposes, one may want to show only some of the support extrusions. // raft_layers.clear(); // bottom_contacts.clear(); @@ -1004,9 +1008,9 @@ public: ::fread(&y, sizeof(coord_t), 1, file); poly.points.emplace_back(Point(x * scale, y * scale)); } + printf("Polygon %d, area: %lf\n", i, area(poly.points)); if (which == -1 || which == i) m_support_polygons_deserialized.emplace_back(std::move(poly)); - printf("Polygon %d, area: %lf\n", i, area(poly.points)); } ::fread(&n_polygons, 4, 1, file); m_trimming_polygons_deserialized.reserve(n_polygons); diff --git a/src/libslic3r/Support/TreeModelVolumes.cpp b/src/libslic3r/Support/TreeModelVolumes.cpp index 33d379c2b5..6ecf735a0e 100644 --- a/src/libslic3r/Support/TreeModelVolumes.cpp +++ b/src/libslic3r/Support/TreeModelVolumes.cpp @@ -192,22 +192,18 @@ TreeModelVolumes::TreeModelVolumes( } }); } - if (! additional_excluded_areas.empty()) { - tbb::parallel_for(tbb::blocked_range(0, m_anti_overhang.size()), - [&](const tbb::blocked_range &range) { - for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) { - if (layer_idx < coord_t(additional_excluded_areas.size())) - append(m_anti_overhang[layer_idx], additional_excluded_areas[layer_idx]); - // if (SUPPORT_TREE_AVOID_SUPPORT_BLOCKER) - // append(m_anti_overhang[layer_idx], storage.support.supportLayers[layer_idx].anti_overhang); - //FIXME block wipe tower - // if (storage.primeTower.enabled) - // append(m_anti_overhang[layer_idx], layer_idx == 0 ? storage.primeTower.outer_poly_first_layer : storage.primeTower.outer_poly); - m_anti_overhang[layer_idx] = union_(m_anti_overhang[layer_idx]); - } - }); - } #endif + + if (!additional_excluded_areas.empty()) { + m_anti_overhang.resize(std::max(m_anti_overhang.size(), additional_excluded_areas.size())); + tbb::parallel_for(tbb::blocked_range(0, additional_excluded_areas.size()), + [&](const tbb::blocked_range &range) { + for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { + append(m_anti_overhang[layer_idx], additional_excluded_areas[layer_idx]); + m_anti_overhang[layer_idx] = union_(m_anti_overhang[layer_idx]); + } + }); + } } void TreeModelVolumes::precalculate(const PrintObject& print_object, const coord_t max_layer, std::function throw_on_cancel) @@ -488,7 +484,8 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex if (calculate_placable) data_placeable.allocate(data.begin(), data.end()); - for (size_t outline_idx : layer_outline_indices) + for (size_t outline_pos = 0; outline_pos < layer_outline_indices.size(); ++outline_pos) { + const size_t outline_idx = layer_outline_indices[outline_pos]; if (const std::vector &outlines = m_layer_outlines[outline_idx].second; ! outlines.empty()) { const TreeSupportMeshGroupSettings &settings = m_layer_outlines[outline_idx].first; const coord_t layer_height = settings.layer_height; @@ -525,7 +522,7 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex }); // 2) Sum over top / bottom ranges. - const bool processing_last_mesh = outline_idx == layer_outline_indices.back(); + const bool processing_last_mesh = outline_pos + 1 == layer_outline_indices.size(); tbb::parallel_for(tbb::blocked_range(data.begin(), data.end()), [&collision_areas_offsetted, &outlines, &machine_border = m_machine_border, &anti_overhang = m_anti_overhang, radius, xy_distance, z_distance_bottom_layers, z_distance_top_layers, min_resolution = m_min_resolution, &data, processing_last_mesh, &throw_on_cancel] @@ -624,6 +621,7 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex // Calculating just the collision areas. } } + } #ifdef SLIC3R_TREESUPPORTS_PROGRESS { std::lock_guard critical_section(*m_critical_progress); diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 70ab0b06f1..1d3f0b29ea 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -996,16 +996,46 @@ void TreeSupport::detect_overhangs(bool check_support_necessity/* = false*/) if (is_auto(stype) && config_detect_sharp_tails) { // BBS detect sharp tail + // On a belt, "below" has to include the belt itself and the + // shear-advanced lower layer, or every belt-contact island reads as + // a sharp tail -- which is what the empty-predecessor skip above was + // really masking. effective_lower is exactly that notion of below. + const ExPolygons &tail_lower = belt_ovh_active ? effective_lower : lower_polys; + // Each island is tested only against the lower islands whose box meets its own; overlaps() tries + // every pair, which is quadratic in the island counts of the two layers. + std::vector lower_bboxes; + lower_bboxes.reserve(tail_lower.size()); + for (const ExPolygon &lower : tail_lower) + lower_bboxes.emplace_back(get_extents(lower)); for (const ExPolygon& expoly : curr_polys) { bool is_sharp_tail = false; // 1. nothing below - // this is a sharp tail region if it's floating and non-ignorable. - // On a belt, "below" has to include the belt itself and the - // shear-advanced lower layer, or every belt-contact island reads as - // a sharp tail -- which is what the empty-predecessor skip above was - // really masking. effective_lower is exactly that notion of below. - const ExPolygons &tail_lower = belt_ovh_active ? effective_lower : lower_polys; - if (!overlaps(offset_ex(expoly, 0.1 * extrusion_width_scaled), tail_lower)) { + // this is a sharp tail region if it's floating and non-ignorable + const ExPolygons expanded = offset_ex(expoly, 0.1 * extrusion_width_scaled); + const BoundingBox bbox = get_extents(expanded); + ExPolygons lower_nearby; + for (size_t i = 0; i < tail_lower.size(); ++i) + if (lower_bboxes[i].overlap(bbox)) + lower_nearby.emplace_back(tail_lower[i]); + // As overlaps(expanded, lower_nearby), with each lower island cut to the island's box first: + // below a fine relief the lower layer is a few islands with thousands of holes, and the whole + // of that boundary would otherwise be intersected once per island above. + const auto overlaps_nearby = [&]() { + for (const ExPolygon &a : expanded) { + if (a.empty()) + continue; + const BoundingBox a_bbox = get_extents(a); + for (const ExPolygon &b : lower_nearby) { + if (b.empty() || !get_extents(b).overlap(a_bbox)) + continue; + const Polygons b_near = ClipperUtils::clip_clipper_polygons_with_subject_bbox(b, a_bbox.inflated(SCALED_EPSILON)); + if (!intersection_pl(to_polylines(b_near), a).empty() || b.contains(a.contour.points.front())) + return true; + } + } + return false; + }; + if (!overlaps_nearby()) { is_sharp_tail = !offset_ex(expoly, -0.1 * extrusion_width_scaled).empty(); } diff --git a/src/libslic3r/Support/TreeSupport3D.cpp b/src/libslic3r/Support/TreeSupport3D.cpp index ef267fba68..e2bd31eadd 100644 --- a/src/libslic3r/Support/TreeSupport3D.cpp +++ b/src/libslic3r/Support/TreeSupport3D.cpp @@ -3485,12 +3485,41 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons m_progress_offset = counter == 0 ? 0 : TREE_PROGRESS_TOTAL * (double(counter) * m_progress_multiplier); #endif // SLIC3R_TREESUPPORT_PROGRESS PrintObject &print_object = *print.get_object(processing.second.front()); + const size_t num_raft_layers_for_exclusions = config.raft_layers.size(); + std::vector> tree_layer_z_ranges; + tree_layer_z_ranges.reserve(num_raft_layers_for_exclusions + print_object.layer_count()); + coordf_t previous_z = 0.; + for (const coordf_t print_z : config.raft_layers) { + tree_layer_z_ranges.emplace_back(previous_z, print_z); + previous_z = print_z; + } + for (const Layer *layer : print_object.layers()) { + tree_layer_z_ranges.emplace_back(layer->print_z - layer->height, layer->print_z); + } + // A tree is one continuous structure while "current filament" may + // alternate between base and interface nozzles from layer to layer. + // Planning against both masks prevents a locally valid layer from + // forcing a branch through another possible nozzle's exclusion volume. + std::vector exclusion_areas = + support_exclusion_areas_for_layers(print_object, tree_layer_z_ranges, false); + const bool tree_uses_interface_material = !config.raft_layers.empty() || + print_object.config().support_interface_top_layers.value > 0 || + number_of_support_interface_bottom_layers(print_object.config()) > 0; + if (tree_uses_interface_material) { + const std::vector interface_exclusion_areas = + support_exclusion_areas_for_layers(print_object, tree_layer_z_ranges, true); + for (size_t layer_idx = 0; layer_idx < exclusion_areas.size(); ++layer_idx) { + append(exclusion_areas[layer_idx], interface_exclusion_areas[layer_idx]); + exclusion_areas[layer_idx] = union_(exclusion_areas[layer_idx]); + } + } + // Generator for model collision, avoidance and internal guide volumes. TreeModelVolumes volumes{ print_object, build_volume, config.maximum_move_distance, config.maximum_move_distance_slow, processing.second.front(), #ifdef SLIC3R_TREESUPPORTS_PROGRESS m_progress_multiplier, m_progress_offset, #endif // SLIC3R_TREESUPPORTS_PROGRESS - /* additional_excluded_areas */{} }; + exclusion_areas }; //FIXME generating overhangs just for the first mesh of the group. assert(processing.second.size() == 1); @@ -3638,6 +3667,9 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons // Produce the support G-code. SupportGeneratorLayersPtr raft_layers = generate_raft_base(print_object, support_params, print_object.slicing_parameters(), top_contacts, interface_layers, base_interface_layers, intermediate_layers, layer_storage); + trim_support_layers_by_exclusion_volumes( + print_object, raft_layers, bottom_contacts, top_contacts, intermediate_layers, + interface_layers, base_interface_layers); SupportGeneratorLayersPtr layers_sorted = generate_support_layers(print_object, raft_layers, bottom_contacts, top_contacts, intermediate_layers, interface_layers, base_interface_layers); // BBS: This is a hack to avoid the support being generated outside the bed area. See #4769. diff --git a/src/libslic3r/Surface.hpp b/src/libslic3r/Surface.hpp index 5e0c0461e4..4564ba0301 100644 --- a/src/libslic3r/Surface.hpp +++ b/src/libslic3r/Surface.hpp @@ -68,7 +68,7 @@ public: thickness(other.thickness), thickness_layers(other.thickness_layers), bridge_angle(other.bridge_angle), extra_perimeters(other.extra_perimeters) {}; - Surface(Surface &&rhs) + Surface(Surface &&rhs) noexcept : surface_type(rhs.surface_type), expolygon(std::move(rhs.expolygon)), thickness(rhs.thickness), thickness_layers(rhs.thickness_layers), bridge_angle(rhs.bridge_angle), extra_perimeters(rhs.extra_perimeters) @@ -94,7 +94,7 @@ public: return *this; } - Surface& operator=(Surface &&rhs) + Surface& operator=(Surface &&rhs) noexcept { surface_type = rhs.surface_type; expolygon = std::move(rhs.expolygon); diff --git a/src/libslic3r/TextureDisplacement.cpp b/src/libslic3r/TextureDisplacement.cpp index 26e8726a72..074eb69db6 100644 --- a/src/libslic3r/TextureDisplacement.cpp +++ b/src/libslic3r/TextureDisplacement.cpp @@ -2724,7 +2724,8 @@ indexed_triangle_set build_texture_displacement_v2(const indexed_triangle_set bool flip_normals, BakeStageRecorder *debug, TextureBakeStats *stats, - const std::vector *model_uv) + const std::vector *model_uv, + float resting_drop) { HeightFieldSampler combined = make_combined_displacement_sampler(mesh, layers, facets_data, model_uv); if (!combined) @@ -2871,6 +2872,9 @@ indexed_triangle_set build_texture_displacement_v2(const indexed_triangle_set bounds.min = bounds.min.cwiseMin(v); bounds.max = bounds.max.cwiseMax(v); } + // The bottom the pipeline clamps and snaps to is the plane the whole object rests on, not this + // part's own: a part held off the plate by another keeps the relief on its underside. + bounds.min.z() -= resting_drop; const auto sample = [&combined](const Vec3f &pos, const Vec3f &, const Vec3f &blend_normal) { // The blend normal chooses the projection; the move itself is along the smooth normal, which @@ -3030,7 +3034,8 @@ static indexed_triangle_set build_texture_displacement_in_place( bool flip_normals, BakeStageRecorder *debug, TextureBakeStats *stats, - const std::vector *model_uv) + const std::vector *model_uv, + float resting_drop) { // The classic path moves the vertices the mesh already has, so there is no budget to report on. (void) stats; @@ -3067,7 +3072,7 @@ static indexed_triangle_set build_texture_displacement_in_place( if (options.pipeline_v2) return build_texture_displacement_v2(mesh, layers, facets_data, options, progress, color, flip_normals, - debug, stats, model_uv); + debug, stats, model_uv, resting_drop); // Layers are combined in slot order, like stacked layers in an image editor: each one folds its // own displacement into the running total via its blend mode (see TextureBlendMode). @@ -3399,10 +3404,12 @@ static indexed_triangle_set build_texture_displacement_in_place( if (!any_displacement) return mesh; - // The model's own resting plane, taken before anything moves - see the clamp after smoothing. + // The plane the model rests on, taken before anything moves - see the clamp after smoothing. That + // is this mesh's own bottom, lowered to the object's when another part of it sits lower. float resting_z = std::numeric_limits::max(); for (const Vec3f &v : mesh.vertices) resting_z = std::min(resting_z, v.z()); + resting_z -= resting_drop; size_t moved_count = 0; for (size_t vi = 0; vi < mesh.vertices.size(); ++vi) @@ -3494,17 +3501,20 @@ indexed_triangle_set build_texture_displacement(const indexed_triangle_set const Transform3d &volume_to_world, BakeStageRecorder *debug, TextureBakeStats *stats, - const std::vector *model_uv) + const std::vector *model_uv, + const Vec3d *texture_anchor, + float resting_drop) { // An untransformed volume on an untransformed instance is by far the common case, and the round // trip costs two matrix multiplies per vertex on a mesh that can carry millions of them - so take // the identity out of the way rather than paying for it. // The texture is projected in the bake frame - world orientation and scale, anchored at the - // volume's origin (see texture_displacement_bake_frame()). - const Transform3d frame = texture_displacement_bake_frame(volume_to_world); + // texture's anchor (see texture_displacement_bake_frame()). + const Transform3d frame = texture_anchor != nullptr ? texture_displacement_bake_frame(volume_to_world, *texture_anchor) : + texture_displacement_bake_frame(volume_to_world); if (frame.matrix().isApprox(Transform3d::Identity().matrix())) return build_texture_displacement_in_place(base_mesh, layers, facets_data, options, progress, color, - false, debug, stats, model_uv); + false, debug, stats, model_uv, resting_drop); const Transform3d to_local = frame.inverse(); // A mirroring placement leaves the positions correct but every winding-derived normal pointing @@ -3520,8 +3530,8 @@ indexed_triangle_set build_texture_displacement(const indexed_triangle_set const size_t debug_mark = (debug != nullptr) ? debug->mark() : 0; // The UV channel rides along untouched: a uv is a coordinate in the texture, not on the model, so // the frame the mesh is measured in does not reach it. - indexed_triangle_set out = build_texture_displacement_in_place(world, layers, facets_data, options, - progress, color, mirrored, debug, stats, model_uv); + indexed_triangle_set out = build_texture_displacement_in_place(world, layers, facets_data, options, progress, + color, mirrored, debug, stats, model_uv, resting_drop); // Everything the bake recorded is in world millimetres, like `out` itself. The debug view draws in // the volume's local frame, so the stages are brought back the same way the result is. if (debug != nullptr) @@ -3568,13 +3578,18 @@ void texture_displacement_patch_frame(const indexed_triangle_set &patch, const s (an.y() <= an.x() && an.y() <= an.z()) ? Vec3f::UnitY() : Vec3f::UnitZ(); } +Transform3d texture_displacement_bake_frame(const Transform3d &volume_to_world, const Vec3d &anchor) +{ + // World orientation and scale, but the origin moved onto the model: the texture then rides with + // the model when it is moved about the plate (and a single, untiled stamp starts on the model + // rather than at the plate's corner), while a tile is still `tiling_scale` printed millimetres + // whatever the instance's scale. + return Eigen::Translation3d(-anchor) * volume_to_world; +} + Transform3d texture_displacement_bake_frame(const Transform3d &volume_to_world) { - // World orientation and scale, but the origin moved to where the volume's own origin sits: the - // texture then rides with the model when it is moved about the plate (and a single, untiled stamp - // starts on the model rather than at the plate's corner), while a tile is still `tiling_scale` - // printed millimetres whatever the instance's scale. - return Eigen::Translation3d(-volume_to_world.translation()) * volume_to_world; + return texture_displacement_bake_frame(volume_to_world, volume_to_world.translation()); } Transform3d texture_displacement_volume_to_world(const ModelVolume &volume) diff --git a/src/libslic3r/TextureDisplacement.hpp b/src/libslic3r/TextureDisplacement.hpp index 919dfad654..89450270eb 100644 --- a/src/libslic3r/TextureDisplacement.hpp +++ b/src/libslic3r/TextureDisplacement.hpp @@ -1040,14 +1040,26 @@ indexed_triangle_set build_texture_displacement(const indexed_triangle_set // When given, receives what the bake spent. TextureBakeStats *stats = nullptr, // The model's own UV channel; see above. - const std::vector *model_uv = nullptr); + const std::vector *model_uv = nullptr, + // The world point the texture is anchored at, null for + // the volume's own origin. Every part of a multibody + // object passes the same point, so the pattern runs on + // across them. See texture_displacement_bake_frame(). + const Vec3d *texture_anchor = nullptr, + // How far the object's lowest point lies below this + // volume's own, in mm. Relief is kept above the plane + // the whole object rests on, so a part held off the + // plate by another keeps the relief on its underside. + float resting_drop = 0.f); // `volume`'s mesh coordinates -> world millimetres: its first instance's transform times its own. // The mesh is shared by every instance, so a multi-instance object can only be baked for one of // them; the first is what the gizmo edits against. Identity when the volume has no object yet. Transform3d texture_displacement_volume_to_world(const ModelVolume &volume); -// The frame the bake and the previews project the texture in: `volume_to_world` with its translation -// removed, i.e. world orientation and scale about the volume's own origin. See build_texture_displacement(). +// The frame the bake and the previews project the texture in: world orientation and scale, with the +// world point `anchor` as its origin. See build_texture_displacement(). +Transform3d texture_displacement_bake_frame(const Transform3d &volume_to_world, const Vec3d &anchor); +// Anchored at the volume's own origin, which is where a single-part object's texture sits. Transform3d texture_displacement_bake_frame(const Transform3d &volume_to_world); // Area-weighted vertex normals of `its` - the directions the bake both projects and displaces along. diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index b0a5250532..e3662919e7 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -167,10 +167,10 @@ inline void append(std::vector &dest, std::vector &&src) { if (dest.empty()) dest = std::move(src); - else { - dest.reserve(dest.size() + src.size()); - std::move(std::begin(src), std::end(src), std::back_inserter(dest)); - } + else + // insert() grows the capacity geometrically; reserving exactly the new size reallocated on every call, which + // made appending piece by piece quadratic. + dest.insert(dest.end(), std::make_move_iterator(src.begin()), std::make_move_iterator(src.end())); src.clear(); src.shrink_to_fit(); } diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index 12b3083d4d..a18083f4d4 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -2024,7 +2024,9 @@ static Semver installable_cache_version(const boost::filesystem::path& dir, cons const auto cache_ver = Semver::parse(VendorCacheFile::peek_version((dir / (vendor + ".opc")).string(), vendor)); if (! cache_ver) return Semver::invalid(); - const Semver profile_ver = get_version_from_json((dir / (vendor + ".json")).string()); + // Packaging prunes the profile of every vendor that ships a cache. + const boost::filesystem::path json = dir / (vendor + ".json"); + const Semver profile_ver = boost::filesystem::exists(json) ? get_version_from_json(json.string()) : Semver(); return cache_covers(*cache_ver, profile_ver) ? *cache_ver : Semver::invalid(); } diff --git a/src/libvgcode/include/GCodeInputData.hpp b/src/libvgcode/include/GCodeInputData.hpp index a0057230e7..e9b0983dde 100644 --- a/src/libvgcode/include/GCodeInputData.hpp +++ b/src/libvgcode/include/GCodeInputData.hpp @@ -26,11 +26,11 @@ struct GCodeInputData // // Palette for extruders colors // - Palette tools_colors; + PaletteWithAlpha tools_colors; // // Palette for color print colors // - Palette color_print_colors; + PaletteWithAlpha color_print_colors; }; } // namespace libvgcode diff --git a/src/libvgcode/include/Types.hpp b/src/libvgcode/include/Types.hpp index 1c3b50208a..ef61af9e3a 100644 --- a/src/libvgcode/include/Types.hpp +++ b/src/libvgcode/include/Types.hpp @@ -63,6 +63,13 @@ using Color = std::array; // using Palette = std::vector; +// +// ORCA: RGB color and opacity, 255 is opaque. Filament colors can be translucent. +// [3] -> alpha +// +using ColorWithAlpha = std::array; +using PaletteWithAlpha = std::vector; + // // Axis aligned box in 3 dimensions // [0] -> { min_x, min_y, min_z } diff --git a/src/libvgcode/include/Viewer.hpp b/src/libvgcode/include/Viewer.hpp index 97b1c335f6..7343f75af7 100644 --- a/src/libvgcode/include/Viewer.hpp +++ b/src/libvgcode/include/Viewer.hpp @@ -65,6 +65,15 @@ public: // void render(const Mat4x4& view_matrix, const Mat4x4& projection_matrix); // + // ORCA: render() leaves out the toolpaths of translucent filaments, which this draws over + // the scene afterwards, so that the caller can shade the opaque scene in between. + // + void render_translucent(const Mat4x4& view_matrix, const Mat4x4& projection_matrix); + // + // ORCA: whether the last render() left out any toolpaths for render_translucent() to draw. + // + bool has_translucent_toolpaths() const; + // // ORCA: realistic view. Render the toolpaths as seen from the light, to fill the caller's // shadow map. Depth only - the caller masks colour writes and owns the framebuffer. // @@ -88,6 +97,11 @@ public: // ORCA: direction to the top light in eye space, shading the toolpaths and biasing their shadow lookup. // void set_light_top_dir(const Vec3& direction); + // + // ORCA: whether the filaments catch an untinted highlight, on by default; the caller ties it to the realistic + // view and its glossy toolpaths setting. + // + void set_gloss(bool gloss); // // ************************************************************************ @@ -129,6 +143,12 @@ public: float get_dim_previous_layers_brightness() const; void set_dim_previous_layers_brightness(float value); // + // Translucent filaments (ORCA) + // Whether the filament colors keep their opacity, or are all drawn opaque. + // + bool is_translucent_filaments() const; + void set_translucent_filaments(bool value); + // // Returns true if the given option is visible. // bool is_option_visible(EOptionType type) const; @@ -177,12 +197,12 @@ public: // Return the palette used to render the toolpaths when // the view type is EViewType::Tool. // - const Palette& get_tool_colors() const; + const PaletteWithAlpha& get_tool_colors() const; // // Set the palette used to render the toolpaths when // the view type is EViewType::Tool with the given one. // - void set_tool_colors(const Palette& colors); + void set_tool_colors(const PaletteWithAlpha& colors); // // Return the count of colors in the palette used to render // the toolpaths when the view type is EViewType::ColorPrint. @@ -192,12 +212,12 @@ public: // Return the palette used to render the toolpaths when // the view type is EViewType::ColorPrint. // - const Palette& get_color_print_colors() const; + const PaletteWithAlpha& get_color_print_colors() const; // // Set the palette used to render the toolpaths when // the view type is EViewType::ColorPrint with the given one. // - void set_color_print_colors(const Palette& colors); + void set_color_print_colors(const PaletteWithAlpha& colors); // // Get the color range for the given view type. // Valid view types are: diff --git a/src/libvgcode/src/SegmentTemplate.cpp b/src/libvgcode/src/SegmentTemplate.cpp index 3887f4128f..3e085761d5 100644 --- a/src/libvgcode/src/SegmentTemplate.cpp +++ b/src/libvgcode/src/SegmentTemplate.cpp @@ -19,7 +19,9 @@ namespace libvgcode { // The eight corners the vertex shader knows how to place. Each is sent once and // referenced by INDEX_DATA below, so the post-transform cache can reuse it across // the triangles that share it: the shader runs 8 times per segment instead of 24. -static constexpr const std::array VERTEX_DATA = { 0, 1, 2, 3, 4, 5, 6, 7 }; +// ORCA: 32-bit, as Metal takes only vertex strides that are a multiple of 4 bytes, and +// the OpenGL driver Parallels Desktop builds on it draws no segment from packed uint8 ones. +static constexpr const std::array VERTEX_DATA = { 0, 1, 2, 3, 4, 5, 6, 7 }; // 16-bit indices: GCN 1/2 GPUs have no 8-bit index support, and some of their drivers // emulate it wrongly in instanced draws. @@ -39,7 +41,7 @@ void SegmentTemplate::init() if (m_vao_id != 0) return; - m_size_in_bytes_gpu += VERTEX_DATA.size() * sizeof(uint8_t) + INDEX_DATA.size() * sizeof(uint16_t); + m_size_in_bytes_gpu += VERTEX_DATA.size() * sizeof(uint32_t) + INDEX_DATA.size() * sizeof(uint16_t); int curr_vertex_array; glsafe(glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &curr_vertex_array)); @@ -51,12 +53,12 @@ void SegmentTemplate::init() glsafe(glGenBuffers(1, &m_vbo_id)); glsafe(glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id)); - glsafe(glBufferData(GL_ARRAY_BUFFER, VERTEX_DATA.size() * sizeof(uint8_t), VERTEX_DATA.data(), GL_STATIC_DRAW)); + glsafe(glBufferData(GL_ARRAY_BUFFER, VERTEX_DATA.size() * sizeof(uint32_t), VERTEX_DATA.data(), GL_STATIC_DRAW)); glsafe(glEnableVertexAttribArray(0)); #ifdef ENABLE_OPENGL_ES - glsafe(glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 0, (const void*)0)); + glsafe(glVertexAttribPointer(0, 1, GL_UNSIGNED_INT, GL_FALSE, 0, (const void*)0)); #else - glsafe(glVertexAttribIPointer(0, 1, GL_UNSIGNED_BYTE, 0, (const void*)0)); + glsafe(glVertexAttribIPointer(0, 1, GL_UNSIGNED_INT, 0, (const void*)0)); #endif // ENABLE_OPENGL_ES // The element buffer binding is part of the vao state, so it is left bound here diff --git a/src/libvgcode/src/Settings.hpp b/src/libvgcode/src/Settings.hpp index fe205531f2..768903759f 100644 --- a/src/libvgcode/src/Settings.hpp +++ b/src/libvgcode/src/Settings.hpp @@ -26,6 +26,8 @@ struct Settings bool dim_previous_layers{ false }; // ORCA: how bright those darkened layers are rendered, 1.0 = unchanged, 0.0 = black float dim_previous_layers_brightness{ 0.4f }; + // ORCA: when disabled, the filaments are drawn opaque whatever their color's opacity + bool translucent_filaments{ true }; bool spiral_vase_mode{ false }; // // Required update flags diff --git a/src/libvgcode/src/Shaders.hpp b/src/libvgcode/src/Shaders.hpp index eaf143f583..447ed4b76b 100644 --- a/src/libvgcode/src/Shaders.hpp +++ b/src/libvgcode/src/Shaders.hpp @@ -15,6 +15,7 @@ static const char* Segments_Vertex_Shader = "#define POINTY_CAPS\n" "#define FIX_TWISTING\n" "uniform vec3 light_top_dir;\n" +"uniform float gloss_strength;\n" "const float light_top_diffuse = 0.6 * 0.8;\n" // ORCA: the specular was 0.6 * 0.125, too faint to give the filament any sheen. "const float light_top_specular = 0.6 * 0.25;\n" @@ -23,6 +24,7 @@ static const char* Segments_Vertex_Shader = "const float light_front_diffuse = 0.6 * 0.2;\n" "const float ambient = 0.2;\n" "const float emission = 0.15;\n" +"const float REFERENCE_THICKNESS = 0.4;\n" "const vec3 UP = vec3(0, 0, 1);\n" "uniform mat4 view_matrix;\n" "uniform mat4 projection_matrix;\n" @@ -37,26 +39,36 @@ static const char* Segments_Vertex_Shader = // ORCA: section view "uniform vec4 clipping_plane;\n" "in int vertex_id;\n" +// ORCA: built with DEPTH_ONLY for the first order independent pass, the shaders keep the geometry and the joint cut +// but neither shade nor carry the colors, see ViewerImpl::render_translucent_segments() +"#ifndef DEPTH_ONLY\n" "out vec3 color;\n" "// ORCA: realistic view - the light the shadow map is able to block, kept apart from the\n" "// ambient and emissive terms in color, which a shadow does not occlude. Their sum is the\n" "// single lighting term this replaces, so shading is unchanged while shadows are off.\n" "out vec3 color_direct;\n" +"#endif\n" "// ORCA: realistic view - the fragment shader looks the fragment up in the shadow map, which\n" "// needs its world position and, for the depth bias, its eye space normal.\n" "out vec3 world_position;\n" +"#ifndef DEPTH_ONLY\n" "out vec3 shadow_normal;\n" +"#endif\n" // ORCA: section view - the segment and the light on its cut face "flat out int segment_id;\n" +"#ifndef DEPTH_ONLY\n" "out vec3 cut_color_direct;\n" +"#endif\n" +// ORCA: the opaque and the translucent segments are drawn in separate passes, see ViewerImpl::render_segments(). +"uniform int first_instance;\n" +"flat out float alpha;\n" // ORCA: the layers greyed or dimmed around the one the sliders show, see ViewerImpl::set_layer_colors(). "uniform ivec2 lit_layers;\n" "uniform int grey_below_layer;\n" "uniform float dim_brightness;\n" "uniform int kept_vertex;\n" -"vec3 decode_color(float color, int id, int layer) {\n" -" int c = int(round(color));\n" -" vec3 rgb = vec3((c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF);\n" +"vec3 decode_color(vec3 color, int id, int layer) {\n" +" vec3 rgb = round(255.0 * color);\n" " if (id != kept_vertex && layer != lit_layers.x && layer != lit_layers.y) {\n" " if (dim_brightness >= 0.0)\n" " rgb = floor(rgb * dim_brightness);\n" @@ -72,9 +84,18 @@ static const char* Segments_Vertex_Shader = " float top_specular = light_top_specular * pow(max(dot(-normalize(eye_position), reflect(-light_top_dir, eye_normal)), 0.0), light_top_shininess);\n" " return top_diffuse + front_diffuse + top_specular;\n" "}\n" +// ORCA: in realistic view, and on a translucent filament, the highlight is the fragment shader's, untinted +"float diffuse_lighting(vec3 eye_normal) {\n" +" return light_top_diffuse * max(dot(eye_normal, light_top_dir), 0.0) + light_front_diffuse * max(dot(eye_normal, light_front_dir), 0.0);\n" +"}\n" "void main() {\n" -" int instance = reverse_order ? instances_count - 1 - gl_InstanceID : gl_InstanceID;\n" +" int instance = first_instance + (reverse_order ? instances_count - 1 - gl_InstanceID : gl_InstanceID);\n" " int id_a = int(texelFetch(segment_index_tex, instance).r);\n" +"#ifdef DEPTH_ONLY\n" +" alpha = 0.0;\n" +"#else\n" +" alpha = texelFetch(color_tex, id_a).a;\n" +"#endif\n" " int id_b = id_a + 1;\n" " vec3 pos_a = texelFetch(position_tex, id_a).xyz;\n" " vec3 pos_b = texelFetch(position_tex, id_b).xyz;\n" @@ -95,6 +116,29 @@ static const char* Segments_Vertex_Shader = " else\n" " line_right_dir = normalize(cross(line_dir, UP));\n" " vec3 line_up_dir = normalize(cross(line_right_dir, line_dir));\n" +// ORCA: the direction of the path across each joint, for the caps below; the fragment shader cuts the segment at +// its joints. The w of a position carries 0.5 at a joint, see extract_pos_and_or_hwa(). +" vec3 joint_prev = vec3(0.0);\n" +" vec3 joint_next = vec3(0.0);\n" +" if (alpha < 1.0 || gloss_strength > 0.0) {\n" +" if (id_a > 0 && fract(texelFetch(position_tex, id_a).w) > 0.25) {\n" +" vec3 prev = pos_a - texelFetch(position_tex, id_a - 1).xyz;\n" +// ORCA: past the vertex repeated in place that starts a split path +" if (dot(prev, prev) < 1e-4 && id_a > 1)\n" +" prev = pos_a - texelFetch(position_tex, id_a - 2).xyz;\n" +" vec3 n = dot(prev, prev) > 1e-8 ? normalize(prev) + line_dir : vec3(0.0);\n" +" if (dot(n, n) > 1e-4)\n" +" joint_prev = prev;\n" +" }\n" +" if (id_b + 1 < textureSize(position_tex) && fract(texelFetch(position_tex, id_b).w) > 0.25) {\n" +" vec3 next = texelFetch(position_tex, id_b + 1).xyz - pos_b;\n" +" if (dot(next, next) < 1e-4 && id_b + 2 < textureSize(position_tex))\n" +" next = texelFetch(position_tex, id_b + 2).xyz - pos_b;\n" +" vec3 n = dot(next, next) > 1e-8 ? line_dir + normalize(next) : vec3(0.0);\n" +" if (dot(n, n) > 1e-4)\n" +" joint_next = next;\n" +" }\n" +" }\n" " const vec2 horizontal_vertical_view_signs_array[16] = vec2[](\n" " //horizontal view (from right)\n" " vec2(1.0, 0.0),\n" @@ -119,6 +163,14 @@ static const char* Segments_Vertex_Shader = " vec3 endpoint_pos = vertex_id < 4 ? pos_a : pos_b;\n" " vec4 hwa = texelFetch(height_width_angle_tex, id);\n" " vec3 height_width_angle = hwa.xyz;\n" +// ORCA: across the vertex repeated in place that starts a split path, a cut joint keeps no angle. The caps take +// it from the joint, to fill the outside of the turn as at any other joint. +" vec3 joint_other = vertex_id < 4 ? joint_prev : joint_next;\n" +" if (height_width_angle.z == 0.0 && dot(joint_other, joint_other) > 0.0) {\n" +" vec3 into = vertex_id < 4 ? joint_other : line;\n" +" vec3 onto = vertex_id < 4 ? line : joint_other;\n" +" height_width_angle.z = atan(into.x * onto.y - into.y * onto.x, dot(into, onto));\n" +" }\n" " // ORCA: Extract bias from w component\n" " float bias = hwa.w;\n" "#ifdef FIX_TWISTING\n" @@ -131,6 +183,15 @@ static const char* Segments_Vertex_Shader = " vec3 camera_view_dir = normalize(endpoint_pos - camera_position);\n" " vec3 diagonal_dir_border = normalize(height_width_angle.x * line_up_dir + height_width_angle.y * line_right_dir);\n" "#endif\n" +// ORCA: a filament's opacity is that of REFERENCE_THICKNESS mm of it, here the path of the view ray through the extrusion +"#ifndef DEPTH_ONLY\n" +" if (alpha < 1.0) {\n" +" vec2 hw = texelFetch(height_width_angle_tex, id_a).xy;\n" +" float path = 1.0 / max(abs(dot(camera_view_dir, line_up_dir)) / hw.x + abs(dot(camera_view_dir, line_right_dir)) / hw.y, 1e-3);\n" +// ORCA: below 1, which would take a translucent segment for an opaque one +" alpha = min(1.0 - pow(1.0 - alpha, min(path / REFERENCE_THICKNESS, 16.0)), 0.999);\n" +" }\n" +"#endif\n" " bool is_vertical_view = abs(dot(camera_view_dir, line_up_dir)) / abs(dot(diagonal_dir_border, line_up_dir)) >\n" " abs(dot(camera_view_dir, line_right_dir)) / abs(dot(diagonal_dir_border, line_right_dir));\n" " vec2 signs = horizontal_vertical_view_signs_array[vertex_id + 8 * int(is_vertical_view)];\n" @@ -163,15 +224,18 @@ static const char* Segments_Vertex_Shader = " vec3 eye_position = (view_matrix * vec4(pos, 1.0)).xyz;\n" " // ORCA: Apply bias to z-position to avoid z-fighting\n" " eye_position.z += bias;\n" -" vec3 eye_normal = (view_matrix * vec4(normalize(pos - endpoint_pos), 0.0)).xyz;\n" -" vec3 color_base = decode_color(texelFetch(color_tex, id).r, id, int(texelFetch(position_tex, id).w));\n" -" color = color_base * (ambient + emission);\n" -" color_direct = color_base * direct_lighting(eye_position, eye_normal);\n" " world_position = pos;\n" -" shadow_normal = eye_normal;\n" " segment_id = id_a;\n" +"#ifndef DEPTH_ONLY\n" +" vec3 eye_normal = (view_matrix * vec4(normalize(pos - endpoint_pos), 0.0)).xyz;\n" +" vec3 color_base = decode_color(texelFetch(color_tex, id).rgb, id, int(texelFetch(position_tex, id).w));\n" +" color = color_base * (ambient + emission);\n" +" color_direct = color_base * ((alpha < 1.0 || gloss_strength > 0.0) ? diffuse_lighting(eye_normal) : direct_lighting(eye_position, eye_normal));\n" +" shadow_normal = eye_normal;\n" " cut_color_direct = clipping_plane.xyz == vec3(0.0) ? vec3(0.0) :\n" -" color_base * direct_lighting(eye_position, mat3(view_matrix) * -clipping_plane.xyz);\n" +" color_base * ((alpha < 1.0 || gloss_strength > 0.0) ? diffuse_lighting(mat3(view_matrix) * -clipping_plane.xyz) :\n" +" direct_lighting(eye_position, mat3(view_matrix) * -clipping_plane.xyz));\n" +"#endif\n" " gl_Position = projection_matrix * vec4(eye_position, 1.0);\n" "}\n"; @@ -188,11 +252,16 @@ static const char* Segments_Shadow_Caster_Vertex_Shader = "uniform bool reverse_order;\n" "uniform int instances_count;\n" "out vec3 world_position;\n" +"uniform samplerBuffer color_tex;\n" +"flat out float alpha;\n" +"flat out int segment_id;\n" "void main() {\n" " int segment = gl_VertexID / 6;\n" " int corner = CORNERS[gl_VertexID - 6 * segment];\n" " int instance = reverse_order ? instances_count - 1 - segment : segment;\n" " int id_a = int(texelFetch(segment_index_tex, instance).r);\n" +" alpha = texelFetch(color_tex, id_a).a;\n" +" segment_id = id_a;\n" " int id = corner < 2 ? id_a : id_a + 1;\n" " vec3 pos_a = texelFetch(position_tex, id_a).xyz;\n" " vec3 pos_b = texelFetch(position_tex, id_a + 1).xyz;\n" @@ -218,9 +287,17 @@ static const char* Segments_Shadow_Caster_Fragment_Shader = "#version 150\n" "uniform vec4 clipping_plane;\n" "in vec3 world_position;\n" +"flat in float alpha;\n" +"flat in int segment_id;\n" +// ORCA: a translucent segment covers a share of the texels as large as its opacity, in an ordered pattern the +// receivers' 5x5 filter reads as a lighter shadow. The pattern moves with the segment, so stacked layers add up. +"const float BAYER[16] = float[](0.0, 8.0, 2.0, 10.0, 12.0, 4.0, 14.0, 6.0, 3.0, 11.0, 1.0, 9.0, 15.0, 7.0, 13.0, 5.0);\n" "void main() {\n" " if (dot(vec4(world_position, 1.0), clipping_plane) < 0.0)\n" " discard;\n" +" ivec2 cell = (ivec2(gl_FragCoord.xy) + ivec2(segment_id, segment_id >> 2)) & 3;\n" +" if (alpha < 1.0 && (BAYER[4 * cell.y + cell.x] + 0.5) / 16.0 > alpha)\n" +" discard;\n" "}\n"; static const char* Segments_Fragment_Shader = @@ -248,13 +325,35 @@ static const char* Segments_Fragment_Shader = "uniform samplerBuffer height_width_angle_tex;\n" "const vec3 UP = vec3(0, 0, 1);\n" "const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);\n" +// ORCA: in realistic view every filament is glossy, with an untinted highlight a translucent one's opacity does not dim +"uniform float gloss_strength;\n" +"const float GLOSS_SHININESS = 80.0;\n" +"#ifndef DEPTH_ONLY\n" "in vec3 color;\n" "in vec3 color_direct;\n" +"#endif\n" "in vec3 world_position;\n" +"#ifndef DEPTH_ONLY\n" "in vec3 shadow_normal;\n" +"#endif\n" "flat in int segment_id;\n" +"#ifndef DEPTH_ONLY\n" "in vec3 cut_color_direct;\n" +"#endif\n" +"flat in float alpha;\n" "out vec4 fragment_color;\n" +// ORCA: order independent transparency, see ViewerImpl::render_translucent_segments(). Pass 1 finds the depth of +// the nearest translucent surface, pass 2 sets that surface apart and adds up the weighted others. +"out float oit_reveal;\n" +"out vec4 oit_front;\n" +"#ifdef DEPTH_ONLY\n" +"const int oit_pass = 1;\n" +"#else\n" +"uniform int oit_pass;\n" +"#endif\n" +"uniform sampler2D opaque_depth;\n" +"uniform sampler2D front_depth;\n" +"uniform vec2 oit_depth_range;\n" "float shadow_shade(vec3 position, vec3 normal) {\n" " if (shadow_intensity <= 0.0)\n" " return 1.0;\n" @@ -298,19 +397,126 @@ static const char* Segments_Fragment_Shader = " texelFetch(height_width_angle_tex, segment_id + 1).xy, along);\n" " return abs(dot(offset, right_dir)) / half_height_width.y + abs(dot(offset, cross(right_dir, line_dir))) / half_height_width.x <= 1.0;\n" "}\n" +// ORCA: two segments of a path overlap at their joint, which blending would draw twice and the highlight of +// realistic view shows on opaque ones too, so each is cut at the bisector plane of its joints: whether the +// fragment lies past the plane of the joint at vertex id, step being -1 for the start of the segment and 1 for +// its end, keeping 0.02 mm of overlap where the faces each segment turns to the camera would leave gaps without +// their caps. Past the vertex repeated in place that starts a split path, the neighbour is one vertex further. +"bool beyond_joint(int id, vec3 pos, vec3 line_dir, int step) {\n" +" int size = textureSize(position_tex);\n" +" if (id + step < 0 || id + step >= size || fract(texelFetch(position_tex, id).w) <= 0.25)\n" +" return false;\n" +" vec3 dir = float(step) * (texelFetch(position_tex, id + step).xyz - pos);\n" +" if (dot(dir, dir) < 1e-4 && id + 2 * step >= 0 && id + 2 * step < size)\n" +" dir = float(step) * (texelFetch(position_tex, id + 2 * step).xyz - pos);\n" +" vec3 n = dot(dir, dir) > 1e-8 ? normalize(dir) + line_dir : vec3(0.0);\n" +" return dot(n, n) > 1e-4 && float(step) * dot(normalize(n), world_position - pos) > 0.02;\n" +"}\n" "void main() {\n" -" vec3 c;\n" -" if (dot(vec4(world_position, 1.0), clipping_plane) >= 0.0)\n" -" c = color + color_direct * shadow_shade(world_position, shadow_normal);\n" -" else {\n" -" vec3 cut;\n" -" if (!find_cut(cut))\n" +" if (alpha < 1.0 || gloss_strength > 0.0) {\n" +" vec3 pos_a = texelFetch(position_tex, segment_id).xyz;\n" +" vec3 pos_b = texelFetch(position_tex, segment_id + 1).xyz;\n" +" vec3 line_dir = normalize(pos_b - pos_a);\n" +" if (beyond_joint(segment_id, pos_a, line_dir, -1) || beyond_joint(segment_id + 1, pos_b, line_dir, 1))\n" " discard;\n" -" c = color + cut_color_direct * shadow_shade(cut, mat3(view_matrix) * -clipping_plane.xyz);\n" +" }\n" +// ORCA: in the transparency passes, the opaque scene hides what lies behind it +" if (oit_pass != 0 && gl_FragCoord.z > texelFetch(opaque_depth, ivec2(gl_FragCoord.xy), 0).r)\n" +" discard;\n" +" if (oit_pass == 1) {\n" +" vec3 cut;\n" +" if (dot(vec4(world_position, 1.0), clipping_plane) < 0.0 && !find_cut(cut))\n" +" discard;\n" +" fragment_color = vec4(gl_FragCoord.z);\n" +" return;\n" +" }\n" +"#ifndef DEPTH_ONLY\n" +" vec3 c;\n" +" vec3 position = world_position;\n" +" vec3 normal = shadow_normal;\n" +" bool cut_face = false;\n" +" float shade;\n" +" if (dot(vec4(world_position, 1.0), clipping_plane) >= 0.0) {\n" +" shade = shadow_shade(position, normal);\n" +" c = color + color_direct * shade;\n" +" }\n" +" else {\n" +" if (!find_cut(position))\n" +" discard;\n" +" cut_face = true;\n" +" normal = mat3(view_matrix) * -clipping_plane.xyz;\n" +" shade = shadow_shade(position, normal);\n" +" c = color + cut_color_direct * shade;\n" " }\n" " c *= exposure;\n" " c = mix(vec3(dot(c, LUMA)), c, saturation);\n" -" fragment_color = vec4(clamp(c, 0.0, 1.0), 1.0);\n" +// ORCA: the highlight takes the normal of the rounded extrusion the segment stands for, an ellipse of its height +// and width around its centre line, smooth across a joint, where the facets of two segments would catch it +// apart. It fades out towards the tip of a path end, whose normal runs along the extrusion. +" float gloss = 0.0;\n" +" if (gloss_strength > 0.0) {\n" +" vec3 across = normalize(normal);\n" +" vec3 start = texelFetch(position_tex, segment_id).xyz;\n" +" vec3 line = texelFetch(position_tex, segment_id + 1).xyz - start;\n" +" float length_sq = dot(line, line);\n" +" if (!cut_face && length_sq > 1e-8) {\n" +" float t = clamp(dot(position - start, line) / length_sq, 0.0, 1.0);\n" +" vec2 half_height_width = 0.5 * mix(texelFetch(height_width_angle_tex, segment_id).xy, texelFetch(height_width_angle_tex, segment_id + 1).xy, t);\n" +" vec3 radial = position - start - t * line;\n" +" vec3 n = vec3(radial.xy / (half_height_width.y * half_height_width.y), radial.z / (half_height_width.x * half_height_width.x));\n" +" n = dot(n, n) > 1e-12 ? normalize(n) : UP;\n" +" across = mat3(view_matrix) * (n - dot(n, line) / length_sq * line);\n" +" }\n" +" vec3 v = projection_matrix[3][3] == 1.0 ? vec3(0.0, 0.0, 1.0) : -normalize((view_matrix * vec4(position, 1.0)).xyz);\n" +" gloss = dot(across, across) > 1e-8 ? gloss_strength * dot(across, across) * pow(max(dot(v, reflect(-light_top_dir, normalize(across))), 0.0), GLOSS_SHININESS) * shade : 0.0;\n" +" }\n" +" if (alpha == 1.0) {\n" +" fragment_color = vec4(clamp(c + gloss, 0.0, 1.0), 1.0);\n" +" return;\n" +" }\n" +// ORCA: translucent, premultiplied +" fragment_color = vec4(clamp(c, 0.0, 1.0) * alpha + gloss, alpha);\n" +" if (oit_pass != 2)\n" +" return;\n" +" if (gl_FragCoord.z <= texelFetch(front_depth, ivec2(gl_FragCoord.xy), 0).r) {\n" +" oit_front = fragment_color;\n" +" fragment_color = vec4(0.0);\n" +" oit_reveal = 0.0;\n" +" return;\n" +" }\n" +" float z = clamp((-(view_matrix * vec4(position, 1.0)).z - oit_depth_range.x) / (oit_depth_range.y - oit_depth_range.x), 0.0, 1.0);\n" +" fragment_color *= alpha * max(pow(1.0 - z, 3.0), 1e-2);\n" +" oit_reveal = -log(1.0 - alpha);\n" +" oit_front = vec4(0.0);\n" +"#endif\n" +"}\n"; + +// ORCA: weighted blended order independent transparency, see ViewerImpl::render_translucent() +static const char* Translucent_Composite_Vertex_Shader = +"#version 150\n" +"void main() {\n" +" vec2 corner = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);\n" +" gl_Position = vec4(2.0 * corner - 1.0, 0.0, 1.0);\n" +"}\n"; + +static const char* Translucent_Composite_Fragment_Shader = +"#version 150\n" +"uniform sampler2D accum_tex;\n" +"uniform sampler2D reveal_tex;\n" +"uniform sampler2D front_tex;\n" +"uniform ivec2 origin;\n" +"out vec4 fragment_color;\n" +"void main() {\n" +" ivec2 coord = ivec2(gl_FragCoord.xy) - origin;\n" +" vec4 front = texelFetch(front_tex, coord, 0);\n" +" vec4 accum = texelFetch(accum_tex, coord, 0);\n" +" if (front.a <= 0.0 && accum.a <= 0.0)\n" +" discard;\n" +" float coverage = accum.a > 0.0 ? 1.0 - exp(-texelFetch(reveal_tex, coord, 0).r) : 0.0;\n" +" vec3 behind = accum.a > 0.0 ? accum.rgb / accum.a * coverage : vec3(0.0);\n" +// the nearest surface over the weighted mean of the others +" float front_alpha = min(front.a, 1.0);\n" +" fragment_color = vec4(front.rgb + (1.0 - front_alpha) * behind, 1.0 - (1.0 - front_alpha) * (1.0 - coverage));\n" "}\n"; static const char* Options_Vertex_Shader = @@ -347,9 +553,8 @@ static const char* Options_Vertex_Shader = "uniform int grey_below_layer;\n" "uniform float dim_brightness;\n" "uniform int kept_vertex;\n" -"vec3 decode_color(float color, int id, int layer) {\n" -" int c = int(round(color));\n" -" vec3 rgb = vec3((c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF);\n" +"vec3 decode_color(vec3 color, int id, int layer) {\n" +" vec3 rgb = round(255.0 * color);\n" " if (id != kept_vertex && layer != lit_layers.x && layer != lit_layers.y) {\n" " if (dim_brightness >= 0.0)\n" " rgb = floor(rgb * dim_brightness);\n" @@ -383,7 +588,7 @@ static const char* Options_Vertex_Shader = " // ORCA: Apply bias to z-position to avoid z-fighting\n" " eye_position.z += bias;\n" " vec3 eye_normal = (view_matrix * vec4(in_normal, 0.0)).xyz;\n" -" vec3 color_base = decode_color(texelFetch(color_tex, id).r, id, int(texelFetch(position_tex, id).w));\n" +" vec3 color_base = decode_color(texelFetch(color_tex, id).rgb, id, int(texelFetch(position_tex, id).w));\n" " color = color_base * lighting(eye_position, eye_normal);\n" " gl_Position = projection_matrix * vec4(eye_position, 1.0);\n" "}\n"; diff --git a/src/libvgcode/src/ShadersES.hpp b/src/libvgcode/src/ShadersES.hpp index 12871f6249..b4983ccfcc 100644 --- a/src/libvgcode/src/ShadersES.hpp +++ b/src/libvgcode/src/ShadersES.hpp @@ -16,6 +16,7 @@ static const char* Segments_Vertex_Shader_ES = "#define POINTY_CAPS\n" "#define FIX_TWISTING\n" "uniform vec3 light_top_dir;\n" +"uniform float gloss_strength;\n" "const float light_top_diffuse = 0.6 * 0.8;\n" // ORCA: the specular was 0.6 * 0.125, too faint to give the filament any sheen. "const float light_top_specular = 0.6 * 0.25;\n" @@ -24,6 +25,7 @@ static const char* Segments_Vertex_Shader_ES = "const float light_front_diffuse = 0.6 * 0.3;\n" "const float ambient = 0.3;\n" "const float emission = 0.15;\n" +"const float REFERENCE_THICKNESS = 0.4;\n" "const vec3 UP = vec3(0, 0, 1);\n" "uniform mat4 view_matrix;\n" "uniform mat4 projection_matrix;\n" @@ -50,14 +52,16 @@ static const char* Segments_Vertex_Shader_ES = // ORCA: section view - the segment and the light on its cut face "flat out int segment_id;\n" "out vec3 cut_color_direct;\n" +// ORCA: the opaque and the translucent segments are drawn in separate passes, see ViewerImpl::render_segments(). +"uniform int first_instance;\n" +"flat out float alpha;\n" // ORCA: the layers greyed or dimmed around the one the sliders show, see ViewerImpl::set_layer_colors(). "uniform ivec2 lit_layers;\n" "uniform int grey_below_layer;\n" "uniform float dim_brightness;\n" "uniform int kept_vertex;\n" -"vec3 decode_color(float color, int id, int layer) {\n" -" int c = int(round(color));\n" -" vec3 rgb = vec3((c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF);\n" +"vec3 decode_color(vec3 color, int id, int layer) {\n" +" vec3 rgb = round(255.0 * color);\n" " if (id != kept_vertex && layer != lit_layers.x && layer != lit_layers.y) {\n" " if (dim_brightness >= 0.0)\n" " rgb = floor(rgb * dim_brightness);\n" @@ -73,6 +77,10 @@ static const char* Segments_Vertex_Shader_ES = " float top_specular = light_top_specular * pow(max(dot(-normalize(eye_position), reflect(-light_top_dir, eye_normal)), 0.0), light_top_shininess);\n" " return top_diffuse + front_diffuse + top_specular;\n" "}\n" +// ORCA: in realistic view, and on a translucent filament, the highlight is the fragment shader's, untinted +"float diffuse_lighting(vec3 eye_normal) {\n" +" return light_top_diffuse * max(dot(eye_normal, light_top_dir), 0.0) + light_front_diffuse * max(dot(eye_normal, light_front_dir), 0.0);\n" +"}\n" "ivec2 tex_coord(sampler2D sampler, int id) {\n" " ivec2 tex_size = textureSize(sampler, 0);\n" " return (tex_size.y == 1) ? ivec2(id, 0) : ivec2(id % tex_size.x, id / tex_size.x);\n" @@ -83,8 +91,9 @@ static const char* Segments_Vertex_Shader_ES = "}\n" "void main() {\n" " int vertex_id = int(vertex_id_float);\n" -" int instance = reverse_order ? instances_count - 1 - gl_InstanceID : gl_InstanceID;\n" +" int instance = first_instance + (reverse_order ? instances_count - 1 - gl_InstanceID : gl_InstanceID);\n" " int id_a = int(texelFetch(segment_index_tex, tex_coord_u(segment_index_tex, instance), 0).r);\n" +" alpha = texelFetch(color_tex, tex_coord(color_tex, id_a), 0).a;\n" " int id_b = id_a + 1;\n" " vec3 pos_a = texelFetch(position_tex, tex_coord(position_tex, id_a), 0).xyz;\n" " vec3 pos_b = texelFetch(position_tex, tex_coord(position_tex, id_b), 0).xyz;\n" @@ -105,6 +114,29 @@ static const char* Segments_Vertex_Shader_ES = " else\n" " line_right_dir = normalize(cross(line_dir, UP));\n" " vec3 line_up_dir = normalize(cross(line_right_dir, line_dir));\n" +// ORCA: the direction of the path across each joint, for the caps below; the fragment shader cuts the segment at +// its joints. The w of a position carries 0.5 at a joint, see extract_pos_and_or_hwa(). +" vec3 joint_prev = vec3(0.0);\n" +" vec3 joint_next = vec3(0.0);\n" +" if (alpha < 1.0 || gloss_strength > 0.0) {\n" +" if (id_a > 0 && fract(texelFetch(position_tex, tex_coord(position_tex, id_a), 0).w) > 0.25) {\n" +" vec3 prev = pos_a - texelFetch(position_tex, tex_coord(position_tex, id_a - 1), 0).xyz;\n" +// ORCA: past the vertex repeated in place that starts a split path +" if (dot(prev, prev) < 1e-4 && id_a > 1)\n" +" prev = pos_a - texelFetch(position_tex, tex_coord(position_tex, id_a - 2), 0).xyz;\n" +" vec3 n = dot(prev, prev) > 1e-8 ? normalize(prev) + line_dir : vec3(0.0);\n" +" if (dot(n, n) > 1e-4)\n" +" joint_prev = prev;\n" +" }\n" +" if (id_b + 1 < textureSize(position_tex, 0).x * textureSize(position_tex, 0).y && fract(texelFetch(position_tex, tex_coord(position_tex, id_b), 0).w) > 0.25) {\n" +" vec3 next = texelFetch(position_tex, tex_coord(position_tex, id_b + 1), 0).xyz - pos_b;\n" +" if (dot(next, next) < 1e-4 && id_b + 2 < textureSize(position_tex, 0).x * textureSize(position_tex, 0).y)\n" +" next = texelFetch(position_tex, tex_coord(position_tex, id_b + 2), 0).xyz - pos_b;\n" +" vec3 n = dot(next, next) > 1e-8 ? line_dir + normalize(next) : vec3(0.0);\n" +" if (dot(n, n) > 1e-4)\n" +" joint_next = next;\n" +" }\n" +" }\n" " const vec2 horizontal_vertical_view_signs_array[16] = vec2[](\n" " //horizontal view (from right)\n" " vec2(1.0, 0.0),\n" @@ -128,6 +160,14 @@ static const char* Segments_Vertex_Shader_ES = " int id = vertex_id < 4 ? id_a : id_b;\n" " vec3 endpoint_pos = vertex_id < 4 ? pos_a : pos_b;\n" " vec3 height_width_angle = texelFetch(height_width_angle_tex, tex_coord(height_width_angle_tex, id), 0).xyz;\n" +// ORCA: across the vertex repeated in place that starts a split path, a cut joint keeps no angle. The caps take +// it from the joint, to fill the outside of the turn as at any other joint. +" vec3 joint_other = vertex_id < 4 ? joint_prev : joint_next;\n" +" if (height_width_angle.z == 0.0 && dot(joint_other, joint_other) > 0.0) {\n" +" vec3 into = vertex_id < 4 ? joint_other : line;\n" +" vec3 onto = vertex_id < 4 ? line : joint_other;\n" +" height_width_angle.z = atan(into.x * onto.y - into.y * onto.x, dot(into, onto));\n" +" }\n" "#ifdef FIX_TWISTING\n" " int closer_id = (dot(camera_position - pos_a, camera_position - pos_a) < dot(camera_position - pos_b, camera_position - pos_b)) ? id_a : id_b;\n" " vec3 closer_pos = (closer_id == id_a) ? pos_a : pos_b;\n" @@ -138,6 +178,13 @@ static const char* Segments_Vertex_Shader_ES = " vec3 camera_view_dir = normalize(endpoint_pos - camera_position);\n" " vec3 diagonal_dir_border = normalize(height_width_angle.x * line_up_dir + height_width_angle.y * line_right_dir);\n" "#endif\n" +// ORCA: a filament's opacity is that of REFERENCE_THICKNESS mm of it, here the path of the view ray through the extrusion +" if (alpha < 1.0) {\n" +" vec2 hw = texelFetch(height_width_angle_tex, tex_coord(height_width_angle_tex, id_a), 0).xy;\n" +" float path = 1.0 / max(abs(dot(camera_view_dir, line_up_dir)) / hw.x + abs(dot(camera_view_dir, line_right_dir)) / hw.y, 1e-3);\n" +// ORCA: below 1, which would take a translucent segment for an opaque one +" alpha = min(1.0 - pow(1.0 - alpha, min(path / REFERENCE_THICKNESS, 16.0)), 0.999);\n" +" }\n" " bool is_vertical_view = abs(dot(camera_view_dir, line_up_dir)) / abs(dot(diagonal_dir_border, line_up_dir)) >\n" " abs(dot(camera_view_dir, line_right_dir)) / abs(dot(diagonal_dir_border, line_right_dir));\n" " vec2 signs = horizontal_vertical_view_signs_array[vertex_id + 8 * int(is_vertical_view)];\n" @@ -169,14 +216,15 @@ static const char* Segments_Vertex_Shader_ES = " }\n" " vec3 eye_position = (view_matrix * vec4(pos, 1.0)).xyz;\n" " vec3 eye_normal = (view_matrix * vec4(normalize(pos - endpoint_pos), 0.0)).xyz;\n" -" vec3 color_base = decode_color(texelFetch(color_tex, tex_coord(color_tex, id), 0).r, id, int(texelFetch(position_tex, tex_coord(position_tex, id), 0).w));\n" +" vec3 color_base = decode_color(texelFetch(color_tex, tex_coord(color_tex, id), 0).rgb, id, int(texelFetch(position_tex, tex_coord(position_tex, id), 0).w));\n" " color = color_base * (ambient + emission);\n" -" color_direct = color_base * direct_lighting(eye_position, eye_normal);\n" +" color_direct = color_base * ((alpha < 1.0 || gloss_strength > 0.0) ? diffuse_lighting(eye_normal) : direct_lighting(eye_position, eye_normal));\n" " world_position = pos;\n" " shadow_normal = eye_normal;\n" " segment_id = id_a;\n" " cut_color_direct = clipping_plane.xyz == vec3(0.0) ? vec3(0.0) :\n" -" color_base * direct_lighting(eye_position, mat3(view_matrix) * -clipping_plane.xyz);\n" +" color_base * ((alpha < 1.0 || gloss_strength > 0.0) ? diffuse_lighting(mat3(view_matrix) * -clipping_plane.xyz) :\n" +" direct_lighting(eye_position, mat3(view_matrix) * -clipping_plane.xyz));\n" " gl_Position = projection_matrix * vec4(eye_position, 1.0);\n" "}\n"; @@ -194,6 +242,9 @@ static const char* Segments_Shadow_Caster_Vertex_Shader_ES = "uniform bool reverse_order;\n" "uniform int instances_count;\n" "out vec3 world_position;\n" +"uniform sampler2D color_tex;\n" +"flat out float alpha;\n" +"flat out int segment_id;\n" "ivec2 tex_coord(sampler2D sampler, int id) {\n" " ivec2 tex_size = textureSize(sampler, 0);\n" " return (tex_size.y == 1) ? ivec2(id, 0) : ivec2(id % tex_size.x, id / tex_size.x);\n" @@ -207,6 +258,8 @@ static const char* Segments_Shadow_Caster_Vertex_Shader_ES = " int corner = CORNERS[gl_VertexID - 6 * segment];\n" " int instance = reverse_order ? instances_count - 1 - segment : segment;\n" " int id_a = int(texelFetch(segment_index_tex, tex_coord_u(segment_index_tex, instance), 0).r);\n" +" alpha = texelFetch(color_tex, tex_coord(color_tex, id_a), 0).a;\n" +" segment_id = id_a;\n" " int id = corner < 2 ? id_a : id_a + 1;\n" " vec3 pos_a = texelFetch(position_tex, tex_coord(position_tex, id_a), 0).xyz;\n" " vec3 pos_b = texelFetch(position_tex, tex_coord(position_tex, id_a + 1), 0).xyz;\n" @@ -231,11 +284,20 @@ static const char* Segments_Shadow_Caster_Vertex_Shader_ES = static const char* Segments_Shadow_Caster_Fragment_Shader_ES = "#version 300 es\n" "precision highp float;\n" +"precision highp int;\n" "uniform vec4 clipping_plane;\n" "in vec3 world_position;\n" +"flat in float alpha;\n" +"flat in int segment_id;\n" +// ORCA: a translucent segment covers a share of the texels as large as its opacity, in an ordered pattern the +// receivers' 5x5 filter reads as a lighter shadow. The pattern moves with the segment, so stacked layers add up. +"const float BAYER[16] = float[](0.0, 8.0, 2.0, 10.0, 12.0, 4.0, 14.0, 6.0, 3.0, 11.0, 1.0, 9.0, 15.0, 7.0, 13.0, 5.0);\n" "void main() {\n" " if (dot(vec4(world_position, 1.0), clipping_plane) < 0.0)\n" " discard;\n" +" ivec2 cell = (ivec2(gl_FragCoord.xy) + ivec2(segment_id, segment_id >> 2)) & 3;\n" +" if (alpha < 1.0 && (BAYER[4 * cell.y + cell.x] + 0.5) / 16.0 > alpha)\n" +" discard;\n" "}\n"; static const char* Segments_Fragment_Shader_ES = @@ -269,12 +331,16 @@ static const char* Segments_Fragment_Shader_ES = "uniform lowp sampler2D height_width_angle_tex;\n" "const vec3 UP = vec3(0, 0, 1);\n" "const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);\n" +// ORCA: in realistic view every filament is glossy, with an untinted highlight a translucent one's opacity does not dim +"uniform float gloss_strength;\n" +"const float GLOSS_SHININESS = 80.0;\n" "in vec3 color;\n" "in vec3 color_direct;\n" "in vec3 world_position;\n" "in vec3 shadow_normal;\n" "flat in int segment_id;\n" "in vec3 cut_color_direct;\n" +"flat in float alpha;\n" "out vec4 fragment_color;\n" "float shadow_shade(vec3 position, vec3 normal) {\n" " if (shadow_intensity <= 0.0)\n" @@ -323,19 +389,74 @@ static const char* Segments_Fragment_Shader_ES = " fetch(height_width_angle_tex, segment_id + 1).xy, along);\n" " return abs(dot(offset, right_dir)) / half_height_width.y + abs(dot(offset, cross(right_dir, line_dir))) / half_height_width.x <= 1.0;\n" "}\n" +// ORCA: two segments of a path overlap at their joint, which blending would draw twice and the highlight of +// realistic view shows on opaque ones too, so each is cut at the bisector plane of its joints: whether the +// fragment lies past the plane of the joint at vertex id, step being -1 for the start of the segment and 1 for +// its end, keeping 0.02 mm of overlap where the faces each segment turns to the camera would leave gaps without +// their caps. Past the vertex repeated in place that starts a split path, the neighbour is one vertex further. +"bool beyond_joint(int id, vec3 pos, vec3 line_dir, int step) {\n" +" int size = textureSize(position_tex, 0).x * textureSize(position_tex, 0).y;\n" +" if (id + step < 0 || id + step >= size || fract(fetch(position_tex, id).w) <= 0.25)\n" +" return false;\n" +" vec3 dir = float(step) * (fetch(position_tex, id + step).xyz - pos);\n" +" if (dot(dir, dir) < 1e-4 && id + 2 * step >= 0 && id + 2 * step < size)\n" +" dir = float(step) * (fetch(position_tex, id + 2 * step).xyz - pos);\n" +" vec3 n = dot(dir, dir) > 1e-8 ? normalize(dir) + line_dir : vec3(0.0);\n" +" return dot(n, n) > 1e-4 && float(step) * dot(normalize(n), world_position - pos) > 0.02;\n" +"}\n" "void main() {\n" -" vec3 c;\n" -" if (dot(vec4(world_position, 1.0), clipping_plane) >= 0.0)\n" -" c = color + color_direct * shadow_shade(world_position, shadow_normal);\n" -" else {\n" -" vec3 cut;\n" -" if (!find_cut(cut))\n" +" if (alpha < 1.0 || gloss_strength > 0.0) {\n" +" vec3 pos_a = fetch(position_tex, segment_id).xyz;\n" +" vec3 pos_b = fetch(position_tex, segment_id + 1).xyz;\n" +" vec3 line_dir = normalize(pos_b - pos_a);\n" +" if (beyond_joint(segment_id, pos_a, line_dir, -1) || beyond_joint(segment_id + 1, pos_b, line_dir, 1))\n" " discard;\n" -" c = color + cut_color_direct * shadow_shade(cut, mat3(view_matrix) * -clipping_plane.xyz);\n" +" }\n" +" vec3 c;\n" +" vec3 position = world_position;\n" +" vec3 normal = shadow_normal;\n" +" bool cut_face = false;\n" +" float shade;\n" +" if (dot(vec4(world_position, 1.0), clipping_plane) >= 0.0) {\n" +" shade = shadow_shade(position, normal);\n" +" c = color + color_direct * shade;\n" +" }\n" +" else {\n" +" if (!find_cut(position))\n" +" discard;\n" +" cut_face = true;\n" +" normal = mat3(view_matrix) * -clipping_plane.xyz;\n" +" shade = shadow_shade(position, normal);\n" +" c = color + cut_color_direct * shade;\n" " }\n" " c *= exposure;\n" " c = mix(vec3(dot(c, LUMA)), c, saturation);\n" -" fragment_color = vec4(clamp(c, 0.0, 1.0), 1.0);\n" +// ORCA: the highlight takes the normal of the rounded extrusion the segment stands for, an ellipse of its height +// and width around its centre line, smooth across a joint, where the facets of two segments would catch it +// apart. It fades out towards the tip of a path end, whose normal runs along the extrusion. +" float gloss = 0.0;\n" +" if (gloss_strength > 0.0) {\n" +" vec3 across = normalize(normal);\n" +" vec3 start = fetch(position_tex, segment_id).xyz;\n" +" vec3 line = fetch(position_tex, segment_id + 1).xyz - start;\n" +" float length_sq = dot(line, line);\n" +" if (!cut_face && length_sq > 1e-8) {\n" +" float t = clamp(dot(position - start, line) / length_sq, 0.0, 1.0);\n" +" vec2 half_height_width = 0.5 * mix(fetch(height_width_angle_tex, segment_id).xy, fetch(height_width_angle_tex, segment_id + 1).xy, t);\n" +" vec3 radial = position - start - t * line;\n" +" vec3 n = vec3(radial.xy / (half_height_width.y * half_height_width.y), radial.z / (half_height_width.x * half_height_width.x));\n" +" n = dot(n, n) > 1e-12 ? normalize(n) : UP;\n" +" across = mat3(view_matrix) * (n - dot(n, line) / length_sq * line);\n" +" }\n" +" vec3 v = projection_matrix[3][3] == 1.0 ? vec3(0.0, 0.0, 1.0) : -normalize((view_matrix * vec4(position, 1.0)).xyz);\n" +" gloss = dot(across, across) > 1e-8 ? gloss_strength * dot(across, across) * pow(max(dot(v, reflect(-light_top_dir, normalize(across))), 0.0), GLOSS_SHININESS) * shade : 0.0;\n" +" }\n" +" if (alpha == 1.0) {\n" +" fragment_color = vec4(clamp(c + gloss, 0.0, 1.0), 1.0);\n" +" return;\n" +" }\n" +// ORCA: translucent, premultiplied +" fragment_color = vec4(clamp(c, 0.0, 1.0) * alpha + gloss, alpha);\n" "}\n"; static const char* Options_Vertex_Shader_ES = @@ -367,9 +488,8 @@ static const char* Options_Vertex_Shader_ES = "uniform int grey_below_layer;\n" "uniform float dim_brightness;\n" "uniform int kept_vertex;\n" -"vec3 decode_color(float color, int id, int layer) {\n" -" int c = int(round(color));\n" -" vec3 rgb = vec3((c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF);\n" +"vec3 decode_color(vec3 color, int id, int layer) {\n" +" vec3 rgb = round(255.0 * color);\n" " if (id != kept_vertex && layer != lit_layers.x && layer != lit_layers.y) {\n" " if (dim_brightness >= 0.0)\n" " rgb = floor(rgb * dim_brightness);\n" @@ -406,7 +526,7 @@ static const char* Options_Vertex_Shader_ES = " clipping_plane_dot = dot(vec4(offset, 1.0), clipping_plane);\n" " vec3 eye_position = (view_matrix * vec4(scale_matrix * in_position + offset, 1.0)).xyz;\n" " vec3 eye_normal = (view_matrix * vec4(in_normal, 0.0)).xyz;\n" -" vec3 color_base = decode_color(texelFetch(color_tex, tex_coord(color_tex, id), 0).r, id, int(texelFetch(position_tex, tex_coord(position_tex, id), 0).w));\n" +" vec3 color_base = decode_color(texelFetch(color_tex, tex_coord(color_tex, id), 0).rgb, id, int(texelFetch(position_tex, tex_coord(position_tex, id), 0).w));\n" " color = color_base * lighting(eye_position, eye_normal);\n" " gl_Position = projection_matrix * vec4(eye_position, 1.0);\n" "}\n"; diff --git a/src/libvgcode/src/Viewer.cpp b/src/libvgcode/src/Viewer.cpp index f4690276f7..f61cd07c3e 100644 --- a/src/libvgcode/src/Viewer.cpp +++ b/src/libvgcode/src/Viewer.cpp @@ -49,6 +49,16 @@ void Viewer::render(const Mat4x4& view_matrix, const Mat4x4& projection_matrix) m_impl->render(view_matrix, projection_matrix); } +void Viewer::render_translucent(const Mat4x4& view_matrix, const Mat4x4& projection_matrix) +{ + m_impl->render_translucent(view_matrix, projection_matrix); +} + +bool Viewer::has_translucent_toolpaths() const +{ + return m_impl->has_translucent_toolpaths(); +} + void Viewer::render_shadow_casters(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& light_position) { m_impl->render_shadow_casters(view_matrix, projection_matrix, light_position); @@ -64,6 +74,11 @@ void Viewer::set_light_top_dir(const Vec3& direction) m_impl->set_light_top_dir(direction); } +void Viewer::set_gloss(bool gloss) +{ + m_impl->set_gloss(gloss); +} + void Viewer::set_tone(float exposure, float saturation) { m_impl->set_tone(exposure, saturation); @@ -124,6 +139,16 @@ void Viewer::set_dim_previous_layers_brightness(float value) m_impl->set_dim_previous_layers_brightness(value); } +bool Viewer::is_translucent_filaments() const +{ + return m_impl->is_translucent_filaments(); +} + +void Viewer::set_translucent_filaments(bool value) +{ + m_impl->set_translucent_filaments(value); +} + bool Viewer::is_option_visible(EOptionType type) const { return m_impl->is_option_visible(type); @@ -179,12 +204,12 @@ size_t Viewer::get_tool_colors_count() const return m_impl->get_tool_colors_count(); } -const Palette& Viewer::get_tool_colors() const +const PaletteWithAlpha& Viewer::get_tool_colors() const { return m_impl->get_tool_colors(); } -void Viewer::set_tool_colors(const Palette& colors) +void Viewer::set_tool_colors(const PaletteWithAlpha& colors) { m_impl->set_tool_colors(colors); } @@ -194,12 +219,12 @@ size_t Viewer::get_color_print_colors_count() const return m_impl->get_color_print_colors_count(); } -const Palette& Viewer::get_color_print_colors() const +const PaletteWithAlpha& Viewer::get_color_print_colors() const { return m_impl->get_color_print_colors(); } -void Viewer::set_color_print_colors(const Palette& colors) +void Viewer::set_color_print_colors(const PaletteWithAlpha& colors) { m_impl->set_color_print_colors(colors); } diff --git a/src/libvgcode/src/ViewerImpl.cpp b/src/libvgcode/src/ViewerImpl.cpp index c6fcb01ace..7908fbed5b 100644 --- a/src/libvgcode/src/ViewerImpl.cpp +++ b/src/libvgcode/src/ViewerImpl.cpp @@ -231,7 +231,9 @@ std::string check_program(GLuint handle) return ret; } -unsigned int init_shader(const std::string& shader_name, const char* vertex_shader, const char* fragment_shader) +// ORCA: fragment_outputs lists the outputs of a fragment shader that writes more than one, in location order +unsigned int init_shader(const std::string& shader_name, const char* vertex_shader, const char* fragment_shader, + const std::vector& fragment_outputs = {}) { const GLuint vs_id = glCreateShader(GL_VERTEX_SHADER); glcheck(); @@ -258,6 +260,10 @@ unsigned int init_shader(const std::string& shader_name, const char* vertex_shad glcheck(); glsafe(glAttachShader(shader_id, vs_id)); glsafe(glAttachShader(shader_id, fs_id)); +#ifndef ENABLE_OPENGL_ES + for (size_t i = 0; i < fragment_outputs.size(); ++i) + glsafe(glBindFragDataLocation(shader_id, static_cast(i), fragment_outputs[i])); +#endif // ENABLE_OPENGL_ES glsafe(glLinkProgram(shader_id)); res = check_program(shader_id); if (!res.empty()) { @@ -292,6 +298,20 @@ static void delete_buffers(unsigned int& id) } } +#ifndef ENABLE_OPENGL_ES +// ORCA: the opaque depth, then the accumulated colors of the translucent segments, see render_translucent(). +// Past the units render_segments() and the shadow map take. +static constexpr int TRANSLUCENT_TEXTURE_UNIT = 5; + +// ORCA: the source with a #define after its #version line +static std::string with_define(const char* source, const char* define) +{ + const std::string src(source); + const size_t body = src.find('\n') + 1; + return src.substr(0, body) + "#define " + define + "\n" + src.substr(body); +} +#endif // ENABLE_OPENGL_ES + static const std::array DEFAULT_EXTRUSION_ROLES_COLORS = { { { 230, 179, 179 }, // None { 255, 230, 77 }, // Perimeter @@ -467,7 +487,7 @@ void ViewerImpl::TextureData::set_heights_widths_angles(const std::vector& glsafe(glPixelStorei(GL_UNPACK_ALIGNMENT, curr_unpack_alignment)); } -void ViewerImpl::TextureData::set_colors(const std::vector& colors) +void ViewerImpl::TextureData::set_colors(const std::vector& colors) { if (m_count == 0) return; @@ -501,17 +521,17 @@ void ViewerImpl::TextureData::set_colors(const std::vector& colors) glsafe(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); glsafe(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); if (remaining >= tex_capacity) { - glsafe(glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, static_cast(w), static_cast(h), 0, GL_RED, GL_FLOAT, &colors[offset])); + glsafe(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, static_cast(w), static_cast(h), 0, GL_RGBA, GL_UNSIGNED_BYTE, &colors[offset])); m_tex_ids[i].colors.second = w * h; } else { // the last row is only partially fitted with data, send it separately - glsafe(glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, static_cast(w), static_cast(h), 0, GL_RED, GL_FLOAT, nullptr)); - glsafe(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, static_cast(w), static_cast(h - 1), GL_RED, GL_FLOAT, &colors[offset])); - glsafe(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, static_cast(h - 1), static_cast(remaining % w), 1, GL_RED, GL_FLOAT, &colors[offset + w * (h - 1)])); + glsafe(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, static_cast(w), static_cast(h), 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr)); + glsafe(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, static_cast(w), static_cast(h - 1), GL_RGBA, GL_UNSIGNED_BYTE, &colors[offset])); + glsafe(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, static_cast(h - 1), static_cast(remaining % w), 1, GL_RGBA, GL_UNSIGNED_BYTE, &colors[offset + w * (h - 1)])); m_tex_ids[i].colors.second = w * (h - 1) + remaining % w; } - m_colors_size += m_tex_ids[i].colors.second * sizeof(float); + m_colors_size += m_tex_ids[i].colors.second * sizeof(ColorWithAlpha); remaining = (remaining > tex_capacity) ? remaining - tex_capacity : 0; } @@ -520,7 +540,7 @@ void ViewerImpl::TextureData::set_colors(const std::vector& colors) glsafe(glPixelStorei(GL_UNPACK_ALIGNMENT, curr_unpack_alignment)); } -void ViewerImpl::TextureData::set_enabled_segments(const std::vector& enabled_segments) +void ViewerImpl::TextureData::set_enabled_segments(const std::vector& enabled_segments, const std::vector& colors, bool sort_by_opacity) { if (m_count == 0) return; @@ -528,6 +548,7 @@ void ViewerImpl::TextureData::set_enabled_segments(const std::vector& for (TexIds& ids : m_tex_ids) { delete_textures(ids.enabled_segments.first); ids.enabled_segments.second = 0; + ids.enabled_translucent_segments = 0; } m_enabled_segments_size = 0; @@ -551,6 +572,12 @@ void ViewerImpl::TextureData::set_enabled_segments(const std::vector& if (!new_tex) curr_segments.push_back(seg - static_cast(curr_tex_id * tex_capacity)); if (i + 1 == enabled_segments.size() || new_tex) { + if (sort_by_opacity) { + const size_t offset = curr_tex_id * tex_capacity; + const auto translucent_begin = std::stable_partition(curr_segments.begin(), curr_segments.end(), + [&colors, offset](uint32_t s) { return colors[offset + s][3] == 255; }); + m_tex_ids[curr_tex_id].enabled_translucent_segments = static_cast(std::distance(translucent_begin, curr_segments.end())); + } const auto [w, h] = width_height(curr_segments.size()); glsafe(glGenTextures(1, &m_tex_ids[curr_tex_id].enabled_segments.first)); @@ -755,6 +782,7 @@ void ViewerImpl::SegmentsUniforms::init(unsigned int shader_id) segment_index_tex = glGetUniformLocation(shader_id, "segment_index_tex"); reverse_order = glGetUniformLocation(shader_id, "reverse_order"); instances_count = glGetUniformLocation(shader_id, "instances_count"); + first_instance = glGetUniformLocation(shader_id, "first_instance"); // ORCA: section view clipping_plane = glGetUniformLocation(shader_id, "clipping_plane"); } @@ -780,7 +808,21 @@ void ViewerImpl::init(const std::string& opengl_context_version) #ifdef ENABLE_OPENGL_ES m_segments_shader_id = init_shader("segments", Segments_Vertex_Shader_ES, Segments_Fragment_Shader_ES); #else - m_segments_shader_id = init_shader("segments", Segments_Vertex_Shader, Segments_Fragment_Shader); + m_segments_shader_id = init_shader("segments", Segments_Vertex_Shader, Segments_Fragment_Shader, { "fragment_color", "oit_reveal", "oit_front" }); + m_uni_segments_oit_pass_id = glGetUniformLocation(m_segments_shader_id, "oit_pass"); + m_uni_segments_opaque_depth_id = glGetUniformLocation(m_segments_shader_id, "opaque_depth"); + m_uni_segments_front_depth_id = glGetUniformLocation(m_segments_shader_id, "front_depth"); + m_uni_segments_oit_depth_range_id = glGetUniformLocation(m_segments_shader_id, "oit_depth_range"); + m_translucent_composite_shader_id = init_shader("translucent_composite", Translucent_Composite_Vertex_Shader, Translucent_Composite_Fragment_Shader); + m_uni_translucent_composite_accum_tex_id = glGetUniformLocation(m_translucent_composite_shader_id, "accum_tex"); + m_uni_translucent_composite_reveal_tex_id = glGetUniformLocation(m_translucent_composite_shader_id, "reveal_tex"); + m_uni_translucent_composite_front_tex_id = glGetUniformLocation(m_translucent_composite_shader_id, "front_tex"); + m_uni_translucent_composite_origin_id = glGetUniformLocation(m_translucent_composite_shader_id, "origin"); + const std::string depth_vs = with_define(Segments_Vertex_Shader, "DEPTH_ONLY"); + const std::string depth_fs = with_define(Segments_Fragment_Shader, "DEPTH_ONLY"); + m_segments_depth_shader_id = init_shader("segments_depth", depth_vs.c_str(), depth_fs.c_str(), { "fragment_color", "oit_reveal", "oit_front" }); + m_uni_segments_depth.init(m_segments_depth_shader_id); + m_uni_segments_depth_opaque_depth_id = glGetUniformLocation(m_segments_depth_shader_id, "opaque_depth"); #endif // ENABLE_OPENGL_ES m_uni_segments.init(m_segments_shader_id); @@ -792,6 +834,7 @@ void ViewerImpl::init(const std::string& opengl_context_version) m_uni_segments_exposure_id = glGetUniformLocation(m_segments_shader_id, "exposure"); m_uni_segments_saturation_id = glGetUniformLocation(m_segments_shader_id, "saturation"); m_uni_segments_light_top_dir_id = glGetUniformLocation(m_segments_shader_id, "light_top_dir"); + m_uni_segments_gloss_id = glGetUniformLocation(m_segments_shader_id, "gloss_strength"); m_uni_segments_layer_colors.init(m_segments_shader_id); glcheck(); assert(m_uni_segments.view_matrix != -1 && @@ -914,6 +957,16 @@ void ViewerImpl::shutdown() glsafe(glDeleteVertexArrays(1, &m_segments_caster_vao_id)); m_segments_caster_vao_id = 0; } +#ifndef ENABLE_OPENGL_ES + if (m_translucent_composite_shader_id != 0) { + glsafe(glDeleteProgram(m_translucent_composite_shader_id)); + m_translucent_composite_shader_id = 0; + } + if (m_segments_depth_shader_id != 0) { + glsafe(glDeleteProgram(m_segments_depth_shader_id)); + m_segments_depth_shader_id = 0; + } +#endif // ENABLE_OPENGL_ES m_initialized = false; OpenGLWrapper::unload_opengl(); } @@ -930,7 +983,10 @@ void ViewerImpl::reset() // swap rather than clear: these are sized by the print, and a reset means the memory // should go back, not sit reserved until the next load std::vector().swap(m_vertices); - std::vector().swap(m_vertices_colors); + std::vector().swap(m_vertices_colors); + m_has_translucent_colors = false; + m_enabled_translucent_segments_count = 0; + m_extrusions_box = { Vec3{ 0.0f, 0.0f, 0.0f }, Vec3{ 0.0f, 0.0f, 0.0f } }; for (std::vector& times : m_layer_start_times) std::vector().swap(times); std::vector().swap(m_layer_first_vertex); @@ -960,6 +1016,7 @@ void ViewerImpl::reset() delete_buffers(m_heights_widths_angles_buf_id); delete_textures(m_positions_tex_id); delete_buffers(m_positions_buf_id); + m_translucent_targets.release(); #endif // ENABLE_OPENGL_ES } @@ -969,6 +1026,25 @@ void ViewerImpl::reset() // To let all drivers be happy, we use GL_RGBA32F format, so we need to add an extra float // to position and heights_widths_angles vectors +// whether a line is drawn from vertex i to vertex i + 1 +static bool is_line(const std::vector& vertices, size_t i) +{ + return i + 1 < vertices.size() && vertices[i + 1].position != vertices[i].position && + vertices[i + 1].type == vertices[i].type && vertices[i].type != EMoveType::Seam; +} + +// ORCA: whether two lines meet at vertex i, also across the vertex repeated in place that starts a path split +// where a value the preview colors by changes, see starts_path() in LibVGCodeWrapper.cpp +static bool is_joint(const std::vector& vertices, size_t i) +{ + auto repeated = [&vertices](size_t j) { + return j + 1 < vertices.size() && vertices[j + 1].position == vertices[j].position && vertices[j + 1].type == vertices[j].type; + }; + const bool before = i > 0 && (is_line(vertices, i - 1) || (i > 1 && repeated(i - 1) && is_line(vertices, i - 2))); + const bool after = is_line(vertices, i) || (repeated(i) && is_line(vertices, i + 1)); + return before && after; +} + static void extract_pos_and_or_hwa(const std::vector& vertices, float travels_radius, float wipes_radius, BitSet<>& valid_lines_bitset, std::vector* positions = nullptr, std::vector* heights_widths_angles = nullptr, bool update_bitset = false) { static constexpr const Vec3 ZERO = { 0.0f, 0.0f, 0.0f }; @@ -988,10 +1064,7 @@ static void extract_pos_and_or_hwa(const std::vector& vertices, floa const EMoveType move_type = v.type; const bool prev_line_valid = i > 0 && valid_lines_bitset[i - 1]; const Vec3 prev_line = prev_line_valid ? v.position - vertices[i - 1].position : ZERO; - const bool this_line_valid = i + 1 < vertices.size() && - vertices[i + 1].position != v.position && - vertices[i + 1].type == move_type && - move_type != EMoveType::Seam; + const bool this_line_valid = is_line(vertices, i); const Vec3 this_line = this_line_valid ? vertices[i + 1].position - v.position : ZERO; if (this_line_valid) { @@ -1004,8 +1077,10 @@ static void extract_pos_and_or_hwa(const std::vector& vertices, floa } if (positions != nullptr) { - // ORCA: the last component, there to comply with GL_RGBA32F format, carries the layer the shaders grey and dim by - Vec4 position = { v.position[0], v.position[1], v.position[2], static_cast(v.layer_id) }; + // ORCA: the last component, there to comply with GL_RGBA32F format, carries the layer the shaders grey and dim by, + // plus 0.5 at the joint of two segments, which the shaders read as an int, see joint_a in Segments_Vertex_Shader + Vec4 position = { v.position[0], v.position[1], v.position[2], + static_cast(v.layer_id) + (is_joint(vertices, i) ? 0.5f : 0.0f) }; if (move_type == EMoveType::Extrude) // push down extrusion vertices by half height to render them at the right z position[2] -= 0.5f * v.height; @@ -1060,6 +1135,7 @@ void ViewerImpl::load(GCodeInputData&& gcode_data) m_settings.spiral_vase_mode = gcode_data.spiral_vase_mode; + m_extrusions_box = get_bounding_box({ EMoveType::Extrude }); for (size_t i = 0; i < m_vertices.size(); ++i) { const PathVertex& v = m_vertices[i]; @@ -1217,8 +1293,8 @@ void ViewerImpl::load(GCodeInputData&& gcode_data) update_view_full_range(); m_view_range.set_visible(m_view_range.get_enabled()); - update_enabled_entities(); update_colors(); + update_enabled_entities(); } void ViewerImpl::update_enabled_entities() @@ -1277,10 +1353,20 @@ void ViewerImpl::update_enabled_entities() enabled_segments.push_back(static_cast(i)); } + // ORCA: so that each pass of render() draws only its own segments, in print order + m_enabled_translucent_segments_count = 0; #ifdef ENABLE_OPENGL_ES - m_texture_data.set_enabled_segments(enabled_segments); + m_texture_data.set_enabled_segments(enabled_segments, m_vertices_colors, m_has_translucent_colors); + for (size_t i = 0; i < m_texture_data.get_count(); ++i) + m_enabled_translucent_segments_count += m_texture_data.get_enabled_translucent_segments_count(i); m_texture_data.set_enabled_options(enabled_options); #else + if (m_has_translucent_colors) { + const auto is_opaque = [this](uint32_t id) { return m_vertices_colors[id][3] == 255; }; + const auto translucent_begin = std::stable_partition(enabled_segments.begin(), enabled_segments.end(), is_opaque); + m_enabled_translucent_segments_count = static_cast(std::distance(translucent_begin, enabled_segments.end())); + } + m_enabled_segments_count = enabled_segments.size(); m_enabled_options_count = enabled_options.size(); @@ -1309,14 +1395,6 @@ void ViewerImpl::update_enabled_entities() m_settings.update_enabled_entities = false; } -static float encode_color(const Color& color) { - const int r = static_cast(color[0]); - const int g = static_cast(color[1]); - const int b = static_cast(color[2]); - const int i_color = r << 16 | g << 8 | b; - return static_cast(i_color); -} - void ViewerImpl::update_colors_texture() { #if !defined(ENABLE_OPENGL_ES) @@ -1331,11 +1409,11 @@ void ViewerImpl::update_colors_texture() // update gpu buffer for colors m_texture_data.set_colors(m_vertices_colors); #else - m_colors_tex_size = m_vertices_colors.size() * sizeof(float); + m_colors_tex_size = m_vertices_colors.size() * sizeof(ColorWithAlpha); // update gpu buffer for colors glsafe(glBindBuffer(GL_TEXTURE_BUFFER, m_colors_buf_id)); - glsafe(glBufferData(GL_TEXTURE_BUFFER, m_vertices_colors.size() * sizeof(float), m_vertices_colors.data(), GL_STATIC_DRAW)); + glsafe(glBufferData(GL_TEXTURE_BUFFER, m_colors_tex_size, m_vertices_colors.data(), GL_STATIC_DRAW)); glsafe(glBindBuffer(GL_TEXTURE_BUFFER, 0)); #endif // ENABLE_OPENGL_ES } @@ -1387,7 +1465,7 @@ void ViewerImpl::update_colors() const size_t tool_colors_size = m_tool_colors.size(); if (m_tool_colors.size() < max_used_extruder_id) { for (size_t i = 0; i < max_used_extruder_id - tool_colors_size; ++i) { - m_tool_colors.emplace_back(DUMMY_COLOR); + m_tool_colors.push_back({ DUMMY_COLOR[0], DUMMY_COLOR[1], DUMMY_COLOR[2], 255 }); } } } @@ -1398,11 +1476,21 @@ void ViewerImpl::update_colors() // If some part of the preview should be rendered in dark grey, it is taken // care of in the shaders, see set_layer_colors(). That is to avoid the need to recalculate // the "normal" color on every slider move. - for (size_t i = 0; i < m_vertices.size(); ++i) - m_vertices_colors[i] = encode_color(get_vertex_color(m_vertices[i])); - + const bool had_translucent_colors = m_has_translucent_colors; + m_has_translucent_colors = false; + for (size_t i = 0; i < m_vertices.size(); ++i) { + const Color color = get_vertex_color(m_vertices[i]); + const uint8_t alpha = get_vertex_alpha(m_vertices[i]); + m_vertices_colors[i] = { color[0], color[1], color[2], alpha }; + m_has_translucent_colors |= alpha < 255; + } + update_colors_texture(); m_settings.update_colors = false; + + // ORCA: the enabled segments are sorted by opacity + if (had_translucent_colors || m_has_translucent_colors) + m_settings.update_enabled_entities = true; } void ViewerImpl::apply_pending_updates() @@ -1410,11 +1498,12 @@ void ViewerImpl::apply_pending_updates() if (m_settings.update_view_full_range) update_view_full_range(); - if (m_settings.update_enabled_entities) - update_enabled_entities(); - + // ORCA: the colors first, which decide the order of the enabled segments if (m_settings.update_colors) update_colors(); + + if (m_settings.update_enabled_entities) + update_enabled_entities(); } void ViewerImpl::render(const Mat4x4& view_matrix, const Mat4x4& projection_matrix) @@ -1501,6 +1590,14 @@ void ViewerImpl::set_dim_previous_layers(bool value) m_settings.dim_previous_layers = value; } +void ViewerImpl::set_translucent_filaments(bool value) +{ + if (m_settings.translucent_filaments == value) + return; + m_settings.translucent_filaments = value; + m_settings.update_colors = true; +} + // ORCA: set how bright the darkened layers are rendered, 1.0 = unchanged, 0.0 = black void ViewerImpl::set_dim_previous_layers_brightness(float value) { @@ -1708,13 +1805,16 @@ Color ViewerImpl::get_vertex_color(const PathVertex& v) const case EViewType::Tool: { assert(static_cast(v.extruder_id) < m_tool_colors.size()); - return m_tool_colors[v.extruder_id]; + const ColorWithAlpha& color = m_tool_colors[v.extruder_id]; + return { color[0], color[1], color[2] }; } case EViewType::Summary: // ORCA case EViewType::ColorPrint: { - return m_layers.layer_contains_colorprint_options(static_cast(v.layer_id)) ? DUMMY_COLOR : - m_color_print_colors[static_cast(v.color_id) % m_color_print_colors.size()]; + if (m_layers.layer_contains_colorprint_options(static_cast(v.layer_id))) + return DUMMY_COLOR; + const ColorWithAlpha& color = m_color_print_colors[static_cast(v.color_id) % m_color_print_colors.size()]; + return { color[0], color[1], color[2] }; } default: { break; } } @@ -1722,13 +1822,32 @@ Color ViewerImpl::get_vertex_color(const PathVertex& v) const return DUMMY_COLOR; } -void ViewerImpl::set_tool_colors(const Palette& colors) +// ORCA: only the extrusions colored by filament can be translucent. +uint8_t ViewerImpl::get_vertex_alpha(const PathVertex& v) const +{ + if (!m_settings.translucent_filaments || !v.is_extrusion()) + return 255; + + switch (m_settings.view_type) + { + case EViewType::Tool: + return m_tool_colors[v.extruder_id][3]; + case EViewType::Summary: + case EViewType::ColorPrint: + return m_layers.layer_contains_colorprint_options(static_cast(v.layer_id)) ? 255 : + m_color_print_colors[static_cast(v.color_id) % m_color_print_colors.size()][3]; + default: + return 255; + } +} + +void ViewerImpl::set_tool_colors(const PaletteWithAlpha& colors) { m_tool_colors = colors; m_settings.update_colors = true; } -void ViewerImpl::set_color_print_colors(const Palette& colors) +void ViewerImpl::set_color_print_colors(const PaletteWithAlpha& colors) { m_color_print_colors = colors; m_settings.update_colors = true; @@ -1836,7 +1955,7 @@ size_t ViewerImpl::get_used_cpu_memory() const ret += sizeof(m_extrusion_roles_colors); ret += sizeof(m_options_colors); ret += STDVEC_MEMSIZE(m_vertices, PathVertex); - ret += STDVEC_MEMSIZE(m_vertices_colors, float); + ret += STDVEC_MEMSIZE(m_vertices_colors, ColorWithAlpha); for (const std::vector& times : m_layer_start_times) ret += STDVEC_MEMSIZE(times, float); ret += STDVEC_MEMSIZE(m_layer_first_vertex, uint32_t); @@ -1858,8 +1977,8 @@ size_t ViewerImpl::get_used_cpu_memory() const for (size_t i = 0; i < COLOR_RANGE_TYPES_COUNT; ++i) { ret += m_layer_time_range[i].size_in_bytes_cpu(); } - ret += STDVEC_MEMSIZE(m_tool_colors, Color); - ret += STDVEC_MEMSIZE(m_color_print_colors, Color); + ret += STDVEC_MEMSIZE(m_tool_colors, ColorWithAlpha); + ret += STDVEC_MEMSIZE(m_color_print_colors, ColorWithAlpha); return ret; } @@ -1880,6 +1999,7 @@ size_t ViewerImpl::get_used_gpu_memory() const ret += m_colors_tex_size; ret += m_enabled_segments_tex_size; ret += m_enabled_options_tex_size; + ret += m_translucent_targets.size_in_bytes(); #endif // ENABLE_OPENGL_ES return ret; } @@ -2095,11 +2215,18 @@ void ViewerImpl::update_heights_widths() #endif // ENABLE_OPENGL_ES } -void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& camera_position) +void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& camera_position, bool translucent) { - // ORCA: realistic view. The shadow caster pass draws depth only. + // ORCA: realistic view. The shadow caster pass draws depth only, as does the first order independent pass. +#ifndef ENABLE_OPENGL_ES + const bool depth_only = m_translucent_pass == 1; + const unsigned int shader_id = m_rendering_shadow_casters ? m_segments_caster_shader_id : depth_only ? m_segments_depth_shader_id : m_segments_shader_id; + const SegmentsUniforms& uni = m_rendering_shadow_casters ? m_uni_segments_caster : depth_only ? m_uni_segments_depth : m_uni_segments; +#else + const bool depth_only = false; const unsigned int shader_id = m_rendering_shadow_casters ? m_segments_caster_shader_id : m_segments_shader_id; const SegmentsUniforms& uni = m_rendering_shadow_casters ? m_uni_segments_caster : m_uni_segments; +#endif // ENABLE_OPENGL_ES if (shader_id == 0) return; @@ -2127,10 +2254,15 @@ void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projec glsafe(glUniformMatrix4fv(uni.projection_matrix, 1, GL_FALSE, projection_matrix.data())); glsafe(glUniform3fv(uni.camera_position, 1, camera_position.data())); // ORCA: view_matrix(2,2) > 0 is looking down, where the last segments printed are the nearest. - const bool reverse_order = view_matrix[10] > 0.0f; + // Blending goes the other way, from the farthest. + const bool reverse_order = (view_matrix[10] > 0.0f) != translucent; glsafe(glUniform1i(uni.reverse_order, reverse_order ? 1 : 0)); glsafe(glUniform4fv(uni.clipping_plane, 1, m_clipping_plane.data())); - if (!m_rendering_shadow_casters) { +#ifndef ENABLE_OPENGL_ES + if (depth_only) + glsafe(glUniform1i(m_uni_segments_depth_opaque_depth_id, TRANSLUCENT_TEXTURE_UNIT)); +#endif // ENABLE_OPENGL_ES + if (!m_rendering_shadow_casters && !depth_only) { // ORCA: realistic view glsafe(glUniform1i(m_uni_segments_shadow_map_id, m_shadow_map_texture_unit)); glsafe(glUniformMatrix4fv(m_uni_segments_shadow_light_vp_id, 1, GL_FALSE, m_shadow_light_vp.data())); @@ -2139,13 +2271,51 @@ void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projec glsafe(glUniform1f(m_uni_segments_exposure_id, m_exposure)); glsafe(glUniform1f(m_uni_segments_saturation_id, m_saturation)); glsafe(glUniform3fv(m_uni_segments_light_top_dir_id, 1, m_light_top_dir.data())); + glsafe(glUniform1f(m_uni_segments_gloss_id, m_gloss ? 0.6f : 0.0f)); set_layer_colors(m_uni_segments_layer_colors); +#ifndef ENABLE_OPENGL_ES + glsafe(glUniform1i(m_uni_segments_oit_pass_id, m_translucent_pass)); + glsafe(glUniform1i(m_uni_segments_opaque_depth_id, TRANSLUCENT_TEXTURE_UNIT)); + glsafe(glUniform1i(m_uni_segments_front_depth_id, TRANSLUCENT_TEXTURE_UNIT + 1)); + glsafe(glUniform2fv(m_uni_segments_oit_depth_range_id, 1, m_oit_depth_range.data())); +#endif // ENABLE_OPENGL_ES + } + + // ORCA: the translucent segments neither hide each other nor what is drawn after them. Drawn late in the + // frame, they cannot count on the depth test the toolpaths left on, which hides them behind opaque ones. + const bool curr_blend = glIsEnabled(GL_BLEND); + const bool curr_depth_test = glIsEnabled(GL_DEPTH_TEST); + std::array curr_blend_func = { 0, 0, 0, 0 }; + std::array curr_blend_equation = { 0, 0 }; + GLboolean curr_depth_mask = GL_TRUE; + if (translucent) { + glsafe(glEnable(GL_DEPTH_TEST)); + glsafe(glGetIntegerv(GL_BLEND_SRC_RGB, &curr_blend_func[0])); + glsafe(glGetIntegerv(GL_BLEND_DST_RGB, &curr_blend_func[1])); + glsafe(glGetIntegerv(GL_BLEND_SRC_ALPHA, &curr_blend_func[2])); + glsafe(glGetIntegerv(GL_BLEND_DST_ALPHA, &curr_blend_func[3])); + glsafe(glGetIntegerv(GL_BLEND_EQUATION_RGB, &curr_blend_equation[0])); + glsafe(glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &curr_blend_equation[1])); + glsafe(glGetBooleanv(GL_DEPTH_WRITEMASK, &curr_depth_mask)); + glsafe(glEnable(GL_BLEND)); + // premultiplied, the highlights are not scaled by the opacity; the nearest depth, then sums, + // in the passes of render_translucent_segments() + glsafe(glBlendEquation(m_translucent_pass == 1 ? GL_MIN : GL_FUNC_ADD)); + glsafe(glBlendFunc(GL_ONE, m_translucent_pass != 0 ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA)); + glsafe(glDepthMask(GL_FALSE)); } glsafe(glDisable(GL_CULL_FACE)); - auto draw = [this, &uni](size_t count) { + // ORCA: of the count enabled segments, the last translucent_count are the translucent ones + auto draw = [this, &uni, translucent](size_t count, size_t translucent_count) { + const size_t first = translucent ? count - translucent_count : 0; + if (!m_rendering_shadow_casters) + count = translucent ? translucent_count : count - translucent_count; + if (count == 0) + return; glsafe(glUniform1i(uni.instances_count, static_cast(count))); + glsafe(glUniform1i(uni.first_instance, static_cast(first))); if (!m_rendering_shadow_casters) { m_segment_template.render(count); return; @@ -2176,7 +2346,7 @@ void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projec glsafe(glBindTexture(GL_TEXTURE_2D, m_texture_data.get_colors_tex_id(i).first)); glsafe(glActiveTexture(GL_TEXTURE3)); glsafe(glBindTexture(GL_TEXTURE_2D, id)); - draw(count); + draw(count, m_texture_data.get_enabled_translucent_segments_count(i)); } #else std::array curr_bound_texture = { 0, 0, 0, 0 }; @@ -2194,16 +2364,25 @@ void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projec glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, m_heights_widths_angles_buf_id)); glsafe(glActiveTexture(GL_TEXTURE2)); glsafe(glBindTexture(GL_TEXTURE_BUFFER, m_colors_tex_id)); - glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_R32F, m_colors_buf_id)); + glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA8, m_colors_buf_id)); glsafe(glActiveTexture(GL_TEXTURE3)); glsafe(glBindTexture(GL_TEXTURE_BUFFER, m_enabled_segments_tex_id)); glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_R32UI, m_enabled_segments_buf_id)); - draw(m_enabled_segments_count); + draw(m_enabled_segments_count, m_enabled_translucent_segments_count); #endif // ENABLE_OPENGL_ES if (curr_cull_face) glsafe(glEnable(GL_CULL_FACE)); + if (translucent) { + if (!curr_depth_test) + glsafe(glDisable(GL_DEPTH_TEST)); + glsafe(glDepthMask(curr_depth_mask)); + glsafe(glBlendEquationSeparate(curr_blend_equation[0], curr_blend_equation[1])); + glsafe(glBlendFuncSeparate(curr_blend_func[0], curr_blend_func[1], curr_blend_func[2], curr_blend_func[3])); + if (!curr_blend) + glsafe(glDisable(GL_BLEND)); + } glsafe(glUseProgram(curr_shader)); #ifdef ENABLE_OPENGL_ES @@ -2283,7 +2462,7 @@ void ViewerImpl::render_options(const Mat4x4& view_matrix, const Mat4x4& project glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, m_heights_widths_angles_buf_id)); glsafe(glActiveTexture(GL_TEXTURE2)); glsafe(glBindTexture(GL_TEXTURE_BUFFER, m_colors_tex_id)); - glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_R32F, m_colors_buf_id)); + glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA8, m_colors_buf_id)); glsafe(glActiveTexture(GL_TEXTURE3)); glsafe(glBindTexture(GL_TEXTURE_BUFFER, m_enabled_options_tex_id)); glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_R32UI, m_enabled_options_buf_id)); @@ -2306,6 +2485,217 @@ void ViewerImpl::render_options(const Mat4x4& view_matrix, const Mat4x4& project glsafe(glActiveTexture(curr_active_texture)); } +#ifndef ENABLE_OPENGL_ES +bool ViewerImpl::TranslucentTargets::update(int width, int height) +{ + if (unsupported || width <= 0 || height <= 0) + return false; + if (fbo != 0 && size[0] == width && size[1] == height) + return true; + + release(); + size = { width, height }; + + int curr_texture = 0; + int curr_draw_fbo = 0; + int curr_read_fbo = 0; + glsafe(glGetIntegerv(GL_TEXTURE_BINDING_2D, &curr_texture)); + glsafe(glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &curr_draw_fbo)); + glsafe(glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &curr_read_fbo)); + + auto make_texture = [width, height](unsigned int& id, GLenum internal_format, GLenum format, GLenum type) { + glsafe(glGenTextures(1, &id)); + glsafe(glBindTexture(GL_TEXTURE_2D, id)); + glsafe(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); + glsafe(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); + glsafe(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); + glsafe(glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, type, nullptr)); + }; + const GLenum buffers[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 }; + + make_texture(depth_tex, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT); + make_texture(accum_tex, GL_RGBA16F, GL_RGBA, GL_FLOAT); + make_texture(reveal_tex, GL_R16F, GL_RED, GL_FLOAT); + make_texture(front_tex, GL_RGBA16F, GL_RGBA, GL_FLOAT); + make_texture(front_depth_tex, GL_R32F, GL_RED, GL_FLOAT); + glsafe(glGenFramebuffers(1, &front_depth_fbo)); + glsafe(glBindFramebuffer(GL_FRAMEBUFFER, front_depth_fbo)); + glsafe(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, front_depth_tex, 0)); + glsafe(glDrawBuffers(1, buffers)); + bool complete = glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; + glsafe(glGenFramebuffers(1, &fbo)); + glsafe(glBindFramebuffer(GL_FRAMEBUFFER, fbo)); + glsafe(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, accum_tex, 0)); + glsafe(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, reveal_tex, 0)); + glsafe(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, front_tex, 0)); + glsafe(glDrawBuffers(3, buffers)); + complete = complete && glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; + + glsafe(glBindTexture(GL_TEXTURE_2D, curr_texture)); + glsafe(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, curr_draw_fbo)); + glsafe(glBindFramebuffer(GL_READ_FRAMEBUFFER, curr_read_fbo)); + + if (!complete) { + release(); + unsupported = true; + } + return complete; +} + +void ViewerImpl::TranslucentTargets::release() +{ + for (unsigned int* id : { &fbo, &front_depth_fbo }) { + if (*id != 0) { + glsafe(glDeleteFramebuffers(1, id)); + *id = 0; + } + } + delete_textures(accum_tex); + delete_textures(reveal_tex); + delete_textures(front_tex); + delete_textures(depth_tex); + delete_textures(front_depth_tex); + size = { 0, 0 }; +} + +size_t ViewerImpl::TranslucentTargets::size_in_bytes() const +{ + // RGBA16F, R16F, RGBA16F, a 24 bit depth and R32F + return static_cast(size[0]) * static_cast(size[1]) * (8 + 2 + 8 + 4 + 4); +} +#endif // ENABLE_OPENGL_ES + +void ViewerImpl::render_translucent(const Mat4x4& view_matrix, const Mat4x4& projection_matrix) +{ + apply_pending_updates(); + if (m_enabled_translucent_segments_count == 0) + return; + + const Mat4x4 inv_view_matrix = inverse(view_matrix); + render_translucent_segments(view_matrix, projection_matrix, { inv_view_matrix[12], inv_view_matrix[13], inv_view_matrix[14] }); +} + +void ViewerImpl::render_translucent_segments(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& camera_position) +{ +#ifndef ENABLE_OPENGL_ES + // ORCA: the order independent path, whose targets are as large as the canvas: the nearest translucent surface + // over the weighted blended order independent transparency (McGuire and Bavoil, 2013) of the others. Blended in + // print order, even one color shows the order, its surfaces being shaded apart. + std::array viewport = { 0, 0, 0, 0 }; + int draw_fbo = 0; + int read_fbo = 0; + int samples = 0; + glsafe(glGetIntegerv(GL_VIEWPORT, viewport.data())); + glsafe(glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_fbo)); + glsafe(glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &read_fbo)); + glsafe(glGetIntegerv(GL_SAMPLES, &samples)); + // the depth of a multisampled framebuffer object cannot be copied into a texture + if ((read_fbo != 0 && samples > 0) || !m_translucent_targets.update(viewport[2], viewport[3])) { + render_segments(view_matrix, projection_matrix, camera_position, true); + return; + } + const TranslucentTargets& targets = m_translucent_targets; + const int width = viewport[2]; + const int height = viewport[3]; + + int curr_active_texture = 0; + std::array curr_textures = { 0, 0, 0 }; + glsafe(glGetIntegerv(GL_ACTIVE_TEXTURE, &curr_active_texture)); + for (int i = 0; i < 3; ++i) { + glsafe(glActiveTexture(GL_TEXTURE0 + TRANSLUCENT_TEXTURE_UNIT + i)); + glsafe(glGetIntegerv(GL_TEXTURE_BINDING_2D, &curr_textures[i])); + } + + // the opaque scene, to hide the translucent segments behind it + glsafe(glActiveTexture(GL_TEXTURE0 + TRANSLUCENT_TEXTURE_UNIT)); + glsafe(glBindTexture(GL_TEXTURE_2D, targets.depth_tex)); + glsafe(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, viewport[0], viewport[1], width, height)); + + // the weights fall with the depth across the extrusions + float near_z = FLT_MAX; + float far_z = -FLT_MAX; + for (int i = 0; i < 8; ++i) { + const Vec3 p = { m_extrusions_box[i & 1][0], m_extrusions_box[(i >> 1) & 1][1], m_extrusions_box[(i >> 2) & 1][2] }; + const float z = -(view_matrix[2] * p[0] + view_matrix[6] * p[1] + view_matrix[10] * p[2] + view_matrix[14]); + near_z = std::min(near_z, z); + far_z = std::max(far_z, z); + } + m_oit_depth_range = { near_z, std::max(far_z, near_z + 1.0f) }; + + // the depth of the nearest translucent surface, as the fragments see it, kept by GL_MIN + const std::array zero = { 0.0f, 0.0f, 0.0f, 0.0f }; + const std::array one = { 1.0f, 1.0f, 1.0f, 1.0f }; + glsafe(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, targets.front_depth_fbo)); + glsafe(glViewport(0, 0, width, height)); + glsafe(glClearBufferfv(GL_COLOR, 0, one.data())); + m_translucent_pass = 1; + render_segments(view_matrix, projection_matrix, camera_position, true); + glsafe(glActiveTexture(GL_TEXTURE0 + TRANSLUCENT_TEXTURE_UNIT + 1)); + glsafe(glBindTexture(GL_TEXTURE_2D, targets.front_depth_tex)); + + // that surface apart, the others summed + glsafe(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, targets.fbo)); + for (int i = 0; i < 3; ++i) + glsafe(glClearBufferfv(GL_COLOR, i, zero.data())); + m_translucent_pass = 2; + render_segments(view_matrix, projection_matrix, camera_position, true); + m_translucent_pass = 0; + + glsafe(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, draw_fbo)); + glsafe(glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo)); + glsafe(glViewport(viewport[0], viewport[1], width, height)); + + // composite over the scene + int curr_shader = 0; + int curr_vertex_array = 0; + std::array curr_blend_func = { 0, 0, 0, 0 }; + GLboolean curr_depth_mask = GL_TRUE; + const bool curr_blend = glIsEnabled(GL_BLEND); + const bool curr_depth_test = glIsEnabled(GL_DEPTH_TEST); + glsafe(glGetIntegerv(GL_CURRENT_PROGRAM, &curr_shader)); + glsafe(glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &curr_vertex_array)); + glsafe(glGetIntegerv(GL_BLEND_SRC_RGB, &curr_blend_func[0])); + glsafe(glGetIntegerv(GL_BLEND_DST_RGB, &curr_blend_func[1])); + glsafe(glGetIntegerv(GL_BLEND_SRC_ALPHA, &curr_blend_func[2])); + glsafe(glGetIntegerv(GL_BLEND_DST_ALPHA, &curr_blend_func[3])); + glsafe(glGetBooleanv(GL_DEPTH_WRITEMASK, &curr_depth_mask)); + + glsafe(glUseProgram(m_translucent_composite_shader_id)); + glsafe(glUniform1i(m_uni_translucent_composite_accum_tex_id, TRANSLUCENT_TEXTURE_UNIT)); + glsafe(glUniform1i(m_uni_translucent_composite_reveal_tex_id, TRANSLUCENT_TEXTURE_UNIT + 1)); + glsafe(glUniform1i(m_uni_translucent_composite_front_tex_id, TRANSLUCENT_TEXTURE_UNIT + 2)); + glsafe(glUniform2i(m_uni_translucent_composite_origin_id, viewport[0], viewport[1])); + glsafe(glActiveTexture(GL_TEXTURE0 + TRANSLUCENT_TEXTURE_UNIT)); + glsafe(glBindTexture(GL_TEXTURE_2D, targets.accum_tex)); + glsafe(glActiveTexture(GL_TEXTURE0 + TRANSLUCENT_TEXTURE_UNIT + 1)); + glsafe(glBindTexture(GL_TEXTURE_2D, targets.reveal_tex)); + glsafe(glActiveTexture(GL_TEXTURE0 + TRANSLUCENT_TEXTURE_UNIT + 2)); + glsafe(glBindTexture(GL_TEXTURE_2D, targets.front_tex)); + glsafe(glEnable(GL_BLEND)); + glsafe(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); + glsafe(glDisable(GL_DEPTH_TEST)); + glsafe(glDepthMask(GL_FALSE)); + glsafe(glBindVertexArray(m_segments_caster_vao_id)); + glsafe(glDrawArrays(GL_TRIANGLES, 0, 3)); + + glsafe(glBindVertexArray(curr_vertex_array)); + glsafe(glDepthMask(curr_depth_mask)); + if (curr_depth_test) + glsafe(glEnable(GL_DEPTH_TEST)); + glsafe(glBlendFuncSeparate(curr_blend_func[0], curr_blend_func[1], curr_blend_func[2], curr_blend_func[3])); + if (!curr_blend) + glsafe(glDisable(GL_BLEND)); + glsafe(glUseProgram(curr_shader)); + for (int i = 0; i < 3; ++i) { + glsafe(glActiveTexture(GL_TEXTURE0 + TRANSLUCENT_TEXTURE_UNIT + i)); + glsafe(glBindTexture(GL_TEXTURE_2D, curr_textures[i])); + } + glsafe(glActiveTexture(curr_active_texture)); +#else + render_segments(view_matrix, projection_matrix, camera_position, true); +#endif // ENABLE_OPENGL_ES +} + #if VGCODE_ENABLE_COG_AND_TOOL_MARKERS void ViewerImpl::render_cog_marker(const Mat4x4& view_matrix, const Mat4x4& projection_matrix) { diff --git a/src/libvgcode/src/ViewerImpl.hpp b/src/libvgcode/src/ViewerImpl.hpp index 0877e6265b..d9394d7e21 100644 --- a/src/libvgcode/src/ViewerImpl.hpp +++ b/src/libvgcode/src/ViewerImpl.hpp @@ -77,6 +77,8 @@ public: // Render the toolpaths // void render(const Mat4x4& view_matrix, const Mat4x4& projection_matrix); + void render_translucent(const Mat4x4& view_matrix, const Mat4x4& projection_matrix); + bool has_translucent_toolpaths() const { return m_enabled_translucent_segments_count > 0; } // // ORCA: realistic view. Render the toolpaths as seen from the light, to fill the caller's // shadow map. Only depth matters here, so the caller masks colour writes; light_position @@ -98,6 +100,7 @@ public: // ORCA: section view, see Viewer::set_clipping_plane() void set_clipping_plane(const std::array& plane) { m_clipping_plane = plane; } void set_light_top_dir(const Vec3& direction) { m_light_top_dir = direction; } + void set_gloss(bool gloss) { m_gloss = gloss; } EViewType get_view_type() const { return m_settings.view_type; } void set_view_type(EViewType type); @@ -121,6 +124,10 @@ public: float get_dim_previous_layers_brightness() const { return m_settings.dim_previous_layers_brightness; } void set_dim_previous_layers_brightness(float value); + // ORCA: whether the filament colors keep their opacity, see get_vertex_alpha() + bool is_translucent_filaments() const { return m_settings.translucent_filaments; } + void set_translucent_filaments(bool value); + bool is_spiral_vase_mode() const { return m_settings.spiral_vase_mode; } std::vector get_time_modes() const; @@ -184,12 +191,12 @@ public: std::vector get_layers_estimated_times() const { return m_layers.get_times(m_settings.time_mode); } size_t get_tool_colors_count() const { return m_tool_colors.size(); } - const Palette& get_tool_colors() const { return m_tool_colors; } - void set_tool_colors(const Palette& colors); + const PaletteWithAlpha& get_tool_colors() const { return m_tool_colors; } + void set_tool_colors(const PaletteWithAlpha& colors); size_t get_color_print_colors_count() const { return m_color_print_colors.size(); } - const Palette& get_color_print_colors() const { return m_color_print_colors; } - void set_color_print_colors(const Palette& colors); + const PaletteWithAlpha& get_color_print_colors() const { return m_color_print_colors; } + void set_color_print_colors(const PaletteWithAlpha& colors); const Color& get_extrusion_role_color(EGCodeExtrusionRole role) const; void set_extrusion_role_color(EGCodeExtrusionRole role, const Color& color); @@ -324,7 +331,10 @@ private: std::vector m_vertices; // Cache for the colors to reduce the need to recalculate colors of all the vertices. - std::vector m_vertices_colors; + std::vector m_vertices_colors; + // ORCA: the enabled segments list the translucent ones last, see update_enabled_entities(). + bool m_has_translucent_colors{ false }; + size_t m_enabled_translucent_segments_count{ 0 }; // // Variables used for toolpaths visibiliity @@ -351,8 +361,8 @@ private: std::array m_layer_time_range{ ColorRange(EColorRangeType::Linear), ColorRange(EColorRangeType::Logarithmic) }; - Palette m_tool_colors; - Palette m_color_print_colors; + PaletteWithAlpha m_tool_colors; + PaletteWithAlpha m_color_print_colors; // // OpenGL shaders ids // @@ -380,6 +390,7 @@ private: int segment_index_tex{ -1 }; int reverse_order{ -1 }; int instances_count{ -1 }; + int first_instance{ -1 }; int clipping_plane{ -1 }; void init(unsigned int shader_id); @@ -393,6 +404,7 @@ private: int m_uni_segments_exposure_id{ -1 }; int m_uni_segments_saturation_id{ -1 }; int m_uni_segments_light_top_dir_id{ -1 }; + int m_uni_segments_gloss_id{ -1 }; // ORCA: the layers greyed or dimmed around the one the sliders show, in the segments and options shaders. struct LayerColorsUniforms { @@ -440,8 +452,9 @@ private: void init(size_t vertices_count); void set_positions(const std::vector& positions); void set_heights_widths_angles(const std::vector& heights_widths_angles); - void set_colors(const std::vector& colors); - void set_enabled_segments(const std::vector& enabled_segments); + void set_colors(const std::vector& colors); + // ORCA: sorted by opacity, each texture lists its opaque segments first, then its translucent ones. + void set_enabled_segments(const std::vector& enabled_segments, const std::vector& colors, bool sort_by_opacity); void set_enabled_options(const std::vector& enabled_options); void reset(); size_t get_count() const { return m_count; } @@ -449,6 +462,7 @@ private: std::pair get_heights_widths_angles_tex_id(size_t id) const; std::pair get_colors_tex_id(size_t id) const; std::pair get_enabled_segments_tex_id(size_t id) const; + size_t get_enabled_translucent_segments_count(size_t id) const { return m_tex_ids[id].enabled_translucent_segments; } std::pair get_enabled_options_tex_id(size_t id) const; size_t get_enabled_segments_count() const; @@ -497,6 +511,7 @@ private: // OpenGL texture to store enabled segments // std::pair enabled_segments{ 0, 0 }; + size_t enabled_translucent_segments{ 0 }; // // OpenGL texture to store enabled options // @@ -565,16 +580,68 @@ private: float m_saturation{ 1.0f }; // ORCA: the light the segments shader shades with, in eye space. Vec3 m_light_top_dir{ -0.4574957f, 0.4574957f, 0.7624929f }; + // ORCA: the untinted highlight of the filaments, see set_gloss() + bool m_gloss{ true }; // ORCA: section view std::array m_clipping_plane{ 0.0f, 0.0f, 0.0f, 1.0f }; + // ORCA: the depth range the weights of render_translucent_segments() span + AABox m_extrusions_box{ Vec3{ 0.0f, 0.0f, 0.0f }, Vec3{ 0.0f, 0.0f, 0.0f } }; +#ifndef ENABLE_OPENGL_ES + // + // ORCA: order independent transparency, see render_translucent_segments(). Single-sampled whatever + // the canvas, see the design doc. + // + struct TranslucentTargets + { + unsigned int fbo{ 0 }; + unsigned int accum_tex{ 0 }; + unsigned int reveal_tex{ 0 }; + // the nearest translucent surface, kept out of the weighted mean of the others + unsigned int front_tex{ 0 }; + // the depth of the opaque scene, which hides the translucent segments behind it + unsigned int depth_tex{ 0 }; + // the depth of the nearest translucent surface, in front_depth_fbo + unsigned int front_depth_tex{ 0 }; + unsigned int front_depth_fbo{ 0 }; + std::array size{ 0, 0 }; + bool unsupported{ false }; + + // false when the targets cannot be made + bool update(int width, int height); + void release(); + size_t size_in_bytes() const; + }; + TranslucentTargets m_translucent_targets; + unsigned int m_translucent_composite_shader_id{ 0 }; + int m_uni_translucent_composite_accum_tex_id{ -1 }; + int m_uni_translucent_composite_reveal_tex_id{ -1 }; + int m_uni_translucent_composite_front_tex_id{ -1 }; + int m_uni_translucent_composite_origin_id{ -1 }; + int m_uni_segments_oit_pass_id{ -1 }; + int m_uni_segments_opaque_depth_id{ -1 }; + int m_uni_segments_front_depth_id{ -1 }; + int m_uni_segments_oit_depth_range_id{ -1 }; + // the segments shaders built with DEPTH_ONLY, drawing the depth of the nearest translucent surface + unsigned int m_segments_depth_shader_id{ 0 }; + SegmentsUniforms m_uni_segments_depth; + int m_uni_segments_depth_opaque_depth_id{ -1 }; + std::array m_oit_depth_range{ 0.0f, 1.0f }; +#endif // ENABLE_OPENGL_ES + // the pass of render_translucent_segments() render_segments() draws: 1 the depth of the nearest + // translucent surface, 2 the accumulation, 0 neither + int m_translucent_pass{ 0 }; + void apply_pending_updates(); void update_view_full_range(); void update_color_ranges(); void update_heights_widths(); - void render_segments(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& camera_position); + uint8_t get_vertex_alpha(const PathVertex& v) const; + // ORCA: translucent draws the segments whose color is translucent, otherwise the opaque ones, or all of them for the shadow casters. + void render_segments(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& camera_position, bool translucent = false); void render_options(const Mat4x4& view_matrix, const Mat4x4& projection_matrix); + void render_translucent_segments(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& camera_position); // ORCA: the program using uni must be current. void set_layer_colors(const LayerColorsUniforms& uni) const; #if VGCODE_ENABLE_COG_AND_TOOL_MARKERS diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index 367aadaa27..71fa481732 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -890,6 +890,8 @@ if (APPLE) GUI/DeepLinkHandlerMac.mm GUI/DeepLinkHandlerMac.h GUI/GUI_UtilsMac.mm + GUI/MacIME.mm + GUI/MacIME.hpp ) FIND_LIBRARY(DISKARBITRATION_LIBRARY DiskArbitration) endif () diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index acd2e4f41c..7dad07c9f7 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -58,6 +58,8 @@ #include #include +#include + #include #include @@ -109,14 +111,15 @@ static constexpr int OUTLINE_DEPTH_TEX_UNIT = 5; Slic3r::ColorRGBA adjust_color_for_rendering(const Slic3r::ColorRGBA &colors) { - if (colors.a() < FullyTransparentMaterialThreshold) { // completely transparent - return {1, 1, 1, FullTransparentModdifiedToFixAlpha}; + // a clear color keeps its hue, at the least opacity that still shows it + const float alpha = std::max(colors.a(), FullyTransparentMaterialThreshold); + if (colors.r() < FULL_BLACK_THRESHOLD && colors.g() < FULL_BLACK_THRESHOLD && colors.b() < FULL_BLACK_THRESHOLD) { + // black, lifted so that the shading shows, the more the more translucent: a dark translucent + // surface shows nothing through itself + const float grey = FULL_BLACK_THRESHOLD + 0.3f * (1.0f - alpha); + return {grey, grey, grey, alpha}; } - else if(colors.r() < FULL_BLACK_THRESHOLD && colors.g() < FULL_BLACK_THRESHOLD && colors.b() < FULL_BLACK_THRESHOLD) { // black - return {FULL_BLACK_THRESHOLD, FULL_BLACK_THRESHOLD, FULL_BLACK_THRESHOLD, colors.a()}; - } - else - return colors; + return {colors.r(), colors.g(), colors.b(), alpha}; } namespace Slic3r { @@ -700,7 +703,7 @@ void GLVolume::render_with_outline(const GUI::Size& cnv_size) } //BBS add render for simple case -void GLVolume::simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_objects, std::vector& extruder_colors, bool ban_light) +void GLVolume::simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_objects, std::vector& extruder_colors, bool ban_light, bool ban_color_volume) { if (this->is_left_handed()) glFrontFace(GL_CW); @@ -734,7 +737,7 @@ void GLVolume::simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_obj } } while (0); - if (color_volume && !picking) { + if (color_volume && !picking && !ban_color_volume) { const bool brighten_selected = selected && !disabled && !force_native_color && !force_neutral_color; // when force_transparent, we need to keep the alpha @@ -1236,6 +1239,9 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, // The outline passes below are driven by is_outline, which only the object shaders have; with an // overlay one (wireframe, x-ray) bound they would just draw the volume again. const bool shader_can_outline = shader->get_uniform_location("is_outline") >= 0; + // ORCA: the object shaders that know how draw a part of a translucent filament as its print would + // show, in premultiplied color, see translucent_filament_color() in gouraud.fs + const bool shade_translucent_filaments = type == ERenderType::Transparent && shader->get_uniform_location("translucent_filament") >= 0; // Prime depth_tex on every frame so non-outline draws do not keep the // default sampler unit 0, which can conflict with other sampler types. @@ -1341,6 +1347,11 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, shader->set_uniform("projection_matrix", projection_matrix); const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose(); shader->set_uniform("view_normal_matrix", view_normal_matrix); + if (shade_translucent_filaments) { + const bool translucent_filament = volume.first->visible && !volume.first->is_modifier && volume.first->color.is_transparent(); + shader->set_uniform("translucent_filament", translucent_filament); + glsafe(::glBlendFunc(translucent_filament ? GL_ONE : GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + } if (volume.first->depth_bias) { glsafe(::glEnable(GL_POLYGON_OFFSET_FILL)); glsafe(::glPolygonOffset(1.0f, 1.0f)); @@ -1383,6 +1394,11 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, if (disable_cullface) glsafe(::glEnable(GL_CULL_FACE)); + if (shade_translucent_filaments) { + // the program is shared, so leave it as the other users expect + shader->set_uniform("translucent_filament", false); + glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + } if (type == ERenderType::Transparent) glsafe(::glDisable(GL_BLEND)); } @@ -1454,10 +1470,31 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo BuildVolume plate_build_volume(pp_bed_shape, build_volume.printable_height(), build_volume.extruder_areas(), build_volume.extruder_heights()); const std::vector& exclude_areas = curr_plate->get_exclude_areas(); + const DynamicPrintConfig *plater_config = GUI::wxGetApp().plater()->config(); + std::vector> exclusion_regions; + // Legacy bed-exclude areas retain Orca's existing 2D presentation. The + // per-extruder 3D state is needed only after collision volumes are enabled. + if (has_bed_exclude_volumes(*plater_config)) { + exclusion_regions = get_bed_excluded_regions_by_extruder(*plater_config); + // The native BuildVolume path below already presents the shared legacy + // area. Merge only opt-in collision volumes into nozzle-specific state. + for (std::vector ®ions : exclusion_regions) + regions.erase(std::remove_if(regions.begin(), regions.end(), + [](const BedExcludeRegion ®ion) { return !region.is_collision_volume(); }), regions.end()); + } + const Vec3d plate_origin = curr_plate->get_origin(); + const Point exclusion_offset(scale_(plate_origin.x()), scale_(plate_origin.y())); + for (std::vector ®ions : exclusion_regions) + for (BedExcludeRegion ®ion : regions) + region.polygon.translate(exclusion_offset); + std::map>> objects_unprintable_filaments; - int extruder_count = build_volume.get_extruder_area_count(); + const DynamicPrintConfig &plate_project_config = GUI::wxGetApp().preset_bundle->project_config; + const int build_volume_extruder_count = build_volume.get_extruder_area_count(); + const int extruder_count = std::max(build_volume_extruder_count, int(exclusion_regions.size())); std::vector> unprintable_filament_ids(extruder_count, std::set()); std::set partly_objects_set; + std::map, std::vector> instance_inside_exclusion_regions; const ModelObjectPtrs &model_objects = model.objects; for (GLVolume* volume : this->volumes) { @@ -1472,7 +1509,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo //FIXME this test does not evaluate collision of a build volume bounding box with non-convex objects. const BoundingBoxf3& bb = volume_bbox(*volume); state = plate_build_volume.volume_state_bbox(bb); - if ((state == BuildVolume::ObjectState::Inside) && (extruder_count > 1)) + if ((state == BuildVolume::ObjectState::Inside) && (build_volume_extruder_count > 1)) { state = plate_build_volume.check_volume_bbox_state_with_extruder_areas(bb, inside_extruders); } @@ -1486,7 +1523,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo const indexed_triangle_set& convex_mesh_it = volume_convex_mesh(*volume).its; const Transform3f trafo = volume->world_matrix().cast(); state = plate_build_volume.object_state(convex_mesh_it, trafo, volume_sinking(*volume)); - if ((state == BuildVolume::ObjectState::Inside) && (extruder_count > 1)) + if ((state == BuildVolume::ObjectState::Inside) && (build_volume_extruder_count > 1)) { state = plate_build_volume.check_object_state_with_extruder_areas(convex_mesh_it, trafo, inside_extruders); } @@ -1499,12 +1536,52 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo } assert(state != BuildVolume::ObjectState::Below); + // Preserve Orca's native printable-area result separately. + // Exclusion collisions have current-map semantics and must not + // leak into the later "unprintable on every possible nozzle" + // aggregation used by automatic printable-area assignment. + const std::vector printable_area_inside_extruders = inside_extruders; + + // Newer Orca resolves live multi-nozzle placement through this + // per-extruder state vector. Merge exclusion-volume collisions + // into the same source of truth instead of relying only on the + // legacy PartPlate::check_outside() path. + if ((state == BuildVolume::ObjectState::Inside || state == BuildVolume::ObjectState::Limited) && + volume->object_idx() >= 0 && volume->object_idx() < int(model_objects.size()) && + volume->instance_idx() >= 0 && + volume->instance_idx() < int(model_objects[volume->object_idx()]->instances.size())) { + inside_extruders.resize(extruder_count, true); + + const std::pair instance_key{ volume->object_idx(), volume->instance_idx() }; + auto [cache_it, inserted] = instance_inside_exclusion_regions.emplace( + instance_key, std::vector(extruder_count, true)); + if (inserted) { + const ModelInstance *instance = model_objects[volume->object_idx()]->instances[volume->instance_idx()]; + for (size_t extruder_id = 0; extruder_id < exclusion_regions.size(); ++extruder_id) { + if (instance->intersects_bed_exclude_regions(exclusion_regions[extruder_id])) + cache_it->second[extruder_id] = false; + } + } + + bool exclusion_limited = false; + for (size_t extruder_id = 0; extruder_id < cache_it->second.size(); ++extruder_id) { + if (!cache_it->second[extruder_id]) { + inside_extruders[extruder_id] = false; + exclusion_limited = true; + } + } + + if (exclusion_limited && state == BuildVolume::ObjectState::Inside) + state = extruder_count > 1 ? BuildVolume::ObjectState::Limited : BuildVolume::ObjectState::Colliding; + + } + if (state == BuildVolume::ObjectState::Limited) { //unprintable_filament_ids.resize(inside_extruders.size()); ModelObject *model_object = model_objects[volume->object_idx()]; ModelVolume *model_volume = model_object->volumes[volume->volume_idx()]; - for (size_t i = 0; i < inside_extruders.size(); ++i) { - if (!inside_extruders[i]) { + for (size_t i = 0; i < printable_area_inside_extruders.size(); ++i) { + if (!printable_area_inside_extruders[i]) { std::vector filaments = model_volume->get_extruders(); unprintable_filament_ids[i].insert(filaments.begin(), filaments.end()); if (object_results) { @@ -1579,8 +1656,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo //check per-object error for extruder areas if (object_results && (extruder_count > 1)) { - const auto& project_config = Slic3r::GUI::wxGetApp().preset_bundle->project_config; - object_results->mode = curr_plate->get_real_filament_map_mode(project_config); + object_results->mode = curr_plate->get_real_filament_map_mode(plate_project_config); if (object_results->mode < FilamentMapMode::fmmManual) { std::vector conflict_filament_vector; @@ -1642,8 +1718,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo else { std::set conflict_filaments_set; - const auto& project_config = Slic3r::GUI::wxGetApp().preset_bundle->project_config; - std::vector filament_maps = curr_plate->get_real_filament_maps(project_config); + std::vector filament_maps = curr_plate->get_real_filament_maps(plate_project_config); for (auto& object_map: objects_unprintable_filaments) { ModelObject *model_object = object_map.first; @@ -1658,7 +1733,8 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo for (int filament: filaments_set) { - if (filament_maps[filament - 1] == extruder_id) + if (filament > 0 && size_t(filament) <= filament_maps.size() && + filament_maps[filament - 1] == extruder_id) { object_filament_info.manual_filaments.emplace(filament, extruder_id); object_results->filament_maps[filament] = extruder_id; @@ -1675,6 +1751,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo object_results->filaments = std::vector(conflict_filaments_set.begin(), conflict_filaments_set.end()); } } + } /*for (GLVolume* volume : this->volumes) diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 7a19b20a24..ac31946c80 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -69,7 +69,7 @@ enum ModelInstanceEPrintVolumeState : unsigned char; using ModelObjectPtrs = std::vector; struct ObjectFilamentInfo { - ModelObject* object; + ModelObject* object { nullptr }; std::map manual_filaments; //manual mode: filament id -> extruder id can not be printed std::vector auto_filaments; //auto mode: filaments in all extruder's outside area @@ -370,7 +370,7 @@ public: virtual void render_with_outline(const GUI::Size& cnv_size); //BBS: add simple render function for thumbnail - void simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_objects, std::vector& extruder_colors, bool ban_light =false); + void simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_objects, std::vector& extruder_colors, bool ban_light =false, bool ban_color_volume = false); void set_bounding_boxes_as_dirty() { m_transformed_bounding_box.reset(); diff --git a/src/slic3r/GUI/ActionRegistry.cpp b/src/slic3r/GUI/ActionRegistry.cpp index 6956423bc6..011381b33e 100644 --- a/src/slic3r/GUI/ActionRegistry.cpp +++ b/src/slic3r/GUI/ActionRegistry.cpp @@ -3,9 +3,11 @@ #include "GUI.hpp" #include "GUI_App.hpp" #include "I18N.hpp" +#include "ImGuiWrapper.hpp" #include "MainFrame.hpp" #include "NativeCommands.hpp" #include "Notebook.hpp" +#include "NotificationManager.hpp" #include "OptionsGroup.hpp" #include "Plater.hpp" #include "SettingsIndex.hpp" @@ -99,6 +101,45 @@ std::string find_loaded_source_name(PluginManager& manager, const std::string& p return plugin_key; } +// Translates a Script capability outcome into the action layer's result vocabulary. Shared by +// the synchronous run path and the async completion notification. +AppActionRunResult script_outcome_to_action_result(const ScriptCompletion& completion) +{ + // Cancelled by PluginManager (unload/shutdown): expected termination, nothing to show. + if (completion.cancelled) + return {}; + + if (!completion.error.empty()) + return {AppActionRunResult::Level::Error, from_u8(completion.error)}; + + const ExecutionResult& result = completion.result; + const bool skipped = result.status == PluginResult::Skipped; + const wxString fallback = skipped ? _L("Script plugin skipped.") : _L("Script plugin finished."); + return {skipped ? AppActionRunResult::Level::Info : AppActionRunResult::Level::Success, + result.message.empty() ? fallback : from_u8(result.message)}; +} + +// Surfaces the eventual outcome of an async script launched from the speed dial. That launch +// already returned (the UI was not blocked), so the finish is reported as a notification. A +// cancellation is silent. +void notify_script_outcome(const ScriptCompletion& completion) +{ + if (completion.cancelled) + return; + if (wxTheApp == nullptr || wxGetApp().is_closing()) + return; + + Plater* plater = wxGetApp().plater(); + if (plater == nullptr || wxGetApp().imgui() == nullptr || !wxGetApp().imgui()->display_initialized()) + return; + + const AppActionRunResult action_result = script_outcome_to_action_result(completion); + const auto level = action_result.level == AppActionRunResult::Level::Error + ? NotificationManager::NotificationLevel::ErrorNotificationLevel + : NotificationManager::NotificationLevel::RegularNotificationLevel; + plater->get_notification_manager()->push_notification(NotificationType::CustomNotification, level, into_u8(action_result.message)); +} + // A runnable script capability exposed as a speed-dial action. source_key = plugin_key // (identity), so a plugin display-name change does not re-key the action. struct PluginScriptAction : AppAction @@ -124,15 +165,36 @@ struct PluginScriptAction : AppAction AppActionRunResult run(const std::string& /*param*/) const override { - std::string error; - const ExecutionResult result = PluginManager::instance().run_script_capability(plugin_key, capability, error); - if (!error.empty()) - return {AppActionRunResult::Level::Error, from_u8(error)}; + struct Outcome + { + bool async = false; + bool completed = false; + AppActionRunResult result; + }; + auto outcome = std::make_shared(); - const bool skipped = result.status == PluginResult::Skipped; - const wxString fallback = skipped ? _L("Script plugin skipped.") : _L("Script plugin finished."); - return {skipped ? AppActionRunResult::Level::Info : AppActionRunResult::Level::Success, - result.message.empty() ? fallback : from_u8(result.message)}; + auto on_done = [outcome](const ScriptCompletion& completion) { + outcome->result = script_outcome_to_action_result(completion); + outcome->completed = true; + if (outcome->async) + notify_script_outcome(completion); + }; + + const PluginManager::ScriptLaunchResult launch = PluginManager::instance().launch_script_capability(plugin_key, capability, on_done); + if (launch.launched_async) { + // The completion is delivered on this (GUI) thread once the (sync or async) invocation + // finishes, so marking `async` here cannot race with on_done. The speed dial has already + // shown a result by then; the final outcome arrives as a notification (a cancellation is + // silent). + outcome->async = true; + if (outcome->completed) + return outcome->result; + return {AppActionRunResult::Level::Info, _L("Script plugin started.")}; + } + + // The launch failed inline; on_done produced the (error) result. + on_done(launch.outcome); + return outcome->result; } }; diff --git a/src/slic3r/GUI/CAD/SketchInlineEditor.hpp b/src/slic3r/GUI/CAD/SketchInlineEditor.hpp index 677e74b3a0..1721066cd8 100644 --- a/src/slic3r/GUI/CAD/SketchInlineEditor.hpp +++ b/src/slic3r/GUI/CAD/SketchInlineEditor.hpp @@ -68,8 +68,8 @@ public: // (nothing further) <- the canvas has nothing to redraw, so it stops // // This canvas repaints ON DEMAND. ImGui decides whether it wants the keyboard at the END of a - // frame, from the active item, and GLCanvas3D::on_char only calls render() when - // update_key_data() says ImGui wants it. No frames -> WantTextInput never turns on -> no + // frame, from the active item, and GLCanvas3D::on_char only calls render() when ImGui + // wants or claims the key. No frames -> WantTextInput never turns on -> no // render on a keystroke -> still no frames. The characters sit in ImGui's queue and the field // looks exactly as deaf as the window it replaced. One repaint per frame while it is open // breaks the circle. diff --git a/src/slic3r/GUI/CalibrationWizard.cpp b/src/slic3r/GUI/CalibrationWizard.cpp index 5d287942ba..912973828c 100644 --- a/src/slic3r/GUI/CalibrationWizard.cpp +++ b/src/slic3r/GUI/CalibrationWizard.cpp @@ -435,7 +435,7 @@ void CalibrationWizard::cache_preset_info(MachineObject *obj, float nozzle_dia, if (obj->is_multi_extruders()) { int ams_id, slot_id, tray_id; get_tray_ams_and_slot_id(curr_obj, result.tray_id, ams_id, slot_id, tray_id); - result.extruder_id = preset_page->get_extruder_id(ams_id); + result.extruder_id = preset_page->get_extruder_id_by_tray_id(result.tray_id); result.nozzle_diameter = preset_page->get_nozzle_diameter(result.extruder_id); } else { @@ -753,7 +753,7 @@ void PressureAdvanceWizard::on_cali_start() X1CCalibInfos::X1CCalibInfo calib_info; get_tray_ams_and_slot_id(curr_obj, item.first, calib_info.ams_id, calib_info.slot_id, calib_info.tray_id); - calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id); + calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(item.first); calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id); calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id); calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id); @@ -792,7 +792,7 @@ void PressureAdvanceWizard::on_cali_start() CalibInfo calib_info; calib_info.dev_id = curr_obj->get_dev_id(); get_tray_ams_and_slot_id(curr_obj, selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id, selected_tray_id); - calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id); + calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(selected_filaments.begin()->first); calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id); calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id); calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id); @@ -877,7 +877,7 @@ void PressureAdvanceWizard::on_cali_start() calib_info.dev_id = curr_obj->get_dev_id(); get_tray_ams_and_slot_id(curr_obj, item.first, calib_info.ams_id, calib_info.slot_id, selected_tray_id); calib_info.index = preset_page->get_index_by_tray_id(item.first); - calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id); + calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(item.first); calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id); calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id); calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id); @@ -1252,7 +1252,7 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow X1CCalibInfos::X1CCalibInfo calib_info; calib_info.tray_id = item.first; get_tray_ams_and_slot_id(curr_obj, item.first, calib_info.ams_id, calib_info.slot_id, calib_info.tray_id); - calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id); + calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(item.first); calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id); calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id); calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id); @@ -1308,7 +1308,15 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow int selected_tray_id = 0; get_tray_ams_and_slot_id(curr_obj, selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id, selected_tray_id); calib_info.select_ams = std::to_string(selected_tray_id); - calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id); + calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(selected_filaments.begin()->first); + if (from_page == FlowRatioCaliSource::FROM_COARSE_PAGE) { + // The fine pass must run on the extruder the coarse pass used. The cache records it; + // the preset page's selection may have changed or been reset since. + const auto cached = get_cached_selected_filament_for_multi_extruder(curr_obj); + const auto it = cached.find(selected_filaments.begin()->first); + if (it != cached.end()) + calib_info.extruder_id = it->second.extruder_id; + } calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id); calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id); calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id); @@ -1724,7 +1732,7 @@ void MaxVolumetricSpeedWizard::on_cali_start() int selected_tray_id = 0; get_tray_ams_and_slot_id(curr_obj, selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id, selected_tray_id); calib_info.select_ams = std::to_string(selected_tray_id); - calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id); + calib_info.extruder_id = preset_page->get_extruder_id_by_tray_id(selected_filaments.begin()->first); calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id); calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id); calib_info.nozzle_diameter = preset_page->get_nozzle_diameter(calib_info.extruder_id); diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index 754d3457cb..673026159e 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -587,8 +587,23 @@ void CalibrationPresetPage::on_sys_color_changed() m_ams_sync_button->msw_rescale(); } -int CalibrationPresetPage::get_extruder_id(int ams_id) +int CalibrationPresetPage::get_extruder_id_by_tray_id(int tray_id) { + // An AMS behind a Filament Track Switch feeds both extruders, so the extruder is the one + // whose panel the filament was selected in. + if (curr_obj && curr_obj->is_multi_extruders()) { + for (FilamentComboBox *fcb : get_selected_filament_combobox()) { + if (fcb->get_tray_id() != tray_id) + continue; + const bool is_deputy = std::find(m_deputy_filament_comboBox_list.begin(), m_deputy_filament_comboBox_list.end(), fcb) != + m_deputy_filament_comboBox_list.end(); + return is_deputy ? DEPUTY_EXTRUDER_ID : MAIN_EXTRUDER_ID; + } + } + + int ams_id = tray_id / 4, slot_id, unused_tray_id; + if (curr_obj) + get_tray_ams_and_slot_id(curr_obj, tray_id, ams_id, slot_id, unused_tray_id); if (m_ams_id_to_extruder_id_map.find(ams_id) != m_ams_id_to_extruder_id_map.end()) { return m_ams_id_to_extruder_id_map[ams_id]; } @@ -866,6 +881,18 @@ static void fill_nozzle_volume_combo(ComboBox *combo) select_nozzle_volume(combo, NozzleVolumeType::nvtStandard); } +static DynamicPrintConfig empty_tray_config() +{ + DynamicPrintConfig config; + config.set_key_value("filament_id", new ConfigOptionStrings{""}); + config.set_key_value("tag_uid", new ConfigOptionStrings{""}); + config.set_key_value("filament_type", new ConfigOptionStrings{""}); + config.set_key_value("tray_name", new ConfigOptionStrings{""}); + config.set_key_value("filament_colour", new ConfigOptionStrings{""}); + config.set_key_value("filament_exist", new ConfigOptionBools{false}); + return config; +} + void CalibrationPresetPage::init_selection_values() { // init nozzle diameter and nozzle volume @@ -2272,27 +2299,36 @@ void CalibrationPresetPage::sync_ams_info(MachineObject* obj) } } - // init virtual tray info - if (full_filament_ams_list.find(VIRTUAL_TRAY_MAIN_ID) != full_filament_ams_list.end()) { - filament_ams_list[VIRTUAL_TRAY_MAIN_ID] = full_filament_ams_list[VIRTUAL_TRAY_MAIN_ID]; - } + // init virtual tray info. With a Filament Track Switch installed the external spools feed + // through the switch, so they can't be calibrated as their own trays. + if (obj->GetFilaSwitch()->IsInstalled()) { + filament_ams_list[VIRTUAL_TRAY_MAIN_ID] = empty_tray_config(); + filament_ams_list[VIRTUAL_TRAY_DEPUTY_ID] = empty_tray_config(); + } else { + if (full_filament_ams_list.find(VIRTUAL_TRAY_MAIN_ID) != full_filament_ams_list.end()) { + filament_ams_list[VIRTUAL_TRAY_MAIN_ID] = full_filament_ams_list[VIRTUAL_TRAY_MAIN_ID]; + } - if (full_filament_ams_list.find(VIRTUAL_TRAY_DEPUTY_ID) != full_filament_ams_list.end()) { - filament_ams_list[VIRTUAL_TRAY_DEPUTY_ID] = full_filament_ams_list[VIRTUAL_TRAY_DEPUTY_ID]; + if (full_filament_ams_list.find(VIRTUAL_TRAY_DEPUTY_ID) != full_filament_ams_list.end()) { + filament_ams_list[VIRTUAL_TRAY_DEPUTY_ID] = full_filament_ams_list[VIRTUAL_TRAY_DEPUTY_ID]; + } } // update filament from panel, display only obj has ams // update multi ams panel, display only obj has multi ams if (obj->HasAms()) { if (obj->is_multi_extruders()) { + // An AMS behind a Filament Track Switch is bound to both extruders and appears in both panels. bool main_done = false; bool deputy_done = false; for (auto &ams_item : obj->GetFilaSystem()->GetAmsList()) { - if (ams_item.second->GetExtruderId() == 0 && !main_done) { - update_multi_extruder_filament_combobox(ams_item.second->GetAmsId(), ams_item.second->GetExtruderId()); + const auto &extruder_set = ams_item.second->GetBindedExtruderSet(); + if (!main_done && extruder_set.count(MAIN_EXTRUDER_ID) != 0) { + update_multi_extruder_filament_combobox(ams_item.second->GetAmsId(), MAIN_EXTRUDER_ID); main_done = true; - } else if (ams_item.second->GetExtruderId() == 1 && !deputy_done) { - update_multi_extruder_filament_combobox(ams_item.second->GetAmsId(), ams_item.second->GetExtruderId()); + } + if (!deputy_done && extruder_set.count(DEPUTY_EXTRUDER_ID) != 0) { + update_multi_extruder_filament_combobox(ams_item.second->GetAmsId(), DEPUTY_EXTRUDER_ID); deputy_done = true; } } @@ -2333,10 +2369,11 @@ void CalibrationPresetPage::sync_ams_info(MachineObject* obj) if (ams->second->IsExist() && info.parse_ams_info(obj, ams->second, obj->GetFilaSystem()->IsDetectRemainEnabled(), obj->is_support_ams_humidity)) { ams_info.push_back(info); - if (info.nozzle_id == 0) { - main_ams_info.push_back(info); - } else { - deputy_ams_info.push_back(info); + for (int extruder_id : ams->second->GetBindedExtruderSet()) { + if (extruder_id == MAIN_EXTRUDER_ID) + main_ams_info.push_back(info); + else + deputy_ams_info.push_back(info); } } m_ams_id_to_extruder_id_map[stoi(info.ams_id)] = info.nozzle_id; @@ -2584,13 +2621,7 @@ void CalibrationPresetPage::update_multi_extruder_filament_combobox(const std::s } } - DynamicPrintConfig empty_config; - empty_config.set_key_value("filament_id", new ConfigOptionStrings{""}); - empty_config.set_key_value("tag_uid", new ConfigOptionStrings{""}); - empty_config.set_key_value("filament_type", new ConfigOptionStrings{""}); - empty_config.set_key_value("tray_name", new ConfigOptionStrings{""}); - empty_config.set_key_value("filament_colour", new ConfigOptionStrings{""}); - empty_config.set_key_value("filament_exist", new ConfigOptionBools{false}); + DynamicPrintConfig empty_config = empty_tray_config(); if (filament_ams_list.empty()) return; diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp index 1ad2a2e1e1..27753baf26 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp @@ -251,7 +251,7 @@ public: void msw_rescale() override; void on_sys_color_changed() override; - int get_extruder_id(int ams_id); + int get_extruder_id_by_tray_id(int tray_id); float get_nozzle_diameter(int extruder_id) const; NozzleVolumeType get_nozzle_volume_type(int extruder_id) const; ExtruderType get_extruder_type(int extruder_id) const; diff --git a/src/slic3r/GUI/ColorPickerDialog.cpp b/src/slic3r/GUI/ColorPickerDialog.cpp index 086eae3a70..b9308c7a8e 100644 --- a/src/slic3r/GUI/ColorPickerDialog.cpp +++ b/src/slic3r/GUI/ColorPickerDialog.cpp @@ -303,10 +303,12 @@ nlohmann::json color_picker_ui_strings() return { {"Color Picker", _u8L("Color Picker")}, {"Basic Colors", _u8L("Basic Colors")}, - {"Orca Palette", _u8L("Orca Palette")},// TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. - {"RAL Classic", _u8L("RAL Classic")}, // TRN: Keep the standard/brand name "RAL" unchanged. + // TRN: Keep the brand name "Orca" unchanged; translate only the palette descriptor. + {"Orca Palette", _u8L("Orca Palette")}, + // TRN: Keep the standard/brand name "RAL" unchanged. + {"RAL Classic", _u8L("RAL Classic")}, {"Gradients", _u8L("Gradients")}, - {"Solid", _u8L("Solid")}, + {"Solid", _u8L_CONTEXT("Solid", "Color picker")}, {"Gradient", _u8L("Gradient")}, {"Gradient start", _u8L("Gradient start")}, {"Gradient end", _u8L("Gradient end")}, @@ -440,7 +442,7 @@ nlohmann::json color_picker_ui_strings() {"Purple", _u8L("Purple")}, {"Rebecca purple", _u8L("Rebecca purple")}, {"Medium violet red", _u8L("Medium violet red")}, - {"PaleV violet red", _u8L("PaleV violet red")}, + {"Pale violet red", _u8L("Pale violet red")}, {"Deep pink", _u8L("Deep pink")}, {"Hot pink", _u8L("Hot pink")}, {"Light pink", _u8L("Light pink")}, @@ -496,7 +498,7 @@ nlohmann::json color_picker_ui_strings() {"Turquoise bay", _u8L("Turquoise bay")}, {"Sky over reef", _u8L("Sky over reef")}, {"Shallow sky", _u8L("Shallow sky")}, - {"Electric bel", _u8L("Electric bel")}, + {"Electric blue", _u8L("Electric blue")}, {"Dolphin", _u8L("Dolphin")}, {"Ocean depths", _u8L("Ocean depths")}, {"Whale", _u8L("Whale")}, @@ -519,7 +521,7 @@ nlohmann::json color_picker_ui_strings() {"Golden yellow", _u8L("Golden yellow")}, {"Honey yellow", _u8L("Honey yellow")}, {"Maize yellow", _u8L("Maize yellow")}, - {"Dalmatian yellow", _u8L("Dalmatian yellow")}, + {"Daffodil yellow", _u8L("Daffodil yellow")}, {"Brown beige", _u8L("Brown beige")}, {"Lemon yellow", _u8L("Lemon yellow")}, {"Oyster white", _u8L("Oyster white")}, @@ -606,7 +608,7 @@ nlohmann::json color_picker_ui_strings() {"Pigeon blue", _u8L("Pigeon blue")}, {"Traffic blue", _u8L("Traffic blue")}, {"Turquoise blue", _u8L("Turquoise blue")}, - {"Capsanthin violet", _u8L("Capsanthin violet")}, + {"Capri blue", _u8L("Capri blue")}, {"Ocean blue", _u8L("Ocean blue")}, {"Water blue", _u8L("Water blue")}, {"Night blue", _u8L("Night blue")}, @@ -644,7 +646,7 @@ nlohmann::json color_picker_ui_strings() {"Luminous green", _u8L("Luminous green")}, {"Squirrel grey", _u8L("Squirrel grey")}, {"Silver grey", _u8L("Silver grey")}, - {"Olivestone", _u8L("Olivestone")}, + {"Olive grey", _u8L("Olive grey")}, {"Moss grey", _u8L("Moss grey")}, {"Signal grey", _u8L("Signal grey")}, {"Mouse grey", _u8L("Mouse grey")}, diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 8bf5b843cc..9af9a4309f 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -807,7 +807,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in toggle_field("enable_arc_fitting", !have_volumetric_extrusion_rate_slope && !is_belt_printer); toggle_line("max_volumetric_extrusion_rate_slope_segment_length", have_volumetric_extrusion_rate_slope); toggle_line("extrusion_rate_smoothing_external_perimeter_only", have_volumetric_extrusion_rate_slope); - if(have_volumetric_extrusion_rate_slope) config->set_key_value("enable_arc_fitting", new ConfigOptionBool(false)); + if(have_volumetric_extrusion_rate_slope) config->set_key_value("enable_arc_fitting", new ConfigOptionEnum(ArcFittingMode::Disabled)); if(have_volumetric_extrusion_rate_slope_segment_length < 0.5) { DynamicPrintConfig new_conf = *config; new_conf.set_key_value("max_volumetric_extrusion_rate_slope_segment_length", new ConfigOptionFloat(1)); @@ -843,17 +843,17 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in bool have_multiline_infill_pattern = pattern == ipGyroid || pattern == ipGrid || pattern == ipRectilinear || pattern == ipTpmsD || pattern == ipTpmsFK || pattern == ipCrossHatch || pattern == ipHoneycomb || pattern == ipLateralLattice || pattern == ipLateralHoneycomb || pattern == ipConcentric || pattern == ipCubic || pattern == ipStars || pattern == ipAlignedRectilinear || pattern == ipLightning || pattern == ip3DHoneycomb || pattern == ipAdaptiveCubic || pattern == ipSupportCubic|| pattern == ipTriangles || pattern == ipQuarterCubic|| pattern == ipArchimedeanChords || pattern == ipHilbertCurve || pattern == ipOctagramSpiral; - // The sparse infill density is the surface density of the adaptive TPMS infill; at 100% the infill is solid. - bool have_tpms_infill = have_infill && config->option("sparse_infill_density")->value < 100 && - is_tpms_adaptive_pattern(pattern); - toggle_line("tpms_adaptive", have_tpms_infill); - bool have_tpms_adaptive = have_tpms_infill && config->opt_enum("tpms_adaptive") != TpmsAdaptiveMode::Disabled; - toggle_line("tpms_interior_density", have_tpms_adaptive); - toggle_line("tpms_adaptive_gradient", have_tpms_adaptive); + // The sparse infill density is the surface density of the adaptive infill; at 100% the infill is solid. + bool have_adaptive_infill_pattern = have_infill && config->option("sparse_infill_density")->value < 100 && + is_adaptive_infill_pattern(pattern); + toggle_line("adaptive_infill_mode", have_adaptive_infill_pattern); + bool have_adaptive_infill = have_adaptive_infill_pattern && config->opt_enum("adaptive_infill_mode") != AdaptiveInfillMode::Disabled; + toggle_line("adaptive_infill_interior_density", have_adaptive_infill); + toggle_line("adaptive_infill_gradient", have_adaptive_infill); // gyroid_optimized only applies when the sparse infill pattern is gyroid without adaptive density; // hide the whole line otherwise. - toggle_line("gyroid_optimized", have_infill && pattern == ipGyroid && !have_tpms_adaptive); + toggle_line("gyroid_optimized", have_infill && pattern == ipGyroid && !have_adaptive_infill); // If there is infill, enable/disable fill_multiline according to whether the pattern supports multiline infill. if (have_infill) { diff --git a/src/slic3r/GUI/ConfigValueFormatter.cpp b/src/slic3r/GUI/ConfigValueFormatter.cpp index 8536e6731d..58f219a9ed 100644 --- a/src/slic3r/GUI/ConfigValueFormatter.cpp +++ b/src/slic3r/GUI/ConfigValueFormatter.cpp @@ -242,7 +242,7 @@ wxString get_string_value(const std::string& opt_key, const DynamicPrintConfig& return get_thumbnails_string(points.values); } else if (pure_key == "bed_exclude_area") { - return get_thumbnails_string(config.option(pure_key)->values); + return from_u8(config.option(pure_key)->serialize()); } else if (pure_key == "head_wrap_detect_zone") { return get_thumbnails_string(config.option(pure_key)->values); diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 5d14f8162e..d04e3f718a 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -2671,7 +2671,8 @@ ConfigWizard::ConfigWizard(wxWindow *parent) p->load_vendors(); //BBS: add bed exclude areas p->custom_config.reset(DynamicPrintConfig::new_from_defaults_keys({ - "gcode_flavor", "printable_area", "bed_exclude_area", "bed_custom_texture", "bed_custom_model", "nozzle_diameter", "filament_diameter", "thumbnails" + "gcode_flavor", "printable_area", "bed_exclude_area", "bed_exclude_volumes", "bed_exclude_volume_mode", "extruder_bed_exclude_volumes", + "bed_custom_texture", "bed_custom_model", "nozzle_diameter", "filament_diameter", "thumbnails" //, "nozzle_temperature", "bed_temperature" })); diff --git a/src/slic3r/GUI/DailyTips.cpp b/src/slic3r/GUI/DailyTips.cpp index 8bace894e1..dc97117efc 100644 --- a/src/slic3r/GUI/DailyTips.cpp +++ b/src/slic3r/GUI/DailyTips.cpp @@ -161,7 +161,7 @@ void DailyTipsDataRenderer::render_img(const ImVec2& start_pos, const ImVec2& si bool has_cjk(const std::string &text) { - for (size_t i = 0; i < text.size() - 2; ++i) { + for (size_t i = 0; i + 2 < text.size(); ++i) { unsigned char c1 = text[i]; unsigned char c2 = text[i + 1]; unsigned char c3 = text[i + 2]; diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index e5d8395e44..bdfcfe02fd 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -11,6 +11,7 @@ #include "GUI_App.hpp" #include "DeviceErrorDialog.hpp" +#include "MainFrame.hpp" #include "Plater.hpp" #include "ReleaseNote.hpp" #include @@ -4751,7 +4752,9 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_ void MachineObject::set_ctt_dlg( wxString text){ if (!m_set_ctt_dlg) { m_set_ctt_dlg = true; - auto print_error_dlg = new GUI::SecondaryCheckDialog(nullptr, wxID_ANY, _L("Warning"), GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM); // ORCA VisibleButtons instead ButtonStyle + // Parented so it is destroyed with the main frame: a parentless top-level window, + // even hidden, keeps wx from leaving the event loop on exit. + auto print_error_dlg = new GUI::SecondaryCheckDialog(GUI::wxGetApp().mainframe, wxID_ANY, _L("Warning"), GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM); // ORCA VisibleButtons instead ButtonStyle print_error_dlg->update_text(text); print_error_dlg->Bind(wxEVT_SHOW, [this](auto& e) { if (!e.IsShown()) { @@ -4786,7 +4789,8 @@ void MachineObject::show_unsupported_dlg(int code) // note: constructed directly rather than through CallAfter because every publish_json caller // is on the UI thread - clicks come from wx handlers, and the agent marshals its own push // callbacks back to main before parse_json runs. set_ctt_dlg relies on the same property. - auto unsupported_dlg = new GUI::SecondaryCheckDialog(nullptr, wxID_ANY, _L("Warning"), + // Parented for the same reason as in set_ctt_dlg. + auto unsupported_dlg = new GUI::SecondaryCheckDialog(GUI::wxGetApp().mainframe, wxID_ANY, _L("Warning"), GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM); unsupported_dlg->update_text(text); unsupported_dlg->Bind(wxEVT_SHOW, [this](auto& e) { @@ -4875,7 +4879,7 @@ void MachineObject::update_model_task() unsigned int http_code = 404; std::string http_error; int res = -1; - res = m_agent->get_model_mall_rating_result(curr_instance_id, rating_result, http_code, http_error); + res = m_agent->get_model_mall_rating_result(curr_instance_id, rating_result, http_code, http_error, Slic3r::GUI::wxGetApp().get_printer_cloud_provider()); request_model_result++; BOOST_LOG_TRIVIAL(info) << "request times: " << request_model_result << " http code: " << http_code; auto rating_info = new DevPrintTaskRatingInfo(); @@ -5064,7 +5068,7 @@ void MachineObject::get_firmware_info() unsigned int http_code; std::string http_body; if (!m_agent) return; - result = m_agent->get_printer_firmware(get_dev_id(), &http_code, &http_body); + result = m_agent->get_printer_firmware(get_dev_id(), &http_code, &http_body, Slic3r::GUI::wxGetApp().get_printer_cloud_provider()); if (result < 0) { // get upgrade list failed return; diff --git a/src/slic3r/GUI/EncodedFilament.cpp b/src/slic3r/GUI/EncodedFilament.cpp index 413c0877c9..9ea9ba2ffd 100644 --- a/src/slic3r/GUI/EncodedFilament.cpp +++ b/src/slic3r/GUI/EncodedFilament.cpp @@ -1,17 +1,21 @@ #include "EncodedFilament.hpp" #include "libslic3r/Utils.hpp" #include +#include #include #include #include #include +#include #include +#include #include #include #include #include "GUI_App.hpp" #include "I18N.hpp" +#include "slic3r/Utils/BBLPrinterAgent.hpp" using json = nlohmann::json; @@ -23,10 +27,19 @@ static wxString _ColourToString(const wxColour& color) return wxString::Format("#%02X%02X%02X%02X", color.Red(), color.Green(), color.Blue(), color.Alpha()); } +// A vendor installed from its preset cache (.opc) has no system/BBL +// directory in the data dir, so fall back to the copy shipped with the app. +static std::string filament_color_codes_path() +{ + const std::string relative_path = "/BBL/filament/filaments_color_codes.json"; + const std::string installed = data_dir() + "/system" + relative_path; + return boost::filesystem::exists(installed) ? installed : resources_dir() + "/profiles" + relative_path; +} + FilamentColorCodeQuery::FilamentColorCodeQuery() { m_fila_id2colors_map = new std::unordered_map; - m_fila_path = data_dir() + "/system/BBL/filament/filaments_color_codes.json"; + m_fila_path = filament_color_codes_path(); LoadFromLocal(); } @@ -41,7 +54,11 @@ FilamentColorCodeQuery::~FilamentColorCodeQuery() FilamentColorCodes* FilamentColorCodeQuery::GetFilaInfoMap(const wxString& fila_id) const { - const auto& iter = m_fila_id2colors_map->find(fila_id); + // The color codes are keyed by Bambu's filament ids. Callers holding Orca's id only get it + // translated when the Bambu agent is live, so translate here for every other agent. + auto iter = m_fila_id2colors_map->find(fila_id); + if (iter == m_fila_id2colors_map->end()) + iter = m_fila_id2colors_map->find(wxString::FromUTF8(BBLPrinterAgent::bambu_filament_id(fila_id.ToStdString(wxConvUTF8)))); return (iter != m_fila_id2colors_map->end()) ? iter->second : nullptr; } diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index f2ae0490d9..55c491f811 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -733,6 +733,14 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true m_value = into_u8(str); } break; + } else if (m_opt.opt_key == "bed_exclude_volumes" || m_opt.opt_key == "extruder_bed_exclude_volumes") { + const std::string definition = into_u8(str); + if (!is_valid_bed_exclude_volumes_string(definition, std::numeric_limits::max())) { + show_error(m_parent, _L("Invalid collision volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |.")); + const std::string old_value = m_value.empty() ? std::string{} : boost::any_cast(m_value); + set_value(from_u8(old_value), true); + break; + } } else if (m_opt.opt_key == "extra_solid_infills") { std::string ustr(str.utf8_string()); // New rule: accept either interval form (N or N#K) or explicit list (e.g. 1,7,9), with optional quotes. @@ -784,11 +792,18 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true case coPoints: { std::vector out_values; str.Replace(" ", wxEmptyString, true); + const bool bed_exclusion_volume_syntax = m_opt_id == "bed_exclude_area" && + (str.Find("|") != wxNOT_FOUND || (str.Find("..") != wxNOT_FOUND && str.Find(";") != wxNOT_FOUND)); + if (bed_exclusion_volume_syntax) { + // Leave volume validation and the copy prompt to the printer tab. + m_value = into_u8(str); + break; + } if (!str.IsEmpty()) { bool invalid_val = false; - wxStringTokenizer thumbnails(str, ","); - while (thumbnails.HasMoreTokens()) { - wxString token = thumbnails.GetNextToken(); + wxStringTokenizer points(str, ","); + while (points.HasMoreTokens()) { + wxString token = points.GetNextToken(); double x, y; wxStringTokenizer thumbnail(token, "x"); if (thumbnail.HasMoreTokens()) { @@ -807,10 +822,11 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true if (invalid_val) { wxString text_value; - if (!m_value.empty()) + if (!m_value.empty() && boost::any_cast>(&m_value) != nullptr) text_value = get_thumbnails_string(boost::any_cast>(m_value)); set_value(text_value, true); - show_error(m_parent, format_wxstr(_L("Invalid format. Expected vector format: \"%1%\""),"XxY, XxY, ..." )); + show_error(m_parent, format_wxstr(_L("Invalid format. Expected vector format: \"%1%\""), "XxY, XxY, ...")); + break; } } diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index fbfd44a475..84de35f0cd 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -126,6 +126,18 @@ namespace GUI { // _u8L("Filament") // }; +// ORCA: a translucent filament swatch goes over the checkerboard of the sidebar's clear swatch +static void add_swatch(ImDrawList* draw_list, const ImVec2& min, const ImVec2& max, const ColorRGBA& color) +{ + if (color.is_transparent()) { + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) + draw_list->AddRectFilled(ImLerp(min, max, ImVec2(0.25f * i, 0.25f * j)), ImLerp(min, max, ImVec2(0.25f * (i + 1), 0.25f * (j + 1))), + (i + j) % 2 == 0 ? IM_COL32_WHITE : IM_COL32(217, 217, 217, 255)); + } + draw_list->AddRectFilled(min, max, ImGuiWrapper::to_ImU32(color)); +} + static std::string get_view_type_string(libvgcode::EViewType view_type) { if (view_type == libvgcode::EViewType::Summary) @@ -1405,6 +1417,7 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const // ORCA: darken the layers the preview layer slider is not scrubbed to m_viewer.set_dim_previous_layers(get_app_config()->get_bool("preview_dim_previous_layers")); m_viewer.set_dim_previous_layers_brightness(0.01f * std::stoi(get_app_config()->get("preview_dim_previous_layers_brightness"))); + m_viewer.set_translucent_filaments(get_app_config()->get_bool("preview_translucent_filaments")); // avoid processing if called with the same gcode_result. // On a belt printer the toolpath geometry fed to libvgcode also depends on the @@ -1415,22 +1428,8 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const //BBS: add logs BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": the same id %1%, return directly, result %2% ") % m_last_result_id % (&gcode_result); - // collect tool colors - libvgcode::Palette tools_colors; - tools_colors.reserve(str_tool_colors.size()); - for (const std::string& color : str_tool_colors) { - tools_colors.emplace_back(libvgcode::convert(color)); - } - m_viewer.set_tool_colors(tools_colors); - - // collect color print colors - libvgcode::Palette color_print_colors; - const std::vector& str_colors = str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors; - color_print_colors.reserve(str_colors.size()); - for (const std::string& color : str_colors) { - color_print_colors.emplace_back(libvgcode::convert(color)); - } - m_viewer.set_color_print_colors(color_print_colors); + m_viewer.set_tool_colors(libvgcode::convert_filament_colors(str_tool_colors)); + m_viewer.set_color_print_colors(libvgcode::convert_filament_colors(str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors)); return; } @@ -2212,7 +2211,13 @@ void GCodeViewer::render_scene(int canvas_width, int canvas_height) return; render_toolpaths(); + // ORCA: the markers write depth, which would hide the translucent toolpaths behind them + if (!m_viewer.has_translucent_toolpaths()) + render_markers(canvas_width, canvas_height); +} +void GCodeViewer::render_markers(int canvas_width, int canvas_height) +{ auto current = m_viewer.get_view_visible_range(); auto endpoints = m_viewer.get_view_full_range(); m_sequential_view.m_show_marker = m_sequential_view.m_show_marker || (current.back() != endpoints.back() && !m_no_render_path); @@ -3236,6 +3241,25 @@ void GCodeViewer::load_shells(const Print& print, bool initialized, bool force_p % m_shells.print_id % m_shells.print_modify_count % object_count %m_shells.volumes.volumes.size(); } +ColorRGBA GCodeViewer::shown_filament_color(ColorRGBA color) const +{ + if (!m_viewer.is_translucent_filaments()) + color.a(1.0f); + return color; +} + +void GCodeViewer::render_translucent_toolpaths(int canvas_width, int canvas_height) +{ + if (!m_viewer.has_translucent_toolpaths()) + return; + + const Camera& camera = wxGetApp().plater()->get_camera(); + m_viewer.render_translucent(libvgcode::convert(static_cast(camera.get_view_matrix().matrix().cast())), + libvgcode::convert(static_cast(camera.get_projection_matrix().matrix().cast()))); + glsafe(::glEnable(GL_DEPTH_TEST)); + render_markers(canvas_width, canvas_height); +} + void GCodeViewer::render_toolpaths() { const Camera& camera = wxGetApp().plater()->get_camera(); @@ -3534,8 +3558,7 @@ void GCodeViewer::render_all_plates_stats(const std::vectorAddRectFilled({ pos.x + 1.0f * m_scale, pos.y + 3.0f * m_scale }, { pos.x + icon_size - 1.0f * m_scale, pos.y + icon_size + 1.0f * m_scale }, - ImGuiWrapper::to_ImU32(color)); + add_swatch(draw_list, { pos.x + 1.0f * m_scale, pos.y + 3.0f * m_scale }, { pos.x + icon_size - 1.0f * m_scale, pos.y + icon_size + 1.0f * m_scale }, color); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(20.0 * m_scale, 6.0 * m_scale)); @@ -4139,8 +4162,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv switch (type) { default: case EItemType::Rect: { - draw_list->AddRectFilled({ pos.x + 1.0f * m_scale, pos.y + 3.0f * m_scale }, { pos.x + icon_size - 1.0f * m_scale, pos.y + icon_size + 1.0f * m_scale }, - ImGuiWrapper::to_ImU32(color)); + add_swatch(draw_list, { pos.x + 1.0f * m_scale, pos.y + 3.0f * m_scale }, { pos.x + icon_size - 1.0f * m_scale, pos.y + icon_size + 1.0f * m_scale }, color); break; } case EItemType::Circle: { @@ -4932,7 +4954,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv for (uint8_t extruder_id : used_extruders_ids) { const std::string weight_text = format_compact_weight(model_used_filaments_g[i], imperial_units); ::sprintf(buf, imperial_units ? "%.2f in %s" : "%.2f m %s", model_used_filaments_m[i], weight_text.c_str()); - append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_tool_colors()[extruder_id]), { { _u8L("Extruder") + " " + std::to_string(extruder_id + 1), offsets[0]}, {buf, offsets[1]} }); + append_item(EItemType::Rect, shown_filament_color(libvgcode::convert(m_viewer.get_tool_colors()[extruder_id])), { { _u8L("Extruder") + " " + std::to_string(extruder_id + 1), offsets[0]}, {buf, offsets[1]} }); // append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_tool_colors()[extruder_id]), _u8L("Extruder") + " " + std::to_string(extruder_id + 1), // true, "", 0.0f, 0.0f, offsets, used_filaments_m[extruder_id], used_filaments_g[extruder_id]); i++; @@ -5028,7 +5050,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv } float checkbox_pos = std::max(predictable_icon_pos, color_print_offsets[_u8L("Display")]); // ORCA prefer predictable_icon_pos when header not reacing end - append_item(EItemType::Rect, libvgcode::convert(tool_colors[extruder_idx]), columns_offsets, false, checkbox_pos/*ORCA*/, true, []() {}); + append_item(EItemType::Rect, shown_filament_color(libvgcode::convert(tool_colors[extruder_idx])), columns_offsets, false, checkbox_pos/*ORCA*/, true, []() {}); } i++; } @@ -5138,7 +5160,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv const size_t extruders_count = get_extruders_count(); std::vector last_color(extruders_count); for (size_t i = 0; i < extruders_count; ++i) { - last_color[i] = libvgcode::convert(m_viewer.get_tool_colors()[i]); + last_color[i] = shown_filament_color(libvgcode::convert(m_viewer.get_tool_colors()[i])); } int last_extruder_id = 1; int color_change_idx = 0; @@ -5160,6 +5182,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv items.push_back({ PartialTime::EType::Print, it->extruder, last_color[it->extruder - 1], ColorRGBA::BLACK(), time_rec.second, get_used_filament_from_volume(used_filaments[color_change_idx++], it->extruder - 1) }); ColorRGBA color; decode_color(it->color, color); + color = shown_filament_color(color); items.push_back({ PartialTime::EType::ColorChange, it->extruder, last_color[it->extruder - 1], color, time_rec.second }); last_color[it->extruder - 1] = color; last_extruder_id = it->extruder; @@ -5186,11 +5209,9 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImVec2 pos = ImGui::GetCursorScreenPos(); pos.x -= 0.5f * ImGui::GetStyle().ItemSpacing.x; - draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, - ImGuiWrapper::to_ImU32(color1)); + add_swatch(draw_list, { pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, color1); pos.x += icon_size; - draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, - ImGuiWrapper::to_ImU32(color2)); + add_swatch(draw_list, { pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, color2); ImGui::SameLine(offsets[0]); imgui.text(short_time(get_time_dhms(times.second - times.first))); @@ -5205,8 +5226,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImVec2 pos = ImGui::GetCursorScreenPos(); pos.x -= 0.5f * ImGui::GetStyle().ItemSpacing.x; - draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, - ImGuiWrapper::to_ImU32(color)); + add_swatch(draw_list, { pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, color); ImGui::SameLine(offsets[0]); imgui.text(short_time(get_time_dhms(times.second))); diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index c07b063cb1..554837747b 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -402,6 +402,8 @@ public: //BBS: GUI refactor: add canvas width and height // Shells, toolpaths, the sequential markers and the IDEX/IQEX toolhead boxes, drawn in 3D. void render_scene(int canvas_width, int canvas_height); + // ORCA: the toolpaths of translucent filaments, blended over the scene, then the markers. render_scene() leaves both out. + void render_translucent_toolpaths(int canvas_width, int canvas_height); // Legend, sliders, the marker's position window and the G-code window, all ImGui. void render_overlay(int canvas_width, int canvas_height, int right_margin); // ORCA: realistic view. Depth-only pass drawing the toolpaths as the light sees them, into @@ -414,6 +416,8 @@ public: // ORCA: section view void set_clipping_plane(const ClippingPlane& plane); void set_light_top_dir(const Vec3d& direction); + // ORCA: the untinted highlight of the filaments, which the canvas gives them in realistic view only + void set_gloss(bool gloss) { m_viewer.set_gloss(gloss); } //BBS // void _render_calibration_thumbnail_internal(ThumbnailData& thumbnail_data, const ThumbnailsParams& thumbnail_params, PartPlateList& partplate_list, OpenGLManager& opengl_manager); // void _render_calibration_thumbnail_framebuffer(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params, PartPlateList& partplate_list, OpenGLManager& opengl_manager); @@ -502,6 +506,8 @@ public: // ORCA: brightness of those darkened layers, 1.0 = unchanged, 0.0 = black void set_dim_previous_layers_brightness(float value) { m_viewer.set_dim_previous_layers_brightness(value); } float get_dim_previous_layers_brightness() const { return m_viewer.get_dim_previous_layers_brightness(); } + // ORCA: draw the toolpaths of translucent filament colors translucent + void set_translucent_filaments(bool value) { m_viewer.set_translucent_filaments(value); } void set_layers_z_range(const std::array& layers_z_range); @@ -534,7 +540,11 @@ private: // Canvas height minus the room the horizontal slider takes. int sequential_view_height(int canvas_height) const; void render_toolpaths(); + // The sequential markers and the IDEX/IQEX toolhead boxes. + void render_markers(int canvas_width, int canvas_height); void render_shells(int canvas_width, int canvas_height); + // ORCA: a filament color as the toolpaths show it, opaque unless translucent filaments are shown + ColorRGBA shown_filament_color(ColorRGBA color) const; //BBS: GUI refactor: add canvas size void render_legend(float &legend_height, int canvas_width, int canvas_height, int right_margin); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 95944a8da5..a005715c4f 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -103,6 +103,7 @@ #include "GUI_Colors.hpp" #include "Mouse3DController.hpp" #include "I18N.hpp" +#include "format.hpp" #include "NotificationManager.hpp" #include "DailyTips.hpp" #include "FilamentMapDialog.hpp" @@ -119,6 +120,10 @@ #include "slic3r/Utils/RetinaHelper.hpp" #endif +#ifdef __APPLE__ +#include "MacIME.hpp" +#endif + #include #include @@ -1885,27 +1890,31 @@ static std::pair construct_extruder_unprintable_error(ObjectFilament auto mode = object_result.mode; for (auto& obj_filament : object_result.object_filaments) { + bool found_left = false; + bool found_right = false; + if (mode == FilamentMapMode::fmmManual) { for (auto& elem : obj_filament.manual_filaments) { - bool found_left = false, found_right = false; - int filamnet_id = elem.first; int extruder_id = elem.second; - if (extruder_id == 1 && !found_left) { + if (extruder_id == 1) { found_left = true; - left_unprintable_objects.emplace_back(obj_filament); } - if (extruder_id == 2 && !found_right) { + if (extruder_id == 2) { found_right = true; - right_unprintable_objects.emplace_back(obj_filament); } } } else { if (!obj_filament.auto_filaments.empty()) { - left_unprintable_objects.emplace_back(obj_filament); - right_unprintable_objects.emplace_back(obj_filament); + found_left = true; + found_right = true; } } + + if (found_left) + left_unprintable_objects.emplace_back(obj_filament); + if (found_right) + right_unprintable_objects.emplace_back(obj_filament); } Preset &preset = GUI::wxGetApp().preset_bundle->printers.get_edited_preset(); @@ -1941,7 +1950,7 @@ static std::pair construct_extruder_unprintable_error(ObjectFilament model_prefix = (boost::format(_u8L("The position or size of some models exceeds the %s's printable range.")) % nozzle_name).str(); else model_prefix = (boost::format(_u8L("The position or size of the model %s exceeds the %s's printable range.")) - %object_result.object_filaments.front().object->name % nozzle_name).str(); + %unprintable_objs.front().object->name % nozzle_name).str(); tips[idx] += model_prefix; tips[idx] += (boost::format(_u8L(" Please check and adjust the part's position or size to fit the printable range:\n"))).str(); @@ -2804,19 +2813,29 @@ void GLCanvas3D::_render_scene(const Camera& camera, const Size& cnv_size) _render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(), show_axes); } m_frame_profiler.mark("bed"); - if (show_bed) //BBS: add outline logic + // Exception: the painting gizmos hide the bed mesh on purpose and draw the plate instead, + // so there the plate list is the only bed reference in the scene. + if (show_bed || _is_below_plate_view_active()) //BBS: add outline logic _render_platelist(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(), only_current, only_body, hover_id, true, show_grid); if (m_design_canvas && show_bed) // Design tab: replace the plate's corner-origin grid with the origin-centred CAD grid. _render_cad_grid(camera.get_view_matrix(), camera.get_projection_matrix()); m_frame_profiler.mark("plates"); - //BBS: add outline logic // Depth pass for object-on-object and self shadows; consumed by the gouraud shader below. _render_shadows(camera.get_view_matrix(), camera.get_projection_matrix()); m_frame_profiler.mark("shadows"); _render_objects(GLVolumeCollection::ERenderType::Opaque, !m_gizmos.is_running()); + _render_below_plate_volumes(); m_frame_profiler.mark("objects"); + // Collision previews follow the same visibility rule as the bed. + const bool show_exclusion_intersections = m_show_bed && + (!m_main_toolbar.is_enabled() || + (gizmo_type != GLGizmosManager::FdmSupports && gizmo_type != GLGizmosManager::Seam && + gizmo_type != GLGizmosManager::MmSegmentation && gizmo_type != GLGizmosManager::FuzzySkin)); + if (show_exclusion_intersections) + wxGetApp().plater()->get_partplate_list().render_exclusion_volume_intersections( + camera.get_view_matrix(), camera.get_projection_matrix()); _render_sla_slices(); _render_selection(); _render_objects(GLVolumeCollection::ERenderType::Transparent, !m_gizmos.is_running()); @@ -2887,6 +2906,11 @@ void GLCanvas3D::_render_scene(const Camera& camera, const Size& cnv_size) m_frame_profiler.mark("ssao"); } + if (m_canvas_type == ECanvasType::CanvasPreview && m_render_preview) { + _render_gcode_translucent(cnv_size.get_width(), cnv_size.get_height()); + m_frame_profiler.mark("gcode translucent"); + } + // After the occlusion pass, which would shade it as the surface behind it. m_center_of_mass.render(*this); @@ -3588,13 +3612,25 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re // psWipeTower, so gating on it would skip the clamp exactly when it is needed. { Vec3d clamped_pos, clamped_size; - part_plate->estimate_wipe_tower_polygon(full_config, plate_id, clamped_pos, clamped_size); + WipeTowerRelocation relocation; + part_plate->estimate_wipe_tower_polygon(full_config, plate_id, clamped_pos, clamped_size, 0, false, &relocation); if (std::abs(x - (float) clamped_pos(0)) > EPSILON || std::abs(y - (float) clamped_pos(1)) > EPSILON) { x = (float) clamped_pos(0); y = (float) clamped_pos(1); ConfigOptionFloat wt_x_opt(x), wt_y_opt(y); dynamic_cast(proj_cfg.option("wipe_tower_x"))->set_at(&wt_x_opt, plate_id, 0); dynamic_cast(proj_cfg.option("wipe_tower_y"))->set_at(&wt_y_opt, plate_id, 0); + // The stored position changes once, so this is shown once per move. + if (NotificationManager *notifications = wxGetApp().notification_manager(); notifications != nullptr && relocation.moved) { + if (relocation.overlaps_objects) + notifications->push_notification(NotificationType::CustomNotification, NotificationManager::NotificationLevel::WarningNotificationLevel, + // TRN %1% is the plate number. + format(_u8L("The prime tower on plate %1% no longer fits where it was placed. There is no free space left on the plate for it, so it was moved onto an object."), plate_id + 1)); + else + notifications->push_notification(NotificationType::CustomNotification, NotificationManager::NotificationLevel::RegularNotificationLevel, + // TRN %1% is the plate number. + format(_u8L("The prime tower on plate %1% no longer fits where it was placed, so it was moved to free space on the plate."), plate_id + 1)); + } } } @@ -3872,6 +3908,15 @@ void GLCanvas3D::bind_event_handlers() // The key-up that would commit a keyboard edit goes to whatever took the focus. if (m_selection_edit.kind != SelectionEdit::None) finish_selection_edit(); + release_held_modifiers(); + wxGetApp().imgui()->forget_key_claims(); +#ifdef __APPLE__ + // ImGuiWrapper stops updating the view once it is no longer the IME target. + if (ImGui::GetIO().ImeWindowHandle == m_canvas->GetHandle()) { + mac_ime_set_active(m_canvas->GetHandle(), false); + ImGui::GetIO().ImeWindowHandle = nullptr; + } +#endif ImGui::SetWindowFocus(nullptr); render(); evt.Skip(); @@ -4005,11 +4050,12 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) // see include/wx/defs.h enum wxKeyCode int keyCode = evt.GetKeyCode(); - auto imgui = wxGetApp().imgui(); - if (imgui->update_key_data(evt)) { + auto imgui = wxGetApp().imgui(); + const bool imgui_claimed = imgui->claim_key_event(evt); + if (imgui->update_key_data(evt) || imgui_claimed) render(); + if (imgui_claimed) return; - } // Design tab: Delete, Esc, Ctrl+Z/Y and F are NOT handled here. DesignPanel's CHAR_HOOK owns // them (one route per key, whatever holds focus) and only lets a key through to this canvas @@ -4300,20 +4346,41 @@ static bool key_repeats(int key) static void key_released(int key) { s_keys_down.erase(key); } +void GLCanvas3D::release_held_modifiers() +{ + for (const int key : { WXK_SHIFT, WXK_CONTROL, WXK_ALT }) { + if (s_keys_down.count(key) == 0) + continue; + wxKeyEvent release(wxEVT_KEY_UP); + release.m_keyCode = key; + on_key(release); + } +} + void GLCanvas3D::on_key(wxKeyEvent& evt) { +#ifdef __APPLE__ + // A key the input method used for a composition must not also edit the text field: Esc would revert + // it, Backspace delete a character, Enter add a line. + if (evt.GetEventType() == wxEVT_KEY_DOWN && mac_ime_owns_key(m_canvas->GetHandle())) + return; +#endif - const int keyCode = evt.GetKeyCode(); + auto imgui = wxGetApp().imgui(); + const int keyCode = evt.GetKeyCode(); + const bool imgui_claimed = imgui->claim_key_event(evt); if (evt.GetEventType() == wxEVT_KEY_DOWN) m_key_down = { keyCode, key_repeats(keyCode) }; else if (evt.GetEventType() == wxEVT_KEY_UP) key_released(keyCode); const bool alt_wheel_released = evt.GetEventType() == wxEVT_KEY_UP && keyCode == WXK_ALT && std::exchange(m_alt_wheel_used, false); - auto imgui = wxGetApp().imgui(); - if (imgui->update_key_data(evt)) + // ImGui closes a popup on Esc only through keyboard navigation, which is off. + if (imgui_claimed && evt.GetEventType() == wxEVT_KEY_DOWN && keyCode == WXK_ESCAPE) + imgui->close_top_popup(); + if (imgui->update_key_data(evt) || imgui_claimed) render(); - else + if (!imgui_claimed) { // Before the gizmos and the selection, which Esc also closes. if (evt.GetEventType() == wxEVT_KEY_DOWN && keyCode == WXK_ESCAPE && std::exchange(m_section_view->panel_open, false)) { @@ -4855,6 +4922,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // It should be detection of volume change // Not only detection of some modifiers !!! if (evt.Dragging()) { + if (PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate()) + plate->clear_exclusion_volume_intersections(); GLGizmosManager::EType c = m_gizmos.get_current_type(); if (current_printer_technology() == ptFFF && (fff_print()->config().print_sequence == PrintSequence::ByObject)) { @@ -5083,6 +5152,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) if (!m_mouse.drag.move_requires_threshold) { m_mouse.dragging = true; + if (PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate()) + plate->clear_exclusion_volume_intersections(); Vec3d cur_pos = m_mouse.drag.start_position_3D; // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag if (m_selection.contains_volume(get_first_hover_volume_idx())) { @@ -5464,6 +5535,10 @@ void GLCanvas3D::force_set_focus() { void GLCanvas3D::on_set_focus(wxFocusEvent& evt) { +#ifdef __APPLE__ + // The focused canvas is the one whose view takes input-method text (see ImGuiWrapper::end_frame()). + ImGui::GetIO().ImeWindowHandle = m_canvas->GetHandle(); +#endif m_tooltip_enabled = false; _refresh_if_shown_on_screen(); m_tooltip_enabled = true; @@ -5632,14 +5707,10 @@ void GLCanvas3D::do_move(const std::string& snapshot_type, bool force_volume_mov // Fixes sinking/flying instances (snaps object to buildplate) for (const std::pair& i : done) { ModelObject* mo = m_model->objects[i.first]; - - if (!mo->auto_drop) { - continue; - } const double shift_z = mo->get_instance_min_z(i.second); //BBS: don't call translate if the z is zero - if ((current_printer_technology() == ptSLA || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) { + if (mo->auto_drop && (current_printer_technology() == ptSLA || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) { const Vec3d shift(0.0, 0.0, -shift_z); m_selection.translate(i.first, i.second, shift); mo->translate_instance(i.second, shift); @@ -5763,14 +5834,10 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type) for (const std::pair &i : done) { ModelObject *mo = m_model->objects[i.first]; - if (!mo->auto_drop) { - continue; - } - // BBS: don't call translate if the z is zero const double shift_z = mo->get_instance_min_z(i.second); // leave sinking instances as sinking - if ((min_zs.find({i.first, i.second})->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) { + if (mo->auto_drop && (min_zs.find({i.first, i.second})->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) { const Vec3d shift(0.0, 0.0, -shift_z); m_selection.translate(i.first, i.second, shift); mo->translate_instance(i.second, shift); @@ -5865,14 +5932,10 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type) for (const std::pair& i : done) { ModelObject* mo = m_model->objects[i.first]; - if (!mo->auto_drop) { - continue; - } - //BBS: don't call translate if the z is zero double shift_z = mo->get_instance_min_z(i.second); // leave sinking instances as sinking - if ((min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) { + if (mo->auto_drop && (min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) { Vec3d shift(0.0, 0.0, -shift_z); m_selection.translate(i.first, i.second, shift); mo->translate_instance(i.second, shift); @@ -5985,14 +6048,10 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type) for (const std::pair& i : done) { ModelObject* mo = m_model->objects[i.first]; - if (!mo->auto_drop) { - continue; - } - //BBS: don't call translate if the z is zero double shift_z = mo->get_instance_min_z(i.second); // leave sinking instances as sinking - if ((min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD)&&(shift_z != 0.0f)) { + if (mo->auto_drop && (min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) { Vec3d shift(0.0, 0.0, -shift_z); m_selection.translate(i.first, i.second, shift); mo->translate_instance(i.second, shift); @@ -6205,6 +6264,13 @@ void GLCanvas3D::set_cursor(ECursorType type) void GLCanvas3D::mouse_up_cleanup() { + // Both direct dragging and gizmo manipulation clear the expensive red + // exclusion-intersection mesh while moving. Gizmo drags do not always set + // m_mouse.dragging, so every completed mouse operation must allow the + // cached preview to restore/recompute that mesh. + if (PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate()) + plate->invalidate_exclusion_volume_preview(); + m_moving = false; m_camera_movement = false; m_mouse.drag.move_volume_idx = -1; @@ -8840,6 +8906,84 @@ void GLCanvas3D::_render_bed(const Transform3d& view_matrix, const Transform3d& m_bed.render(*this, view_matrix, projection_matrix, bottom, scale_factor, show_axes); } +bool GLCanvas3D::_is_below_plate_view_active() const +{ + return dynamic_cast(m_gizmos.get_current()) != nullptr && m_gizmos.is_hiding_instances(); +} + +// The painting gizmo clips the selected object at the plate, so the part under the plate is not drawn. +// This pass draws that part of the selected instance again at 50% opacity, depth writes off. +void GLCanvas3D::_render_below_plate_volumes() +{ + if (!_is_below_plate_view_active() || m_volumes.empty()) + return; + + GLShaderProgram* shader = wxGetApp().get_shader("gouraud"); + if (shader == nullptr) + return; + + const Camera& camera = wxGetApp().plater()->get_camera(); + const Transform3d& view_matrix = camera.get_view_matrix(); + const Transform3d& proj_matrix = camera.get_projection_matrix(); + const int object_idx = m_selection.get_object_idx(); + const int instance_idx = m_selection.get_instance_idx(); + + // Depth test stays on so whatever is already in the depth buffer hides the ghost; depth writes + // are off and back faces are culled, so each pixel blends only the near surface once. + const GLboolean cull_face = ::glIsEnabled(GL_CULL_FACE); + glsafe(::glEnable(GL_DEPTH_TEST)); + glsafe(::glEnable(GL_CULL_FACE)); + glsafe(::glCullFace(GL_BACK)); + glsafe(::glDepthMask(GL_FALSE)); + glsafe(::glEnable(GL_BLEND)); + glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + + shader->start_using(); + // Keep z <= SINKING_Z_THRESHOLD, the complement of the clip the painting gizmo applies. + shader->set_uniform("z_range", std::array{ -FLT_MAX, float(SINKING_Z_THRESHOLD) }); + shader->set_uniform("clipping_plane", m_volumes.get_clipping_plane()); + shader->set_uniform("use_color_clip_plane", false); + shader->set_uniform("is_outline", false); + shader->set_uniform("slope.actived", false); + shader->set_uniform("print_volume.type", -1); + shader->set_uniform("extruder_printable_heights", std::array{ 0.0f, 0.0f, 0.0f }); + shader->set_uniform("shadow_intensity", 0.0f); + + // simple_render() needs these to reach the plain surface; with ban_color_volume it ignores both. + ModelObjectPtrs& model_objects = wxGetApp().model().objects; + std::vector extruder_colors = wxGetApp().plater()->get_extruders_colors(); + + for (GLVolume* volume : m_volumes.volumes) { + // is_active cannot gate this pass: the color painter marks the whole instance inactive and + // draws it in its own gizmo pass. The instance and print-part checks below are what pick + // this ghost out of the scene. + if (volume->object_idx() != object_idx || volume->instance_idx() != instance_idx || + volume->is_modifier || volume->is_wipe_tower || volume->volume_idx() < 0) + continue; + + volume->set_render_color(); + ColorRGBA color = volume->render_color; + color.a(0.5f); + volume->model.set_color(color); + + const Transform3d model_matrix = volume->world_matrix(); + shader->set_uniform("view_model_matrix", view_matrix * model_matrix); + shader->set_uniform("projection_matrix", proj_matrix); + shader->set_uniform("volume_world_matrix", model_matrix); + const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose(); + shader->set_uniform("view_normal_matrix", view_normal_matrix); + // Painted facets would send render() through the MMU segmentation sub-models, which carry + // their own opaque filament colours; the ghost draws the plain surface so the alpha holds. + volume->simple_render(shader, model_objects, extruder_colors, false, true); + } + shader->stop_using(); + + glsafe(::glDisable(GL_BLEND)); + glsafe(::glDepthMask(GL_TRUE)); + if (cull_face == GL_FALSE) + glsafe(::glDisable(GL_CULL_FACE)); +} + bool GLCanvas3D::_hides_inactive_plates() const { return m_canvas_type == ECanvasType::CanvasView3D && !m_design_canvas && wxGetApp().focus_mode(); @@ -9472,6 +9616,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with // Set on every use: the program is shared, so a canvas that leaves it unset would inherit // the last canvas's choice. shader->set_uniform("lighting_model", studio ? 1 : 0); + shader->set_uniform("translucent_gloss", realistic_mode); if (studio) { const Transform3d& view = wxGetApp().plater()->get_camera().get_view_matrix(); shader->set_uniform("world_up_eye", Vec3f((view.matrix().block<3, 3>(0, 0) * Vec3d::UnitZ()).cast())); @@ -9740,7 +9885,9 @@ void GLCanvas3D::_render_wireframe_overlay() glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)); #endif - m_volumes.render(GLVolumeCollection::ERenderType::Opaque, false, view_matrix, proj_matrix, sz); + m_volumes.render(GLVolumeCollection::ERenderType::All, false, view_matrix, proj_matrix, sz, [](const GLVolume& volume) { + return !volume.render_color.is_transparent() || (volume.visible && !volume.is_modifier && volume.color.is_transparent()); + }); #if !SLIC3R_OPENGL_ES glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)); @@ -9754,13 +9901,8 @@ void GLCanvas3D::_render_gcode(int canvas_width, int canvas_height) // Realistic view: the toolpaths receive the same depth map they were rendered into by // _render_shadows, which is what gives them object-on-object and self shadows. Intensity 0 // short-circuits the lookup in the shader, so this is inert whenever the map is missing. - const bool receive_shadows = m_shadow_map_valid && m_shadow_map_texture_id != 0 && m_shadow_map_size != 0; - if (receive_shadows) { - glsafe(::glActiveTexture(GL_TEXTURE4)); - glsafe(::glBindTexture(GL_TEXTURE_2D, m_shadow_map_texture_id)); - glsafe(::glActiveTexture(GL_TEXTURE0)); + if (_bind_gcode_shadow_map(true)) m_gcode_viewer.set_shadow_map(4, m_shadow_light_vp, 0.35f, 1.0f / static_cast(m_shadow_map_size)); - } else m_gcode_viewer.set_shadow_map(4, Transform3d::Identity(), 0.0f, 0.0f); @@ -9772,14 +9914,27 @@ void GLCanvas3D::_render_gcode(int canvas_width, int canvas_height) (_shadow_mode() != EShadowMode::Off || cfg->get_bool(SETTING_OPENGL_PHONG_SSAO)); m_gcode_viewer.set_tone(lossy_passes ? 1.1f : 1.0f, 1.15f); m_gcode_viewer.set_light_top_dir(_static_light_dir_eye().value_or(Vec3d(-0.4574957, 0.4574957, 0.7624929))); + m_gcode_viewer.set_gloss(_is_realistic_view_enabled() && cfg != nullptr && cfg->get_bool(SETTING_OPENGL_REALISTIC_GLOSS)); m_gcode_viewer.render_scene(canvas_width, canvas_height); + _bind_gcode_shadow_map(false); +} - if (receive_shadows) { - glsafe(::glActiveTexture(GL_TEXTURE4)); - glsafe(::glBindTexture(GL_TEXTURE_2D, 0)); - glsafe(::glActiveTexture(GL_TEXTURE0)); - } +void GLCanvas3D::_render_gcode_translucent(int canvas_width, int canvas_height) +{ + _bind_gcode_shadow_map(true); + m_gcode_viewer.render_translucent_toolpaths(canvas_width, canvas_height); + _bind_gcode_shadow_map(false); +} + +bool GLCanvas3D::_bind_gcode_shadow_map(bool bind) const +{ + if (!m_shadow_map_valid || m_shadow_map_texture_id == 0 || m_shadow_map_size == 0) + return false; + glsafe(::glActiveTexture(GL_TEXTURE4)); + glsafe(::glBindTexture(GL_TEXTURE_2D, bind ? m_shadow_map_texture_id : 0)); + glsafe(::glActiveTexture(GL_TEXTURE0)); + return true; } void GLCanvas3D::_render_gcode_overlay(int canvas_width, int canvas_height) @@ -11968,9 +12123,10 @@ bool GLCanvas3D::is_bed_visible() const if (!m_main_toolbar.is_enabled()) return true; - const auto type = m_gizmos.get_current_type(); - return type != GLGizmosManager::FdmSupports && type != GLGizmosManager::Seam && - type != GLGizmosManager::MmSegmentation && type != GLGizmosManager::FuzzySkin; + // The painting gizmos clip the selected instance at the plate (see InstancesHider), so the bed + // mesh would sit in front of the part below it. They draw the plate and its grid instead (see + // _render_scene) and the below-plate part as a translucent ghost. + return !_is_below_plate_view_active(); } Vec3d GLCanvas3D::get_camera_pan_anchor(Camera& camera, ECameraNavigationType navigation_type, diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index e483859824..f24fff0f2b 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -1275,6 +1275,8 @@ public: void on_idle(wxIdleEvent& evt); void on_char(wxKeyEvent& evt); void on_key(wxKeyEvent& evt); + // Sends a key-up for each modifier still held, whose own key-up is sent to the window that takes the focus. + void release_held_modifiers(); // Runs the Plater/Preview shortcut bound to chord, swallowing auto-repeats of one-shot // shortcuts; false when nothing is bound. bool handle_shortcut(const KeyChord& chord); @@ -1552,10 +1554,16 @@ private: void _render_imex_ghost_tooltip(); void _render_section_view_caps(); void _render_wireframe_overlay(); + bool _is_below_plate_view_active() const; + void _render_below_plate_volumes(); bool _is_xray_view_active() const; void _render_xray_volumes(); //BBS: GUI refactor: add canvas size as parameters void _render_gcode(int canvas_width, int canvas_height); + // The translucent toolpaths, after the occlusion pass, which would shade them as the surface behind them. + void _render_gcode_translucent(int canvas_width, int canvas_height); + // Realistic view: binds, or unbinds, the shadow map the toolpaths read on texture unit 4. False without a map. + bool _bind_gcode_shadow_map(bool bind) const; void _render_gcode_overlay(int canvas_width, int canvas_height); //BBS: render a plane for assemble void _render_plane() const; diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index e376bfc097..b7e41dac98 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -263,8 +263,18 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt } break; case coPoints:{ + if (opt_key == "bed_exclude_area" && boost::any_cast(&value) != nullptr) { + // Tab handles pasted volume syntax after this callback. Do not + // deserialize it as points: failure would erase the saved area + // before the user can accept or cancel the copy operation. + break; + } if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "thumbnails" || opt_key == "wrapping_exclude_area" ) { config.option(opt_key)->values = boost::any_cast>(value); + if (opt_key == "bed_exclude_area") { + ConfigOptionPoints normalized(boost::any_cast>(value)); + config.option(opt_key)->deserialize(normalized.serialize()); + } break; } auto vec_new = std::make_unique(boost::any_cast(value)); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index b9e119220c..38f602ab65 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -132,6 +132,7 @@ #include #include #include +#include #include #include @@ -139,6 +140,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -1294,6 +1298,32 @@ void GUI_App::shutdown() BOOST_LOG_TRIVIAL(info) << "GUI_App::shutdown exit"; } +void GUI_App::start_exit_watchdog() +{ + // Last resort for code that never returns while the app closes (plugins, vendor libraries, + // network calls). The app config is saved on idle and again in MainFrame::shutdown, so ending + // the process loses little; static destructors and atexit handlers are skipped too, as they may + // be what is stuck. + constexpr auto grace = std::chrono::seconds(30); + try { + // Made now: by the time the watchdog fires, static destruction may be under way. The logger + // holds its own reference, which keeps boost::log's core and sinks alive. + boost::log::sources::severity_logger_mt logger; + std::thread([grace, logger]() mutable { + std::this_thread::sleep_for(grace); + try { + BOOST_LOG_SEV(logger, boost::log::trivial::error) + << "OrcaSlicer did not finish closing within " << grace.count() << " s; ending the process"; + } catch (...) { + // A failing log sink must not stop the exit. + } + std::_Exit(EXIT_FAILURE); + }).detach(); + } catch (const std::system_error& ex) { + BOOST_LOG_TRIVIAL(warning) << "Could not start the exit watchdog: " << ex.what(); + } +} + std::string GUI_App::get_http_url(std::string country_code, std::string path) { @@ -3002,8 +3032,10 @@ void GUI_App::init_plugin_gui_wiring() }; // why: a newly loaded plugin only adds a selectable agent - // refresh the dropdown and leave the live agent alone - auto refresh_printer_agent_dropdown_after_load = [](const std::string&) + // refresh the dropdown and leave the live agent alone, unless it brought a printer connection + // the selected preset may be waiting for: plugins load asynchronously and can register their + // agent after the startup preset is applied + auto refresh_printer_agent_after_load = [](bool provides_printer_connection) { if (!wxTheApp) return; @@ -3012,10 +3044,14 @@ void GUI_App::init_plugin_gui_wiring() if (app->is_closing()) return; - app->CallAfter([app] + app->CallAfter([app, provides_printer_connection] { - if (!app->is_closing()) - app->refresh_printer_agent_dropdown(); + if (app->is_closing()) + return; + + if (provides_printer_connection) + app->switch_printer_agent_if_pending(); + app->refresh_printer_agent_dropdown(); }); }; @@ -3055,14 +3091,19 @@ void GUI_App::init_plugin_gui_wiring() return; wxGetApp().mainframe->plugin_pages().on_plugin_deregister(plugin_key); }); - plugin_mgr.subscribe_on_load_callback(refresh_printer_agent_dropdown_after_load); + plugin_mgr.subscribe_on_load_callback([refresh_printer_agent_after_load](const std::string& plugin_key) { + refresh_printer_agent_after_load(!PluginManager::instance() + .get_plugin_capabilities(plugin_key, PluginCapabilityType::PrinterConnection, + /*only_enabled=*/true) + .empty()); + }); plugin_mgr.subscribe_on_unload_callback(switch_printer_agent_after_unload); plugin_mgr.subscribe_on_capability_load_callback( - [refresh_plugins_dialog, refresh_printer_agent_dropdown_after_load](const PluginCapabilityId& capability) { + [refresh_plugins_dialog, refresh_printer_agent_after_load](const PluginCapabilityId& capability) { if (capability.type == PluginCapabilityType::PrinterConnection) NetworkAgentFactory::register_python_printer_agent(capability.plugin_key, capability.name); refresh_plugins_dialog(); - refresh_printer_agent_dropdown_after_load(capability.plugin_key); + refresh_printer_agent_after_load(capability.type == PluginCapabilityType::PrinterConnection); // A newly loaded capability may satisfy a missing-plugin notification; re-validate the // current plate (on the UI thread) so the notification clears once its plugin is available. if (wxTheApp && !wxGetApp().is_closing()) @@ -4236,6 +4277,12 @@ void GUI_App::switch_printer_agent() return; } + // why: installing an agent updates the sidebar and the main frame's print button; until the + // main window exists, load_current_presets() has not run Tab::on_presets_changed(), which + // installs the selected preset's agent once the window is up + if (!mainframe || !plater_) + return; + const DynamicPrintConfig& config = preset_bundle->printers.get_edited_preset().config; const std::string effective_agent_id = resolve_printer_agent_id(config.opt_string("printer_agent")); @@ -4303,6 +4350,21 @@ void GUI_App::switch_printer_agent() select_machine(effective_agent_id); } +void GUI_App::switch_printer_agent_if_pending() +{ + if (!m_agent || !preset_bundle) + return; + + const std::string wanted_agent_id = resolve_printer_agent_id(preset_bundle->printers.get_edited_preset().config.opt_string("printer_agent")); + const auto live_agent = m_agent->get_printer_agent(); + if (live_agent && live_agent->get_agent_info().id == wanted_agent_id) + return; + if (!NetworkAgentFactory::get_printer_agent_info(wanted_agent_id)) + return; + + switch_printer_agent(); +} + void GUI_App::select_machine(const std::string& agent_id) { // Skip for BBL agent for now - uses its own device discovery/selection @@ -4320,8 +4382,27 @@ void GUI_App::select_machine(const std::string& agent_id) const auto& preset = preset_bundle->printers.get_edited_preset(); const DynamicPrintConfig* host_cfg = &preset.config; + // Hands the machine to the Device tab's full selection flow (UI updates, callbacks, etc.). + auto select_dev = [this](const std::string& dev_id) { + if (MonitorPanel* monitor = MonitorPanel::if_built()) { + monitor->select_machine(dev_id); + BOOST_LOG_TRIVIAL(info) << "GUI_App::select_machine" << ": triggered select_machine for dev_id=" << dev_id; + } else if (m_device_manager->set_selected_machine(dev_id)) { + // The Device tab's own state is set when the tab is built. + MonitorPanel::on_machine_selected(m_device_manager->get_selected_machine()); + BOOST_LOG_TRIVIAL(info) << "GUI_App::select_machine" << ": set_selected_machine dev_id=" << dev_id; + } + }; + std::string print_host = host_cfg->opt_string("print_host"); if (print_host.empty()) { + // Orca: a printer bound from the Device tab is kept as a device of the agent rather than in + // the preset's print_host. Select it when it is the agent's only one, as + // MainFrame::load_printer_url() does; otherwise nothing is selected until the print dialog + // picks it, and filament sync has no printer to read from. + const auto machines = m_device_manager->get_my_machine_list(agent_id); + if (machines.size() == 1 && machines.begin()->second) + select_dev(machines.begin()->second->get_dev_id()); return; } std::string port = host_cfg->opt_string("printhost_port"); @@ -4368,17 +4449,7 @@ void GUI_App::select_machine(const std::string& agent_id) existing->set_access_code(access_code); } existing->local_use_ssl = boost::istarts_with(print_host, "https://"); - - // Use MonitorPanel::select_machine() to trigger full selection flow - // This reuses existing logic for machine switching (UI updates, callbacks, etc.) - if (MonitorPanel* monitor = MonitorPanel::if_built()) { - monitor->select_machine(dev_id); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": triggered select_machine for dev_id=" << dev_id; - } else if (m_device_manager->set_selected_machine(dev_id)) { - // The Device tab's own state is set when the tab is built. - MonitorPanel::on_machine_selected(m_device_manager->get_selected_machine()); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": set_selected_machine dev_id=" << dev_id; - } + select_dev(dev_id); } bool GUI_App::dark_mode() @@ -8998,7 +9069,8 @@ void GUI_App::open_preferences(PreferencesTab tab, const std::string& highlight_ // Render settings the canvas reads every frame; a change needs one redraw to show. static constexpr const char* opengl_render_setting_keys[] = { SETTING_OPENGL_FXAA_ENABLED, SETTING_OPENGL_FPS_CAP, SETTING_OPENGL_SHOW_FPS_OVERLAY, SETTING_OPENGL_SHOW_RENDER_TIMINGS, - SETTING_OPENGL_SCENE_CACHE, SETTING_OPENGL_SKIP_IDENTICAL_FRAMES, SETTING_OPENGL_REALISTIC_SHADOWS + SETTING_OPENGL_SCENE_CACHE, SETTING_OPENGL_SKIP_IDENTICAL_FRAMES, SETTING_OPENGL_REALISTIC_SHADOWS, + SETTING_OPENGL_REALISTIC_GLOSS }; std::vector previous_opengl_render_settings; for (const char* key : opengl_render_setting_keys) diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 33ac8f317f..6838bafcfb 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -411,7 +411,11 @@ public: const boost::optional& last_config_version() const { return m_last_config_version; } // Reconcile the live printer agent with the stored preset selection. + // No-op until the main window exists; the startup preset load installs the agent then. void switch_printer_agent(); + // Install the selected preset's agent if it is registered but not live, e.g. when its plugin + // finishes loading after the startup preset was applied. Otherwise leave the live agent alone. + void switch_printer_agent_if_pending(); std::string resolve_printer_agent_id(const std::string& stored_id) const; // ORCA TODO: in the future, bbl presets should specify "bbl" printer agent id @@ -431,6 +435,8 @@ public: bool is_closing() const { return m_is_closing.load(std::memory_order_acquire); } void set_closing(bool closing) { m_is_closing.store(closing, std::memory_order_release); } + // Called once closing can no longer be vetoed: ends the process if closing does not finish in time. + void start_exit_watchdog(); // SoftFever bool show_gcode_window() const { return m_show_gcode_window; } diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index c838b898f6..7cbb19440a 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -31,6 +31,7 @@ #include "slic3r/GUI/wxExtensions.hpp" #include #include +#include #include #include #include @@ -143,15 +144,17 @@ std::map> SettingsFactory::PART_CATE {"top_shell_layers", L("Top solid layers"), 1}, {"top_shell_thickness", L("Top minimum shell thickness"), 1}, {"top_surface_density", L("Top Surface Density"), 1}, + {"top_color_penetration_layers", "", 1}, {"bottom_shell_layers", L("Bottom solid layers"), 1}, {"bottom_shell_thickness", L("Bottom minimum shell thickness"), 1}, {"bottom_surface_density", L("Bottom Surface Density"), 1}, + {"bottom_color_penetration_layers", "", 1}, {"sparse_infill_density", "", 1}, {"fill_multiline", "", 1}, {"sparse_infill_pattern", "", 1}, - {"tpms_adaptive", "", 1}, - {"tpms_interior_density", "", 1}, - {"tpms_adaptive_gradient", "", 1}, + {"adaptive_infill_mode", "", 1}, + {"adaptive_infill_interior_density", "", 1}, + {"adaptive_infill_gradient", "", 1}, {"sparse_infill_smooth_factor", "", 1}, {"lateral_lattice_angle_1", "", 1}, {"lateral_lattice_angle_2", "", 1}, @@ -554,6 +557,17 @@ std::vector MenuFactory::get_svg_volume_bitmaps() return volume_bmps; } +size_t MenuFactory::FindPositionById(wxMenu* menu, int id) +{ + const wxMenuItemList& list = menu->GetMenuItems(); + size_t idx = 0; + for (auto node = list.GetFirst(); node; node = node->GetNext(), ++idx) { + if (node->GetData()->GetId() == id) + return idx; + } + return wxNOT_FOUND; // or list.GetCount() +} + void MenuFactory::append_menu_item_set_visible(wxMenu* menu) { bool has_one_shown = false; @@ -651,7 +665,7 @@ void MenuFactory::load_handy_model(std::size_t index) return; pl->load_files(input_files, LoadStrategy::LoadModel); if (model.arrange_after_import) { - pl->set_prepare_state(Job::PREPARE_STATE_MENU); + pl->set_prepare_state(Job::PREPARE_STATE_DEFAULT); pl->arrange(); } @@ -1178,7 +1192,7 @@ void MenuFactory::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* m [](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu); } -void MenuFactory::append_menu_items_flush_options(wxMenu* menu) +void MenuFactory::append_menu_items_flush_options(wxMenu* menu, size_t pos) { const wxString name = _L("Flush Options"); // Delete old menu item @@ -1260,15 +1274,7 @@ void MenuFactory::append_menu_items_flush_options(wxMenu* menu) return option->getBool(); }, m_parent); - size_t i = 0; - for (auto node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext()) - { - i++; - wxMenuItem* item = node->GetData(); - if (item->GetItemLabelText() == _L("Edit in Parameter Table")) - break; - } - menu->Insert(i, wxID_ANY, _L("Flush Options"), flush_options_menu); + menu->Insert(pos, wxID_ANY, _L("Flush Options"), flush_options_menu); } void MenuFactory::append_menu_items_convert_unit(wxMenu* menu) @@ -1342,29 +1348,95 @@ void MenuFactory::append_menu_item_merge_to_single_object(wxMenu* menu) []() { return obj_list()->can_merge_to_single_object(); }, m_parent); } -void MenuFactory::append_menu_item_merge_parts_to_single_part(wxMenu* menu) +wxMenu* MenuFactory::append_menu_item_transform(wxMenu* menu, bool multi_selection, bool show_mirror, bool is_scalable) { - menu->AppendSeparator(); - append_menu_item(menu, wxID_ANY, _L("Mesh boolean"), _L("Mesh boolean operations including union and subtraction"), - [](wxCommandEvent&) { obj_list()->boolean/*merge_volumes*/(); }, "", menu, - []() { return obj_list()->can_mesh_boolean(); }, m_parent); + wxMenu* sub_menu = new wxMenu(); + + if(show_mirror){ + // Mirror + append_menu_item(sub_menu, wxID_ANY, _L("Mirror") + ":", "", [](wxCommandEvent&){}, "", menu, [](){return false;}, m_parent); + append_menu_item(sub_menu, wxID_ANY, _L("Along X Axis"), _L("Mirror along the X axis"), + [](wxCommandEvent&) { plater()->mirror(X); }, "menu_mirror_x", m_parent); + append_menu_item(sub_menu, wxID_ANY, _L("Along Y Axis"), _L("Mirror along the Y axis"), + [](wxCommandEvent&) { plater()->mirror(Y); }, "menu_mirror_y", m_parent); + append_menu_item(sub_menu, wxID_ANY, _L("Along Z Axis"), _L("Mirror along the Z axis"), + [](wxCommandEvent&) { plater()->mirror(Z); }, "menu_mirror_z", m_parent); + } + + if(is_scalable){ + if(sub_menu->GetMenuItemCount() > 0) + sub_menu->AppendSeparator(); + append_menu_item_scale_selection_to_fit_print_volume(sub_menu); + sub_menu->AppendSeparator(); // Convert units will be added later + } + + append_submenu(menu, sub_menu, wxID_ANY, _L("Transform"), "", "", [](){return true;}, m_parent); + return sub_menu; } -void MenuFactory::append_menu_items_mirror(wxMenu* menu) +wxMenu* MenuFactory::append_menu_item_modify(wxMenu* menu, bool multi_selection, bool splittable, bool is_mesh, bool mesh_boolean) { - wxMenu* mirror_menu = new wxMenu(); - if (!mirror_menu) - return; + wxMenu* sub_menu = new wxMenu(); - append_menu_item(mirror_menu, wxID_ANY, _L("Along X Axis"), _L("Mirror along the X Axis"), - [](wxCommandEvent&) { plater()->mirror(X); }, "menu_mirror_x", menu); - append_menu_item(mirror_menu, wxID_ANY, _L("Along Y Axis"), _L("Mirror along the Y Axis"), - [](wxCommandEvent&) { plater()->mirror(Y); }, "menu_mirror_y", menu); - append_menu_item(mirror_menu, wxID_ANY, _L("Along Z Axis"), _L("Mirror along the Z Axis"), - [](wxCommandEvent&) { plater()->mirror(Z); }, "menu_mirror_z", menu); + if(splittable){ + // Object Split + append_menu_item(sub_menu, wxID_ANY, _L("Split") + ":", "", [](wxCommandEvent&){}, "", menu, [](){return false;}, m_parent); + append_menu_item(sub_menu, wxID_ANY, _L("To Objects"), _L("Split the selected object into multiple objects"), + [](wxCommandEvent&) { plater()->split_object(); }, "menu_split_objects", menu, + []() { return plater()->can_split(true); }, m_parent); + append_menu_item(sub_menu, wxID_ANY, _L("To Parts"), _L("Split the selected object into multiple parts"), + [](wxCommandEvent&) { plater()->split_volume(); }, "menu_split_parts", menu, + []() { return plater()->can_split(false); }, m_parent); + } - append_submenu(menu, mirror_menu, wxID_ANY, _L("Mirror"), _L("Mirror object"), "", - []() { return plater()->can_mirror(); }, m_parent); + if(mesh_boolean){ + if(sub_menu->GetMenuItemCount() > 0) + sub_menu->AppendSeparator(); + // Mesh Boolean + append_menu_item(sub_menu, wxID_ANY, _L("Mesh boolean"), _L("Mesh boolean operations including union and subtraction"), + [](wxCommandEvent&) { obj_list()->boolean/*merge_volumes*/(); }, "", menu, + []() { return obj_list()->can_mesh_boolean(); }, m_parent); + + } + + if(is_mesh){ + if(sub_menu->GetMenuItemCount() > 0) + sub_menu->AppendSeparator(); + if(!multi_selection){ // these doesnt support multiple items + // Object Simplify + append_menu_item_simplify(sub_menu); + // Mesh Smooth / Subdivision + append_menu_item_smooth_mesh(sub_menu); + sub_menu->AppendSeparator(); + } + // Object Repair + append_menu_item_fix_through_cgal(sub_menu); + } + + append_submenu(menu, sub_menu, wxID_ANY, _L("Modify"), "", "", [](){return true;}, m_parent); + return sub_menu; +} + +wxMenu* MenuFactory::append_menu_item_more(wxMenu* menu, bool multi_selection, bool disk_op, bool export_op) +{ + wxMenu* sub_menu = new wxMenu(); + + if(disk_op){ + // Reload from disk supports multi selection too (#16589) + append_menu_item_reload_from_disk(sub_menu); + sub_menu->AppendSeparator(); + if(!multi_selection) // "Replace with STL" only works on a single item + append_menu_item_replace_with_stl(sub_menu); + append_menu_item_replace_all_with_stl(sub_menu); + } + if(export_op){ + sub_menu->AppendSeparator(); + append_menu_item_export_stl(sub_menu, multi_selection); + append_menu_item_export_drc(sub_menu, multi_selection); + } + append_submenu(menu, sub_menu, wxID_ANY, _L("More"), "", "",[](){return true;}, m_parent); + + return sub_menu; } void MenuFactory::append_menu_item_precise_seam_submenu(wxMenu* menu) @@ -1492,7 +1564,7 @@ void MenuFactory::append_menu_item_precise_seam_submenu(wxMenu* menu) insert_pos); } -void MenuFactory::append_menu_item_edit_text(wxMenu *menu) +void MenuFactory::append_menu_item_edit_text(wxMenu *menu, size_t pos) { wxString name = _L("Edit text"); @@ -1513,8 +1585,13 @@ void MenuFactory::append_menu_item_edit_text(wxMenu *menu) if (menu != &m_text_part_menu) { const int menu_item_id = menu->FindItem(name); - if (menu_item_id != wxNOT_FOUND) + if (menu_item_id != wxNOT_FOUND) { + // Delete old menu item and the separator placed right after it + const size_t item_pos = FindPositionById(menu, menu_item_id); + if (item_pos != size_t(wxNOT_FOUND) && item_pos + 1 < menu->GetMenuItemCount() && menu->FindItemByPosition(item_pos + 1)->IsSeparator()) + menu->Destroy(menu->FindItemByPosition(item_pos + 1)); menu->Destroy(menu_item_id); + } if (!can_edit_text()) return; } @@ -1527,10 +1604,14 @@ void MenuFactory::append_menu_item_edit_text(wxMenu *menu) mng.open_gizmo(GLGizmosManager::Emboss); // close() and reopen - move to be visible mng.open_gizmo(GLGizmosManager::Emboss); }; - append_menu_item(menu, wxID_ANY, name, description, open_emboss, icon, nullptr, can_edit_text, m_parent); + append_menu_item(menu, wxID_ANY, name, description, open_emboss, icon, nullptr, can_edit_text, m_parent, pos); + if (pos == size_t(wxNOT_FOUND)) + menu->AppendSeparator(); + else + menu->InsertSeparator(pos + 1); } -void MenuFactory::append_menu_item_edit_svg(wxMenu *menu) +void MenuFactory::append_menu_item_edit_svg(wxMenu *menu, size_t pos) { wxString name = _L("Edit SVG"); auto can_edit_svg = []() { @@ -1550,8 +1631,13 @@ void MenuFactory::append_menu_item_edit_svg(wxMenu *menu) if (menu != &m_svg_part_menu) { const int menu_item_id = menu->FindItem(name); - if (menu_item_id != wxNOT_FOUND) + if (menu_item_id != wxNOT_FOUND) { + // Delete old menu item and the separator placed right after it + const size_t item_pos = FindPositionById(menu, menu_item_id); + if (item_pos != size_t(wxNOT_FOUND) && item_pos + 1 < menu->GetMenuItemCount() && menu->FindItemByPosition(item_pos + 1)->IsSeparator()) + menu->Destroy(menu->FindItemByPosition(item_pos + 1)); menu->Destroy(menu_item_id); + } if (!can_edit_svg()) return; } @@ -1564,21 +1650,34 @@ void MenuFactory::append_menu_item_edit_svg(wxMenu *menu) mng.open_gizmo(GLGizmosManager::Svg); // close() and reopen - move to be visible mng.open_gizmo(GLGizmosManager::Svg); }; - append_menu_item(menu, wxID_ANY, name, description, open_svg, icon, nullptr, can_edit_svg, m_parent); + append_menu_item(menu, wxID_ANY, name, description, open_svg, icon, nullptr, can_edit_svg, m_parent, pos); + if (pos == size_t(wxNOT_FOUND)) + menu->AppendSeparator(); + else + menu->InsertSeparator(pos + 1); } -void MenuFactory::append_menu_item_invalidate_cut_info(wxMenu *menu) +void MenuFactory::append_menu_item_invalidate_cut_info(wxMenu *menu, size_t pos) { const wxString menu_name = _L("Invalidate cut info"); auto menu_item_id = menu->FindItem(menu_name); - if (menu_item_id != wxNOT_FOUND) - // Delete old menu item if selected object isn't cut + if (menu_item_id != wxNOT_FOUND) { + // Delete old menu item (and the separator placed right after it) if selected object isn't cut + const size_t item_pos = FindPositionById(menu, menu_item_id); + if (item_pos != size_t(wxNOT_FOUND) && item_pos + 1 < menu->GetMenuItemCount() && menu->FindItemByPosition(item_pos + 1)->IsSeparator()) + menu->Destroy(menu->FindItemByPosition(item_pos + 1)); menu->Destroy(menu_item_id); + } - if (obj_list()->has_selected_cut_object()) + if (obj_list()->has_selected_cut_object()) { append_menu_item(menu, wxID_ANY, menu_name, "", [](wxCommandEvent &) { obj_list()->invalidate_cut_info_for_selection(); }, - "", menu, []() { return true; }, m_parent); + "cut_", menu, []() { return true; }, m_parent, pos); + if (pos == size_t(wxNOT_FOUND)) + menu->AppendSeparator(); + else + menu->InsertSeparator(pos + 1); + } } MenuFactory::MenuFactory() @@ -1613,9 +1712,16 @@ void MenuFactory::create_default_menu() void MenuFactory::create_common_object_menu(wxMenu* menu) { append_menu_item_rename(menu); + menu->AppendSeparator(); + append_menu_items_instance_manipulation(menu); + // Object Split / Mirror / Mesh Tools + append_menu_item_transform(menu, false /*multi_selection*/, true /*mirror*/, false /*is_scalable*/); + append_menu_item_modify(menu, false /*multi_selection*/, true /*splittable*/, true /*mesh*/, false /*mesh_boolean*/); + // Delete menu was moved to be after +/- instace to make it more difficult to be selected by mistake. + menu->AppendSeparator(); append_menu_item_delete(menu); menu->AppendSeparator(); @@ -1624,28 +1730,11 @@ void MenuFactory::create_common_object_menu(wxMenu* menu) append_menu_item_export_drc(menu); // "Scale to print volume" makes a sense just for whole object append_menu_item_scale_selection_to_fit_print_volume(menu); - - append_menu_item_fix_through_cgal(menu); - append_menu_items_mirror(menu); } void MenuFactory::create_object_menu() { create_common_object_menu(&m_object_menu); - wxMenu* split_menu = new wxMenu(); - if (!split_menu) - return; - - append_menu_item(split_menu, wxID_ANY, _L("To Objects"), _L("Split the selected object into multiple objects"), - [](wxCommandEvent&) { plater()->split_object(); }, "menu_split_objects", &m_object_menu, - []() { return plater()->can_split(true); }, m_parent); - append_menu_item(split_menu, wxID_ANY, _L("To Parts"), _L("Split the selected object into multiple parts"), - [](wxCommandEvent&) { plater()->split_volume(); }, "menu_split_parts", &m_object_menu, - []() { return plater()->can_split(false); }, m_parent); - - append_submenu(&m_object_menu, split_menu, wxID_ANY, _L("Split"), _L("Split the selected object"), "", - []() { return plater()->can_split(true) || plater()->can_split(false); }, m_parent); - m_object_menu.AppendSeparator(); // BBS: remove Layers Editing m_object_menu.AppendSeparator(); @@ -1655,88 +1744,69 @@ void MenuFactory::create_object_menu() void MenuFactory::create_extra_object_menu() { - // Object instances / conversions - append_menu_items_instance_manipulation(&m_object_menu); - m_object_menu.AppendSeparator(); - append_menu_item_instance_to_object(&m_object_menu); - m_object_menu.AppendSeparator(); - //append_menu_item_fill_bed(&m_object_menu); // Object Clone append_menu_item_clone(&m_object_menu); - // Object Repair - append_menu_item_fix_through_cgal(&m_object_menu); - // Object Simplify - append_menu_item_simplify(&m_object_menu); - // Object Mesh Subdivision - append_menu_item_smooth_mesh(&m_object_menu); - // merge to single part - append_menu_item_merge_parts_to_single_part(&m_object_menu); + + // Instances + auto instances = new wxMenu(); + if (!instances) return; + append_menu_items_instance_manipulation(instances); + instances->AppendSeparator(); + append_menu_item_instance_to_object(instances); + append_submenu(&m_object_menu, instances, wxID_ANY, _L("Instances"), "", "",[](){return true;}, m_parent); + + m_object_menu.AppendSeparator(); + // Object Center append_menu_item_center(&m_object_menu); + + append_menu_item_drop(&m_object_menu); + + m_object_transform_menu = append_menu_item_transform(&m_object_menu, false /*multi_selection*/, true /*mirror*/, true /*is_scalable*/); // Object Align/Distribute append_menu_item_align_distribute(&m_object_menu); - // Object Drop - append_menu_item_drop(&m_object_menu); - // Object Split - wxMenu* split_menu = new wxMenu(); - if (!split_menu) - return; - append_menu_item(split_menu, wxID_ANY, _L("To Objects"), _L("Split the selected object into multiple objects"), - [](wxCommandEvent&) { plater()->split_object(); }, "menu_split_objects", &m_object_menu, - []() { return plater()->can_split(true); }, m_parent); - append_menu_item(split_menu, wxID_ANY, _L("To Parts"), _L("Split the selected object into multiple parts"), - [](wxCommandEvent&) { plater()->split_volume(); }, "menu_split_parts", &m_object_menu, - []() { return plater()->can_split(false); }, m_parent); - - append_submenu(&m_object_menu, split_menu, wxID_ANY, _L("Split"), _L("Split the selected object"), "", - []() { return plater()->can_split(true); }, m_parent); - - // Mirror - append_menu_items_mirror(&m_object_menu); + append_menu_item_modify(&m_object_menu, false /*multi_selection*/, true /*splittable*/, true /*mesh*/, true /*mesh_boolean*/); + m_object_geometry_pos = m_object_menu.GetMenuItemCount(); // pos for property related items // Delete + m_object_menu.AppendSeparator(); append_menu_item_delete(&m_object_menu); m_object_menu.AppendSeparator(); + // Modifier Part // BBS append_menu_items_add_volume(&m_object_menu); - m_object_menu.AppendSeparator(); + + wxMenuItem* props_marker = m_object_menu.Append(wxID_ANY, "", "", wxITEM_SEPARATOR); // AppendSeparator() not assigns an id to item + m_object_props_marker = props_marker->GetId(); + // Set filament insert menu item here // Set Printable wxMenuItem* menu_item_printable = append_menu_item_printable(&m_object_menu); - m_object_menu.AppendSeparator(); wxMenuItem* menu_item_auto_drop = append_menu_item_auto_drop(&m_object_menu); m_object_menu.AppendSeparator(); append_menu_item_per_object_process(&m_object_menu); // Enter per object parameters append_menu_item_per_object_settings(&m_object_menu); + + // ORCA Utilities menu m_object_menu.AppendSeparator(); - append_menu_item_reload_from_disk(&m_object_menu); - append_menu_item_replace_with_stl(&m_object_menu); - append_menu_item_replace_all_with_stl(&m_object_menu); - append_menu_item_export_stl(&m_object_menu); - append_menu_item_export_drc(&m_object_menu); + append_menu_item_more(&m_object_menu, false /*multi_selection*/, true /*disk_op*/, true/*export_op*/); } void MenuFactory::create_bbl_assemble_object_menu() { // Delete append_menu_item_delete(&m_assemble_object_menu); - // Object Repair - append_menu_item_fix_through_cgal(&m_assemble_object_menu); - // Object Simplify - append_menu_item_simplify(&m_assemble_object_menu); - // Object Mesh Subdivision - append_menu_item_smooth_mesh(&m_assemble_object_menu); + m_assemble_object_menu.AppendSeparator(); + + append_menu_item_modify(&m_assemble_object_menu, false /*multi_selection*/, false /*splittable*/, true /*mesh*/, false /*mesh_boolean*/); m_assemble_object_menu.AppendSeparator(); } void MenuFactory::create_sla_object_menu() { create_common_object_menu(&m_sla_object_menu); - append_menu_item(&m_sla_object_menu, wxID_ANY, _L("Split"), _L("Split the selected object into multiple objects"), - [](wxCommandEvent&) { plater()->split_object(); }, "", nullptr, - []() { return plater()->can_split(true); }, m_parent); m_sla_object_menu.AppendSeparator(); @@ -1745,49 +1815,29 @@ void MenuFactory::create_sla_object_menu() [](wxCommandEvent&) { plater()->optimize_rotation(); }); } -void MenuFactory::create_part_menu() -{ - wxMenu* menu = &m_part_menu; - append_menu_item_rename(menu); - append_menu_item_delete(menu); - append_menu_item_reload_from_disk(menu); - append_menu_item_export_stl(menu); - append_menu_item_export_drc(menu); - append_menu_item_fix_through_cgal(menu); - append_menu_items_mirror(menu); - append_menu_item_merge_parts_to_single_part(menu); - - append_menu_item(menu, wxID_ANY, _L("Split"), _L("Split the selected object into multiple parts"), - [](wxCommandEvent&) { plater()->split_volume(); }, "split_parts", nullptr, - []() { return plater()->can_split(false); }, m_parent); - - menu->AppendSeparator(); - append_menu_item_change_type(menu); - append_menu_item_precise_seam_submenu(menu); - append_menu_items_mirror(&m_part_menu); - append_menu_item(&m_part_menu, wxID_ANY, _L("Split"), _L("Split the selected object into multiple parts"), - [](wxCommandEvent&) { plater()->split_volume(); }, "split_parts", nullptr, - []() { return plater()->can_split(false); }, m_parent); - m_part_menu.AppendSeparator(); - append_menu_item_per_object_process(&m_part_menu); - append_menu_item_per_object_settings(&m_part_menu); -} - void MenuFactory::create_text_part_menu() { wxMenu* menu = &m_text_part_menu; append_menu_item_edit_text(menu); - append_menu_item_delete(menu); - append_menu_item_fix_through_cgal(menu); - append_menu_item_simplify(menu); + append_menu_item_center(menu); append_menu_item_align_distribute(menu); - append_menu_items_mirror(menu); + append_menu_item_transform(&m_text_part_menu, false /*multi_selection*/, true /*mirror*/, false /*is_scalable*/); + append_menu_item_modify(&m_text_part_menu, false /*multi_selection*/, false /*splittable*/, true /*mesh*/, false /*mesh_boolean*/); + + //m_text_geometry_pos = m_text_part_menu.GetMenuItemCount(); // pos for geometry related items + menu->AppendSeparator(); - append_menu_item_per_object_process(menu); - append_menu_item_per_object_settings(menu); + append_menu_item_delete(menu); + menu->AppendSeparator(); + append_menu_item_change_type(menu); + m_text_props_marker = menu->FindItem(_L("Change Type")); // dynamic property items are inserted after this item + menu->AppendSeparator(); + + append_menu_item_per_object_process(menu); + m_text_project_marker = menu->FindItem(_L("Paste Process Settings")); // append_menu_item_per_object_settings() is inserted after this item } void MenuFactory::create_svg_part_menu() @@ -1795,49 +1845,52 @@ void MenuFactory::create_svg_part_menu() wxMenu* menu = &m_svg_part_menu; append_menu_item_edit_svg(menu); - append_menu_item_delete(menu); - append_menu_item_fix_through_cgal(menu); - append_menu_item_simplify(menu); - append_menu_items_mirror(menu); + + append_menu_item_center(menu); + append_menu_item_align_distribute(menu); + append_menu_item_transform(&m_svg_part_menu, false /*multi_selection*/, true /*mirror*/, false /*is_scalable*/); + append_menu_item_modify(&m_svg_part_menu, false /*multi_selection*/, false /*splittable*/, true /*mesh*/, false /*mesh_boolean*/); + + //m_svg_geometry_pos = m_svg_part_menu.GetMenuItemCount(); // pos for geometry related items + menu->AppendSeparator(); - append_menu_item_per_object_process(menu); - append_menu_item_per_object_settings(menu); + append_menu_item_delete(menu); + menu->AppendSeparator(); + append_menu_item_change_type(menu); + m_svg_props_marker = menu->FindItem(_L("Change Type")); // dynamic property items are inserted after this item + menu->AppendSeparator(); + + append_menu_item_per_object_process(menu); + m_svg_project_marker = menu->FindItem(_L("Paste Process Settings")); // append_menu_item_per_object_settings() is inserted after this item } void MenuFactory::create_bbl_part_menu() { wxMenu* menu = &m_part_menu; - append_menu_item_delete(menu); - append_menu_item_edit_text(menu); - append_menu_item_fix_through_cgal(menu); - append_menu_item_simplify(menu); - append_menu_item_smooth_mesh(menu); append_menu_item_center(menu); + append_menu_item_drop(&m_part_menu); + + m_part_transform_menu = append_menu_item_transform(&m_part_menu, false /*multi_selection*/, true /*mirror*/, true /*is_scalable*/); append_menu_item_align_distribute(menu); - append_menu_item_drop(menu); - append_menu_items_mirror(menu); - wxMenu* split_menu = new wxMenu(); - if (!split_menu) - return; + append_menu_item_modify(&m_part_menu, false /*multi_selection*/, true /*splittable*/, true /*mesh*/, false /*mesh_boolean*/); + append_menu_item_edit_text(menu); + //m_part_geometry_pos = m_part_menu.GetMenuItemCount(); // pos for geometry related items - append_menu_item(split_menu, wxID_ANY, _L("To Objects"), _L("Split the selected object into multiple objects"), - [](wxCommandEvent&) { plater()->split_object(); }, "menu_split_objects", menu, - []() { return plater()->can_split(true); }, m_parent); - append_menu_item(split_menu, wxID_ANY, _L("To Parts"), _L("Split the selected object into multiple parts"), - [](wxCommandEvent&) { plater()->split_volume(); }, "menu_split_parts", menu, - []() { return plater()->can_split(false); }, m_parent); - - append_submenu(menu, split_menu, wxID_ANY, _L("Split"), _L("Split the selected object"), "", - []() { return plater()->can_split(true); }, m_parent); menu->AppendSeparator(); - append_menu_item_per_object_process(menu); - append_menu_item_per_object_settings(menu); + append_menu_item_delete(menu); + menu->AppendSeparator(); + append_menu_item_change_type(menu); - append_menu_item_reload_from_disk(menu); - append_menu_item_replace_with_stl(menu); - append_menu_item_replace_all_with_stl(menu); + m_part_props_marker = menu->FindItem(_L("Change Type")); // dynamic property items are inserted after this item + menu->AppendSeparator(); + + append_menu_item_per_object_process(menu); + m_part_project_marker = menu->FindItem(_L("Paste Process Settings")); // append_menu_item_per_object_settings() is inserted after this item + + menu->AppendSeparator(); + append_menu_item_more(&m_part_menu, false /*multi_selection*/, true /*disk_op*/, false /*export_op*/); } void MenuFactory::create_bbl_assemble_part_menu() @@ -1920,9 +1973,10 @@ void MenuFactory::create_plate_menu() [](wxCommandEvent&) { plater()->select_all(); }, "", nullptr, []() { - return !plater()->model().objects.empty(); + return !plater()->model().objects.empty() && plater()->can_delete_plate(); // also disable when only one plate exist }, m_parent); + menu->AppendSeparator(); // delete objects on current plate append_menu_item(menu, wxID_ANY, _L("Delete All"), _L("Delete all objects on the current plate"), [](wxCommandEvent&) { @@ -1933,6 +1987,8 @@ void MenuFactory::create_plate_menu() return !plate->get_objects().empty(); }, m_parent); + menu->AppendSeparator(); + // arrange objects on current plate append_menu_item(menu, wxID_ANY, _L("Arrange"), _L("Arrange current plate"), [](wxCommandEvent&) { @@ -1946,33 +2002,11 @@ void MenuFactory::create_plate_menu() }, m_parent); - // reload all objects on current plate - append_menu_item( - menu, wxID_ANY, _L("Reload All"), _L("Reload all from disk"), - [](wxCommandEvent&) { - PartPlate* plate = plater()->get_partplate_list().get_selected_plate(); - assert(plate); - plater()->set_prepare_state(Job::PREPARE_STATE_MENU); - plater()->reload_all_from_disk(); - }, - "", nullptr, []() { return !plater()->get_partplate_list().get_selected_plate()->get_objects().empty(); }, m_parent); - - // fix objects on current plate - append_menu_item(menu, wxID_ANY, _L("Fix All"), _L("Fix all models on the current plate"), - [](wxCommandEvent&) { obj_list()->fix_all_through_cgal(false); }, "", nullptr, - []() { return !plater()->get_partplate_list().get_selected_plate()->empty(); }, m_parent); - - // fix objects on all plates - append_menu_item(menu, wxID_ANY, _L("Fix All Plates"), _L("Fix all models on all plates"), - [](wxCommandEvent&) { obj_list()->fix_all_through_cgal(true); }, "", nullptr, - []() { return !plater()->model().objects.empty(); }, m_parent); - // orient objects on current plate append_menu_item(menu, wxID_ANY, _L("Auto Rotate"), _L("Auto rotate current plate"), [](wxCommandEvent&) { PartPlate* plate = plater()->get_partplate_list().get_selected_plate(); assert(plate); - //BBS TODO call auto rotate for current plate plater()->set_prepare_state(Job::PREPARE_STATE_MENU); plater()->orient(); }, "", nullptr, @@ -1980,17 +2014,24 @@ void MenuFactory::create_plate_menu() return !plater()->get_partplate_list().get_selected_plate()->get_objects().empty(); }, m_parent); - // delete current plate -#ifdef __WINDOWS__ - append_menu_item(menu, wxID_ANY, _L("Delete Plate"), _L("Remove the selected plate"), - [](wxCommandEvent&) { plater()->delete_plate(); }, "menu_delete", nullptr, - []() { return plater()->can_delete_plate(); }, m_parent); -#else - append_menu_item(menu, wxID_ANY, _L("Delete Plate"), _L("Remove the selected plate"), - [](wxCommandEvent&) { plater()->delete_plate(); }, "", nullptr, - []() { return plater()->can_delete_plate(); }, m_parent); -#endif + wxMenu* modify_menu = new wxMenu(); + // fix objects on current plate + append_menu_item(modify_menu, wxID_ANY, _L("Fix All"), _L("Fix all models on the current plate"), + [](wxCommandEvent&) { obj_list()->fix_all_through_cgal(false); }, "", nullptr, + []() { return !plater()->get_partplate_list().get_selected_plate()->empty(); }, m_parent); + + // fix objects on all plates + append_menu_item(modify_menu, wxID_ANY, _L("Fix All Plates"), _L("Fix all models on all plates"), + [](wxCommandEvent&) { obj_list()->fix_all_through_cgal(true); }, "", nullptr, + []() { return !plater()->model().objects.empty(); }, m_parent); + + append_submenu(menu, modify_menu, wxID_ANY, _L("Modify"), "", "", + [](){ return !plater()->model().objects.empty(); }, m_parent); + + menu->AppendSeparator(); + + m_plate_mods_pos = menu->GetMenuItemCount(); // pos for dynamic plate items (Edit Plate Name / Lock / Delete Plate) // add shapes menu->AppendSeparator(); @@ -2005,9 +2046,20 @@ void MenuFactory::create_plate_menu() [](wxCommandEvent&) { plater()->add_file(); }, "menu_add_part", menu, []() {return wxGetApp().plater()->can_add_model(); }, m_parent); + menu->AppendSeparator(); + // reload all objects on current plate + append_menu_item( + menu, wxID_ANY, _L("Reload All"), _L("Reload all from disk"), + [](wxCommandEvent&) { + PartPlate* plate = plater()->get_partplate_list().get_selected_plate(); + assert(plate); + plater()->set_prepare_state(Job::PREPARE_STATE_MENU); + plater()->reload_all_from_disk(); + }, + "", nullptr, []() { return !plater()->get_partplate_list().get_selected_plate()->get_objects().empty(); }, m_parent); + menu->AppendSeparator(); append_menu_item_replace_all_with_stl(menu); - return; } @@ -2019,7 +2071,6 @@ void MenuFactory::init(wxWindow* parent) //BBS //create_object_menu(); create_sla_object_menu(); - //create_part_menu(); create_text_part_menu(); create_svg_part_menu(); create_extra_object_menu(); @@ -2049,12 +2100,18 @@ wxMenu* MenuFactory::default_menu() wxMenu* MenuFactory::object_menu() { - append_menu_items_convert_unit(&m_object_menu); - append_menu_items_flush_options(&m_object_menu); - append_menu_item_invalidate_cut_info(&m_object_menu); - append_menu_item_edit_text(&m_object_menu); - append_menu_item_edit_svg(&m_object_menu); - append_menu_item_change_filament(&m_object_menu); + append_menu_items_convert_unit(m_object_transform_menu); + + // GEOMETRY + append_menu_item_invalidate_cut_info(&m_object_menu, 0); // inserts itself to top of menu + append_menu_item_edit_text( &m_object_menu, 0); // inserts itself to top of menu + append_menu_item_edit_svg( &m_object_menu, 0); // inserts itself to top of menu + + // PROPS > Place items above printable + size_t props_pos = FindPositionById(&m_object_menu, m_object_props_marker); // stored positions not works as expected since menu has multiple dynamic sections + append_menu_item_change_filament(&m_object_menu, props_pos + 1); + append_menu_items_flush_options (&m_object_menu, props_pos + 2); + return &m_object_menu; } @@ -2063,33 +2120,35 @@ wxMenu* MenuFactory::sla_object_menu() append_menu_items_convert_unit(&m_sla_object_menu); append_menu_item_settings(&m_sla_object_menu); //update_menu_items_instance_manipulation(mtObjectSLA); - append_menu_item_edit_text(&m_sla_object_menu); - append_menu_item_edit_svg(&m_object_menu); + append_menu_item_edit_text(&m_sla_object_menu, 0); // inserts itself to top of menu + append_menu_item_edit_svg(&m_sla_object_menu, 0); // inserts itself to top of menu return &m_sla_object_menu; } wxMenu* MenuFactory::part_menu() { - append_menu_items_convert_unit(&m_part_menu); - append_menu_item_change_filament(&m_part_menu); + append_menu_items_convert_unit(m_part_transform_menu); + + // stored positions not works as expected since menu has multiple dynamic sections + append_menu_item_per_object_settings(&m_part_menu, FindPositionById(&m_part_menu, m_part_project_marker) + 1); + append_menu_item_change_filament(&m_part_menu, FindPositionById(&m_part_menu, m_part_props_marker) + 1); append_menu_item_precise_seam_submenu(&m_part_menu); - append_menu_item_per_object_settings(&m_part_menu); return &m_part_menu; } wxMenu* MenuFactory::text_part_menu() { - append_menu_item_change_filament(&m_text_part_menu); - append_menu_item_per_object_settings(&m_text_part_menu); + append_menu_item_per_object_settings(&m_text_part_menu, FindPositionById(&m_text_part_menu, m_text_project_marker) + 1); + append_menu_item_change_filament(&m_text_part_menu, FindPositionById(&m_text_part_menu, m_text_props_marker) + 1); return &m_text_part_menu; } wxMenu *MenuFactory::svg_part_menu() { - append_menu_item_change_filament(&m_svg_part_menu); - append_menu_item_per_object_settings(&m_svg_part_menu); + append_menu_item_per_object_settings(&m_svg_part_menu, FindPositionById(&m_svg_part_menu, m_svg_project_marker) + 1); + append_menu_item_change_filament(&m_svg_part_menu, FindPositionById(&m_svg_part_menu, m_svg_props_marker) + 1); return &m_svg_part_menu; } @@ -2138,63 +2197,64 @@ wxMenu* MenuFactory::multi_selection_menu() int index = 0; if (obj_list()->can_merge_to_multipart_object()) { append_menu_item_merge_to_multipart_object(menu); + menu->AppendSeparator(); index++; } append_menu_item_center(menu); - append_menu_item_align_distribute(menu); append_menu_item_drop(menu); + + auto transform_menu = append_menu_item_transform(menu, true /*multi_selection*/, false /*mirror*/, true /*is_scalable*/); + append_menu_items_convert_unit(transform_menu); + append_menu_item_align_distribute(menu); + //ORCA switch to sub menus if new items added + //append_menu_item_modify(menu, true /*multi_selection*/, false /*splittable*/, true /*is_mesh*/, false /*mesh_boolean*/); append_menu_item_fix_through_cgal(menu); //append_menu_item_simplify(menu); + menu->AppendSeparator(); append_menu_item_delete(menu); menu->AppendSeparator(); + append_menu_item_change_filament(menu); append_menu_item_set_printable(menu); - menu->AppendSeparator(); - append_menu_item_set_auto_drop(menu); menu->AppendSeparator(); append_menu_item_per_object_process(menu); menu->AppendSeparator(); - append_menu_items_convert_unit(menu); - append_menu_item_replace_all_with_stl(menu); - //BBS - append_menu_item_change_filament(menu); - menu->AppendSeparator(); - append_menu_item_export_stl(menu, true); - append_menu_item_export_drc(menu, true); + // Reload from disk / Replace all with STL / Export STL / Export DRC + append_menu_item_more(menu, true /*multi_selection*/, true /*disk_op*/, true /*export_op*/); } else { append_menu_item_center(menu); - append_menu_item_align_distribute(menu); append_menu_item_drop(menu); - append_menu_item_fix_through_cgal(menu); - //append_menu_item_simplify(menu); - append_menu_item_delete(menu); - append_menu_items_convert_unit(menu); - append_menu_item_replace_all_with_stl(menu); - append_menu_item_change_filament(menu); - wxMenu* split_menu = new wxMenu(); - if (split_menu) { - append_menu_item(split_menu, wxID_ANY, _L("To Objects"), _L("Split the selected object into multiple objects"), - [](wxCommandEvent&) { plater()->split_object(); }, "menu_split_objects", menu, - []() { return plater()->can_split(true); }, m_parent); - append_menu_item(split_menu, wxID_ANY, _L("To Parts"), _L("Split the selected object into multiple parts"), - [](wxCommandEvent&) { plater()->split_volume(); }, "menu_split_parts", menu, - []() { return plater()->can_split(false); }, m_parent); - append_submenu(menu, split_menu, wxID_ANY, _L("Split"), _L("Split the selected object"), "", - []() { return plater()->can_split(true); }, m_parent); - } - append_menu_item_per_object_process(menu); + //ORCA switch to sub menus if new items added + auto transform_menu = append_menu_item_transform(menu, true /*multi_selection*/, false /*mirror*/, true /*is_scalable*/); + append_menu_item_align_distribute(menu); + append_menu_item_modify(menu, true /*multi_selection*/, true /*splittable*/, true /*is_mesh*/, false /*mesh_boolean*/); + //append_menu_item_drop(menu); + //append_menu_item_fix_through_cgal(menu); + append_menu_items_convert_unit(transform_menu); + //append_menu_item_simplify(menu); menu->AppendSeparator(); + append_menu_item_delete(menu); + menu->AppendSeparator(); + + append_menu_item_change_filament(menu); append_menu_item_change_type(menu); // Subtype picker for Precise Seam — shown only when all selected volumes are PS. // Must be paired with Change Type here (as in single-volume part_menu), otherwise // the user cannot switch PS subtypes (LEFT/RIGHT/etc.) on multi-selection. - append_menu_item_precise_seam_submenu(menu); - append_menu_item_change_filament(menu); + append_menu_item_precise_seam_submenu(menu); // inserts itself right after "Change Type" + append_menu_item_set_auto_drop(menu); + menu->AppendSeparator(); + + append_menu_item_per_object_process(menu); + menu->AppendSeparator(); + + // Reload from disk / Replace all with STL + append_menu_item_more(menu, true /*multi_selection*/, true /*disk_op*/, false /*export_op*/); } return menu; } @@ -2213,6 +2273,7 @@ wxMenu* MenuFactory::assemble_multi_selection_menu() append_menu_item_set_visible(menu); //append_menu_item_fix_through_cgal(menu); //append_menu_item_simplify(menu); + menu->AppendSeparator(); append_menu_item_delete(menu); menu->AppendSeparator(); append_menu_item_change_extruder(menu); @@ -2248,8 +2309,9 @@ wxMenu *MenuFactory::filament_action_menu(int active_filament_menu_id) { //BBS: add partplate related logic wxMenu* MenuFactory::plate_menu() { - append_menu_item_locked(&m_plate_menu); - append_menu_item_plate_name(&m_plate_menu); + append_menu_item_plate_name( &m_plate_menu, m_plate_mods_pos); + append_menu_item_locked( &m_plate_menu, m_plate_mods_pos + 1); + append_menu_item_plate_delete(&m_plate_menu, m_plate_mods_pos + 2); return &m_plate_menu; } @@ -2259,6 +2321,7 @@ wxMenu* MenuFactory::assemble_object_menu() // Set Visible append_menu_item_set_visible(menu); // Delete + menu->AppendSeparator(); append_menu_item_delete(menu); //// Object Repair //append_menu_item_fix_through_cgal(menu); @@ -2278,6 +2341,7 @@ wxMenu* MenuFactory::assemble_part_menu() wxMenu* menu = new MenuWithSeparators(); append_menu_item_set_visible(menu); + menu->AppendSeparator(); append_menu_item_delete(menu); //append_menu_item_simplify(menu); menu->AppendSeparator(); @@ -2445,7 +2509,7 @@ void MenuFactory::append_menu_item_per_object_process(wxMenu* menu) m_parent); } -void MenuFactory::append_menu_item_per_object_settings(wxMenu* menu) +void MenuFactory::append_menu_item_per_object_settings(wxMenu* menu, size_t pos) { const std::vector names = { _L("Edit in Parameter Table"), _L("Edit print parameters for a single object") }; // Delete old menu item @@ -2462,10 +2526,10 @@ void MenuFactory::append_menu_item_per_object_settings(wxMenu* menu) []() { Selection& selection = plater()->canvas3D()->get_selection(); return selection.is_single_full_object() || selection.is_single_full_instance() || selection.is_single_volume(); - }, m_parent); + }, m_parent, pos); } -void MenuFactory::append_menu_item_change_filament(wxMenu* menu) +void MenuFactory::append_menu_item_change_filament(wxMenu* menu, size_t pos) { const std::vector names = { _L("Change Filament"), _L("Set Filament for selected items") }; // Delete old menu item @@ -2546,7 +2610,10 @@ void MenuFactory::append_menu_item_change_filament(wxMenu* menu) [i](wxCommandEvent&) { obj_list()->set_extruder_for_selected_items(i); }, i == 0 ? wxNullBitmap : *icons[i - 1], menu, [is_active_extruder]() { return !is_active_extruder; }, m_parent); } - menu->Append(wxID_ANY, name, extruder_selection_menu, _L("Change Filament")); + if (pos == wxNOT_FOUND) + menu->Append(wxID_ANY, name, extruder_selection_menu); + else + menu->Insert(pos, wxID_ANY, name, extruder_selection_menu, _L("Change Filament")); } void MenuFactory::append_menu_item_set_printable(wxMenu* menu) @@ -2602,7 +2669,7 @@ void MenuFactory::append_menu_item_set_auto_drop(wxMenu* menu) menu_item_set_auto_drop->GetId()); } -void MenuFactory::append_menu_item_locked(wxMenu* menu) +void MenuFactory::append_menu_item_locked(wxMenu* menu, size_t pos) { const std::vector names = { _L("Unlock"), _L("Lock") }; // Delete old menu item @@ -2620,7 +2687,7 @@ void MenuFactory::append_menu_item_locked(wxMenu* menu) [plate](wxCommandEvent&) { bool lock = plate->is_locked(); plate->lock(!lock); - }, "", nullptr, []() { return true; }, m_parent); + }, "", nullptr, []() { return true; }, m_parent, pos); m_parent->Bind(wxEVT_UPDATE_UI, [](wxUpdateUIEvent& evt) { PartPlate* plate = plater()->get_partplate_list().get_selected_plate(); @@ -2631,7 +2698,7 @@ void MenuFactory::append_menu_item_locked(wxMenu* menu) }, item->GetId()); } -void MenuFactory::append_menu_item_plate_name(wxMenu *menu) +void MenuFactory::append_menu_item_plate_name(wxMenu *menu, size_t pos) { wxString name= _L("Edit Plate Name"); // Delete old menu item @@ -2655,7 +2722,7 @@ void MenuFactory::append_menu_item_plate_name(wxMenu *menu) } plater()->get_current_canvas3D()->post_event(SimpleEvent(EVT_GLCANVAS_PLATE_NAME_CHANGE)); }, - "", nullptr, []() { return true; }, m_parent); + "", nullptr, []() { return true; }, m_parent, pos); m_parent->Bind( wxEVT_UPDATE_UI, @@ -2667,6 +2734,32 @@ void MenuFactory::append_menu_item_plate_name(wxMenu *menu) item->GetId()); } +void MenuFactory::append_menu_item_plate_delete(wxMenu *menu, size_t pos) +{ + wxString name= _L("Delete Plate"); + // Delete old menu item and the separator placed right before it + const int item_id = menu->FindItem(name); + if (item_id != wxNOT_FOUND) { + const size_t item_pos = FindPositionById(menu, item_id); + if (item_pos != size_t(wxNOT_FOUND) && item_pos > 0 && menu->FindItemByPosition(item_pos - 1)->IsSeparator()) + menu->Destroy(menu->FindItemByPosition(item_pos - 1)); + menu->Destroy(item_id); + } + + menu->InsertSeparator(pos); + + PartPlate *plate = plater()->get_partplate_list().get_selected_plate(); + assert(plate); + + // delete current plate + auto item = append_menu_item(menu, wxID_ANY, name, _L("Remove the selected plate"), + [](wxCommandEvent&) { plater()->delete_plate(); }, "", nullptr, + []() { return plater()->can_delete_plate(); }, m_parent, pos + 1); + + // no extra wxEVT_UPDATE_UI handler here: a second handler on the same id runs before the one bound + // by append_menu_item() and, without evt.Skip(), swallows the enable/disable condition +} + void MenuFactory::update_object_menu() { append_menu_items_add_volume(&m_object_menu); diff --git a/src/slic3r/GUI/GUI_Factories.hpp b/src/slic3r/GUI/GUI_Factories.hpp index 65526c5c04..d2ab760205 100644 --- a/src/slic3r/GUI/GUI_Factories.hpp +++ b/src/slic3r/GUI/GUI_Factories.hpp @@ -109,14 +109,25 @@ private: wxWindow* m_parent {nullptr}; MenuWithSeparators m_object_menu; + wxMenu* m_object_transform_menu; + size_t m_object_geometry_pos; + int m_object_props_marker; MenuWithSeparators m_part_menu; + wxMenu* m_part_transform_menu; + int m_part_props_marker; + int m_part_project_marker; MenuWithSeparators m_text_part_menu; + int m_text_props_marker; + int m_text_project_marker; MenuWithSeparators m_svg_part_menu; + int m_svg_props_marker; + int m_svg_project_marker; MenuWithSeparators m_sla_object_menu; MenuWithSeparators m_default_menu; MenuWithSeparators m_instance_menu; //BBS: add part plate related logic MenuWithSeparators m_plate_menu; + size_t m_plate_mods_pos; MenuWithSeparators m_assemble_object_menu; MenuWithSeparators m_assemble_part_menu; @@ -128,11 +139,12 @@ private: std::array items_decrease; std::array items_set_number_of_copies; + size_t FindPositionById(wxMenu* menu, int id); + void create_default_menu(); void create_common_object_menu(wxMenu *menu); void create_object_menu(); void create_sla_object_menu(); - void create_part_menu(); void create_text_part_menu(); void create_svg_part_menu(); //BBS: add part plate related logic @@ -170,16 +182,14 @@ private: void append_menu_item_delete(wxMenu* menu); void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu); void append_menu_items_convert_unit(wxMenu* menu); // Add "Conver/Revert..." menu items (from/to inches/meters) after "Reload From Disk" - void append_menu_items_flush_options(wxMenu* menu); + void append_menu_items_flush_options(wxMenu* menu, size_t pos = -1); void append_menu_item_merge_to_multipart_object(wxMenu *menu); void append_menu_item_merge_to_single_object(wxMenu* menu); - void append_menu_item_merge_parts_to_single_part(wxMenu *menu); - void append_menu_items_mirror(wxMenu *menu); void append_menu_item_align_distribute(wxMenu *menu); void append_menu_item_precise_seam_submenu(wxMenu* menu); - void append_menu_item_invalidate_cut_info(wxMenu *menu); - void append_menu_item_edit_text(wxMenu *menu); - void append_menu_item_edit_svg(wxMenu *menu); + void append_menu_item_invalidate_cut_info(wxMenu *menu, size_t pos = -1); + void append_menu_item_edit_text(wxMenu *menu, size_t pos = -1); + void append_menu_item_edit_svg(wxMenu *menu, size_t pos = -1); void append_menu_items_instance_manipulation(wxMenu *menu); //void update_menu_items_instance_manipulation(MenuType type); @@ -190,13 +200,17 @@ private: void append_menu_item_center(wxMenu* menu); void append_menu_item_drop(wxMenu* menu); void append_menu_item_per_object_process(wxMenu* menu); - void append_menu_item_per_object_settings(wxMenu* menu); - void append_menu_item_change_filament(wxMenu* menu); + void append_menu_item_per_object_settings(wxMenu* menu, size_t pos = -1); + void append_menu_item_change_filament(wxMenu* menu, size_t pos = -1); void append_menu_item_set_printable(wxMenu* menu); void append_menu_item_set_auto_drop(wxMenu* menu); - void append_menu_item_locked(wxMenu* menu); + void append_menu_item_locked(wxMenu* menu, size_t pos = -1); void append_menu_item_fill_bed(wxMenu *menu); - void append_menu_item_plate_name(wxMenu *menu); + void append_menu_item_plate_name(wxMenu *menu, size_t pos = -1); + void append_menu_item_plate_delete(wxMenu *menu, size_t pos = -1); + wxMenu* append_menu_item_transform(wxMenu* menu, bool multi_selection, bool show_mirror, bool is_scalable); + wxMenu* append_menu_item_modify( wxMenu* menu, bool multi_selection, bool splittable, bool is_mesh, bool mesh_boolean); + wxMenu* append_menu_item_more( wxMenu* menu, bool multi_selection, bool disk_op, bool export_op); }; }} diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index e7d1041cb6..5961d5af47 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1618,7 +1618,9 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me get_selected_item_indexes(obj_idx, vol_idx, item); if (obj_idx != -1) { Plater::TakeSnapshot snapshot(plater, _u8L("Shift objects to bed")); - (*m_objects)[obj_idx]->ensure_on_bed(); + // Shift on request also when auto drop is off, which ensure_on_bed() skips. + ModelObject* mo = (*m_objects)[obj_idx]; + mo->translate_instances(-mo->min_z() * Vec3d::UnitZ()); cnv->reload_scene(true, true); update_info_items(obj_idx); notify_instance_updated(obj_idx); @@ -6734,7 +6736,9 @@ void ObjectList::OnEditingStarted(wxDataViewEvent &event) Plater::TakeSnapshot snapshot(plater, _u8L("Shift objects to bed")); int obj_idx, vol_idx; get_selected_item_indexes(obj_idx, vol_idx, item); - (*m_objects)[obj_idx]->ensure_on_bed(); + // Shift on request also when auto drop is off, which ensure_on_bed() skips. + ModelObject* mo = (*m_objects)[obj_idx]; + mo->translate_instances(-mo->min_z() * Vec3d::UnitZ()); cnv->reload_scene(true, true); update_info_items(obj_idx); notify_instance_updated(obj_idx); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAlignment.cpp b/src/slic3r/GUI/Gizmos/GLGizmoAlignment.cpp index 96b85215a1..3e70763181 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAlignment.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAlignment.cpp @@ -19,6 +19,37 @@ namespace Slic3r { namespace GUI { +namespace { + +// Maps world coordinates into the frame whose axes are the columns of basis. +Transform3d world_to_frame(const Matrix3d &basis) +{ + Transform3d trafo = Transform3d::Identity(); + trafo.linear() = basis.transpose(); + return trafo; +} + +// Model parts of an instance, as ModelObject::instance_bounding_box() or instance_convex_hull_bounding_box() takes them. +BoundingBoxf3 instance_box_in_frame(const ModelObject &object, const ModelInstance &instance, const Transform3d &to_frame, bool convex_hull) +{ + BoundingBoxf3 box; + const Transform3d inst_matrix = to_frame * instance.get_transformation().get_matrix(); + for (const ModelVolume *v : object.volumes) { + if (!v->is_model_part()) + continue; + const Transform3d matrix = inst_matrix * v->get_matrix(); + box.merge(convex_hull ? v->get_convex_hull().transformed_bounding_box(matrix) : v->mesh().transformed_bounding_box(matrix)); + } + return box; +} + +BoundingBoxf3 volume_box_in_frame(const GLVolume &volume, const Matrix3d &basis) +{ + return volume.transformed_convex_hull_bounding_box(world_to_frame(basis) * volume.world_matrix()); +} + +} // namespace + GLGizmoAlignment::GLGizmoAlignment(GLCanvas3D& canvas) : m_canvas(canvas) { } @@ -106,9 +137,10 @@ bool GLGizmoAlignment::align_to_center(AlignType type,bool align_parent) { std::string type_str = type == AlignType::CENTER_X ? "X" : (type == AlignType::CENTER_Y ? "Y" : "Z"); std::string operation_name = type == AlignType::CENTER_X ? "X Center" : (type == AlignType::CENTER_Y ? "Y Center" : "Z Center"); + const Matrix3d basis = reference_basis(align_parent); double selection_center = 0.f; if (align_parent) { - BoundingBoxf3 parent_box = get_parent_box(); + BoundingBoxf3 parent_box = get_parent_box(basis); selection_center = get_current_coord(operation_name, parent_box); // Handle multiple volume selection @@ -119,18 +151,18 @@ bool GLGizmoAlignment::align_to_center(AlignType type,bool align_parent) get_selection().setup_cache(); - BoundingBoxf3 selection_bbox = get_items_box(); + BoundingBoxf3 selection_bbox = get_items_box(basis); double current_coord = get_current_coord(operation_name, selection_bbox); Vec3d displacement = generate_displacement(operation_name, selection_center - current_coord); // Move the selected volumes together so that their collective bounding box is centered in the parent for (const GLVolume *volume : get_selected_part_volumes()) { - get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), displacement, false); + get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), basis * displacement, false); } finish_operation(true); return true; } BoundingBoxf3 big_bb; - auto objects = get_selected_objects_info(big_bb); + auto objects = get_selected_objects_info(big_bb, basis); if (objects.empty()) return false; // Handle multiple objects or parts selection @@ -143,7 +175,7 @@ bool GLGizmoAlignment::align_to_center(AlignType type,bool align_parent) Vec3d displacement = generate_displacement(operation_name, selection_center - current_coord); // Multiple objects: use selection bounding box for alignment for (const auto &obj : objects) { - apply_transformation(obj.object_idx, obj.instance_idx, displacement); + apply_transformation(obj.object_idx, obj.instance_idx, basis * displacement); } finish_operation(); @@ -157,23 +189,23 @@ bool GLGizmoAlignment::align_to_center(AlignType type,bool align_parent) get_selection().setup_cache(); - BoundingBoxf3 selection_bbox = get_items_box(); + BoundingBoxf3 selection_bbox = get_items_box(basis); selection_center = get_current_coord(operation_name, selection_bbox); // Move each part to align to the center of their collective bounding box for (const GLVolume *volume : get_selected_part_volumes()) { - auto temp_box = volume->transformed_convex_hull_bounding_box(); + auto temp_box = volume_box_in_frame(*volume, basis); double current = get_current_coord(operation_name, temp_box); double offset = selection_center - current; Vec3d displacement = generate_displacement(operation_name, offset); - get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), displacement, false); + get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), basis * displacement, false); } finish_operation(true); return true; } BoundingBoxf3 big_bb; - auto objects = get_selected_objects_info(big_bb); + auto objects = get_selected_objects_info(big_bb, basis); if (objects.empty()) return false; // Handle multiple instances selection_center = get_current_coord(operation_name, big_bb); @@ -188,7 +220,7 @@ bool GLGizmoAlignment::align_to_center(AlignType type,bool align_parent) BoundingBoxf3 temp_bbox = obj.bbox; double current_coord = get_current_coord(operation_name, temp_bbox); Vec3d displacement = generate_displacement(operation_name, selection_center - current_coord); - apply_transformation(obj.object_idx, obj.instance_idx, displacement); + apply_transformation(obj.object_idx, obj.instance_idx, basis * displacement); } finish_operation(); return true; @@ -244,9 +276,10 @@ bool GLGizmoAlignment::distribute_z() template bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFunc set_coord, const std::string &operation_name ,bool align_parent) { + const Matrix3d basis = reference_basis(align_parent); if (align_parent) { // Find reference coordinate - BoundingBoxf3 parent_box = get_parent_box(); + BoundingBoxf3 parent_box = get_parent_box(basis); double reference_coord = get_current_coord(operation_name, parent_box); // Handle parts selection differently if (is_parts_selection(true)) { @@ -259,12 +292,12 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun const std::vector volumes = get_selected_part_volumes(); if (volumes.empty()) return false; - BoundingBoxf3 selection_bbox = get_items_box(); + BoundingBoxf3 selection_bbox = get_items_box(basis); double current_coord = get_current_coord(operation_name, selection_bbox); Vec3d displacement = generate_displacement(operation_name, reference_coord - current_coord); for (const GLVolume *volume : volumes) { if (displacement.norm() > 1e-6) { - get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), displacement, false); + get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), basis * displacement, false); } } @@ -274,7 +307,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun // Handle objects selection (original logic) BoundingBoxf3 big_bb; - auto objects = get_selected_objects_info(big_bb); + auto objects = get_selected_objects_info(big_bb, basis); if (objects.empty()) return false; if (!take_snapshot("align to parent node " + operation_name)) { return false; } @@ -286,7 +319,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun for (const auto &obj : objects) { if (displacement.norm() > 1e-6) { - apply_transformation(obj.object_idx, obj.instance_idx, displacement); + apply_transformation(obj.object_idx, obj.instance_idx, basis * displacement); } } @@ -309,7 +342,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun bool first = true; for (const GLVolume* volume : volumes) { - BoundingBoxf3 bbox = volume->transformed_convex_hull_bounding_box(); + BoundingBoxf3 bbox = volume_box_in_frame(*volume, basis); double coord = 0.0; if (operation_name.find("X Max") != std::string::npos) { @@ -339,7 +372,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun } for (const GLVolume* volume : volumes) { - BoundingBoxf3 bbox = volume->transformed_convex_hull_bounding_box(); + BoundingBoxf3 bbox = volume_box_in_frame(*volume, basis); double current_coord = 0.0; if (operation_name.find("X Max") != std::string::npos) { @@ -367,7 +400,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun } if (displacement.norm() > 1e-6) { - get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), displacement, false); + get_selection().translate(volume->object_idx(), volume->instance_idx(), volume->volume_idx(), basis * displacement, false); } } @@ -377,7 +410,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun // Handle objects selection (original logic) BoundingBoxf3 big_bb; - auto objects = get_selected_objects_info(big_bb); + auto objects = get_selected_objects_info(big_bb, basis); if (objects.empty()) return false; if (!take_snapshot(operation_name)) { @@ -402,7 +435,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun set_coord(displacement, reference_coord, current_coord); if (displacement.norm() > 1e-6) { - apply_transformation(obj.object_idx, obj.instance_idx, displacement); + apply_transformation(obj.object_idx, obj.instance_idx, basis * displacement); } } @@ -413,6 +446,7 @@ bool GLGizmoAlignment::align_objects_generic(GetCoordFunc get_coord, SetCoordFun template bool GLGizmoAlignment::distribute_objects_generic(GetCoordFunc get_coord, int axis, const std::string& operation_name) { + const Matrix3d basis = reference_basis(false); if (is_parts_selection(false)) { const std::vector volumes = get_selected_part_volumes(); if (volumes.size() < 3) return false; @@ -425,7 +459,7 @@ bool GLGizmoAlignment::distribute_objects_generic(GetCoordFunc get_coord, int ax std::vector entries; entries.reserve(volumes.size()); for (const GLVolume* v : volumes) { - BoundingBoxf3 bbox = v->transformed_convex_hull_bounding_box(); + BoundingBoxf3 bbox = volume_box_in_frame(*v, basis); Vec3d c = bbox.center(); double coord = (axis == 0 ? c.x() : axis == 1 ? c.y() : c.z()); entries.push_back({v, coord}); @@ -433,9 +467,9 @@ bool GLGizmoAlignment::distribute_objects_generic(GetCoordFunc get_coord, int ax std::sort(entries.begin(), entries.end(), [](const VolEntry& a, const VolEntry& b){ return a.coord < b.coord; }); - BoundingBoxf3 selection_bbox = get_items_box(); - BoundingBoxf3 left_bbox = entries.front().v->transformed_convex_hull_bounding_box(); - BoundingBoxf3 right_bbox = entries.back().v->transformed_convex_hull_bounding_box(); + BoundingBoxf3 selection_bbox = get_items_box(basis); + BoundingBoxf3 left_bbox = volume_box_in_frame(*entries.front().v, basis); + BoundingBoxf3 right_bbox = volume_box_in_frame(*entries.back().v, basis); auto axis_extent = [&](const BoundingBoxf3 &bb) { return (axis == 0 ? (bb.max.x() - bb.min.x()) : axis == 1 ? (bb.max.y() - bb.min.y()) : (bb.max.z() - bb.min.z())); }; double left_width = axis_extent(left_bbox); double right_width = axis_extent(right_bbox); @@ -454,7 +488,7 @@ bool GLGizmoAlignment::distribute_objects_generic(GetCoordFunc get_coord, int ax Vec3d displacement = Vec3d::Zero(); displacement[axis] = offset; const GLVolume *v = entries[i].v; - get_selection().translate(v->object_idx(), v->instance_idx(), v->volume_idx(), displacement, false); + get_selection().translate(v->object_idx(), v->instance_idx(), v->volume_idx(), basis * displacement, false); } } @@ -462,7 +496,7 @@ bool GLGizmoAlignment::distribute_objects_generic(GetCoordFunc get_coord, int ax return true; } BoundingBoxf3 big_bb; - auto objects = get_selected_objects_info(big_bb); + auto objects = get_selected_objects_info(big_bb, basis); if (objects.size() < 3) return false; if (!take_snapshot(operation_name)) { @@ -488,7 +522,7 @@ bool GLGizmoAlignment::distribute_objects_generic(GetCoordFunc get_coord, int ax if (std::abs(offset) > 1e-6) { Vec3d displacement = Vec3d::Zero(); displacement[axis] = offset; - apply_transformation(objects[i].object_idx, objects[i].instance_idx, displacement); + apply_transformation(objects[i].object_idx, objects[i].instance_idx, basis * displacement); } } @@ -544,13 +578,27 @@ Vec3d GLGizmoAlignment::generate_displacement(std::string operation_name, double return displacement; } -std::vector GLGizmoAlignment::get_selected_objects_info(BoundingBoxf3 &big_bb) const +Matrix3d GLGizmoAlignment::reference_basis(bool align_parent) const +{ + // Plate alignment stays on the world axes. + const Selection &selection = get_selection(); + if (!m_object_cs || selection.is_empty() || (align_parent && !is_parts_selection(true))) + return Matrix3d::Identity(); + + // The instance of the first selected volume, as the Move gizmo's object coordinate system does. + auto transformation = selection.get_first_volume()->get_instance_transformation(); + transformation.reset_scaling_factor(); + return transformation.get_matrix_no_offset().linear(); +} + +std::vector GLGizmoAlignment::get_selected_objects_info(BoundingBoxf3 &big_bb, const Matrix3d &basis) const { std::vector objects; Selection& selection = get_selection(); if (selection.is_empty()) return objects; + const Transform3d to_frame = world_to_frame(basis); const auto& content = selection.get_content(); for (const auto& obj_it : content) { for (const auto& inst_idx : obj_it.second) { @@ -559,7 +607,7 @@ std::vector GLGizmoAlignment::get_selected_objects if (obj_idx >= 0 && obj_idx < selection.get_model()->objects.size()) { ModelObject* object = selection.get_model()->objects[obj_idx]; if (inst_idx >= 0 && inst_idx < object->instances.size()) { - BoundingBoxf3 bbox = object->instance_bounding_box(inst_idx); + BoundingBoxf3 bbox = instance_box_in_frame(*object, *object->instances[inst_idx], to_frame, false); big_bb.merge(bbox); objects.emplace_back(obj_idx, inst_idx, bbox); } @@ -602,22 +650,24 @@ std::vector GLGizmoAlignment::get_selected_part_volumes() cons return volumes; } -BoundingBoxf3 GLGizmoAlignment::get_items_box() const +BoundingBoxf3 GLGizmoAlignment::get_items_box(const Matrix3d &basis) const { BoundingBoxf3 box; if (is_parts_selection(false)) { for (const GLVolume *volume : get_selected_part_volumes()) - box.merge(volume->transformed_convex_hull_bounding_box()); + box.merge(volume_box_in_frame(*volume, basis)); } else - get_selected_objects_info(box); + get_selected_objects_info(box, basis); return box; } -BoundingBoxf3 GLGizmoAlignment::get_parent_box() const +BoundingBoxf3 GLGizmoAlignment::get_parent_box(const Matrix3d &basis) const { const Selection &selection = get_selection(); - if (is_parts_selection(true)) - return selection.get_model()->objects[selection.get_object_idx()]->instance_convex_hull_bounding_box(selection.get_instance_idx()); + if (is_parts_selection(true)) { + const ModelObject *object = selection.get_model()->objects[selection.get_object_idx()]; + return instance_box_in_frame(*object, *object->instances[selection.get_instance_idx()], world_to_frame(basis), true); + } // can_align() requires every selected instance on one plate, so the first one gives the plate. BoundingBoxf3 box; @@ -629,7 +679,7 @@ BoundingBoxf3 GLGizmoAlignment::get_parent_box() const if (plate == nullptr) break; BoundingBoxf3 instances_box; - get_selected_objects_info(instances_box); + get_selected_objects_info(instances_box, Matrix3d::Identity()); box = plate->get_plate_box(); box.max.z() = instances_box.max.z(); // Keep the aligned objects off the plate edge. @@ -714,4 +764,4 @@ size_t GLGizmoAlignment::get_items_count(AlignType type, bool align_parent, std: } } // namespace GUI -} // namespace Slic3r \ No newline at end of file +} // namespace Slic3r diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAlignment.hpp b/src/slic3r/GUI/Gizmos/GLGizmoAlignment.hpp index daca519034..30db673dfd 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAlignment.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAlignment.hpp @@ -62,7 +62,13 @@ public: bool can_align(AlignType type, bool align_parent = false) const; bool can_distribute(AlignType type) const; - std::vector get_selected_objects_info(BoundingBoxf3 &big_bb) const; + // Object coordinate system: operations align along the axes of the selection's instance instead of the world axes. + void set_object_cs(bool flag) { m_object_cs = flag; } + // Rotation whose columns are the axes an operation aligns along. Plate alignment always uses the world axes. + Matrix3d reference_basis(bool align_parent) const; + + // Boxes and displacements inside the operations are in the frame of the basis from reference_basis(). + std::vector get_selected_objects_info(BoundingBoxf3 &big_bb, const Matrix3d &basis) const; double get_current_coord(std::string operation_name, BoundingBoxf3 &bbox); Vec3d generate_displacement(std::string operation_name, double offset); @@ -72,16 +78,17 @@ public: // The volumes a parts operation moves: the selected volumes, or only the model parts when a whole instance is // selected. Empty for a cut object, whose parts must keep their place. std::vector get_selected_part_volumes() const; - // World bounding box of the items an operation moves, the reference of every non-parent operation. - BoundingBoxf3 get_items_box() const; - // World bounding box aligned to with align_parent: the instance of a parts selection, or the plate holding the + // Bounding box of the items an operation moves, the reference of every non-parent operation. + BoundingBoxf3 get_items_box(const Matrix3d &basis) const; + // Bounding box aligned to with align_parent: the instance of a parts selection, or the plate holding the // selected instances, up to their top. - BoundingBoxf3 get_parent_box() const; + BoundingBoxf3 get_parent_box(const Matrix3d &basis) const; // Number of items the operation would move, or 0 when it cannot move them; why_not then gets the reason, if any. size_t get_items_count(AlignType type, bool align_parent, std::string *why_not = nullptr) const; private: GLCanvas3D& m_canvas; + bool m_object_cs{false}; template bool align_objects_generic(GetCoordFunc get_coord, SetCoordFunc set_coord, const std::string &operation_name, bool align_parent = false); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index db125ae1d5..a3f680da59 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -517,6 +517,46 @@ bool check(ModelVolumeType volume_type) { volume_type == ModelVolumeType::NEGATIVE_VOLUME || volume_type == ModelVolumeType::PARAMETER_MODIFIER; } + +// Text of a new text volume +const char *const default_text = L("Embossed text"); + +// Whether the loaded font of the style manager has a glyph for every character of the text +bool can_write(StyleManager &style_manager, const std::string &text) +{ + bool exist_unknown = false; + create_range_text(text, *style_manager.get_font_file_with_cache().font_file, + style_manager.get_font_prop().collection_number.value_or(0), &exist_unknown); + return !exist_unknown; +} + +bool can_write(const EmbossStyle &style, const std::string &text) +{ + StyleManager style_manager(nullptr, {}); + return style_manager.load_style(StyleManager::Style{style}) && can_write(style_manager, text); +} + +// The default styles use system fonts, which can lack the script of the translated default text, e.g. with +// a Chinese UI on an English system. Then put first a style with a bundled font that can write it. Only +// registered faces are used: a text volume can be edited again only when its font is found by face name. +void add_style_for_default_text(EmbossStyles &styles) +{ + const std::string text = _u8L(default_text); + // the untranslated text is Latin, which the system fonts have + if (text == default_text || can_write(styles.front(), text)) + return; + + for (const char *face_name : {"HarmonyOS Sans SC", "NanumGothic", "Sarabun"}) { + wxFont wx_font = *wxNORMAL_FONT; + if (!wx_font.SetFaceName(face_name)) + continue; + EmbossStyle style = WxFontUtils::create_emboss_style(wx_font, _u8L("Default font")); + if (can_write(style, text)) { + styles.insert(styles.begin(), std::move(style)); + return; + } + } +} } bool GLGizmoEmboss::init_create(ModelVolumeType volume_type) @@ -541,8 +581,10 @@ bool GLGizmoEmboss::init_create(ModelVolumeType volume_type) m_style_manager.discard_style_changes(); - // set default text - m_text = _u8L("Embossed text"); + // set default text, in English when the active font cannot write its translation + m_text = _u8L(default_text); + if (m_style_manager.is_active_font() && !can_write(m_style_manager, m_text)) + m_text = default_text; return true; } @@ -1070,29 +1112,28 @@ EmbossStyles GLGizmoEmboss::create_default_styles() }),styles.end() ); - // exist some valid style? - if (!styles.empty()) - return styles; - // No valid style in defult list // at least one style must contain loadable font - wxFont wx_font; - for (const wxString &face : facenames) { - wx_font = wxFont(face); - if (WxFontUtils::create_font_file(wx_font) != nullptr) - break; - wx_font = wxFont(); // NotOk - } + if (styles.empty()) { + wxFont wx_font; + for (const wxString &face : facenames) { + wx_font = wxFont(face); + if (WxFontUtils::create_font_file(wx_font) != nullptr) + break; + wx_font = wxFont(); // NotOk + } - if (wx_font.IsOk()) { - // use first alphabetic sorted installed font - styles.push_back(WxFontUtils::create_emboss_style(wx_font, _u8L("First font"))); - } else { - // On current OS is not installed any correct TTF font - // use font packed with Slic3r - std::string font_path = Slic3r::resources_dir() + "/fonts/NotoSans-Regular.ttf"; - styles.push_back(EmbossStyle{_u8L("Default font"), font_path, EmbossStyle::Type::file_path}); + if (wx_font.IsOk()) { + // use first alphabetic sorted installed font + styles.push_back(WxFontUtils::create_emboss_style(wx_font, _u8L("First font"))); + } else { + // On current OS is not installed any correct TTF font + // use font packed with OrcaSlicer + std::string font_path = Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Regular.ttf"; + styles.push_back(EmbossStyle{_u8L("Default font"), font_path, EmbossStyle::Type::file_path}); + } } + add_style_for_default_text(styles); return styles; } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp index 6968e81c7e..22629570cb 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp @@ -110,8 +110,8 @@ bool GLGizmoMove3D::on_is_activable() const void GLGizmoMove3D::on_set_state() { if (get_state() == On) { - m_last_selected_obejct_idx = -1; - m_last_selected_volume_idx = -1; + m_last_selected_obejct_idx = -2; + m_last_selected_volume_idx = -2; change_cs_by_selection(); } if (m_object_manipulation) @@ -355,13 +355,17 @@ void GLGizmoMove3D::render_align_preview() if (m_object_manipulation == nullptr || m_object_manipulation->get_hovered_align_type() == AlignType::NONE) return; - // The box the hovered operation aligns to, in world coordinates like the operation itself. - const AlignType type = m_object_manipulation->get_hovered_align_type(); - const GLGizmoAlignment &helper = m_object_manipulation->get_alignment_helper(); - const BoundingBoxf3 box = m_object_manipulation->get_align_to_parent() ? helper.get_parent_box() : helper.get_items_box(); + // The box the hovered operation aligns to, in the frame the operation aligns along. + const AlignType type = m_object_manipulation->get_hovered_align_type(); + const GLGizmoAlignment &helper = m_object_manipulation->get_alignment_helper(); + const bool to_parent = m_object_manipulation->get_align_to_parent(); + const Matrix3d basis = helper.reference_basis(to_parent); + const BoundingBoxf3 box = to_parent ? helper.get_parent_box(basis) : helper.get_items_box(basis); if (!box.defined) return; - m_parent.get_selection().render_bounding_box(box, {0.0f, 150.0f / 255.0f, 136.0f / 255.0f}, m_parent.get_scale()); + Transform3d basis_trafo = Transform3d::Identity(); + basis_trafo.linear() = basis; + m_parent.get_selection().render_bounding_box(box, basis_trafo, {0.0f, 150.0f / 255.0f, 136.0f / 255.0f}, m_parent.get_scale()); GLShaderProgram* shader = wxGetApp().get_shader("flat"); if (shader == nullptr) @@ -427,7 +431,7 @@ void GLGizmoMove3D::render_align_preview() for (double position : positions) { plane_center[axis] = position; plane_matrix.translation() = plane_center; - shader->set_uniform("view_model_matrix", camera.get_view_matrix() * plane_matrix); + shader->set_uniform("view_model_matrix", camera.get_view_matrix() * basis_trafo * plane_matrix); m_align_plane.render(); } shader->stop_using(); @@ -437,7 +441,7 @@ void GLGizmoMove3D::render_align_preview() } void GLGizmoMove3D::change_cs_by_selection() { - int obejct_idx, volume_idx; + int obejct_idx = -1, volume_idx = -1; ModelVolume *model_volume = m_parent.get_selection().get_selected_single_volume(obejct_idx, volume_idx); if (m_last_selected_obejct_idx == obejct_idx && m_last_selected_volume_idx == volume_idx) { return; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp index 3eb5522156..5d6a3317df 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp @@ -81,7 +81,8 @@ private: void render_align_preview(); void change_cs_by_selection(); //cs mean Coordinate System private: - int m_last_selected_obejct_idx, m_last_selected_volume_idx; + // -1 is a selection without a single volume; -2 is no selection seen yet. + int m_last_selected_obejct_idx{-2}, m_last_selected_volume_idx{-2}; }; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 388b04312d..6c540fa9d2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -114,6 +114,11 @@ Vec3f GLGizmoPainterBase::get_tilt_up_direction() const } void GLGizmoPainterBase::render_triangles(const Selection& selection, const ModelVolume* skip) const +{ + render_triangles(selection, skip == nullptr ? std::vector{} : std::vector{skip}); +} + +void GLGizmoPainterBase::render_triangles(const Selection& selection, const std::vector& skip) const { auto* shader = wxGetApp().get_shader("mm_gouraud"); if (!shader) @@ -135,7 +140,7 @@ void GLGizmoPainterBase::render_triangles(const Selection& selection, const Mode continue; ++mesh_id; - if (mv == skip) + if (std::find(skip.begin(), skip.end(), mv) != skip.end()) continue; Transform3d trafo_matrix; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp index 96871ae5dc..9695606417 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp @@ -235,6 +235,10 @@ public: protected: // Draws every model part's selector, except `skip`'s when given. virtual void render_triangles(const Selection& selection, const ModelVolume* skip = nullptr) const; + // The same, skipping every part in `skip`. A gizmo can have a preview standing in for more than one + // model part at a time - the texture-displacement gizmo previews every painted part of a multibody + // object - and drawing those parts' selectors over it would bury the preview under a flat surface. + void render_triangles(const Selection& selection, const std::vector& skip) const; void render_cursor(); void render_cursor_circle(); void render_cursor_sphere(const Transform3d& trafo) const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp index 4842f93f34..e0609d5660 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp @@ -185,8 +185,8 @@ bool GLGizmoScale3D::on_is_activable() const void GLGizmoScale3D::on_set_state() { if (get_state() == On) { - m_last_selected_obejct_idx = -1; - m_last_selected_volume_idx = -1; + m_last_selected_obejct_idx = -2; + m_last_selected_volume_idx = -2; change_cs_by_selection(); } } @@ -302,7 +302,7 @@ void GLGizmoScale3D::update_grabbers_data() void GLGizmoScale3D::change_cs_by_selection() { - int obejct_idx, volume_idx; + int obejct_idx = -1, volume_idx = -1; ModelVolume *model_volume = m_parent.get_selection().get_selected_single_volume(obejct_idx, volume_idx); if (m_last_selected_obejct_idx == obejct_idx && m_last_selected_volume_idx == volume_idx) { return; } m_last_selected_obejct_idx = obejct_idx; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp index d830b9f36a..3a91a5fa62 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp @@ -110,7 +110,8 @@ private: void update_grabbers_data(); void change_cs_by_selection(); // cs mean Coordinate System private: - int m_last_selected_obejct_idx, m_last_selected_volume_idx; + // -1 is a selection without a single volume; -2 is no selection seen yet. + int m_last_selected_obejct_idx{-2}, m_last_selected_volume_idx{-2}; }; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp b/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp index 7f0019f86b..adc9982a80 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.cpp @@ -7,6 +7,7 @@ #include "ColorSpaceConvert.hpp" #include "libslic3r/AABBTreeIndirect.hpp" +#include "libslic3r/BoundingBox.hpp" #include "libslic3r/Color.hpp" #include "libslic3r/FilamentMixer.hpp" #include "libslic3r/PresetBundle.hpp" @@ -26,6 +27,7 @@ #include "slic3r/GUI/GuiColor.hpp" #include "slic3r/GUI/ImGuiWrapper.hpp" #include "slic3r/GUI/MainFrame.hpp" // wxGetApp().mainframe, as the projector window's parent +#include "slic3r/GUI/MeshUtils.hpp" #include "slic3r/GUI/MsgDialog.hpp" #include "slic3r/GUI/OpenGLManager.hpp" #include "slic3r/GUI/Plater.hpp" @@ -580,6 +582,7 @@ void GLGizmoTextureDisplacement::on_shutdown() { m_parent.toggle_model_objects_visibility(true); m_preview_glmodel.reset(); + m_part_previews.clear(); m_shaded_preview_glmodel.reset(); m_paint_overlay_glmodel.reset(); m_paint_overlay_dirty = false; @@ -705,8 +708,7 @@ void GLGizmoTextureDisplacement::render_painter_gizmo() // why those two modes looked like they did nothing. Leave it out and let the undisplaced volume show // through instead (toggle_model_objects_visibility below) - that one *is* coincident with the // overlay, which is what the offset assumes, and it is the surface whose mapping is being inspected. - const bool use_true_preview = !use_shaded && m_uv_check_mode == UVCheckMode::None && - m_preview_glmodel.is_initialized(); + const bool use_true_preview = !use_shaded && m_uv_check_mode == UVCheckMode::None && has_true_preview(); // In Checker/Distortion mode the UV-check overlay *is* the surface visualization the user is // looking at, so the opaque paint-selection highlight must not be drawn on top of it - same // reasoning as skipping it for the shaded preview (see bug #12). Without this the painted area @@ -717,10 +719,23 @@ void GLGizmoTextureDisplacement::render_painter_gizmo() // put it back. Getting this wrong leaves an invisible model, so it is decided once, here, rather // than per branch below. ModelVolume *mv = texture_volume(); + // The parts a preview is standing in for, and whose real volumes therefore have to be hidden and + // whose selectors must not be drawn over it. The shaded view only ever shades the layer stack's own + // part; the true-displacement view covers every painted part of a multibody object. + std::vector previewed; + if (use_shaded && mv != nullptr) { + previewed.push_back(mv); + } else if (use_true_preview) { + if (mv != nullptr && m_preview_glmodel.is_initialized()) + previewed.push_back(mv); + for (const std::unique_ptr &preview : m_part_previews) + if (const ModelVolume *part = preview_part(*preview); part != nullptr) + previewed.push_back(part); + } m_parent.toggle_model_objects_visibility(true); - if ((use_shaded || use_true_preview) && mv != nullptr) + for (const ModelVolume *volume : previewed) m_parent.toggle_model_objects_visibility(false, m_c->selection_info()->model_object(), - m_c->selection_info()->get_active_instance(), mv); + m_c->selection_info()->get_active_instance(), volume); // Over a preview, the paint feedback - the selectors' highlight in the Normal view, the tint in both - // is drawn only while a mouse button is down: during a stroke, a fill click included. Between strokes @@ -734,14 +749,15 @@ void GLGizmoTextureDisplacement::render_painter_gizmo() if (use_shaded) { render_shaded_preview_mesh(); // The shaded mesh is the textured volume alone, so the other model parts are still the selectors' to draw. - render_triangles(selection, mv); + render_triangles(selection, previewed); textured_selector_drawn = false; } else if (use_true_preview) { render_preview_mesh(); glsafe(::glEnable(GL_POLYGON_OFFSET_FILL)); glsafe(::glPolygonOffset(-1.0f, -1.0f)); - // Without paint feedback, only the other model parts: render_preview_mesh() draws the textured one. - render_triangles(selection, paint_feedback ? nullptr : mv); + // Without paint feedback, only the parts with no preview over them: render_preview_mesh() draws + // the rest. + render_triangles(selection, paint_feedback ? std::vector{} : previewed); glsafe(::glDisable(GL_POLYGON_OFFSET_FILL)); textured_selector_drawn = paint_feedback; } else { @@ -1239,36 +1255,61 @@ void GLGizmoTextureDisplacement::render_seam_overlay() void GLGizmoTextureDisplacement::render_preview_mesh() { const ModelObject *mo = m_c->selection_info()->model_object(); - const ModelVolume *mv = texture_volume(); - if (mo == nullptr || mv == nullptr) + if (mo == nullptr) return; - const Selection &selection = m_parent.get_selection(); - const Transform3d trafo_matrix = mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix() * mv->get_matrix(); - auto *shader = wxGetApp().get_shader("gouraud_light"); if (shader == nullptr) return; + + const Selection &selection = m_parent.get_selection(); + const Transform3d instance_matrix = mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix(); + const Camera &camera = wxGetApp().plater()->get_camera(); + const Transform3d &view_matrix = camera.get_view_matrix(); + shader->start_using(); - const Camera &camera = wxGetApp().plater()->get_camera(); - const Transform3d &view_matrix = camera.get_view_matrix(); - shader->set_uniform("view_model_matrix", view_matrix * trafo_matrix); - shader->set_uniform("projection_matrix", camera.get_projection_matrix()); - const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * trafo_matrix.matrix().block(0, 0, 3, 3).inverse().transpose(); - shader->set_uniform("view_normal_matrix", view_normal_matrix); - if (m_preview_color_runs.empty()) { - m_preview_glmodel.render(); - } else { - // set_color() writes the uniform the shader reads, so one call per group is all the - // per-triangle colour this needs. - for (const PreviewColorRun &run : m_preview_color_runs) { - m_preview_glmodel.set_color(run.color); - m_preview_glmodel.render(run.range, shader); + // Each part is drawn through its own matrix: a multibody object's parts sit in different places + // inside the object, so one matrix for all of them would pile every preview onto the first part. + const auto draw = [&](const ModelVolume &volume, GLModel &model, const std::vector &runs) { + if (!model.is_initialized()) + return; + const Transform3d trafo_matrix = instance_matrix * volume.get_matrix(); + shader->set_uniform("view_model_matrix", view_matrix * trafo_matrix); + shader->set_uniform("projection_matrix", camera.get_projection_matrix()); + const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * + trafo_matrix.matrix().block(0, 0, 3, 3).inverse().transpose(); + shader->set_uniform("view_normal_matrix", view_normal_matrix); + if (runs.empty()) { + model.render(); + } else { + // set_color() writes the uniform the shader reads, so one call per group is all the + // per-triangle colour this needs. + for (const PreviewColorRun &run : runs) { + model.set_color(run.color); + model.render(run.range, shader); + } } - } + }; + + if (const ModelVolume *owner = texture_volume(); owner != nullptr) + draw(*owner, m_preview_glmodel, m_preview_color_runs); + for (const std::unique_ptr &preview : m_part_previews) + if (const ModelVolume *part = preview_part(*preview); part != nullptr) + draw(*part, preview->glmodel, preview->color_runs); shader->stop_using(); } +const ModelVolume *GLGizmoTextureDisplacement::preview_part(const PartPreview &preview) const +{ + const ModelObject *mo = m_c->selection_info()->model_object(); + if (mo == nullptr) + return nullptr; + for (const ModelVolume *mv : mo->volumes) + if (mv->id() == preview.volume_id) + return mv; + return nullptr; // the part was removed, or its mesh replaced, since the preview was built +} + float GLGizmoTextureDisplacement::layer_texture_aspect(const TextureDisplacementLayer &layer) { // decode_height_texture() is cached on the image_data allocation, so this is a hash lookup rather @@ -2362,8 +2403,9 @@ void GLGizmoTextureDisplacement::rebuild_preview() return; const ModelVolume *mv = texture_volume(); - if (mv == nullptr || !mv->is_texture_displacement_painted()) { + if (mv == nullptr || !any_part_painted()) { m_preview_glmodel.reset(); + m_part_previews.clear(); m_preview_its = indexed_triangle_set{}; // no displaced mesh; wireframe falls back to the base m_preview_job_pending = false; refresh_wireframe(); @@ -2384,14 +2426,44 @@ void GLGizmoTextureDisplacement::rebuild_preview() queue_preview_job(); } +indexed_triangle_set GLGizmoTextureDisplacement::group_preview_by_color(const indexed_triangle_set &its, + const std::vector &triangle_color, + const std::vector &entry_colors, + std::vector &runs) +{ + runs.clear(); + if (triangle_color.size() != its.indices.size() || entry_colors.empty()) + return its; + + indexed_triangle_set sorted; + sorted.vertices = its.vertices; + sorted.indices.reserve(its.indices.size()); + for (int want = 0; want <= int(entry_colors.size()); ++want) { + const size_t first = sorted.indices.size(); + for (size_t i = 0; i < its.indices.size(); ++i) + if (int(triangle_color[i]) == want) + sorted.indices.push_back(its.indices[i]); + if (sorted.indices.size() == first) + continue; + runs.push_back({ { first * 3, sorted.indices.size() * 3 }, + want == 0 ? GLVolume::NEUTRAL_COLOR : entry_colors[size_t(want - 1)] }); + } + return sorted; +} + void GLGizmoTextureDisplacement::queue_preview_job() { // A job in flight when the gizmo closes still runs its completion handler, which would otherwise // happily queue the follow-up run it was holding - against a gizmo nobody is looking at any more. if (m_state != On) return; - const ModelVolume *mv = texture_volume(); - if (mv == nullptr || !mv->is_texture_displacement_painted()) + const ModelVolume *owner = texture_volume(); + if (owner == nullptr) + return; + // Every painted part, so the preview shows the whole of what Bake will do rather than its first + // part - the same set bake() displaces. + const std::vector parts = painted_parts(); + if (parts.empty()) return; // One in flight at a time; everything requested meanwhile collapses into a single follow-up run @@ -2404,22 +2476,39 @@ void GLGizmoTextureDisplacement::queue_preview_job() const uint64_t generation = m_preview_generation->load(); TextureDisplacementPreviewInput input; - input.base_mesh = mv->mesh().its; - input.layers = mv->texture_displacement_layers; - input.options = mv->texture_displacement_options; - // The preview is looked at, not printed or sliced: skip the simplification and the repair that - // follows it, which are most of the one-run pipeline's time. The relief is the same. - if (input.options.pipeline_v2) - input.options.v2_max_triangles_k = 0; - input.volume_to_world = texture_displacement_volume_to_world(*mv); - if (mv->has_texture_uv()) - input.model_uv = mv->texture_uv; - for (int i = 0; i < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++i) - input.facets_data[size_t(i)] = mv->texture_displacement_facet(i).get_data(); // Captured here rather than read in the handler: the palette is main-thread state, and the preview // has to be grouped against the same palette it was computed with, not whatever it is by the time - // the result lands. - input.color = color_settings_for(*mv); + // the result lands. Read off the layer stack's own part, since that is where the stack lives. + input.color = color_settings_for(*owner); + input.volumes.reserve(parts.size()); + // Which part each result belongs to, so the handler can tell the layer stack's own preview - the one + // the overlays and the wireframe are keyed to - from the rest. + std::vector part_ids; + part_ids.reserve(parts.size()); + const Vec3d anchor = texture_anchor(); + const std::vector drops = resting_drops(parts); + for (size_t i = 0; i < parts.size(); ++i) { + const ModelVolume *part = parts[i]; + TextureDisplacementPreviewVolume entry; + entry.base_mesh = part->mesh().its; + entry.layers = layers_for_part(*part); + entry.options = owner->texture_displacement_options; + // The preview is looked at, not printed or sliced: skip the simplification and the repair that + // follows it, which are most of the one-run pipeline's time. The relief is the same. + if (entry.options.pipeline_v2) + entry.options.v2_max_triangles_k = 0; + entry.volume_to_world = texture_displacement_volume_to_world(*part); + entry.texture_anchor = anchor; + entry.resting_drop = drops[i]; + if (part->has_texture_uv()) + entry.model_uv = part->texture_uv; + for (int slot = 0; slot < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++slot) + entry.facets_data[size_t(slot)] = part->texture_displacement_facet(slot).get_data(); + input.volumes.push_back(std::move(entry)); + part_ids.push_back(part->id()); + } + const ObjectID owner_id = owner->id(); + // The result names a palette entry per triangle (index + 1), so these are the colours to draw it in: // a single filament's own, or for a mix the colour its slot will show once a bake creates it. std::vector entry_colors; @@ -2430,43 +2519,52 @@ void GLGizmoTextureDisplacement::queue_preview_job() m_preview_job_running = true; auto &worker = wxGetApp().plater()->get_ui_job_worker(); queue_job(worker, std::make_unique(std::move(input), generation, m_preview_generation, - [this, entry_colors](TextureDisplacementPreviewResult result, uint64_t result_generation) { - indexed_triangle_set its = std::move(result.mesh); + [this, entry_colors, part_ids, owner_id](std::vector results, + uint64_t result_generation) { m_preview_job_running = false; if (result_generation != m_preview_generation->load()) { // Superseded while this was computing (it will have aborted early and come back // empty). Whatever the newest state is, it still needs a run. m_preview_job_pending = true; - } else if (its.indices.empty()) { + } else if (results.empty()) { // Aborted or cancelled rather than finished - the handler runs on every outcome so // the in-flight latch above always clears. Keep whatever preview is already on screen // rather than blanking it; there is no new result to show, not a new empty one. } else { + // A finished run carries the whole object, so it replaces the previous one outright: a + // part that is no longer painted must lose its preview, or its flat volume would stay + // hidden behind geometry from before. m_preview_glmodel.reset(); m_preview_color_runs.clear(); - if (result.triangle_color.size() == its.indices.size() && !entry_colors.empty()) { - indexed_triangle_set sorted; - sorted.vertices = its.vertices; - sorted.indices.reserve(its.indices.size()); - for (int want = 0; want <= int(entry_colors.size()); ++want) { - const size_t first = sorted.indices.size(); - for (size_t i = 0; i < its.indices.size(); ++i) - if (int(result.triangle_color[i]) == want) - sorted.indices.push_back(its.indices[i]); - if (sorted.indices.size() == first) - continue; - m_preview_color_runs.push_back( - { { first * 3, sorted.indices.size() * 3 }, - want == 0 ? GLVolume::NEUTRAL_COLOR : entry_colors[size_t(want - 1)] }); + m_preview_its = indexed_triangle_set{}; + m_part_previews.clear(); + + for (size_t i = 0; i < results.size() && i < part_ids.size(); ++i) { + indexed_triangle_set its = std::move(results[i].mesh); + if (its.indices.empty()) + continue; // this part's layers moved nothing; its own volume is drawn instead + + std::vector runs; + indexed_triangle_set grouped = + group_preview_by_color(its, results[i].triangle_color, entry_colors, runs); + + if (part_ids[i] == owner_id) { + m_preview_color_runs = std::move(runs); + m_preview_glmodel.init_from(grouped); + m_preview_glmodel.set_color(GLVolume::NEUTRAL_COLOR); + // Keep the displaced mesh so the wireframe overlay can be drawn on the raised + // surface actually shown in the true-displacement view. + m_preview_its = std::move(its); + } else { + auto preview = std::make_unique(); + preview->volume_id = part_ids[i]; + preview->color_runs = std::move(runs); + preview->glmodel.init_from(grouped); + preview->glmodel.set_color(GLVolume::NEUTRAL_COLOR); + m_part_previews.push_back(std::move(preview)); } - m_preview_glmodel.init_from(sorted); - } else { - m_preview_glmodel.init_from(its); } - m_preview_glmodel.set_color(GLVolume::NEUTRAL_COLOR); - // Keep the displaced mesh so the wireframe overlay can be drawn on it (the - // true-displacement view), then refresh the wireframe from it. - m_preview_its = std::move(its); + refresh_wireframe(); // The paint tint rides the displaced surface in this view, so it follows the new mesh. m_paint_overlay_dirty = true; @@ -3702,6 +3800,82 @@ const ModelVolume* GLGizmoTextureDisplacement::texture_volume() const return const_cast(this)->texture_volume(); } +std::vector GLGizmoTextureDisplacement::texture_parts() +{ + std::vector out; + ModelObject *mo = m_c->selection_info()->model_object(); + if (mo == nullptr) + return out; + for (ModelVolume *mv : mo->volumes) + if (mv->is_model_part()) + out.push_back(mv); + return out; +} + +std::vector GLGizmoTextureDisplacement::painted_parts() +{ + std::vector out; + for (ModelVolume *mv : texture_parts()) + if (mv->is_texture_displacement_painted()) + out.push_back(mv); + return out; +} + +bool GLGizmoTextureDisplacement::any_part_painted() const +{ + for (const ModelVolume *mv : const_cast(this)->texture_parts()) + if (mv->is_texture_displacement_painted()) + return true; + return false; +} + +std::vector GLGizmoTextureDisplacement::layers_for_part(const ModelVolume &part) const +{ + const ModelVolume *owner = texture_volume(); + if (owner == nullptr) + return {}; + std::vector out = owner->texture_displacement_layers; + if (&part == owner) + return out; + for (TextureDisplacementLayer &layer : out) { + layer.lscm_seam_edges.clear(); + layer.islands.clear(); + layer.island_groups.clear(); + layer.lscm_uv_overrides.clear(); + } + return out; +} + +Vec3d GLGizmoTextureDisplacement::texture_anchor() const +{ + const ModelVolume *owner = texture_volume(); + return owner != nullptr ? Vec3d(texture_displacement_volume_to_world(*owner).translation()) : Vec3d::Zero(); +} + +std::vector GLGizmoTextureDisplacement::resting_drops(const std::vector &parts) +{ + const auto bottom = [](const ModelVolume &part) { + return part.mesh().transformed_bounding_box(texture_displacement_volume_to_world(part)).min.z(); + }; + // Each part's bottom is measured the same way as the object's, so the lowest part's drop is exactly + // 0 and a single-part object bakes against its own bottom as it always has. + double object_bottom = std::numeric_limits::max(); + for (const ModelVolume *part : texture_parts()) + object_bottom = std::min(object_bottom, bottom(*part)); + std::vector out; + out.reserve(parts.size()); + for (const ModelVolume *part : parts) + out.push_back(float(bottom(*part) - object_bottom)); + return out; +} + +Transform3d GLGizmoTextureDisplacement::prepare_texture_frame(const ModelVolume &part) +{ + if (texture_parts().size() < 2) + return Transform3d::Identity(); + return texture_displacement_bake_frame(texture_displacement_volume_to_world(part), texture_anchor()); +} + void GLGizmoTextureDisplacement::update_model_object() { store_panel_state(); @@ -4982,7 +5156,10 @@ void GLGizmoTextureDisplacement::remove_texture_layer(int slot) [slot](const TextureDisplacementLayer &l) { return l.slot == slot; }), layers.end()); if (slot >= 0 && slot < int(TEXTURE_DISPLACEMENT_MAX_LAYERS)) { - mv->texture_displacement_facet(slot).reset(); + // Every model part: paint left in the slot on another part would still bake, and the next layer + // added reuses the slot. + for (ModelVolume *part : texture_parts()) + part->texture_displacement_facet(slot).reset(); m_thumbnails[size_t(slot)].reset(); m_thumbnail_source[size_t(slot)].reset(); m_layer_expanded[size_t(slot)] = false; @@ -5073,25 +5250,19 @@ void GLGizmoTextureDisplacement::move_texture_layer(int slot, int to_index) int GLGizmoTextureDisplacement::select_visible_faces(const std::array *uv_clip) { - ModelVolume *mv = texture_volume(); - ModelObject *mo = m_c->selection_info()->model_object(); - const int idx = texture_volume_raycaster_index(); - if (mv == nullptr || mo == nullptr || idx < 0 || idx >= int(m_triangle_selectors.size())) + const ModelVolume *owner = texture_volume(); + ModelObject *mo = m_c->selection_info()->model_object(); + // Every model part, at its selector's and its raycaster's index (see texture_parts()): what is in + // view gets painted whichever part it belongs to, and one part can hide another. + const std::vector parts = texture_parts(); + const std::vector raycasters = m_c->raycaster()->raycasters(); + if (owner == nullptr || mo == nullptr || parts.size() > m_triangle_selectors.size() || parts.size() > raycasters.size()) return 0; - const indexed_triangle_set &its = mv->mesh().its; - if (its.indices.empty()) - return 0; - - const Selection &selection = m_parent.get_selection(); - const Geometry::Transformation trafo(mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix() * - mv->get_matrix()); - const Transform3d &to_world = trafo.get_matrix(); - const Camera &camera = wxGetApp().plater()->get_camera(); - - // Normals transform by the inverse transpose, not by the matrix itself - with a non-uniform - // scale the two differ, and using the wrong one flips the facing test on the scaled axes. - const Matrix3d normal_matrix = to_world.matrix().block<3, 3>(0, 0).inverse().transpose(); + const Selection &selection = m_parent.get_selection(); + const Transform3d instance = mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix(); + const Transform3d owner_to_world = instance * owner->get_matrix(); + const Camera &camera = wxGetApp().plater()->get_camera(); // Pass 1 (cheap): drop back-facing triangles. Under perspective the view direction varies across // the model, so it is taken per triangle from the eye to the centroid; under an orthographic @@ -5101,69 +5272,109 @@ int GLGizmoTextureDisplacement::select_visible_faces(const std::array const bool ortho = camera.get_type() == Camera::EType::Ortho; const Vec3d fwd = camera.get_dir_forward(); - std::vector centroids; // world coords, what get_unobscured_idxs() expects - std::vector front_facing; // parallel: which facet each centroid came from - centroids.reserve(its.indices.size() / 2); - front_facing.reserve(its.indices.size() / 2); + std::vector trafos; + std::vector> centroids(parts.size()); // world coords, what get_unobscured_idxs() expects + std::vector> front_facing(parts.size()); // parallel: which facet each centroid came from + trafos.reserve(parts.size()); + for (size_t p = 0; p < parts.size(); ++p) { + const ModelVolume &part = *parts[p]; + const indexed_triangle_set &its = part.mesh().its; + trafos.emplace_back(instance * part.get_matrix()); + const Transform3d &to_world = trafos.back().get_matrix(); + // The projection frame maps the owner's local coordinates (see apply_projection_frame()), so + // another part's centroids are brought into them before the clip test. + const Transform3d to_owner = (&part == owner) ? Transform3d::Identity() : Transform3d(owner_to_world.inverse() * to_world); - for (size_t f = 0; f < its.indices.size(); ++f) { - const stl_triangle_vertex_indices &tri = its.indices[f]; - const Vec3d a = its.vertices[tri[0]].cast(); - const Vec3d b = its.vertices[tri[1]].cast(); - const Vec3d c = its.vertices[tri[2]].cast(); - const Vec3d n_world = normal_matrix * (b - a).cross(c - a); - if (n_world.squaredNorm() < 1e-20) - continue; // degenerate triangle: no meaningful normal, so no meaningful facing test - const Vec3d centroid_local = (a + b + c) / 3.0; - const Vec3d centroid_world = to_world * centroid_local; - const Vec3d view_dir = ortho ? fwd : Vec3d(centroid_world - eye); - if (n_world.dot(view_dir) >= 0.0) - continue; // facing away from the camera + // Normals transform by the inverse transpose, not by the matrix itself - with a non-uniform + // scale the two differ, and using the wrong one flips the facing test on the scaled axes. + const Matrix3d normal_matrix = to_world.matrix().block<3, 3>(0, 0).inverse().transpose(); - // Clip to the projection frame before the raycast, not after: outside the frame the texture - // samples to nothing anyway, so those facets would only be painted to no effect - and this - // is also what keeps the ray queries proportional to the framed area instead of the model. - if (uv_clip != nullptr) { - Vec2f uv; - if (!project_uv_projective(*uv_clip, centroid_local.cast(), uv)) - continue; // behind the projector - if (uv.x() < 0.f || uv.x() > 1.f || uv.y() < 0.f || uv.y() > 1.f) - continue; + centroids[p].reserve(its.indices.size() / 2); + front_facing[p].reserve(its.indices.size() / 2); + for (size_t f = 0; f < its.indices.size(); ++f) { + const stl_triangle_vertex_indices &tri = its.indices[f]; + const Vec3d a = its.vertices[tri[0]].cast(); + const Vec3d b = its.vertices[tri[1]].cast(); + const Vec3d c = its.vertices[tri[2]].cast(); + const Vec3d n_world = normal_matrix * (b - a).cross(c - a); + if (n_world.squaredNorm() < 1e-20) + continue; // degenerate triangle: no meaningful normal, so no meaningful facing test + const Vec3d centroid_local = (a + b + c) / 3.0; + const Vec3d centroid_world = to_world * centroid_local; + const Vec3d view_dir = ortho ? fwd : Vec3d(centroid_world - eye); + if (n_world.dot(view_dir) >= 0.0) + continue; // facing away from the camera + + // Clip to the projection frame before the raycast, not after: outside the frame the texture + // samples to nothing anyway, so those facets would only be painted to no effect - and this + // is also what keeps the ray queries proportional to the framed area instead of the model. + if (uv_clip != nullptr) { + Vec2f uv; + if (!project_uv_projective(*uv_clip, (to_owner * centroid_local).cast(), uv)) + continue; // behind the projector + if (uv.x() < 0.f || uv.x() > 1.f || uv.y() < 0.f || uv.y() > 1.f) + continue; + } + centroids[p].emplace_back(centroid_world.cast()); + front_facing[p].push_back(unsigned(f)); } - centroids.emplace_back(centroid_world.cast()); - front_facing.push_back(unsigned(f)); } - if (centroids.empty()) - return 0; // Pass 2 (the expensive one): a real ray query per surviving centroid, so geometry in front of a // front-facing triangle correctly hides it - the far inner wall of a cup is front-facing but not - // visible. This is why the whole thing is click-driven rather than live. - std::vector unobscured; + // visible. This is why the whole thing is click-driven rather than live. Each raycaster only sees + // its own part's mesh, so a centroid has to be clear of every one of them; its own part goes first, + // since that is what hides most of them. + size_t visible = 0; { wxBusyCursor wait; - unobscured = m_c->raycaster()->raycasters()[size_t(idx)]->get_unobscured_idxs( - trafo, camera, centroids, m_c->object_clipper()->get_clipping_plane()); + const ClippingPlane *clipping_plane = m_c->object_clipper()->get_clipping_plane(); + for (size_t p = 0; p < parts.size(); ++p) { + std::vector &points = centroids[p]; + std::vector &facets = front_facing[p]; + const auto keep_unobscured_by = [&](size_t q) { + const std::vector clear = raycasters[q]->get_unobscured_idxs(trafos[q], camera, points, clipping_plane); + std::vector kept_points; + std::vector kept_facets; + kept_points.reserve(clear.size()); + kept_facets.reserve(clear.size()); + for (unsigned i : clear) { + kept_points.push_back(points[i]); + kept_facets.push_back(facets[i]); + } + points = std::move(kept_points); + facets = std::move(kept_facets); + }; + if (!points.empty()) + keep_unobscured_by(p); + for (size_t q = 0; q < parts.size() && !points.empty(); ++q) + if (q != p) + keep_unobscured_by(q); + visible += facets.size(); + } } - if (unobscured.empty()) + if (visible == 0) return 0; Plater::TakeSnapshot snapshot(wxGetApp().plater(), _u8L("Select visible faces for texture displacement"), UndoRedo::SnapshotType::GizmoAction); - // Replaces the layer's paint rather than adding to it: the checkbox means "project onto what I - // can see", so a second capture from a new angle should not leave the previous angle painted. + // Replaces the layer's paint rather than adding to it, on every part including those nothing was + // visible on: the checkbox means "project onto what I can see", so a second capture from a new + // angle should not leave the previous angle painted. // TriangleSelectorGUI, not the TriangleSelector base: request_update_render_data() is declared on // the GUI subclass, so binding to the base here would drop it. - TriangleSelectorGUI &selector = *m_triangle_selectors[size_t(idx)]; - selector.reset(); - for (unsigned i : unobscured) - selector.set_facet(int(front_facing[i]), EnforcerBlockerType::ENFORCER); - selector.request_update_render_data(true); + for (size_t p = 0; p < parts.size(); ++p) { + TriangleSelectorGUI &selector = *m_triangle_selectors[p]; + selector.reset(); + for (unsigned f : front_facing[p]) + selector.set_facet(int(f), EnforcerBlockerType::ENFORCER); + selector.request_update_render_data(true); + } update_model_object(); m_parent.set_as_dirty(); - return int(unobscured.size()); + return int(visible); } void GLGizmoTextureDisplacement::select_whole_model() @@ -5190,27 +5401,31 @@ void GLGizmoTextureDisplacement::select_whole_model() void GLGizmoTextureDisplacement::subdivide_model() { - ModelVolume *mv = texture_volume(); ModelObject *mo = m_c->selection_info()->model_object(); - if (mv == nullptr || mo == nullptr || m_subdivide_count < 1) + // Every model part, like the remesh: this is a plain mesh operation on the object, and a part left + // coarse is a part no height map can raise relief on. + const std::vector parts = texture_parts(); + if (mo == nullptr || parts.empty() || m_subdivide_count < 1) return; // 0 passes means "no subdivision" - don't take a snapshot for a no-op Plater *plater = wxGetApp().plater(); Plater::TakeSnapshot snapshot(plater, _u8L("Subdivide model for texture displacement"), UndoRedo::SnapshotType::GizmoAction); - // Same save/replace/restore-painting dance GLGizmoSimplify uses when it re-tessellates a - // volume's mesh: supported/seam/mmu/fuzzy-skin masks get remapped onto the new triangles, - // texture-displacement doesn't (no remap support for it yet) and is dropped instead of being - // left referring to triangle indices that no longer mean the same thing. - std::optional saved_painting = mv->save_painting(); + for (ModelVolume *mv : parts) { + // Same save/replace/restore-painting dance GLGizmoSimplify uses when it re-tessellates a + // volume's mesh: supported/seam/mmu/fuzzy-skin masks get remapped onto the new triangles, + // texture-displacement doesn't (no remap support for it yet) and is dropped instead of being + // left referring to triangle indices that no longer mean the same thing. + std::optional saved_painting = mv->save_painting(); - // max_edge_length 0 means "no triangle is ever small enough", so every non-degenerate edge is - // split on each of the m_subdivide_count passes - i.e. a plain "subdivide the whole mesh N times". - TriangleMesh new_mesh(subdivide_mesh_uniform(mv->mesh().its, 0.f, m_subdivide_count)); - mv->set_mesh(std::move(new_mesh)); - mv->set_new_unique_id(); - mv->calculate_convex_hull(); - mv->restore_painting(saved_painting); + // max_edge_length 0 means "no triangle is ever small enough", so every non-degenerate edge is + // split on each of the m_subdivide_count passes - i.e. a plain "subdivide the whole mesh N times". + TriangleMesh new_mesh(subdivide_mesh_uniform(mv->mesh().its, 0.f, m_subdivide_count)); + mv->set_mesh(std::move(new_mesh)); + mv->set_new_unique_id(); + mv->calculate_convex_hull(); + mv->restore_painting(saved_painting); + } if (ObjectList *obj_list = wxGetApp().obj_list()) { const ModelObjectPtrs &objs = plater->model().objects; @@ -5855,13 +6070,35 @@ ColorQuantizeFn GLGizmoTextureDisplacement::make_palette_quantizer(const std::ve TextureDisplacementPrepareResult GLGizmoTextureDisplacement::prepare_mesh( const indexed_triangle_set &base, const TextureDisplacementFacetsData &masks, const std::vector &layers, const std::vector &model_uv, - const TextureDisplacementPrepareParams ¶ms, + const Transform3d &texture_frame, const TextureDisplacementPrepareParams ¶ms, const TextureColorSettings &color_settings, const DisplacementProgressFn &progress, BakeStageRecorder *debug) { TextureDisplacementPrepareResult out; const auto report = [&progress](int pct) { return !progress || progress(pct); }; + // The samplers are built over a copy of the current mesh moved into `texture_frame`, and queried + // with points and normals mapped across, so the stages below go on measuring the mesh itself. + const bool framed = !texture_frame.matrix().isApprox(Transform3d::Identity().matrix()); + const Matrix3d frame_normal = texture_frame.linear().inverse().transpose(); + indexed_triangle_set framed_mesh; + const auto mesh_to_sample = [&](const indexed_triangle_set &its) -> const indexed_triangle_set & { + if (!framed) + return its; + framed_mesh = its; + for (Vec3f &v : framed_mesh.vertices) + v = (texture_frame * v.cast()).cast(); + return framed_mesh; + }; + const auto sample_in_frame = [&](auto sampler) -> decltype(sampler) { + if (!framed || !sampler) + return sampler; + return [sampler, frame = texture_frame, frame_normal](const Vec3f &pos, const Vec3f &normal) { + return sampler((frame * pos.cast()).cast(), + (frame_normal * normal.cast()).normalized().cast()); + }; + }; + // Stage capture for the debug view. Timed from the end of the previous stage, so the capture - // a copy plus an edge scan - never lands inside the measurement it reports. auto stage_clock = std::chrono::steady_clock::now(); @@ -5937,17 +6174,20 @@ TextureDisplacementPrepareResult GLGizmoTextureDisplacement::prepare_mesh( // length baseline alone. const std::vector uv_stage = uv_now(); const std::vector *uv_ptr = uv_stage.empty() ? nullptr : &uv_stage; + const indexed_triangle_set &sampled = mesh_to_sample(mesh.its); HeightFieldSampler sampler; if (params.subdiv_feature) - sampler = make_combined_displacement_sampler(mesh.its, layers, current, uv_ptr); + sampler = sample_in_frame(make_combined_displacement_sampler(sampled, layers, current, uv_ptr)); // Colour boundaries need triangles of their own - the chord test cannot see them, since // the height field is perfectly smooth across a change of filament. ColorFieldSampler color; // A flat-colour layer is matched against single filaments only, as the bake does, so its // boundaries are refined where the bake will actually change filament. if (params.subdiv_color_edge_mm > 0.f && !color_settings.empty()) - color = make_combined_color_sampler(mesh.its, layers, current, make_palette_quantizer(color_settings.palette), - make_palette_quantizer(color_settings.palette_pure), uv_ptr); + color = sample_in_frame(make_combined_color_sampler(sampled, layers, current, + make_palette_quantizer(color_settings.palette), + make_palette_quantizer(color_settings.palette_pure), + uv_ptr)); // The refinement follows perceived colour: a mix is one colour here, however the slicer // interleaves its filaments layer by layer. // "Min edge" is a feature-mode control (it is the floor the curvature test refines down @@ -6008,8 +6248,8 @@ TextureDisplacementPrepareResult GLGizmoTextureDisplacement::prepare_mesh( cut_region[i] = (region[size_t(source[i])] & REFINE_PAINTED) ? 1 : 0; const std::vector uv_refined = uv_now(); const HeightFieldSampler refined_sampler = - make_combined_displacement_sampler(mesh.its, layers, current, - uv_refined.empty() ? nullptr : &uv_refined); + sample_in_frame(make_combined_displacement_sampler(mesh_to_sample(mesh.its), layers, current, + uv_refined.empty() ? nullptr : &uv_refined)); std::vector cut_source; size_t cuts = 0; indexed_triangle_set cut = cut_mesh_at_steps(mesh.its, cut_region, refined_sampler, @@ -6047,7 +6287,7 @@ void GLGizmoTextureDisplacement::subdivide_model_adaptive() update_model_object(); // flush any in-progress stroke into the committed masks first - if (!mv->is_texture_displacement_painted()) { + if (!any_part_painted()) { show_error(nullptr, _u8L("Paint the area you want to subdivide first - adaptive subdivision only " "refines where you have painted.")); return; @@ -6209,7 +6449,8 @@ void GLGizmoTextureDisplacement::remesh_model() params.remesh_sharp_deg = m_remesh_keep_sharp_edges ? m_remesh_sharp_angle_deg : 0.f; queue_prepare(params, _u8L("Remesh model for texture displacement"), /* then_bake */ false, _u8L("Remeshing did not change the model. It may be non-manifold (open edges or edges " - "shared by more than two triangles), or the target edge length may already be met.")); + "shared by more than two triangles), or the target edge length may already be met."), + PrepareScope::AllParts); } void GLGizmoTextureDisplacement::rebuild_subdivide_preview() @@ -6360,23 +6601,35 @@ GLTexture *GLGizmoTextureDisplacement::get_layer_height_texture(const TextureDis void GLGizmoTextureDisplacement::bake(bool own_snapshot) { - ModelVolume *mv = texture_volume(); - if (!mv || m_bake_in_progress) + ModelVolume *owner = texture_volume(); + if (owner == nullptr || m_bake_in_progress) return; // Make sure the currently active layer's in-progress edits are flushed into the model before // baking, otherwise the most recent, not-yet-committed strokes would be silently skipped. update_model_object(); - if (!mv->is_texture_displacement_painted()) { + // Every painted part, not only the one holding the layer stack: the brush paints across all of + // them (see update_model_object()), so baking one would leave the user's paint on the others + // untouched and their geometry flat. + const std::vector parts = painted_parts(); + if (parts.empty()) { show_error(nullptr, _u8L("Nothing is painted, there is nothing to bake.")); return; } + const Vec3d anchor = texture_anchor(); + const std::vector drops = resting_drops(parts); + std::vector volumes; + volumes.reserve(parts.size()); + for (size_t i = 0; i < parts.size(); ++i) + volumes.push_back(texture_displacement_bake_volume(*parts[i], layers_for_part(*parts[i]), + owner->texture_displacement_options, anchor, drops[i])); + m_bake_in_progress = true; - queue_texture_displacement_bake(*mv, color_settings_for(*mv), [this]() { + queue_texture_displacement_bake(std::move(volumes), color_settings_for(*owner), [this]() { m_bake_in_progress = false; - // Baking replaces the volume's mesh (new id, new topology) without changing the object's + // Baking replaces each baked part's mesh (new id, new topology) without changing the object's // id or volume count, so GLGizmoPainterBase::data_changed()'s usual change-detection never // notices it needs to reload - do it explicitly here, otherwise the gizmo keeps painting // and rendering against the stale, pre-bake TriangleSelectorPatch until the object is @@ -6448,7 +6701,7 @@ void GLGizmoTextureDisplacement::bake_standard() return; update_model_object(); // flush the active layer's in-progress strokes before anything reads them - if (!mv->is_texture_displacement_painted()) { + if (!any_part_painted()) { show_error(nullptr, _u8L("Nothing is painted, there is nothing to bake.")); return; } @@ -6520,7 +6773,8 @@ void GLGizmoTextureDisplacement::run_stage_debug() m_debug_in_progress = true; queue_texture_displacement_debug( - *mv, color_settings_for(*mv), params, run_prepare, m_debug_check_topology, + *mv, color_settings_for(*mv), params, prepare_texture_frame(*mv), resting_drops({mv}).front(), run_prepare, + m_debug_check_topology, [this](std::vector stages) { m_debug_in_progress = false; if (!stages.empty()) { @@ -6548,6 +6802,9 @@ void GLGizmoTextureDisplacement::show_debug_stage(int index) m_use_shaded_preview = false; m_preview_color_runs.clear(); m_preview_glmodel.reset(); + // The stage is a capture of one part's run, so the other parts go back to being drawn as themselves + // rather than keeping a live preview the captured stages say nothing about. + m_part_previews.clear(); indexed_triangle_set its; its.vertices = stage.mesh.vertices; @@ -6669,23 +6926,36 @@ void GLGizmoTextureDisplacement::render_debug_stage_panel(ModelVolume *mv) void GLGizmoTextureDisplacement::queue_prepare(const TextureDisplacementPrepareParams ¶ms, const std::string &snapshot_name, bool then_bake, - const std::string &unchanged_msg) + const std::string &unchanged_msg, PrepareScope scope) { - ModelVolume *mv = texture_volume(); - if (mv == nullptr || m_prepare_in_progress || m_bake_in_progress) + ModelVolume *owner = texture_volume(); + if (owner == nullptr || m_prepare_in_progress || m_bake_in_progress) + return; + + // Preparing only the layer stack's own part would hand the displacement a coarse mesh everywhere + // else - a height map can only move vertices that already exist, so on a multibody object that is + // the difference between relief and a flat face. See PrepareScope for which parts that means. + const std::vector parts = scope == PrepareScope::AllParts ? texture_parts() : painted_parts(); + if (parts.empty()) return; TextureDisplacementPrepareInput input; - input.volume_id = mv->id(); - input.base_mesh = mv->mesh().its; - input.masks = facets_data_of(*mv); - input.layers = mv->texture_displacement_layers; input.params = params; input.snapshot_name = snapshot_name; - if (mv->has_texture_uv()) - input.model_uv = mv->texture_uv; + input.volumes.reserve(parts.size()); + for (const ModelVolume *part : parts) { + TextureDisplacementPrepareVolume entry; + entry.volume_id = part->id(); + entry.base_mesh = part->mesh().its; + entry.masks = facets_data_of(*part); + entry.layers = layers_for_part(*part); + if (part->has_texture_uv()) + entry.model_uv = part->texture_uv; + entry.texture_frame = prepare_texture_frame(*part); + input.volumes.push_back(std::move(entry)); + } if (params.subdiv_color_edge_mm > 0.f) - input.color = color_settings_for(*mv); + input.color = color_settings_for(*owner); m_prepare_in_progress = true; queue_texture_displacement_prepare(std::move(input), [this, then_bake, unchanged_msg]( @@ -8399,9 +8669,20 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float const float footer_top = ImGui::GetCursorScreenPos().y; ImGui::Separator(); { - const float x0 = ImGui::GetCursorPosX(); - const int base_k = mv != nullptr ? int((mv->mesh().facets_count() + 500) / 1000) : 0; - const bool v2 = mv != nullptr && mv->texture_displacement_options.pipeline_v2; + const float x0 = ImGui::GetCursorPosX(); + // Over every part the bake will act on, not just the one holding the layer stack, so the count + // the footer quotes is the count Bake is actually working with on a multibody object. Before + // anything is painted there is nothing to bake yet, and the whole object is the honest estimate. + size_t base_facets = 0; + { + std::vector counted = painted_parts(); + if (counted.empty()) + counted = texture_parts(); + for (const ModelVolume *part : counted) + base_facets += part->mesh().facets_count(); + } + const int base_k = int((base_facets + 500) / 1000); + const bool v2 = mv != nullptr && mv->texture_displacement_options.pipeline_v2; // The triangle budget is the one subdivision control Standard mode keeps: its right value depends on // the part rather than on the recipe (a big model, or a fine texture, simply needs more of them), and @@ -8534,7 +8815,9 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float ImGui::SameLine(x0 + panel_w - button_w * 2 - style.ItemSpacing.x); - const bool can_bake = !busy && mv != nullptr && mv->is_texture_displacement_painted(); + // Read before Close below, which releases the selection any_part_painted() finds the parts through. + const bool painted = mv != nullptr && any_part_painted(); + const bool can_bake = !busy && painted; const std::string bake_label = m_prepare_in_progress ? _u8L("Preparing...") : m_bake_in_progress ? _u8L("Baking...") : into_u8(m_desc.at("bake")); @@ -8554,7 +8837,7 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float m_imgui->pop_bold_font(); GLGizmoUtils::pop_orca_button_style(); if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) - panel_tooltip(mv != nullptr && !mv->is_texture_displacement_painted() ? + panel_tooltip(mv != nullptr && !painted ? (m_seam_edit_mode ? _u8L("Nothing is painted yet. The UV editor's seam tool is on, so " "strokes on the model mark seams instead of painting - turn " "it off in the pane to paint.") : @@ -8580,8 +8863,8 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float // What Bake will produce, and which layers it will skip. if (mv != nullptr) { const std::string base_count = base_k > 0 ? Slic3r::format(_u8L("%1% k"), base_k) : - std::to_string(mv->mesh().facets_count()); - const unsigned base_n = base_k > 0 ? unsigned(base_k) * 1000 : unsigned(mv->mesh().facets_count()); + std::to_string(base_facets); + const unsigned base_n = base_k > 0 ? unsigned(base_k) * 1000 : unsigned(base_facets); const unsigned result_n = unsigned(base_k + m_subdivide_budget_k) * 1000; // TRN %1% is a triangle count, either exact or rounded to thousands such as "120 k". std::string note = v2 ? Slic3r::format(into_u8(_L_PLURAL("Model: %1% triangle - the bake refines to the resolution above, up to its budget", @@ -8591,7 +8874,7 @@ void GLGizmoTextureDisplacement::on_render_input_window(float x, float y, float "Bake moves existing vertices - the model stays at %1% triangles", base_n)), base_count) : Slic3r::format(into_u8(_L_PLURAL("Bake result up to ~%1% k triangle", "Bake result up to ~%1% k triangles", result_n)), base_k + m_subdivide_budget_k); - if (mv->is_texture_displacement_painted()) { + if (painted) { std::vector skipped; for (const TextureDisplacementLayer &l : mv->texture_displacement_layers) if (!slot_painted(l.slot)) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.hpp b/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.hpp index 22d8b417c7..873d90ff69 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.hpp @@ -15,6 +15,7 @@ #include #include #include "libslic3r/Color.hpp" +#include "libslic3r/ObjectID.hpp" #include #include "libslic3r/TriangleSelector.hpp" #include "libslic3r/TriangleMesh.hpp" @@ -69,6 +70,14 @@ public: // to the samplers so a ModelUV layer drives // the refinement through its own layout. const std::vector &model_uv, + // `base`'s coordinates -> the frame the bake + // samples the texture in, so the refinement + // follows the texture the bake will apply. + // Only the sampling moves into it: the mesh, + // and every length in `params`, stay in + // `base`'s own coordinates. Identity samples + // there as well. + const Transform3d &texture_frame, const TextureDisplacementPrepareParams ¶ms, const TextureColorSettings &color_settings, const DisplacementProgressFn &progress, @@ -185,6 +194,35 @@ public: ColorRGBA color; }; std::vector m_preview_color_runs; + + // The displaced preview of each painted model part *other* than the one owning the layer stack. That + // part keeps m_preview_glmodel and m_preview_its, which the paint overlays, the wireframe and the UV + // and seam editors are all keyed to; the remaining parts of a multibody object only need their + // geometry drawn, so that is all this holds. Built by the same preview job, one entry per part. + // + // Held behind unique_ptr because GLModel owns GPU buffers and has no move constructor: a vector of + // them by value would copy the handles on reallocation and free them twice. + struct PartPreview + { + ObjectID volume_id; + GLModel glmodel; + std::vector color_runs; + }; + std::vector> m_part_previews; + // The part `preview` was built for, or nullptr if it has gone away or had its mesh replaced since - + // in which case that part's own volume is drawn instead of a preview that no longer describes it. + const ModelVolume *preview_part(const PartPreview &preview) const; + // Whether the true-displacement view has anything to draw. Asking m_preview_glmodel alone would + // hide the real volumes behind an empty preview whenever only another part is painted. + bool has_true_preview() const { return m_preview_glmodel.is_initialized() || !m_part_previews.empty(); } + // The preview mesh as it is uploaded: when the run reported a palette entry per triangle, the index + // buffer is reordered so that each palette colour becomes one contiguous draw range (returned in + // `runs`); otherwise `its` is handed back unchanged and `runs` stays empty. Only the index buffer is + // permuted, never the vertices - see PreviewColorRun. + static indexed_triangle_set group_preview_by_color(const indexed_triangle_set &its, + const std::vector &triangle_color, + const std::vector &entry_colors, + std::vector &runs); // True if any of the volume's layers would actually colour something: colour turned on, and a // texture that has colour to give. What decides whether a palette is captured into a job at all, // and so whether the colour criterion and the mmu write ever run. @@ -258,12 +296,46 @@ private: void on_shutdown() override; PainterGizmoType get_painter_type() const override; - // Phase 1 restricts the texture layer list to the first model-part volume of the current - // object (the common single-volume case); multi-part objects only get texture layers on - // their first part until a later phase. Returns nullptr if there is no model part. + // The model part that owns the object's texture layer stack, its options, and the unwrap the UV and + // seam editors work on: the first model part of the current object. Those are object-wide settings + // kept on one part rather than copied onto all of them. Returns nullptr if there is no model part. + // + // This is *not* the set of parts a bake acts on - see painted_parts(). Reading the layer stack and + // baking are different questions, and answering the second one with this is what made texture + // displacement ignore every part of a multibody object but the first. ModelVolume* texture_volume(); const ModelVolume* texture_volume() const; + // Every model part of the current object, in the object's own volume order - which is also the + // order update_from_model_object() builds m_triangle_selectors in, so index i here is selector i. + std::vector texture_parts(); + // The parts a bake or a preview acts on: those of texture_parts() carrying paint in at least one + // slot. Empty when nothing is painted anywhere on the object, which is what the Bake button and its + // "nothing is painted" check test. + std::vector painted_parts(); + bool any_part_painted() const; + + // The object's layer stack as it applies to `part`. The stack itself lives on texture_volume(), but + // four of each layer's fields index *that* part's mesh and the chart ids of *its* unwrap - the LSCM + // seam edges, the island placements, their join groups and the per-vertex uv overrides. Carried onto + // another part they would address triangles and charts that have nothing to do with it, so they are + // dropped and that part unwraps on its own. Everything else - the image, depth, tiling, projection + // method, blend mode, colour - applies unchanged, since every part is baked in the one texture frame + // anchored at texture_anchor(); that is what lets one stack texture a whole multibody object. + std::vector layers_for_part(const ModelVolume &part) const; + // The world point the object's texture is anchored at: texture_volume()'s origin. Every part is + // baked and previewed in the frame anchored there (see texture_displacement_bake_frame()), so a + // tiled pattern runs on across the parts and a view projection lands where it was aimed on each. + Vec3d texture_anchor() const; + // For each of `parts`, at the same index: how far the object's lowest point lies below that part's + // own, in mm - what its bake lowers its resting plane by, so every part is clamped against the one + // plane the object rests on. 0 for the lowest part, and so for a single-part object. + std::vector resting_drops(const std::vector &parts); + // Where prepare_mesh() samples `part`'s texture: the frame its bake samples in when the object has + // several model parts, so they are all refined for one continuous texture. A single-part object + // keeps the identity, the frame it has always been refined in. + Transform3d prepare_texture_frame(const ModelVolume &part); + void add_texture_layer(); void remove_texture_layer(int slot); // Moves the layer in `slot` to position `to_index` of the slot-ordered stack (an insertion index, @@ -310,8 +382,14 @@ private: // - `unchanged_msg`, when not empty, is shown if the run had nothing to do. Standard's Bake passes // nothing: a mesh that already meets the criteria is not an error there, it just goes straight // on to the displacement. + // - `scope` is which of the object's model parts to prepare. Anything feeding a displacement + // prepares exactly the parts that displacement will move; a plain Remesh is a mesh operation on + // the object and takes all of them, so painting the rest of a multibody object afterwards has a + // dense enough mesh to show relief on. + enum class PrepareScope { PaintedParts, AllParts }; void queue_prepare(const TextureDisplacementPrepareParams ¶ms, const std::string &snapshot_name, - bool then_bake, const std::string &unchanged_msg); + bool then_bake, const std::string &unchanged_msg, + PrepareScope scope = PrepareScope::PaintedParts); // Set from queue_prepare() until its job's result has been committed. Distinct from // m_bake_in_progress because Standard's Bake sets both in turn, and because every button that would // read or replace the mesh has to stay disabled for the whole of it. @@ -351,14 +429,14 @@ private: // volume's slot among them, or -1 if it has none (no selection, or the lists disagree). int texture_volume_raycaster_index() const; - // Paints exactly the facets currently visible from the camera onto the active layer, replacing - // whatever that layer had painted. "Visible" is two tests: the facet faces the camera, and its - // centroid is not hidden behind other geometry (a real raycast, so a concave part's far inner - // wall is correctly excluded). When `uv_clip` is given (the projection frame's matrix), facets - // whose centroid falls outside the frame's uv unit square are skipped first - which both clips - // the selection to the frame and spares the raycast for everything outside it. Costs one ray - // query per surviving facet, so it is a one-shot action, never a per-frame one. Returns the - // number of facets selected. + // Paints exactly the facets currently visible from the camera onto the active layer, on every model + // part, replacing whatever that layer had painted on each. "Visible" is two tests: the facet faces + // the camera, and its centroid is not hidden behind other geometry of any part (a real raycast, so + // a concave part's far inner wall is correctly excluded). When `uv_clip` is given (the projection + // frame's matrix), facets whose centroid falls outside the frame's uv unit square are skipped first + // - which both clips the selection to the frame and spares the raycast for everything outside it. + // Costs one ray query per surviving facet and part, so it is a one-shot action, never a per-frame + // one. Returns the number of facets selected. int select_visible_faces(const std::array *uv_clip = nullptr); // When set, "Capture current view" also re-selects the visible faces, so the viewpoint the diff --git a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp index e391022d6c..9cabc2e3fe 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp @@ -7,7 +7,6 @@ #include -#include #include "slic3r/GUI/Selection.hpp" #include #include "libslic3r/Model.hpp" @@ -174,6 +173,9 @@ void InstancesHider::on_update() m_clippers.emplace_back(new MeshClipper); m_clippers.back()->set_plane(ClippingPlane(-Vec3d::UnitZ(), z_min)); m_clippers.back()->set_mesh(mesh->its); + // Outline only: a filled cap would read as a surface the object does not have, and it + // covers the model below it. 0.4 mm matches the cut gizmo's contour width. + m_clippers.back()->set_behaviour(false, 0.4); } m_old_meshes = meshes; } @@ -214,10 +216,7 @@ void InstancesHider::render_cut() const else clipper->set_limiting_plane(ClippingPlane::ClipsNothing()); - glsafe(::glPushAttrib(GL_DEPTH_TEST)); - glsafe(::glDisable(GL_DEPTH_TEST)); - clipper->render_cut(mv->is_model_part() ? ColorRGBA(0.8f, 0.3f, 0.0f, 1.0f) : color_from_model_volume(*mv)); - glsafe(::glPopAttrib()); + clipper->render_contour(mv->is_model_part() ? ColorRGBA(0.8f, 0.3f, 0.0f, 1.0f) : color_from_model_volume(*mv)); ++clipper_id; } diff --git a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp index 427eac8b9c..9e17c2a015 100644 --- a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp +++ b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp @@ -748,7 +748,8 @@ void GizmoObjectManipulation::set_init_rotation(const Geometry::Transformation & void GizmoObjectManipulation::reset_align_state() { m_hovered_align_type = GLGizmoAlignment::AlignType::NONE; - m_align_to_parent = !m_alignment_helper.can_align(GLGizmoAlignment::AlignType::X_MIN); + m_can_align_within = m_alignment_helper.can_align(GLGizmoAlignment::AlignType::X_MIN); + m_align_to_parent = !m_can_align_within; } void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper, std::string window_name, float x, float y, float bottom_limit) @@ -924,7 +925,7 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper, } if (!focued_on_text) m_glcanvas.handle_sidebar_focus_event("", false); - // Align and distribute along the world axes, within the selection or to the object or plate holding it. + // Align and distribute along the coordinate system of the panel, within the selection or to the object or plate holding it. using AlignType = GLGizmoAlignment::AlignType; const bool old_align_to_parent = m_align_to_parent; AlignType hovered_align_type = AlignType::NONE; @@ -932,6 +933,7 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper, ImGui::Spacing(); ImGui::Separator(); ImGui::Spacing(); + m_alignment_helper.set_object_cs(is_instance_coordinates()); // Each row is row_height tall, separated by ItemSpacing.y. Every control is centered vertically in its row. const float row_y = ImGui::GetCursorPosY(); @@ -954,7 +956,13 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper, _u8L("Selection"), m_alignment_helper.is_parts_selection(true) ? _u8L("Object") : _u8L("Plate") }; - if (!m_alignment_helper.can_align(AlignType::X_MIN)) { + // Selecting enough items to align within them makes that the default, as when the tool opens. + const bool can_align_within = m_alignment_helper.can_align(AlignType::X_MIN); + if (can_align_within != m_can_align_within) { + m_can_align_within = can_align_within; + m_align_to_parent = !can_align_within; + } + if (!can_align_within) { align_modes.erase(align_modes.begin()); m_align_to_parent = true; } diff --git a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.hpp b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.hpp index 7452884146..e69ed2be3a 100644 --- a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.hpp +++ b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.hpp @@ -188,6 +188,8 @@ private: GLGizmoAlignment::AlignType m_hovered_align_type{GLGizmoAlignment::AlignType::NONE}; // Align to the object or plate holding the selection rather than within the selection. bool m_align_to_parent{false}; + // Whether the selection can align within itself, tracked to detect when the selection crosses that threshold. + bool m_can_align_within{false}; // Contains all shortcuts in the format of {shortcut, description}, e.g. {alt + _L("Left mouse button"), _L("Part_selection")} std::vector> m_shortcuts_move; diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index 2234d1afb4..6bd847f32f 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -33,7 +33,7 @@ static const char* HMS_LOCAL_IMG_PATH = "hms/local_image"; // the local HMS info // Orca: dev-id-type set trimmed to the devices Orca ships local HMS images for -static std::unordered_set package_dev_id_types {"094", "239", "093", "22E"}; +static std::unordered_set package_dev_id_types {"094", "239", "093", "22E", "20P", "26A", "31B"}; // Orca: HMS should be disabled when stealth mode is on or networking is not installed static bool should_disable_hms() diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 080e85ad4e..432bd80cae 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include "libslic3r/Technologies.hpp" @@ -50,6 +49,10 @@ #endif #include +#ifdef __APPLE__ +#include "MacIME.hpp" +#endif + #include "libslic3r/libslic3r.h" #include #include "libslic3r/Utils.hpp" @@ -506,6 +509,11 @@ bool ImGuiWrapper::update_mouse_data(wxMouseEvent& evt) io.MouseDown[0] = evt.LeftIsDown(); io.MouseDown[1] = evt.RightIsDown(); io.MouseDown[2] = evt.MiddleIsDown(); + // Replaces a modifier left held when its key-up was sent to another window. + io.KeyCtrl = evt.ControlDown(); + io.KeyShift = evt.ShiftDown(); + io.KeyAlt = evt.AltDown(); + io.KeySuper = evt.MetaDown(); // Only a vertical wheel event with a direction is a wheel step. A macOS trackpad reports sideways motion // as separate horizontal events, and its wheel events often carry a rotation of 0: wx truncates the // sub-pixel deltas to whole ones and passes on events with no delta at all. Read as vertical steps, @@ -588,16 +596,6 @@ void ImGuiWrapper::new_frame() // synchronize key states // when the application loses the focus it may happen that the key up event is not processed - // synchronize modifier keys - constexpr std::array, 3> imgui_mod_keys{ - std::make_pair(ImGuiKeyModFlags_Ctrl, WXK_CONTROL), - std::make_pair(ImGuiKeyModFlags_Shift, WXK_SHIFT), - std::make_pair(ImGuiKeyModFlags_Alt, WXK_ALT) }; - for (const std::pair& key : imgui_mod_keys) { - if ((io.KeyMods & key.first) != 0 && !wxGetKeyState(key.second)) - io.KeyMods &= ~key.first; - } - // Not sure if it is neccessary // values from 33 to 126 are reserved for the standard ASCII characters for (size_t i = 33; i <= 126; ++i) { @@ -618,6 +616,11 @@ void ImGuiWrapper::new_frame() ImDrawData* ImGuiWrapper::end_frame() { +#ifdef __APPLE__ + // io.ImeWindowHandle is the focused canvas' view (GLCanvas3D::on_set_focus()). + if (void* view = ImGui::GetIO().ImeWindowHandle) + mac_ime_set_active(view, ImGui::GetIO().WantTextInput); +#endif ImGui::Render(); m_new_frame_open = false; return ImGui::GetDrawData(); @@ -2137,18 +2140,41 @@ bool ImGuiWrapper::want_any_input() const bool ImGuiWrapper::text_input_active() const { - const ImGuiID id = ImGui::GetActiveID(); - return id != 0 && ImGui::GetInputTextState(id) != nullptr; + // An active InputText requests text input in each frame that draws it, and NewFrame() moves the + // request into io.WantTextInput. + const ImGuiContext& g = *ImGui::GetCurrentContext(); + return g.WithinFrameScope ? g.IO.WantTextInput : g.WantTextInputNextFrame == 1; +} + +// A popup stays on the popup stack while its canvas is hidden, so it counts only if the last finished frame +// drew it, which NewFrame() moves from Active to WasActive. +static bool drawn_last_frame(const ImGuiWindow* popup) +{ + return popup != nullptr && (ImGui::GetCurrentContext()->WithinFrameScope ? popup->WasActive : popup->Active); } bool ImGuiWrapper::modal_popup_open() const { - // A modal stays on the popup stack while its canvas is hidden, so it counts only if the last finished - // frame drew it, which NewFrame() moves from Active to WasActive. - const ImGuiWindow* modal = ImGui::GetTopMostPopupModal(); - if (modal == nullptr) - return false; - return ImGui::GetCurrentContext()->WithinFrameScope ? modal->WasActive : modal->Active; + return drawn_last_frame(ImGui::GetTopMostPopupModal()); +} + +bool ImGuiWrapper::popup_open() const +{ + const ImVector& stack = ImGui::GetCurrentContext()->OpenPopupStack; + return std::any_of(stack.begin(), stack.end(), [](const ImGuiPopupData& popup) { return drawn_last_frame(popup.Window); }); +} + +void ImGuiWrapper::close_top_popup() +{ + const ImVector& stack = ImGui::GetCurrentContext()->OpenPopupStack; + for (int level = stack.Size - 1; level >= 0; --level) { + const ImGuiWindow* popup = stack[level].Window; + if (!drawn_last_frame(popup)) + continue; + if ((popup->Flags & ImGuiWindowFlags_Modal) == 0) + ImGui::ClosePopupToLevel(level, true); + return; + } } bool ImGuiWrapper::owns_key(const KeyChord& chord) const @@ -2156,6 +2182,39 @@ bool ImGuiWrapper::owns_key(const KeyChord& chord) const return modal_popup_open() || (chord.edits_text() && text_input_active()); } +bool ImGuiWrapper::item_held() const +{ + return ImGui::GetIO().MouseDown[0] && ImGui::GetActiveID() != 0; +} + +bool ImGuiWrapper::owns_keyboard() const +{ + return popup_open() || item_held() || text_input_active(); +} + +bool ImGuiWrapper::claim_key_event(const wxKeyEvent& evt) +{ + const bool claimed = owns_keyboard(); + const int key = evt.GetKeyCode(); + if (evt.GetEventType() == wxEVT_KEY_DOWN) { + m_char_claim = m_key_claims.try_emplace(key, claimed).first->second; + return *m_char_claim; + } + if (evt.GetEventType() == wxEVT_KEY_UP) { + m_char_claim.reset(); + if (const auto press = m_key_claims.extract(key)) + return press.mapped(); + return claimed; + } + return std::exchange(m_char_claim, std::nullopt).value_or(claimed); +} + +void ImGuiWrapper::forget_key_claims() +{ + m_key_claims.clear(); + m_char_claim.reset(); +} + ImFontAtlasCustomRect* ImGuiWrapper::GetTextureCustomRect(const wchar_t& tex_id) { auto item = m_custom_glyph_rects_ids.find(tex_id); @@ -3172,6 +3231,14 @@ void ImGuiWrapper::init_input() // Don't let imgui special-case Mac, wxWidgets already do that io.ConfigMacOSXBehaviors = false; +#ifdef __APPLE__ + // Places the input method's candidate window at the text cursor. + io.ImeSetInputScreenPosFn = [](int x, int y) { + if (void* view = ImGui::GetIO().ImeWindowHandle) + mac_ime_set_caret(view, x, y, int(ImGui::GetFontSize())); + }; +#endif + // Setup clipboard interaction callbacks io.SetClipboardTextFn = clipboard_set; io.GetClipboardTextFn = clipboard_get; diff --git a/src/slic3r/GUI/ImGuiWrapper.hpp b/src/slic3r/GUI/ImGuiWrapper.hpp index 6b5487bb5f..e4b8dabd77 100644 --- a/src/slic3r/GUI/ImGuiWrapper.hpp +++ b/src/slic3r/GUI/ImGuiWrapper.hpp @@ -73,6 +73,10 @@ class ImGuiWrapper #endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT std::map m_custom_glyph_rects_ids; std::string m_clipboard_text; + // Keys held down, each with whether ImGui claimed its press. + std::map m_key_claims; + // Whether ImGui claimed the last key-down, for the char event that follows it. + std::optional m_char_claim; public: struct LastSliderStatus { @@ -224,8 +228,21 @@ public: bool text_input_active() const; // True while an ImGui modal popup is on screen. bool modal_popup_open() const; + // True while any ImGui popup is on screen, modal or not. + bool popup_open() const; + // Closes the topmost popup on screen unless it is a modal, which handles Esc itself. + void close_top_popup(); // True for every key while a modal is open, and for text-editing keys while an InputText is active. bool owns_key(const KeyChord& chord) const; + // True while the left mouse button holds an ImGui item, such as a slider being dragged. + bool item_held() const; + // True while a popup is open, an item is held or an InputText is active. + bool owns_keyboard() const; + // Returns owns_keyboard() as of the key's key-down, so its repeats, char event and release get the + // same answer. Call it once per event. + bool claim_key_event(const wxKeyEvent& evt); + // Drops the record of held keys, whose key-ups are sent to the window that takes the focus. + void forget_key_claims(); // Optional inputs are used for set up value inside of an optional, with default value // diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.cpp b/src/slic3r/GUI/Jobs/ArrangeJob.cpp index 1ba99bf1b1..fd4fdee4ed 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.cpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.cpp @@ -50,6 +50,58 @@ namespace Slic3r { namespace GUI { using ArrangePolygon = arrangement::ArrangePolygon; +void set_arrange_polygon_bed_exclusion_extruders(ArrangePolygon &polygon, const ModelObject &object, + const PartPlate &plate, const DynamicPrintConfig &config) +{ + polygon.bed_exclusion_extruder_ids.clear(); + if (active_bed_exclude_volume_mode(config) == BedExcludeVolumeMode::Shared) + return; + + const ConfigOptionFloats *nozzle_diameters = config.opt("nozzle_diameter"); + const size_t extruder_count = nozzle_diameters != nullptr ? nozzle_diameters->size() : 0; + if (extruder_count == 0) + return; + + PresetBundle *preset_bundle = wxGetApp().preset_bundle; + if (preset_bundle == nullptr) + return; + + const DynamicPrintConfig &project_config = preset_bundle->project_config; + // Automatic Bambu mapping may be recalculated after arrangement or differ + // between destination plates. Leave it unresolved so every nozzle volume + // is checked rather than embedding a temporary assignment in the item. + if (preset_bundle->is_bbl_vendor() && + is_auto_filament_map_mode(plate.get_real_filament_map_mode(project_config))) + return; + + std::set extruder_ids; + for (const auto &mapping : plate.get_object_filament_extruders(object, project_config, extruder_count)) + extruder_ids.emplace(int(mapping.second)); + polygon.bed_exclusion_extruder_ids.assign(extruder_ids.begin(), extruder_ids.end()); +} + +static void set_arrange_polygon_bed_exclusion_extruders_for_all_plates(ArrangePolygon &polygon, + const ModelObject &object, + PartPlateList &plate_list, + const DynamicPrintConfig &config) +{ + polygon.bed_exclusion_extruder_ids.clear(); + if (active_bed_exclude_volume_mode(config) == BedExcludeVolumeMode::Shared) + return; + + std::set extruder_ids; + for (int plate_index = 0; plate_index < plate_list.get_plate_count(); ++plate_index) { + ArrangePolygon mapped = polygon; + set_arrange_polygon_bed_exclusion_extruders(mapped, object, *plate_list.get_plate(plate_index), config); + if (mapped.bed_exclusion_extruder_ids.empty()) { + polygon.bed_exclusion_extruder_ids.clear(); + return; + } + extruder_ids.insert(mapped.bed_exclusion_extruder_ids.begin(), mapped.bed_exclusion_extruder_ids.end()); + } + polygon.bed_exclusion_extruder_ids.assign(extruder_ids.begin(), extruder_ids.end()); +} + // Cache the wti info class WipeTower: public GLCanvas3D::WipeTowerInfo { public: @@ -194,11 +246,14 @@ void ArrangeJob::clear_input() current_plate_index = 0; } -ArrangePolygon ArrangeJob::prepare_arrange_polygon(void* model_instance) +ArrangePolygon ArrangeJob::prepare_arrange_polygon(void *model_instance, const PartPlate *mapping_plate) { ModelInstance* instance = (ModelInstance*)model_instance; const Slic3r::DynamicPrintConfig& config = wxGetApp().preset_bundle->full_config(); - return get_instance_arrange_poly(instance, config); + ArrangePolygon polygon = get_instance_arrange_poly(instance, config); + if (mapping_plate != nullptr) + set_arrange_polygon_bed_exclusion_extruders(polygon, *instance->get_object(), *mapping_plate, config); + return polygon; } void ArrangeJob::prepare_selected() { @@ -234,6 +289,8 @@ void ArrangeJob::prepare_selected() { for (size_t i = 0; i < inst_sel.size(); ++i) { ModelInstance* mi = mo->instances[i]; ArrangePolygon&& ap = prepare_arrange_polygon(mo->instances[i]); + set_arrange_polygon_bed_exclusion_extruders_for_all_plates( + ap, *mo, plate_list, wxGetApp().preset_bundle->full_config()); //BBS: partplate_list preprocess //remove the locked plate's instances, neither in selected, nor in un-selected bool locked = plate_list.preprocess_arrange_polygon(oidx, i, ap, inst_sel[i]); @@ -309,6 +366,8 @@ void ArrangeJob::prepare_all() { for (size_t i = 0; i < mo->instances.size(); ++i) { ModelInstance * mi = mo->instances[i]; ArrangePolygon&& ap = prepare_arrange_polygon(mo->instances[i]); + set_arrange_polygon_bed_exclusion_extruders_for_all_plates( + ap, *mo, plate_list, wxGetApp().preset_bundle->full_config()); //BBS: partplate_list preprocess //remove the locked plate's instances, neither in selected, nor in un-selected bool locked = plate_list.preprocess_arrange_polygon(oidx, i, ap, true); @@ -350,7 +409,7 @@ void ArrangeJob::prepare_all() { bool enable_wrapping = current_config.option("enable_wrapping_detection")->value; // add the virtual object into unselect list if has - plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping, MAX_NUM_PLATES); + plate_list.preprocess_exclude_areas(m_unselected, wxGetApp().preset_bundle->full_config(), enable_wrapping, MAX_NUM_PLATES); prepare_belt_regions(MAX_NUM_PLATES); } @@ -503,7 +562,7 @@ void ArrangeJob::prepare_partplate() { for (size_t inst_idx = 0; inst_idx < mo->instances.size(); ++inst_idx) { bool in_plate = plate->contain_instance(oidx, inst_idx) || plate->intersect_instance(oidx, inst_idx); - ArrangePolygon&& ap = prepare_arrange_polygon(mo->instances[inst_idx]); + ArrangePolygon&& ap = prepare_arrange_polygon(mo->instances[inst_idx], plate); ArrangePolygons& cont = mo->instances[inst_idx]->printable ? (in_plate ? m_selected : m_unselected) : @@ -534,7 +593,8 @@ void ArrangeJob::prepare_partplate() { bool enable_wrapping = current_config.option("enable_wrapping_detection")->value; // add the virtual object into unselect list if has - plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping, current_plate_index + 1); + plate_list.preprocess_exclude_areas( + m_unselected, wxGetApp().preset_bundle->full_config(), enable_wrapping, current_plate_index + 1); prepare_belt_regions(current_plate_index + 1); } @@ -686,7 +746,7 @@ void ArrangeJob::process(Ctl &ctl) imex.add_keep_outs(m_unselected); bool enable_wrapping = global_config.option("enable_wrapping_detection")->value; - partplate_list.preprocess_exclude_areas(params.excluded_regions, enable_wrapping, 1, scale_(1)); + partplate_list.preprocess_exclude_areas(params.excluded_regions, global_config, enable_wrapping, 1, scale_(1)); BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose(); @@ -771,6 +831,17 @@ void ArrangeJob::finalize(bool canceled, std::exception_ptr &eptr) { if (canceled || eptr) return; + // Nothing could be placed: leave the plates and the instances exactly as they were. + // Rebuilding the plates would only re-home the instances by their bounds, which moves + // a too large item to whichever plate it happens to reach over. + const bool nothing_arranged = !m_selected.empty() && + std::all_of(m_selected.begin(), m_selected.end(), [](const ArrangePolygon &ap) { return !ap.is_arranged(); }); + if (nothing_arranged) { + m_plater->get_notification_manager()->close_notification_of_type(NotificationType::ArrangeOngoing); + m_plater->m_arrange_running.store(false); + return; + } + // Unprintable items go to the last virtual bed int beds = 0; @@ -870,12 +941,13 @@ void ArrangeJob::finalize(bool canceled, std::exception_ptr &eptr) { } m_plater->get_notification_manager()->close_notification_of_type(NotificationType::ArrangeOngoing); - //BBS: reload all objects due to arrange + //BBS: reload all objects due to arrange. Plates are never recycled here: arranging + // must not remove a plate the user created, even when the arrange left it empty. if (only_on_partplate) { - plate_list.rebuild_plates_after_arrangement(!only_on_partplate, true, current_plate_index); + plate_list.rebuild_plates_after_arrangement(false, true, current_plate_index); } else { - plate_list.rebuild_plates_after_arrangement(!only_on_partplate, true); + plate_list.rebuild_plates_after_arrangement(false, true); } // unlock the plates we just locked diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.hpp b/src/slic3r/GUI/Jobs/ArrangeJob.hpp index a31b65cea3..4383174f56 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.hpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.hpp @@ -16,10 +16,17 @@ namespace Slic3r { class ModelInstance; +class ModelObject; namespace GUI { class Plater; +class PartPlate; + +void set_arrange_polygon_bed_exclusion_extruders(arrangement::ArrangePolygon &polygon, + const ModelObject &object, + const PartPlate &plate, + const DynamicPrintConfig &config); class ArrangeJob : public Job { @@ -71,7 +78,7 @@ class ArrangeJob : public Job void prepare_belt_regions(int num_plates); void prepare_imex_zones(); - ArrangePolygon prepare_arrange_polygon(void* instance); + ArrangePolygon prepare_arrange_polygon(void *instance, const PartPlate *mapping_plate = nullptr); protected: diff --git a/src/slic3r/GUI/Jobs/FillBedJob.cpp b/src/slic3r/GUI/Jobs/FillBedJob.cpp index 4b4936e4ef..f3da5e631b 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.cpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.cpp @@ -79,6 +79,7 @@ void FillBedJob::prepare() bool selected = (oidx == m_object_idx); ArrangePolygon ap = get_instance_arrange_poly(mo->instances[inst_idx], global_config); + set_arrange_polygon_bed_exclusion_extruders(ap, *mo, *plate, global_config); BoundingBox ap_bb = ap.transformed_poly().contour.bounding_box(); ap.name = mo->name; @@ -146,8 +147,8 @@ void FillBedJob::prepare() bool enable_wrapping = global_config.option("enable_wrapping_detection")->value; //add the virtual object into unselect list if has double scaled_exclusion_gap = scale_(1); - plate_list.preprocess_exclude_areas(params.excluded_regions, enable_wrapping, 1, scaled_exclusion_gap); - plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping); + plate_list.preprocess_exclude_areas(params.excluded_regions, global_config, enable_wrapping, 1, scaled_exclusion_gap); + plate_list.preprocess_exclude_areas(m_unselected, global_config, enable_wrapping); m_bedpts = get_bed_shape(*m_plater->config()); @@ -173,11 +174,14 @@ void FillBedJob::prepare() auto polys = offset_ex(m_selected.front().poly, params.min_obj_distance / 2); ExPolygon poly = polys.empty() ? m_selected.front().poly : polys.front(); double poly_area = poly.area() / sc; + const ArrangePolygon &fill_template = m_selected.front(); double unsel_area = std::accumulate(m_unselected.begin(), m_unselected.end(), 0., - [cur_plate_index](double s, const auto &ap) { + [cur_plate_index, &fill_template](double s, const auto &ap) { //BBS: m_unselected instance is in the same partplate - return s + (ap.bed_idx == cur_plate_index) * ap.poly.area(); + const bool exclusion_applies = !ap.is_bed_exclusion || + bed_exclusion_applies(fill_template, ap); + return s + (ap.bed_idx == cur_plate_index && exclusion_applies) * ap.poly.area(); //return s + (ap.bed_idx == 0) * ap.poly.area(); }) / sc; @@ -192,36 +196,24 @@ void FillBedJob::prepare() //sel_id = std::max(sel_id, 0); ModelInstance *mi = model_object->instances[sel_id]; ArrangePolygon template_ap = get_instance_arrange_poly(mi, global_config); + set_arrange_polygon_bed_exclusion_extruders(template_ap, *model_object, *plate, global_config); - int obj_idx; - double offset_base, offset; - bool was_one_instance; - if (m_instances) { - obj_idx = m_plater->get_selected_object_idx(); - offset_base = m_plater->canvas3D()->get_size_proportional_to_max_bed_size(0.05); - offset = offset_base; - was_one_instance = model_object->instances.size()==1; - } - - for (int i = 0; i < needed_items; ++i, offset += offset_base) { + for (int i = 0; i < needed_items; ++i) { ArrangePolygon ap = template_ap; ap.poly = m_selected.front().poly; ap.bed_idx = PartPlateList::MAX_PLATES_COUNT; ap.itemid = -1; - ap.setter = [this, offset](const ArrangePolygon &p) { + ap.setter = [this, mi](const ArrangePolygon &p) { ModelObject *mo = m_plater->model().objects[m_object_idx]; - ModelObject *obj; if (m_instances) { - ModelInstance* model_instance = mo->instances.back(); - Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0); - mo->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation(), model_instance->get_mirror()); - obj = mo; + ModelInstance *new_instance = mo->add_instance(*mi); + new_instance->apply_arrange_result(p.translation.cast(), p.rotation); } else { ModelObject* newObj = m_plater->model().add_object(*mo); newObj->name = mo->name +" "+ std::to_string(p.itemid); - obj = newObj; + for (ModelInstance *new_instance : newObj->instances) + new_instance->apply_arrange_result(p.translation.cast(), p.rotation); } - for (ModelInstance *newInst : obj->instances) { newInst->apply_arrange_result(p.translation.cast(), p.rotation); } //m_plater->sidebar().obj_list()->paste_objects_into_list({m_plater->model().objects.size()-1}); }; m_selected.emplace_back(ap); @@ -248,7 +240,6 @@ void FillBedJob::process(Ctl &ctl) if (m_object_idx == -1 || m_selected.empty()) return; update_arrange_params(params, m_plater->config(), m_selected); - m_bedpts = get_shrink_bedpts(m_plater->config(), params); auto &partplate_list = m_plater->get_partplate_list(); auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); @@ -260,6 +251,8 @@ void FillBedJob::process(Ctl &ctl) update_selected_items_inflation(m_selected, m_plater->config(), params); update_unselected_items_inflation(m_unselected, m_plater->config(), params); + // After the inflation, which may give back part of the bed margin. + m_bedpts = get_shrink_bedpts(m_plater->config(), params); bool do_stop = false; params.stopcondition = [&ctl, &do_stop]() { @@ -278,21 +271,65 @@ void FillBedJob::process(Ctl &ctl) // final align用的是凸包,在有fixed item的情况下可能找到的参考点位置是错的,这里就不做了。见STUDIO-3265 params.do_final_align = !is_bbl; - if (m_selected.size() > 100){ + if (m_selected.size() > 100) { // too many items, just find grid empty cells to put them - Vec2f step = unscaled(get_extents(m_selected.front().poly).size()) + Vec2f(m_selected.front().brim_width, m_selected.front().brim_width); - std::vector empty_cells = Plater::get_empty_cells(step); - size_t n=std::min(m_selected.size(), empty_cells.size()); - for (size_t i = 0; i < n; i++) { - m_selected[i].translation = scaled(empty_cells[i]); - m_selected[i].bed_idx= 0; + std::vector occupied_boxes; + for (const ArrangePolygon &fixed : m_unselected) { + if (fixed.bed_idx != 0 || fixed.is_extrusion_cali_object) + continue; + + if (fixed.is_bed_exclusion) { + const bool relevant = std::any_of( + m_selected.begin(), m_selected.end(), [&fixed](const ArrangePolygon &item) { + return bed_exclusion_applies(item, fixed); + }); + if (!relevant) + continue; + } + + BoundingBox bbox = get_extents(fixed.transformed_poly()); + bbox.offset(std::max(0, fixed.inflation)); + occupied_boxes.emplace_back(unscale(bbox.min), unscale(bbox.max)); } - for (size_t i = n; i < m_selected.size(); i++) { - m_selected[i].bed_idx = -1; + + // Fill the remaining space without disturbing instances which are + // already placed. Besides matching the meaning of "Fill bed", this + // also prevents candidates rejected by the grid from remaining under + // newly placed copies at their old positions. + const Vec3d plate_origin = partplate_list.get_curr_plate()->get_origin(); + for (const ArrangePolygon &existing : m_selected) { + if (existing.priority == 0 || existing.bed_idx != 0) + continue; + + BoundingBox bbox = get_extents(existing.transformed_poly()); + bbox.offset(std::max(0, existing.inflation)); + BoundingBoxf local_box(unscale(bbox.min), unscale(bbox.max)); + local_box.translate(Vec2d(-plate_origin.x(), -plate_origin.y())); + occupied_boxes.emplace_back(std::move(local_box)); } - } - else + + const Vec2f step = unscaled(get_extents(m_selected.front().poly).size()) + + Vec2f(m_selected.front().brim_width, m_selected.front().brim_width); + const bool has_conditional_exclusions = has_bed_exclusion_regions(m_unselected); + const std::vector empty_cells = + Plater::get_empty_cells(step, occupied_boxes, !has_conditional_exclusions); + + size_t cell_index = 0; + for (ArrangePolygon &item : m_selected) { + if (item.priority != 0) + continue; + + if (cell_index < empty_cells.size()) { + item.translation = scaled(empty_cells[cell_index++]); + item.bed_idx = 0; + } else { + item.bed_idx = arrangement::UNARRANGED; + } + } + + } else { arrangement::arrange(m_selected, m_unselected, m_bedpts, params); + } // finalize just here. ctl.update_status(100, ctl.was_canceled() ? @@ -357,6 +394,17 @@ void FillBedJob::finalize(bool canceled, std::exception_ptr &eptr) obj_list->update_printable_state(i, 0); } + if (m_instances && model_object->instances.size() > inst_cnt) { + const size_t new_instance_count = model_object->instances.size() - inst_cnt; + // Match the normal add-instance flow: update the scene before the + // object tree starts referring to the newly created instances. + m_plater->update(); + // A single-instance object has no instance children in the object + // tree yet, so the first refresh must add the original as well. + obj_list->increase_object_instances( + m_object_idx, inst_cnt == 1 ? new_instance_count + 1 : new_instance_count); + } + BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": paste_objects_into_list"; /*for (ArrangePolygon& ap : m_selected) { @@ -367,10 +415,9 @@ void FillBedJob::finalize(bool canceled, std::exception_ptr &eptr) //model_object->ensure_on_bed(); //BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": model_object->ensure_on_bed()"; - if (m_instances) {// && wxGetApp().app_config->get("auto_arrange") == "true") { - m_plater->set_prepare_state(Job::PREPARE_STATE_MENU); - m_plater->arrange(); - } + // FillBedJob has already computed and validated the final positions. + // The instance tree is synchronized above, so rerunning the general + // arranger here would only risk discarding a valid fill result. m_plater->update(); { diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index b6b420969f..c903e3b139 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -716,8 +716,6 @@ void PrintJob::process(Ctl &ctl) } else { // wait for printer mqtt ready the same job id - wxGetApp().plater()->record_slice_preset("print"); - BOOST_LOG_TRIVIAL(error) << "print_job: send ok."; wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id); if (!m_completed_evt_data.empty()) diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp b/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp index 72363e4393..ef3a49b8f7 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.cpp @@ -6,6 +6,7 @@ #include #include #include "libslic3r/TextureDisplacement.hpp" +#include "libslic3r/Point.hpp" #include #include #include @@ -50,6 +51,9 @@ void TextureDisplacementBakeJob::process(Ctl &ctl) // bake, which on a subdivided mesh can run for several seconds. // Colour, when any layer asks for it, is computed in the same pass as the displacement: both need // the same per-layer projection and UV work, and doing it twice would double the expensive part. + // + // The quantizers are built once for the whole job rather than per part: each fills a colour lookup + // cube that costs tens of milliseconds, and the palette is the object's, not the part's. TextureColorRequest color_request; TextureColorRequest *color = nullptr; if (!m_input.color.empty()) { @@ -57,27 +61,38 @@ void TextureDisplacementBakeJob::process(Ctl &ctl) if (!m_input.color.palette_pure.empty()) color_request.quantize_pure = GLGizmoTextureDisplacement::make_palette_quantizer(m_input.color.palette_pure); color_request.despeckle_passes = m_input.color.despeckle_passes; - color_request.out_triangle = &m_triangle_color; if (color_request.quantize) color = &color_request; } + // Each part gets its own slice of the 1..100 range, in order, so one progress bar covers the whole + // bake however many parts it displaces. + const size_t count = m_input.volumes.size(); + m_results.resize(count); int last_reported = 1; - m_result = TriangleMesh(build_texture_displacement( - m_input.base_mesh, m_input.layers, m_input.facets_data, m_input.options, - [&ctl, &status, &last_reported](int percent) { - if (ctl.was_canceled()) - return false; - // The notification repaints (and wakes the idle loop) on every call, so only push a - // message when the displayed integer percentage actually moves. - if (percent > last_reported) { - last_reported = percent; - ctl.update_status(percent, status); - } - return true; - }, - color, m_input.volume_to_world, nullptr, &m_stats, - m_input.model_uv.empty() ? nullptr : &m_input.model_uv)); + for (size_t i = 0; i < count; ++i) { + const TextureDisplacementBakeVolume &volume = m_input.volumes[i]; + if (color != nullptr) + color_request.out_triangle = &m_results[i].triangle_color; + m_results[i].mesh = TriangleMesh(build_texture_displacement( + volume.base_mesh, volume.layers, volume.facets_data, volume.options, + [&ctl, &status, &last_reported, i, count](int percent) { + if (ctl.was_canceled()) + return false; + // The notification repaints (and wakes the idle loop) on every call, so only push a + // message when the displayed integer percentage actually moves. + const int overall = int((i * 100 + size_t(std::max(0, percent))) / count); + if (overall > last_reported) { + last_reported = overall; + ctl.update_status(overall, status); + } + return true; + }, + color, volume.volume_to_world, nullptr, &m_results[i].stats, + volume.model_uv.empty() ? nullptr : &volume.model_uv, &volume.texture_anchor, volume.resting_drop)); + if (ctl.was_canceled()) + break; + } // Always finish at 100: this is what closes the notification. Reported even on cancel, where // build_texture_displacement() returns an empty mesh and finalize() commits nothing. @@ -92,147 +107,184 @@ void TextureDisplacementBakeJob::finalize(bool canceled, std::exception_ptr &ept ~OnExit() { if (fn) fn(); } } on_exit{m_on_finished}; - if (canceled || eptr || m_result.empty()) + if (canceled || eptr) return; // A bake that moved nothing - no layer could be sampled, or every sample was zero - must not be // committed: committing is what clears the baked layers' paint, so the user would see the painted // region simply vanish with no relief in its place and no idea why. Keep the paint and say so. - { - const indexed_triangle_set &out = m_result.its; - bool unchanged = out.indices.size() == m_input.base_mesh.indices.size() && - out.vertices.size() == m_input.base_mesh.vertices.size(); - for (size_t i = 0; unchanged && i < out.vertices.size(); ++i) - unchanged = (out.vertices[i] - m_input.base_mesh.vertices[i]).cwiseAbs().maxCoeff() < 1e-5f; - if (unchanged) { - show_error(nullptr, _u8L("The bake produced no displacement, so nothing was changed and the paint was kept. " - "Check that the painted layer has a texture and a non-zero depth.")); - return; - } + // Judged per part, because on a multibody object only some parts may carry a layer that displaces; + // the ones that did move are committed and the rest are left exactly as they were. + const auto moved = [this](size_t i) { + const TriangleMesh &result = m_results[i].mesh; + if (result.empty()) + return false; + const indexed_triangle_set &out = result.its; + const indexed_triangle_set &base = m_input.volumes[i].base_mesh; + bool unchanged = out.indices.size() == base.indices.size() && out.vertices.size() == base.vertices.size(); + for (size_t v = 0; unchanged && v < out.vertices.size(); ++v) + unchanged = (out.vertices[v] - base.vertices[v]).cwiseAbs().maxCoeff() < 1e-5f; + return !unchanged; + }; + + std::vector to_commit; + for (size_t i = 0; i < m_results.size(); ++i) + if (moved(i)) + to_commit.push_back(i); + if (to_commit.empty()) { + show_error(nullptr, _u8L("The bake produced no displacement, so nothing was changed and the paint was kept. " + "Check that the painted layer has a texture and a non-zero depth.")); + return; } Plater *plater = wxGetApp().plater(); - const auto commit = [this, plater]() { - ModelVolume *volume = get_model_volume(m_input.volume_id, plater->model().objects); - if (volume == nullptr) - return; - - // The filament each palette entry prints in. This is where a mix becomes a mixed filament slot, - // and only a mix the bake actually painted with: the preview never creates one, so the project - // gains only the slots this result needs. Done before anything below names them - adding a slot - // runs ModelVolume::update_extruder_count(), which clamps paint above the old filament count. + // The filament each palette entry prints in. This is where a mix becomes a mixed filament slot, + // and only a mix the bake actually painted with: the preview never creates one, so the project + // gains only the slots this result needs. Decided once for the whole bake, over the entries every + // part used between them, so the same mix cannot end up in two slots. Done before anything below + // names them - adding a slot runs ModelVolume::update_extruder_count(), which clamps paint above + // the old filament count. + const auto filaments_for_palette = [this, plater, &to_commit]() { + // palette_filaments() only cares *which* entries appear, so the union of the parts' entries + // stands in for their concatenated per-triangle colours. + std::vector seen(m_input.color.palette.size() + 1, 0); + std::vector used; + for (const size_t i : to_commit) + for (const uint8_t entry : m_results[i].triangle_color) + if (entry > 0 && size_t(entry) < seen.size() && !seen[size_t(entry)]) { + seen[size_t(entry)] = 1; + used.push_back(entry); + } Sidebar &sidebar = plater->sidebar(); - const std::vector filament_of = GLGizmoTextureDisplacement::palette_filaments( - m_input.color.palette, m_triangle_color, [&sidebar](const PrintableColor &mix) { + return GLGizmoTextureDisplacement::palette_filaments( + m_input.color.palette, used, [&sidebar](const PrintableColor &mix) { return sidebar.ensure_mixed_filament({ unsigned(mix.a + 1), unsigned(mix.b + 1) }, { mix.a_percent(), 100 - mix.a_percent() }); }); + }; - // Whether the bake replaced the triangles or only moved the vertices it was given. The classic - // path is topology-preserving by contract, so every per-triangle annotation on the volume still - // means what it did; the default pipeline refines, cuts and simplifies, so none of them do. - // Both are checked: the flag is what the bake promised, the count is what it delivered. Only - // the triangles matter - the annotations are per facet and reference no vertex index - so a - // vertex count that changed on its own (the bake compacts unreferenced vertices away) is not a - // reason to remap anything. - const bool topology_changed = m_input.options.pipeline_v2 || - m_result.its.indices.size() != m_input.base_mesh.indices.size(); + const auto commit = [this, plater, &to_commit, &filaments_for_palette]() { + const std::vector filament_of = filaments_for_palette(); + ModelObject *object = nullptr; - // Carry the volume's existing paint - the model's own colours above all - across that rebuild. - // Without it a bake left the mmu_segmentation_facets bitstream pointing at a triangle set that - // no longer existed, which is what scrambled the colours of an imported coloured model even - // with colour switched off on every layer and nothing in the bake that was meant to touch them. - // - // transfer_facet_paint() rather than ModelVolume::restore_painting(): the latter's remap wants - // a target triangle overlapping the source paint to within 0.01 mm, which the baked surface is - // nowhere near - it has moved by the relief depth. Nothing to do when the topology is intact: - // triangle i is still triangle i, so the paint is already exactly right and carrying it at all - // could only lose detail. - std::array before; - if (topology_changed) { - before[0] = volume->supported_facets.get_data(); - before[1] = volume->seam_facets.get_data(); - before[2] = volume->mmu_segmentation_facets.get_data(); - before[3] = volume->fuzzy_skin_facets.get_data(); - } + for (const size_t i : to_commit) { + ModelVolume *volume = get_model_volume(m_input.volumes[i].volume_id, plater->model().objects); + // The lookup doubles as a staleness check: anything that replaces a volume's mesh also gives it + // a new id, so a part replaced since this bake started - by an undo, another bake, or a + // boolean - simply fails to find its volume and is skipped. + if (volume == nullptr) + continue; + const TextureDisplacementBakeVolume &input = m_input.volumes[i]; + const std::vector &triangle_color = m_results[i].triangle_color; - volume->set_mesh(std::move(m_result)); - volume->set_new_unique_id(); - volume->calculate_convex_hull(); + // Whether the bake replaced the triangles or only moved the vertices it was given. The classic + // path is topology-preserving by contract, so every per-triangle annotation on the volume still + // means what it did; the default pipeline refines, cuts and simplifies, so none of them do. + // Both are checked: the flag is what the bake promised, the count is what it delivered. Only + // the triangles matter - the annotations are per facet and reference no vertex index - so a + // vertex count that changed on its own (the bake compacts unreferenced vertices away) is not a + // reason to remap anything. + const bool topology_changed = input.options.pipeline_v2 || + m_results[i].mesh.its.indices.size() != input.base_mesh.indices.size(); - if (topology_changed) { - const std::array target{ &volume->supported_facets, &volume->seam_facets, - &volume->mmu_segmentation_facets, - &volume->fuzzy_skin_facets }; - for (size_t ch = 0; ch < target.size(); ++ch) { - const std::vector state = - transfer_facet_paint(m_input.base_mesh, before[ch], volume->mesh().its); - // Nothing was painted in this channel, or there is nothing to paint it onto: either - // way the annotation must not keep describing the mesh that is gone. - if (state.empty()) { - target[ch]->reset(); - continue; - } - TriangleSelector selector(volume->mesh()); - bool any = false; - for (size_t i = 0; i < state.size(); ++i) - if (state[i] != 0) { - selector.set_facet(int(i), EnforcerBlockerType(state[i])); - any = true; + // Carry the volume's existing paint - the model's own colours above all - across that rebuild. + // Without it a bake left the mmu_segmentation_facets bitstream pointing at a triangle set that + // no longer existed, which is what scrambled the colours of an imported coloured model even + // with colour switched off on every layer and nothing in the bake that was meant to touch them. + // + // transfer_facet_paint() rather than ModelVolume::restore_painting(): the latter's remap wants + // a target triangle overlapping the source paint to within 0.01 mm, which the baked surface is + // nowhere near - it has moved by the relief depth. Nothing to do when the topology is intact: + // triangle i is still triangle i, so the paint is already exactly right and carrying it at all + // could only lose detail. + std::array before; + if (topology_changed) { + before[0] = volume->supported_facets.get_data(); + before[1] = volume->seam_facets.get_data(); + before[2] = volume->mmu_segmentation_facets.get_data(); + before[3] = volume->fuzzy_skin_facets.get_data(); + } + + volume->set_mesh(std::move(m_results[i].mesh)); + volume->set_new_unique_id(); + volume->calculate_convex_hull(); + + if (topology_changed) { + const std::array target{ &volume->supported_facets, &volume->seam_facets, + &volume->mmu_segmentation_facets, + &volume->fuzzy_skin_facets }; + for (size_t ch = 0; ch < target.size(); ++ch) { + const std::vector state = + transfer_facet_paint(input.base_mesh, before[ch], volume->mesh().its); + // Nothing was painted in this channel, or there is nothing to paint it onto: either + // way the annotation must not keep describing the mesh that is gone. + if (state.empty()) { + target[ch]->reset(); + continue; } - if (any) - target[ch]->set(selector); - else - target[ch]->reset(); + TriangleSelector selector(volume->mesh()); + bool any = false; + for (size_t t = 0; t < state.size(); ++t) + if (state[t] != 0) { + selector.set_facet(int(t), EnforcerBlockerType(state[t])); + any = true; + } + if (any) + target[ch]->set(selector); + else + target[ch]->reset(); + } } - } - // Colour lands in mmu_segmentation_facets, merged *over* whatever is already painted there - // rather than replacing it: a triangle the texture does not colour keeps its existing filament, - // and one the user never painted at all stays at NONE, which already means "the volume's own - // filament". That is what confines the effect to the painted area without having to invent a - // colour for everything outside it. What was already painted is whatever the transfer above - // left in the annotation, so this bake's colour lands on top of it rather than instead of it. - if (!m_triangle_color.empty() && m_triangle_color.size() == volume->mesh().its.indices.size()) { - TriangleSelector selector(volume->mesh()); - const TriangleSelector::TriangleSplittingData &existing = volume->mmu_segmentation_facets.get_data(); - if (!existing.bitstream.empty()) - selector.deserialize(existing, false); - for (size_t i = 0; i < m_triangle_color.size(); ++i) { - const size_t entry = size_t(m_triangle_color[i]); - if (entry > 0 && entry <= filament_of.size() && filament_of[entry - 1] >= 0) - selector.set_facet(int(i), EnforcerBlockerType(filament_of[entry - 1] + 1)); + // Colour lands in mmu_segmentation_facets, merged *over* whatever is already painted there + // rather than replacing it: a triangle the texture does not colour keeps its existing filament, + // and one the user never painted at all stays at NONE, which already means "the volume's own + // filament". That is what confines the effect to the painted area without having to invent a + // colour for everything outside it. What was already painted is whatever the transfer above + // left in the annotation, so this bake's colour lands on top of it rather than instead of it. + if (!triangle_color.empty() && triangle_color.size() == volume->mesh().its.indices.size()) { + TriangleSelector selector(volume->mesh()); + const TriangleSelector::TriangleSplittingData &existing = volume->mmu_segmentation_facets.get_data(); + if (!existing.bitstream.empty()) + selector.deserialize(existing, false); + for (size_t t = 0; t < triangle_color.size(); ++t) { + const size_t entry = size_t(triangle_color[t]); + if (entry > 0 && entry <= filament_of.size() && filament_of[entry - 1] >= 0) + selector.set_facet(int(t), EnforcerBlockerType(filament_of[entry - 1] + 1)); + } + volume->mmu_segmentation_facets.set(selector); } - volume->mmu_segmentation_facets.set(selector); + + // Clear the paint mask of every layer that was actually baked so a repeat bake (or the paint + // overlay) doesn't act on triangles that no longer represent the same unbaked surface. The + // texture layer definitions themselves are left untouched so the user can keep sculpting with + // the same textures. + // + // A mask the bake did *not* consume only still means what it did if the topology is unchanged, + // which is true of the classic path (it moves existing vertices) but not of the one-run + // pipeline, which rebuilds and then simplifies the mesh. A mask left behind against the old + // topology is exactly what makes the gizmo reload an empty selector over a non-empty mask and + // then erase it on the next flush - see GLGizmoTextureDisplacement::update_from_model_object(). + for (int slot = 0; slot < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++slot) { + const auto it = std::find_if(input.layers.begin(), input.layers.end(), + [slot](const TextureDisplacementLayer &l) { return l.slot == slot; }); + if (topology_changed || (it != input.layers.end() && !it->empty())) + volume->texture_displacement_facet(slot).reset(); + } + + // The model's own UV channel. Resampled onto a rebuilt mesh from the surface the bake started + // from: a displaced vertex came from its foot point on that surface, which is the position its + // uv belongs to - so no distance limit, the relief depth is exactly how far it has moved. + if (!input.model_uv.empty()) + volume->texture_uv = topology_changed ? transfer_uv_channel(input.base_mesh, input.model_uv, + volume->mesh().its) : + input.model_uv; + + if (object == nullptr) + object = volume->get_object(); } - // Clear the paint mask of every layer that was actually baked so a repeat bake (or the paint - // overlay) doesn't act on triangles that no longer represent the same unbaked surface. The - // texture layer definitions themselves are left untouched so the user can keep sculpting with - // the same textures. - // - // A mask the bake did *not* consume only still means what it did if the topology is unchanged, - // which is true of the classic path (it moves existing vertices) but not of the one-run - // pipeline, which rebuilds and then simplifies the mesh. A mask left behind against the old - // topology is exactly what makes the gizmo reload an empty selector over a non-empty mask and - // then erase it on the next flush - see GLGizmoTextureDisplacement::update_from_model_object(). - for (int slot = 0; slot < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++slot) { - const auto it = std::find_if(m_input.layers.begin(), m_input.layers.end(), - [slot](const TextureDisplacementLayer &l) { return l.slot == slot; }); - if (topology_changed || (it != m_input.layers.end() && !it->empty())) - volume->texture_displacement_facet(slot).reset(); - } - - // The model's own UV channel. Resampled onto a rebuilt mesh from the surface the bake started - // from: a displaced vertex came from its foot point on that surface, which is the position its - // uv belongs to - so no distance limit, the relief depth is exactly how far it has moved. - if (!m_input.model_uv.empty()) - volume->texture_uv = topology_changed ? transfer_uv_channel(m_input.base_mesh, m_input.model_uv, - volume->mesh().its) : - m_input.model_uv; - - ModelObject *object = volume->get_object(); if (object == nullptr) return; @@ -261,8 +313,15 @@ void TextureDisplacementBakeJob::finalize(bool canceled, std::exception_ptr &ept // The refinement went finer than the budget could keep: the simplification had to take detail back // out to fit, so what was baked carries less of the texture than the resolution asked for. Said // here, with the numbers, because it is the only place that knows them - and not as an error - // dialog: the result is a usable mesh, just not the one the settings described. - if (m_stats.budget_limited) { + // dialog: the result is a usable mesh, just not the one the settings described. Summed over the + // parts that hit it, since the budget is spent per part and one message is enough. + size_t refined = 0, budget = 0; + for (const size_t i : to_commit) + if (m_results[i].stats.budget_limited) { + refined += m_results[i].stats.triangles_refined; + budget += m_results[i].stats.triangles_budget; + } + if (refined > 0) { // Thousands under a million, so a small budget is not reported as "0.1 M". const auto count = [](size_t n) { return n >= 1000000 ? Slic3r::format("%1$.1f M", double(n) / 1000000.) : @@ -272,26 +331,39 @@ void TextureDisplacementBakeJob::finalize(bool canceled, std::exception_ptr &ept NotificationType::CustomNotification, NotificationManager::NotificationLevel::WarningNotificationLevel, Slic3r::format(_u8L("The triangle budget limited the detail: this resolution needs %1% triangles, " "the budget kept %2%. Raise Budget or use a coarser Resolution for the full detail."), - count(m_stats.triangles_refined), count(m_stats.triangles_budget))); + count(refined), count(budget))); } } -void queue_texture_displacement_bake(const ModelVolume &volume, const TextureColorSettings &color, +TextureDisplacementBakeVolume texture_displacement_bake_volume(const ModelVolume &volume, + const std::vector &layers, + const TextureDisplacementOptions &options, + const Vec3d &texture_anchor, + float resting_drop) +{ + TextureDisplacementBakeVolume out; + out.volume_id = volume.id(); + out.base_mesh = volume.mesh().its; + out.layers = layers; + out.options = options; + out.volume_to_world = texture_displacement_volume_to_world(volume); + out.texture_anchor = texture_anchor; + out.resting_drop = resting_drop; + if (volume.has_texture_uv()) + out.model_uv = volume.texture_uv; + for (int i = 0; i < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++i) + out.facets_data[size_t(i)] = volume.texture_displacement_facet(i).get_data(); + return out; +} + +void queue_texture_displacement_bake(std::vector volumes, + const TextureColorSettings &color, std::function on_finished, bool take_snapshot) { TextureDisplacementBakeInput input; + input.volumes = std::move(volumes); input.color = color; input.take_snapshot = take_snapshot; - input.volume_id = volume.id(); - input.base_mesh = volume.mesh().its; - if (volume.has_texture_uv()) - input.model_uv = volume.texture_uv; - input.layers = volume.texture_displacement_layers; - input.options = volume.texture_displacement_options; - input.volume_to_world = texture_displacement_volume_to_world(volume); - for (int i = 0; i < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++i) - input.facets_data[size_t(i)] = volume.texture_displacement_facet(i).get_data(); - auto &worker = wxGetApp().plater()->get_ui_job_worker(); queue_job(worker, std::make_unique(std::move(input), std::move(on_finished))); diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.hpp b/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.hpp index 5e1a586736..dc611910bf 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.hpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementBakeJob.hpp @@ -17,10 +17,11 @@ namespace Slic3r { class ModelVolume; } namespace Slic3r::GUI { -// Everything process() needs, captured by value on the main thread when the job is queued so the -// worker thread never touches the live Model concurrently with the UI (mirrors how EmbossJob's -// DataBase is captured before process() runs). -struct TextureDisplacementBakeInput +// One model part's share of a bake: its own mesh, its own paint masks and UV channel, and the layer +// stack to displace it by. Captured by value on the main thread when the job is queued so the worker +// thread never touches the live Model concurrently with the UI (mirrors how EmbossJob's DataBase is +// captured before process() runs). +struct TextureDisplacementBakeVolume { ObjectID volume_id; indexed_triangle_set base_mesh; @@ -30,22 +31,38 @@ struct TextureDisplacementBakeInput // Mesh coordinates -> world millimetres. Captured here with everything else so the worker never // reaches back into the live Model for it. See build_texture_displacement(). Transform3d volume_to_world = Transform3d::Identity(); - // Captured on the main thread. Empty unless some layer is colouring, in which case the bake also - // writes the volume's mmu_segmentation_facets - the same per-triangle filament assignment the MMU - // paint gizmo writes - alongside the displaced geometry. - TextureColorSettings color; - // The volume's own UV channel (ModelVolume::texture_uv), empty when it has none: what a ModelUV + // The part's own UV channel (ModelVolume::texture_uv), empty when it has none: what a ModelUV // layer maps through, and what the commit puts back on the baked mesh. std::vector model_uv; + // Where the part sits in its object: the world point the object's texture is anchored at, and how + // far the object's lowest point lies below the part's own. See build_texture_displacement(). + Vec3d texture_anchor = Vec3d::Zero(); + float resting_drop = 0.f; +}; + +struct TextureDisplacementBakeInput +{ + // Every model part the bake acts on, in the object's own volume order. An object made of several + // parts carries one entry per part the paint actually reaches: the layer stack is the object's, + // but each part is displaced through its own mesh, its own masks and its own UV channel. Baking + // only the first part is what made texture displacement silently ignore every other body of a + // multibody object. + std::vector volumes; + // Captured on the main thread, and shared by every part: the palette comes from the project's + // filaments and from the layer stack, neither of which is per part. Empty unless some layer is + // colouring, in which case the bake also writes each part's mmu_segmentation_facets - the same + // per-triangle filament assignment the MMU paint gizmo writes - alongside the displaced geometry. + TextureColorSettings color; // Whether this job pushes its own undo step when it commits. False when the caller has already // taken one that is meant to cover the displacement as well - Standard mode's Bake, which remeshes // and subdivides first and has to undo as a single action. - bool take_snapshot = true; + bool take_snapshot = true; }; -// Bakes a volume's painted texture-displacement layers into real mesh geometry in the background, +// Bakes an object's painted texture-displacement layers into real mesh geometry in the background, // then commits the result on the main thread - mirrors EmbossJob's UpdateJob/update_volume() -// bake-and-commit pattern (see EmbossJob.cpp). +// bake-and-commit pattern (see EmbossJob.cpp). Every part is displaced in the one job and committed +// under the one undo step, so a multibody object undoes as a single action. class TextureDisplacementBakeJob : public Job { public: @@ -55,24 +72,41 @@ public: void finalize(bool canceled, std::exception_ptr &eptr) override; private: + // What the bake produced for one part of m_input.volumes, at the same index. + struct VolumeResult + { + TriangleMesh mesh; + // Per triangle of `mesh`: the palette entry to print it in, as its index + 1 (0 = leave + // alone). Empty unless a layer asked for colour. See TextureColorRequest; finalize() turns + // these into filaments. + std::vector triangle_color; + // What the bake spent, for the message it leaves behind when the budget capped the detail. + TextureBakeStats stats; + }; + TextureDisplacementBakeInput m_input; - TriangleMesh m_result; - // What the bake spent, for the message it leaves behind when the budget capped the detail. - TextureBakeStats m_stats; - // Per triangle of m_result: the palette entry to print it in, as its index + 1 (0 = leave alone). - // Empty unless a layer asked for colour. See TextureColorRequest; finalize() turns these into - // filaments. - std::vector m_triangle_color; + std::vector m_results; std::function m_on_finished; }; -// Captures `volume`'s current mesh/layers/paint data and queues a TextureDisplacementBakeJob on -// the app's UI job worker. `on_finished` is always called once the job settles (success, failure, -// or cancellation), so the caller can clear its own "bake in progress" UI state. Must be called -// from the main thread. -void queue_texture_displacement_bake(const ModelVolume &volume, const TextureColorSettings &color, +// Captures each of `volumes`' current mesh/layers/paint data and queues a single +// TextureDisplacementBakeJob on the app's UI job worker. `on_finished` is always called once the job +// settles (success, failure, or cancellation), so the caller can clear its own "bake in progress" UI +// state. Must be called from the main thread. +void queue_texture_displacement_bake(std::vector volumes, + const TextureColorSettings &color, std::function on_finished, bool take_snapshot = true); +// `volume`'s share of a bake, read off the live Model. `layers`, `options`, `texture_anchor` and +// `resting_drop` are passed in rather than taken from `volume` because they belong to the object, not +// to the part: every part of a multibody object is displaced by the same stack, in the same texture +// frame and against the same plate (see GLGizmoTextureDisplacement::layers_for_part()). +TextureDisplacementBakeVolume texture_displacement_bake_volume(const ModelVolume &volume, + const std::vector &layers, + const TextureDisplacementOptions &options, + const Vec3d &texture_anchor, + float resting_drop); + } // namespace Slic3r::GUI #endif // slic3r_TextureDisplacementBakeJob_hpp_ diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.cpp b/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.cpp index eb4eec036f..0ef72a2f03 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.cpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.cpp @@ -60,8 +60,8 @@ void TextureDisplacementDebugJob::process(Ctl &ctl) // experimental pipeline refines as part of the bake and has nothing to prepare. if (m_input.run_prepare && !m_input.options.pipeline_v2) { const TextureDisplacementPrepareResult prepared = - GLGizmoTextureDisplacement::prepare_mesh(mesh, masks, m_input.layers, uv, m_input.prepare_params, - m_input.color, + GLGizmoTextureDisplacement::prepare_mesh(mesh, masks, m_input.layers, uv, m_input.prepare_texture_frame, + m_input.prepare_params, m_input.color, // Preparation is roughly half the run; the bake // takes the progress bar from there. [&report](int pct) { return report(1 + pct / 2); }, @@ -86,7 +86,8 @@ void TextureDisplacementDebugJob::process(Ctl &ctl) build_texture_displacement(mesh, m_input.layers, masks, m_input.options, [&report](int pct) { return report(50 + pct / 2); }, /* color */ nullptr, m_input.volume_to_world, &recorder, /* stats */ nullptr, - uv.empty() ? nullptr : &uv); + uv.empty() ? nullptr : &uv, /* texture_anchor: the volume's own origin */ nullptr, + m_input.resting_drop); m_stages = recorder.take(); ctl.update_status(100, status); // always finish at 100: this is what closes the notification @@ -106,6 +107,7 @@ void TextureDisplacementDebugJob::finalize(bool canceled, std::exception_ptr &ep void queue_texture_displacement_debug(const ModelVolume &volume, const TextureColorSettings &color, const TextureDisplacementPrepareParams &prepare_params, + const Transform3d &prepare_texture_frame, float resting_drop, bool run_prepare, bool check_topology, std::function)> on_finished) { @@ -119,6 +121,8 @@ void queue_texture_displacement_debug(const ModelVolume &volume, const TextureCo input.check_topology = check_topology; input.color = color; input.volume_to_world = texture_displacement_volume_to_world(volume); + input.prepare_texture_frame = prepare_texture_frame; + input.resting_drop = resting_drop; if (volume.has_texture_uv()) input.model_uv = volume.texture_uv; for (int i = 0; i < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++i) diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.hpp b/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.hpp index 981a17773f..251f2cbccf 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.hpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementDebugJob.hpp @@ -44,6 +44,11 @@ struct TextureDisplacementDebugInput // Mesh coordinates -> world millimetres, as the bake gets it. The captured stages are brought // back into mesh coordinates before they are handed over, so the gizmo can draw them directly. Transform3d volume_to_world = Transform3d::Identity(); + // Where the preparation samples the texture, and how far below the volume's own bottom its object + // rests - both as the bake and its preparation get them (see TextureDisplacementPrepareVolume and + // TextureDisplacementBakeVolume). + Transform3d prepare_texture_frame = Transform3d::Identity(); + float resting_drop = 0.f; // Only the quantizer is used, and only by the refinement's colour criterion - the debug run // produces no colour of its own. TextureColorSettings color; @@ -79,6 +84,7 @@ private: // caller can clear its own in-progress state. Must be called from the main thread. void queue_texture_displacement_debug(const ModelVolume &volume, const TextureColorSettings &color, const TextureDisplacementPrepareParams &prepare_params, + const Transform3d &prepare_texture_frame, float resting_drop, bool run_prepare, bool check_topology, std::function)> on_finished); diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.cpp b/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.cpp index 6c582d3746..5c19e6b450 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.cpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "slic3r/GUI/GLCanvas3D.hpp" #include "slic3r/GUI/Jobs/Worker.hpp" @@ -44,18 +45,29 @@ void TextureDisplacementPrepareJob::process(Ctl &ctl) // once it reaches 100%, and below that it shows Cancel, which is wired through here. Reporting is // throttled to whole percentage points because every call repaints the notification and wakes the // idle loop. + // Each part gets its own slice of the range, in order, so one bar covers them all. + const size_t count = m_input.volumes.size(); + m_results.resize(count); int last_reported = 1; - m_result = GLGizmoTextureDisplacement::prepare_mesh(m_input.base_mesh, m_input.masks, m_input.layers, - m_input.model_uv, m_input.params, m_input.color, - [&ctl, &status, &last_reported](int percent) { - if (ctl.was_canceled()) - return false; - if (percent > last_reported) { - last_reported = percent; - ctl.update_status(percent, status); - } - return true; - }); + for (size_t i = 0; i < count; ++i) { + const TextureDisplacementPrepareVolume &volume = m_input.volumes[i]; + m_results[i] = GLGizmoTextureDisplacement::prepare_mesh(volume.base_mesh, volume.masks, volume.layers, + volume.model_uv, volume.texture_frame, + m_input.params, m_input.color, + [&ctl, &status, &last_reported, i, count](int percent) { + if (ctl.was_canceled()) + return false; + const int overall = + int((i * 100 + size_t(std::max(0, percent))) / count); + if (overall > last_reported) { + last_reported = overall; + ctl.update_status(overall, status); + } + return true; + }); + if (ctl.was_canceled()) + break; + } ctl.update_status(100, status); // always finish at 100: this is what closes the notification } @@ -72,44 +84,56 @@ void TextureDisplacementPrepareJob::finalize(bool canceled, std::exception_ptr & if (canceled || eptr) return; - if (m_result.paint_lost) { - outcome = TextureDisplacementPrepareOutcome::PaintLost; - return; + // One part losing its paint stops the whole prepare, exactly as it stops a single-part one: the + // promise is that a prepare which cannot carry the paint changes nothing, and committing the other + // parts would break it halfway. The message that follows tells the user to remesh by hand instead. + for (const TextureDisplacementPrepareResult &result : m_results) + if (result.paint_lost) { + outcome = TextureDisplacementPrepareOutcome::PaintLost; + return; + } + + Plater *plater = wxGetApp().plater(); + + // Resolved before the snapshot is opened, so a run whose parts have all gone away leaves no empty + // undo step behind. The lookup doubles as the staleness check: anything that replaces a volume's + // mesh also gives it a new id (set_new_unique_id()), so a prepare computed from a mesh that has + // since been replaced - by an undo, another bake, or a boolean - simply fails to find its volume. + std::vector> to_commit; + for (size_t i = 0; i < m_results.size(); ++i) { + if (m_results[i].mesh.indices.empty()) + continue; + if (ModelVolume *volume = get_model_volume(m_input.volumes[i].volume_id, plater->model().objects); + volume != nullptr && volume->get_object() != nullptr) + to_commit.emplace_back(i, volume); } - if (m_result.mesh.indices.empty()) { + if (to_commit.empty()) { + // Nothing needed doing anywhere, which is not an error - every mesh already met the criteria. outcome = TextureDisplacementPrepareOutcome::Unchanged; return; } - Plater *plater = wxGetApp().plater(); - ModelVolume *volume = get_model_volume(m_input.volume_id, plater->model().objects); - // The lookup doubles as a staleness check: anything that replaces a volume's mesh also gives it a - // new id (set_new_unique_id()), so a prepare computed from a mesh that has since been replaced - - // by an undo, another bake, or a boolean - simply fails to find its volume and commits nothing. - if (volume == nullptr) - return; - ModelObject *object = volume->get_object(); - if (object == nullptr) - return; - + ModelObject *object = to_commit.front().second->get_object(); { Plater::TakeSnapshot snapshot(plater, m_input.snapshot_name, UndoRedo::SnapshotType::GizmoAction); - // The four standard paint channels ride across on ModelVolume's own spatial remap. The eight - // texture-displacement masks do not go through it - prepare_mesh() has already carried them, - // exactly, from the source triangles the refinement records - so they are put back after - // restore_painting(), which resets every extra facet before remapping the channels it knows. - std::optional saved_painting = volume->save_painting(); - volume->set_mesh(TriangleMesh(std::move(m_result.mesh))); - volume->set_new_unique_id(); - volume->calculate_convex_hull(); - volume->restore_painting(saved_painting); - for (int i = 0; i < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++i) - volume->texture_displacement_facet(i).set_data(std::move(m_result.masks[size_t(i)])); - // The model's own UV channel, resampled onto the new mesh by the run. Also put back after - // restore_painting(), which resets it along with the extra facets for the same reason: it is - // indexed by triangle and the triangles have changed. - volume->texture_uv = std::move(m_result.uv); + for (const auto &[i, volume] : to_commit) { + // The four standard paint channels ride across on ModelVolume's own spatial remap. The eight + // texture-displacement masks do not go through it - prepare_mesh() has already carried them, + // exactly, from the source triangles the refinement records - so they are put back after + // restore_painting(), which resets every extra facet before remapping the channels it knows. + std::optional saved_painting = volume->save_painting(); + volume->set_mesh(TriangleMesh(std::move(m_results[i].mesh))); + volume->set_new_unique_id(); + volume->calculate_convex_hull(); + volume->restore_painting(saved_painting); + for (int slot = 0; slot < int(TEXTURE_DISPLACEMENT_MAX_LAYERS); ++slot) + volume->texture_displacement_facet(slot).set_data(std::move(m_results[i].masks[size_t(slot)])); + // The model's own UV channel, resampled onto the new mesh by the run. Also put back after + // restore_painting(), which resets it along with the extra facets for the same reason: it is + // indexed by triangle and the triangles have changed. + volume->texture_uv = std::move(m_results[i].uv); + } if (ObjectList *obj_list = wxGetApp().obj_list()) { const ModelObjectPtrs &objs = plater->model().objects; diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.hpp b/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.hpp index a07bf63ae9..1565e54f83 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.hpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementPrepareJob.hpp @@ -31,36 +31,50 @@ namespace Slic3r::GUI { // this job adds is the worker thread, the progress notification with its Cancel button, and the commit. enum class TextureDisplacementPrepareOutcome { - Committed, // the volume now carries the prepared mesh and the paint carried onto it - Unchanged, // nothing needed doing - the mesh already met the criteria; the model was not touched - PaintLost, // the remesh landed but no layer's paint survived it, so nothing was committed - Failed, // cancelled, threw, or the volume went away while the job ran + Committed, // the parts now carry the prepared mesh and the paint carried onto it + Unchanged, // nothing needed doing - the meshes already met the criteria; the model was not touched + PaintLost, // a remesh landed but no layer's paint survived it, so nothing was committed + Failed, // cancelled, threw, or the volumes went away while the job ran }; -struct TextureDisplacementPrepareInput +// One model part's share of a prepare. As with the bake, `layers` belongs to the object rather than to +// the part (see GLGizmoTextureDisplacement::layers_for_part()). +struct TextureDisplacementPrepareVolume { ObjectID volume_id; indexed_triangle_set base_mesh; TextureDisplacementFacetsData masks; std::vector layers; - TextureDisplacementPrepareParams params; - // Captured on the main thread. Empty when no layer is colouring, in which case the refinement - // skips the colour criterion entirely. Only the *quantizer* is used here: refinement follows - // perceived colour, never the interleaving that realises a mix. - TextureColorSettings color; - // The volume's own UV channel (ModelVolume::texture_uv), empty when it has none. prepare_mesh() + // The part's own UV channel (ModelVolume::texture_uv), empty when it has none. prepare_mesh() // resamples it onto the mesh it produces, and the commit puts it back - like the masks, it is // indexed by triangle and so cannot survive the stages on its own. std::vector model_uv; + // Where prepare_mesh() samples the texture: the bake frame shared by every part of a multibody + // object, so each part is refined for the texture the bake will put on it. Identity, the part's own + // coordinates, for a single-part object. + Transform3d texture_frame = Transform3d::Identity(); +}; + +struct TextureDisplacementPrepareInput +{ + // Every model part to prepare, in the object's own volume order - the same parts the bake that + // follows will displace, so a multibody object is refined everywhere its paint reaches rather than + // only on its first part. + std::vector volumes; + TextureDisplacementPrepareParams params; + // Captured on the main thread. Empty when no layer is colouring, in which case the refinement + // skips the colour criterion entirely. Only the *quantizer* is used here: refinement follows + // perceived colour, never the interleaving that realises a mix. + TextureColorSettings color; // The undo step the commit opens. Standard mode's Bake names it after the bake, because the // displacement job that follows commits into this same step rather than pushing its own. - std::string snapshot_name; + std::string snapshot_name; }; class TextureDisplacementPrepareJob : public Job { TextureDisplacementPrepareInput m_input; - TextureDisplacementPrepareResult m_result; + std::vector m_results; std::function m_on_finished; public: diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.cpp b/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.cpp index 32b88aa951..ee17d11c8e 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.cpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.cpp @@ -1,19 +1,22 @@ #include "TextureDisplacementPreviewJob.hpp" #include "slic3r/GUI/Gizmos/GLGizmoTextureDisplacement.hpp" +#include #include #include #include #include #include +#include #include "libslic3r/TextureDisplacement.hpp" #include namespace Slic3r::GUI { -TextureDisplacementPreviewJob::TextureDisplacementPreviewJob(TextureDisplacementPreviewInput &&input, uint64_t generation, - std::shared_ptr> current_generation, - std::function on_finished) +TextureDisplacementPreviewJob::TextureDisplacementPreviewJob( + TextureDisplacementPreviewInput &&input, uint64_t generation, + std::shared_ptr> current_generation, + std::function, uint64_t)> on_finished) : m_input(std::move(input)), m_generation(generation), m_current_generation(std::move(current_generation)), m_on_finished(std::move(on_finished)) { @@ -26,6 +29,9 @@ void TextureDisplacementPreviewJob::process(Ctl &ctl) // Only ever touches m_input (captured by value before this job was queued) and local state - // never the live Model - so this is safe to run concurrently with the UI thread. + // + // The quantizers are built once for the whole run: the palette is the object's, not the part's, + // and each one fills a colour lookup cube that costs tens of milliseconds. TextureColorRequest color_request; TextureColorRequest *color = nullptr; if (!m_input.color.empty()) { @@ -33,23 +39,32 @@ void TextureDisplacementPreviewJob::process(Ctl &ctl) if (!m_input.color.palette_pure.empty()) color_request.quantize_pure = GLGizmoTextureDisplacement::make_palette_quantizer(m_input.color.palette_pure); color_request.despeckle_passes = m_input.color.despeckle_passes; - color_request.out_triangle = &m_result.triangle_color; if (color_request.quantize) color = &color_request; } - m_result.mesh = build_texture_displacement(m_input.base_mesh, m_input.layers, m_input.facets_data, - m_input.options, - [this, &ctl](int) { - // Bail the moment this preview stops being the current - // one; build_texture_displacement() then returns an - // empty mesh and finalize() drops it. - return !ctl.was_canceled() && - (!m_current_generation || - m_current_generation->load() == m_generation); - }, - color, m_input.volume_to_world, nullptr, nullptr, - m_input.model_uv.empty() ? nullptr : &m_input.model_uv); + // Bail the moment this preview stops being the current one: build_texture_displacement() then + // returns an empty mesh, and finalize() drops the whole run rather than showing half of it. + const auto still_wanted = [this, &ctl](int) { + return !ctl.was_canceled() && + (!m_current_generation || m_current_generation->load() == m_generation); + }; + + m_results.resize(m_input.volumes.size()); + for (size_t i = 0; i < m_input.volumes.size(); ++i) { + const TextureDisplacementPreviewVolume &volume = m_input.volumes[i]; + if (color != nullptr) + color_request.out_triangle = &m_results[i].triangle_color; + m_results[i].mesh = build_texture_displacement(volume.base_mesh, volume.layers, volume.facets_data, + volume.options, still_wanted, color, volume.volume_to_world, + nullptr, nullptr, + volume.model_uv.empty() ? nullptr : &volume.model_uv, + &volume.texture_anchor, volume.resting_drop); + if (!still_wanted(0)) { + m_results.clear(); + return; + } + } } void TextureDisplacementPreviewJob::finalize(bool canceled, std::exception_ptr &eptr) @@ -62,9 +77,9 @@ void TextureDisplacementPreviewJob::finalize(bool canceled, std::exception_ptr & // was ever queued again for the rest of the session. An empty result is the caller's signal that // nothing usable came back; it already handles that. if (canceled || eptr) - m_on_finished(TextureDisplacementPreviewResult{}, m_generation); + m_on_finished({}, m_generation); else - m_on_finished(std::move(m_result), m_generation); + m_on_finished(std::move(m_results), m_generation); } } // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.hpp b/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.hpp index 7f7941e828..c8ef0fb168 100644 --- a/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.hpp +++ b/src/slic3r/GUI/Jobs/TextureDisplacementPreviewJob.hpp @@ -15,9 +15,9 @@ namespace Slic3r::GUI { -// Everything process() needs, captured by value on the main thread when the job is queued - -// mirrors TextureDisplacementBakeInput, but a preview never writes back to the Model. -struct TextureDisplacementPreviewInput +// One model part's share of a preview. Captured by value on the main thread when the job is queued - +// mirrors TextureDisplacementBakeVolume, but a preview never writes back to the Model. +struct TextureDisplacementPreviewVolume { indexed_triangle_set base_mesh; std::vector layers; @@ -26,16 +26,26 @@ struct TextureDisplacementPreviewInput // Mesh coordinates -> world millimetres, so the preview is displaced in the same space the bake // is and the two cannot disagree. See build_texture_displacement(). Transform3d volume_to_world = Transform3d::Identity(); - // Empty unless a layer is colouring, in which case the preview reports the palette entry per - // triangle alongside the mesh, so the Normal view shows the colours the bake will produce. - TextureColorSettings color; - // The volume's own UV channel (ModelVolume::texture_uv), so a ModelUV layer previews through the - // same layout it will bake through. Empty when the volume has none. + // The part's own UV channel (ModelVolume::texture_uv), so a ModelUV layer previews through the + // same layout it will bake through. Empty when the part has none. std::vector model_uv; + // Where the part sits in its object, as TextureDisplacementBakeVolume has it. + Vec3d texture_anchor = Vec3d::Zero(); + float resting_drop = 0.f; }; -// A preview result: the displaced mesh, and - when the input carried a palette - one palette entry per -// triangle (its index + 1; 0 means "no colour from the texture"). +struct TextureDisplacementPreviewInput +{ + // The same parts the bake would displace, in the object's own volume order, so the preview shows + // the whole of what Bake will do on a multibody object rather than just its first part. + std::vector volumes; + // Empty unless a layer is colouring, in which case the preview reports the palette entry per + // triangle alongside the mesh, so the Normal view shows the colours the bake will produce. + TextureColorSettings color; +}; + +// A preview result for one part: the displaced mesh, and - when the input carried a palette - one +// palette entry per triangle (its index + 1; 0 means "no colour from the texture"). struct TextureDisplacementPreviewResult { indexed_triangle_set mesh; @@ -65,9 +75,12 @@ public: // already been superseded stops burning CPU instead of running to completion for a result that // will only be thrown away. That matters because the UI job worker runs one job at a time in FIFO // order: without it, a Bake queued behind a handful of stale previews waits for every one of them. + // + // `on_finished` receives one result per input part, at the same index - or an empty vector when + // the run was superseded, cancelled or threw. TextureDisplacementPreviewJob(TextureDisplacementPreviewInput &&input, uint64_t generation, std::shared_ptr> current_generation, - std::function on_finished); + std::function, uint64_t)> on_finished); void process(Ctl &ctl) override; void finalize(bool canceled, std::exception_ptr &eptr) override; @@ -76,8 +89,8 @@ private: TextureDisplacementPreviewInput m_input; uint64_t m_generation; std::shared_ptr> m_current_generation; - TextureDisplacementPreviewResult m_result; - std::function m_on_finished; + std::vector m_results; + std::function, uint64_t)> m_on_finished; }; } // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.cpp b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.cpp index 8c6e475ad7..f91fc0ed23 100644 --- a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.cpp +++ b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.cpp @@ -17,6 +17,7 @@ #include "libslic3r/libslic3r.h" #include "LibVGCodeWrapper.hpp" +#include "slic3r/GUI/3DScene.hpp" #include #include "libslic3r/Print.hpp" @@ -73,10 +74,28 @@ Color convert(const Slic3r::ColorRGBA& c) return { safe_val(c.r()), safe_val(c.g()), safe_val(c.b()) }; } -Color convert(const std::string& color_str) +Slic3r::ColorRGBA convert(const ColorWithAlpha& c) { - Slic3r::ColorRGBA color_rgba; - return decode_color(color_str, color_rgba) ? convert(color_rgba) : DUMMY_COLOR; + static const float inv_255 = 1.0f / 255.0f; + return { c[0] * inv_255, c[1] * inv_255, c[2] * inv_255, c[3] * inv_255 }; +} + +PaletteWithAlpha convert_filament_colors(const std::vector& colors_str) +{ + PaletteWithAlpha ret; + ret.reserve(colors_str.size()); + for (const std::string& color_str : colors_str) { + Slic3r::ColorRGBA color_rgba; + if (!decode_color(color_str, color_rgba)) { + ret.push_back({ DUMMY_COLOR[0], DUMMY_COLOR[1], DUMMY_COLOR[2], 255 }); + continue; + } + // as the 3D view draws it: a clear color kept at the least opacity, black lifted + color_rgba = adjust_color_for_rendering(color_rgba); + const Color color = convert(color_rgba); + ret.push_back({ color[0], color[1], color[2], static_cast(std::lround(255.0f * color_rgba.a())) }); + } + return ret; } Slic3r::ExtrusionRole convert(EGCodeExtrusionRole role) @@ -233,18 +252,8 @@ GCodeInputData convert(const Slic3r::GCodeProcessorResult& result, const std::ve return convert(v); }; - // collect tool colors - ret.tools_colors.reserve(str_tool_colors.size()); - for (const std::string& color : str_tool_colors) { - ret.tools_colors.emplace_back(convert(color)); - } - - // collect color print colors - const std::vector& str_colors = str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors; - ret.color_print_colors.reserve(str_colors.size()); - for (const std::string& color : str_colors) { - ret.color_print_colors.emplace_back(convert(color)); - } + ret.tools_colors = convert_filament_colors(str_tool_colors); + ret.color_print_colors = convert_filament_colors(str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors); const std::vector& moves = result.moves; // One vertex per move after the first, plus a phantom in front of every path start. Reserving @@ -874,18 +883,8 @@ GCodeInputData convert(const Slic3r::Print& print, const std::vector& str_colors = str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors; - ret.color_print_colors.reserve(str_colors.size()); - for (const std::string& color : str_colors) { - ret.color_print_colors.emplace_back(convert(color)); - } + ret.tools_colors = convert_filament_colors(str_tool_colors); + ret.color_print_colors = convert_filament_colors(str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors); return ret; } diff --git a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp index a780a5f033..b354abd81e 100644 --- a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp +++ b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp @@ -47,8 +47,11 @@ extern Slic3r::ColorRGBA convert(const Color& c); // mapping from Slic3r::ColorRGBA to libvgcode::Color extern Color convert(const Slic3r::ColorRGBA& c); -// mapping from encoded color to libvgcode::Color -extern Color convert(const std::string& color_str); +// ORCA: mapping from libvgcode::ColorWithAlpha to Slic3r::ColorRGBA +extern Slic3r::ColorRGBA convert(const ColorWithAlpha& c); + +// ORCA: mapping from encoded filament colors to libvgcode::PaletteWithAlpha, keeping their opacity +extern PaletteWithAlpha convert_filament_colors(const std::vector& colors_str); // mapping from libvgcode::EGCodeExtrusionRole to Slic3r::ExtrusionRole extern Slic3r::ExtrusionRole convert(EGCodeExtrusionRole role); diff --git a/src/slic3r/GUI/MacIME.hpp b/src/slic3r/GUI/MacIME.hpp new file mode 100644 index 0000000000..1b6f3fb9e6 --- /dev/null +++ b/src/slic3r/GUI/MacIME.hpp @@ -0,0 +1,26 @@ +#pragma once + +// Input methods (Chinese, Japanese, Korean) for ImGui text fields drawn on a GL canvas on macOS. +// +// wxWidgets gives a wxGLCanvas a view that is no NSTextInputClient, so the view has no input context: +// keys skip the input method and a CJK input source types plain letters. These functions turn the +// canvas view into a text input client while an ImGui text field wants text input. Committed text still +// arrives as wxEVT_CHAR. + +namespace Slic3r::GUI { + +// Call every frame with io.WantTextInput. While active, the view's input context stays the current one, +// which also lets the input source's own language toggle (Caps Lock, 中/英) reach the field. Deactivating +// drops an unfinished composition. +void mac_ime_set_active(void* ns_view, bool active); + +// Anchors the candidate window at the text cursor. x, y (top of the cursor line) and height are canvas +// backing pixels, the coordinates ImGui works in. +void mac_ime_set_caret(void* ns_view, int x, int y, int height); + +// True when the key-down being dispatched belongs to the input method: it changed or ended a composition, +// or arrived while one was open. wxWidgets still sends a key-down for such a key, which must not also +// edit the text field. +bool mac_ime_owns_key(void* ns_view); + +} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/MacIME.mm b/src/slic3r/GUI/MacIME.mm new file mode 100644 index 0000000000..5e9afdc489 --- /dev/null +++ b/src/slic3r/GUI/MacIME.mm @@ -0,0 +1,194 @@ +#import "MacIME.hpp" + +#import +#import + +// The canvas view's class (wxNSCustomOpenGLView) gets the NSTextInputClient methods added at runtime. +// Declaring the protocol at runtime does not give a view an input context, so the view also overrides +// -inputContext and owns its NSTextInputContext. The client models only the composition: it never sees +// the field's text, so the composition is the whole document as far as the input method is concerned. +// Per-view state lives in associated objects. Compiled without ARC. + +namespace { + +char key_installed; // on the class: methods added +char key_context; // NSTextInputContext* +char key_active; // NSNumber: an ImGui text field wants text input +char key_marked; // NSString*: the composition, nil when there is none +char key_selected; // NSValue (NSRange): the selection inside the composition +char key_caret; // NSValue (NSRect): the text cursor line in view coordinates +char key_ime_event; // NSEvent*: the last key-down that changed a composition + +id get(id object, const void* key) { return objc_getAssociatedObject(object, key); } + +void set(id object, const void* key, id value) { objc_setAssociatedObject(object, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } + +bool is_active(id view) { return [get(view, &key_active) boolValue]; } + +NSString* marked_text(id view) { return get(view, &key_marked); } + +void set_marked_text(id view, NSString* text, NSRange selected) +{ + const bool composing = text.length > 0; + set(view, &key_marked, composing ? text : nil); + set(view, &key_selected, composing ? [NSValue valueWithRange:selected] : nil); +} + +// The key-down being dispatched went to the input method. +void claim_current_key(id view) +{ + NSEvent* event = [NSApp currentEvent]; + if (event.type == NSEventTypeKeyDown) + set(view, &key_ime_event, event); +} + +NSString* plain_string(id text) { return [text isKindOfClass:[NSAttributedString class]] ? [text string] : text; } + +// wx's own insertText: sends the text as wxEVT_CHAR, preceded by a key-down when it is the character of +// the key being pressed. +void send_text(id view, NSString* text) +{ + if (text.length > 0) + [view performSelector:@selector(insertText:) withObject:text]; +} + +NSTextInputContext* ime_input_context(id self, SEL) { return is_active(self) ? get(self, &key_context) : nil; } + +void ime_insert_text(id self, SEL, id text, NSRange) +{ + if (marked_text(self) != nil) { + claim_current_key(self); + set_marked_text(self, nil, {}); + } + send_text(self, plain_string(text)); +} + +void ime_set_marked_text(id self, SEL, id text, NSRange selected, NSRange) +{ + claim_current_key(self); + set_marked_text(self, plain_string(text), selected); +} + +// Accepts the composition as typed. +void ime_unmark_text(id self, SEL) +{ + NSString* text = [[marked_text(self) retain] autorelease]; + if (text == nil) + return; + claim_current_key(self); + set_marked_text(self, nil, {}); + send_text(self, text); +} + +BOOL ime_has_marked_text(id self, SEL) { return marked_text(self) != nil; } + +NSRange ime_marked_range(id self, SEL) +{ + NSString* text = marked_text(self); + return text != nil ? NSMakeRange(0, text.length) : NSMakeRange(NSNotFound, 0); +} + +NSRange ime_selected_range(id self, SEL) +{ + NSValue* selected = get(self, &key_selected); + return selected != nil ? selected.rangeValue : NSMakeRange(NSNotFound, 0); +} + +NSRect ime_first_rect(id self, SEL, NSRange range, NSRangePointer actual_range) +{ + if (actual_range != nullptr) + *actual_range = range; + NSView* view = self; + NSValue* caret = get(self, &key_caret); + // Without a reported cursor, the top-left corner of the canvas. + const NSRect rect = caret != nil ? caret.rectValue : NSMakeRect(0, 0, 1, 16); + return view.window != nil ? [view.window convertRectToScreen:[view convertRect:rect toView:nil]] : NSZeroRect; +} + +NSAttributedString* ime_attributed_substring(id self, SEL, NSRange range, NSRangePointer actual_range) +{ + NSString* text = marked_text(self); + const NSRange clamped = text != nil ? NSIntersectionRange(range, NSMakeRange(0, text.length)) : NSMakeRange(0, 0); + if (clamped.length == 0) + return nil; + if (actual_range != nullptr) + *actual_range = clamped; + return [[[NSAttributedString alloc] initWithString:[text substringWithRange:clamped]] autorelease]; +} + +NSArray* ime_valid_attributes(id, SEL) { return @[]; } + +NSUInteger ime_character_index(id, SEL, NSPoint) { return NSNotFound; } + +void install(Class cls) +{ + if (get(cls, &key_installed) != nil) + return; + set(cls, &key_installed, @YES); + + Protocol* protocol = @protocol(NSTextInputClient); + class_addProtocol(cls, protocol); + const struct { SEL sel; IMP imp; } methods[] = { + { @selector(insertText:replacementRange:), (IMP) ime_insert_text }, + { @selector(setMarkedText:selectedRange:replacementRange:), (IMP) ime_set_marked_text }, + { @selector(unmarkText), (IMP) ime_unmark_text }, + { @selector(hasMarkedText), (IMP) ime_has_marked_text }, + { @selector(markedRange), (IMP) ime_marked_range }, + { @selector(selectedRange), (IMP) ime_selected_range }, + { @selector(firstRectForCharacterRange:actualRange:), (IMP) ime_first_rect }, + { @selector(attributedSubstringForProposedRange:actualRange:), (IMP) ime_attributed_substring }, + { @selector(validAttributesForMarkedText), (IMP) ime_valid_attributes }, + { @selector(characterIndexForPoint:), (IMP) ime_character_index }, + }; + for (const auto& method : methods) + class_addMethod(cls, method.sel, method.imp, protocol_getMethodDescription(protocol, method.sel, YES, YES).types); + // The view's own doCommandBySelector: (from wx) stays: keys the input method passes on reach wx unchanged. + class_addMethod(cls, @selector(inputContext), (IMP) ime_input_context, + method_getTypeEncoding(class_getInstanceMethod([NSView class], @selector(inputContext)))); +} + +} // namespace + +namespace Slic3r::GUI { + +void mac_ime_set_active(void* ns_view, bool active) +{ + NSView* view = (NSView*) ns_view; + if (view == nil || active == is_active(view)) + return; + NSTextInputContext* context = get(view, &key_context); + if (context == nil) { + install([view class]); + context = [[[NSTextInputContext alloc] initWithClient:(id) view] autorelease]; + set(view, &key_context, context); + } + // An open composition belongs to the field that lost input or to an earlier session; dropping it + // first keeps the input method's callbacks from committing it. + set_marked_text(view, nil, {}); + set(view, &key_active, @(active)); + if (active) + [context activate]; + else { + [context discardMarkedText]; + [context deactivate]; + } +} + +void mac_ime_set_caret(void* ns_view, int x, int y, int height) +{ + NSView* view = (NSView*) ns_view; + if (view == nil) + return; + const CGFloat scale = view.window != nil ? view.window.backingScaleFactor : 1.0; + set(view, &key_caret, [NSValue valueWithRect:NSMakeRect(x / scale, y / scale, 1.0, height / scale)]); +} + +bool mac_ime_owns_key(void* ns_view) +{ + NSView* view = (NSView*) ns_view; + NSEvent* event = [NSApp currentEvent]; + return view != nil && is_active(view) && event.type == NSEventTypeKeyDown && + (marked_text(view) != nil || get(view, &key_ime_event) == event); +} + +} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index b1ae832abc..9938509e89 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -732,6 +732,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ MarkdownTip::ExitTip(); // Prevent queued selection/UI refresh work from running as normal during reset. wxGetApp().set_closing(true); + wxGetApp().start_exit_watchdog(); m_plater->reset(); this->shutdown(); @@ -801,7 +802,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ this->Iconize(); return; } - if (evt.CmdDown() && evt.GetKeyCode() == 'Q') { wxPostEvent(this, wxCloseEvent(wxEVT_CLOSE_WINDOW)); return;} if (evt.CmdDown() && evt.RawControlDown() && evt.GetKeyCode() == 'F') { EnableFullScreenView(true); if (IsFullScreen()) { @@ -901,12 +901,19 @@ bool MainFrame::handle_global_shortcut(const KeyChord& chord) if (can_export_model()) publish_project(); break; + case Shortcut::Quit: + Close(false); + break; case Shortcut::ShowLabels: if (m_plater && m_plater->is_view3D_shown()) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); } break; + case Shortcut::ShowCollisionVolumes: + if (m_plater && m_plater->is_view3D_shown() && m_plater->printer_technology() == ptFFF) + m_plater->show_collision_volumes(!m_plater->are_collision_volumes_shown()); + break; case Shortcut::ViewDefault: if (m_plater) { select_view("plate"); @@ -3116,7 +3123,7 @@ void MainFrame::init_menubar_as_editor() fileMenu->AppendSeparator(); #ifndef __APPLE__ - append_menu_item(fileMenu, wxID_EXIT, _L("Quit"), wxString::Format(_L("Quit")), + append_shortcut_item(fileMenu, Shortcut::Quit, false, _L("Quit"), wxString::Format(_L("Quit")), [this](wxCommandEvent&) { Close(false); }, "menu_exit", nullptr); #else append_menu_item(fileMenu, wxID_EXIT, _L("Quit"), wxString::Format(_L("Quit")), @@ -3130,12 +3137,15 @@ void MainFrame::init_menubar_as_editor() { editMenu = new wxMenu(); + // Feeds the key to ImGui instead when ImGui has the focused canvas's keyboard, since the menu + // handles its key equivalents before the canvas receives the key. auto handle_key_event = [](wxKeyEvent& evt) { - if (wxGetApp().imgui()->update_key_data(evt)) { - wxGetApp().plater()->get_current_canvas3D()->render(); - return true; - } - return false; + const ImGuiWrapper* imgui = focused_canvas_imgui(wxWindow::FindFocus()); + if (imgui == nullptr || !imgui->owns_keyboard()) + return false; + wxGetApp().imgui()->update_key_data(evt); + wxGetApp().plater()->get_current_canvas3D()->render(); + return true; }; #ifndef __APPLE__ // BBS undo @@ -3469,6 +3479,14 @@ void MainFrame::init_menubar_as_editor() [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this); m_shortcut_menu_items.push_back({ show_labels, Shortcut::ShowLabels, _L("Show &Labels"), true }); + wxMenuItem* show_collision_volumes = append_menu_check_item( + viewMenu, wxID_ANY, shortcut_label(_L("Show all collision volumes"), Shortcut::ShowCollisionVolumes, true), + _L("Show the full height of every configured collision volume, including on an empty bed."), + [this](wxCommandEvent&) { m_plater->show_collision_volumes(!m_plater->are_collision_volumes_shown()); }, this, + [this]() { return m_plater->is_view3D_shown() && m_plater->printer_technology() == ptFFF; }, + [this]() { return m_plater->are_collision_volumes_shown(); }, this); + m_shortcut_menu_items.push_back({ show_collision_volumes, Shortcut::ShowCollisionVolumes, _L("Show all collision volumes"), true }); + append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Overhang"), _L("Show object overhang highlight in 3D scene."), [this](wxCommandEvent &) { m_plater->show_view3D_overhang(!m_plater->is_view3D_overhang_shown()); diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index b517e36841..3e1943ecb3 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -21,6 +21,9 @@ #include #include #include +#ifdef _WIN32 +#include +#endif #include #include #include @@ -164,122 +167,96 @@ static std::string format_device_string(int vid, int pid) return ret; } +namespace { +// One HID top-level collection: what both device lists below report. +struct HidCollection +{ + unsigned short vendor_id{ 0 }; + unsigned short product_id{ 0 }; + unsigned short usage_page{ 0 }; + unsigned short usage{ 0 }; +}; +} // namespace + +// Windows keeps the ids and usage of every HID collection for Raw Input, so nothing is opened. +// hid_enumerate() opens and queries every HID device instead (~200 ms on a typical PC). +static bool list_hid_collections_raw_input(std::vector& out) +{ + std::vector devices; + bool listed = false; + for (int attempt = 0; attempt < 3 && ! listed; ++attempt) { + UINT count = 0; + if (::GetRawInputDeviceList(nullptr, &count, sizeof(RAWINPUTDEVICELIST)) != 0) + return false; + devices.resize(count); + const UINT got = count == 0 ? 0 : ::GetRawInputDeviceList(devices.data(), &count, sizeof(RAWINPUTDEVICELIST)); + if (got != UINT(-1)) { + devices.resize(got); + listed = true; + } else if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) + return false; + // else a device was plugged in meanwhile, try again + } + if (! listed) + return false; + + for (const RAWINPUTDEVICELIST& device : devices) { + if (device.dwType != RIM_TYPEHID) + continue; + RID_DEVICE_INFO info{}; + info.cbSize = sizeof(info); + UINT size = sizeof(info); + if (::GetRawInputDeviceInfoW(device.hDevice, RIDI_DEVICEINFO, &info, &size) == UINT(-1)) + continue; + out.push_back({ static_cast(info.hid.dwVendorId), static_cast(info.hid.dwProductId), + info.hid.usUsagePage, info.hid.usUsage }); + } + return true; +} + static std::string detect_attached_device() { - std::string ret; - // Initialize the hidapi library - int res = hid_init(); - if (res != 0) - BOOST_LOG_TRIVIAL(error) << "Unable to initialize hidapi library"; - else if (wxGetApp().app_config->get("skip_3dmouse_detect") == "true") { - BOOST_LOG_TRIVIAL(info) << "do not detect 3d Mouse"; + std::vector collections; + if (! list_hid_collections_raw_input(collections)) { + // A device plugged in later still connects through device_attached(). + const DWORD error = ::GetLastError(); + BOOST_LOG_TRIVIAL(warning) << "Raw Input device list unavailable, error " << error; + return {}; + } + if (collections.empty()) { + BOOST_LOG_TRIVIAL(trace) << "detect_attached_device() - no HID device enumerated."; + return {}; } - else { - // Enumerates devices - hid_device_info* devices = hid_enumerate(0, 0); - if (devices == nullptr) - BOOST_LOG_TRIVIAL(trace) << "detect_attached_device() - no HID device enumerated."; - else { - // Searches for 1st connected 3Dconnexion device - struct DeviceData - { - unsigned short usage_page{ 0 }; - unsigned short usage{ 0 }; - DeviceData(unsigned short usage_page, unsigned short usage) - : usage_page(usage_page), usage(usage) - {} + // https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf + // Usage page 1 - Generic Desktop Controls + // Usage page 1, usage 8 - Multi-axis Controller + const auto has_valid_usage = [](const HidCollection& c) { return c.usage_page == 1 && c.usage == 8; }; - // https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf - // Usage page 1 - Generic Desktop Controls - // Usage page 1, usage 8 - Multi-axis Controller - bool has_valid_usage() const { return usage_page == 1 && usage == 8; } - }; + // When using 3Dconnexion universal receiver, multiple devices are detected sharing the same vendor_id and product_id. + // To choose from them the right one we use: usage_page == 1 and usage == 8 + // When only a single device is detected, as for wired connections, vendor_id and product_id are enough - // When using 3Dconnexion universal receiver, multiple devices are detected sharing the same vendor_id and product_id. - // To choose from them the right one we use: usage_page == 1 and usage == 8 - // When only a single device is detected, as for wired connections, vendor_id and product_id are enough + // First we collect all the 3Dconnexion devices from the enumerated list. + typedef std::pair DeviceIds; + std::map> detected_devices; + for (const HidCollection& c : collections) { + if (std::find(_3DCONNEXION_VENDORS.begin(), _3DCONNEXION_VENDORS.end(), c.vendor_id) == _3DCONNEXION_VENDORS.end() || + std::find(_3DCONNEXION_DEVICES.begin(), _3DCONNEXION_DEVICES.end(), c.product_id) == _3DCONNEXION_DEVICES.end()) + continue; + detected_devices[DeviceIds(c.vendor_id, c.product_id)].push_back(c); + } - // First we count all the valid devices from the enumerated list, - - hid_device_info* current = devices; - typedef std::pair DeviceIds; - typedef std::vector DeviceDataList; - typedef std::map DetectedDevices; - DetectedDevices detected_devices; - while (current != nullptr) { - unsigned short vendor_id = 0; - unsigned short product_id = 0; - - for (size_t i = 0; i < _3DCONNEXION_VENDORS.size(); ++i) { - if (_3DCONNEXION_VENDORS[i] == current->vendor_id) { - vendor_id = current->vendor_id; - break; - } - } - - if (vendor_id != 0) { - for (size_t i = 0; i < _3DCONNEXION_DEVICES.size(); ++i) { - if (_3DCONNEXION_DEVICES[i] == current->product_id) { - product_id = current->product_id; - DeviceIds detected_device(vendor_id, product_id); - DetectedDevices::iterator it = detected_devices.find(detected_device); - if (it == detected_devices.end()) - it = detected_devices.insert(DetectedDevices::value_type(detected_device, DeviceDataList())).first; - - it->second.emplace_back(current->usage_page, current->usage); - } - } - } - - current = current->next; - } - - // Free enumerated devices - hid_free_enumeration(devices); - - unsigned short vendor_id = 0; - unsigned short product_id = 0; - if (!detected_devices.empty()) { - // Then we'll decide the choosing logic to apply in dependence of the device count and operating system - for (const DetectedDevices::value_type& device : detected_devices) { - if (device.second.size() == 1) { - if (device.second.front().has_valid_usage()) { - vendor_id = device.first.first; - product_id = device.first.second; - break; - } - } - else { - bool found = false; - for (const DeviceData& data : device.second) { - if (data.has_valid_usage()) { - vendor_id = device.first.first; - product_id = device.first.second; - found = true; - break; - } - } - - if (found) - break; - } - } - } - - if (vendor_id != 0 && product_id != 0) { - ret = format_device_string(static_cast(vendor_id), static_cast(product_id)); - BOOST_LOG_TRIVIAL(trace) << "Detected device: " << std::hex << vendor_id << std::dec << "::" << std::hex << product_id << std::dec << " " << ret; - } - else - BOOST_LOG_TRIVIAL(trace) << "No 3DConnexion device detected"; + // Then we pick the first device with a multi-axis controller collection. + for (const auto& [ids, device_collections] : detected_devices) { + if (std::any_of(device_collections.begin(), device_collections.end(), has_valid_usage)) { + std::string ret = format_device_string(static_cast(ids.first), static_cast(ids.second)); + BOOST_LOG_TRIVIAL(trace) << "Detected device: " << std::hex << ids.first << std::dec << "::" << std::hex << ids.second << std::dec << " " << ret; + return ret; } - - // Finalize the hidapi library - hid_exit(); } - - return ret; + BOOST_LOG_TRIVIAL(trace) << "No 3DConnexion device detected"; + return {}; } // Called by Win32 HID enumeration callback. @@ -827,7 +804,10 @@ bool Mouse3DController::handle_input(const DataPacketAxis& packet) void Mouse3DController::init() { #ifdef _WIN32 - m_device_str = detect_attached_device(); + if (wxGetApp().app_config->get("skip_3dmouse_detect") == "true") + BOOST_LOG_TRIVIAL(info) << "do not detect 3d Mouse"; + else + m_device_str = detect_attached_device(); if (!m_device_str.empty()) { m_connected = true; if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 8af4cfeef8..57cb7b4c52 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -1209,7 +1209,7 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config if (opt_key == "printable_area") ret = get_thumbnails_string(config.option(opt_key)->values); else if (opt_key == "bed_exclude_area") - ret = get_thumbnails_string(config.option(opt_key)->values); + ret = from_u8(config.option(opt_key)->serialize()); else if (opt_key == "wrapping_exclude_area") ret = get_thumbnails_string(config.option(opt_key)->values); else @@ -1320,7 +1320,7 @@ boost::any ConfigOptionsGroup::get_config_value2(const DynamicPrintConfig& confi if (opt_key == "printable_area") ret = get_thumbnails_string(config.option(opt_key)->values); else if (opt_key == "bed_exclude_area") - ret = get_thumbnails_string(config.option(opt_key)->values); + ret = from_u8(config.option(opt_key)->serialize()); else if (opt_key == "wrapping_exclude_area") ret = get_thumbnails_string(config.option(opt_key)->values); else @@ -1332,6 +1332,21 @@ boost::any ConfigOptionsGroup::get_config_value2(const DynamicPrintConfig& confi return ret; } +bool ConfigOptionsGroup::commit_config_value(const t_config_option_key& opt_key, int opt_index) +{ + if (m_config == nullptr) + return false; + + // m_opt_map is filled while the option lines are created, so it still resolves the option when + // the group's controls (and thus its fields) have not been built yet. + const std::string opt_id = option_id_in_map(m_opt_map, opt_key, opt_index); + if (opt_id.empty()) + return false; + + on_change_OG(opt_id, get_config_value2(*m_config, opt_key, opt_index)); + return true; +} + Field* ConfigOptionsGroup::get_fieldc(const t_config_option_key& opt_key, int opt_index) { Field* field = get_field(opt_key); diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index ae629f943e..bea4596e09 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -119,6 +119,37 @@ using column_t = std::function; using t_optionfield_map = std::map; using t_opt_map = std::map< std::string, std::pair >; +// The option id a group's option map holds for opt_key, and the index it carries. `opt_index` is +// an in/out parameter: a negative value asks for the option's single entry, an explicit one selects +// that index. Returns an empty string when the map does not own the option, or when a negative index +// matches several entries -- a vector option the GUI edits one index at a time, which has no single +// value to commit. A group fills the map while its option lines are created (OptionsGroup::append_line +// / ConfigOptionsGroup::get_option), so this resolves an option even before its controls (and its +// field) have been built. +inline std::string option_id_in_map(const t_opt_map& options, const t_config_option_key& opt_key, int& opt_index) +{ + if (opt_index >= 0) { + for (const auto& opt : options) { + if (opt.second.first == opt_key && opt.second.second == opt_index) { + opt_index = opt.second.second; + return opt.first; + } + } + return {}; + } + + std::string opt_id; + for (const auto& opt : options) { + if (opt.second.first != opt_key) + continue; + if (!opt_id.empty()) + return {}; // several entries: a vector option, not one value + opt_id = opt.first; + opt_index = opt.second.second; + } + return opt_id; +} + class OptionsGroup { public: const bool staticbox{true}; @@ -332,6 +363,15 @@ public: boost::any get_config_value(const DynamicPrintConfig& config, const std::string& opt_key, int opt_index = -1); // BBS: restore all pages in preset boost::any get_config_value2(const DynamicPrintConfig& config, const std::string& opt_key, int opt_index = -1); + // Re-run this group's committed-change path for one of its options without a widget event: + // build the option's value from the config this group edits (get_config_value2, the same form + // the option's field reports) and dispatch on_change_OG(), so the group's option-specific + // conversion (e.g. the printer_agent canonicalization) and its registered change handler run + // exactly as for a hand edit. The option map is filled while the option lines are created, so + // this resolves an option whose field is not built yet (a lazy page, or an option the GUI has + // no field for). Returns false when this group does not own the option, or when opt_index < 0 + // matches several entries (a vector option the GUI edits index by index has no single value). + bool commit_config_value(const t_config_option_key& opt_key, int opt_index = -1); Field* get_fieldc(const t_config_option_key& opt_key, int opt_index); std::pair get_custom_ctrl_with_blinking_ptr(const t_config_option_key& opt_key, int opt_index/* = -1*/); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index ae0c0c46db..f8de4fbfc9 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -76,6 +76,8 @@ #include "libslic3r/GCode/WipeTowerEstimate.hpp" #include "libslic3r/ClipperUtils.hpp" #include "libslic3r/BoundingBox.hpp" +#include "libslic3r/ExclusionVolumeGeometry.hpp" +#include "libslic3r/Tesselate.hpp" #include "libslic3r/Geometry.hpp" #include "libslic3r/GCode/ThumbnailData.hpp" #include "libslic3r/IMEXHelpers.hpp" @@ -1467,6 +1469,144 @@ static bool init_model_from_lines(GLModel &model, const Lines3 &lines) return true; } +static ExPolygon expolygon_from_polygon(const Polygon &polygon) +{ + ExPolygon expolygon; + expolygon.contour = polygon; + expolygon.contour.make_counter_clockwise(); + return expolygon; +} + +static void append_expolygon_triangles(GLModel::Geometry &init_data, const ExPolygon &expolygon, float z) +{ + const std::vector triangles = triangulate_expolygon_2f(expolygon, NORMALS_UP); + if (triangles.empty() || triangles.size() % 3 != 0) + return; + + Vec2f min = triangles.front(); + Vec2f max = min; + for (const Vec2f &v : triangles) { + min = min.cwiseMin(v).eval(); + max = max.cwiseMax(v).eval(); + } + + const Vec2f size = max - min; + if (size.x() <= 0.0f || size.y() <= 0.0f) + return; + + Vec2f inv_size = size.cwiseInverse(); + inv_size.y() *= -1.0f; + + init_data.reserve_vertices(init_data.vertices_count() + triangles.size()); + init_data.reserve_indices(init_data.indices_count() + triangles.size()); + for (const Vec2f &v : triangles) { + init_data.add_vertex(Vec3f(v.x(), v.y(), z), (Vec2f)(v - min).cwiseProduct(inv_size).eval()); + const unsigned int vertices_counter = (unsigned int)init_data.vertices_count(); + if (vertices_counter % 3 == 0) + init_data.add_triangle(vertices_counter - 3, vertices_counter - 2, vertices_counter - 1); + } +} + +static bool init_model_from_polygons(GLModel &model, const Polygons &polygons, float z) +{ + model.reset(); + if (polygons.empty()) + return true; + + GLModel::Geometry init_data; + init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3T2 }; + + for (const Polygon &polygon : polygons) { + if (polygon.points.size() < 3) + continue; + + append_expolygon_triangles(init_data, expolygon_from_polygon(polygon), z); + } + + if (!init_data.is_empty()) + model.init_from(std::move(init_data)); + + return true; +} + +static bool init_model_from_expolygons(GLModel &model, const ExPolygons &expolygons, float z) +{ + model.reset(); + if (expolygons.empty()) + return true; + + GLModel::Geometry init_data; + init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3T2 }; + + for (const ExPolygon &expolygon : expolygons) { + if (expolygon.contour.points.size() < 3) + continue; + + append_expolygon_triangles(init_data, expolygon, z); + } + + if (!init_data.is_empty()) + model.init_from(std::move(init_data)); + + return true; +} + +struct ExclusionVolumePrismPreview +{ + Polygon footprint; + double z_min { 0.0 }; + double z_max { 0.0 }; +}; + +static bool init_exclusion_volume_prism_model(GLModel &model, const std::vector &prisms) +{ + model.reset(); + if (prisms.empty()) + return true; + + GLModel::Geometry init_data; + init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3 }; + + for (const ExclusionVolumePrismPreview &prism : prisms) { + const Polygon &polygon = prism.footprint; + const float z_min = static_cast(prism.z_min); + const float z_max = static_cast(prism.z_max); + if (polygon.points.size() < 3 || z_max <= z_min) + continue; + + init_data.reserve_vertices(init_data.vertices_count() + 4 * polygon.points.size()); + init_data.reserve_indices(init_data.indices_count() + 6 * polygon.points.size()); + for (size_t i = 0; i < polygon.points.size(); ++i) { + const Point &p0 = polygon.points[i]; + const Point &p1 = polygon.points[(i + 1) % polygon.points.size()]; + + init_data.add_vertex(Vec3f(unscale(p0.x()), unscale(p0.y()), z_min)); + init_data.add_vertex(Vec3f(unscale(p1.x()), unscale(p1.y()), z_min)); + init_data.add_vertex(Vec3f(unscale(p1.x()), unscale(p1.y()), z_max)); + init_data.add_vertex(Vec3f(unscale(p0.x()), unscale(p0.y()), z_max)); + + const unsigned int base = (unsigned int)init_data.vertices_count() - 4; + init_data.add_triangle(base, base + 1, base + 2); + init_data.add_triangle(base, base + 2, base + 3); + } + + const ExPolygon expolygon = expolygon_from_polygon(polygon); + const std::vector triangles = triangulate_expolygon_2f(expolygon, NORMALS_UP); + init_data.reserve_vertices(init_data.vertices_count() + triangles.size()); + init_data.reserve_indices(init_data.indices_count() + triangles.size()); + const unsigned int cap_base = (unsigned int)init_data.vertices_count(); + for (const Vec2f &v : triangles) + init_data.add_vertex(Vec3f(v.x(), v.y(), z_max)); + for (size_t i = 0; i + 2 < triangles.size(); i += 3) + init_data.add_triangle(cap_base + (unsigned int)i, cap_base + (unsigned int)i + 1, cap_base + (unsigned int)i + 2); + } + + if (!init_data.is_empty()) + model.init_from(std::move(init_data)); + + return true; +} + static void init_raycaster_from_model(PickingModel& model) { assert(model.mesh_raycaster == nullptr); @@ -1886,6 +2026,410 @@ void PartPlate::render_exclude_area(bool force_default_color) { glsafe(::glDepthMask(GL_TRUE)); } +double PartPlate::max_broad_phase_intersecting_object_height(const Polygons& regions) const +{ + if (m_model == nullptr) + return 0.0; + + double max_height = 0.0; + + for (const std::pair &object_instance : obj_to_instance_set) { + const int obj_id = object_instance.first; + const int instance_id = object_instance.second; + if (obj_id < 0 || obj_id >= int(m_model->objects.size())) + continue; + + ModelObject *object = m_model->objects[obj_id]; + if (instance_id < 0 || instance_id >= int(object->instances.size())) + continue; + + ModelInstance *instance = object->instances[instance_id]; + if (!instance->printable) + continue; + + Polygon hull = instance->convex_hull_2d(); + bool intersects_region = false; + for (const Polygon ®ion : regions) { + if (!intersection(Polygons{ region }, Polygons{ hull }).empty()) { + intersects_region = true; + break; + } + } + + if (!intersects_region) + continue; + + const BoundingBoxf3 instance_box = object->instance_convex_hull_bounding_box(instance_id); + max_height = std::max(max_height, instance_box.max.z()); + } + + return max_height; +} + +std::string PartPlate::exclusion_volume_preview_cache_key(const std::vector ®ions) const +{ + std::ostringstream key; + key << std::setprecision(17); + key << "plate:" << m_origin.x() << ',' << m_origin.y() << ',' << m_height << ';'; + + key << "regions:" << regions.size() << ';'; + for (const BedExcludeRegion ®ion : regions) { + key << region.z_min << ".." << region.z_max << ':' + << int(region.purpose) << ':' << region.has_z_range << ':' + << region.polygon.points.size(); + for (const Point &point : region.polygon.points) + key << ',' << point.x() << 'x' << point.y(); + key << ';'; + } + + key << "instances:" << obj_to_instance_set.size() << ';'; + if (m_model != nullptr) { + for (const std::pair &object_instance : obj_to_instance_set) { + const int obj_id = object_instance.first; + const int instance_id = object_instance.second; + key << obj_id << ':' << instance_id << ':'; + if (obj_id < 0 || obj_id >= int(m_model->objects.size())) { + key << "invalid;"; + continue; + } + + const ModelObject *object = m_model->objects[obj_id]; + if (instance_id < 0 || instance_id >= int(object->instances.size())) { + key << "invalid;"; + continue; + } + + const ModelInstance *instance = object->instances[instance_id]; + key << static_cast(object) << ':' << static_cast(instance) << ':' + << object->volumes.size() << ':' << instance->printable << ':'; + + const Transform3d instance_matrix = instance->get_matrix(); + for (int r = 0; r < int(instance_matrix.matrix().rows()); ++r) + for (int c = 0; c < int(instance_matrix.matrix().cols()); ++c) + key << instance_matrix.matrix()(r, c) << ','; + + for (const ModelVolume *volume : object->volumes) { + key << static_cast(volume) << ':'; + for (const int filament_id : volume->get_extruders()) + key << 'f' << filament_id << ','; + const Transform3d volume_matrix = volume->get_matrix(); + for (int r = 0; r < int(volume_matrix.matrix().rows()); ++r) + for (int c = 0; c < int(volume_matrix.matrix().cols()); ++c) + key << volume_matrix.matrix()(r, c) << ','; + } + key << ';'; + } + } + + return key.str(); +} + +void PartPlate::update_exclusion_volume_preview_models() +{ + if (!m_exclusion_volume_preview_dirty) + return; + m_exclusion_volume_preview_dirty = false; + + const DynamicPrintConfig *config = m_plater != nullptr ? m_plater->config() : nullptr; + if (config == nullptr) { + m_exclusion_volume_preview_cache_key.clear(); + m_exclusion_volume_floor_triangles.reset(); + m_exclusion_volume_border_triangles.reset(); + m_extruder_exclusion_volume_borders.clear(); + m_active_exclusion_volume_prisms.reset(); + m_exclusion_volume_intersection_triangles.reset(); + m_exclusion_volume_intersections_cleared = false; + return; + } + + const std::vector> regions_by_extruder = get_bed_excluded_regions_by_extruder(*config); + std::vector regions; + const BedExcludeVolumeMode mode = active_bed_exclude_volume_mode(*config); + for (size_t extruder_id = 0; extruder_id < regions_by_extruder.size(); ++extruder_id) { + if (mode == BedExcludeVolumeMode::Shared && extruder_id > 0) + break; + for (const BedExcludeRegion ®ion : regions_by_extruder[extruder_id]) { + if (!region.is_collision_volume() && extruder_id > 0) + continue; + regions.emplace_back(region); + } + } + // A coloured border communicates which physical nozzle owns a footprint. + // With only one nozzle the exclusion applies to every filament, so using + // the first filament colour would incorrectly imply material ownership. + const bool show_nozzle_ownership = + regions_by_extruder.size() > 1 && mode != BedExcludeVolumeMode::Shared; + std::ostringstream grouped_key; + const bool show_all_volumes = m_plater->are_collision_volumes_shown(); + grouped_key << exclusion_volume_preview_cache_key(regions) << "mode:" << int(mode) + << ";show_all:" << show_all_volumes << ";groups:"; + for (const std::vector &group : regions_by_extruder) + grouped_key << group.size() << ','; + const std::vector filament_colors = m_plater->get_extruder_colors_from_plater_config(); + std::vector preview_colors(regions_by_extruder.size()); + + // Use the same effective filament-to-nozzle policy as collision checks so + // the coloured border never implies a mapping the validator does not use. + const DynamicPrintConfig &project_config = wxGetApp().preset_bundle->project_config; + const std::vector filament_map = get_effective_exclusion_filament_maps( + project_config, filament_colors.size(), regions_by_extruder.size()); + grouped_key << "map:"; + for (const int extruder_id : filament_map) + grouped_key << extruder_id << ','; + grouped_key << ';'; + grouped_key << "object_maps:"; + if (m_model != nullptr) { + for (const std::pair &object_instance : obj_to_instance_set) { + const int object_id = object_instance.first; + if (object_id < 0 || object_id >= int(m_model->objects.size())) + continue; + grouped_key << object_id << ':'; + for (const auto &[filament_id, extruder_id] : get_object_filament_extruders( + *m_model->objects[object_id], project_config, regions_by_extruder.size())) + grouped_key << filament_id << '>' << extruder_id << ','; + grouped_key << ';'; + } + } + for (size_t filament_id = 0; filament_id < filament_colors.size(); ++filament_id) { + const int mapped_extruder = filament_id < filament_map.size() ? filament_map[filament_id] - 1 : int(filament_id); + if (mapped_extruder >= 0 && size_t(mapped_extruder) < preview_colors.size() && preview_colors[mapped_extruder].empty()) + preview_colors[mapped_extruder] = filament_colors[filament_id]; + } + + if (const ConfigOptionStrings *extruder_colors = config->opt("extruder_colour"); + extruder_colors != nullptr) { + for (size_t extruder_id = 0; extruder_id < preview_colors.size() && extruder_id < extruder_colors->size(); ++extruder_id) + if (preview_colors[extruder_id].empty()) + preview_colors[extruder_id] = extruder_colors->values[extruder_id]; + } + for (const std::string &color : preview_colors) + grouped_key << color << ','; + const std::string cache_key = grouped_key.str(); + if (cache_key == m_exclusion_volume_preview_cache_key && !m_exclusion_volume_intersections_cleared) + return; + m_exclusion_volume_preview_cache_key = cache_key; + m_exclusion_volume_intersections_cleared = false; + + m_exclusion_volume_floor_triangles.reset(); + m_exclusion_volume_border_triangles.reset(); + m_extruder_exclusion_volume_borders.clear(); + m_active_exclusion_volume_prisms.reset(); + m_exclusion_volume_intersection_triangles.reset(); + + const Point plate_offset(scale_(m_origin.x()), scale_(m_origin.y())); + Polygons floor_regions; + ExPolygons border_regions; + const coord_t ribbon_width = scale_(1.6); + struct PreviewRegion { + BedExcludeRegion region; + Polygon footprint; + size_t extruder_id; + }; + std::vector preview_regions; + Polygons preview_footprints; + std::vector active_prisms; + + if (show_nozzle_ownership) { + static const std::array fallback_colors = { + ColorRGBA{ .18f, .52f, .95f, .92f }, ColorRGBA{ .95f, .35f, .22f, .92f }, + ColorRGBA{ .25f, .72f, .38f, .92f }, ColorRGBA{ .72f, .34f, .88f, .92f }, + ColorRGBA{ .95f, .68f, .16f, .92f }, ColorRGBA{ .18f, .76f, .78f, .92f } + }; + const coord_t tool_border_width = scale_(0.55); + for (size_t extruder_id = 0; extruder_id < regions_by_extruder.size(); ++extruder_id) { + ColorRGBA color = fallback_colors[extruder_id % fallback_colors.size()]; + if (extruder_id < preview_colors.size()) { + ColorRGBA decoded; + if (decode_color(preview_colors[extruder_id], decoded)) { + color = decoded; + color.a(0.92f); + } + } + + for (const BedExcludeRegion ®ion_src : regions_by_extruder[extruder_id]) { + if (!region_src.is_collision_volume()) + continue; + Polygon footprint = region_src.polygon; + footprint.translate(plate_offset); + footprint.make_counter_clockwise(); + const Polygons inner = offset(Polygons{ footprint }, -tool_border_width, jtMiter, 2.0); + const ExPolygons border = inner.empty() ? ExPolygons{ expolygon_from_polygon(footprint) } : diff_ex(Polygons{ footprint }, inner); + auto model = std::make_unique(); + // Nozzle colours identify the bed footprint, not the volume's + // vertical position, so keep this border with the grey preview. + const float border_z = GROUND_Z + 0.026f; + if (init_model_from_expolygons(*model, border, border_z) && model->is_initialized()) + m_extruder_exclusion_volume_borders.emplace_back(std::move(model), color); + } + } + } + + for (size_t extruder_id = 0; extruder_id < regions_by_extruder.size(); ++extruder_id) { + // Shared regions are identical for every nozzle. Keeping one copy + // avoids duplicate floor, prism and intersection geometry. + if (mode == BedExcludeVolumeMode::Shared && extruder_id > 0) + break; + + for (const BedExcludeRegion ®ion_src : regions_by_extruder[extruder_id]) { + // The legacy area is shared and bed-fixed, even when nozzle-specific + // collision volumes are active. Keep only one preview copy. + if (!region_src.is_collision_volume() && extruder_id > 0) + continue; + Polygon region = region_src.polygon; + region.translate(plate_offset); + region.make_counter_clockwise(); + BedExcludeRegion translated_region = region_src; + translated_region.polygon = region; + preview_regions.push_back({ std::move(translated_region), region, extruder_id }); + preview_footprints.emplace_back(region); + + // Legacy polygons continue to use Orca's existing grey bed preview; + // the additional floor/ribbon belongs only to collision volumes. + if (region_src.is_collision_volume()) { + if (!region_src.has_z_range || region_src.z_min <= EPSILON) { + floor_regions.emplace_back(region); + } else { + const Polygons inner = offset(Polygons{ region }, -ribbon_width, jtMiter, 2.0); + ExPolygons border = inner.empty() ? ExPolygons{ expolygon_from_polygon(region) } : diff_ex(Polygons{ region }, inner); + border_regions.insert(border_regions.end(), border.begin(), border.end()); + } + } + } + } + + // Automatic previews stay limited to nearby objects. The View toggle lets + // profile authors inspect the complete configured height on an empty bed. + const double preview_height = show_all_volumes ? 0.0 : + max_broad_phase_intersecting_object_height(preview_footprints); + if (show_all_volumes || preview_height > EPSILON) { + for (const PreviewRegion &preview_region : preview_regions) { + const BedExcludeRegion ®ion_src = preview_region.region; + if (!region_src.is_collision_volume()) + continue; + const double z_min = region_src.has_z_range ? region_src.z_min : 0.0; + const double z_max = show_all_volumes ? region_src.z_max : std::min(region_src.z_max, preview_height); + if (z_max > z_min + EPSILON) + active_prisms.push_back({ preview_region.footprint, z_min, z_max }); + } + } + + indexed_triangle_set intersection_triangles; + if (m_model != nullptr && !preview_regions.empty()) { + for (const std::pair &object_instance : obj_to_instance_set) { + const int obj_id = object_instance.first; + const int instance_id = object_instance.second; + if (obj_id < 0 || obj_id >= int(m_model->objects.size())) + continue; + + ModelObject *object = m_model->objects[obj_id]; + if (instance_id < 0 || instance_id >= int(object->instances.size())) + continue; + + ModelInstance *instance = object->instances[instance_id]; + if (!instance->printable) + continue; + + std::set relevant_extruders; + if (mode != BedExcludeVolumeMode::Shared) { + for (const auto &mapping : get_object_filament_extruders( + *object, project_config, regions_by_extruder.size())) + relevant_extruders.emplace(mapping.second); + } + + Polygon hull = instance->convex_hull_2d(); + const BoundingBoxf3 instance_box = object->instance_convex_hull_bounding_box(instance_id); + for (const PreviewRegion &preview_region : preview_regions) { + if (preview_region.region.is_collision_volume() && mode != BedExcludeVolumeMode::Shared && + relevant_extruders.find(preview_region.extruder_id) == relevant_extruders.end()) + continue; + + const BedExcludeRegion ®ion = preview_region.region; + if (intersection(Polygons{ preview_region.footprint }, Polygons{ hull }).empty()) + continue; + if (instance_box.max.z() < region.z_min || instance_box.min.z() > region.z_max) + continue; + + // The preview path intentionally requests the full clipped mesh. + // Boolean-only placement checks call this without an output mesh. + indexed_triangle_set region_intersections; + if (instance->intersects_bed_exclude_region(region, ®ion_intersections) && !region_intersections.empty()) + its_merge(intersection_triangles, region_intersections); + } + } + } + + if (!floor_regions.empty() && !init_model_from_polygons(m_exclusion_volume_floor_triangles, floor_regions, GROUND_Z + 0.01f)) + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create exclusion volume floor preview triangles\n"; + + if (!border_regions.empty() && !init_model_from_expolygons(m_exclusion_volume_border_triangles, border_regions, GROUND_Z + 0.018f)) + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create exclusion volume preview border\n"; + + if (!active_prisms.empty() && !init_exclusion_volume_prism_model(m_active_exclusion_volume_prisms, active_prisms)) + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create active exclusion volume preview prisms\n"; + + if (!intersection_triangles.empty()) + m_exclusion_volume_intersection_triangles.init_from(intersection_triangles); +} + +void PartPlate::render_exclusion_volume_previews(bool force_default_color) +{ + if (force_default_color) + return; + + update_exclusion_volume_preview_models(); + + const ColorRGBA floor_color = m_selected ? ColorRGBA{ .86f, .86f, .86f, .70f } : ColorRGBA{ .60f, .60f, .60f, .30f }; + const ColorRGBA ribbon_color{ .60f, .60f, .60f, .70f }; + const ColorRGBA prism_color{ .52f, .52f, .52f, .38f }; + + glsafe(::glDepthMask(GL_FALSE)); + + m_exclusion_volume_floor_triangles.set_color(floor_color); + m_exclusion_volume_floor_triangles.render(); + + m_exclusion_volume_border_triangles.set_color(ribbon_color); + m_exclusion_volume_border_triangles.render(); + + for (auto &colored_border : m_extruder_exclusion_volume_borders) { + colored_border.first->set_color(colored_border.second); + colored_border.first->render(); + } + + m_active_exclusion_volume_prisms.set_color(prism_color); + m_active_exclusion_volume_prisms.render(); + + glsafe(::glLineWidth(1.0f * m_scale_factor)); + glsafe(::glDepthMask(GL_TRUE)); +} + +void PartPlate::render_exclusion_volume_intersections() +{ + if (!m_exclusion_volume_intersection_triangles.is_initialized()) + return; + + const ColorRGBA intersection_color{ .68f, .02f, .02f, .58f }; + + glsafe(::glEnable(GL_POLYGON_OFFSET_FILL)); + glsafe(::glPolygonOffset(-1.0f, -1.0f)); + + m_exclusion_volume_intersection_triangles.set_color(intersection_color); + m_exclusion_volume_intersection_triangles.render(); + + glsafe(::glDisable(GL_POLYGON_OFFSET_FILL)); +} + +void PartPlate::clear_exclusion_volume_intersections() +{ + m_exclusion_volume_intersection_triangles.reset(); + m_exclusion_volume_intersections_cleared = true; +} + +void PartPlate::invalidate_exclusion_volume_preview() +{ + m_exclusion_volume_preview_dirty = true; +} + + /*void PartPlate::render_background_for_picking(const ColorRGBA render_color) const { unsigned int triangles_vcount = m_triangles.get_vertices_count(); @@ -2992,6 +3536,122 @@ int PartPlate::get_logical_extruder_by_filament_id(const DynamicConfig& g_config return filament_map[idx - 1] - 1; } +std::vector PartPlate::get_effective_exclusion_filament_maps( + const DynamicConfig &g_config, const size_t filament_count, const size_t extruder_count) const +{ + std::vector result(filament_count, 0); + if (extruder_count == 0) + return result; + + const std::vector configured_map = get_real_filament_maps(g_config); + const FilamentMapMode map_mode = get_real_filament_map_mode(g_config); + PresetBundle *preset_bundle = wxGetApp().preset_bundle; + const bool is_bambu = preset_bundle != nullptr && preset_bundle->is_bbl_vendor(); + const bool automatic = is_auto_filament_map_mode(map_mode); + const bool automatic_map_resolved = !automatic || !get_filament_maps().empty(); + for (size_t filament_id = 0; filament_id < filament_count; ++filament_id) { + const int extruder_id = bed_exclusion_extruder_for_filament( + filament_id, configured_map, map_mode, is_bambu, automatic_map_resolved, extruder_count); + if (extruder_id >= 0) + result[filament_id] = extruder_id + 1; + } + return result; +} + +std::map PartPlate::get_object_filament_extruders( + const ModelObject &object, const DynamicConfig &g_config, const size_t extruder_count) const +{ + std::set filament_ids; + const DynamicPrintConfig &process_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; + const auto effective_option = [&object, &process_config](const char *key) -> const ConfigOption * { + if (const ConfigOption *option = object.config.option(key); option != nullptr) + return option; + return process_config.option(key); + }; + const auto effective_int = [&effective_option](const char *key) { + const ConfigOption *option = effective_option(key); + return option != nullptr ? option->getInt() : 0; + }; + const auto effective_float = [&effective_option](const char *key) { + const ConfigOption *option = effective_option(key); + return option != nullptr ? option->getFloat() : 0.0; + }; + const auto effective_bool = [&effective_option](const char *key) { + const ConfigOption *option = effective_option(key); + return option != nullptr && option->getBool(); + }; + + const bool has_brim = effective_int("brim_type") != int(BrimType::btNoBrim) && effective_float("brim_width") > 0.0; + const int wall_loops = effective_int("wall_loops"); + const double sparse_infill_density = effective_float("sparse_infill_density"); + const int top_shell_layers = effective_int("top_shell_layers"); + const int bottom_shell_layers = effective_int("bottom_shell_layers"); + const std::array, 6> feature_filament_keys = { + std::pair{ "outer_wall_filament_id", wall_loops > 0 || has_brim }, + std::pair{ "inner_wall_filament_id", wall_loops > 1 }, + std::pair{ "sparse_infill_filament_id", sparse_infill_density > 0.0 }, + std::pair{ "internal_solid_filament_id", sparse_infill_density > 0.0 || top_shell_layers > 0 || bottom_shell_layers > 0 }, + std::pair{ "top_surface_filament_id", top_shell_layers > 0 }, + std::pair{ "bottom_surface_filament_id", bottom_shell_layers > 0 } + }; + auto collect_config_filaments = [&filament_ids, &feature_filament_keys](const DynamicConfig &config) { + for (const auto &[key, active] : feature_filament_keys) { + if (active) { + if (const ConfigOption *option = config.option(key); option != nullptr && option->getInt() > 0) + filament_ids.emplace(option->getInt()); + } + } + if (const ConfigOption *option = config.option("extruder"); option != nullptr && option->getInt() > 0) + filament_ids.emplace(option->getInt()); + }; + + for (const ModelVolume *volume : object.volumes) { + const std::vector volume_filaments = volume->get_extruders(); + filament_ids.insert(volume_filaments.begin(), volume_filaments.end()); + collect_config_filaments(volume->config.get()); + } + collect_config_filaments(object.config.get()); + for (const auto &layer_range : object.layer_config_ranges) + collect_config_filaments(layer_range.second.get()); + + // Process-level feature assignments also apply when the object has no + // override. This mirrors the relevant parts of PrintObject::printing_extruders() + // closely enough for an unsliced placement preview. + for (const auto &[key, active] : feature_filament_keys) { + if (active && !object.config.has(key) && process_config.has(key) && process_config.opt_int(key) > 0) + filament_ids.emplace(process_config.opt_int(key)); + } + + const bool has_support = effective_bool("enable_support") || effective_int("raft_layers") > 0; + if (has_support) { + const int support_filament = effective_int("support_filament"); + const int interface_filament = effective_int("support_interface_filament"); + if (support_filament > 0) + filament_ids.emplace(support_filament); + if (interface_filament > 0) + filament_ids.emplace(interface_filament); + } + + // Match Orca's normal fallback for an unassigned object. + if (filament_ids.empty()) + filament_ids.emplace(1); + + const size_t required_filament_count = filament_ids.empty() ? 0 : size_t(*filament_ids.rbegin()); + const std::vector filament_map = get_effective_exclusion_filament_maps( + g_config, required_filament_count, extruder_count); + std::map result; + for (const int filament_id : filament_ids) { + if (filament_id <= 0) + continue; + + const int mapped_extruder = size_t(filament_id) <= filament_map.size() && filament_map[filament_id - 1] > 0 ? + filament_map[filament_id - 1] - 1 : -1; + if (mapped_extruder >= 0 && size_t(mapped_extruder) < extruder_count) + result.emplace(filament_id, size_t(mapped_extruder)); + } + return result; +} + std::vector PartPlate::get_used_filaments() { std::vector used_filaments; @@ -3372,7 +4032,37 @@ WipeTowerFootprint PartPlate::estimate_wipe_tower_footprint(const DynamicPrintCo return Slic3r::estimate_wipe_tower_footprint(config, resolve_wipe_tower_type(config), filament_ids, layer_height, max_height); } -arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const DynamicPrintConfig& config, int plate_index, Vec3d& wt_pos, Vec3d& wt_size, int plate_extruder_size, bool use_global_objects) const +Polygons PartPlate::wipe_tower_obstacles(const DynamicPrintConfig &config) const +{ + Polygons obstacles; + for (const auto &[obj_id, instance_id] : obj_to_instance_set) { + if (!valid_instance(obj_id, instance_id)) + continue; + const ModelObject *object = m_model->objects[obj_id]; + const ModelInstance *instance = object->instances[instance_id]; + if (!instance->printable) + continue; + // A sinking object counts its whole outline, the part below the bed included. + Polygon hull = object->convex_hull_2d(instance->get_matrix()); + if (hull.size() < 3) + continue; + hull.translate(-scaled(m_origin.x()), -scaled(m_origin.y())); + // An object's own setting wins over the print preset's. + auto option_of = [&object, &config](const char *key) { + const ConfigOption *opt = object->config.option(key); + return opt != nullptr ? opt : config.option(key); + }; + // An auto brim is only sized while slicing, so it is taken at the brim width option too. + const ConfigOption *brim_type = option_of("brim_type"); + const ConfigOption *brim_width = option_of("brim_width"); + const double brim = brim_type != nullptr && brim_width != nullptr && brim_type->getInt() != static_cast(btNoBrim) ? brim_width->getFloat() : 0.; + append(obstacles, offset(hull, static_cast(scaled(brim + WIPE_TOWER_MARGIN)))); + } + return obstacles; +} + +arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const DynamicPrintConfig& config, int plate_index, Vec3d& wt_pos, Vec3d& wt_size, int plate_extruder_size, bool use_global_objects, + WipeTowerRelocation *relocation) const { float x = dynamic_cast(config.option("wipe_tower_x"))->get_at(plate_index); float y = dynamic_cast(config.option("wipe_tower_y"))->get_at(plate_index); @@ -3405,10 +4095,40 @@ arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const Dynamic // mesh, a couple of mm inside this reserved estimate), so a drop can land slightly out // of bounds — snap it onto the bound; only far-out positions get the comfort re-place. const float tol = 5.f; - if (x < margin - tol || x > x_hi + tol) x = std::clamp(x, x_lo_c, x_hi_c); - else x = std::clamp(x, margin, x_hi); - if (y < margin - tol || y > y_hi + tol) y = std::clamp(y, y_lo_c, y_hi_c); - else y = std::clamp(y, margin, y_hi); + const float saved_x = x, saved_y = y; + const bool replace_x = x < margin - tol || x > x_hi + tol; + const bool replace_y = y < margin - tol || y > y_hi + tol; + x = replace_x ? std::clamp(x, x_lo_c, x_hi_c) : std::clamp(x, margin, x_hi); + y = replace_y ? std::clamp(y, y_lo_c, y_hi_c) : std::clamp(y, margin, y_hi); + if (relocation != nullptr && (replace_x || replace_y)) { + relocation->moved = true; + // The footprint keeps clear of every object and its brim, and turns about its anchor + // as the tower does. + Polygon tower({ {scaled(-wp_brim_width), scaled(-wp_brim_width)}, + {scaled(w + wp_brim_width), scaled(-wp_brim_width)}, + {scaled(w + wp_brim_width), scaled(depth + wp_brim_width)}, + {scaled(-wp_brim_width), scaled(depth + wp_brim_width)} }); + if (const auto *rotation = config.option("wipe_tower_rotation_angle"); rotation != nullptr && rotation->value != 0.) + tower.rotate(Geometry::deg2rad(rotation->value)); + const Polygons objects = wipe_tower_obstacles(config); + const Point placed(scaled(x), scaled(y)); + // The re-placed spot stands when it is clear. Otherwise take the clear spot nearest the + // saved position, keeping the comfort margin where the plate leaves room for it. + if (!nearest_clear_wipe_tower_anchor(BoundingBox(placed, placed), tower, objects, placed)) { + const Point saved(scaled(saved_x), scaled(saved_y)); + std::optional clear = nearest_clear_wipe_tower_anchor( + BoundingBox(Point(scaled(x_lo_c), scaled(y_lo_c)), Point(scaled(x_hi_c), scaled(y_hi_c))), tower, objects, saved); + if (!clear) + clear = nearest_clear_wipe_tower_anchor(BoundingBox(Point(scaled(margin), scaled(margin)), Point(scaled(x_hi), scaled(y_hi))), + tower, objects, saved); + if (clear) { + x = static_cast(unscaled(clear->x())); + y = static_cast(unscaled(clear->y())); + } else { + relocation->overlaps_objects = true; + } + } + } wt_pos(0) = x; wt_pos(1) = y; wt_pos(2) = 0.f; @@ -3453,6 +4173,7 @@ void PartPlate::clear(bool clear_sliced_result) { obj_to_instance_set.clear(); instance_outside_set.clear(); + invalidate_exclusion_volume_preview(); if (clear_sliced_result) { m_ready_for_slice = true; update_slice_result_valid_state(false); @@ -3532,6 +4253,7 @@ void PartPlate::set_pos_and_size(Vec3d& origin, int width, int depth, double hei m_width = width; m_depth = depth; m_height = height; + invalidate_exclusion_volume_preview(); if (with_instance_move && m_plater) m_plater->mark_plate_toolbar_image_dirty(); @@ -3661,6 +4383,7 @@ void PartPlate::set_print(PrintBase* print, GCodeResult* result, int index) m_print_index = index; m_print->set_plate_origin(m_origin); + invalidate_exclusion_volume_preview(); return; } @@ -3781,7 +4504,14 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi ModelInstance* instance = object->instances[instance_id]; BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id); - Polygon hull = instance->convex_hull_2d(); + // Reuse the hull across exclusion and IMEX checks, but do not build it for + // instances rejected by the plate bounds or printers with no relevant zones. + std::optional instance_hull; + const auto get_instance_hull = [&]() -> const Polygon & { + if (!instance_hull) + instance_hull = instance->convex_hull_2d(); + return *instance_hull; + }; BoundingBoxf3 plate_box = get_plate_box(); this->open_belt_y(plate_box); if (instance_box.max.z() > plate_box.min.z()) @@ -3800,34 +4530,66 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi else if (plate_box.contains(instance_box)) { - if (m_exclude_bounding_box.size() > 0) - { - Polygon hull = instance->convex_hull_2d(); - int index; - for (index = 0; index < m_exclude_bounding_box.size(); index ++) - { - Polygon p = m_exclude_bounding_box[index].polygon(true); // instance convex hull is scaled, so we need to scale here - if (intersection({ p }, { hull }).empty() == false) - //if (m_exclude_bounding_box[index].intersects(instance_box)) - { - break; - } - } - if (index >= m_exclude_bounding_box.size()) - outside = false; - } - else - outside = false; + outside = false; + const DynamicPrintConfig *config = m_plater != nullptr ? m_plater->config() : nullptr; + bool checked_config_regions = false; + if (config != nullptr) { + const std::vector> regions_by_extruder = + get_bed_excluded_regions_by_extruder(*config); + const BedExcludeVolumeMode mode = active_bed_exclude_volume_mode(*config); + // The legacy outside flag has no filament/nozzle context. Always + // check the shared legacy area here, but let the newer per-extruder + // pipeline handle nozzle-specific collision volumes. + const Point plate_offset(scale_(m_origin.x()), scale_(m_origin.y())); + const Polygon &hull = get_instance_hull(); + + const size_t groups_to_check = regions_by_extruder.empty() ? 0 : 1; + for (size_t group_id = 0; group_id < groups_to_check; ++group_id) { + const std::vector &extruder_regions = regions_by_extruder[group_id]; + for (const BedExcludeRegion ®ion_src : extruder_regions) { + if (mode != BedExcludeVolumeMode::Shared && region_src.is_collision_volume()) + continue; + checked_config_regions = true; + Polygon region = region_src.polygon; + region.translate(plate_offset); + region.make_counter_clockwise(); + + if (intersection(Polygons{ region }, Polygons{ hull }).empty()) + continue; + + if (instance_box.max.z() < region_src.z_min || instance_box.min.z() > region_src.z_max) + continue; + + BedExcludeRegion translated_region = region_src; + translated_region.polygon = std::move(region); + if (instance->intersects_bed_exclude_region(translated_region)) { + outside = true; + break; + } + } + if (outside) + break; + } + } + + if (!checked_config_regions && m_exclude_bounding_box.size() > 0) { + const Polygon &hull = get_instance_hull(); + for (const BoundingBoxf3 &exclude_box : m_exclude_bounding_box) { + Polygon p = exclude_box.polygon(true); // instance convex hull is scaled, so we need to scale here + if (!intersection({ p }, { hull }).empty()) { + outside = true; + break; + } + } + } } // IDEX/IQEX placement check (prepare-mode bounding-box test). // Block objects that overlap secondary (copy/mirror) zones or the carriage // danger strip at the primary zone boundary. Reuses the existing // outside=true → instance_outside_set → update_states() → blocks slicing path. - // Reuse the hull computed above: ModelInstance::convex_hull_2d() is NOT cached - // (Model.cpp has the validity guard commented out), so recomputing it here would - // cost every user a per-instance hull rebuild, including on non-IMEX printers. - if (!outside && imex_hull_violates(hull)) + if (!outside && (!m_imex_secondary_zone_boxes.empty() || !m_imex_collision_zones.empty()) && + imex_hull_violates(get_instance_hull())) outside = true; return outside; @@ -3893,6 +4655,7 @@ int PartPlate::add_instance(int obj_id, int instance_id, bool move_position, Bou std::pair pair(obj_id, instance_id); obj_to_instance_set.insert(pair); + invalidate_exclusion_volume_preview(); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": plate_id %1%, add instance obj_id %2%, instance_id %3%, move_position %4%") % m_plate_index % obj_id % instance_id % move_position; @@ -3935,6 +4698,7 @@ int PartPlate::remove_instance(int obj_id, int instance_id) it = obj_to_instance_set.find(std::pair(obj_id, instance_id)); if (it != obj_to_instance_set.end()) { obj_to_instance_set.erase(it); + invalidate_exclusion_volume_preview(); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":plate_id %1%, found obj_id %2%, instance_id %3%") % m_plate_index % obj_id % instance_id; result = 0; } @@ -3994,6 +4758,7 @@ void PartPlate::translate_all_instance(Vec3d position) } } } + invalidate_exclusion_volume_preview(); return; } @@ -4028,6 +4793,7 @@ void PartPlate::duplicate_all_instance(unsigned int dup_count, bool need_skip, s for ( size_t new_instance_id = 0; new_instance_id < newObj->instances.size(); new_instance_id++ ) { obj_to_instance_set.emplace(std::pair(new_obj_id, new_instance_id)); + invalidate_exclusion_volume_preview(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": duplicate object into plate: index_pair [%1%,%2%], obj_id %3%") % new_obj_id % new_instance_id % newObj->id().id; } } @@ -4071,6 +4837,7 @@ void PartPlate::update_instance_exclude_status(int obj_id, int instance_id, Boun std::set>::iterator it; outside = check_outside(obj_id, instance_id, bounding_box); + invalidate_exclusion_volume_preview(); it = instance_outside_set.find(std::pair(obj_id, instance_id)); if (it == instance_outside_set.end()) { @@ -4098,6 +4865,7 @@ void PartPlate::update_object_index(int obj_idx_removed, int obj_idx_max) } obj_to_instance_set.clear(); obj_to_instance_set = temp_set; + invalidate_exclusion_volume_preview(); //update the instance_outside_set temp_set.clear(); @@ -4353,6 +5121,8 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon) bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, const std::vector& extruder_heights, Vec2d position, float height_to_lid, float height_to_rod) { + invalidate_exclusion_volume_preview(); + Pointfs new_shape, new_exclude_areas; m_extruder_heights = extruder_heights; for (const Vec2d& p : shape) { @@ -4573,6 +5343,7 @@ void PartPlate::render(const Transform3d& view_matrix, const Transform3d& projec } render_wrapping_detection_area(force_background_color); } + render_exclusion_volume_previews(force_background_color); } render_height_limit(mode); @@ -5013,6 +5784,7 @@ void PartPlate::set_filament_map_mode(const FilamentMapMode& mode) clear_filament_map_mode(); else m_config.option>("filament_map_mode", true)->value = mode; + invalidate_exclusion_volume_preview(); } std::vector PartPlate::get_filament_maps() const @@ -5027,12 +5799,14 @@ std::vector PartPlate::get_filament_maps() const void PartPlate::set_filament_maps(const std::vector& f_maps) { m_config.option("filament_map", true)->values = f_maps; + invalidate_exclusion_volume_preview(); } void PartPlate::clear_filament_map() { if (m_config.has("filament_map")) m_config.erase("filament_map"); + invalidate_exclusion_volume_preview(); } std::vector PartPlate::get_filament_volume_maps() const @@ -5750,6 +6524,39 @@ void PartPlateList::update_plates() set_shapes(m_shape, m_exclude_areas, m_wrapping_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); } +void PartPlateList::invalidate_exclusion_volume_previews() +{ + for (PartPlate *plate : m_plate_list) + if (plate != nullptr) + plate->invalidate_exclusion_volume_preview(); +} + +void PartPlateList::render_exclusion_volume_intersections( + const Transform3d &view_matrix, + const Transform3d &projection_matrix) +{ + GLShaderProgram *shader = wxGetApp().get_shader("flat"); + if (shader == nullptr) + return; + + shader->start_using(); + shader->set_uniform("view_model_matrix", view_matrix); + shader->set_uniform("projection_matrix", projection_matrix); + + glsafe(::glEnable(GL_DEPTH_TEST)); + glsafe(::glEnable(GL_BLEND)); + glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + glsafe(::glDepthMask(GL_FALSE)); + + for (PartPlate *plate : m_plate_list) + if (plate != nullptr) + plate->render_exclusion_volume_intersections(); + + glsafe(::glDepthMask(GL_TRUE)); + glsafe(::glDisable(GL_BLEND)); + shader->stop_using(); +} + int PartPlateList::create_plate(bool adjust_position) { PartPlate* plate = NULL; @@ -5858,6 +6665,7 @@ int PartPlateList::duplicate_plate(int index) // go over the instances and pair with the object for (size_t new_instance_id = 0; new_instance_id < object_copy->instances.size(); new_instance_id++){ new_plate->obj_to_instance_set.emplace(std::pair(new_obj_id, new_instance_id)); + new_plate->invalidate_exclusion_volume_preview(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": duplicate object into plate: index_pair [%1%,%2%], obj_id %3%") % new_obj_id % new_instance_id % object_copy->id().id; } } @@ -6843,7 +7651,8 @@ bool PartPlateList::preprocess_arrange_polygon_other_locked(int obj_index, int i return locked; } -bool PartPlateList::preprocess_exclude_areas(arrangement::ArrangePolygons &unselected, bool enable_wrapping_detect, int num_plates, float inflation) +bool PartPlateList::preprocess_exclude_areas(arrangement::ArrangePolygons &unselected, const DynamicPrintConfig &config, + bool enable_wrapping_detect, int num_plates, float inflation) { bool added = false; @@ -6875,10 +7684,47 @@ bool PartPlateList::preprocess_exclude_areas(arrangement::ArrangePolygons &unsel } added = true; } + const BedExcludeVolumeMode mode = active_bed_exclude_volume_mode(config); + const bool use_resolved_regions = has_bed_exclude_volumes(config); - // excluded area - if (m_exclude_areas.size() > 0) - { + if (use_resolved_regions) { + const std::vector> regions_by_extruder = + get_bed_excluded_regions_by_extruder(config); + const size_t extruder_count = mode == BedExcludeVolumeMode::Shared ? + std::min(1, regions_by_extruder.size()) : regions_by_extruder.size(); + + for (size_t extruder_id = 0; extruder_id < extruder_count; ++extruder_id) { + for (size_t region_id = 0; region_id < regions_by_extruder[extruder_id].size(); ++region_id) { + const BedExcludeRegion ®ion = regions_by_extruder[extruder_id][region_id]; + if (!region.is_collision_volume() || region.polygon.points.size() < 3 || + (region.has_z_range && region.z_max <= region.z_min + EPSILON)) + continue; + + for (int plate_idx = 0; plate_idx < num_plates; ++plate_idx) { + arrangement::ArrangePolygon blocker; + blocker.poly.contour = bed_exclusion_arrange_polygon(region.polygon); + blocker.translation = Vec2crd::Zero(); + blocker.rotation = 0.0; + blocker.is_virt_object = true; + blocker.is_bed_exclusion = true; + blocker.bed_exclusion_extruder_id = mode == BedExcludeVolumeMode::Shared ? -1 : int(extruder_id); + blocker.bed_idx = plate_idx; + blocker.height = std::max(0.0, region.z_max - region.z_min); + blocker.z_min = region.z_min; + blocker.z_max = region.z_max; + blocker.has_z_range = region.has_z_range; + blocker.name = "BedExclusionVolume" + std::to_string(extruder_id) + "_" + std::to_string(region_id); + blocker.inflation = inflation; + unselected.emplace_back(std::move(blocker)); + } + added = true; + } + } + } + + // Keep Orca's established legacy-area arrange obstacle alongside any + // explicit collision-volume blockers. The two settings are additive. + if (!m_exclude_areas.empty()) { //has exclude areas PartPlate *plate = m_plate_list[0]; @@ -7048,19 +7894,14 @@ void PartPlateList::postprocess_arrange_polygon(arrangement::ArrangePolygon& arr { BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": bed_idx %1%, selected %2%, translation(x) %3%, (y) %4%") % arrange_polygon.bed_idx % selected % unscale(arrange_polygon.translation(X)) % unscale(arrange_polygon.translation(Y)); + // UNARRANGED means the item could not be placed, so it has no bed to map onto and + // must be left where the user had it. Moving it to a virtual bed here would shift + // it off the plate, because no such plate is created for it afterwards. + if (arrange_polygon.bed_idx == arrangement::UNARRANGED) + return; + if ((selected) || (arrange_polygon.bed_idx != PartPlateList::MAX_PLATES_COUNT)) { - if (arrange_polygon.bed_idx == -1) - { - // outarea for large object - arrange_polygon.bed_idx = m_plate_list.size(); - BoundingBox apbox = get_extents(arrange_polygon.transformed_poly()); // the item may have been rotated - auto apbox_size = apbox.size(); - - arrange_polygon.translation(X) = 0.5 * apbox_size[0]; - arrange_polygon.translation(Y) = scaled(static_cast(m_plate_depth)) - 0.5 * apbox_size[1]; - } - arrange_polygon.row = arrange_polygon.bed_idx / m_plate_cols; arrange_polygon.col = arrange_polygon.bed_idx % m_plate_cols; arrange_polygon.translation(X) += scaled(plate_stride_x() * arrange_polygon.col); diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index ac7a9db0b6..d90e6f2767 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -19,11 +19,14 @@ #include #include #include +#include #include +#include #include #include #include #include +#include #include #include "libslic3r/ObjectID.hpp" @@ -94,6 +97,13 @@ class PartPlateList; using GCodeResult = GCodeProcessorResult; +// What estimate_wipe_tower_polygon did to a saved tower position that no longer fits the plate. +struct WipeTowerRelocation +{ + bool moved = false; // re-placed, not just snapped onto the bound it was dropped past + bool overlaps_objects = false; // no spot on the plate was clear of the objects, so it sits on one +}; + class PartPlate : public ObjectBase { public: @@ -152,6 +162,14 @@ private: PickingModel m_triangles; GLModel m_exclude_triangles; GLModel m_wrapping_detection_triangles; + GLModel m_exclusion_volume_floor_triangles; + GLModel m_exclusion_volume_border_triangles; + std::vector, ColorRGBA>> m_extruder_exclusion_volume_borders; + GLModel m_active_exclusion_volume_prisms; + GLModel m_exclusion_volume_intersection_triangles; + std::string m_exclusion_volume_preview_cache_key; + bool m_exclusion_volume_preview_dirty { true }; + bool m_exclusion_volume_intersections_cleared { false }; GLModel m_logo_triangles; GLModel m_gridlines; GLModel m_gridlines_bolder; @@ -234,6 +252,11 @@ private: void render_logo(bool bottom, bool render_cali = true); void render_logo_texture(GLTexture &logo_texture, GLModel &logo_buffer, bool bottom); void render_exclude_area(bool force_default_color); + void render_exclusion_volume_previews(bool force_default_color); + void render_exclusion_volume_intersections(); + void update_exclusion_volume_preview_models(); + std::string exclusion_volume_preview_cache_key(const std::vector ®ions) const; + double max_broad_phase_intersecting_object_height(const Polygons& regions) const; //void render_background_for_picking(const ColorRGBA render_color) const; void render_grid(bool bottom); void render_wrapping_detection_area(bool force_default_color); @@ -254,6 +277,9 @@ private: int picking_id_component(int idx) const; void on_filament_map_mode_change(); + // What a re-placed tower keeps clear of: each printable instance's convex hull, grown by its + // brim and the tower margin, in plate coordinates. + Polygons wipe_tower_obstacles(const DynamicPrintConfig &config) const; public: static constexpr unsigned int PLATE_NAME_HOVER_ID = 6; @@ -457,7 +483,10 @@ public: // use_global_objects skips the containment test, which the CLI needs before objects are // assigned to plates - the layer height is then the project's thinnest, which over-reserves. WipeTowerFootprint estimate_wipe_tower_footprint(const DynamicPrintConfig & config, int plate_extruder_size = 0, bool use_global_objects = false) const; - arrangement::ArrangePolygon estimate_wipe_tower_polygon(const DynamicPrintConfig & config, int plate_index, Vec3d& wt_pos, Vec3d& wt_size, int plate_extruder_size = 0, bool use_global_objects = false) const; + // relocation: callers that store the returned position pass it, so a re-placed tower is + // moved clear of the plate's objects where there is room, and they are told it moved. + arrangement::ArrangePolygon estimate_wipe_tower_polygon(const DynamicPrintConfig & config, int plate_index, Vec3d& wt_pos, Vec3d& wt_size, int plate_extruder_size = 0, bool use_global_objects = false, + WipeTowerRelocation *relocation = nullptr) const; bool check_objects_empty_and_gcode3mf(std::vector &result) const; // get used filaments from config, 1 based idx // expand_mixed_slots = false keeps mixed filament slots as slots instead of their components. @@ -472,6 +501,16 @@ public: const std::vector& get_slice_filaments_info() const { return slice_filaments_info; } int get_physical_extruder_by_filament_id(const DynamicConfig& g_config, int idx) const; int get_logical_extruder_by_filament_id(const DynamicConfig& g_config, int idx) const; + // Resolve the mapping policy used specifically by exclusion regions. + // Values are 1-based nozzle ids; 0 means automatic Bambu mapping has not + // produced a concrete plate-local assignment yet. + std::vector get_effective_exclusion_filament_maps(const DynamicConfig &g_config, size_t filament_count, + size_t extruder_count) const; + // 1-based filament id -> 0-based nozzle/exclusion-region id for the + // object's current plate mapping. Includes every filament referenced by + // any model volume (including painted facets). + std::map get_object_filament_extruders(const ModelObject &object, const DynamicConfig &g_config, + size_t extruder_count) const; bool check_filament_printable(const DynamicPrintConfig & config, wxString& error_message); bool check_tpu_printable_status(const DynamicPrintConfig & config, const std::vector &tpu_filaments); bool check_mixture_of_pla_and_petg(const DynamicPrintConfig & config); @@ -495,6 +534,8 @@ public: //check whether instance is outside the plate or not bool check_outside(int obj_id, int instance_id, BoundingBoxf3* bounding_box = nullptr); + void clear_exclusion_volume_intersections(); + void invalidate_exclusion_volume_preview(); //judge whether instance is intesected with plate or not bool intersect_instance(int obj_id, int instance_id, BoundingBoxf3* bounding_box = nullptr); @@ -700,6 +741,8 @@ public: for (std::vector>::iterator it = instances_outside.begin(); it != instances_outside.end(); ++it) instance_outside_set.insert(std::pair(it->first, it->second)); + + invalidate_exclusion_volume_preview(); } template void save(Archive& ar) const { std::vector> objects_and_instances; @@ -880,6 +923,8 @@ public: // Pantheon: update plates after moving plate to the front void update_plates(); + void invalidate_exclusion_volume_previews(); + void render_exclusion_volume_intersections(const Transform3d &view_matrix, const Transform3d &projection_matrix); /*basic plate operations*/ //create an empty plate and return its index @@ -996,7 +1041,8 @@ public: //preprocess an arrangement::ArrangePolygon, return true if it is in a locked plate bool preprocess_arrange_polygon(int obj_index, int instance_index, arrangement::ArrangePolygon& arrange_polygon, bool selected); bool preprocess_arrange_polygon_other_locked(int obj_index, int instance_index, arrangement::ArrangePolygon& arrange_polygon, bool selected); - bool preprocess_exclude_areas(arrangement::ArrangePolygons& unselected, bool enable_wrapping_detect, int num_plates = 16, float inflation = 0); + bool preprocess_exclude_areas(arrangement::ArrangePolygons &unselected, const DynamicPrintConfig &config, + bool enable_wrapping_detect, int num_plates = 16, float inflation = 0); bool preprocess_nonprefered_areas(arrangement::ArrangePolygons& regions, int num_plates = 1, float inflation=0); void postprocess_bed_index_for_selected(arrangement::ArrangePolygon& arrange_polygon); diff --git a/src/slic3r/GUI/PartSkipDialog.cpp b/src/slic3r/GUI/PartSkipDialog.cpp index af90584549..f68590976e 100644 --- a/src/slic3r/GUI/PartSkipDialog.cpp +++ b/src/slic3r/GUI/PartSkipDialog.cpp @@ -511,7 +511,7 @@ void PartSkipDialog::fetchUrl(boost::weak_ptr wfs) fs->SetUrl("3"); } }); - }); + }, wxGetApp().get_printer_cloud_provider()); break; } default: break; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index d395fe104c..40dc58850a 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -228,6 +228,7 @@ #include "Jobs/PlaterWorker.hpp" #include "Jobs/BoostThreadWorker.hpp" #include "BackgroundSlicingProcess.hpp" +#include "PostProcessor.hpp" #include "SelectMachine.hpp" #include "SendMultiMachinePage.hpp" #include "SendToPrinter.hpp" @@ -1117,11 +1118,15 @@ void Sidebar::priv::layout_printer(bool isBBL, bool isDual) // ORCA: a non-Bambu printer with several extruders lists one nozzle row per tool; Bambu's own // multi-extruder printers keep the left/right pair above. const bool multi_extruder_rows = !preset_bundle.is_bbl_vendor() && extruder_count > 1; + const auto &diameters = cfg.option("nozzle_diameter")->values; + const bool mixed_diameters = std::any_of(diameters.begin(), diameters.end(), [&diameters](double value) { + return get_diameter_string(value) != get_diameter_string(diameters.front()); + }); // The variant box switches the machine variant. The card below lists the nozzles when there - // are flow variants to choose or several extruders to show; otherwise the box says it all. + // are flow variants to choose or extruders of different diameters; otherwise the box says it all. panel_nozzle_dia->Show(true); - extruder_single_sizer->Show(has_flow_variant || multi_extruder_rows); + extruder_single_sizer->Show(has_flow_variant || (multi_extruder_rows && mixed_diameters)); single_extruder->SetNozzleRowCount(multi_extruder_rows ? size_t(extruder_count) : 1); } else { panel_nozzle_dia->Show(false); @@ -2864,7 +2869,8 @@ Sidebar::Sidebar(Plater *parent) // add printer title scrolled_sizer->Add(p->m_panel_printer_title, 0, wxEXPAND | wxALL, 0); - p->m_panel_printer_title->Bind(wxEVT_LEFT_UP, [this] (auto & e) { + // ORCA Bind with LEFT_DOWN, since closing a dialog over the title bar can send it a stray LEFT_UP + auto toggle_printer_section = ([this] (wxMouseEvent & e) { if (!p || !p->combo_printer || !p->m_text_printer_settings || !p->m_panel_printer_content || !m_scrolled_sizer) return; // ORCA Show printer name on title when its folded to inform user without expanding it again @@ -2875,6 +2881,8 @@ Sidebar::Sidebar(Plater *parent) p->m_panel_printer_separator->Show(isShown); m_scrolled_sizer->Layout(); }); + p->m_panel_printer_title->Bind(wxEVT_LEFT_DOWN , toggle_printer_section); + p->m_panel_printer_title->Bind(wxEVT_LEFT_DCLICK, toggle_printer_section); // ORCA add bottom border for seperation wile sections folded p->m_panel_printer_separator = new wxPanel(p->scrolled, wxID_ANY, wxDefaultPosition, wxSize(-1, FromDIP(2))); // ORCA staticline class not works without string p->m_panel_printer_separator->SetBackgroundColour("#FFFFFF"); @@ -3247,7 +3255,8 @@ Sidebar::Sidebar(Plater *parent) p->m_panel_filament_title = new StaticBox(p->scrolled, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_NONE); p->m_panel_filament_title->SetBackgroundColor(title_bg); p->m_panel_filament_title->SetBackgroundColor2(0xF1F1F1); - p->m_panel_filament_title->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent &e) { + // ORCA Bind with LEFT_DOWN, since closing a dialog over the title bar can send it a stray LEFT_UP + auto toggle_filament_section = ([this](wxMouseEvent &e) { if (!p || !p->m_filament_area_wrapper || !m_scrolled_sizer || !p->m_bpButton_set_filament || !p->m_purge_mode_btn || !p->m_flushing_volume_btn || !p->m_bpButton_add_filament || !ams_btn) return; // ORCA exclude area of del button from titlebar collapse/expand feature to fix undesired collapse when user spams del filament button @@ -3266,6 +3275,8 @@ Sidebar::Sidebar(Plater *parent) CallAfter([this]{update_filaments_counter(true);}); // call after all UI processing done }); + p->m_panel_filament_title->Bind(wxEVT_LEFT_DOWN , toggle_filament_section); + p->m_panel_filament_title->Bind(wxEVT_LEFT_DCLICK, toggle_filament_section); wxBoxSizer* bSizer39; bSizer39 = new wxBoxSizer( wxHORIZONTAL ); @@ -4011,7 +4022,8 @@ void Sidebar::update_presets(Preset::Type preset_type) auto diameters = wxGetApp().preset_bundle->printers.diameters_of_selected_printer(); auto diameter = printer_preset.config.opt_string("printer_variant"); auto extruder_max_nozzle_count = printer_preset.config.option("extruder_max_nozzle_count"); - auto update_extruder_variant = [printer_model, extruders_def, extruders, nozzle_volumes_def, nozzle_volumes, extruder_variants,diameter,extruder_max_nozzle_count](ExtruderGroup & extruder, size_t row, int index) { + const bool has_flow_variant = preset_bundle.support_different_extruders(); + auto update_extruder_variant = [printer_model, extruders_def, extruders, nozzle_volumes_def, nozzle_volumes, extruder_variants,diameter,extruder_max_nozzle_count,has_flow_variant](ExtruderGroup & extruder, size_t row, int index) { ComboBox *combo_flow = extruder.rows[row].flow; combo_flow->Clear(); // A profile may leave the per-extruder lists shorter than the nozzle count (they are @@ -4047,8 +4059,8 @@ void Sidebar::update_presets(Preset::Type preset_type) if (select == -1) select = combo_flow->GetCount() - 1; combo_flow->SetSelection(select); - // No flow variant for this extruder: the diameter keeps the whole row. - combo_flow->Show(combo_flow->GetCount() > 0); + // No flow variant for this printer or extruder: the diameter keeps the whole row. + combo_flow->Show(has_flow_variant && combo_flow->GetCount() > 0); }; auto update_extruder_diameter = [&diameters, &nozzle_diameter, &diameter](int extruder_index,ExtruderGroup & extruder) { @@ -7823,7 +7835,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) , main_frame(main_frame) //BBS: add bed_exclude_area , config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({ - "printable_area", "bed_exclude_area", "wrapping_exclude_area", "extruder_printable_area", "bed_custom_texture", "bed_custom_model", "print_sequence", + "printable_area", "bed_exclude_area", "bed_exclude_volumes", "bed_exclude_volume_mode", "extruder_bed_exclude_volumes", "extruder_offset", + "wrapping_exclude_area", "extruder_printable_area", "bed_custom_texture", "bed_custom_model", "print_sequence", "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", "nozzle_height", "skirt_type", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle", @@ -9275,12 +9288,9 @@ std::vector Plater::priv::load_files(const std::vector& input_ if (config_substitutions.unrecogized_keys.size() > 0) { wxString text = wxString::Format(_L("The 3MF file version %s is newer than %s's version %s, found the following unrecognized keys:"), file_version.to_string_sf(), std::string(SLIC3R_APP_FULL_NAME), app_version.to_string_sf()); - text += "\n"; - wxString context = text; - wxString append = _L("You should update your software.\n"); - context += "\n\n"; - context += append; - log_and_show_3mf_info(context, newer_3mf_title); + text += "\n" + from_u8(boost::algorithm::join(config_substitutions.unrecogized_keys, ", ")) + "\n\n"; + text += _L("You should update your software.\n"); + log_and_show_3mf_info(text, newer_3mf_title); } else { //if the minor version is not matched @@ -9338,9 +9348,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ } else if (load_config) { // Logged, not shown: it is the same for every BambuStudio project and needs no action. - std::string unrecognized; - for (const std::string& key : config_substitutions.unrecogized_keys) - unrecognized += (unrecognized.empty() ? "" : ", ") + key; + const std::string unrecognized = boost::algorithm::join(config_substitutions.unrecogized_keys, ", "); BOOST_LOG_TRIVIAL(info) << "BambuStudio " << file_version.to_string() << " project " << path.string() << ", unrecognized settings: " << (unrecognized.empty() ? "none" : unrecognized); } @@ -10852,6 +10860,11 @@ void Plater::priv::reset(bool apply_presets_change, bool reload_presets) m_worker.cancel_all(); + // Stop slicing before reinit() deletes the plates' prints. Deleting a Print only cancels the + // background thread once a print-level step has started, so a slice still generating + // perimeters or infill would keep running on freed layers. + this->background_process.stop(); + //BBS: clear the partplate list's object before object cleared partplate_list.reinit(); partplate_list.update_slice_context_to_current_plate(background_process); @@ -11030,10 +11043,68 @@ void Plater::priv::split_volume() wxGetApp().obj_list()->split(); } +// Boxes within bed that clear every rectangular exclusion zone: the rectangles spanned by bed and +// exclusion edges that overlap no exclusion. Slivers no wider than the bed padding are dropped. +static std::vector free_print_volumes(const BoundingBoxf3& bed, const std::vector& excludes) +{ + std::vector xs{ bed.min.x(), bed.max.x() }; + std::vector ys{ bed.min.y(), bed.max.y() }; + for (const BoundingBoxf3& ex : excludes) { + for (const double x : { ex.min.x(), ex.max.x() }) + if (x > bed.min.x() && x < bed.max.x()) + xs.push_back(x); + for (const double y : { ex.min.y(), ex.max.y() }) + if (y > bed.min.y() && y < bed.max.y()) + ys.push_back(y); + } + std::sort(xs.begin(), xs.end()); + std::sort(ys.begin(), ys.end()); + xs.erase(std::unique(xs.begin(), xs.end()), xs.end()); + ys.erase(std::unique(ys.begin(), ys.end()), ys.end()); + + const double min_size = 2. * Slic3r::BuildVolume::SceneEpsilon; + std::vector free_volumes; + for (size_t i = 0; i < xs.size(); ++i) + for (size_t j = i + 1; j < xs.size(); ++j) + for (size_t k = 0; k < ys.size(); ++k) + for (size_t l = k + 1; l < ys.size(); ++l) { + const double min_x = xs[i], max_x = xs[j], min_y = ys[k], max_y = ys[l]; + if (max_x - min_x <= min_size || max_y - min_y <= min_size) + continue; + + const bool blocked = std::any_of(excludes.begin(), excludes.end(), [&](const BoundingBoxf3& ex) { + return min_x < ex.max.x() && max_x > ex.min.x() && min_y < ex.max.y() && max_y > ex.min.y(); + }); + if (blocked) + continue; + + BoundingBoxf3 box = bed; + box.min.x() = min_x; + box.min.y() = min_y; + box.max.x() = max_x; + box.max.y() = max_y; + free_volumes.push_back(box); + } + return free_volumes; +} + void Plater::priv::scale_selection_to_fit_print_volume() { #if ENABLE_ENHANCED_PRINT_VOLUME_FIT - this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(this->bed.build_volume()); + const BuildVolume volume = this->bed.build_volume(); + // Every plate shares the bed size, but each sits at its own origin: fit onto the + // plate the selection is on instead of always onto the first one. + PartPlate* plate = this->partplate_list.get_curr_plate(); + const Vec3d bed_center = plate != nullptr ? plate->get_center_origin() : + Vec3d(volume.bed_center().x(), volume.bed_center().y(), 0.); + // On a multi-nozzle printer each nozzle reaches only part of the bed, so a model fitted + // to the bed can still exceed a nozzle's printable range. Fit into the volume every + // nozzle shares, which is also the area Arrange places items in, minus any exclusion zone. + const BoundingBoxf3 bed_box = plate != nullptr ? plate->get_build_volume(true) : volume.bounding_volume(); + std::vector print_volumes{ bed_box }; + if (plate != nullptr && !plate->get_exclude_areas().empty()) + print_volumes = free_print_volumes(bed_box, plate->get_exclude_areas()); + this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(volume, Vec2d(bed_center.x(), bed_center.y()), print_volumes); #else this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(*config); #endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT @@ -17169,8 +17240,10 @@ void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, i canvas->do_scale(""); auto cur_flowrate = filament_config->option("filament_flow_ratio")->get_at(0); // TODO: per-filament param - std::vector internal_solid_speeds = generate_max_speed_parameter_value("internal_solid_infill_speed", linear, pass); - std::vector top_surface_speeds = generate_max_speed_parameter_value("top_surface_speed", linear, pass); + // Cap the speeds for the extrusion the test prints, not the profile's line width and layer height + const float infill_line_width = nozzle_diameter * 1.2f; + std::vector internal_solid_speeds = generate_max_speed_parameter_value("internal_solid_infill_speed", infill_line_width, layer_height, linear, pass); + std::vector top_surface_speeds = generate_max_speed_parameter_value("top_surface_speed", infill_line_width, layer_height, linear, pass); // adjust parameters for (auto _obj : objects) { @@ -17189,8 +17262,8 @@ void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, i _obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true)); _obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0)); _obj->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum(ipRectilinear)); - _obj->config.set_key_value("top_surface_line_width", new ConfigOptionFloatOrPercent(nozzle_diameter * 1.2f, false)); - _obj->config.set_key_value("internal_solid_infill_line_width", new ConfigOptionFloatOrPercent(nozzle_diameter * 1.2f, false)); + _obj->config.set_key_value("top_surface_line_width", new ConfigOptionFloatOrPercent(infill_line_width, false)); + _obj->config.set_key_value("internal_solid_infill_line_width", new ConfigOptionFloatOrPercent(infill_line_width, false)); // ORCA: use the pattern parameter _obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum(pattern)); const auto *top_solid_flow = dynamic_cast(_obj->config.option("top_solid_infill_flow_ratio")); @@ -17865,6 +17938,9 @@ void Plater::calib_input_shaping_freq(const Calib_Params& params) filament_config->set_key_value("slow_down_for_layer_cooling", new ConfigOptionBools{false}); print_config->set_key_value("layer_height", new ConfigOptionFloat(0.2)); set_config_values(print_config, "enable_overhang_speed", false); + // A 100% factor sends Klipper MINIMUM_CRUISE_RATIO=0 with every acceleration change, for the whole test. + print_config->set_key_value("accel_to_decel_enable", new ConfigOptionBool(true)); + print_config->set_key_value("accel_to_decel_factor", new ConfigOptionPercent(100)); print_config->set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); print_config->set_key_value("wall_loops", new ConfigOptionInt(1)); print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0)); @@ -17929,6 +18005,9 @@ void Plater::calib_input_shaping_damp(const Calib_Params& params) filament_config->set_key_value("slow_down_min_speed", new ConfigOptionFloats { 0.0 }); filament_config->set_key_value("slow_down_for_layer_cooling", new ConfigOptionBools{false}); set_config_values(print_config, "enable_overhang_speed", false); + // A 100% factor sends Klipper MINIMUM_CRUISE_RATIO=0 with every acceleration change, for the whole test. + print_config->set_key_value("accel_to_decel_enable", new ConfigOptionBool(true)); + print_config->set_key_value("accel_to_decel_factor", new ConfigOptionPercent(100)); print_config->set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); print_config->set_key_value("wall_loops", new ConfigOptionInt(1)); print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0)); @@ -18670,7 +18749,7 @@ void ProjectDropDialog::on_dpi_changed(const wxRect& suggested_rect) //BBS: remove GCodeViewer as seperate APP logic bool Plater::load_files(const wxArrayString& filenames) { - const std::regex pattern_drop(".*[.](stp|step|stl|oltp|obj|amf|3mf|svg|zip|drc)", std::regex::icase); + const std::regex pattern_drop(".*[.](stp|step|stl|oltp|obj|amf|3mf|svg|zip|drc|glb|gltf|fbx)", std::regex::icase); const std::regex pattern_gcode_drop(".*[.](gcode|g)", std::regex::icase); std::vector normal_paths; @@ -19051,6 +19130,19 @@ bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); } bool Plater::are_view3D_labels_shown() const { return p->are_view3D_labels_shown(); } void Plater::show_view3D_labels(bool show) { p->show_view3D_labels(show); } +bool Plater::are_collision_volumes_shown() const +{ + return wxGetApp().app_config->get_bool("show_collision_volumes"); +} + +void Plater::show_collision_volumes(bool show) +{ + wxGetApp().app_config->set_bool("show_collision_volumes", show); + p->partplate_list.invalidate_exclusion_volume_previews(); + p->view3D->get_canvas3d()->set_as_dirty(); + p->view3D->get_canvas3d()->request_extra_frame(); +} + bool Plater::is_view3D_overhang_shown() const { return p->is_view3D_overhang_shown(); } void Plater::show_view3D_overhang(bool show) { p->show_view3D_overhang(show); } @@ -19572,7 +19664,11 @@ void Plater::export_gcode_3mf(bool export_all) SaveStrategy strategy = SaveStrategy::Silence | SaveStrategy::SplitModel | SaveStrategy::WithGcode | SaveStrategy::SkipModel; // BBS: silence if (wxGetApp().app_config->get_bool("export_statistics")) strategy = strategy | SaveStrategy::WithStatistics; - export_3mf(output_path, strategy, plate_idx); + if (export_3mf(output_path, strategy, plate_idx) < 0) { + // No file was written (e.g. a post-processing script failed), don't report a successful export. + p->exporting_status = ExportingStatus::NOT_EXPORTING; + return; + } RemovableDriveManager& removable_drive_manager = *wxGetApp().removable_drive_manager(); @@ -19874,9 +19970,9 @@ bool Plater::check_printer_initialized(MachineObject *obj, bool only_warning, bo dlg.ShowModal(); } - PrinterPartsDialog *print_parts_dlg = new PrinterPartsDialog(nullptr); - print_parts_dlg->update_machine_obj(obj); - print_parts_dlg->ShowModal(); + PrinterPartsDialog print_parts_dlg(nullptr); + print_parts_dlg.update_machine_obj(obj); + print_parts_dlg.ShowModal(); } else { auto printer_name = get_selected_printer_name_in_combox(); // wxString(obj->get_preset_printer_model_name(machine_print_name)) pop_warning_and_go_to_device_page(printer_name, Plater::PrinterWarningType::NOT_CONNECTED, _L("Sync printer information")); @@ -20429,6 +20525,45 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy p->partplate_list.store_to_3mf_structure(plate_data_list, (strategy & SaveStrategy::WithGcode || strategy & SaveStrategy::WithSliceInfo), export_plate_idx, strategy & SaveStrategy::WithStatistics); + // Orca: non-BBL G-code isn't post-processed in place, so run the scripts on a copy before packing it. + std::vector pp_tmp_files; + ScopeGuard remove_pp_tmp_files([&pp_tmp_files]() { + for (const std::string& f : pp_tmp_files) { + boost::system::error_code ec; + boost::filesystem::remove(f, ec); + } + }); + + // Backups (SkipStatic) don't pack G-code, so don't run user scripts for them. + if ((strategy & SaveStrategy::WithGcode) && !(strategy & SaveStrategy::SkipStatic) && + p->printer_technology == ptFFF && !wxGetApp().preset_bundle->is_bbl_vendor()) { + try { + for (PlateData* pd : plate_data_list) { + if (pd == nullptr || pd->gcode_file.empty()) + continue; + PartPlate* plate = p->partplate_list.get_plate(pd->plate_index); + if (plate == nullptr) + continue; + PrintBase* print = nullptr; + plate->get_print(&print, nullptr, nullptr); + Print* fff_print = dynamic_cast(print); + if (fff_print == nullptr) + continue; + + std::string src_path = pd->gcode_file; // in/out: becomes the post-processed copy if a script ran + std::string output_name = path_u8; // scripts see the real target; a rename is ignored for 3mf + if (run_post_process_scripts(src_path, true, "File", output_name, fff_print->full_print_config())) { + pp_tmp_files.push_back(src_path); + pd->gcode_file = src_path; + } + } + } catch (const std::exception& ex) { + release_PlateData_list(plate_data_list); + show_error(this, ex.what(), false); + return -1; + } + } + // BBS: backup PresetBundle& preset_bundle = *wxGetApp().preset_bundle; std::vector project_presets = preset_bundle.get_current_project_embedded_presets(); @@ -20746,76 +20881,6 @@ void Plater::reslice() p->preview->reload_print(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": finished, started slicing for plate %1%") % p->partplate_list.get_curr_plate_index(); - - record_slice_preset("slicing"); -} - -void Plater::record_slice_preset(std::string action) -{ - // record slice preset - try - { - json j; - auto printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset_with_vendor_profile().preset; - if (printer_preset.is_system) { - j["printer_preset_name"] = printer_preset.name; - } - else { - j["printer_preset_name"] = printer_preset.config.opt_string("inherits"); - } - const t_config_enum_values* keys_map = print_config_def.get("curr_bed_type")->enum_keys_map; - if (keys_map) { - for (auto item : *keys_map) { - if (item.second == wxGetApp().preset_bundle->project_config.opt_enum("curr_bed_type")) { - j["curr_bed_type"] = item.first; - break; - } - } - } - auto filament_presets = wxGetApp().preset_bundle->filament_presets; - for (int i = 0; i < filament_presets.size(); ++i) { - auto filament_preset = wxGetApp().preset_bundle->filaments.find_preset(filament_presets[i]); - if (filament_preset->is_system) { - j["filament_preset_" + std::to_string(i)] = filament_preset->name; - } - else { - j["filament_preset_" + std::to_string(i)] = filament_preset->config.opt_string("inherits"); - } - } - - Preset& print_preset = wxGetApp().preset_bundle->prints.get_edited_preset(); - if (print_preset.is_system) { - j["process_preset"] = print_preset.name; - } - else { - j["process_preset"] = print_preset.config.opt_string("inherits"); - } - j["support_type"] = ConfigOptionEnum::get_enum_names().at(print_preset.config.opt_enum("support_type")); - j["sparse_infill_pattern"] = ConfigOptionEnum::get_enum_names().at(print_preset.config.opt_enum("sparse_infill_pattern")); - j["sparse_infill_density"] = print_preset.config.opt("sparse_infill_density")->value; - - j["brim_type"] = ConfigOptionEnum::get_enum_names().at(print_preset.config.opt_enum("brim_type")); - j["user_mode"] = wxGetApp().get_mode_str(); - - if (p->background_process.fff_print()) { - const DynamicPrintConfig& full_config = p->background_process.fff_print()->full_print_config(); - json values = json::array(); - if (full_config.has("different_settings_to_system")) { - std::vector different_values = full_config.option("different_settings_to_system")->values; - for (auto& item : different_values) { - values.push_back(item); - } - } - j["different_settings_to_system"] = values; - } - - j["record_event"] = action; - NetworkAgent* agent = wxGetApp().getAgent(); - } - catch (...) - { - return; - } } //BBS: add project slicing related logic @@ -21449,6 +21514,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) { bool update_scheduled = false; bool bed_shape_changed = false; + bool exclusion_preview_changed = false; bool imex_changed = false; //bool print_sequence_changed = false; t_config_option_keys diff_keys = p->config->diff(config); @@ -21467,6 +21533,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) if (update_filament_colors_in_full_config()) { p->sidebar->update_mixed_filament_list(); + p->partplate_list.invalidate_exclusion_volume_previews(); p->sidebar->obj_list()->update_filament_colors(); p->sidebar->update_dynamic_filament_list(); continue; @@ -21490,6 +21557,12 @@ void Plater::on_config_change(const DynamicPrintConfig &config) } p->config->set_key_value(opt_key, config.option(opt_key)->clone()); + if (opt_key == "bed_exclude_volume_mode" || opt_key == "bed_exclude_area" || + opt_key == "bed_exclude_volumes" || opt_key == "extruder_bed_exclude_volumes" || opt_key == "extruder_offset" || + opt_key == "master_extruder_id" || opt_key == "nozzle_diameter" || + opt_key == "printable_height" || opt_key == "extruder_colour") + exclusion_preview_changed = true; + if (opt_key == "printer_technology") { this->set_printer_technology(config.opt_enum(opt_key)); // print technology is changed, so we should to update a search list @@ -21501,7 +21574,8 @@ void Plater::on_config_change(const DynamicPrintConfig &config) p->partplate_list.invalid_all_slice_result(); } //BBS: add bed_exclude_area - else if (opt_key == "printable_area" || opt_key == "bed_exclude_area" + else if (opt_key == "printable_area" || opt_key == "bed_exclude_volume_mode" || opt_key == "bed_exclude_area" + || opt_key == "bed_exclude_volumes" || opt_key == "extruder_bed_exclude_volumes" || opt_key == "extruder_offset" || opt_key == "bed_custom_texture" || opt_key == "bed_custom_model" || opt_key == "extruder_clearance_height_to_lid" || opt_key == "extruder_clearance_height_to_rod") { @@ -21523,6 +21597,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) } else if(opt_key == "extruder_colour") { update_scheduled = true; + p->partplate_list.invalidate_exclusion_volume_previews(); //p->sidebar->obj_list()->update_extruder_colors(); } else if (opt_key == "printable_height") { @@ -21547,8 +21622,12 @@ void Plater::on_config_change(const DynamicPrintConfig &config) else if (opt_key == "support_interface_filament" || opt_key == "support_filament" || opt_key == "outer_wall_filament_id" || opt_key == "inner_wall_filament_id" || opt_key == "sparse_infill_filament_id" || opt_key == "internal_solid_filament_id" || - opt_key == "top_surface_filament_id" || opt_key == "bottom_surface_filament_id") { + opt_key == "top_surface_filament_id" || opt_key == "bottom_surface_filament_id" || + opt_key == "enable_support" || opt_key == "raft_layers" || opt_key == "wall_loops" || + opt_key == "sparse_infill_density" || opt_key == "top_shell_layers" || + opt_key == "bottom_shell_layers" || opt_key == "brim_type" || opt_key == "brim_width") { update_scheduled = true; + p->partplate_list.invalidate_exclusion_volume_previews(); } // IDEX/IQEX: when is_imex toggles the mode icon needs to be repositioned on every plate. // set_shape() short-circuits when the bed geometry is unchanged, so we refresh explicitly. @@ -21562,8 +21641,16 @@ void Plater::on_config_change(const DynamicPrintConfig &config) p->view3D->get_canvas3d()->set_as_dirty(); } - if (bed_shape_changed) + if (bed_shape_changed) { set_bed_shape(); + get_current_canvas3D()->requires_check_outside_state(); + } + + if (exclusion_preview_changed) + p->partplate_list.invalidate_exclusion_volume_previews(); + + if (bed_shape_changed || exclusion_preview_changed) + get_current_canvas3D()->request_extra_frame(); // After any bed-shape or is_imex change, ensure the IMEX mode icon geometry and // raycaster are correct. set_shape() short-circuits when the bed is unchanged, @@ -21644,9 +21731,10 @@ void Plater::set_bed_shape() const } } } + const ConfigOptionPoints *bed_exclude_area = p->config->option("bed_exclude_area"); set_bed_shape(p->config->option("printable_area")->values, //BBS: add bed exclude areas - p->config->option("bed_exclude_area")->values, + bed_exclude_area->values, p->config->option("wrapping_exclude_area")->values, p->config->option("printable_height")->value, p->config->option("extruder_printable_area")->values, @@ -21887,6 +21975,7 @@ void Plater::set_global_filament_map(const std::vector& filament_map) { auto& project_config = wxGetApp().preset_bundle->project_config; project_config.option("filament_map")->values = filament_map; + p->partplate_list.invalidate_exclusion_volume_previews(); } void Plater::set_global_filament_volume_map(const std::vector& filament_volume_map) @@ -22139,6 +22228,7 @@ void Plater::changed_mesh(int obj_idx) void Plater::changed_object(ModelObject &object){ assert(object.get_model() == &p->model); // is object from same model? object.invalidate_bounding_box(); + p->partplate_list.invalidate_exclusion_volume_previews(); // recenter and re - align to Z = 0 object.ensure_on_bed(p->printer_technology != ptSLA); @@ -22180,6 +22270,8 @@ void Plater::changed_objects(const std::vector& object_idxs) if (object_idxs.empty()) return; + p->partplate_list.invalidate_exclusion_volume_previews(); + for (size_t obj_idx : object_idxs) { if (obj_idx < p->model.objects.size()) { if (p->model.objects[obj_idx]->min_z() >= SINKING_Z_THRESHOLD) @@ -22368,7 +22460,9 @@ void Plater::clone_selection() dlg.ShowModal(); } -std::vector Plater::get_empty_cells(const Vec2f step) +std::vector Plater::get_empty_cells(const Vec2f step, + const std::vector &local_exclude_boxes, + bool include_plate_exclude_areas) { PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate(); BoundingBoxf3 build_volume = plate->get_build_volume(true); @@ -22377,11 +22471,18 @@ std::vector Plater::get_empty_cells(const Vec2f step) std::vector cells; auto min_x = step(0)/2;// start_point.x() - step(0) * int((start_point.x() - bbox.min.x()) / step(0)); auto min_y = step(1)/2;// start_point.y() - step(1) * int((start_point.y() - bbox.min.y()) / step(1)); - auto& exclude_box3s = plate->get_exclude_areas(); std::vector exclude_boxs; - for (auto& box : exclude_box3s) { - Vec2d vmin(box.min.x(), box.min.y()), vmax(box.max.x(), box.max.y()); - exclude_boxs.emplace_back(vmin, vmax); + if (include_plate_exclude_areas) { + const auto &exclude_box3s = plate->get_exclude_areas(); + for (const auto &box : exclude_box3s) { + Vec2d vmin(box.min.x(), box.min.y()), vmax(box.max.x(), box.max.y()); + exclude_boxs.emplace_back(vmin, vmax); + } + } + const Vec3d plate_origin = plate->get_origin(); + for (BoundingBoxf box : local_exclude_boxes) { + box.translate(Vec2d(plate_origin.x(), plate_origin.y())); + exclude_boxs.emplace_back(std::move(box)); } for (float x = min_x + bbox.min.x(); x < bbox.max.x() - step(0) / 2; x += step(0)) for (float y = min_y + bbox.min.y(); y < bbox.max.y() - step(1) / 2; y += step(1)) { diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 564addb0c7..f00cdbacc8 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -505,6 +505,9 @@ public: bool are_view3D_labels_shown() const; void show_view3D_labels(bool show); + bool are_collision_volumes_shown() const; + void show_collision_volumes(bool show); + bool is_view3D_overhang_shown() const; void show_view3D_overhang(bool show); @@ -597,7 +600,6 @@ public: bool has_toolpaths_to_export() const; void export_toolpaths_to_obj() const; void reslice(); - void record_slice_preset(std::string action); void reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages = false); void reslice_SLA_hollowing(const ModelObject &object, bool postpone_error_messages = false); void reslice_SLA_until_step(SLAPrintObjectStep step, const ModelObject &object, bool postpone_error_messages = false); @@ -771,7 +773,9 @@ public: void split_volume(); void optimize_rotation(); // find all empty cells on the plate and won't overlap with exclusion areas - static std::vector get_empty_cells(const Vec2f step); + static std::vector get_empty_cells(const Vec2f step, + const std::vector &local_exclude_boxes = {}, + bool include_plate_exclude_areas = true); //BBS: void fill_color(int extruder_id); diff --git a/src/slic3r/GUI/PluginsDialog.cpp b/src/slic3r/GUI/PluginsDialog.cpp index 86ca31ba0f..0a7338e6b3 100644 --- a/src/slic3r/GUI/PluginsDialog.cpp +++ b/src/slic3r/GUI/PluginsDialog.cpp @@ -1158,10 +1158,7 @@ void PluginsDialog::run_script_plugin_capability(const std::string& plugin_key, { PluginManager& manager = PluginManager::instance(); - std::string error; - ExecutionResult result; - - auto complete_with_error = [this, &manager, &plugin_key](const std::string& plugin_error, const wxString& status_message) { + auto complete_with_error = [this, &manager, plugin_key](const std::string& plugin_error, const wxString& status_message) { const std::string normalized_error = plugin_error.empty() ? _u8L("Script plugin failed.") : plugin_error; if (!manager.set_plugin_error(plugin_key, normalized_error)) BOOST_LOG_TRIVIAL(warning) << "Failed to record plugin error. plugin_key=" << plugin_key; @@ -1177,32 +1174,53 @@ void PluginsDialog::run_script_plugin_capability(const std::string& plugin_key, show_status(message, "error"); }; + // Always runs on the GUI thread. For a started invocation (sync `def execute` or `async def`) + // the runtime delivers it later; it is called inline here only when the launch itself failed. + auto finish = [this, alive = m_alive, plugin_key, &manager, complete_with_error](const ScriptCompletion& completion) { + if (!alive->load()) + return; + + // Cancelled by PluginManager (unload/shutdown): expected termination. Report neither an + // error nor a normal success, and do not touch the plugin's error/state. + if (completion.cancelled) + return; + + if (!completion.error.empty()) { + complete_with_error(completion.error, wxString()); + return; + } + + const ExecutionResult& result = completion.result; + + BOOST_LOG_TRIVIAL(info) << "Script plugin execution completed. plugin_key=" << plugin_key + << " status=" << static_cast(result.status) << " message=" << result.message + << " data=" << result.data; + + const bool failed = result.status == PluginResult::RecoverableError || result.status == PluginResult::FatalError; + if (failed) { + complete_with_error(result.message, wxString()); + return; + } + + manager.clear_plugin_error(plugin_key); + send_plugins(); + + const bool skipped = result.status == PluginResult::Skipped; + const wxString fallback = skipped ? _L("Script plugin skipped.") : _L("Script plugin finished."); + const wxString message = result.message.empty() ? fallback : from_u8(result.message); + show_status(message, skipped ? "info" : "success"); + }; + + PluginManager::ScriptLaunchResult launch; { wxBusyCursor busy; - result = manager.run_script_capability(plugin_key, capability_name, error); + launch = manager.launch_script_capability(plugin_key, capability_name, finish); } - if (!error.empty()) { - complete_with_error(error, wxString()); - return; - } - - BOOST_LOG_TRIVIAL(info) << "Script plugin execution completed. plugin_key=" << plugin_key - << " status=" << static_cast(result.status) << " message=" << result.message << " data=" << result.data; - - const bool failed = result.status == PluginResult::RecoverableError || result.status == PluginResult::FatalError || !error.empty(); - if (failed) { - complete_with_error(result.message, wxString()); - return; - } - - manager.clear_plugin_error(plugin_key); - send_plugins(); - - const bool skipped = result.status == PluginResult::Skipped; - const wxString fallback = skipped ? _L("Script plugin skipped.") : _L("Script plugin finished."); - const wxString message = result.message.empty() ? fallback : from_u8(result.message); - show_status(message, skipped ? "info" : "success"); + // Every started invocation — a synchronous `def execute` included — completes later through + // `finish`; only a launch failure is reported inline. Return without blocking. + if (!launch.launched_async) + finish(launch.outcome); } void PluginsDialog::update_plugin(const std::string& plugin_key) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index dc726ca6f6..567a9c218f 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1097,6 +1097,16 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxString too home->SendCloudProvidersInfo(); } } + // ORCA: apply the filament translucency change immediately to the currently loaded preview + else if (param == "preview_translucent_filaments") { + if (Plater* plater = wxGetApp().plater()) { + if (GLCanvas3D* canvas = plater->get_preview_canvas3D()) { + canvas->get_gcode_viewer().set_translucent_filaments(app_config->get_bool(param)); + canvas->set_as_dirty(); + canvas->request_extra_frame(); + } + } + } // ORCA: apply the preview dimming change immediately to the currently loaded preview else if (param == "preview_dim_previous_layers") { if (m_dim_previous_layers_brightness_input) @@ -2016,6 +2026,14 @@ void PreferencesDialog::create_items() SETTING_OPENGL_REALISTIC_SHADOWS, ShadowsLabels, ShadowsValues); g_sizer->Add(item_realistic_shadows); + auto item_realistic_gloss = create_item_checkbox( + _L("Glossy toolpaths"), + _L("Highlights the toolpaths in Preview as glossy plastic in realistic view.\n" + "Off, a translucent filament is matte and an opaque one keeps the highlight of the plain view."), + SETTING_OPENGL_REALISTIC_GLOSS + ); + g_sizer->Add(item_realistic_gloss); + //// GRAPHICS > Anti-aliasing g_sizer->Add(create_item_title(_L("Anti-aliasing")), 1, wxEXPAND); @@ -2155,6 +2173,13 @@ void PreferencesDialog::create_items() ); g_sizer->Add(item_dim_previous_layers_brightness); + auto item_translucent_filaments = create_item_checkbox( + _L("Translucent filaments"), + _L("Draw the toolpaths of filaments whose color is partly transparent as see-through, as the 3D view draws their objects. Turn it off to draw every filament opaque."), + "preview_translucent_filaments" + ); + g_sizer->Add(item_translucent_filaments); + g_sizer->AddSpacer(FromDIP(10)); sizer_page->Add(g_sizer, 0, wxEXPAND); diff --git a/src/slic3r/GUI/PrinterWebView.cpp b/src/slic3r/GUI/PrinterWebView.cpp index e3c1202b5a..dd597ad38d 100644 --- a/src/slic3r/GUI/PrinterWebView.cpp +++ b/src/slic3r/GUI/PrinterWebView.cpp @@ -1,31 +1,38 @@ #include "PrinterWebView.hpp" #include "PrinterWebViewHandler.hpp" +#include "I18N.hpp" + #include "slic3r/GUI/PrinterWebView.hpp" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/MainFrame.hpp" -#include "libslic3r_version.h" +#include +#include +#include "libslic3r_version.h" +#include +#include "libslic3r/Utils.hpp" +#include "libslic3r/Config.hpp" +#include "libslic3r/PresetBundle.hpp" + +#include #include -#include + +#include + +#include #include #include -#include #include -#include "libslic3r/Utils.hpp" -#include -#include #include #include #include - -#include -#include -#include "I18N.hpp" -#include #include #include +#include +#include + class wxWindow; #ifdef __linux__ @@ -203,16 +210,32 @@ void PrinterWebView::reset_browser() // OnLoaded may have cleared m_url_deferred already, so requeue the last url for Show(). m_apikey_sent = false; + m_url_loaded = false; m_url_deferred = m_url; } +// Same lookup as create_printer_webview_handler(). +static PrintHostType active_host_type() +{ + if (wxGetApp().preset_bundle == nullptr) + return htOctoPrint; + return wxGetApp().preset_bundle->printers.get_edited_preset().config.option>("host_type")->value; +} + void PrinterWebView::load_url(wxString& url, wxString apikey) { // this->Show(); // this->Raise(); + const PrintHostType host_type = active_host_type(); + // Selecting the tab requests the same page again; navigating would reload it and drop its state. + if (m_url_loaded && url == m_url && apikey == m_apikey && host_type == m_host_type) + return; + m_url = url; m_apikey = apikey; + m_host_type = host_type; m_apikey_sent = false; + m_url_loaded = false; m_handler = create_printer_webview_handler(*this); if (this->IsShown()) { @@ -284,9 +307,10 @@ void PrinterWebView::SendAPIKey() // RemoveAllUserScripts causes WebView to forget about our script message handler, // so re-add it here. m_browser->RemoveScriptMessageHandler("wx"); - if (m_browser->AddScriptMessageHandler("wx")) - WebView::MarkScriptMessageHandlerAdded(m_browser); - else + // Mark before adding: on WKWebView the add yields in RunScript() after registering "wx", + // and CreateWebView()'s deferred add, if it runs in that yield, would register it again. + WebView::MarkScriptMessageHandlerAdded(m_browser); + if (!m_browser->AddScriptMessageHandler("wx")) wxLogError("Could not add script message handler"); #ifdef __linux__ @@ -333,10 +357,12 @@ void PrinterWebView::OnError(wxWebViewEvent &evt) void PrinterWebView::OnLoaded(wxWebViewEvent& evt) { - if (evt.GetURL().IsEmpty()) + // The web view's initial empty document (about:blank on WebKit) is not the requested page. + if (evt.GetURL().IsEmpty() || evt.GetURL() == "about:blank") return; //ORCA: url loaded successfully, safe to clear m_url_deferred.clear(); + m_url_loaded = true; SendAPIKey(); if (m_handler != nullptr) { diff --git a/src/slic3r/GUI/PrinterWebView.hpp b/src/slic3r/GUI/PrinterWebView.hpp index 53c4f30557..01ee229baa 100644 --- a/src/slic3r/GUI/PrinterWebView.hpp +++ b/src/slic3r/GUI/PrinterWebView.hpp @@ -29,6 +29,7 @@ #include #include #include "Lazy.hpp" +#include "libslic3r/PrintConfig.hpp" namespace Slic3r { @@ -68,6 +69,10 @@ private: // Last url passed to load_url(), reloaded after reset_browser(). wxString m_url; wxString m_url_deferred; + // Host type the page was loaded for; it selects the handler, so a change needs a reload. + PrintHostType m_host_type{htOctoPrint}; + // True once the page for m_url has finished loading in m_browser. + bool m_url_loaded{false}; std::unique_ptr m_handler; bool m_reset_on_show{false}; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 3f5bf126a2..26441baf37 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -5738,8 +5738,9 @@ void SelectMachineDialog::reset_and_sync_ams_list() } // Orca: collapse the per-nozzle material items into the single panel when the printer has one -// extruder or a filament switch (both feed a single logical mapping surface); otherwise keep the -// left/right split. Early-returns unless an item is actually in the wrong panel. +// extruder or a filament switch (both feed a single logical mapping surface), or when the plate is +// sliced for one nozzle (it has no left/right filament map); otherwise keep the left/right split. +// Early-returns unless an item is actually in the wrong panel. void SelectMachineDialog::update_material_item_pos(MachineObject* obj_) { if (!obj_) { @@ -5748,7 +5749,10 @@ void SelectMachineDialog::update_material_item_pos(MachineObject* obj_) const bool is_single_head = obj_->GetExtderSystem()->GetTotalExtderCount() < 2; const bool has_switcher = obj_->GetFilaSwitch()->IsInstalled(); - const bool use_single_panel = is_single_head || has_switcher; + // reset_and_sync_ams_list() fills m_filaments_map only for a multi-nozzle plate + const auto& full_config = wxGetApp().preset_bundle->full_config(); + const bool single_nozzle_plate = full_config.option("nozzle_diameter")->values.size() < 2; + const bool use_single_panel = is_single_head || has_switcher || single_nozzle_plate; bool to_change_pos = false; for (const auto& iter : m_materialList) { diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 4d7f1591ee..a6e6d96dc3 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -17,6 +17,7 @@ #include "libslic3r/Color.hpp" #include "libslic3r/Point.hpp" #include "libslic3r/Geometry.hpp" +#include "libslic3r/LayOnFace.hpp" #include "slic3r/GUI/GLModel.hpp" #include #include @@ -579,29 +580,12 @@ void Selection::drop() wxGetApp().plater()->take_snapshot(L("Move object")); - this->move_to_center(Vec3d(0, 0, -min_z)); - - for (unsigned int i : m_list) { - GLVolume& volume = *(*m_volumes)[i]; - // Skip the wipe tower: its synthetic id (>= 1000) is not an index into m_model->objects. - if (volume.object_idx() >= 1000) - continue; - ModelObject* model_object = m_model->objects[volume.object_idx()]; - - if (model_object != nullptr) { - if (m_mode == Volume) { - ModelVolume* cur_mv = model_object->volumes[volume.volume_idx()]; - cur_mv->set_transformation(volume.get_volume_transformation()); - } else if (m_mode == Instance) { - model_object->instances[volume.instance_idx()]->set_transformation(volume.get_instance_transformation()); - } - - model_object->invalidate_bounding_box(); - this->notify_instance_update(volume.object_idx(), volume.instance_idx()); - } - } - - wxGetApp().plater()->get_view3D_canvas3D()->post_event(SimpleEvent(EVT_GLCANVAS_INSTANCE_MOVED)); + // do_move() writes every volume back to the model and refreshes the view. + setup_cache(); + TransformationType transformation_type; + transformation_type.set_relative(); + translate(Vec3d(0, 0, -min_z), transformation_type); + wxGetApp().plater()->get_view3D_canvas3D()->do_move(""); } void Selection::center_plate(const int plate_idx) { @@ -1472,11 +1456,9 @@ void Selection::flattening_rotate(const Vec3d& normal) for (unsigned int i : m_list) { GLVolume& v = *(*m_volumes)[i]; - // Normal transformed from the object coordinate space to the world coordinate space. + // Additional rotation to align the face normal with the down vector in the world coordinate space. const Geometry::Transformation& old_inst_trafo = v.get_instance_transformation(); - const Vec3d tnormal = old_inst_trafo.get_matrix().matrix().block(0, 0, 3, 3).inverse().transpose() * normal; - // Additional rotation to align tnormal with the down vector in the world coordinate space. - const Transform3d rotation_matrix = Transform3d(Eigen::Quaterniond().setFromTwoVectors(tnormal, -Vec3d::UnitZ())); + const Transform3d rotation_matrix = lay_on_face_rotation(normal, old_inst_trafo.get_matrix_no_offset()); v.set_instance_transformation(old_inst_trafo.get_offset_matrix() * rotation_matrix * old_inst_trafo.get_matrix_no_offset()); } @@ -1496,7 +1478,7 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type } #if ENABLE_ENHANCED_PRINT_VOLUME_FIT -void Selection::scale_to_fit_print_volume(const BuildVolume& volume) +void Selection::scale_to_fit_print_volume(const BuildVolume& volume, const Vec2d& bed_center, const std::vector& print_volumes) { auto fit = [this](double s, Vec3d offset) { if (s <= 0.0 || s == 1.0) @@ -1526,22 +1508,30 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume) //wxGetApp().obj_manipul()->set_dirty(); }; - auto fit_rectangle = [this, fit](const BuildVolume& volume) { - const BoundingBoxf3 print_volume = volume.bounding_volume(); - const Vec3d print_volume_size = print_volume.size(); - + auto fit_rectangle = [this, fit, &print_volumes]() { // adds 1/100th of a mm on all sides to avoid false out of print volume detections due to floating-point roundings const Vec3d box_size = get_bounding_box().size() + 0.02 * Vec3d::Ones(); - const double sx = (box_size.x() != 0.0) ? print_volume_size.x() / box_size.x() : 0.0; - const double sy = (box_size.y() != 0.0) ? print_volume_size.y() / box_size.y() : 0.0; - const double sz = (box_size.z() != 0.0) ? print_volume_size.z() / box_size.z() : 0.0; + double best_s = 0.0; + const BoundingBoxf3* best = nullptr; + for (const BoundingBoxf3& print_volume : print_volumes) { + const Vec3d print_volume_size = print_volume.size(); - if (sx != 0.0 && sy != 0.0 && sz != 0.0) - fit(std::min(sx, std::min(sy, sz)), print_volume.center() - get_bounding_box().center()); + const double sx = (box_size.x() != 0.0) ? print_volume_size.x() / box_size.x() : 0.0; + const double sy = (box_size.y() != 0.0) ? print_volume_size.y() / box_size.y() : 0.0; + const double sz = (box_size.z() != 0.0) ? print_volume_size.z() / box_size.z() : 0.0; + + if (sx != 0.0 && sy != 0.0 && sz != 0.0 && std::min(sx, std::min(sy, sz)) > best_s) { + best_s = std::min(sx, std::min(sy, sz)); + best = &print_volume; + } + } + + if (best != nullptr) + fit(best_s, best->center() - get_bounding_box().center()); }; - auto fit_circle = [this, fit](const BuildVolume& volume) { + auto fit_circle = [this, fit, &bed_center](const BuildVolume& volume) { const Geometry::Circled& print_circle = volume.circle(); double print_circle_radius = unscale(print_circle.radius); @@ -1572,7 +1562,9 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume) const double s = std::min(print_circle_radius / circle_radius, volume.printable_height() / max_z); const Vec3d sel_center = get_bounding_box().center(); const Vec3d offset = s * (Vec3d(unscale(circle.center.x()), unscale(circle.center.y()), 0.5 * max_z) - sel_center); - const Vec3d print_center = { unscale(print_circle.center.x()), unscale(print_circle.center.y()), 0.5 * volume.printable_height() }; + // The active plate's bed is the same circle, moved by its centre. + const Vec3d plate_shift = Vec3d(bed_center.x() - volume.bed_center().x(), bed_center.y() - volume.bed_center().y(), 0.); + const Vec3d print_center = Vec3d(unscale(print_circle.center.x()), unscale(print_circle.center.y()), 0.5 * volume.printable_height()) + plate_shift; fit(s, print_center - (sel_center + offset)); }; @@ -1581,7 +1573,7 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume) switch (volume.type()) { - case BuildVolume_Type::Rectangle: { fit_rectangle(volume); break; } + case BuildVolume_Type::Rectangle: { fit_rectangle(); break; } case BuildVolume_Type::Circle: { fit_circle(volume); break; } default: { break; } } diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index a02f01da00..e35b71677f 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -354,7 +354,11 @@ public: void flattening_rotate(const Vec3d& normal); void scale(const Vec3d& scale, TransformationType transformation_type); #if ENABLE_ENHANCED_PRINT_VOLUME_FIT - void scale_to_fit_print_volume(const BuildVolume& volume); + // bed_center is the centre of the plate the selection is on: every plate shares the + // bed size, but each sits at its own origin. print_volumes are the candidate boxes the + // selection may be fitted into (e.g. the bed minus rectangular exclusion zones); the one + // allowing the largest scale is used. + void scale_to_fit_print_volume(const BuildVolume& volume, const Vec2d& bed_center, const std::vector& print_volumes); #else void scale_to_fit_print_volume(const DynamicPrintConfig& config); #endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT @@ -392,6 +396,11 @@ public: render_bounding_box(box, Transform3d::Identity(), get_auto_drop(), color); } + void render_bounding_box(const BoundingBoxf3& box, const Transform3d& trafo, const ColorRGB& color, float scale) { + m_scale_factor = scale; + render_bounding_box(box, trafo, get_auto_drop(), color); + } + //BBS void cut_to_clipboard(); void copy_to_clipboard(); diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index 031c5847f4..cd45264a7a 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -1831,7 +1831,7 @@ what(); } BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " : Tutk url error: ress = " << res; } - }); + }, wxGetApp().get_printer_cloud_provider()); } } } diff --git a/src/slic3r/GUI/Shortcuts.cpp b/src/slic3r/GUI/Shortcuts.cpp index df8d7c00ca..03fc6937b8 100644 --- a/src/slic3r/GUI/Shortcuts.cpp +++ b/src/slic3r/GUI/Shortcuts.cpp @@ -147,6 +147,7 @@ constexpr std::array shortcut_table = {{ // Display SHORTCUT(ShowLabels, "show_labels", L("Show object labels in 3D scene."), GLOBAL, { 'E', CTRL }), + SHORTCUT(ShowCollisionVolumes, "show_collision_volumes", L("Show all collision volumes"), GLOBAL, { 'K', CTRL_SHIFT }), SHORTCUT(ShowWireframe, "show_wireframe", L("Show/Hide wireframe"), CANVAS, { WXK_RETURN, CTRL_SHIFT }), SHORTCUT(ToggleGcodeWindow, "toggle_gcode_window", L("On/Off G-code window"), PREVIEW, { 'C' }), SHORTCUT(ToggleOneLayerMode, "toggle_one_layer_mode", L("On/Off one layer mode of the vertical slider"), PREVIEW, { 'L' }), @@ -159,6 +160,7 @@ constexpr std::array shortcut_table = {{ SHORTCUT(CollapseSidebar, "collapse_sidebar", L("Collapse/Expand the sidebar"), CANVAS, { WXK_TAB, SHIFT }), SHORTCUT(ReloadDevicePage, "reload_device_page", L("Reload the device page"), CANVAS, { WXK_F5 }), SHORTCUT(KeyboardShortcuts, "keyboard_shortcuts", L("Show keyboard shortcuts list"), CANVAS, { '?' }), + SHORTCUT(Quit, "quit", L("Quit"), GLOBAL, { 'Q', CTRL }), // Speed Dial SHORTCUT(SpeedDial, "speed_dial", L("Open the Speed Dial"), GLOBAL, { WXK_SPACE }), diff --git a/src/slic3r/GUI/Shortcuts.hpp b/src/slic3r/GUI/Shortcuts.hpp index aba315d521..ddc9a7ed8d 100644 --- a/src/slic3r/GUI/Shortcuts.hpp +++ b/src/slic3r/GUI/Shortcuts.hpp @@ -46,9 +46,9 @@ enum class Shortcut : uint8_t { // Camera ViewDefault, ViewTop, ViewBottom, ViewFront, ViewRear, ViewLeft, ViewRight, ViewPlate, ZoomIn, ZoomOut, Mouse3DSettings, // Display - ShowLabels, ShowWireframe, ToggleGcodeWindow, ToggleOneLayerMode, ToggleBeltRawGcode, + ShowLabels, ShowCollisionVolumes, ShowWireframe, ToggleGcodeWindow, ToggleOneLayerMode, ToggleBeltRawGcode, // Application - Preferences, Search, SwitchView, CollapseSidebar, ReloadDevicePage, KeyboardShortcuts, + Preferences, Search, SwitchView, CollapseSidebar, ReloadDevicePage, KeyboardShortcuts, Quit, // Speed Dial SpeedDial, Count diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 654d8db56c..d68c9f1635 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -196,8 +196,8 @@ static void market_model_scoring_page(int design_id) std::string url; std::string country_code = GUI::wxGetApp().app_config->get_country_code(); std::string model_http_url = GUI::wxGetApp().get_model_http_url(country_code); - if (GUI::wxGetApp().getAgent()->get_model_mall_detail_url(&url, std::to_string(design_id)) == 0) { - std::string user_id = GUI::wxGetApp().getAgent()->get_user_id(); + if (GUI::wxGetApp().getAgent()->get_model_mall_detail_url(&url, std::to_string(design_id), GUI::wxGetApp().get_printer_cloud_provider()) == 0) { + std::string user_id = GUI::wxGetApp().getAgent()->get_user_id(GUI::wxGetApp().get_printer_cloud_provider()); boost::algorithm::replace_first(url, "models", "u/" + user_id + "/rating"); // Prevent user_id from containing design_id size_t sign_in = url.find("/rating"); @@ -3783,7 +3783,7 @@ void StatusPanel::update_model_info() curr_model_task->task_id = curr_task->task_id; request_model_info_flag = true; if (!curr_model_task->task_id.empty() && curr_model_task->task_id.compare("0") != 0) { - wxGetApp().getAgent()->get_subtask(curr_model_task, get_subtask_fn); + wxGetApp().getAgent()->get_subtask(curr_model_task, get_subtask_fn, wxGetApp().get_printer_cloud_provider()); } } } @@ -6032,7 +6032,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer() if (!need_upload_images.empty()) { std::string config; - int ret = wxGetApp().getAgent()->get_oss_config(config, wxGetApp().app_config->get_country_code(), http_code, http_error); + int ret = wxGetApp().getAgent()->get_oss_config(config, wxGetApp().app_config->get_country_code(), http_code, http_error, wxGetApp().get_printer_cloud_provider()); if (ret == -1) { error_info += into_u8(_L("Get oss config failed.")) + "\n\thttp code: " + std::to_string(http_code) + "\n\thttp error: " + http_error; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": get oss config filed and http_error: " << http_error; @@ -6047,7 +6047,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer() std::pair need_upload = *it; std::string need_upload_uf8 = into_u8(need_upload.second); //Local path when incoming, cloud path when outgoing - ret = wxGetApp().getAgent()->put_rating_picture_oss(config, need_upload_uf8, m_model_id, m_profile_id, http_code, http_error); + ret = wxGetApp().getAgent()->put_rating_picture_oss(config, need_upload_uf8, m_model_id, m_profile_id, http_code, http_error, wxGetApp().get_printer_cloud_provider()); std::unordered_map::iterator iter; switch (ret) { case 0: @@ -6107,7 +6107,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer() } if (m_upload_status_code == StatusCode::UPLOAD_PROGRESS) { - int ret = wxGetApp().getAgent()->put_model_mall_rating(m_rating_id, m_star_count, comment, m_image_url_paths, http_code, http_error); + int ret = wxGetApp().getAgent()->put_model_mall_rating(m_rating_id, m_star_count, comment, m_image_url_paths, http_code, http_error, wxGetApp().get_printer_cloud_provider()); MessageDialog *dlg_info; switch (ret) { case 0: EndModal(wxID_OK); break; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 721e97df92..50cdc5abf3 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -46,6 +46,7 @@ #include "slic3r/GUI/DeviceCore/DevConfigUtil.h" #include #include +#include #include "libslic3r/LifecycleEvents.hpp" #include "libslic3r/Point.hpp" #include "slic3r/GUI/SettingsIndex.hpp" @@ -81,6 +82,7 @@ #include "wxExtensions.hpp" #include "PresetComboBoxes.hpp" #include +#include #include "GUI_App.hpp" #include "GUI_ObjectList.hpp" @@ -1645,6 +1647,138 @@ void Tab::load_config(const DynamicPrintConfig& config) } } +// The option keys a preset of `type` may hold. The tab's config shares the global +// print_config_def with every other preset type, so membership has to be checked against the +// preset type's own key list instead of the config definition, or a printer setting could be +// written into the process preset. +static const std::vector& preset_type_options(Preset::Type type) +{ + static const std::vector none; + switch (type) { + case Preset::TYPE_PRINT: return Preset::print_options(); + case Preset::TYPE_FILAMENT: return Preset::filament_options(); + case Preset::TYPE_PRINTER: return Preset::printer_options(); + default: return none; + } +} + +static const char* preset_type_name(Preset::Type type) +{ + switch (type) { + case Preset::TYPE_PRINT: return "process"; + case Preset::TYPE_FILAMENT: return "filament"; + case Preset::TYPE_PRINTER: return "printer"; + default: return "preset"; + } +} + +// Commit one option whose new value already sits in m_config through the same path a hand edit +// runs. The key-specific behaviour (ConfigOptionsGroup::on_change_OG, including the printer_agent +// canonicalization, the group's pre-checks and Tab::on_value_change()) runs exactly as for a hand +// edit. A built field supplies the field's typed/clamped value; otherwise the owning +// ConfigOptionsGroup builds the value from the config it edits and dispatches the same +// on_change_OG(). The option's page is reloaded from the config just committed first, so a built +// field reports the committed value rather than a stale one. No tab-wide refresh happens here: the +// caller does it once for the whole batch. +bool Tab::commit_preset_config_value(const std::string& opt_key) +{ + if (Page* field_page = nullptr; Field* field = get_field(opt_key, &field_page)) { + field_page->reload_config(); + field->field_changed(); + return true; + } + for (const PageShp& page : m_pages) + for (const ConfigOptionsGroupShp& group : page->m_optgroups) + if (group->commit_config_value(opt_key)) + return true; + return false; +} + +// Set one option of the currently edited preset from its serialized string form, then run the +// same update path a hand edit runs. The edited preset is not saved: it only becomes dirty, +// exactly as if the field had been edited by hand. +void Tab::apply_preset_config_value(const std::string& opt_key, const std::string& value) +{ + apply_preset_config_values({{opt_key, value}}); +} + +// Apply a batch of settings as one transaction: parse and validate the whole batch first, then +// commit it through the same per-setting path apply_preset_config_value() uses, restoring the edited +// preset and the state derived from it if a setting fails. See the header for the contract and its +// limits. +void Tab::apply_preset_config_values(const std::vector>& values) +{ + if (m_config == nullptr) + throw std::runtime_error("The preset configuration is not available"); + if (wxGetApp().plater() == nullptr) + throw std::runtime_error("OrcaSlicer main window is not available"); + + if (values.empty()) + return; + + const std::vector& options = preset_type_options(m_type); + + // Preparation: reject every batch that cannot be applied before touching the edited preset, so a + // bad key or value fails without a partial write. The key must belong to this preset type, it must + // not repeat, and each value is strict-parsed into a scratch copy (the strict deserializer can + // already have mutated an option when it rejects a bad value, so the check has to run somewhere + // the edited preset is not affected). Callback failures cannot be prepared this way: a setting's + // on_change callback is a GUI method, not a pure function of the config, so whether it throws is + // only known by running it. That residual case is handled by the rollback below. + std::set seen; + DynamicPrintConfig scratch(*m_config); + for (const auto& kv : values) { + const std::string& opt_key = kv.first; + if (std::find(options.begin(), options.end(), opt_key) == options.end()) + throw std::invalid_argument(format("Unknown %1% preset setting \"%2%\"", preset_type_name(m_type), opt_key)); + if (!seen.insert(opt_key).second) + throw std::invalid_argument(format("%1% preset setting \"%2%\" is set more than once in the same update", + preset_type_name(m_type), opt_key)); + try { + scratch.set_deserialize_strict(opt_key, kv.second); + } catch (const ConfigurationError& err) { + throw std::invalid_argument(err.what()); + } + } + + // Rollback boundary: snapshot the whole edited config, not just the keys the batch names, because a + // key-specific callback can adjust related settings of the edited preset (mutually exclusive + // options, compatibility, and so on). A failure restores this config and then recomputes the state + // derived from it. + DynamicPrintConfig before(*m_config); + try { + for (const auto& kv : values) { + m_config->set_deserialize_strict(kv.first, kv.second); + if (!commit_preset_config_value(kv.first)) + // The GUI edits this setting through a custom widget rather than a group (e.g. + // compatible_printers), so take the same shared no-field commit path the widget uses. + // The value was written above, so saved mode skips the write and keeps the path's + // compatibility recompute, dirty flag, preset-combo and plater updates. + load_key_value(kv.first, boost::any(), /*saved_value=*/true); + } + } catch (...) { + *m_config = before; + // A callback can rewrite state derived from the config (compatibility marks, the preset + // selector, dependent tabs, the Plater and, on the printer tab, the printer agent) before it + // throws. Recompute that derived state from the restored config so none of it is left + // reflecting the failed batch. Effects that are not a function of the config (a dialog the + // user already accepted, an undo snapshot, a command already sent to a device, the target + // selection) cannot be reversed here; see the header. + m_preset_bundle->update_compatible(PresetSelectCompatibleType::Never); + reload_config(); + update_dirty(); + update(); + throw; + } + + // Apply the batch's final state once. The commit paths above already maintained the dirty flag, + // preset combo and, on the printer tab, the printer-agent switch; this reloads the visible page + // and pushes the config to the Plater. + reload_config(); + update_dirty(); + update(); +} + // Reload current $self->{config} (aka $self->{presets}->edited_preset->config) into the UI fields. void Tab::reload_config() { @@ -1944,6 +2078,36 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) return; } + // The bed-area point option cannot store collision-volume syntax. Offer to + // copy it to the volume setting while retaining the area's previous value. + if (opt_key == "bed_exclude_area" && m_type == Preset::TYPE_PRINTER) { + const std::string *definition = boost::any_cast(&value); + if (definition != nullptr && is_bed_exclusion_volume_syntax(*definition)) { + const double printable_height = m_config->opt_float("printable_height"); + if (!is_valid_bed_exclude_volumes_string(*definition, printable_height)) { + show_error(wxGetApp().plater(), _L("Invalid collision volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |.")); + reload_config(); + return; + } + + MessageDialog dialog( + wxGetApp().plater(), + _L("This definition contains collision-volume syntax. Add it to the toolhead collision volumes for G-code checking and travel avoidance? The existing excluded bed area will be preserved."), + _L("Add collision volumes"), wxICON_QUESTION | wxYES | wxNO); + if (dialog.ShowModal() == wxID_YES) { + DynamicPrintConfig converted = *m_config; + append_bed_exclude_volumes(converted, *definition); + load_config(converted); + reload_config(); + on_presets_changed(); + wxGetApp().plater()->update(); + } else { + reload_config(); + } + return; + } + } + // Keep this preset's "plugins" manifest in sync when a plugin picker changes, so full_config() and // save_to_json() always find resolved "name;uuid;capability" references and rebuild it nowhere else. // Also drop any plugin config override entries for a capability the change just stopped @@ -1966,6 +2130,25 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value) printer_tab->on_gcode_flavor_changed(); } + if (opt_key == "bed_exclude_volume_mode" && m_type == Preset::TYPE_PRINTER && + m_config->opt_enum("bed_exclude_volume_mode") == BedExcludeVolumeMode::PerExtruder) { + auto *per_extruder = m_config->option("extruder_bed_exclude_volumes"); + const auto *shared = m_config->option("bed_exclude_volumes"); + const size_t extruder_count = m_config->option("nozzle_diameter")->size(); + const bool definitions_empty = per_extruder == nullptr || + std::all_of(per_extruder->values.begin(), per_extruder->values.end(), [](const std::string &entry) { return entry.empty(); }); + + if (definitions_empty && shared != nullptr && extruder_count > 0) { + const std::string serialized = shared->value; + const bool valid_shared_definition = + is_valid_bed_exclude_volumes_string(serialized, std::numeric_limits::max()); + DynamicPrintConfig new_conf = *m_config; + new_conf.set_key_value("extruder_bed_exclude_volumes", + new ConfigOptionStrings(std::vector(extruder_count, valid_shared_definition ? serialized : std::string{}))); + m_config_manipulation.apply(m_config, &new_conf); + } + } + if (opt_key == "compatible_prints") this->compatible_widget_reload(m_compatible_prints); if (opt_key == "compatible_printers") @@ -2948,6 +3131,7 @@ void TabPrint::build() optgroup->append_single_option_line("top_shell_layers", "strength_settings_top_bottom_shells#shell-layers"); optgroup->append_single_option_line("top_shell_thickness", "strength_settings_top_bottom_shells#shell-thickness"); + optgroup->append_single_option_line("top_color_penetration_layers", "strength_settings_top_bottom_shells#paint-penetration-layers"); optgroup->append_single_option_line("top_surface_density", "strength_settings_top_bottom_shells#surface-density"); optgroup->append_single_option_line("top_surface_pattern", "strength_settings_top_bottom_shells#surface-pattern"); optgroup->append_single_option_line("top_surface_fill_order", "strength_settings_top_bottom_shells#fill-order"); @@ -2957,6 +3141,7 @@ void TabPrint::build() optgroup->append_single_option_line("top_surface_expansion_direction", "strength_settings_top_bottom_shells#surface-expansion-direction"); optgroup->append_single_option_line("bottom_shell_layers", "strength_settings_top_bottom_shells#shell-layers"); optgroup->append_single_option_line("bottom_shell_thickness", "strength_settings_top_bottom_shells#shell-thickness"); + optgroup->append_single_option_line("bottom_color_penetration_layers", "strength_settings_top_bottom_shells#paint-penetration-layers"); optgroup->append_single_option_line("bottom_surface_density", "strength_settings_top_bottom_shells#surface-density"); optgroup->append_single_option_line("bottom_surface_pattern", "strength_settings_top_bottom_shells#surface-pattern"); optgroup->append_single_option_line("bottom_surface_fill_order", "strength_settings_top_bottom_shells#fill-order"); @@ -2968,9 +3153,9 @@ void TabPrint::build() optgroup->append_single_option_line("sparse_infill_density", "strength_settings_infill#sparse-infill-density"); optgroup->append_single_option_line("fill_multiline", "strength_settings_infill#fill-multiline"); optgroup->append_single_option_line("sparse_infill_pattern", "strength_settings_infill#sparse-infill-pattern"); - optgroup->append_single_option_line("tpms_adaptive", "strength_settings_patterns#adaptive-density"); - optgroup->append_single_option_line("tpms_interior_density", "strength_settings_patterns#interior-density"); - optgroup->append_single_option_line("tpms_adaptive_gradient", "strength_settings_patterns#adaptive-gradient"); + optgroup->append_single_option_line("adaptive_infill_mode", "strength_settings_patterns#adaptive-density"); + optgroup->append_single_option_line("adaptive_infill_interior_density", "strength_settings_patterns#interior-density"); + optgroup->append_single_option_line("adaptive_infill_gradient", "strength_settings_patterns#adaptive-gradient"); optgroup->append_single_option_line("gyroid_optimized", "strength_settings_patterns#gyroid-optimized"); optgroup->append_single_option_line("sparse_infill_smooth_factor", "strength_settings_infill#sparse-infill-smooth-factor"); optgroup->append_single_option_line("infill_direction", "strength_settings_infill#direction"); @@ -5250,11 +5435,15 @@ void TabPrinter::build_fff() Option option = optgroup->get_option("bed_exclude_area"); option.opt.full_width = true; optgroup->append_single_option_line(option, "printer_basic_information_printable_space#excluded-bed-area"); - // optgroup->append_single_option_line("printable_area"); + + option = optgroup->get_option("bed_exclude_volumes"); + option.opt.full_width = true; + optgroup->append_single_option_line(option, "printer_basic_information_printable_space#toolhead-collision-volumes"); + optgroup->append_single_option_line("bed_exclude_volume_mode", "printer_basic_information_printable_space#toolhead-collision-volumes"); + optgroup->append_single_option_line("printable_height", "printer_basic_information_printable_space#printable-height"); - optgroup->append_single_option_line("support_multi_bed_types","printer_basic_information_printable_space#support-multi-bed-types"); + optgroup->append_single_option_line("support_multi_bed_types", "printer_basic_information_printable_space#support-multi-bed-types"); optgroup->append_single_option_line("best_object_pos", "printer_basic_information_printable_space#best-object-position"); - // todo: for multi_extruder test optgroup->append_single_option_line("z_offset", "printer_basic_information_printable_space#z-offset"); optgroup->append_single_option_line("preferred_orientation", "printer_basic_information_printable_space#preferred-orientation"); @@ -5279,7 +5468,7 @@ void TabPrinter::build_fff() option.opt.width = Field::def_width_wider(); option.opt.tooltip = L("Select the network agent implementation for printer communication. " "Available agents are registered at startup."); - optgroup->append_single_option_line(option); + optgroup->append_single_option_line(option, "printer_basic_information_advanced#printer-agent"); } } @@ -5642,9 +5831,7 @@ void TabPrinter::append_option_line(ConfigOptionsGroupShp optgroup, const std::s auto line = Line{ option.opt.full_label, "" }; line.label_path = label_path; line.append_option(option); - if (m_use_silent_mode - || m_printer_technology == ptSLA // just for first build, if SLA printer preset is selected - ) + if (m_printer_technology == ptSLA) // just for first build, if SLA printer preset is selected line.append_option(optgroup->get_option(opt_key, 1)); optgroup->append_line(line); } @@ -5653,29 +5840,6 @@ PageShp TabPrinter::build_kinematics_page() { auto page = add_options_page(L("Motion ability"), "custom-gcode_motion", true); // ORCA: icon only visible on placeholders - if (m_use_silent_mode) { - // Legend for OptionsGroups - auto optgroup = page->new_optgroup(""); - auto line = Line{ "", "" }; - - ConfigOptionDef def; - def.type = coString; - def.width = Field::def_width(); - def.gui_type = ConfigOptionDef::GUIType::legend; - def.mode = comDevelop; - //def.tooltip = L("Values in this column are for Normal mode"); - def.set_default_value(new ConfigOptionString{ _(L("Normal")).ToUTF8().data() }); - - auto option = Option(def, "full_power_legend"); - line.append_option(option); - - //def.tooltip = L("Values in this column are for Stealth mode"); - def.set_default_value(new ConfigOptionString{ _(L("Silent")).ToUTF8().data() }); - option = Option(def, "silent_legend"); - line.append_option(option); - - optgroup->append_line(line); - } auto optgroup = page->new_optgroup(L("Advanced"), "param_advanced"); optgroup->append_single_option_line("emit_machine_limits_to_gcode", "printer_motion_ability#emit-limits-to-g-code"); @@ -5775,13 +5939,9 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) size_t existed_page = 0; for (size_t i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already if (m_pages[i]->title().find(L("Motion ability")) != std::string::npos) { - if (m_rebuild_kinematics_page) - m_pages.erase(m_pages.begin() + i); - else - existed_page = i; + existed_page = i; break; } - m_rebuild_kinematics_page = false; if (existed_page < n_before_extruders && (is_marlin_flavor || from_initial_build)) { auto page = build_kinematics_page(); @@ -6068,6 +6228,10 @@ if (is_marlin_flavor) option.opt.full_width = true; optgroup->append_single_option_line(option, "printer_extruder_basic_information#extruder-printable-area"); + Option exclusion_option = optgroup->get_option("extruder_bed_exclude_volumes", extruder_idx); + exclusion_option.opt.full_width = true; + optgroup->append_single_option_line(exclusion_option, "printer_basic_information_printable_space#toolhead-collision-volumes"); + optgroup->m_on_change = [this](const t_config_option_key& opt_key, boost::any value) { // The page edits the extruder selected on the variant switch. @@ -6549,6 +6713,16 @@ void TabPrinter::toggle_options() const bool support_parallel_printheads = printer_cfg.opt_bool("support_parallel_printheads"); toggle_line("parallel_printheads_count", support_parallel_printheads); + const size_t exclusion_extruder_count = m_preset_bundle->get_printer_extruder_count(); + // UI visibility follows the selected mode even before any volumes are + // entered. The runtime resolver still ignores empty configurations. + const BedExcludeVolumeMode exclusion_mode = m_config->opt_enum("bed_exclude_volume_mode"); + // Legacy areas and collision volumes are additive. Keep the established + // material keep-out editable while the opt-in motion constraints exist. + toggle_option("bed_exclude_area", true); + toggle_line("bed_exclude_volume_mode", exclusion_extruder_count > 1); + toggle_line("bed_exclude_volumes", exclusion_extruder_count <= 1 || exclusion_mode != BedExcludeVolumeMode::PerExtruder); + toggle_line("fan_direction", m_config->opt_bool("auxiliary_fan")); // The cooling filter and air filtration are alternative accessories: show only the one the printer supports. @@ -6665,6 +6839,9 @@ void TabPrinter::toggle_options() toggle_option("extruder_printable_area", false, i); // disable toggle_line("extruder_printable_area", m_preset_bundle->get_printer_extruder_count() == 2, i); //hide + const bool per_extruder_exclusions = + m_config->opt_enum("bed_exclude_volume_mode") == BedExcludeVolumeMode::PerExtruder; + toggle_line("extruder_bed_exclude_volumes", m_preset_bundle->get_printer_extruder_count() > 1 && per_extruder_exclusions, i); toggle_option("extruder_printable_height", false, i); toggle_line("extruder_printable_height", m_preset_bundle->get_printer_extruder_count() == 2, i); @@ -6753,13 +6930,9 @@ void TabPrinter::toggle_options() const bool gcf_is_klipper = gcf == GCodeFlavor::gcfKlipper; const bool gcf_is_reprap_firmware = gcf == GCodeFlavor::gcfRepRapFirmware; - bool silent_mode = m_config->opt_bool("silent_mode"); - int max_field = silent_mode ? 2 : 1; - for (int i = 0; i < max_field; ++i) - toggle_option("machine_max_acceleration_travel", !gcf_is_marlin_legacy && !gcf_is_klipper, i); + toggle_option("machine_max_acceleration_travel", !gcf_is_marlin_legacy && !gcf_is_klipper, 0); toggle_line("machine_max_acceleration_travel", !gcf_is_marlin_legacy && !gcf_is_klipper); - for (int i = 0; i < max_field; ++i) - toggle_option("machine_max_junction_deviation", gcf_is_marlin_firmware, i); + toggle_option("machine_max_junction_deviation", gcf_is_marlin_firmware, 0); toggle_line("machine_max_junction_deviation", gcf_is_marlin_firmware); // Check if junction deviation value is non-zero and firmware is Marlin @@ -6773,12 +6946,10 @@ void TabPrinter::toggle_options() enable_jerk = true; } } - for (int i = 0; i < max_field; ++i) { - toggle_option("machine_max_jerk_x", enable_jerk, i); - toggle_option("machine_max_jerk_y", enable_jerk, i); - toggle_option("machine_max_jerk_z", enable_jerk, i); - toggle_option("machine_max_jerk_e", enable_jerk, i); - } + toggle_option("machine_max_jerk_x", enable_jerk, 0); + toggle_option("machine_max_jerk_y", enable_jerk, 0); + toggle_option("machine_max_jerk_z", enable_jerk, 0); + toggle_option("machine_max_jerk_e", enable_jerk, 0); bool emittable_limits = gcf_is_marlin_legacy || gcf_is_marlin_firmware || gcf_is_reprap_firmware; toggle_option("emit_machine_limits_to_gcode", emittable_limits); @@ -6883,11 +7054,6 @@ void TabPrinter::update() void TabPrinter::update_fff() { - if (m_use_silent_mode != m_config->opt_bool("silent_mode")) { - m_rebuild_kinematics_page = true; - m_use_silent_mode = m_config->opt_bool("silent_mode"); - } - // Sync IDEX/IQEX tool grid whenever carriage configuration changes. // set_grid_size() is a no-op when dimensions and layout are unchanged. // load_from_config() is gated on matches_config() — without that guard, diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 44ef0704a3..6b4444c962 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -424,6 +424,40 @@ public: //BBS update plater presets if update_plater_presets = true void update_tab_ui(bool update_plater_presets = false); void load_config(const DynamicPrintConfig& config); + // Host/plugin API: set one option of this tab's currently edited preset from its serialized + // string value, then run the same committed-change path a field edit runs. `opt_key` must be a + // setting of this tab's preset type, so a key of another preset type (e.g. a printer setting + // passed to the process tab) is rejected instead of written silently. `value` is parsed by the + // strict config deserializer, which raises std::invalid_argument for an unknown key or a value + // the option cannot parse, and leaves the preset unchanged. The key-specific behaviour runs + // through its ConfigOptionsGroup::on_change_OG(): with the option's built field it uses the + // field's typed value, otherwise the owning group builds the value and dispatches the same call, + // so a not-yet-built field still gets it. A key the GUI edits through a custom widget instead + // takes the shared no-field commit path, Tab::load_key_value() in saved mode. + void apply_preset_config_value(const std::string& opt_key, const std::string& value); + + // Host/plugin API: apply a batch of settings to this tab's currently edited preset as one + // transaction. Each pair is a setting of this tab's preset type and its serialized string value. + // The whole batch is parsed and validated before the edited preset is touched; each setting then + // runs the same committed-change path apply_preset_config_value() uses, so setting-specific + // validation, correction and on_change callbacks stay authoritative. Duplicate keys are rejected, + // because the transaction must not resolve an incidental write order, and the batch order is + // preserved. If applying the batch fails, the edited preset's config is restored to its pre-batch + // state and the state derived from it (compatibility marks, the preset selector, dependent tabs, + // the Plater and the printer agent) is recomputed, so the edited preset never keeps a subset of + // the staged settings. + // + // Only the edited preset is restored. A setting's on_change callback is a GUI method, not a pure + // function of the config, so effects outside the edited preset cannot be prepared or undone: the + // transaction does not reverse preset/slot selection made while resolving the target, a dialog + // decision the user already accepted, an undo snapshot, a dependent preset's rewritten config, or + // anything already sent to a device. Exact all-or-nothing across those is not achievable while the + // authoritative GUI callbacks run; this method guarantees the edited preset's own settings, not + // those external effects. + // + // Throws std::invalid_argument for an unknown key, a value the option cannot parse, or a duplicate + // key; std::runtime_error when the preset or main window is unavailable. + void apply_preset_config_values(const std::vector>& values); virtual void reload_config(); void update_mode(); void update_visibility(); @@ -507,6 +541,12 @@ protected: wxSizer* compatible_widget_create(wxWindow* parent, PresetDependencies &deps); void compatible_widget_reload(PresetDependencies &deps); void load_key_value(const std::string& opt_key, const boost::any& value, bool saved_value = false); + // Commit one option whose new value already sits in m_config through the same path a field edit + // runs (throwing field, otherwise the owning group's on_change_OG()). Reloads the option's page + // so a built field reports the committed value, but performs no tab-wide refresh. Returns true + // when a built field or a group owns the option, false when the GUI edits it through a custom + // widget with no group entry. + bool commit_preset_config_value(const std::string& opt_key); //BBS: GUI refactor // return true if cancelled @@ -677,9 +717,7 @@ class IMEXModesCtrl; class TabPrinter : public Tab { private: - bool m_use_silent_mode = false; void append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key, const std::string& label_path = ""); - bool m_rebuild_kinematics_page = false; void update_input_shaper_menu(GCodeFlavor flavor); // R8: track the belt->non-belt transition so update_fff() only clears the belt-derived diff --git a/src/slic3r/GUI/TaskManager.cpp b/src/slic3r/GUI/TaskManager.cpp index 54efafe8ae..287ef2b5cf 100644 --- a/src/slic3r/GUI/TaskManager.cpp +++ b/src/slic3r/GUI/TaskManager.cpp @@ -375,7 +375,7 @@ std::map TaskManager::get_task_list(int curr_page, i task_query_params.limit = page_count; task_query_params.offset = curr_page * page_count; std::string task_info; - int result = agent->get_user_tasks(task_query_params, &task_info); + int result = agent->get_user_tasks(task_query_params, &task_info, GUI::wxGetApp().get_printer_cloud_provider()); BOOST_LOG_TRIVIAL(trace) << "task_manager: get_task_list task_info=" << task_info; if (result == 0) { try { diff --git a/src/slic3r/GUI/TextureImportDialog.cpp b/src/slic3r/GUI/TextureImportDialog.cpp index 8e83f0302a..cee0b5fe5b 100644 --- a/src/slic3r/GUI/TextureImportDialog.cpp +++ b/src/slic3r/GUI/TextureImportDialog.cpp @@ -32,6 +32,8 @@ #include "slic3r/GUI/GUI_Utils.hpp" #include "libslic3r/TexturePainting.hpp" #include "slic3r/GUI/Widgets/SpinInput.hpp" +#include +#include #include "libslic3r/TriangleMesh.hpp" #include #include @@ -101,34 +103,6 @@ static wxColour texture_import_separator_colour() return StateColor::darkModeColorFor(wxColour(SEPARATOR_COLOUR_KEY)); } -// Orca's confirm palette, applied here rather than through Button::SetStyle because these buttons -// keep custom pill geometry that SetStyle resets. The Disabled entries are load-bearing: without -// one, StateColor::colorForStates falls through to the Normal entry and a disabled button paints -// as a live accent button. -static void apply_accent_button_colours(Button* btn) -{ - btn->SetBackgroundColor(StateColor( - std::pair(wxColour("#CECECE"), StateColor::Disabled), - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal))); - btn->SetBorderColor(StateColor( - std::pair(wxColour("#CECECE"), StateColor::Disabled), - std::pair(wxColour(0, 150, 136), StateColor::Normal))); - btn->SetTextColor(StateColor( - std::pair(wxColour("#6B6B6A"), StateColor::Disabled), - std::pair(wxColour("#FFFFFE"), StateColor::Normal))); -} - -// The same button while the parameters behind it are dirty: still clickable, but reading as -// "what you see is not what this button would apply". -static void apply_muted_button_colours(Button* btn) -{ - btn->SetBackgroundColor(wxColour("#CECECE")); - btn->SetBorderColor(wxColour("#CECECE")); - btn->SetTextColor(wxColour("#6B6B6A")); -} - static wxFont texture_import_section_title_font(wxWindow* win) { wxFont font = win ? win->GetFont() : wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); @@ -327,7 +301,7 @@ void AccentSlider::OnPaint(wxPaintEvent&) int ts = FromDIP(8); int pen_w = FromDIP(2); - wxColour accent_clr = StateColor::darkModeColorFor(IsEnabled() ? wxColour("#009688") : wxColour("#ACACAC")); + wxColour accent_clr = IsEnabled() ? wxColour("#009688") : StateColor::darkModeColorFor(wxColour("#ACACAC")); // use original accent color here to make it more readable wxColour track_clr = StateColor::darkModeColorFor(IsEnabled() ? wxColour("#CECECE") : wxColour("#DFDFDF")); int tx = xFromValue(); @@ -547,6 +521,14 @@ public: wxColour pop_bg = StateColor::darkModeColorFor(*wxWHITE); SetBackgroundColour(pop_bg); + // ORCA add border for popups. it required to add this controls because it covers all background + Bind(wxEVT_PAINT, [this](wxPaintEvent& evt) { + wxPaintDC dc(this); + dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#DBDBDB")), FromDIP(1))); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); + }); + m_content = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); m_content->SetBackgroundColour(pop_bg); m_content->SetScrollRate(0, FromDIP(20)); @@ -556,7 +538,7 @@ public: const int row_h = FromDIP(32); const int pad = FromDIP(8); const int max_visible_rows = 10; - const wxColour header_clr = StateColor::darkModeColorFor(wxColour("#ACACAC")); + const wxColour header_clr = StateColor::darkModeColorFor(wxColour("#363636")); auto add_section_header = [&](const wxString& label) { auto* hdr = new wxStaticText(m_content, wxID_ANY, label); @@ -567,7 +549,7 @@ public: outer->Add(hdr, 0, wxLEFT | wxRIGHT | wxTOP, pad); auto* line = new StaticLine(m_content); line->SetLineColour(wxColour(SEPARATOR_COLOUR_KEY)); - outer->Add(line, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM, pad); + outer->Add(line, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, pad); }; auto add_section = [&](const wxString& label, TextureFilamentKind kind) { @@ -605,7 +587,7 @@ public: add_label->SetFont(af); decompose_label->SetFont(af); const bool add_enabled = !m_can_add_filament || m_can_add_filament(); - const wxColour action_clr = StateColor::darkModeColorFor(wxColour("#009688")); + const wxColour action_clr = wxColour("#009688"); add_label->SetForegroundColour(add_enabled ? action_clr : header_clr); decompose_label->SetForegroundColour(add_enabled ? action_clr : header_clr); add_label->SetCursor(wxCursor(add_enabled ? wxCURSOR_HAND : wxCURSOR_ARROW)); @@ -659,7 +641,7 @@ public: list_h -= ((int)m_colors_rgba.size() - max_visible_rows) * row_h; m_content->SetMinSize(wxSize(pop_w, list_h)); m_content->SetMaxSize(wxSize(pop_w, list_h)); - top_sizer->Add(m_content, 0, wxEXPAND); + top_sizer->Add(m_content, 0, wxEXPAND | wxALL, FromDIP(1)); top_sizer->AddSpacer(FromDIP(4)); auto* sep_line = new StaticLine(this); @@ -714,8 +696,8 @@ private: row->SetBackgroundStyle(wxBG_STYLE_PAINT); row->SetCursor(wxCursor(wxCURSOR_HAND)); - const int sq = row->FromDIP(24); - const int sq_r = row->FromDIP(2); + const int sq = row->FromDIP(20); // ORCA match color swatch sizes + const int sq_r = row->FromDIP(0); const int sq_x = row->FromDIP(4); const int gap1 = row->FromDIP(8); @@ -754,7 +736,7 @@ private: wxFont nf = p->GetFont(); nf.SetPointSize(9); dc.SetFont(nf); - dc.SetTextForeground(paint_clr.GetLuminance() < 0.6 ? *wxWHITE : texture_import_gray9000()); + dc.SetTextForeground(paint_clr.GetLuminance() < 0.51 ? *wxWHITE : *wxBLACK); // ORCA match used foreground color with other swatches wxString ns = wxString::Format("%d", display_number((int)idx)); wxSize tsz = dc.GetTextExtent(ns); dc.DrawText(ns, sq_x + (sq - tsz.x) / 2, sq_y + (sq - tsz.y) / 2); @@ -823,9 +805,9 @@ private: wxFont font = p->GetFont(); font.SetPointSize(9); dc.SetFont(font); - int x = p->FromDIP(2); - const int sw = p->FromDIP(22); - const int sw_r = p->FromDIP(2); + int x = p->FromDIP(6); // ORCA Match left margins + const int sw = p->FromDIP(20); // ORCA Match color swatch sizes + const int sw_r = 0; //p->FromDIP(2); const int y = (sz.y - sw) / 2; for (size_t ci = 0; ci < entry.mixed_components.size() && ci < entry.mixed_ratios.size(); ++ci) { @@ -936,12 +918,20 @@ public: wxColour pop_bg = StateColor::darkModeColorFor(*wxWHITE); SetBackgroundColour(pop_bg); + // ORCA add border for popups. it required to add this controls because it covers all background + Bind(wxEVT_PAINT, [this](wxPaintEvent& evt) { + wxPaintDC dc(this); + dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#DBDBDB")), FromDIP(1))); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); + }); + auto* content = new wxPanel(this, wxID_ANY); content->SetBackgroundColour(pop_bg); content->SetBackgroundStyle(wxBG_STYLE_PAINT); auto* sizer = new wxBoxSizer(wxVERTICAL); - const int row_h = FromDIP(36); + const int row_h = FromDIP(32); const int pop_w = std::max(FromDIP(216), popup_width); sizer->Add(create_item_row(content, TextureAutoMixMode::CMYW, row_h), 0, wxEXPAND); sizer->Add(create_item_row(content, TextureAutoMixMode::RYBW, row_h), 0, wxEXPAND); @@ -966,7 +956,7 @@ private: wxPanel* create_item_row(wxWindow* parent, TextureAutoMixMode mode, int row_h) { wxColour row_bg = StateColor::darkModeColorFor(*wxWHITE); - wxColour hover_bg = StateColor::darkModeColorFor(wxColour("#F4F4F4")); + wxColour checked_bg = StateColor::darkModeColorFor(wxColour("#BFE1DE")); wxColour text_fg = texture_import_text_colour(); wxColour accent = StateColor::darkModeColorFor(wxColour("#009688")); @@ -977,15 +967,16 @@ private: row->SetCursor(wxCursor(wxCURSOR_HAND)); const int row_idx = mode == TextureAutoMixMode::CMYW ? 0 : 1; - row->Bind(wxEVT_PAINT, [this, row_bg, hover_bg, text_fg, accent, mode, row_idx](wxPaintEvent& e) { + row->Bind(wxEVT_PAINT, [this, row_bg, checked_bg, text_fg, accent, mode, row_idx](wxPaintEvent& e) { auto* p = static_cast(e.GetEventObject()); wxAutoBufferedPaintDC dc(p); wxSize sz = p->GetClientSize(); const bool hovered = (m_hover_idx == row_idx); const bool selected = (m_current_mode == mode); - dc.SetBrush(wxBrush(hovered ? hover_bg : row_bg)); - dc.SetPen(*wxTRANSPARENT_PEN); + // ORCA Match look with combo box dropdown + dc.SetBrush(wxBrush(selected ? checked_bg : row_bg)); + dc.SetPen(hovered ? wxPen(accent) : *wxTRANSPARENT_PEN); dc.DrawRectangle(0, 0, sz.x, sz.y); wxFont font = p->GetFont(); @@ -996,6 +987,7 @@ private: wxSize tsz = dc.GetTextExtent(label); dc.DrawText(label, p->FromDIP(12), (sz.y - tsz.y) / 2); + /* if (selected) { wxFont check_font = p->GetFont(); check_font.SetPointSize(12); @@ -1006,6 +998,7 @@ private: wxSize csz = dc.GetTextExtent(check); dc.DrawText(check, sz.x - p->FromDIP(16) - csz.x, (sz.y - csz.y) / 2); } + */ }); row->Bind(wxEVT_MOTION, [this, row, row_idx](wxMouseEvent& evt) { @@ -1913,7 +1906,7 @@ void TextureImportDialog::build_ui() { const wxColour dialog_bg = StateColor::darkModeColorFor(*wxWHITE); SetBackgroundColour(dialog_bg); - SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D"))); + SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636"))); wxBoxSizer* root_sizer = new wxBoxSizer(wxVERTICAL); @@ -1993,18 +1986,14 @@ void TextureImportDialog::build_preview_panel(wxWindow* parent, wxSizer* sizer) m_tab_panel->SetBackgroundColour(preview_bg); m_btn_view_original = new Button(m_tab_panel, _L("Original")); + m_btn_view_original->SetStyle(ButtonStyle::Regular, ButtonType::Parameter); m_btn_view_original->SetId(ID_VIEW_ORIGINAL); m_btn_view_multicolor = new Button(m_tab_panel, _L("Multi-Color")); + m_btn_view_multicolor->SetStyle(ButtonStyle::Regular, ButtonType::Parameter); m_btn_view_multicolor->SetId(ID_VIEW_MULTICOLOR); const int view_button_height = FromDIP(27); - m_btn_view_original->SetCornerRadius(view_button_height / 2); - m_btn_view_original->SetMinSize(wxSize(FromDIP(57), view_button_height)); - m_btn_view_original->SetFont(m_btn_view_original->GetFont().Bold()); m_btn_view_original->SetToolTip(_L("Your input texture model")); - m_btn_view_multicolor->SetCornerRadius(view_button_height / 2); - m_btn_view_multicolor->SetMinSize(wxSize(FromDIP(57), view_button_height)); - m_btn_view_multicolor->SetFont(m_btn_view_multicolor->GetFont().Bold()); m_btn_view_multicolor->SetToolTip(_L("Processed multi-color model")); wxBoxSizer* tab_sizer = new wxBoxSizer(wxHORIZONTAL); @@ -2014,7 +2003,6 @@ void TextureImportDialog::build_preview_panel(wxWindow* parent, wxSizer* sizer) m_tab_panel->Fit(); m_btn_view_multicolor->Hide(); - auto preview_original = [this](wxMouseEvent& e) { if (m_preview_canvas) { m_preview_canvas->set_render_mode(TexturePreviewCanvas::RenderMode::Original); @@ -2069,12 +2057,12 @@ void TextureImportDialog::build_preview_panel(wxWindow* parent, wxSizer* sizer) void TextureImportDialog::build_params_panel(wxWindow* parent, wxSizer* sizer) { - wxColour label_fg = StateColor::darkModeColorFor(wxColour("#323A3D")); + wxColour label_fg = StateColor::darkModeColorFor(wxColour("#363636")); wxBoxSizer* color_header_sizer = new wxBoxSizer(wxHORIZONTAL); wxStaticText* lbl_colors = new wxStaticText(parent, wxID_ANY, _L("Color Count")); lbl_colors->SetForegroundColour(label_fg); - lbl_colors->SetFont(lbl_colors->GetFont().Bold()); + lbl_colors->SetFont(Label::Head_14); color_header_sizer->Add(lbl_colors, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(8)); m_btn_color_4 = new Button(parent, "4"); @@ -2085,33 +2073,11 @@ void TextureImportDialog::build_params_panel(wxWindow* parent, wxSizer* sizer) m_btn_color_16->SetId(ID_COLOR_16); m_btn_color_auto = new Button(parent, _L("Auto")); m_btn_color_auto->SetId(ID_COLOR_AUTO); - - { - StateColor preset_bg( - std::pair(wxColour(0, 137, 123), StateColor::Pressed | StateColor::Checked), - std::pair(wxColour(38, 166, 154), StateColor::Hovered | StateColor::Checked), - std::pair(wxColour(0, 150, 136), StateColor::Checked), - std::pair(wxColour("#CECECE"), StateColor::Pressed), - std::pair(wxColour("#EEEEEE"), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - StateColor preset_bd( - std::pair(wxColour(0, 150, 136), StateColor::Checked), - std::pair(wxColour("#CECECE"), StateColor::Normal)); - StateColor preset_text( - std::pair(wxColour("#FFFFFE"), StateColor::Checked), - std::pair(wxColour("#323A3D"), StateColor::Normal)); - - for (auto* btn : {m_btn_color_4, m_btn_color_8, m_btn_color_16}) { - btn->SetCornerRadius(FromDIP(12)); - btn->SetMinSize(wxSize(FromDIP(28), FromDIP(28))); - btn->SetBackgroundColor(preset_bg); - btn->SetBorderColor(preset_bd); - btn->SetTextColor(preset_text); - } - } + m_btn_color_auto->SetStyle(ButtonStyle::Regular, ButtonType::Window); update_color_count_preset_buttons(); + color_header_sizer->AddStretchSpacer(); color_header_sizer->Add(m_btn_color_4, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(2)); color_header_sizer->Add(m_btn_color_8, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(2)); color_header_sizer->Add(m_btn_color_16, 0, wxALIGN_CENTER_VERTICAL); @@ -2134,7 +2100,7 @@ void TextureImportDialog::build_params_panel(wxWindow* parent, wxSizer* sizer) wxStaticText* lbl_smooth = new wxStaticText(parent, wxID_ANY, _L("Smooth Level")); lbl_smooth->SetForegroundColour(label_fg); - lbl_smooth->SetFont(lbl_smooth->GetFont().Bold()); + lbl_smooth->SetFont(Label::Head_14); sizer->Add(lbl_smooth, 0, wxBOTTOM, FromDIP(4)); wxBoxSizer* smooth_sizer = new wxBoxSizer(wxHORIZONTAL); @@ -2154,27 +2120,7 @@ void TextureImportDialog::build_params_panel(wxWindow* parent, wxSizer* sizer) m_btn_apply = new Button(parent, _L("Apply")); m_btn_apply->SetId(ID_BTN_APPLY); - - { - StateColor btn_bg_white( - std::pair(wxColour("#CECECE"), StateColor::Pressed), - std::pair(wxColour("#EEEEEE"), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - const wxColour btn_bd_accent = wxColour(0, 150, 136); - const wxColour btn_text_accent = wxColour(0, 150, 136); - - m_btn_color_auto->SetCornerRadius(FromDIP(12)); - m_btn_color_auto->SetMinSize(wxSize(FromDIP(60), FromDIP(28))); - m_btn_color_auto->SetBackgroundColor(btn_bg_white); - m_btn_color_auto->SetBorderColor(btn_bd_accent); - m_btn_color_auto->SetTextColor(btn_text_accent); - - m_btn_apply->SetCornerRadius(FromDIP(12)); - m_btn_apply->SetMinSize(wxSize(FromDIP(60), FromDIP(28))); - m_btn_apply->SetBackgroundColor(btn_bg_white); - m_btn_apply->SetBorderColor(btn_bd_accent); - m_btn_apply->SetTextColor(btn_text_accent); - } + m_btn_apply->SetStyle(ButtonStyle::Regular, ButtonType::Window); // Defer attaching the Auto/Apply tooltips until the dialog has actually // been shown. On macOS, AppKit creates NSTrackingArea and dispatches a @@ -2198,7 +2144,7 @@ void TextureImportDialog::build_params_panel(wxWindow* parent, wxSizer* sizer) wxBoxSizer* apply_sizer = new wxBoxSizer(wxHORIZONTAL); apply_sizer->Add(m_btn_color_auto, 0, wxRIGHT, FromDIP(4)); apply_sizer->Add(m_btn_apply, 0); - sizer->Add(apply_sizer, 0, wxALIGN_RIGHT | wxBOTTOM, FromDIP(8)); + sizer->Add(apply_sizer, 0, wxALIGN_RIGHT | wxBOTTOM | wxTOP, FromDIP(8)); m_hint_label = new wxStaticText(parent, wxID_ANY, _L("Reminder: parameters changed, click Apply to take effect")); @@ -2214,27 +2160,19 @@ void TextureImportDialog::build_params_panel(wxWindow* parent, wxSizer* sizer) void TextureImportDialog::build_mapping_panel(wxWindow* parent, wxSizer* sizer) { - wxColour secondary_fg = StateColor::darkModeColorFor(wxColour("#6B6B6B")); + wxColour secondary_fg = StateColor::darkModeColorFor(wxColour("#363636")); wxBoxSizer* header_sizer = new wxBoxSizer(wxHORIZONTAL); wxStaticText* lbl_mapping = new wxStaticText(parent, wxID_ANY, _L("Filament Mapping")); lbl_mapping->SetForegroundColour(secondary_fg); - lbl_mapping->SetFont(texture_import_section_title_font(parent)); + lbl_mapping->SetFont(Label::Head_14); m_auto_mix_font_point_size = lbl_mapping->GetFont().GetPointSize(); header_sizer->Add(lbl_mapping, 0, wxALIGN_CENTER_VERTICAL); m_btn_mix_reset = new Button(parent, "", "revert_btn", wxBORDER_NONE, 16); m_btn_mix_reset->SetCanFocus(false); - m_btn_mix_reset->SetPaddingSize(wxSize(FromDIP(2), FromDIP(2))); - { - StateColor reset_bg( - std::pair(wxColour("#F4F4F4"), StateColor::Pressed), - std::pair(wxColour("#F8F8F8"), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - m_btn_mix_reset->SetBackgroundColor(reset_bg); - m_btn_mix_reset->SetBorderColor(StateColor()); - } + m_btn_mix_reset->SetStyle(ButtonStyle::Regular, ButtonType::Icon); m_btn_mix_reset->SetToolTip(_L("Reset filament mapping to the state before one-click mixing")); m_btn_mix_reset->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) { reset_auto_mix(); @@ -2245,31 +2183,10 @@ void TextureImportDialog::build_mapping_panel(wxWindow* parent, wxSizer* sizer) header_sizer->AddStretchSpacer(); - m_btn_auto_mix = new Button(parent, auto_mix_mode_label(m_auto_mix_mode)); - { - wxFont btn_font = m_btn_auto_mix->GetFont(); - btn_font.SetPointSize(m_auto_mix_font_point_size); - m_btn_auto_mix->SetFont(btn_font); - } - m_btn_auto_mix->SetCornerRadius(FromDIP(14)); - m_btn_auto_mix->SetMinSize(wxSize(FromDIP(178), FromDIP(28))); - { - StateColor btn_bg( - std::pair(wxColour("#F4F4F4"), StateColor::Pressed), - std::pair(wxColour("#F8F8F8"), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - const wxColour btn_bd = wxColour("#CECECE"); - const wxColour btn_text = texture_import_gray9000(); - m_btn_auto_mix->SetBackgroundColor(btn_bg); - m_btn_auto_mix->SetBorderColor(btn_bd); - m_btn_auto_mix->SetTextColor(btn_text); - } + m_btn_auto_mix = new Button(parent, auto_mix_mode_label(m_auto_mix_mode), "drop_down", 0, 16); + m_btn_auto_mix->SetStyle(ButtonStyle::Regular, ButtonType::Parameter); m_btn_auto_mix->SetToolTip(_L("Choose the one-click auto-mix mode for texture color import")); - m_btn_auto_mix->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& evt) { - show_auto_mix_popup(); - evt.Skip(); - }); - m_btn_auto_mix->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& evt) { + m_btn_auto_mix->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) { // ORCA show popup on click instead show_auto_mix_popup(); evt.Skip(); }); @@ -2279,11 +2196,12 @@ void TextureImportDialog::build_mapping_panel(wxWindow* parent, wxSizer* sizer) wxBoxSizer* merge_sizer = new wxBoxSizer(wxHORIZONTAL); m_auto_merge_cb = new wxCheckBox(parent, wxID_ANY, _L("Auto-merge same filament")); + m_auto_merge_cb->SetFont(Label::Body_14); m_auto_merge_cb->SetToolTip(_L("Automatically merge identical filaments into existing filaments in the project")); m_auto_merge_cb->SetForegroundColour(secondary_fg); m_auto_merge_cb->SetValue(true); m_auto_merge_cb->Bind(wxEVT_CHECKBOX, &TextureImportDialog::on_auto_merge_toggled, this); - merge_sizer->Add(m_auto_merge_cb, 0, wxALIGN_CENTER_VERTICAL); + merge_sizer->Add(m_auto_merge_cb, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, FromDIP(5)); sizer->Add(merge_sizer, 0, wxEXPAND | wxBOTTOM, FromDIP(8)); @@ -2316,29 +2234,16 @@ void TextureImportDialog::build_bottom_buttons(wxSizer* sizer) m_btn_skip = new Button(this, _L("Skip Matching")); m_btn_skip->SetId(ID_BTN_SKIP); m_btn_skip->SetToolTip(_L("Skip filament mapping and import as a single-color model")); - m_btn_skip->SetCornerRadius(FromDIP(20)); - m_btn_skip->SetMinSize(wxSize(FromDIP(136), FromDIP(40))); - { - StateColor skip_bg( - std::pair(wxColour("#CECECE"), StateColor::Pressed), - std::pair(wxColour("#EEEEEE"), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - const wxColour skip_bd = wxColour("#CECECE"); - const wxColour skip_text = wxColour("#6B6B6A"); - m_btn_skip->SetBackgroundColor(skip_bg); - m_btn_skip->SetBorderColor(skip_bd); - m_btn_skip->SetTextColor(skip_text); - } + m_btn_skip->SetStyle(ButtonStyle::Regular, ButtonType::Choice); m_btn_ok = new Button(this, _L("Confirm")); m_btn_ok->SetId(wxID_OK); - m_btn_ok->SetCornerRadius(FromDIP(20)); - m_btn_ok->SetMinSize(wxSize(FromDIP(156), FromDIP(40))); - apply_accent_button_colours(m_btn_ok); - + m_btn_ok->SetStyle(ButtonStyle::Confirm, ButtonType::Choice); + m_btn_ok->EnableTooltipEvenDisabled(); + btn_sizer->AddStretchSpacer(); - btn_sizer->Add(m_btn_skip, 0, wxRIGHT, FromDIP(16)); - btn_sizer->Add(m_btn_ok, 0); + btn_sizer->Add(m_btn_ok, 0, wxRIGHT, FromDIP(16)); // Match ordering of choice buttons on whole UI + btn_sizer->Add(m_btn_skip, 0); sizer->Add(btn_sizer, 0, wxEXPAND | wxTOP, FromDIP(8)); } @@ -2675,11 +2580,11 @@ void TextureImportDialog::on_mesh_repair_decision_required(wxCommandEvent&) // with the same type swaps only the palette and leaves the geometry alone. if (auto* yes_btn = dynamic_cast(dlg.FindWindow(wxID_YES))) { yes_btn->SetStyle(ButtonStyle::Regular, ButtonType::Choice); - yes_btn->SetMinSize(wxSize(FromDIP(180), FromDIP(24))); + //yes_btn->SetMinSize(wxSize(FromDIP(180), FromDIP(32))); // Height not matches and will cause issues on longer translations. let dialog manages it } if (auto* no_btn = dynamic_cast(dlg.FindWindow(wxID_NO))) { no_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Choice); - no_btn->SetMinSize(wxSize(FromDIP(160), FromDIP(24))); + //no_btn->SetMinSize(wxSize(FromDIP(160), FromDIP(32))); // Height not matches and will cause issues on longer translations. let dialog manages it } dlg.Layout(); dlg.Fit(); @@ -3739,7 +3644,7 @@ void TextureImportDialog::rebuild_mapping_rows() const wxColour dash_clr = StateColor::darkModeColorFor(wxColour("#ACACAC")); const wxColour hex_fg = texture_import_text_colour(); - const wxColour card_bg = StateColor::darkModeColorFor(wxColour("#E8E8E8")); + const wxColour card_bg = StateColor::darkModeColorFor(wxColour("#FFFFFF")); const wxColour card_bd = StateColor::darkModeColorFor(wxColour("#DBDBDB")); const wxColour name_fg = texture_import_text_colour(); const wxColour chev_clr = StateColor::darkModeColorFor(wxColour("#6B6B6A")); @@ -3766,7 +3671,7 @@ void TextureImportDialog::rebuild_mapping_rows() // --- Source card (dashed border, circle + hex) --- const int src_w = FromDIP(138); const int target_min_w = FromDIP(239); - const int row_h = FromDIP(44); + const int row_h = FromDIP(32); // ORCA compact row height row.source_panel = new wxPanel(row_panel, wxID_ANY, wxDefaultPosition, wxSize(src_w, row_h), wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE); row.source_panel->SetMinSize(wxSize(src_w, row_h)); @@ -3785,12 +3690,12 @@ void TextureImportDialog::rebuild_mapping_rows() wxPen dash_pen(dash_clr, 1, wxPENSTYLE_SHORT_DASH); dc.SetPen(dash_pen); dc.SetBrush(wxBrush(p->GetParent()->GetBackgroundColour())); - int r = p->FromDIP(8); + int r = 0; //p->FromDIP(8); dc.DrawRoundedRectangle(0, 0, sz.x, sz.y, r); - // Color circle 24px - int cd = p->FromDIP(24); - int cx = p->FromDIP(10); + // Color circle 20px + int cd = p->FromDIP(20); // ORCA match size of swatches + int cx = p->FromDIP(6); // ORCA match margins int cy = (sz.y - cd) / 2; dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(src_wx_color)); @@ -3874,7 +3779,7 @@ void TextureImportDialog::rebuild_mapping_rows() if (ci >= m_mapping_rows.size()) return; int fil_idx = m_mapping_rows[ci].target_filament_idx; - int r = p->FromDIP(8); + int r = 0; //p->FromDIP(8); dc.SetBrush(wxBrush(card_bg)); dc.SetPen(wxPen(card_bd, 1)); dc.DrawRoundedRectangle(0, 0, sz.x, sz.y, r); @@ -3886,9 +3791,9 @@ void TextureImportDialog::rebuild_mapping_rows() mixed_font.SetPointSize(10); dc.SetFont(mixed_font); - int x = p->FromDIP(10); - const int sw = p->FromDIP(28); - const int sw_r = p->FromDIP(6); + int x = p->FromDIP(6);// ORCA Match left margins + const int sw = p->FromDIP(20); // ORCA match size of swatches + const int sw_r = 0; //p->FromDIP(6); const int sw_y = (sz.y - sw) / 2; for (size_t mi = 0; mi < entry.mixed_components.size() && mi < entry.mixed_ratios.size(); ++mi) { if (mi > 0) { @@ -3916,7 +3821,7 @@ void TextureImportDialog::rebuild_mapping_rows() wxString num_str = wxString::Format("%d", display_number(comp_idx)); wxSize nsz = dc.GetTextExtent(num_str); - dc.SetTextForeground(comp_clr.GetLuminance() < 0.6 ? *wxWHITE : texture_import_gray9000()); + dc.SetTextForeground(comp_clr.GetLuminance() < 0.51 ? *wxWHITE : *wxBLACK); // ORCA match used foreground color with other swatches dc.DrawText(num_str, x + (sw - nsz.x) / 2, sw_y + (sw - nsz.y) / 2); x += sw + p->FromDIP(5); @@ -3940,10 +3845,10 @@ void TextureImportDialog::rebuild_mapping_rows() } // Numbered color square 32x32, rounded 6px - int sq = p->FromDIP(32); - int sq_x = p->FromDIP(6); + int sq = p->FromDIP(20); // ORCA match size of swatches + int sq_x = p->FromDIP(6);// ORCA Match left margins int sq_y = (sz.y - sq) / 2; - int sq_r = p->FromDIP(6); + int sq_r = 0; //p->FromDIP(6); wxColour fil_clr = get_target_wxcolor(fil_idx); dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(fil_clr)); @@ -3954,7 +3859,7 @@ void TextureImportDialog::rebuild_mapping_rows() wxFont num_font = p->GetFont(); num_font.SetPointSize(10); dc.SetFont(num_font); - dc.SetTextForeground(fil_clr.GetLuminance() < 0.6 ? *wxWHITE : texture_import_gray9000()); + dc.SetTextForeground(fil_clr.GetLuminance() < 0.51 ? *wxWHITE : *wxBLACK); // ORCA match used foreground color with other swatches wxString num_str = wxString::Format("%d", display_number(fil_idx)); wxSize nsz = dc.GetTextExtent(num_str); dc.DrawText(num_str, sq_x + (sq - nsz.x) / 2, sq_y + (sq - nsz.y) / 2); @@ -4030,9 +3935,12 @@ std::vector TextureImportDialog::build_matches_from_rows( void TextureImportDialog::update_color_count_preset_buttons() { - if (m_btn_color_4) m_btn_color_4->SetValue(m_param_color_count == 4); - if (m_btn_color_8) m_btn_color_8->SetValue(m_param_color_count == 8); - if (m_btn_color_16) m_btn_color_16->SetValue(m_param_color_count == 16); + auto update = [this](auto* btn, int count) { + if (btn) btn->SetStyle(m_param_color_count == count ? ButtonStyle::Confirm : ButtonStyle::Regular, ButtonType::Window); + }; + update(m_btn_color_4 , 4); + update(m_btn_color_8 , 8); + update(m_btn_color_16, 16); } void TextureImportDialog::set_color_count_value(int value, bool update_spin) @@ -4161,27 +4069,9 @@ void TextureImportDialog::highlight_view_button(int view_index) { Button* btns[] = { m_btn_view_original, m_btn_view_multicolor }; - // The inactive pill lies on m_tab_panel, which is preview_bg (#EEEEEE -> #4C4C55), and has to - // read as raised above that strip in both themes — so its fill steps away from the strip in - // opposite directions. gDarkColors pairs one light tone with one dark tone and cannot express - // an inversion, so the two are picked here the way filament_swatch_border_colour() does. - const bool dark_pill = is_dark(); - StateColor inactive_bg( - std::pair(dark_pill ? wxColour(0x5C, 0x5C, 0x64) : wxColour("#F4F4F4"), StateColor::Pressed), - std::pair(dark_pill ? wxColour(0x66, 0x66, 0x6E) : wxColour("#F8F8F8"), StateColor::Hovered), - std::pair(dark_pill ? wxColour(0x54, 0x54, 0x5B) : *wxWHITE, StateColor::Normal)); - const wxColour inactive_bd = dark_pill ? wxColour(0x54, 0x54, 0x5B) : *wxWHITE; - const wxColour inactive_text = wxColour("#6B6B6A"); - for (int i = 0; i < 2; ++i) { if (!btns[i]) continue; - if (i == view_index) { - apply_accent_button_colours(btns[i]); - } else { - btns[i]->SetBackgroundColor(inactive_bg); - btns[i]->SetBorderColor(inactive_bd); - btns[i]->SetTextColor(inactive_text); - } + btns[i]->SetStyle(i == view_index ? ButtonStyle::Confirm : ButtonStyle::Regular, ButtonType::Parameter); btns[i]->Refresh(); } } @@ -4259,10 +4149,8 @@ void TextureImportDialog::update_confirm_button_state() void TextureImportDialog::style_confirm_button(bool dirty) { if (dirty) { - apply_muted_button_colours(m_btn_ok); m_btn_ok->SetToolTip(_L("Reminder: parameters changed, click Apply to take effect")); } else { - apply_accent_button_colours(m_btn_ok); m_btn_ok->UnsetToolTip(); } if (m_hint_label) @@ -4308,33 +4196,10 @@ void TextureImportDialog::on_dpi_changed(const wxRect&) const int view_button_height = FromDIP(27); for (Button* btn : {m_btn_view_original, m_btn_view_multicolor}) { - if (btn) { - btn->SetCornerRadius(view_button_height / 2); - btn->SetMinSize(wxSize(FromDIP(57), view_button_height)); - } + if (btn) btn->Rescale(); // ORCA Rescale applies all style automatically when combined with SetStyle } - for (Button* btn : {m_btn_color_4, m_btn_color_8, m_btn_color_16}) { - if (btn) { - btn->SetCornerRadius(FromDIP(12)); - btn->SetMinSize(wxSize(FromDIP(28), FromDIP(28))); - } - } - - if (m_btn_color_auto) { - m_btn_color_auto->SetCornerRadius(FromDIP(12)); - m_btn_color_auto->SetMinSize(wxSize(FromDIP(60), FromDIP(28))); - } - if (m_btn_apply) { - m_btn_apply->SetCornerRadius(FromDIP(12)); - m_btn_apply->SetMinSize(wxSize(FromDIP(60), FromDIP(28))); - } - if (m_btn_auto_mix) { - m_btn_auto_mix->SetCornerRadius(FromDIP(14)); - m_btn_auto_mix->SetMinSize(wxSize(FromDIP(178), FromDIP(28))); - } - if (m_btn_mix_reset) - m_btn_mix_reset->SetPaddingSize(wxSize(FromDIP(2), FromDIP(2))); + update_color_count_preset_buttons(); // ORCA Rescale applies all style automatically when combined with SetStyle if (m_color_spin) m_color_spin->SetMinSize(wxSize(FromDIP(60), FromDIP(28))); @@ -4346,14 +4211,13 @@ void TextureImportDialog::on_dpi_changed(const wxRect&) m_mapping_scroll->SetScrollRate(0, FromDIP(20)); } - if (m_btn_skip) { - m_btn_skip->SetCornerRadius(FromDIP(20)); - m_btn_skip->SetMinSize(wxSize(FromDIP(136), FromDIP(40))); - } - if (m_btn_ok) { - m_btn_ok->SetCornerRadius(FromDIP(20)); - m_btn_ok->SetMinSize(wxSize(FromDIP(156), FromDIP(40))); - } + // ORCA Rescale applies all style automatically when combined with SetStyle + if (m_btn_skip) m_btn_skip->Rescale(); + if (m_btn_ok) m_btn_ok->Rescale(); + if (m_btn_color_auto) m_btn_color_auto->Rescale(); + if (m_btn_apply) m_btn_apply->Rescale(); + if (m_btn_auto_mix) m_btn_auto_mix->Rescale(); + if (m_btn_mix_reset) m_btn_mix_reset->Rescale(); // Mapping rows store their panel sizes (source/target/arrow/row height) // as fixed FromDIP min/max sizes, so rebuild them to pick up the new DPI. diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 8a9693f750..43e271cceb 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -1623,10 +1623,6 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres wxString label = option.label_local; if (type == Preset::TYPE_PRINTER && variant_index >= 0 && printer_options_with_variant_2.count(get_pure_opt_key(opt_key)) > 0) { - // Orca: silent_mode is obsolete on import, but its option and two-column UI still exist. - // Keep mode labels for configs that explicitly enable it; omit them in the default single-mode UI. - if (new_config.opt_bool("silent_mode")) - label += " (" + (variant_index % 2 == 0 ? _L("Normal") : _L("Silent")) + ")"; variant_index /= 2; } if (variant_index >= 0 && extruder_variant && variant_index < extruder_variant->size()) { diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index d6fc4a7170..578d33ffd0 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -832,7 +832,7 @@ void WebViewPanel::SendDesignStaffpick(bool on) void WebViewPanel::OpenModelDetail(std::string id, NetworkAgent *agent) { std::string url; - if ((agent ? agent->get_model_mall_detail_url(&url, id) : get_model_mall_detail_url(&url, id)) == 0) + if ((agent ? agent->get_model_mall_detail_url(&url, id, wxGetApp().get_printer_cloud_provider()) : get_model_mall_detail_url(&url, id)) == 0) { if (url.find("?") != std::string::npos) { diff --git a/src/slic3r/GUI/Widgets/Label.cpp b/src/slic3r/GUI/Widgets/Label.cpp index da5e9b72af..0e5d9eab43 100644 --- a/src/slic3r/GUI/Widgets/Label.cpp +++ b/src/slic3r/GUI/Widgets/Label.cpp @@ -310,7 +310,7 @@ Label::Label(wxWindow *parent, wxFont const &font, wxString const &text, long st SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent)); SetForegroundColour("#262E30"); if (style & LB_PROPAGATE_MOUSE_EVENT) { - for (auto evt : { wxEVT_LEFT_UP, wxEVT_LEFT_DOWN }) + for (auto evt : { wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK}) // ORCA also propagete LEFT_DCLICK event that used on sidebar titlebars Bind(evt, [this] (auto & e) { GetParent()->GetEventHandler()->ProcessEventLocally(e); }); }; if (style & LB_AUTO_WRAP) { diff --git a/src/slic3r/GUI/Widgets/PopupWindow.cpp b/src/slic3r/GUI/Widgets/PopupWindow.cpp index 371ece392b..a8273b5ce6 100644 --- a/src/slic3r/GUI/Widgets/PopupWindow.cpp +++ b/src/slic3r/GUI/Widgets/PopupWindow.cpp @@ -2,6 +2,11 @@ #include #include +#ifdef __WXGTK__ +#include +#include "slic3r/GUI/LinuxDisplayBackend.hpp" +#endif + static wxWindow *GetTopParent(wxWindow *pWindow) { wxWindow *pWin = pWindow; @@ -85,10 +90,56 @@ void PopupWindow::OnMouseEvent2(wxMouseEvent &evt) #endif #ifdef __WXGTK__ +template static void for_each_tooltip_window(Fn fn) +{ + GList *toplevels = gtk_window_list_toplevels(); + for (GList *l = toplevels; l; l = l->next) + if (gtk_window_get_type_hint(GTK_WINDOW(l->data)) == GDK_WINDOW_TYPE_HINT_TOOLTIP) + fn(GTK_WINDOW(l->data)); + g_list_free(toplevels); +} + +bool PopupWindow::Show(bool show) +{ + // On Wayland a shown GTK tooltip is itself an xdg_popup, and GDK maps a new popup only as a child of + // the topmost one ("Tried to map a popup with a non-top most parent"). GTK hides the tooltip on a + // click or key press only after the widgets have handled it, so a popup opened from that click would + // never appear. GtkMenu hides the tooltip first for the same reason, through a private call; hiding the + // tooltip window is the public equivalent, and GtkTooltip then treats it as closed and shows it again + // on a later hover. + if (show && !IsShown() && Slic3r::GUI::is_running_on_wayland()) + for_each_tooltip_window([](GtkWindow *win) { gtk_widget_hide(GTK_WIDGET(win)); }); + return wxPopupTransientWindow::Show(show); +} + +// Whether a tooltip of a widget in this popup, or in a popup opened from it, is on screen. Such a tooltip is +// transient for the window of the popup holding the widget, and that popup is transient for the one it opened from. +static bool own_tooltip_mapped(GtkWindow *popup) +{ + bool mapped = false; + for_each_tooltip_window([popup, &mapped](GtkWindow *win) { + // The compositor can dismiss a tooltip without GTK hiding the widget, so ask GDK whether it is mapped. + GdkWindow *gdk_win = gtk_widget_get_window(GTK_WIDGET(win)); + if (!gdk_win || !gdk_window_is_visible(gdk_win)) + return; + for (GtkWindow *w = gtk_window_get_transient_for(win); w && !mapped; w = gtk_window_get_transient_for(w)) + mapped = w == popup; + }); + return mapped; +} + +// On Wayland, a GTK tooltip of a widget in a shown popup takes the keyboard focus from the toplevel, which then +// reports a deactivation while the user is still on the popup: GTK makes the tooltip transient for the popup's +// window, which holds the seat grab, so GDK maps the tooltip as an xdg_popup with a grab of its own, and the +// compositor gives the keyboard to the topmost grabbing popup. The toplevel is activated again when the tooltip +// hides, so that deactivation is ignored. wxGTK reports no second deactivation until the next activation, so if +// the app loses the focus while such a tooltip holds it (another app's window taking the focus, a gesture), the +// popup stays open until the user returns. X11 tooltips never take the focus. void PopupWindow::topWindowActiavate(wxActivateEvent &event) { event.Skip(); - if (!event.GetActive() && IsShown() && ShouldDismissOnTopWindowDeactivate()) + if (!event.GetActive() && IsShown() && ShouldDismissOnTopWindowDeactivate() && + !(Slic3r::GUI::is_running_on_wayland() && own_tooltip_mapped(GTK_WINDOW(m_widget)))) DismissAndNotify(); } #endif diff --git a/src/slic3r/GUI/Widgets/PopupWindow.hpp b/src/slic3r/GUI/Widgets/PopupWindow.hpp index 45afea8213..a95a04e214 100644 --- a/src/slic3r/GUI/Widgets/PopupWindow.hpp +++ b/src/slic3r/GUI/Widgets/PopupWindow.hpp @@ -14,6 +14,9 @@ public: PopupWindow(wxWindow *parent, int style = wxBORDER_NONE) { Create(parent, style); } bool Create(wxWindow *parent, int flags = wxBORDER_NONE); +#ifdef __WXGTK__ + bool Show(bool show = true) override; +#endif #ifdef __WXMSW__ void BindUnfocusEvent(); #endif diff --git a/src/slic3r/Utils/BBLPrinterAgent.cpp b/src/slic3r/Utils/BBLPrinterAgent.cpp index 7fde77a075..fbf4826184 100644 --- a/src/slic3r/Utils/BBLPrinterAgent.cpp +++ b/src/slic3r/Utils/BBLPrinterAgent.cpp @@ -7,6 +7,8 @@ #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/DeviceCore/DevManager.h" +#include +#include #include #include #include @@ -16,6 +18,7 @@ #include #include #include +#include #include #include using json = nlohmann::json; @@ -64,12 +67,16 @@ const BambuFilamentIdMap& bambu_filament_id_map() return map; } -// Rewrites every string under "tray_info_idx", "filament_id" or "filamentId", at any depth, in place. +// Keys whose string value is a filament id. "cate" and "fila_id" are the H2C nozzle rack's: the +// auto nozzle mapping request and the rack status in the push message. +constexpr std::array filament_id_keys{"tray_info_idx", "filament_id", "filamentId", "cate", "fila_id"}; + +// Rewrites every string under a filament id key, at any depth, in place. void rewrite_filament_ids(json& j, const std::unordered_map& map) { if (j.is_object()) { for (auto& [key, value] : j.items()) { - if (value.is_string() && (key == "tray_info_idx" || key == "filament_id" || key == "filamentId")) { + if (value.is_string() && std::find(filament_id_keys.begin(), filament_id_keys.end(), key) != filament_id_keys.end()) { auto it = map.find(value.get_ref()); if (it != map.end()) value = it->second; @@ -84,8 +91,8 @@ void rewrite_filament_ids(json& j, const std::unordered_map& map) { - if (map.empty() || (text.find("tray_info_idx") == std::string::npos && text.find("filament_id") == std::string::npos && - text.find("filamentId") == std::string::npos)) + if (map.empty() || std::none_of(filament_id_keys.begin(), filament_id_keys.end(), + [&text](std::string_view key) { return text.find(key) != std::string::npos; })) return text; // nothing to map, skip the parse (moved, not copied) try { json j = json::parse(text); @@ -126,6 +133,11 @@ std::string BBLPrinterAgent::to_orca_filament_id(const std::string& printer_fila } std::string BBLPrinterAgent::from_orca_filament_id(const std::string& orca_filament_id) const +{ + return bambu_filament_id(orca_filament_id); +} + +std::string BBLPrinterAgent::bambu_filament_id(const std::string& orca_filament_id) { const auto& map = bambu_filament_id_map().to_bambu; auto it = map.find(orca_filament_id); diff --git a/src/slic3r/Utils/BBLPrinterAgent.hpp b/src/slic3r/Utils/BBLPrinterAgent.hpp index 2a273afe47..02e45276b6 100644 --- a/src/slic3r/Utils/BBLPrinterAgent.hpp +++ b/src/slic3r/Utils/BBLPrinterAgent.hpp @@ -101,6 +101,9 @@ public: // scripts/update_bambu_filament_ids.py). An id without a map row is returned as it is. std::string to_orca_filament_id(const std::string& printer_filament_id) const override; std::string from_orca_filament_id(const std::string& orca_filament_id) const override; + // The same translation for Bambu-keyed data (filaments_color_codes.json) read while another + // agent, or none, is live. + static std::string bambu_filament_id(const std::string& orca_filament_id); // Rewrite every string under "tray_info_idx", "filament_id" or "filamentId", at any depth, // in a JSON document (an MQTT payload or PrintParams::ams_mapping_info). Text that does not diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index a15dffa76a..e23e7645c9 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -181,7 +181,7 @@ void update_speed_parameter( const std::string& key) } } -std::vector generate_max_speed_parameter_value(const std::string &key, const bool linear, const int pass) +std::vector generate_max_speed_parameter_value(const std::string &key, const float line_width, const float layer_height, const bool linear, const int pass) { auto preset_bundle = wxGetApp().preset_bundle; auto &printer_config = preset_bundle->printers.get_edited_preset().config; @@ -193,8 +193,6 @@ std::vector generate_max_speed_parameter_value(const std::string &key, c std::vector nozzle_volume_types = preset_bundle->project_config.option("nozzle_volume_type")->values; float nozzle_diameter = printer_config.option("nozzle_diameter")->values[0]; - float layer_height = print_config.option("layer_height")->value; - float line_width = print_config.get_abs_value("line_width", nozzle_diameter); Flow flow = Flow(line_width, layer_height, nozzle_diameter); diff --git a/src/slic3r/Utils/CalibUtils.hpp b/src/slic3r/Utils/CalibUtils.hpp index 00b9e0020c..5bd4a0a04a 100644 --- a/src/slic3r/Utils/CalibUtils.hpp +++ b/src/slic3r/Utils/CalibUtils.hpp @@ -101,7 +101,7 @@ extern void get_default_k_n_value(const std::string &filament_id, float &k, floa extern wxString get_nozzle_volume_type_name(NozzleVolumeType type); extern void update_speed_parameter(const std::string &key); -extern std::vector generate_max_speed_parameter_value(const std::string &key, bool linear, int pass); +extern std::vector generate_max_speed_parameter_value(const std::string &key, float line_width, float layer_height, bool linear, int pass); } } \ No newline at end of file diff --git a/src/slic3r/Utils/FontConfigHelp.cpp b/src/slic3r/Utils/FontConfigHelp.cpp index 81f7d9784c..8e21051a28 100644 --- a/src/slic3r/Utils/FontConfigHelp.cpp +++ b/src/slic3r/Utils/FontConfigHelp.cpp @@ -11,6 +11,9 @@ #include #include +#include +#include +#include #include "libslic3r/Utils.hpp" @@ -22,11 +25,26 @@ static std::optional finalize_guard; // cache for Loading of the default configuration file and building information about the available fonts. static FcConfig *fc = nullptr; +// The bundled fonts can be registered only in wx's own font configuration (Label::initSysFont), +// so add them here too, to find the files of the faces wx offers. They are added file by file: +// adding the directory writes a font cache for its path, which in an AppImage differs on every start. +static FcConfig *load_font_config() +{ + FcConfig *config = FcInitLoadConfigAndFonts(); + if (config == nullptr) + return nullptr; + boost::system::error_code ec; + for (const auto &entry : boost::filesystem::directory_iterator(Slic3r::resources_dir() + "/fonts", ec)) + if (entry.path().extension() == ".ttf") + FcConfigAppFontAddFile(config, (const FcChar8 *) entry.path().string().c_str()); + return config; +} + std::string Slic3r::GUI::get_font_path(const wxFont &font, bool reload_fonts) { if (!finalize_guard.has_value()) { FcInit(); - fc = FcInitLoadConfigAndFonts(); + fc = load_font_config(); finalize_guard.emplace([]() { // Some internal problem of Font config or other library use FC too(like wxWidget) // fccache.c:795: FcCacheFini: Assertion `fcCacheChains[i] == NULL' failed. @@ -35,7 +53,7 @@ std::string Slic3r::GUI::get_font_path(const wxFont &font, bool reload_fonts) }); } else if (reload_fonts) { FcConfigDestroy(fc); - fc = FcInitLoadConfigAndFonts(); + fc = load_font_config(); } if (fc == nullptr) return ""; @@ -103,10 +121,10 @@ std::string Slic3r::GUI::get_font_path(const wxFont &font, bool reload_fonts) FcPatternAddInteger(matchPattern, FC_WEIGHT, weight); FcPatternAddInteger(matchPattern, FC_WIDTH, width); - FcConfigSubstitute(NULL, matchPattern, FcMatchPattern); + FcConfigSubstitute(fc, matchPattern, FcMatchPattern); FcDefaultSubstitute(matchPattern); - FcPattern *resultPattern = FcFontMatch(NULL, matchPattern, &res); + FcPattern *resultPattern = FcFontMatch(fc, matchPattern, &res); if (resultPattern == nullptr) return ""; ScopeGuard sg_rp([resultPattern]() { FcPatternDestroy(resultPattern); }); diff --git a/src/slic3r/Utils/MoonrakerPrinterAgent.cpp b/src/slic3r/Utils/MoonrakerPrinterAgent.cpp index 8494eb5cfd..731d0c007e 100644 --- a/src/slic3r/Utils/MoonrakerPrinterAgent.cpp +++ b/src/slic3r/Utils/MoonrakerPrinterAgent.cpp @@ -146,6 +146,14 @@ beast::error_code run_until_done(net::io_context& ioc, const std::atomic& return done ? result : beast::error_code{net::error::operation_aborted}; } +Slic3r::Http::ProgressFn cancel_when(std::function cancelled) +{ + if (!cancelled) { + return {}; + } + return [cancelled = std::move(cancelled)](Slic3r::Http::Progress, bool& cancel) { cancel = cancelled(); }; +} + uint64_t steady_now_ms() { return static_cast( @@ -214,9 +222,6 @@ int MoonrakerPrinterAgent::connect_printer(const PrinterConnectionParams& params gen = ++connect_generation; base_url = device_info.base_url; api_key = device_info.api_key; - if (connect_thread.joinable()) { - connect_thread.detach(); - } } // Stop existing status stream and clear state @@ -232,7 +237,20 @@ int MoonrakerPrinterAgent::connect_printer(const PrinterConnectionParams& params // Launch connection in background thread (capture by value to avoid data races) { std::lock_guard lock(connect_mutex); - connect_thread = std::thread([this, dev_id = params.dev_id, base_url, api_key, gen]() { perform_connection_async(dev_id, base_url, api_key, gen); }); + // Each connection thread joins the one it supersedes, so the destructor's join waits for all of them + // Shared, so a failed thread start does not destroy the superseded thread while it is still joinable + auto superseded = std::make_shared(std::move(connect_thread)); + try { + connect_thread = std::thread([this, dev_id = params.dev_id, base_url, api_key, gen, superseded]() { + perform_connection_async(dev_id, base_url, api_key, gen); + if (superseded->joinable()) { + superseded->join(); + } + }); + } catch (...) { + connect_thread = std::move(*superseded); + throw; + } } return BAMBU_NETWORK_SUCCESS; @@ -244,9 +262,6 @@ int MoonrakerPrinterAgent::disconnect_printer() std::lock_guard lock(connect_mutex); device_info = MoonrakerDeviceInfo{}; ++connect_generation; // Invalidate any in-flight connection - if (connect_thread.joinable()) { - connect_thread.detach(); - } } stop_status_stream(); @@ -1123,10 +1138,11 @@ bool MoonrakerPrinterAgent::init_device_info(const std::string& dev_id, const st return true; } -bool MoonrakerPrinterAgent::fetch_device_info(const std::string& base_url, - const std::string& api_key, - MoonrakerDeviceInfo& info, - std::string& error) const +bool MoonrakerPrinterAgent::fetch_device_info(const std::string& base_url, + const std::string& api_key, + MoonrakerDeviceInfo& info, + std::string& error, + const std::function& cancelled) const { auto fetch_json = [&](const std::string& url, nlohmann::json& out) { std::string response_body; @@ -1139,6 +1155,7 @@ bool MoonrakerPrinterAgent::fetch_device_info(const std::string& base_url, } http.timeout_connect(5) .timeout_max(10) + .on_progress(cancel_when(cancelled)) .on_complete([&](std::string body, unsigned status) { if (status == 200) { response_body = body; @@ -1182,10 +1199,11 @@ bool MoonrakerPrinterAgent::fetch_device_info(const std::string& base_url, return true; } -bool MoonrakerPrinterAgent::query_printer_status(const std::string& base_url, - const std::string& api_key, - nlohmann::json& status, - std::string& error) const +bool MoonrakerPrinterAgent::query_printer_status(const std::string& base_url, + const std::string& api_key, + nlohmann::json& status, + std::string& error, + const std::function& cancelled) const { std::string url = join_url(base_url, "/printer/objects/query?print_stats&virtual_sdcard&extruder&heater_bed&fan"); @@ -1199,6 +1217,7 @@ bool MoonrakerPrinterAgent::query_printer_status(const std::string& base_url, } http.timeout_connect(5) .timeout_max(10) + .on_progress(cancel_when(cancelled)) .on_complete([&](std::string body, unsigned status_code) { if (status_code == 200) { response_body = body; @@ -1331,7 +1350,7 @@ bool MoonrakerPrinterAgent::fetch_object_list(const std::string& base_url, http.timeout_connect(5) .timeout_max(10) // Gives up once the status stream, the only caller, stops - .on_progress([this](Http::Progress, bool& cancel) { cancel = ws_stop.load(); }) + .on_progress(cancel_when([this] { return ws_stop.load(); })) .on_complete([&](std::string body, unsigned status) { if (status == 200) { response_body = body; @@ -1415,16 +1434,8 @@ void MoonrakerPrinterAgent::announce_printhost_device() } } - // Try to fetch actual device name from Moonraker - // Priority: 1) Moonraker hostname, 2) Preset model name, 3) Generic fallback - std::string dev_name; - MoonrakerDeviceInfo info; - std::string fetch_error; - if (fetch_device_info(device_info.base_url, device_info.api_key, info, fetch_error) && !info.dev_name.empty()) { - dev_name = info.dev_name; - } else { - dev_name = device_info.model_name.empty() ? "Moonraker Printer" : device_info.model_name; - } + // Never asks the printer, since discovery runs on the GUI thread and an unreachable printer would freeze it + const std::string dev_name = device_info.model_name.empty() ? "Moonraker Printer" : device_info.model_name; const std::string model_id = device_info.model_id; @@ -2261,8 +2272,10 @@ void MoonrakerPrinterAgent::perform_connection_async(const std::string& dev_id, try { MoonrakerDeviceInfo fetched_info; - if (!fetch_device_info(base_url, api_key, fetched_info, error_msg)) { - BOOST_LOG_TRIVIAL(error) << "MoonrakerPrinterAgent: Failed to fetch server info: " << error_msg; + if (!fetch_device_info(base_url, api_key, fetched_info, error_msg, is_stale)) { + if (!is_stale()) { + BOOST_LOG_TRIVIAL(error) << "MoonrakerPrinterAgent: Failed to fetch server info: " << error_msg; + } // Orca todo: revist here, for now don't send error, this is set current MachineObject to null // dispatch_local_connect(ConnectStatusFailed, dev_id, "server_info_failed"); return; @@ -2283,12 +2296,15 @@ void MoonrakerPrinterAgent::perform_connection_async(const std::string& dev_id, #if 1 // Query initial status nlohmann::json initial_status; - if (query_printer_status(base_url, api_key, initial_status, error_msg)) { - { - update_status_cache(initial_status); + if (query_printer_status(base_url, api_key, initial_status, error_msg, is_stale)) { + // Under connect_mutex, so a superseded connection never writes into the next connection's cache + std::lock_guard lock(connect_mutex); + if (is_stale()) { + return; } + update_status_cache(initial_status); BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: Initial status queried successfully"; - } else { + } else if (!is_stale()) { BOOST_LOG_TRIVIAL(warning) << "MoonrakerPrinterAgent: Initial status query failed: " << error_msg; } @@ -2312,12 +2328,15 @@ void MoonrakerPrinterAgent::perform_connection_async(const std::string& dev_id, result = BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED; } - // Only dispatch if this connection is still the current one - if (result == BAMBU_NETWORK_SUCCESS && !is_stale()) { - dispatch_local_connect(ConnectStatusOk, dev_id, "0"); - dispatch_printer_connected(dev_id); - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: connect_printer completed - dev_id=" << dev_id; - } else if (result != BAMBU_NETWORK_SUCCESS && result != BAMBU_NETWORK_ERR_CANCELED) { + if (result == BAMBU_NETWORK_SUCCESS) { + // Under connect_mutex, so a superseded connection never reports itself connected + std::lock_guard lock(connect_mutex); + if (!is_stale()) { + dispatch_local_connect(ConnectStatusOk, dev_id, "0"); + dispatch_printer_connected(dev_id); + BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: connect_printer completed - dev_id=" << dev_id; + } + } else if (result != BAMBU_NETWORK_ERR_CANCELED) { // Orca todo: revist here, for now don't send error, this is set current MachineObject to null // dispatch_local_connect(ConnectStatusFailed, dev_id, error_msg); } diff --git a/src/slic3r/Utils/MoonrakerPrinterAgent.hpp b/src/slic3r/Utils/MoonrakerPrinterAgent.hpp index a7edc476e8..cf487bcf6b 100644 --- a/src/slic3r/Utils/MoonrakerPrinterAgent.hpp +++ b/src/slic3r/Utils/MoonrakerPrinterAgent.hpp @@ -112,7 +112,12 @@ protected: // Methods that derived classes may need to override or access virtual bool init_device_info(const std::string& dev_id, const std::string& dev_ip, const std::string& username, const std::string& password, bool use_ssl, const std::string& port); - virtual bool fetch_device_info(const std::string& base_url, const std::string& api_key, MoonrakerDeviceInfo& info, std::string& error) const; + // An override must give up its request once `cancelled` returns true, or the destructor waits out its timeout + virtual bool fetch_device_info(const std::string& base_url, + const std::string& api_key, + MoonrakerDeviceInfo& info, + std::string& error, + const std::function& cancelled) const; void start_status_stream(const std::string& dev_id, const std::string& base_url, const std::string& api_key); void stop_status_stream(); @@ -137,7 +142,11 @@ private: int send_access_code(const std::string& dev_id); bool fetch_object_list(const std::string& base_url, const std::string& api_key, std::set& objects, std::string& error) const; - bool query_printer_status(const std::string& base_url, const std::string& api_key, nlohmann::json& status, std::string& error) const; + bool query_printer_status(const std::string& base_url, + const std::string& api_key, + nlohmann::json& status, + std::string& error, + const std::function& cancelled) const; bool send_gcode_sync(const std::string& dev_id, const std::string& gcode) const; void send_gcode_async(const std::string& dev_id, const std::string& gcode, std::function on_result = {}) const; diff --git a/src/slic3r/Utils/NetworkAgentFactory.cpp b/src/slic3r/Utils/NetworkAgentFactory.cpp index 82a6e469ae..7f59dc7573 100644 --- a/src/slic3r/Utils/NetworkAgentFactory.cpp +++ b/src/slic3r/Utils/NetworkAgentFactory.cpp @@ -166,8 +166,12 @@ std::shared_ptr NetworkAgentFactory::create_printer_agent_by_id(c void NetworkAgentFactory::clear_printer_agent_cache() { - std::lock_guard lock(s_registry_mutex); - auto& cache = get_printer_agent_cache(); + // Disconnects and destroys the agents outside the lock, since a destructor waits for its agent's threads + std::map> cache; + { + std::lock_guard lock(s_registry_mutex); + cache.swap(get_printer_agent_cache()); + } for (auto& pair : cache) { if (pair.second) pair.second->disconnect_printer(); diff --git a/src/slic3r/Utils/OrcaCloudServiceAgent.cpp b/src/slic3r/Utils/OrcaCloudServiceAgent.cpp index f5f7e30d1d..69686d470e 100644 --- a/src/slic3r/Utils/OrcaCloudServiceAgent.cpp +++ b/src/slic3r/Utils/OrcaCloudServiceAgent.cpp @@ -71,6 +71,7 @@ #if !defined(_WIN32) #include #include +#include #include #endif @@ -145,10 +146,9 @@ public: #else m_fd = ::open(path.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0600); if (m_fd == -1) { m_locked = true; return; } // can't open -> don't block - struct flock fl{}; - fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; int rc; - do { rc = ::fcntl(m_fd, F_SETLKW, &fl); } while (rc == -1 && errno == EINTR); // blocks in kernel + // An fcntl lock would not block other threads in this process, and any close() of this file would release it. + do { rc = ::flock(m_fd, LOCK_EX); } while (rc == -1 && errno == EINTR); // blocks in kernel m_locked = (rc != -1); #endif } @@ -1917,13 +1917,20 @@ RefreshResult OrcaCloudServiceAgent::refresh_from_storage(const std::string& rea bool OrcaCloudServiceAgent::refresh_if_expiring(std::chrono::seconds skew, const std::string& reason) { - bool needs_refresh = false; - { + const auto needs_refresh = [&] { std::lock_guard lock(session_mutex); - needs_refresh = should_refresh_locked(skew); - } + return should_refresh_locked(skew); + }; + if (!needs_refresh()) + return true; - if (!needs_refresh) + // A refresh may already be running on another thread, e.g. the one start() launches. Wait for + // it and check again instead of spending the refresh token it is rotating. Bounded: the + // refresh POST times out after 30 s. + const auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(60); + while (refresh_running.load() && std::chrono::steady_clock::now() < deadline) + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + if (!needs_refresh()) return true; // First attempt. refresh_from_storage blocks on the cross-process lock and reads the @@ -1935,6 +1942,8 @@ bool OrcaCloudServiceAgent::refresh_if_expiring(std::chrono::seconds skew, const // One retry, only for a transient network failure of the refresh POST (lost response, // timeout, 429/5xx -> Transient). The retry re-acquires the lock and re-reads the store. std::this_thread::sleep_for(std::chrono::milliseconds(750)); + if (!needs_refresh()) + return true; return refresh_from_storage(reason + "_retry", false) == RefreshResult::Success; } diff --git a/src/slic3r/Utils/QidiPrinterAgent.cpp b/src/slic3r/Utils/QidiPrinterAgent.cpp index c2dc4411a6..9b3c8a7cb7 100644 --- a/src/slic3r/Utils/QidiPrinterAgent.cpp +++ b/src/slic3r/Utils/QidiPrinterAgent.cpp @@ -55,7 +55,7 @@ bool QidiPrinterAgent::fetch_filament_info(std::string dev_id, FilamentSyncMode std::string series_id; { MoonrakerDeviceInfo info; - if (fetch_device_info(device_info.base_url, device_info.api_key, info, error)) { + if (fetch_device_info(device_info.base_url, device_info.api_key, info, error, {})) { series_id = infer_series_id(info.model_id, info.dev_name); } } @@ -73,7 +73,14 @@ bool QidiPrinterAgent::fetch_filament_info(std::string dev_id, FilamentSyncMode // 3. Fetch slot info and build AmsTrayData directly std::vector trays; int box_count = 0; - if (!fetch_slot_info(device_info.base_url, device_info.api_key, dict, series_id, trays, box_count, error)) { + bool slots_ok = false; + try { + slots_ok = fetch_slot_info(device_info.base_url, device_info.api_key, dict, series_id, trays, box_count, error); + } catch (const nlohmann::json::exception& e) { + // A slot value of an unexpected type fails the sync instead of escaping to the UI + error = e.what(); + } + if (!slots_ok) { BOOST_LOG_TRIVIAL(warning) << "QidiPrinterAgent::fetch_filament_info: Failed to fetch slot info: " << error; return false; } @@ -91,7 +98,7 @@ bool QidiPrinterAgent::fetch_slot_info(const std::string& base_url, int& box_count, std::string& error) { - std::string url = join_url(base_url, "/printer/objects/query?save_variables=variables"); + std::string url = join_url(base_url, "/printer/objects/query?save_variables=variables&multi_color_controller=box"); for (int i = 0; i < 16; ++i) { url += "&box_stepper%20slot" + std::to_string(i) + "=runout_button"; } @@ -164,9 +171,12 @@ bool QidiPrinterAgent::fetch_slot_info(const std::string& base_url, AmsTrayData tray; tray.slot_index = i; - // Read slot variables - const int color_index = variables.value("color_slot" + std::to_string(i), 1); - const int filament_type = variables.value("filament_slot" + std::to_string(i), 1); + // Read slot variables. Newer firmware stores a hex color list and a material id instead of dictionary + // indexes, and only in the slots it has rewritten, so each slot is checked for both forms. + const auto color_value = variables.value("color_slot" + std::to_string(i), nlohmann::json(1)); + const auto filament_value = variables.value("filament_slot" + std::to_string(i), nlohmann::json(1)); + const int color_index = color_value.is_number() ? color_value.get() : 0; + const int filament_type = filament_value.is_number() ? filament_value.get() : 0; const int vendor_type = variables.value("vendor_slot" + std::to_string(i), 0); // Check filament presence via runout sensor @@ -187,6 +197,13 @@ bool QidiPrinterAgent::fetch_slot_info(const std::string& base_url, if (filament_it != dict.filaments.end()) { filament_name = filament_it->second; } + if (filament_value.is_string()) { + const nlohmann::json::json_pointer decoded_type("/multi_color_controller/box/box" + std::to_string(i / 4) + + "_filament_info_" + std::to_string(i % 4) + "_filament_type"); + if (status.contains(decoded_type) && status[decoded_type].is_string()) { + filament_name = status[decoded_type].get(); + } + } tray.tray_type = normalize_filament_type(filament_name); // Try Qidi-specific setting ID first; fall back to visible preset by type @@ -202,7 +219,9 @@ bool QidiPrinterAgent::fetch_slot_info(const std::string& base_url, // Look up color from dictionary auto color_it = dict.colors.find(color_index); - if (color_it != dict.colors.end()) { + if (color_value.is_array() && !color_value.empty() && color_value[0].is_string()) { + tray.tray_color = color_value[0].get(); + } else if (color_it != dict.colors.end()) { tray.tray_color = color_it->second; } else { tray.tray_color = "FFFFFFFF"; diff --git a/src/slic3r/Utils/SimplyPrint.cpp b/src/slic3r/Utils/SimplyPrint.cpp index ff6860a244..98b1a7fa16 100644 --- a/src/slic3r/Utils/SimplyPrint.cpp +++ b/src/slic3r/Utils/SimplyPrint.cpp @@ -350,9 +350,13 @@ bool SimplyPrint::do_temp_upload(const boost::filesystem::path& file_path, if (should_open_in_external_browser()) { wxLaunchDefaultBrowser(url); } else { - const auto mainframe = GUI::wxGetApp().mainframe; - mainframe->request_select_tab(TAB_ID_MONITOR); - mainframe->load_printer_url(url); + // The tab switch queues a reload of the printer's home page, so switch synchronously + // first and queue the import page after it. + GUI::wxGetApp().CallAfter([url = wxString::FromUTF8(url)] { + const auto mainframe = GUI::wxGetApp().mainframe; + mainframe->select_tab(TAB_ID_MONITOR); + mainframe->load_printer_url(url); + }); } return true; diff --git a/src/slic3r/plugin/CloudPluginService.cpp b/src/slic3r/plugin/CloudPluginService.cpp index 22e0b57f81..221ec7787c 100644 --- a/src/slic3r/plugin/CloudPluginService.cpp +++ b/src/slic3r/plugin/CloudPluginService.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -49,16 +50,22 @@ bool CloudPluginService::fetch_manifests_into_descriptors(std::vectorensure_token_fresh("fetch_plugin_manifests"); + std::vector mine_descriptors; + auto mine = std::async(std::launch::async, [agent = m_orca_agent, &mine_descriptors] { + return agent->fetch_mine_manifests_into_descriptors(mine_descriptors); + }); + int ret = m_orca_agent->fetch_subscribed_manifests_into_descriptors(descriptors, not_found, unauthorized); + const int mine_ret = mine.get(); if (ret != 0) { BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": Failed to get subscribed plugins."; return false; } - std::vector mine_descriptors; - - ret = m_orca_agent->fetch_mine_manifests_into_descriptors(mine_descriptors); + ret = mine_ret; if (ret != 0) { BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": Failed to get owned plugins."; diff --git a/src/slic3r/plugin/PluginAuditManager.cpp b/src/slic3r/plugin/PluginAuditManager.cpp index e913763891..2c1a13b990 100644 --- a/src/slic3r/plugin/PluginAuditManager.cpp +++ b/src/slic3r/plugin/PluginAuditManager.cpp @@ -5,12 +5,17 @@ #include "libslic3r/libslic3r.h" // GCODEVIEWER_APP_KEY, and SLIC3R_APP_KEY via libslic3r_version.h #include "libslic3r_version.h" +#include #include +#include +#include #include #include #include +#include #include +#include #include #include #include @@ -130,6 +135,20 @@ static AuditEventCategory event_category(const std::string& event_name) return it == audit_event_categories.end() ? AuditEventCategory::None : it->second; } +// Events the 3.12 stdlib raises with sys.audit() inside the function that performs the whole +// operation, so the raising frame bounds everything the operation does. Every other mapped event +// is a primitive raised from C, whose current frame is whatever Python code called it -- possibly +// a library loop over many targets -- so it never marks an operation. glob.glob and glob.glob/2 +// are raised in iglob(), which returns its lazy generator before any directory is listed. +static const std::unordered_set operation_root_events{ + "urllib.Request", "http.client.connect", "os.walk", "os.fwalk", + "glob.glob", "glob.glob/2", "pathlib.Path.glob", "pathlib.Path.rglob", + "subprocess.Popen", "pty.spawn", "tempfile.mkstemp", "tempfile.mkdtemp", + "shutil.copyfile", "shutil.copymode", "shutil.copystat", "shutil.copytree", + "shutil.chown", "shutil.move", "shutil.rmtree", "shutil.make_archive", + "shutil.unpack_archive", +}; + // True for the categories whose targets are filesystem paths, as opposed to a network // address or a process command line -- the deny-path and allowed-root checks only make sense // against a path. @@ -146,51 +165,280 @@ static bool is_fs_category(AuditEventCategory category) } } +// HTTP and raw-socket events are governed by the same network permission: a declared host may be +// reached through either layer, and the layers nest for one plugin action (urllib -> http.client +// -> socket). +static bool is_network_category(AuditEventCategory category) +{ + return category == AuditEventCategory::Http || category == AuditEventCategory::Socket; +} + +// --------------------------------------------------------------------------- +// Network permission identity +// --------------------------------------------------------------------------- + +static std::string ascii_lower(std::string value) +{ + boost::algorithm::to_lower(value); + return value; +} + +static std::string trim_ascii_space(std::string value) +{ + boost::algorithm::trim(value); + return value; +} + +// Canonical storage keeps IPv6 literals bracketed (https://[::1]), while a socket address +// exposes the bare literal (::1). Compare them without the brackets. +static std::string without_ipv6_brackets(std::string host) +{ + if (host.size() >= 2 && host.front() == '[' && host.back() == ']') + host = host.substr(1, host.size() - 2); + return host; +} + +// Returns the host part of a URL authority, dropping userinfo and port. IPv6 literals keep their +// brackets so that a URL and a bare address compare consistently. +static std::string host_from_authority(std::string authority) +{ + const size_t at = authority.rfind('@'); + if (at != std::string::npos) + authority.erase(0, at + 1); + + if (authority.empty()) + return {}; + + if (authority.front() == '[') { + const size_t close = authority.find(']'); + if (close == std::string::npos) + return {}; + authority.erase(close + 1); + return ascii_lower(authority); + } + + const size_t colon = authority.find(':'); + if (colon != std::string::npos) + authority.erase(colon); + + if (authority.find_first_of(" \t\r\n/?#@") != std::string::npos) + return {}; + + return ascii_lower(authority); +} + +// Extracts a host from a target that is not a URL: "host", "host:443", "[::1]:443", "('host', +// 443)" (the form older releases persisted for socket address events), or "'host'". +static std::string network_host_from_target(const std::string& target) +{ + std::string value = trim_ascii_space(target); + if (value.empty()) + return {}; + + if (value.front() == '(') { + // Legacy persisted address tuple: ("host", 443) or ("host", 443, 0, 0). + const size_t quote = value.find_first_of("'\""); + if (quote != std::string::npos) { + const char delimiter = value[quote]; + const size_t end = value.find(delimiter, quote + 1); + if (end == std::string::npos) + return {}; + value = value.substr(quote + 1, end - quote - 1); + } else { + value = value.substr(1); + const size_t comma = value.find(','); + if (comma != std::string::npos) + value.erase(comma); + } + } else if (value.front() == '[') { + const size_t close = value.find(']'); + if (close == std::string::npos) + return {}; + value.erase(close + 1); + } else { + // Strip a ":port" suffix, but leave a bare IPv6 literal ("::1") intact. + const size_t colon = value.find(':'); + if (colon != std::string::npos && value.find(':', colon + 1) == std::string::npos) + value.erase(colon); + } + + value = trim_ascii_space(value); + if (value.empty() || value.find_first_of(" \t\r\n/?#@") != std::string::npos) + return {}; + + return ascii_lower(value); +} + +std::string PluginAuditManager::normalize_network_url(const std::string& url) +{ + const size_t scheme_end = url.find("://"); + if (scheme_end == std::string::npos || scheme_end == 0) + return {}; + + const std::string scheme = ascii_lower(url.substr(0, scheme_end)); + if (scheme != "http" && scheme != "https") + return {}; + + const size_t authority_start = scheme_end + 3; + const size_t authority_end = url.find_first_of("/?#", authority_start); + const std::string authority = url.substr(authority_start, authority_end == std::string::npos + ? std::string::npos + : authority_end - authority_start); + + const std::string host = host_from_authority(authority); + if (host.empty()) + return {}; + + return scheme + "://" + host; +} + +bool PluginAuditManager::network_permission_matches(const std::vector& granted, + const std::string& target) +{ + if (target.empty()) + return false; + + const bool target_is_url = target.find("://") != std::string::npos; + const std::string target_url = normalize_network_url(target); + if (target_is_url && target_url.empty()) { + // A non-http(s) URL has no network identity we can generalize; only an exact grant + // recorded by an earlier approval stays valid, so an unrelated scheme never matches. + return std::find(granted.begin(), granted.end(), target) != granted.end(); + } + + const std::string target_host = + target_is_url ? std::string{} : without_ipv6_brackets(network_host_from_target(target)); + if (!target_is_url && target_host.empty()) + return false; + + for (const std::string& entry : granted) { + // Preserve an exact grant recorded by an older release, e.g. a full URL with a query. + if (entry == target) + return true; + + const std::string entry_url = normalize_network_url(entry); + if (target_is_url) { + // Canonical scheme://host grants are host-wide. Older grants that persisted a full + // URL remain scoped to that exact URL, preserving the operation-root URL check. + if (!entry_url.empty() && entry_url == entry && entry_url == target_url) + return true; + continue; + } + + if (!entry_url.empty()) { + // A bare host carries no scheme: only a canonical scheme://host grant is host-wide. + // A grant that persisted a full URL stays scoped to that URL, so it must not + // authorize raw socket access to its whole host. Normalization lowercases the scheme + // and host, so a canonical grant compares equal to its lowercased form. + if (ascii_lower(entry) == entry_url) { + const std::string entry_host = entry_url.substr(entry_url.find("://") + 3); + if (without_ipv6_brackets(entry_host) == target_host) + return true; + } + } else if (without_ipv6_brackets(network_host_from_target(entry)) == target_host) { + // Legacy persisted address tuples, e.g. "('host', 443)". + return true; + } + } + + return false; +} + +// The category's name in a saved event grant, e.g. "FsRead" in "FsRead:open". +static const char* category_name(AuditEventCategory category) +{ + switch (category) { + case AuditEventCategory::FsRead: return "FsRead"; + case AuditEventCategory::FsReadWrite: return "FsReadWrite"; + case AuditEventCategory::FsCreate: return "FsCreate"; + case AuditEventCategory::FsDelete: return "FsDelete"; + case AuditEventCategory::Http: return "Http"; + case AuditEventCategory::Socket: return "Socket"; + case AuditEventCategory::ProcessCreate: return "ProcessCreate"; + case AuditEventCategory::ProcessReplace: return "ProcessReplace"; + case AuditEventCategory::Threading: return "Threading"; + case AuditEventCategory::None: break; + } + return "None"; +} + // --------------------------------------------------------------------------- // Path safety // --------------------------------------------------------------------------- -bool is_inside_allowed_root(const boost::filesystem::path& candidate, const boost::filesystem::path& allowed_root) +namespace { + +// Canonicalize a path for containment comparison. weakly_canonical resolves symlinks but does +// NOT require the path to exist — it canonicalizes the prefix that exists and appends the +// non-existing tail lexically. +boost::filesystem::path canonical_for_comparison(const boost::filesystem::path& path) { namespace fs = boost::filesystem; boost::system::error_code ec; - - // Canonicalize both paths. weakly_canonical resolves symlinks but does - // NOT require the path to exist — it canonicalizes the prefix that exists - // and appends the non-existing tail lexically. - fs::path canon_candidate = fs::weakly_canonical(candidate, ec); + fs::path canon = fs::weakly_canonical(path, ec); if (ec) { // Fall back to lexically_normal + absolute - canon_candidate = fs::absolute(candidate, ec).lexically_normal(); + canon = fs::absolute(path, ec).lexically_normal(); if (ec) - canon_candidate = candidate; + canon = path; } + return canon; +} - fs::path canon_root = fs::weakly_canonical(allowed_root, ec); - if (ec) { - canon_root = fs::absolute(allowed_root, ec).lexically_normal(); - if (ec) - canon_root = allowed_root; - } +// True when the final component of `path` is a symlink whose target does not exist. +// +// weakly_canonical() leaves such a link in its lexical tail: it stats the prefix and stops at the +// first non-existing component, and exists() follows the link and reports false for a dangling +// one. A target such as /link would therefore compare as if it lived inside the tree even +// though a write through it lands at the link's target, which the grant does not describe. +// +// A link whose target exists is not dangling: symlink_status() reports the link itself (it does +// not follow it) while exists() follows it and succeeds. The canonical form of such a candidate is +// already resolved to the target, so this check does not fire for it. An intermediate dangling +// component is not reported here and needs no special case: the open cannot follow it either, so +// nothing is created. +bool ends_in_dangling_symlink(const boost::filesystem::path& path) +{ + namespace fs = boost::filesystem; - // Component-wise comparison: the root must be a prefix of candidate, - // and the next component must not be ".." or missing. - auto cand_it = canon_candidate.begin(); - auto cand_end = canon_candidate.end(); - auto root_it = canon_root.begin(); - auto root_end = canon_root.end(); + boost::system::error_code ec; + const fs::file_status status = fs::symlink_status(path, ec); + // symlink_status does not follow the link, so a missing target still reports symlink; a path + // that does not exist at all reports an error instead. + if (ec || !fs::is_symlink(status)) + return false; - const auto same_component = [](const fs::path& lhs, const fs::path& rhs) { + // exists() follows the link: false means the target is missing. + return !fs::exists(path, ec); +} + +bool same_path_component(const boost::filesystem::path& lhs, const boost::filesystem::path& rhs) +{ #ifdef _WIN32 - return boost::algorithm::iequals(lhs.native(), rhs.native()); + return boost::algorithm::iequals(lhs.native(), rhs.native()); #else - return lhs == rhs; + return lhs == rhs; #endif - }; +} + +// Component-wise containment: the whole of canonical_root must be a prefix of +// canonical_candidate, and the remaining components must not traverse upward. Both arguments are +// expected to come from canonical_for_comparison(). On a match, suffix receives the candidate's +// components below the root (empty when the two paths are equal). +bool suffix_inside_root(const boost::filesystem::path& canonical_candidate, + const boost::filesystem::path& canonical_root, + boost::filesystem::path& suffix) +{ + suffix.clear(); + + auto cand_it = canonical_candidate.begin(); + auto cand_end = canonical_candidate.end(); + auto root_it = canonical_root.begin(); + auto root_end = canonical_root.end(); // Consume matching components - while (root_it != root_end && cand_it != cand_end && same_component(*root_it, *cand_it)) { + while (root_it != root_end && cand_it != cand_end && same_path_component(*root_it, *cand_it)) { ++root_it; ++cand_it; } @@ -205,9 +453,28 @@ bool is_inside_allowed_root(const boost::filesystem::path& candidate, const boos return false; } + for (; cand_it != cand_end; ++cand_it) + suffix /= *cand_it; return true; } +} // namespace + +bool is_inside_allowed_root(const boost::filesystem::path& candidate, const boost::filesystem::path& allowed_root) +{ + const boost::filesystem::path canonical_candidate = canonical_for_comparison(candidate); + + // Fail closed on a dangling final symlink instead of comparing the path it is spelled as: the + // grant describes the link, not the destination a write through it would create. The test is + // applied to the canonical form, which leaves a dangling link unresolved as its final + // component, so a trailing separator does not hide it either. + if (ends_in_dangling_symlink(canonical_candidate)) + return false; + + boost::filesystem::path suffix; + return suffix_inside_root(canonical_candidate, canonical_for_comparison(allowed_root), suffix); +} + // --------------------------------------------------------------------------- // ScopedPluginAuditContext // --------------------------------------------------------------------------- @@ -215,26 +482,50 @@ bool is_inside_allowed_root(const boost::filesystem::path& candidate, const boos thread_local std::string PluginAuditManager::m_current_plugin_key = ""; thread_local std::string PluginAuditManager::m_current_capability_name = ""; thread_local std::vector PluginAuditManager::m_scoped_allowed_roots; +thread_local std::vector PluginAuditManager::m_root_frames; +thread_local int PluginAuditManager::m_releasing_frames = 0; thread_local bool PluginAuditManager::m_audit_denial_pending = false; thread_local bool PluginAuditManager::m_has_last_violation = false; thread_local AuditViolation PluginAuditManager::m_last_violation; ScopedPluginAuditContext::ScopedPluginAuditContext(const std::string& plugin_key, const std::string& capability_name) - : m_previous_id(PluginAuditManager::instance().current_plugin()) + : m_plugin_key(plugin_key) + , m_capability(capability_name) + , m_previous_id(PluginAuditManager::instance().current_plugin()) , m_previous_capability(PluginAuditManager::instance().current_capability()) , m_previous_scoped_roots(PluginAuditManager::m_scoped_allowed_roots) + , m_previous_root_frames(std::move(PluginAuditManager::m_root_frames)) { PluginAuditManager::instance().set_current_plugin(plugin_key); PluginAuditManager::instance().set_current_capability(capability_name); PluginAuditManager::m_scoped_allowed_roots.clear(); + PluginAuditManager::m_root_frames.clear(); } ScopedPluginAuditContext::~ScopedPluginAuditContext() { - PluginAuditManager::instance().set_current_plugin(m_previous_id); - PluginAuditManager::instance().set_current_capability(m_previous_capability); + PluginAuditManager& mgr = PluginAuditManager::instance(); + + // Let this scope's root frames go while it is still the current context, and as its own + // plugin: the trampoline's denial path clears the key before the scope ends, and a finalizer + // must never be judged as the outer plugin, or bypass the audit when there is none. A + // finalizer may record a new root frame, so repeat until none is held. + if (!PluginAuditManager::m_root_frames.empty()) { + assert(PyGILState_Check()); + mgr.set_current_plugin(m_plugin_key); + mgr.set_current_capability(m_capability); + while (!PluginAuditManager::m_root_frames.empty()) { + std::vector frames = std::move(PluginAuditManager::m_root_frames); + PluginAuditManager::m_root_frames.clear(); + mgr.release_frames(frames); + } + } + + mgr.set_current_plugin(m_previous_id); + mgr.set_current_capability(m_previous_capability); PluginAuditManager::m_scoped_allowed_roots = std::move(m_previous_scoped_roots); + PluginAuditManager::m_root_frames = std::move(m_previous_root_frames); } // --------------------------------------------------------------------------- @@ -296,16 +587,18 @@ void PluginAuditManager::add_denied_filename(const std::string& filename) std::vector PluginAuditManager::default_denied_filenames() { // AppConfig::config_path() picks .conf vs .ini on the USE_JSON_CONFIG ifdef and the app key - // on its mode, and is a non-static member we cannot call without an instance. Denying all + // on its mode, and is a non-static member we cannot call without an instance. Denying all // four names is cheaper and more robust than replicating that; the two unused names cost one - // string comparison each. Single-sourced here so install_hook() and the tests seed from the - // same list and cannot drift apart. + // string comparison each. Keep the plugin install-state sidecar here too: it controls which + // packages load on startup and must remain host-managed. Single-sourced so install_hook() and + // the tests seed from the same list and cannot drift apart. return { SLIC3R_APP_KEY ".conf", GCODEVIEWER_APP_KEY ".conf", SLIC3R_APP_KEY ".ini", GCODEVIEWER_APP_KEY ".ini", secret_constants::USER_SECRET_FILENAME, + ".install_state.json", }; } @@ -353,7 +646,8 @@ std::vector PluginAuditManager::default_denied_path_keywords() // it happens to live inside an otherwise-allowed root (e.g. the bundled TLS client cert at // resources_dir()/cert/..., which would become reachable the moment resources_dir() is // granted as a read-only allowed root). Match as whole path components, not substrings, so - // imports such as numpy/__config__.py and stdlib configparser.py remain usable. + // imports such as numpy/__config__.py and stdlib configparser.py remain usable. Inside + // data_dir() they match below that root only; see is_denied_path_keyword(). return {"secret", "secrets", "cert", "certs", "certificate", "certificates", "conf", "config"}; } @@ -372,19 +666,29 @@ bool PluginAuditManager::is_denied_path_keyword(const boost::filesystem::path& c { namespace fs = boost::filesystem; - boost::system::error_code ec; - fs::path canon = fs::weakly_canonical(candidate, ec); - if (ec) { - canon = fs::absolute(candidate, ec).lexically_normal(); - if (ec) - canon = candidate; - } + const fs::path canon = canonical_for_comparison(candidate); + + // The app's data folder can itself sit below a component named like one of the keywords + // without being one: Flatpak keeps it under /.var/app//config/OrcaSlicer, and + // the sandbox's home layout is not ours to change. A keyword above data_dir() therefore says + // nothing about what a plugin may reach inside it, so inside data_dir() the keywords apply to + // the suffix below data_dir() only. Everywhere else -- resources_dir() with the bundled + // certificates, a plugin's own folders, arbitrary files -- the whole path is still checked, + // and so is a keyword under data_dir() itself. + fs::path canonical_data_dir; + if (!data_dir().empty()) + canonical_data_dir = canonical_for_comparison(data_dir()); + + fs::path scope = canon; + fs::path suffix; + if (!canonical_data_dir.empty() && suffix_inside_root(canon, canonical_data_dir, suffix)) + scope = suffix; std::lock_guard lock(m_mutex); if (m_denied_path_keywords.empty()) return false; - for (const auto& component : canon) { + for (const auto& component : scope) { std::string name = component.string(); if (name.empty()) continue; @@ -441,6 +745,12 @@ AuditDecision PluginAuditManager::check_path_access(const boost::filesystem::pat candidate = absolute_candidate; } + // Importing Python modules reads their source and may inspect package directories. These + // reads are normal interpreter work, not plugin data access; keep the exemption read-only + // and exclude third-party packages from the stdlib roots. + if (!is_write && is_stdlib_path(candidate)) + return {true, ""}; + // A root that doesn't allow writes only matches a read-shaped request; a write/create/ // delete-shaped one falls through to "outside allowed root" for that root even though the // path is physically inside it. @@ -471,79 +781,40 @@ AuditDecision PluginAuditManager::check_open(const std::string& path_str, const return check_path_access(boost::filesystem::path(path_str), is_write); } -bool PluginAuditManager::request_filesystem_read_permissions(const std::string& plugin_key, - const std::vector& paths) +namespace { + +// Builds and shows the modal confirmation. Must run on the GUI thread. The prompt helpers in +// PluginAuditDetail below share it so every permission prompt is styled the same way. +bool show_permission_dialog(const wxString& message, const wxString& title) { - if (plugin_key.empty() || paths.empty()) + wxMessageDialog dialog(nullptr, message, title, wxYES_NO | wxICON_WARNING); + return dialog.ShowModal() == wxID_YES; +} + +} // namespace + +bool PluginAuditManager::request_network_permissions(const std::string& plugin_key, + const std::vector& urls) +{ + if (plugin_key.empty() || urls.empty()) return true; - PluginDescriptor descriptor; - if (!PluginManager::instance().try_get_plugin_descriptor(plugin_key, descriptor) || descriptor.plugin_root.empty()) - return false; - - PluginInstallState state; - read_install_state(boost::filesystem::path(descriptor.plugin_root), state); - - std::vector missing; - for (const std::string& path : paths) { - if (std::find(state.permissions.fs_read.begin(), state.permissions.fs_read.end(), path) == state.permissions.fs_read.end()) - missing.push_back(path); - } - if (missing.empty()) - return true; - - if (wxTheApp == nullptr || GUI::wxGetApp().is_closing()) - return false; - - auto show_dialog = [&descriptor, &missing]() { - wxString requested_paths; - for (const std::string& path : missing) - requested_paths += wxString::FromUTF8(path.c_str()) + "\n"; - - wxMessageDialog dialog( - nullptr, - wxString::Format(_L("Plugin \"%s\" requests filesystem read access to:\n%s"), - wxString::FromUTF8(descriptor.name.c_str()), requested_paths), - _L("Plugin permissions"), - wxYES_NO | wxICON_WARNING); - return dialog.ShowModal() == wxID_YES; - }; - - bool granted = false; - if (wxIsMainThread()) { - granted = show_dialog(); - } else { - auto result = std::make_shared>(); - auto future = result->get_future(); - GUI::wxGetApp().CallAfter([result, descriptor_name = descriptor.name, missing]() { - wxString requested_paths; - for (const std::string& path : missing) - requested_paths += wxString::FromUTF8(path.c_str()) + "\n"; - - wxMessageDialog dialog( - nullptr, - wxString::Format(_L("Plugin \"%s\" requests filesystem read access to:\n%s"), - wxString::FromUTF8(descriptor_name.c_str()), requested_paths), - _L("Plugin permissions"), - wxYES_NO | wxICON_WARNING); - result->set_value(dialog.ShowModal() == wxID_YES); - }); - granted = future.get(); + // Reduce every request to scheme://host before comparing or persisting it, so a URL with a + // path or query cannot create a second grant for the same host. + PluginPermissions requested; + for (const std::string& url : urls) { + const std::string normalized = normalize_network_url(url); + if (normalized.empty()) { + BOOST_LOG_TRIVIAL(warning) << "[AUDIT] Invalid network permission request for plugin " << plugin_key << ": " << url; + return false; + } + if (std::find(requested.network_http.begin(), requested.network_http.end(), normalized) == requested.network_http.end()) + requested.network_http.push_back(normalized); } - if (!granted) - return false; - - if (state.plugin_name.empty()) { - state.installed_from = descriptor.is_cloud_plugin() ? "cloud" : "local"; - state.installed_version = !descriptor.installed_version.empty() ? descriptor.installed_version : descriptor.version; - state.plugin_name = descriptor.name; - state.cloud_uuid = descriptor.cloud_uuid(); - state.enabled = true; - } - - state.permissions.fs_read.insert(state.permissions.fs_read.end(), missing.begin(), missing.end()); - return write_install_state(boost::filesystem::path(descriptor.plugin_root), state); + // network_permission_matches() also applies the recorded host grant to raw socket events, so + // one HTTP grant covers both event layers without prompting for each list separately. + return request_permissions(plugin_key, requested); } void PluginAuditManager::report_violation(const AuditViolation& violation) @@ -575,34 +846,6 @@ bool PluginAuditManager::last_violation(AuditViolation& violation) const return true; } -bool PluginAuditManager::has_approved_ancestor(const std::string& plugin_key, - const std::vector& call_site_ids) const -{ - if (plugin_key.empty() || call_site_ids.empty()) - return false; - - std::lock_guard lock(m_mutex); - auto it = m_approved_call_sites.find(plugin_key); - if (it == m_approved_call_sites.end()) - return false; - - for (const auto& id : call_site_ids) - if (it->second.count(id)) - return true; - return false; -} - -void PluginAuditManager::record_approved_call_sites(const std::string& plugin_key, - const std::vector& call_site_ids) -{ - if (plugin_key.empty() || call_site_ids.empty()) - return; - - std::lock_guard lock(m_mutex); - auto& approved = m_approved_call_sites[plugin_key]; - approved.insert(call_site_ids.begin(), call_site_ids.end()); -} - // --------------------------------------------------------------------------- // The C-level audit hook // --------------------------------------------------------------------------- @@ -616,6 +859,39 @@ PyObject* tuple_item(PyObject* args, Py_ssize_t index) return PyTuple_GET_ITEM(args, index); } +std::string python_unicode(PyObject* object) +{ + if (!object || !PyUnicode_Check(object)) + return {}; + const char* text = PyUnicode_AsUTF8(object); + if (!text) { + PyErr_Clear(); + return {}; + } + return text; +} + +// Converts a str/bytes leaf to text, clearing a failed conversion. Returns false when `object` is +// neither str nor bytes, so callers can apply their own fallback. +bool python_text(PyObject* object, std::string& out) +{ + if (PyUnicode_Check(object)) { + out = python_unicode(object); + return true; + } + if (PyBytes_Check(object)) { + const char* value = PyBytes_AsString(object); + if (!value) { + PyErr_Clear(); + out.clear(); + return true; + } + out = value; + return true; + } + return false; +} + std::string python_path(PyObject* object) { if (!object) @@ -627,26 +903,12 @@ std::string python_path(PyObject* object) return {}; } - const char* path = PyUnicode_Check(path_object) ? PyUnicode_AsUTF8(path_object) : PyBytes_AsString(path_object); - std::string result = path ? path : ""; + std::string result; + python_text(path_object, result); Py_DECREF(path_object); - if (!path) - PyErr_Clear(); return result; } -std::string python_unicode(PyObject* object) -{ - if (!object || !PyUnicode_Check(object)) - return {}; - const char* text = PyUnicode_AsUTF8(object); - if (!text) { - PyErr_Clear(); - return {}; - } - return text; -} - std::string python_str(PyObject* object) { if (!object) @@ -663,40 +925,88 @@ std::string python_str(PyObject* object) return result; } -std::vector call_site_identities(const std::string& plugin_root) -{ - std::vector ids; - if (plugin_root.empty()) - return ids; +// The interpreter's stdlib folders, and the site-packages folders inside them that hold +// third-party code, both resolved. Set by install_hook(); like the verdict cache below, only +// touched while the GIL is held. +static std::vector s_stdlib_dirs; +static std::vector s_site_package_dirs; +static std::unordered_map s_stdlib_file_verdicts; // co_filename -> is stdlib +void collect_stdlib_dirs() +{ + s_stdlib_dirs.clear(); + s_site_package_dirs.clear(); + s_stdlib_file_verdicts.clear(); + + PyObject* sysconfig = PyImport_ImportModule("sysconfig"); + PyObject* paths = sysconfig ? PyObject_CallMethod(sysconfig, "get_paths", nullptr) : nullptr; + if (paths && PyDict_Check(paths)) { + const auto collect = [paths](const char* key, std::vector& out) { + const std::string dir = python_unicode(PyDict_GetItemString(paths, key)); // borrowed + if (dir.empty()) + return; + boost::system::error_code ec; + const boost::filesystem::path resolved = boost::filesystem::weakly_canonical(dir, ec); + out.push_back(ec ? boost::filesystem::path(dir) : resolved); + }; + collect("stdlib", s_stdlib_dirs); + collect("platstdlib", s_stdlib_dirs); + collect("purelib", s_site_package_dirs); + collect("platlib", s_site_package_dirs); + } + Py_XDECREF(paths); + Py_XDECREF(sysconfig); + if (PyErr_Occurred()) { + PyErr_Clear(); + BOOST_LOG_TRIVIAL(error) << "[AUDIT] Failed to read the stdlib folders from sysconfig"; + } +} + +bool is_stdlib_frame(PyObject* frame) +{ + PyCodeObject* code = PyFrame_GetCode(reinterpret_cast(frame)); // new reference + const std::string filename = python_unicode(code->co_filename); + Py_DECREF(code); + return PluginAuditManager::is_stdlib_file(filename); +} + +// The frames on this thread's Python stack, innermost first. The pointers stay valid while the +// caller runs, because a running activation keeps its frame object alive. +std::vector stack_frames() +{ + std::vector frames; PyFrameObject* frame = PyEval_GetFrame(); // borrowed reference Py_XINCREF(frame); // normalize to an owned reference for the loop below - while (frame) { - PyCodeObject* code = PyFrame_GetCode(frame); // new reference - const std::string filename = python_unicode(reinterpret_cast(code->co_filename)); - const bool is_plugin_frame = !filename.empty() && boost::algorithm::starts_with(filename, plugin_root); - - std::string id; - if (!is_plugin_frame && !filename.empty()) { - const std::string funcname = python_unicode(reinterpret_cast(code->co_name)); - id = filename + ":" + funcname + ":" + std::to_string(code->co_firstlineno); - } - Py_DECREF(code); - + frames.push_back(reinterpret_cast(frame)); PyFrameObject* back = PyFrame_GetBack(frame); // new reference, or nullptr at the top of the stack Py_DECREF(frame); frame = back; - - if (is_plugin_frame) - break; - if (!id.empty()) - ids.push_back(std::move(id)); } + return frames; +} - Py_XDECREF(frame); // only holds a reference here if the loop exited via break +// Moves the held root frames whose operation has returned from `held` to `dropped`. A suspended +// generator's frame (os.walk between two items) is off the stack, but its operation resumes, so +// it stays held until the scope ends. +void take_returned_frames(std::vector& held, std::vector& dropped) +{ + if (held.empty()) + return; - return ids; + const std::vector stack = stack_frames(); + const auto running = [&stack](PyObject* frame) { + if (std::find(stack.begin(), stack.end(), frame) != stack.end()) + return true; + // NULL once the generator has finished or been deleted: its frame then owns its own data. + PyObject* generator = PyFrame_GetGenerator(reinterpret_cast(frame)); // new reference + const bool suspended = generator != nullptr; + Py_XDECREF(generator); + return suspended; + }; + const auto returned = std::stable_partition(held.begin(), held.end(), running); + dropped.insert(dropped.end(), returned, held.end()); + held.erase(returned, held.end()); } static const std::unordered_set two_path_fs_events{ @@ -717,12 +1027,15 @@ static const std::unordered_map> audit_targ {"socket.getnameinfo", {0}}, {"socket.getservbyname", {0}}, {"socket.getservbyport", {0}}, + {"socket.sendto", {1}}, + {"socket.sendmsg", {1}}, {"os.system", {0}}, {"subprocess.Popen", {1, 0}}, {"os.posix_spawn", {1, 0}}, {"os.spawn", {2, 1}}, {"os.startfile", {0}}, + {"os.startfile/2", {0}}, {"pty.spawn", {0}}, {"_winapi.CreateProcess", {1, 0}}, {"_posixsubprocess.fork_exec", {0}}, @@ -758,7 +1071,7 @@ std::vector audit_targets(const std::string& event_name, AuditEvent // Thread creation exposes no user-supplied target. Use a fixed sentinel so the grant // persists per plugin: the permission list matches targets by exact string, and the // started function's repr embeds an address that changes every run. - targets.emplace_back("thread"); + targets.emplace_back(kThreadPermissionTarget); return targets; default: break; @@ -767,7 +1080,11 @@ std::vector audit_targets(const std::string& event_name, AuditEvent const auto it = audit_target_arg_indices.find(event_name); if (it != audit_target_arg_indices.end()) { for (const Py_ssize_t index : it->second) { - std::string value = python_str(tuple_item(args, index)); + // None is an argument left out (sendmsg without an address), not a target named "None". + PyObject* const item = tuple_item(args, index); + if (item == Py_None) + continue; + std::string value = python_str(item); if (!value.empty()) { targets.push_back(std::move(value)); break; @@ -778,8 +1095,14 @@ std::vector audit_targets(const std::string& event_name, AuditEvent return targets; } -std::vector* permission_list_for(AuditEventCategory category, PluginPermissions& permissions) +// The saved list that grants an event: its category's target list, or the event-grant list for +// an event with no target. Kept apart, so that no grant doubles as a target of the same name (an +// os.fork grant is not an os.exec of a command named "os.fork"). +std::vector* permission_list_for(AuditEventCategory category, bool by_event, PluginPermissions& permissions) { + if (by_event) + return &permissions.events; + switch (category) { case AuditEventCategory::FsRead: return &permissions.fs_read; case AuditEventCategory::FsReadWrite: return &permissions.fs_readwrite; @@ -792,13 +1115,142 @@ std::vector* permission_list_for(AuditEventCategory category, Plugi } } -bool has_permission(const std::vector& granted, const std::string& target) +// An event with no target is granted by its effective category and name, e.g. "FsRead:open" +// for a read of a file descriptor, which does not grant a write of one ("FsReadWrite:open"). +std::string event_grant_key(AuditEventCategory category, const std::string& event_name) { - return std::find(granted.begin(), granted.end(), target) != granted.end(); + return std::string(category_name(category)) + ":" + event_name; +} + +// The directory named by a directory-tree grant, i.e. "/*". "*" is the only wildcard, and +// only as the grant's final path component; any other "*" is an ordinary character, so a grant +// can never widen into a pattern the plugin did not spell out. Returns false for a grant that is +// not a tree grant. +bool tree_grant_root(const std::string& grant, boost::filesystem::path& root) +{ + if (grant.size() < 2 || grant.back() != '*' || grant.find('*') != grant.size() - 1) + return false; + + const boost::filesystem::path path(grant); + if (path.filename() != "*") + return false; + + const boost::filesystem::path parent = path.parent_path(); + if (parent.empty()) + return false; + + // Never resolve ".." here: a grant shown to the user as "/a/../*" must not silently become + // the root or another ancestor. Without a wildcard the string still matches verbatim. + for (const boost::filesystem::path& component : parent) { + if (component == "..") + return false; + } + + // Rebuild from the components so "." and duplicate separators do not affect the canonical + // comparison below. + boost::filesystem::path normalized; + for (const boost::filesystem::path& component : parent.lexically_normal()) { + if (!component.empty()) + normalized /= component; + } + root = std::move(normalized); + return !root.empty(); +} + +// The grant to display and store for a permission request: a recognized tree grant is resolved +// against the working directory when the request is made, so a relative "/*" names the +// directory it actually covers. Grants that are already absolute, exact (non-tree) grants, and +// the non-filesystem buckets are returned unchanged: they are matched verbatim, and re-rendering +// them would change the string the user approved. +std::string absolute_tree_grant(const std::string& grant) +{ + boost::filesystem::path root; + if (!tree_grant_root(grant, root) || root.is_absolute()) + return grant; + + boost::system::error_code ec; + const boost::filesystem::path absolute_root = boost::filesystem::absolute(root, ec); + if (ec || !absolute_root.is_absolute()) + return grant; + + return (absolute_root.lexically_normal() / "*").string(); +} + +// True when a filesystem grant covers a target: the exact string, or -- for a tree grant -- the +// granted folder itself and every path beneath it, at any depth. Components are compared one by +// one, so "/root/*" covers "/root/a/b" but not "/root-other/file". +// +// A tree grant and its target are both canonicalized before the comparison, so a symlink inside +// the granted folder cannot launder access to a path outside it, and a grant rooted at a symlink +// applies to the symlink's target. weakly_canonical keeps a write target whose tail does not +// exist yet matchable: it canonicalizes the existing prefix and appends the rest lexically. A +// dangling final symlink is not covered at all: containment fails closed, because a write through +// it would land at its target rather than at the granted path. +bool fs_grant_covers(const std::string& grant, const std::string& target) +{ + if (grant == target) + return true; + if (target.empty()) + return false; + + boost::filesystem::path root; + if (!tree_grant_root(grant, root)) + return false; + + return is_inside_allowed_root(boost::filesystem::path(target), root); +} + +// True when `granted` already covers `target`. Only the filesystem buckets accept a tree grant: +// an event grant ("FsRead:open") and the non-filesystem buckets (URLs, socket addresses, +// commands) are matched verbatim, as before. +bool has_permission(AuditEventCategory category, bool by_event, const std::vector& granted, + const std::string& target) +{ + const bool fs_bucket = + !by_event && (category == AuditEventCategory::FsRead || category == AuditEventCategory::FsReadWrite); + for (const auto& grant : granted) { + if (grant == target) + return true; + if (fs_bucket && fs_grant_covers(grant, target)) + return true; + } + return false; +} + +// A declared or previously approved network grant may live in either network list: an HTTP grant +// covers the sockets the same request opens, and a raw socket grant covers a later HTTP call to +// the same host. +bool has_network_permission(const PluginPermissions& permissions, const std::string& target) +{ + return PluginAuditManager::network_permission_matches(permissions.network_http, target) || + PluginAuditManager::network_permission_matches(permissions.network_socket, target); +} + +// A targetless network event names no host the grant could be matched against: http.client.send +// writes to a connection that was already opened. Any recorded network grant covers it. +bool has_any_network_permission(const PluginPermissions& permissions) +{ + return !permissions.network_http.empty() || !permissions.network_socket.empty(); +} + +// A sandbox plugin may not have a sidecar yet. Seed the small amount of install metadata the +// writer needs so clicking Yes still creates the JSON file. +void seed_install_metadata(const PluginDescriptor& descriptor, PluginInstallState& state) +{ + if (!state.plugin_name.empty()) + return; + + state.installed_from = descriptor.is_cloud_plugin() ? "cloud" : "local"; + state.installed_version = !descriptor.installed_version.empty() ? descriptor.installed_version : descriptor.version; + state.plugin_name = descriptor.name; + state.cloud_uuid = descriptor.cloud_uuid(); + state.enabled = true; } bool persist_permission(const std::string& plugin_key, PluginInstallState& state, + AuditEventCategory category, + bool by_event, std::vector& permission_list, const std::string& target) { @@ -806,17 +1258,9 @@ bool persist_permission(const std::string& plugin_key, if (!PluginManager::instance().try_get_plugin_descriptor(plugin_key, descriptor) || descriptor.plugin_root.empty()) return false; - // A sandbox plugin may not have a sidecar yet. Seed the small amount of install metadata - // needed by the writer so clicking Yes still creates the JSON file. - if (state.plugin_name.empty()) { - state.installed_from = descriptor.is_cloud_plugin() ? "cloud" : "local"; - state.installed_version = !descriptor.installed_version.empty() ? descriptor.installed_version : descriptor.version; - state.plugin_name = descriptor.name; - state.cloud_uuid = descriptor.cloud_uuid(); - state.enabled = true; - } + seed_install_metadata(descriptor, state); - if (!has_permission(permission_list, target)) + if (!has_permission(category, by_event, permission_list, target)) permission_list.push_back(target); return write_install_state(boost::filesystem::path(descriptor.plugin_root), state); } @@ -869,9 +1313,17 @@ wxString audit_message(AuditEventCategory category, const wxString& plugin_name, "Plugin \"%s\" is requesting to delete the following files:\n%s", target_count), plugin_name, target_list); case AuditEventCategory::Http: - return wxString::Format(_L("Plugin \"%s\" is requesting to make an HTTP request to:\n%s"), plugin_name, target_list); + return wxString::Format( + _L("Plugin \"%s\" is requesting network access to:\n%s\n\n" + "Approval covers HTTP or HTTPS access and raw network connections to the listed hosts. " + "It does not restrict ports. A URL with a path, query or port is covered only for that " + "exact URL."), + plugin_name, target_list); case AuditEventCategory::Socket: - return wxString::Format(_L("Plugin \"%s\" is requesting to open a network connection to:\n%s"), plugin_name, target_list); + return wxString::Format( + _L("Plugin \"%s\" is requesting network access to:\n%s\n\n" + "Approval covers raw network connections to the listed hosts. It does not restrict ports."), + plugin_name, target_list); case AuditEventCategory::ProcessCreate: return wxString::Format(_L_PLURAL("Plugin \"%s\" is requesting to run the following command:\n%s", "Plugin \"%s\" is requesting to run the following commands:\n%s", target_count), @@ -893,92 +1345,422 @@ bool prompt_for_targets(AuditEventCategory category, const std::string& plugin_n for (const auto& target : unresolved) target_list += wxString::FromUTF8(target.c_str()) + "\n"; - wxMessageDialog dialog(nullptr, - audit_message(category, wxString::FromUTF8(plugin_name.c_str()), - wxString::FromUTF8(event_name.c_str()), target_list, unresolved.size()), - _L("Plugin permission request"), wxYES_NO | wxICON_WARNING); + return show_permission_dialog( + audit_message(category, wxString::FromUTF8(plugin_name.c_str()), wxString::FromUTF8(event_name.c_str()), + target_list, unresolved.size()), + _L("Plugin permission request")); +} + +// Shows a prompt whose body may cover several permission buckets. Must run on the GUI thread. +bool prompt_for_permission_message(const wxString& message) +{ + wxMessageDialog dialog(nullptr, message, _L("Plugin permissions"), wxYES_NO | wxICON_WARNING); return dialog.ShowModal() == wxID_YES; } // Records a grant in the plugin's sidecar so it is not asked again. Reads the install state // freshly because the async prompt outlives the caller's stack copy of it. -void persist_grant(const std::string& plugin_key, AuditEventCategory category, const std::vector& targets) +void persist_grant(const std::string& plugin_key, AuditEventCategory category, bool by_event, const std::vector& keys) { PluginInstallState state; if (!PluginManager::instance().get_install_state(plugin_key, state)) return; - std::vector* permission_list = permission_list_for(category, state.permissions); + std::vector* permission_list = permission_list_for(category, by_event, state.permissions); if (!permission_list) return; - for (const auto& target : targets) - persist_permission(plugin_key, state, *permission_list, target); + for (const auto& key : keys) + persist_permission(plugin_key, state, category, by_event, *permission_list, key); } -// Requests permission for an audited event, returning true when it is already granted or the user -// approves an inline prompt. +static PluginAuditManager::PermissionPrompt s_permission_prompt_for_testing; +static PluginAuditManager::PermissionMessagePrompt s_permission_message_prompt_for_testing; + +static const char* audit_category_name(AuditEventCategory category) +{ + switch (category) { + case AuditEventCategory::FsRead: return "FsRead"; + case AuditEventCategory::FsReadWrite: return "FsReadWrite"; + case AuditEventCategory::FsCreate: return "FsCreate"; + case AuditEventCategory::FsDelete: return "FsDelete"; + case AuditEventCategory::Http: return "Http"; + case AuditEventCategory::Socket: return "Socket"; + case AuditEventCategory::ProcessCreate: return "ProcessCreate"; + case AuditEventCategory::ProcessReplace: return "ProcessReplace"; + case AuditEventCategory::Threading: return "Threading"; + default: return "None"; + } +} + +// Asks the user to grant an audited event, returning true when they approve an inline prompt. +// `keys` are what a Yes saves: the unresolved targets, or the event-grant key when the event has +// no target (by_event), which the prompt does not show as a target. // // An audited event can fire on a thread the UI thread may itself be blocked waiting on: the // SlicingPipeline hook runs on the slicing worker thread (see PluginHooks.cpp), and // BackgroundSlicingProcess::stop()/stop_internal() park the UI thread until that worker stops. // Blocking the worker on a marshaled modal -- which is safe for the plugin-load worker that -// request_filesystem_read_permissions runs on -- would therefore deadlock the application (the +// request_permissions runs on -- would therefore deadlock the application (the // invariant PluginHostUi.cpp documents for slicing-hook UI calls). Off the main thread the prompt // is therefore posted asynchronously and the current event denied (fail closed, like an unanswered // prompt); the grant is persisted once the user accepts, so a later attempt succeeds without // re-prompting. bool request_permission(AuditEventCategory category, const std::string& plugin_key, const std::string& plugin_name, - const std::string& event_name, const std::vector& unresolved) + const std::string& event_name, bool by_event, const std::vector& keys) { + const std::vector shown = by_event ? std::vector{} : keys; + std::string targets_text = by_event ? "" : ""; + for (const auto& target : shown) { + if (!targets_text.empty()) + targets_text += ", "; + targets_text += target; + } + + BOOST_LOG_TRIVIAL(info) << "[AUDIT PROMPT] plugin=" << plugin_key << " event=" << event_name + << " category=" << audit_category_name(category) << " targets=[" << targets_text << "]" + << (by_event && !keys.empty() ? " grant=" + keys.front() : std::string{}); + + if (s_permission_prompt_for_testing) + return s_permission_prompt_for_testing(event_name, shown); + if (wxTheApp == nullptr || GUI::wxGetApp().is_closing()) return false; if (wxIsMainThread()) - return prompt_for_targets(category, plugin_name, event_name, unresolved); + return prompt_for_targets(category, plugin_name, event_name, shown); - GUI::wxGetApp().CallAfter([category, plugin_key, plugin_name, event_name, unresolved]() { + GUI::wxGetApp().CallAfter([category, plugin_key, plugin_name, event_name, by_event, keys, shown]() { if (wxTheApp == nullptr || GUI::wxGetApp().is_closing()) return; - if (prompt_for_targets(category, plugin_name, event_name, unresolved)) - persist_grant(plugin_key, category, unresolved); + if (prompt_for_targets(category, plugin_name, event_name, shown)) + persist_grant(plugin_key, category, by_event, keys); }); return false; } +// Decides an event that no allowed root or running operation covers: a saved grant allows it, +// otherwise the user is asked and a Yes is saved. int decide_audited_event(PluginAuditManager& mgr, PluginInstallState& state, const std::string& plugin_key, const std::string& plugin_name, const std::string& event_name, AuditEventCategory category, - const std::vector& targets, - std::vector* permission_list, - const std::vector& call_site_ids) + const std::vector& targets) { - std::vector unresolved = targets; - if (permission_list) { + const bool by_event = targets.empty(); + const std::vector keys = by_event ? std::vector{event_grant_key(category, event_name)} : targets; + std::vector* permission_list = permission_list_for(category, by_event, state.permissions); + + std::vector unresolved = keys; + if (permission_list || is_network_category(category)) { unresolved.clear(); - for (const auto& target : targets) - if (!has_permission(*permission_list, target)) - unresolved.push_back(target); - if (!targets.empty() && unresolved.empty()) + for (const auto& key : keys) { + // A network grant authorizes a specific host, except for a targetless event such as + // http.client.send, which names no host: any network grant covers that. + const bool granted_network = + is_network_category(category) && + (by_event ? has_any_network_permission(state.permissions) + : has_network_permission(state.permissions, key)); + if (!(permission_list && has_permission(category, by_event, *permission_list, key)) && !granted_network) + unresolved.push_back(key); + } + if (unresolved.empty()) return 0; } - if (!request_permission(category, plugin_key, plugin_name, event_name, unresolved)) + // Letting a root frame go runs finalizers inside a scope destructor or another event's hook, + // where no dialog may open: what they do must already be granted. + if (mgr.releasing_frames()) + return report_denied(mgr, event_name, {false, "audit permission required"}); + + if (!request_permission(category, plugin_key, plugin_name, event_name, by_event, unresolved)) return report_denied(mgr, event_name, {false, "audit permission required"}); if (permission_list) - for (const auto& target : unresolved) - persist_permission(plugin_key, state, *permission_list, target); - - mgr.record_approved_call_sites(plugin_key, call_site_ids); + for (const auto& key : unresolved) + persist_permission(plugin_key, state, category, by_event, *permission_list, key); return 0; } +// Judges an audited event raised while a plugin context is active. +int audit_plugin_event(PluginAuditManager& mgr, const std::string& event_name, AuditEventCategory event_type, PyObject* args) +{ + const bool fs_category = is_fs_category(event_type); + const std::vector targets = audit_targets(event_name, event_type, args); + + // A denied path (secrets, certificates, config files -- see is_denied_path) is an + // unconditional block: checked before the running-operation check below, so no granted + // operation can launder access to one, and before the allowed-root shortcut further down, + // so an allowed root (e.g. the read-only resources folder) cannot make a denied path + // underneath it reachable. + if (fs_category) { + for (const auto& target : targets) { + if (mgr.is_denied_path(boost::filesystem::path(target))) + return report_denied(mgr, event_name, {false, "denied path"}, target); + } + } + + // A nested event of an operation already granted, e.g. socket.connect inside an approved + // urlopen(), is not asked again. urllib.Request is always judged on its own URL, so a + // redirect or a nested urlopen() inside a running request is not covered by it. + if (event_name != "urllib.Request" && mgr.covered_by_root_frame()) + return 0; + + // A filesystem target that resolves entirely inside a pre-determined allowed root -- the + // plugin system's own data_dir() tree (which holds each plugin's storage folder and the + // installed/system profile cache), the read-only bundled resources folder, or a per-call + // scoped root such as the current G-code folder -- is part of the plugin system's normal + // workflow and does not need a prompt. + if (fs_category && !targets.empty()) { + const bool is_write = event_type != AuditEventCategory::FsRead; + const bool all_inside_allowed_root = + std::all_of(targets.begin(), targets.end(), [&](const std::string& target) { + return mgr.check_path_access(boost::filesystem::path(target), is_write).allowed; + }); + if (all_inside_allowed_root) + return 0; + } + + PluginInstallState state; + const bool have_install_state = PluginManager::instance().get_install_state(mgr.current_plugin(), state); + if (!have_install_state) { + BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << " Failed to get install state for " << mgr.current_plugin(); + } + + const std::string plugin_name = state.plugin_name.empty() ? mgr.current_plugin() : state.plugin_name; + + const int result = decide_audited_event(mgr, state, mgr.current_plugin(), plugin_name, event_name, event_type, targets); + + // A granted operation covers its nested events while it runs. A targetless grant names no + // operation, so it covers nothing else. + if (result == 0 && !targets.empty() && operation_root_events.count(event_name)) + mgr.record_root_frame(); + return result; +} + } // namespace PluginAuditDetail +bool PluginAuditManager::request_permissions(const std::string& plugin_key, const PluginPermissions& requested) +{ + if (plugin_key.empty()) + return true; + + PluginDescriptor descriptor; + if (!PluginManager::instance().try_get_plugin_descriptor(plugin_key, descriptor) || descriptor.plugin_root.empty()) + return false; + + PluginInstallState state; + read_install_state(boost::filesystem::path(descriptor.plugin_root), state); + + // Per bucket, keep only the targets that no earlier grant already covers. Dropping these + // before prompting keeps a repeated declaration from asking again for what is on disk. + struct MissingBucket { + AuditEventCategory category; + std::vector targets; + }; + std::vector missing_buckets; + + // A network target counts as granted when either network list covers it, matched the same + // way the audit hook matches it (canonical scheme://host, bare host, legacy address tuple), + // so a declaration that is already reachable is not asked for again. + const auto collect_missing = [&missing_buckets, &state](AuditEventCategory category, + const std::vector& requested_targets, + const std::vector& granted_targets) { + // Only the filesystem buckets accept a tree grant. Network targets match by host and the + // remaining buckets verbatim. + const bool tree_grant_bucket = + category == AuditEventCategory::FsRead || category == AuditEventCategory::FsReadWrite; + MissingBucket bucket{category, {}}; + for (const std::string& requested_target : requested_targets) { + if (requested_target.empty()) + continue; + // A relative wildcard names a directory relative to the working directory the request + // is made in, while the audit hook reports absolute targets. Resolve it once, here, so + // the prompt shows and the sidecar stores the scope the grant actually covers. + const std::string target = tree_grant_bucket + ? PluginAuditDetail::absolute_tree_grant(requested_target) + : requested_target; + // A saved wildcard already covers a more specific request. Deduplicate inside the + // request verbatim only: two requested entries may cover different sets. + const bool already_granted = + is_network_category(category) + ? PluginAuditDetail::has_network_permission(state.permissions, target) + : PluginAuditDetail::has_permission(category, /*by_event=*/false, granted_targets, target); + + if (!already_granted && std::find(bucket.targets.begin(), bucket.targets.end(), target) == bucket.targets.end()) + bucket.targets.push_back(target); + } + if (!bucket.targets.empty()) + missing_buckets.push_back(std::move(bucket)); + }; + + collect_missing(AuditEventCategory::FsRead, requested.fs_read, state.permissions.fs_read); + collect_missing(AuditEventCategory::FsReadWrite, requested.fs_readwrite, state.permissions.fs_readwrite); + collect_missing(AuditEventCategory::Http, requested.network_http, state.permissions.network_http); + collect_missing(AuditEventCategory::Socket, requested.network_socket, state.permissions.network_socket); + collect_missing(AuditEventCategory::ProcessCreate, requested.process, state.permissions.process); + collect_missing(AuditEventCategory::Threading, requested.threading, state.permissions.threading); + + if (missing_buckets.empty()) + return true; + + const auto build_message = [](const std::string& plugin_name, const std::vector& buckets) { + wxString message; + for (const MissingBucket& bucket : buckets) { + wxString targets; + for (const std::string& target : bucket.targets) + targets += wxString::FromUTF8(target.c_str()) + "\n"; + + if (!message.IsEmpty()) + message += "\n\n"; + message += PluginAuditDetail::audit_message(bucket.category, wxString::FromUTF8(plugin_name.c_str()), + wxEmptyString, targets, bucket.targets.size()); + } + return message; + }; + + bool granted = false; + if (PluginAuditDetail::s_permission_message_prompt_for_testing) { + // Tests run without a wxApp to host the dialog: hand the seam the message it would show. + granted = PluginAuditDetail::s_permission_message_prompt_for_testing( + build_message(descriptor.name, missing_buckets).utf8_string()); + } else if (wxTheApp == nullptr || GUI::wxGetApp().is_closing()) { + return false; + } else if (wxIsMainThread()) { + granted = PluginAuditDetail::prompt_for_permission_message(build_message(descriptor.name, missing_buckets)); + } else { + auto result = std::make_shared>(); + auto future = result->get_future(); + GUI::wxGetApp().CallAfter([result, plugin_name = descriptor.name, missing_buckets, build_message]() { + result->set_value(PluginAuditDetail::prompt_for_permission_message(build_message(plugin_name, missing_buckets))); + }); + granted = future.get(); + } + + if (!granted) + return false; + + // The dialog can stay open while another grant is persisted; re-read before saving so this + // request adds to the current state instead of replacing it. + PluginInstallState latest_state; + if (read_install_state(boost::filesystem::path(descriptor.plugin_root), latest_state)) + state = std::move(latest_state); + + PluginAuditDetail::seed_install_metadata(descriptor, state); + + for (const MissingBucket& bucket : missing_buckets) { + std::vector* permission_list = + PluginAuditDetail::permission_list_for(bucket.category, /*by_event=*/false, state.permissions); + if (!permission_list) + continue; + for (const std::string& target : bucket.targets) + if (std::find(permission_list->begin(), permission_list->end(), target) == permission_list->end()) + permission_list->push_back(target); + } + + return write_install_state(boost::filesystem::path(descriptor.plugin_root), state); +} + +void PluginAuditManager::record_root_frame() +{ + PyObject* frame = reinterpret_cast(PyEval_GetFrame()); // borrowed reference + if (!frame || !PluginAuditDetail::is_stdlib_frame(frame)) + return; + if (std::find(m_root_frames.begin(), m_root_frames.end(), frame) != m_root_frames.end()) + return; // glob.glob and glob.glob/2 share a frame + Py_INCREF(frame); + m_root_frames.push_back(frame); +} + +bool PluginAuditManager::covered_by_root_frame() const +{ + if (m_root_frames.empty()) + return false; + + // Only stdlib frames may sit between the event and the operation: plugin or library code + // the operation calls back into (an os.walk onerror, a urllib handler) acts on its own. + for (PyObject* frame : PluginAuditDetail::stack_frames()) { + if (std::find(m_root_frames.begin(), m_root_frames.end(), frame) != m_root_frames.end()) + return true; + if (!PluginAuditDetail::is_stdlib_frame(frame)) + return false; + } + return false; +} + +bool PluginAuditManager::releasing_frames() const { return m_releasing_frames > 0; } + +bool PluginAuditManager::is_stdlib_file(const std::string& filename) +{ + // Frozen stdlib modules (os, posixpath, codecs, ...) carry a pseudo filename. + if (boost::algorithm::starts_with(filename, "& dirs) { + return std::any_of(dirs.begin(), dirs.end(), + [&file](const boost::filesystem::path& dir) { return is_inside_allowed_root(file, dir); }); + }; + it->second = inside_any(PluginAuditDetail::s_stdlib_dirs) && !inside_any(PluginAuditDetail::s_site_package_dirs); + } + return it->second; +} + +bool PluginAuditManager::is_stdlib_path(const boost::filesystem::path& path) +{ + if (path.empty()) + return false; + + const auto inside_any = [&path](const std::vector& dirs) { + return std::any_of(dirs.begin(), dirs.end(), + [&path](const boost::filesystem::path& dir) { return is_inside_allowed_root(path, dir); }); + }; + return inside_any(PluginAuditDetail::s_stdlib_dirs) && !inside_any(PluginAuditDetail::s_site_package_dirs); +} + +void PluginAuditManager::release_frames(std::vector& frames) +{ + if (frames.empty()) + return; + + // A finalizer's own denial must neither replace the PermissionError of the event being + // decided nor leave a stale denial behind for the next call. + PyObject* const error = PyErr_GetRaisedException(); + const bool denial_pending = m_audit_denial_pending; + const bool has_violation = m_has_last_violation; + const AuditViolation violation = m_last_violation; + + std::vector released; + released.swap(frames); + ++m_releasing_frames; + for (PyObject* frame : released) + Py_DECREF(frame); + --m_releasing_frames; + + m_audit_denial_pending = denial_pending; + m_has_last_violation = has_violation; + m_last_violation = violation; + PyErr_SetRaisedException(error); +} + +void PluginAuditManager::set_permission_prompt_for_testing(PermissionPrompt prompt) +{ + PluginAuditDetail::s_permission_prompt_for_testing = std::move(prompt); +} + +void PluginAuditManager::set_permission_message_prompt_for_testing(PermissionMessagePrompt prompt) +{ + PluginAuditDetail::s_permission_message_prompt_for_testing = std::move(prompt); +} + int PluginAuditManager::audit_hook(const char* event, PyObject* args, void* user_data) { auto* mgr = static_cast(user_data); @@ -1006,62 +1788,20 @@ int PluginAuditManager::audit_hook(const char* event, PyObject* args, void* user if (event_type == AuditEventCategory::None) return 0; - const bool fs_category = is_fs_category(event_type); - const std::vector targets = PluginAuditDetail::audit_targets(event_name, event_type, args); - - // A denied path (secrets, certificates, config files -- see is_denied_path) is an - // unconditional block: checked before the ancestor-cascade check below, so a cascade - // approval recorded for an unrelated action can never launder access to one, and before - // the allowed-root shortcut further down, so an allowed root (e.g. the read-only resources - // folder) cannot make a denied path underneath it reachable. - if (fs_category) { - for (const auto& target : targets) { - if (mgr->is_denied_path(boost::filesystem::path(target))) - return PluginAuditDetail::report_denied(*mgr, event_name, {false, "denied path"}, target); - } - } - - PluginDescriptor plugin_descriptor; - PluginManager::instance().try_get_plugin_descriptor(mgr->current_plugin(), plugin_descriptor); - - // Some plugins call other audited events, e.g. urlib.request will call socket.connect. So this is so that if urlib.request - // was already approved, socket.connect won't trigger another permission dialog. - const std::vector call_site_ids = - PluginAuditDetail::call_site_identities(plugin_descriptor.plugin_root); - if (mgr->has_approved_ancestor(mgr->current_plugin(), call_site_ids)) - return 0; - - // A filesystem target that resolves entirely inside a pre-determined allowed root -- the - // plugin system's own data_dir() tree (which holds each plugin's storage folder and the - // installed/system profile cache), the read-only bundled resources folder, or a per-call - // scoped root such as the current G-code folder -- is part of the plugin system's normal - // workflow and does not need a prompt. - if (fs_category && !targets.empty()) { - const bool is_write = event_type != AuditEventCategory::FsRead; - const bool all_inside_allowed_root = - std::all_of(targets.begin(), targets.end(), [&](const std::string& target) { - return mgr->check_path_access(boost::filesystem::path(target), is_write).allowed; - }); - if (all_inside_allowed_root) - return 0; - } - - PluginInstallState state; - const bool have_install_state = PluginManager::instance().get_install_state(mgr->current_plugin(), state); - if (!have_install_state) { - BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << " Failed to get install state for " << mgr->current_plugin(); - } - - const std::string plugin_name = state.plugin_name.empty() ? mgr->current_plugin() : state.plugin_name; - - std::vector* permission_list = PluginAuditDetail::permission_list_for(event_type, state.permissions); - - return PluginAuditDetail::decide_audited_event(*mgr, state, mgr->current_plugin(), plugin_name, event_name, - event_type, targets, permission_list, call_site_ids); + // Root frames whose operation has returned are let go once this event is decided, so that a + // finalizer they run re-enters a hook whose held frames are already consistent. + std::vector returned_frames; + PluginAuditDetail::take_returned_frames(m_root_frames, returned_frames); + const int result = PluginAuditDetail::audit_plugin_event(*mgr, event_name, event_type, args); + mgr->release_frames(returned_frames); + return result; } void PluginAuditManager::install_hook() { + // Identifies stdlib frames for operation roots and stdlib paths for read-only access. + PluginAuditDetail::collect_stdlib_dirs(); + // data_dir() is the primary globally-allowed root during plugin execution: read+write. It // covers the plugin system's own workflow needs -- each plugin's storage folder // (data_dir()/orca_plugins) and the installed/system profile cache (data_dir()/system) -- @@ -1076,8 +1816,9 @@ void PluginAuditManager::install_hook() // "cert" denied-path keyword seeded below. add_global_allowed_root(resources_dir(), /*allow_write=*/false); - // The user's app config and cloud credentials live directly inside data_dir(), so the - // root just granted would otherwise expose them to any plugin. Deny them by name. + // The user's app config and cloud credentials live directly inside data_dir(), and plugin + // install state lives beneath it, so the root just granted would otherwise expose them to + // plugins. Deny them by name. // // Seeded here rather than by each secret's owner because install_hook() runs during lazy // interpreter init and therefore provably precedes any plugin bytecode, whereas @@ -1088,10 +1829,12 @@ void PluginAuditManager::install_hook() for (const auto& name : default_denied_filenames()) add_denied_filename(name); - // Categorical denies on top of the exact-name list above: no path a plugin can reach may - // contain a "secret", "cert"(ificate), or "conf"(ig) path component, regardless of which - // allowed root it happens to sit inside. default_denied_path_keywords() is the single - // source of this list; the tests seed from it too. + // Categorical denies on top of the exact-name list above: a path a plugin reaches must not + // have a "secret", "cert"(ificate), or "conf"(ig) component below data_dir() -- or anywhere + // in the path outside data_dir(), whose own location may legitimately contain one (Flatpak + // keeps it under .../config/OrcaSlicer). This holds regardless of which allowed root the + // path happens to sit inside. default_denied_path_keywords() is the single source of this + // list; the tests seed from it too. for (const auto& keyword : default_denied_path_keywords()) add_denied_path_keyword(keyword); diff --git a/src/slic3r/plugin/PluginAuditManager.hpp b/src/slic3r/plugin/PluginAuditManager.hpp index 41d3dca1e8..b85a528840 100644 --- a/src/slic3r/plugin/PluginAuditManager.hpp +++ b/src/slic3r/plugin/PluginAuditManager.hpp @@ -4,16 +4,21 @@ // Via pybind11 so this file requests the same python3xx.lib as everything else. #include #include +#include #include #include -#include -#include #include #include namespace Slic3r { +struct PluginPermissions; + +// Thread creation exposes no user-supplied target, so both the runtime audit event and a +// request_permissions(threading=True) declaration use this fixed target. +inline constexpr const char* kThreadPermissionTarget = "thread"; + struct AuditDecision { bool allowed = true; std::string reason; @@ -49,7 +54,9 @@ enum class AuditEventCategory { }; // Returns true if candidate resolves to a path inside allowed_root. -// Uses weakly_canonical and component-wise comparison to reject traversal attacks. +// Uses weakly_canonical and component-wise comparison to reject traversal attacks. A candidate +// whose final component is a dangling symlink is never inside: containment fails closed rather +// than authorizing the destination a write through it would create. bool is_inside_allowed_root(const boost::filesystem::path& candidate, const boost::filesystem::path& allowed_root); @@ -103,12 +110,13 @@ public: bool is_denied_filename(const boost::filesystem::path& candidate) const; // --- denied-path-keyword registry --- - // Keywords that categorically deny a path if ANY component matches one case-insensitively -- + // Keywords that categorically deny a path when a component matches one case-insensitively -- // e.g. a "secrets" subfolder, a "certificates" folder, a "conf"/"config" directory, or a // .conf/.ini file anywhere the plugin can otherwise reach, including inside an allowed root. - // This is broader than the exact-name is_denied_filename registry, but it is not a substring - // match: importable modules such as numpy/__config__.py, configparser.py, sysconfig.py, or - // user folders such as "Conference" and "Concert" are unrelated names and must stay promptable. + // The components above the app's data_dir() are not considered (see below). This is broader + // than the exact-name is_denied_filename registry, but it is not a substring match: + // importable modules such as numpy/__config__.py, configparser.py, sysconfig.py, or user + // folders such as "Conference" and "Concert" are unrelated names and must stay promptable. void add_denied_path_keyword(const std::string& keyword); // The list install_hook() seeds into the keyword registry. Exposed so tests seed the exact @@ -116,7 +124,10 @@ public: static std::vector default_denied_path_keywords(); // True when any component of candidate's (canonicalized) path matches a registered keyword, - // case-insensitively. A registered "conf" keyword also blocks .conf/.ini file components. + // case-insensitively. Inside data_dir(), only the components below data_dir() are checked: + // the app's own data folder may itself sit under a component named like a keyword (Flatpak + // keeps it under .../config/OrcaSlicer), which must not deny everything inside it. A + // registered "conf" keyword also blocks .conf/.ini file components. bool is_denied_path_keyword(const boost::filesystem::path& candidate) const; // is_denied_filename(candidate) || is_denied_path_keyword(candidate). Convenience for @@ -131,12 +142,53 @@ public: AuditDecision check_path_access(const boost::filesystem::path& candidate, bool is_write); AuditDecision check_open(const std::string& path, const std::string& mode); - // Ask the user to grant the requested filesystem-read paths. The request may originate on a - // plugin load worker, so the implementation marshals the modal dialog to the wx main thread. - // Returns true only when every missing path was granted and persisted; denial aborts the plugin - // load without adding a permission. - bool request_filesystem_read_permissions(const std::string& plugin_key, - const std::vector& paths); + // Ask the user to grant the requested permissions. The request may originate on a plugin + // load worker, so the implementation marshals the modal dialog to the wx main thread. + // Targets already persisted for the plugin are not shown or asked for again. Returns true + // only when every missing target was granted and persisted; denial aborts the plugin load + // without adding a permission. + // + // A filesystem target may name a directory tree: a trailing "/*" (e.g. "/path/to/folder/*") + // grants the folder itself and every path beneath it, at any depth. "*" is the only wildcard + // and is only recognized as the final path component; elsewhere it is an ordinary character. + // The wildcard applies to fs_read and fs_readwrite only, never to event grants or the other + // buckets, and a read grant still never authorizes a write (or the reverse). Denied paths + // stay denied regardless of a covering wildcard. + // + // A relative tree grant is resolved against the working directory when the request is made: + // the prompt shows, and the sidecar stores, the absolute scope it covers. Exact grants and + // the non-filesystem buckets are stored and compared verbatim. + // + // Tree grants are matched on canonical paths: a symlink below the granted folder does not + // extend the grant outside it, and a grant whose root is a symlink applies to its target. A + // target whose final component is a dangling symlink is never covered, since a write through + // it would create the link's target rather than the path the grant describes. Exact + // (non-tree) grants keep their verbatim string comparison. + bool request_permissions(const std::string& plugin_key, const PluginPermissions& requested); + + // Ask the user to grant network access to the given http(s) URLs. Each URL is reduced to its + // scheme and host before prompting and persisting, so one approval covers every path, query + // and port on that host. The grant is recorded as an HTTP grant; network_permission_matches + // applies it to raw socket events for the same host too. Like request_permissions, the request + // may originate on a plugin load worker; denial aborts the plugin load without adding a + // permission. + bool request_network_permissions(const std::string& plugin_key, + const std::vector& urls); + + // Canonical scheme://host form used to store and match network permissions. Returns an empty + // string unless `url` is an absolute http(s) URL with a host. The path, query, fragment, + // userinfo and port are discarded; scheme and host are lowercased. + static std::string normalize_network_url(const std::string& url); + + // True when a granted scheme://host entry covers `target`. `target` is a URL (urllib.Request), + // a bare host (http.client.connect, socket.getaddrinfo) or an address as exposed by the audit + // event (a hostname, a host:port pair, or a legacy persisted tuple such as "('host', 443)"). + // URL targets must match both scheme and host. Canonical scheme://host grants cover all paths; + // older full-URL grants remain exact. A bare host carries no scheme, so it matches the host of + // a canonical scheme://host grant only; a full-URL grant does not authorize raw sockets to its + // host, and a bare host never matches a different host. + static bool network_permission_matches(const std::vector& granted, + const std::string& target); void report_violation(const AuditViolation& violation); bool audit_denial_pending() const; @@ -144,15 +196,32 @@ public: void clear_last_violation(); bool last_violation(AuditViolation& violation) const; - // --- call-site cascade cache --- - // A single plugin action often fires several nested CPython audit events as it passes - // through stdlib layers (urllib.request calling http.client calling socket, for example). - // Once the user approves one event, every stdlib frame still on the stack for that call - // is recorded here by (filename, function, first line) identity. A later event whose own - // ancestor chain still contains one of those frames is the same logical action seen from - // a deeper layer, so it is auto-approved instead of prompting again. - bool has_approved_ancestor(const std::string& plugin_key, const std::vector& call_site_ids) const; - void record_approved_call_sites(const std::string& plugin_key, const std::vector& call_site_ids); + // --- operation-root frames --- + // One stdlib operation fires several nested audit events as it passes through lower layers: + // urlopen() raises urllib.Request, then http.client and socket events. When an operation's + // own root event is granted (by a saved grant or the user), the stdlib frame that raised it + // is held, and a later event whose stack reaches that frame through stdlib frames only is + // part of the same operation, so it is allowed without a prompt of its own. Plugin or + // library code the operation calls back into is judged on its own. A frame is let go once it + // returns, a suspended generator's (os.walk) when the audit scope ends. Letting a frame go may + // run finalizers of objects its locals held; they are judged as the plugin and never prompt. + void record_root_frame(); + bool covered_by_root_frame() const; + bool releasing_frames() const; + + // True when code from `filename` (a code object's co_filename) is the interpreter's own + // stdlib: the only code a root frame's coverage passes through. Valid after install_hook(). + static bool is_stdlib_file(const std::string& filename); + + // Answers permission prompts in place of the dialog, for tests. Production never sets it. + using PermissionPrompt = std::function& targets)>; + static void set_permission_prompt_for_testing(PermissionPrompt prompt); + + // Answers the combined permission-request prompt in place of the dialog, receiving the message + // it would show. Tests run without a wxApp, so this seam also stands in for the app check. + // Production never sets it. + using PermissionMessagePrompt = std::function; + static void set_permission_message_prompt_for_testing(PermissionMessagePrompt prompt); bool verbose_events = true; @@ -163,24 +232,38 @@ private: static int audit_hook(const char* event, PyObject* args, void* user_data); + // True for paths inside the interpreter's stdlib, excluding site-packages. Unlike + // is_stdlib_file(), this query is not cached because filesystem paths may resolve through + // symlinks that can change. + static bool is_stdlib_path(const boost::filesystem::path& path); + + // Drops the references in `frames`, keeping the caller's error and denial state intact. + void release_frames(std::vector& frames); + static thread_local std::string m_current_plugin_key; static thread_local std::string m_current_capability_name; static thread_local std::vector m_scoped_allowed_roots; + static thread_local std::vector m_root_frames; // strong references + static thread_local int m_releasing_frames; static thread_local bool m_audit_denial_pending; static thread_local bool m_has_last_violation; static thread_local AuditViolation m_last_violation; - // mutable: is_denied_filename() and has_approved_ancestor() are const queries that must lock. + // mutable: is_denied_filename() is a const query that must lock. mutable std::mutex m_mutex; + std::vector m_global_allowed_roots; std::vector m_denied_filenames; std::vector m_denied_path_keywords; - std::unordered_map> m_approved_call_sites; // plugin_key -> call-site ids }; // RAII guard that sets the current plugin key and capability name, restoring the previous // pair on scope exit. `capability_name` may be empty for calls that are not scoped to a // single capability. +// +// Each scope owns the root frames recorded inside it and lets them go, as its own plugin, before +// restoring the outer context. That needs the GIL whenever a frame is still held, so construct +// the scope after the GIL guard, to be destroyed before it. class ScopedPluginAuditContext { public: @@ -194,9 +277,12 @@ public: ScopedPluginAuditContext& operator=(const ScopedPluginAuditContext&) = delete; private: + std::string m_plugin_key; + std::string m_capability; std::string m_previous_id; std::string m_previous_capability; std::vector m_previous_scoped_roots; + std::vector m_previous_root_frames; }; } // namespace Slic3r diff --git a/src/slic3r/plugin/PluginFsUtils.cpp b/src/slic3r/plugin/PluginFsUtils.cpp index 1dd8391ad7..2b4a38928a 100644 --- a/src/slic3r/plugin/PluginFsUtils.cpp +++ b/src/slic3r/plugin/PluginFsUtils.cpp @@ -808,6 +808,7 @@ bool read_install_state(const boost::filesystem::path& plugin_dir, PluginInstall read_string_list("network_socket", parsed.permissions.network_socket); read_string_list("process", parsed.permissions.process); read_string_list("threading", parsed.permissions.threading); + read_string_list("events", parsed.permissions.events); } if (state.contains("enabled") && state["enabled"].is_boolean()) @@ -832,6 +833,29 @@ bool read_install_state(const boost::filesystem::path& plugin_dir, PluginInstall } } +namespace { + +// The single descriptor -> sidecar metadata mapping. Prefer installed_version (fetched at install +// time and preserved across rewrites) over a possibly stale manifest version. +void apply_install_metadata(PluginInstallState& state, const PluginDescriptor& entry) +{ + state.installed_from = entry.is_cloud_plugin() ? "cloud" : "local"; + state.installed_version = !entry.installed_version.empty() ? entry.installed_version : entry.version; + state.plugin_name = entry.name; + state.cloud_uuid = entry.cloud_uuid(); +} + +} // namespace + +void seed_install_metadata(PluginInstallState& state, const PluginDescriptor& entry) +{ + if (!state.plugin_name.empty()) + return; + + apply_install_metadata(state, entry); + state.enabled = true; +} + bool write_install_state(const boost::filesystem::path& plugin_dir, const PluginInstallState& state) { namespace fs = boost::filesystem; @@ -852,6 +876,7 @@ bool write_install_state(const boost::filesystem::path& plugin_dir, const Plugin {"network_socket", state.permissions.network_socket}, {"process", state.permissions.process}, {"threading", state.permissions.threading}, + {"events", state.permissions.events}, }; nlohmann::json capabilities = nlohmann::json::array(); @@ -874,16 +899,9 @@ bool write_install_state(const boost::filesystem::path& plugin_dir, const Plugin // Loading a plugin updates its lifecycle/capability state, but must retain permissions granted // during register_capabilities() or by a previous runtime audit prompt. read_install_state(plugin_dir, state); - state.installed_from = entry.is_cloud_plugin() ? "cloud" : "local"; - // Prefer the descriptor's recorded installed_version (the version fetched from the cloud - // at install time, preserved across sidecar re-writes) so a stale manifest/PEP723 header - // never overwrites the source-of-truth version. Fall back to the manifest version for - // first-time/local installs where installed_version is not yet populated. - state.installed_version = !entry.installed_version.empty() ? entry.installed_version : entry.version; - state.plugin_name = entry.name; - state.cloud_uuid = entry.cloud_uuid(); - state.enabled = enabled; - state.capabilities = capabilities; + apply_install_metadata(state, entry); + state.enabled = enabled; + state.capabilities = capabilities; return write_install_state(plugin_dir, state); } @@ -894,11 +912,7 @@ bool write_install_state(const boost::filesystem::path& plugin_dir, const Plugin // permissions on a fresh install/reinstall. PluginManager writes the real per-capability flags // while preserving permissions once the package is loaded, via the overload above. PluginInstallState state; - state.installed_from = entry.is_cloud_plugin() ? "cloud" : "local"; - state.installed_version = !entry.installed_version.empty() ? entry.installed_version : entry.version; - state.plugin_name = entry.name; - state.cloud_uuid = entry.cloud_uuid(); - state.enabled = true; + seed_install_metadata(state, entry); return write_install_state(plugin_dir, state); } diff --git a/src/slic3r/plugin/PluginFsUtils.hpp b/src/slic3r/plugin/PluginFsUtils.hpp index 9c864ed73a..302519a3e4 100644 --- a/src/slic3r/plugin/PluginFsUtils.hpp +++ b/src/slic3r/plugin/PluginFsUtils.hpp @@ -98,12 +98,18 @@ inline nlohmann::json py_to_json(const pybind11::handle& o, int depth = 0) struct PluginPermissions { + // Filesystem targets. A target ending in "/*" (e.g. "/path/to/folder/*") grants the folder + // and its whole subtree, at any depth; "*" is the only wildcard and only as the final path + // component. Reads and writes stay separate buckets: a wildcard in one never grants the other. std::vector fs_read; std::vector fs_readwrite; std::vector network_http; std::vector network_socket; std::vector process; std::vector threading; + // Grants for audit events that expose no target, keyed ":" (e.g. + // "Socket:socket.__new__"). Matched verbatim; the filesystem wildcard does not apply. + std::vector events; }; struct PluginInstallState { @@ -184,12 +190,19 @@ std::vector collect_resource_texture_files(const std::string& dir, // Canonical writer: emits the .install_state.json schema for the given state. bool write_install_state(const boost::filesystem::path& plugin_dir, const PluginInstallState& state); + // Builds a PluginInstallState from the descriptor and delegates to the canonical writer. bool write_install_state(const boost::filesystem::path& plugin_dir, const PluginDescriptor& entry, bool enabled, const std::vector>& capabilities); // Convenience overload: write(dir, entry, /*enabled=*/true, /*capabilities=*/{}). bool write_install_state(const boost::filesystem::path& plugin_dir, const PluginDescriptor& entry); +// Fill the descriptor-derived install metadata into a sidecar state that does not describe an +// installed plugin yet, and mark it enabled. Leaves permissions and capabilities untouched. +// Single source for the metadata mapping used by the install writer and by the audit prompt path +// that creates a sidecar on demand. +void seed_install_metadata(PluginInstallState& state, const PluginDescriptor& entry); + // Reads install state back into the descriptor; plugin_key is always derived. Returns whether the // sidecar was present and valid. bool read_install_state(const boost::filesystem::path& plugin_dir, PluginDescriptor& entry); diff --git a/src/slic3r/plugin/PluginHooks.cpp b/src/slic3r/plugin/PluginHooks.cpp index dec7d261c6..0088bc1477 100644 --- a/src/slic3r/plugin/PluginHooks.cpp +++ b/src/slic3r/plugin/PluginHooks.cpp @@ -102,6 +102,12 @@ void install_slicing_pipeline_hook() ctx.step = step; ctx.print = &print; ctx.object = object; + // Slicing hooks are synchronous by design and never await: the context + // borrows Print/PrintObject that are only valid during this call, and the + // UI thread may itself be blocked waiting on this slicing worker. An async + // override is rejected here rather than scheduled -- cap->execute() casts + // its Python result to ExecutionResult and a coroutine object cannot be + // cast, so it surfaces as the SlicingError below. r = cap->execute(ctx); } catch (const CanceledException&) { throw; // cancellation must reach process(), never become a slicing error diff --git a/src/slic3r/plugin/PluginManager.cpp b/src/slic3r/plugin/PluginManager.cpp index 98bf0b6ad6..27ebcdda3a 100644 --- a/src/slic3r/plugin/PluginManager.cpp +++ b/src/slic3r/plugin/PluginManager.cpp @@ -12,11 +12,16 @@ #include "PluginFsUtils.hpp" #include "PluginHooks.hpp" +#include "PluginAuditManager.hpp" +#include "PyPluginTrampoline.hpp" #include "PythonInterpreter.hpp" #include "PythonPluginBridge.hpp" #include "OrcaCloudServiceAgent.hpp" #include "libslic3r/Semver.hpp" +#include "pybind11/pytypes.h" +#include "pybind11/gil.h" +#include "pybind11/pybind11.h" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/NotificationManager.hpp" @@ -41,6 +46,7 @@ #include #include #include +#include #include "slic3r/GUI/ImGuiWrapper.hpp" #include "slic3r/GUI/Plater.hpp" @@ -68,8 +74,10 @@ void Plugin::release_module() PluginManager& PluginManager::instance() { // Touch the interpreter first so its static outlives this one: ~Plugin needs it alive to - // release module, sys.modules, and sys.path ownership safely. + // release module, sys.modules, and sys.path ownership safely. Touch the async Script runtime + // next, so ~PluginManager can still drain it during its own shutdown(). PythonInterpreter::instance(); + ScriptAsyncRuntime::instance(); static PluginManager inst; return inst; } @@ -101,6 +109,9 @@ bool PluginManager::initialize() m_initialized = true; } + // Re-arm the async Script runtime in case shutdown() ran earlier in this process. + ScriptAsyncRuntime::instance().reset(); + // Bring every capability's stored config into memory. Deliberately unconditional and // independent of which plugins are installed: an entry outlives uninstall/unsubscribe, so a // plugin that comes back later finds its settings intact. A missing or malformed file just @@ -167,6 +178,10 @@ void PluginManager::shutdown() unload_all_plugins(); PythonPluginBridge::instance().clear_pending_captures(); + // Every async Script run has been drained by unload_all_plugins above; wait for every + // invocation worker before the interpreter is allowed to finalize. + ScriptAsyncRuntime::instance().shutdown(); + // Every config write already goes to disk as it happens (store_capability_config), so this // only catches an in-memory-only mutation. Note we flush rather than clear: unloading the // plugins above must never discard their stored config. @@ -754,6 +769,10 @@ void PluginManager::release_load_slot(const std::string& plugin_key) void PluginManager::cancel_and_wait_for_capabilities( const std::vector>& capabilities) { + // Ask the plugin to cancel first, then schedule the async cancellation: on_cancelled() can + // observe/record state while the run is still intact, and only afterwards is its asyncio task + // cancelled. Draining of capability references still follows, so the module is not unloaded + // until the run has settled. for (const auto& capability : capabilities) { if (!capability || !capability->is_enabled()) continue; @@ -769,15 +788,37 @@ void PluginManager::cancel_and_wait_for_capabilities( } } - const auto deadline = std::chrono::steady_clock::now() + std::chrono::seconds(2); - while (std::chrono::steady_clock::now() < deadline) { + for (const auto& capability : capabilities) { + if (capability) + ScriptAsyncRuntime::instance().cancel_plugin(capability->audit_plugin_key()); + } + + // Script rows are bounded only by their own worker: a cancelled or stalled invocation of another + // plugin can no longer couple to this one (each invocation owns a thread). A Script worker is + // drained without a deadline — forcing module unload while one is outstanding would leave Python + // executing against a freed module, or let a blocking preset selection mutate presets after the + // plugin is gone. Non-Script synchronous calls keep the historical bounded grace. On the GUI + // thread the event loop is pumped so a modal selection can settle instead of being starved by a + // blocking wait. + const auto grace_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(2); + for (;;) { const bool all_released = std::all_of(capabilities.begin(), capabilities.end(), [](const auto& capability) { return !capability || capability->ref_count() == 0; }); - if (all_released) + // A cancellation that arrived before the invocation ran skips the ref counter, so an active + // worker must also be gone: never unload the module while any Script thread is still live. + const bool invocation_active = std::any_of(capabilities.begin(), capabilities.end(), [](const auto& capability) { + return capability != nullptr && ScriptAsyncRuntime::instance().has_active_run(capability.get()); + }); + if (all_released && !invocation_active) return; - std::this_thread::sleep_for(std::chrono::milliseconds(10)); + if (!invocation_active && std::chrono::steady_clock::now() >= grace_deadline) + break; + + if (wxTheApp != nullptr && wxIsMainThread()) + wxYield(); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } for (const auto& capability : capabilities) { @@ -1180,12 +1221,8 @@ void PluginManager::mark_plugin_install_state_disabled(const std::string& plugin const boost::filesystem::path root(descriptor.plugin_root); PluginInstallState state; - if (!read_install_state(root, state)) { - state.installed_from = descriptor.is_cloud_plugin() ? "cloud" : "local"; - state.installed_version = !descriptor.installed_version.empty() ? descriptor.installed_version : descriptor.version; - state.plugin_name = descriptor.name; - state.cloud_uuid = descriptor.cloud_uuid(); - } + if (!read_install_state(root, state)) + seed_install_metadata(state, descriptor); state.enabled = false; if (!write_install_state(root, state)) return; @@ -2070,41 +2107,385 @@ bool PluginManager::delete_and_unsubscribe_cloud_plugin(const std::string& plugi return finalize_cloud_plugin_removal(descriptor, false, error); } +// ── Async Script runtime ──────────────────────────────────────────────────────────────────── + +namespace { + +// The asyncio loop of the Script invocation running on the calling thread. Owned +1 while set; +// always cleared under the GIL before the worker thread exits. +thread_local PyObject* tl_script_loop = nullptr; + +} // namespace + +struct ScriptAsyncRuntime::Impl +{ + struct Run + { + std::string plugin_key; + std::string capability_name; + std::shared_ptr capability; + std::function on_done; + std::atomic cancel_requested{false}; + // True while an asyncio loop/task is live for this run. Read without the GIL by + // cancel_plugin() to avoid taking the GIL for a purely synchronous invocation. + std::atomic has_loop{false}; + + // Live asyncio loop/task for cancellation. Guarded by handle_mutex and only touched + // with the GIL held. + std::mutex handle_mutex; + pybind11::object loop; + pybind11::object task; + }; + + std::mutex mutex; + std::condition_variable cv; + std::vector> active; + bool stopping = false; + + // Runs one invocation to completion on the calling (worker) thread. + void run_invocation(const std::shared_ptr& run); +}; + +void ScriptAsyncRuntime::Impl::run_invocation(const std::shared_ptr& run) +{ + ScriptCompletion completion; + + { + PythonRuntimeLease lease = PythonInterpreter::instance().acquire_runtime_lease(); + if (!lease) { + completion.error = _u8L("Python interpreter is shutting down"); + } else { + pybind11::gil_scoped_acquire gil; + + if (run->cancel_requested.load(std::memory_order_acquire)) { + // Cancelled before it ran: expected termination, never an error. + completion.cancelled = true; + } else { + // Hold the capability reference, the audit scope and the GIL for the whole + // invocation, so unload/shutdown cannot tear the module out from under it. + PluginCapabilityInterface::RefCounter ref_counter(*run->capability); + + std::optional audit_scope; + if (!run->capability->audit_plugin_key().empty()) + audit_scope.emplace(run->capability->audit_plugin_key(), run->capability->name()); + + // Detection and execution both happen here, on the worker: a synchronous + // `def execute` runs to completion off the UI thread, exactly like an `async def`. + ScriptExecuteInvocation invocation = invoke_script_execute(run->capability); + if (!invocation.error.empty()) { + completion.error = invocation.error; + } else if (!invocation.is_async) { + completion.result = invocation.result; + } else if (run->cancel_requested.load(std::memory_order_acquire)) { + completion.cancelled = true; + } else { + try { + pybind11::module_ asyncio = pybind11::module_::import("asyncio"); + pybind11::object loop = asyncio.attr("new_event_loop")(); + asyncio.attr("set_event_loop")(loop); + + tl_script_loop = loop.ptr(); + Py_INCREF(tl_script_loop); + + pybind11::object task = loop.attr("create_task")(std::move(invocation.awaitable)); + { + std::lock_guard lock(run->handle_mutex); + run->loop = loop; + run->task = task; + } + run->has_loop.store(true, std::memory_order_release); + // A cancellation that arrived before the loop came up must still land. + if (run->cancel_requested.load(std::memory_order_acquire)) + loop.attr("call_soon_threadsafe")(task.attr("cancel")); + + try { + pybind11::object returned = loop.attr("run_until_complete")(task); + completion.result = returned.cast(); + } catch (pybind11::error_already_set& err) { + // Only our own cancel_plugin() cancellation is expected termination; a + // CancelledError the plugin raised on its own stays a real error. + if (err.matches(asyncio.attr("CancelledError")) && + run->cancel_requested.load(std::memory_order_acquire)) { + completion.cancelled = true; + } else { + log_python_exception_keep(err); + completion.error = err.what(); + } + } + + run->has_loop.store(false, std::memory_order_release); + { + std::lock_guard lock(run->handle_mutex); + run->task = pybind11::object(); + run->loop = pybind11::object(); + } + Py_CLEAR(tl_script_loop); + loop.attr("close")(); + asyncio.attr("set_event_loop")(pybind11::none()); + } catch (pybind11::error_already_set& err) { + log_python_exception_keep(err); + completion.error = err.what(); + } catch (const std::exception& ex) { + completion.error = ex.what(); + } + + // Covers an exception thrown after the loop came up but before the clear above. + if (run->has_loop.load(std::memory_order_acquire)) { + run->has_loop.store(false, std::memory_order_release); + std::lock_guard lock(run->handle_mutex); + run->task = pybind11::object(); + run->loop = pybind11::object(); + } + + if (tl_script_loop != nullptr) + Py_CLEAR(tl_script_loop); + } + } + + // Drop the capability reference while the GIL is held: releasing a pybind holder from + // a non-Python thread would DECREF the capability without the GIL. Runs on every + // lease-valid path, including an invocation cancelled before it ran. + run->capability.reset(); + } + } + + // A cancellation requested by cancel_plugin() (unload/shutdown) is expected termination and is + // authoritative: whatever the body did — finished, swallowed CancelledError, or failed — nothing + // is surfaced as an error or as a normal success. + if (run->cancel_requested.load(std::memory_order_acquire)) { + completion.cancelled = true; + completion.error.clear(); + } + + auto on_done = std::move(run->on_done); + auto deliver = [on_done, completion]() { + if (on_done) + on_done(completion); + }; + + if (wxTheApp == nullptr || wxIsMainThread()) + deliver(); + else + GUI::wxGetApp().CallAfter(deliver); + + // Leave `active` last, so a drain cannot observe the run as finished before its completion was + // queued/delivered and its capability reference released. + { + std::lock_guard lock(mutex); + active.erase(std::remove(active.begin(), active.end(), run), active.end()); + } + cv.notify_all(); +} + +ScriptAsyncRuntime& ScriptAsyncRuntime::instance() +{ + static ScriptAsyncRuntime inst; + return inst; +} + +ScriptAsyncRuntime::ScriptAsyncRuntime() : m_impl(std::make_unique()) {} + +ScriptAsyncRuntime::~ScriptAsyncRuntime() { shutdown(); } + +bool ScriptAsyncRuntime::start(const std::string& plugin_key, + const std::string& capability_name, + std::shared_ptr capability, + std::function on_done) +{ + if (!PythonInterpreter::instance().is_initialized()) + return false; + + auto run = std::make_shared(); + run->plugin_key = plugin_key; + run->capability_name = capability_name; + run->capability = std::move(capability); + run->on_done = std::move(on_done); + + { + std::lock_guard lock(m_impl->mutex); + if (m_impl->stopping) + return false; + m_impl->active.push_back(run); + } + + // One worker thread per invocation. A stalled invocation of one plugin can never delay another + // plugin's unload or another invocation, and no invocation body ever runs on the caller (UI) + // thread. The thread holds `run` (and so the capability) until it finishes; the runtime tracks + // it in `active` and waits for it on shutdown. + Impl* impl = m_impl.get(); + try { + std::thread([impl, run] { impl->run_invocation(run); }).detach(); + } catch (...) { + std::lock_guard lock(m_impl->mutex); + m_impl->active.erase(std::remove(m_impl->active.begin(), m_impl->active.end(), run), m_impl->active.end()); + return false; + } + return true; +} + +void ScriptAsyncRuntime::cancel_plugin(const std::string& plugin_key) +{ + std::vector> runs; + { + std::lock_guard lock(m_impl->mutex); + for (const auto& run : m_impl->active) + if (run->plugin_key == plugin_key) + runs.push_back(run); + } + + for (const auto& run : runs) + run->cancel_requested.store(true, std::memory_order_release); + + for (const auto& run : runs) { + // A synchronous invocation has no loop to cancel; skip it so the caller never blocks on + // the GIL while that invocation is (uninterruptibly) running. + if (!run->has_loop.load(std::memory_order_acquire)) + continue; + + PythonGILState gil; + if (!gil) + continue; + + pybind11::object loop; + pybind11::object task; + { + std::lock_guard lock(run->handle_mutex); + loop = run->loop; + task = run->task; + } + if (!loop || !task) + continue; + + try { + loop.attr("call_soon_threadsafe")(task.attr("cancel")); + } catch (const std::exception& ex) { + BOOST_LOG_TRIVIAL(warning) << "Script async cancel failed for plugin '" << plugin_key << "': " << ex.what(); + } + } +} + +bool ScriptAsyncRuntime::has_active_run(const PluginCapabilityInterface* capability) const +{ + std::lock_guard lock(m_impl->mutex); + for (const auto& run : m_impl->active) + if (run->capability.get() == capability) + return true; + return false; +} + +void ScriptAsyncRuntime::shutdown() +{ + { + std::lock_guard lock(m_impl->mutex); + m_impl->stopping = true; + } + + std::unique_lock lock(m_impl->mutex); + m_impl->cv.wait(lock, [this] { return m_impl->active.empty(); }); +} + +void ScriptAsyncRuntime::reset() +{ + shutdown(); + + std::lock_guard lock(m_impl->mutex); + m_impl->stopping = false; +} + +pybind11::object ScriptAsyncRuntime::current_loop() +{ + if (tl_script_loop == nullptr) + return pybind11::object(); + return pybind11::reinterpret_borrow(pybind11::handle(tl_script_loop)); +} + ExecutionResult PluginManager::run_script_capability(const std::string& plugin_key, const std::string& capability_name, std::string& error) { - if (plugin_key.empty() || capability_name.empty()) { - return {}; + ExecutionResult result; + std::mutex mutex; + std::condition_variable cv; + bool done = false; + + ScriptLaunchResult launch = launch_script_capability( + plugin_key, capability_name, [&](const ScriptCompletion& completion) { + std::lock_guard lock(mutex); + result = completion.result; + // A cancel_plugin() cancellation is expected termination, not an error to report. + error = completion.cancelled ? std::string() : completion.error; + done = true; + cv.notify_all(); + }); + + if (launch.launched_async) { + // Async run: the completion is delivered on the GUI thread. When this call is itself on + // the GUI thread it must pump the event loop, or the completion can never be delivered. + std::unique_lock lock(mutex); + if (wxTheApp != nullptr && wxIsMainThread()) { + while (!done) { + cv.wait_for(lock, std::chrono::milliseconds(10)); + lock.unlock(); + wxYield(); + lock.lock(); + } + } else { + cv.wait(lock, [&] { return done; }); + } + } else { + result = launch.outcome.result; + error = launch.outcome.error; + } + + return result; +} + +PluginManager::ScriptLaunchResult PluginManager::launch_script_capability(const std::string& plugin_key, + const std::string& capability_name, + ScriptCompletionFn on_done) +{ + ScriptLaunchResult launch; + + // Mirror the historical synchronous behavior for a dangling reference: nothing to run and + // no error (the caller's guarded UI normally prevents this). + if (plugin_key.empty() || capability_name.empty()) + return launch; + + if (m_shutting_down.load(std::memory_order_acquire)) { + launch.outcome.error = _u8L("Plugin system is shutting down."); + return launch; } auto cap = get_plugin_capability({PluginCapabilityType::Script, capability_name, plugin_key}); if (!cap) - return {}; + return launch; - auto cap_interface = std::dynamic_pointer_cast(cap); - if (!cap_interface) - return {}; + if (!std::dynamic_pointer_cast(cap)) + return launch; - ExecutionResult result; - try { - PythonGILState gil; - if (!gil) { - error = "Python interpreter is shutting down"; - return {}; - } - result = cap_interface->execute(); - } catch (const std::exception& ex) { - error = ex.what(); - BOOST_LOG_TRIVIAL(error) << "Script plugin execution threw exception. plugin_key=" << plugin_key << " error=" << error; - } catch (...) { - error = _u8L("Unknown error"); - BOOST_LOG_TRIVIAL(error) << "Script plugin execution threw unknown exception. plugin_key=" << plugin_key; + // Every Script body runs off the caller's thread now: the invocation — including detection and + // a synchronous `def execute` — is handed to the runtime, which runs it on its own worker and + // reports the outcome through the completion callback. Nothing executes before returning here, + // so the UI thread is never blocked by a Script invocation. + const bool started = ScriptAsyncRuntime::instance().start( + plugin_key, capability_name, cap, + [this, plugin_key, on_done](const ScriptCompletion& completion) { + // A cancellation requested by cancel_plugin() (unload/shutdown) is expected termination: + // record no plugin error and surface nothing. Genuine user/plugin errors still record. + if (!completion.cancelled && !completion.error.empty()) + set_plugin_error(plugin_key, completion.error); + if (on_done) + on_done(completion); + }); + + if (!started) { + launch.outcome.error = _u8L("Plugin system is shutting down."); + set_plugin_error(plugin_key, launch.outcome.error); + BOOST_LOG_TRIVIAL(error) << "Script plugin execution failed. plugin_key=" << plugin_key + << " error=" << launch.outcome.error; + return launch; } - if (!error.empty()) { - set_plugin_error(plugin_key, error); - } - - return result; + launch.launched_async = true; + return launch; } void PluginManager::dispatch_lifecycle_event(LifecycleEvent evt, const LifecycleEventContext& ctx) { diff --git a/src/slic3r/plugin/PluginManager.hpp b/src/slic3r/plugin/PluginManager.hpp index bd7a495a67..21d2bc1e5b 100644 --- a/src/slic3r/plugin/PluginManager.hpp +++ b/src/slic3r/plugin/PluginManager.hpp @@ -15,6 +15,7 @@ #include #include #include +#include "pybind11/pytypes.h" #include "slic3r/plugin/PluginFsUtils.hpp" #include #include @@ -98,6 +99,19 @@ struct Plugin void release_module(); }; +// Outcome of one Script invocation, delivered to a script completion callback. +// +// `cancelled` marks a run terminated by PluginManager's own cancellation (plugin unload / shutdown): +// expected termination, not a failure. Callers must not surface it as an error nor as a normal +// success. `error` carries only genuine user/plugin exceptions; `result` is meaningful when neither +// `cancelled` nor a non-empty `error` is set. +struct ScriptCompletion +{ + ExecutionResult result; + std::string error; + bool cancelled = false; +}; + class PluginManager { public: @@ -214,6 +228,25 @@ public: ExecutionResult run_script_capability(const std::string& plugin_key, const std::string& capability_name, std::string& error); + // Outcome of launching a Script capability. + struct ScriptLaunchResult + { + bool launched_async = false; // true => a run started off-thread; wait for on_done + ScriptCompletion outcome; // meaningful when !launched_async (start failure only) + }; + // Invoked on the GUI thread when a Script invocation finishes (or inline, on the calling thread, + // when the run could not be started at all). + using ScriptCompletionFn = std::function; + + // Starts a Script capability off the caller's thread. Both a synchronous `def execute` and an + // `async def execute` run on a ScriptAsyncRuntime worker, so this never blocks the UI thread and + // no invocation runs before returning. `launched_async` is true exactly when a run started; the + // caller then waits for on_done instead of a returned result. When it is false, `outcome.error` + // explains why (the caller's guarded UI normally prevents this). + ScriptLaunchResult launch_script_capability(const std::string& plugin_key, + const std::string& capability_name, + ScriptCompletionFn on_done = {}); + void dispatch_lifecycle_event(LifecycleEvent evt, const LifecycleEventContext& ctx); private: @@ -309,6 +342,74 @@ private: std::atomic m_shutting_down{false}; }; +// ── Async Script execution ────────────────────────────────────────────────────────────────── +// +// A Script capability whose Python `execute` is an `async def` (or otherwise returns a +// coroutine) must not run on the UI thread, and cannot use the synchronous trampoline path, +// which casts the return value to ExecutionResult and would reject a coroutine. +// +// ScriptAsyncRuntime drives such executions off the calling (UI) thread. Each invocation gets its +// own worker thread and, for an `async def`, its own asyncio event loop. Every invocation body — +// detection, a synchronous `def execute`, or an `async def` coroutine — runs on that worker, so no +// Script invocation ever blocks the UI thread and no invocation is queued behind another plugin's. +// For the whole invocation the worker holds: +// * a shared_ptr to the capability, so the capability and its module stay alive across awaits; +// * a PythonRuntimeLease plus the GIL, so the interpreter cannot finalize underneath it; +// * the capability's audit scope (ScopedPluginAuditContext), +// which keeps plugin unload and interpreter shutdown from tearing the module out from under a +// suspended run. Unload cancels the run and drains it (it never force-unloads after a timeout). +// +// Interface for host awaitables (see plugin/host/): a host awaitable is constructed inside the +// Script coroutine, i.e. on the worker thread with that invocation's loop running, so it can +// read that loop with asyncio.get_running_loop() or ScriptAsyncRuntime::current_loop(). To +// resume from another thread (typically the UI thread) it must resolve its future with +// loop.call_soon_threadsafe(...) and must never touch plugin Python objects, or the loop, +// directly from that other thread. The loop only runs while the coroutine is suspended inside +// run_until_complete; once Script execute returns the loop is closed and the module may unload. +class ScriptAsyncRuntime +{ +public: + static ScriptAsyncRuntime& instance(); + + ~ScriptAsyncRuntime(); + ScriptAsyncRuntime(const ScriptAsyncRuntime&) = delete; + ScriptAsyncRuntime& operator=(const ScriptAsyncRuntime&) = delete; + + // Starts one Script invocation on its own worker thread. The invocation body (Python `execute`, + // whether `def` or `async def`) and its detection both run on that worker, never on the calling + // thread. `on_done` is invoked on the GUI thread (or inline when there is no wx app) when the + // invocation finishes; a `cancelled` completion is expected termination from cancel_plugin(). + // Returns false when the runtime is shutting down. + bool start(const std::string& plugin_key, + const std::string& capability_name, + std::shared_ptr capability, + std::function on_done); + + // Requests cancellation of every active run owned by plugin_key: marks the run and cancels + // its asyncio task via loop.call_soon_threadsafe (a synchronous invocation has no loop). + void cancel_plugin(const std::string& plugin_key); + + // True while a run for `capability` is active. + bool has_active_run(const PluginCapabilityInterface* capability) const; + + // Stops accepting runs and waits for every in-flight invocation worker. Nothing is torn down + // by force. + void shutdown(); + + // Re-arms the runtime after a shutdown() so a later initialize() in the same process can + // start runs again. + void reset(); + + // The asyncio loop of the Script invocation running on the calling thread, or an empty + // object when the calling thread is not running one. Must be called with the GIL held. + static pybind11::object current_loop(); + +private: + ScriptAsyncRuntime(); + struct Impl; + std::unique_ptr m_impl; +}; + // Resolve each configured capability reference to a loaded capability of type T and run `execute`. template void execute_capabilities_from_refs(const ConfigOptionStrings& capabilities, diff --git a/src/slic3r/plugin/PyPluginTrampoline.hpp b/src/slic3r/plugin/PyPluginTrampoline.hpp index 915c578353..074a140735 100644 --- a/src/slic3r/plugin/PyPluginTrampoline.hpp +++ b/src/slic3r/plugin/PyPluginTrampoline.hpp @@ -2,10 +2,12 @@ #define slic3r_PyPluginTrampoline_hpp_ #include "libslic3r/LifecycleEvents.hpp" +#include #include #include +#include #include #include #include @@ -14,9 +16,11 @@ #include "PythonInterpreter.hpp" #include "PluginFsUtils.hpp" #include "PluginAuditManager.hpp" +#include "pybind11/cast.h" #include #include #include +#include // Trampoline variants of pybind11's override macros. Every C++->Python plugin call crosses a // trampoline method, so this single boundary is where we (1) log the full Python traceback and @@ -61,6 +65,78 @@ } while (0) namespace Slic3r { + +// True when `object` is a coroutine object (the value produced by calling an `async def`). +// Match inspect.iscoroutine() without importing Python modules inside the plugin audit scope. +// Must be called with the GIL held. +inline bool py_is_coroutine(const pybind11::handle& object) +{ + return object && PyCoro_CheckExact(object.ptr()); +} + +// Result of invoking a Script capability's Python `execute` exactly once. +// +// A synchronous override (`def execute`) runs to completion here and yields `result`. +// An asynchronous override (`async def execute`, or any override that returns a coroutine) +// yields the coroutine object in `awaitable` WITHOUT running it: the cast to ExecutionResult +// that the trampoline would otherwise perform is impossible for a coroutine, so the caller +// chooses how to drive it. Whoever drives it must keep the capability referenced and re-open +// this call's GIL + runtime lease + audit scope for the coroutine's whole lifetime (see +// ScriptAsyncRuntime in PluginManager.hpp). +struct ScriptExecuteInvocation +{ + bool is_async = false; + pybind11::object awaitable; // valid iff is_async; a coroutine object created under the GIL + ExecutionResult result; // valid iff !is_async + std::string error; // non-empty when the call or coroutine creation raised +}; + +// Invokes ScriptPluginCapability::execute() under the GIL, replicating the audited trampoline +// call (capability ref counter, audit scope, traceback-preserving rethrow) but returning a +// coroutine object instead of forcing a cast when the plugin's `execute` is `async def`. +// +// `capability` must be the concrete, Python-bound capability instance (obtainable from +// get_plugin_capability()); it is resolved back to its Python object through pybind's instance +// map. Never throws: a Python exception is logged (full traceback) and reported in `error`. +inline ScriptExecuteInvocation invoke_script_execute(const std::shared_ptr& capability) +{ + ScriptExecuteInvocation invocation; + if (!capability) + return invocation; + + try { + pybind11::gil_scoped_acquire gil; + PluginCapabilityInterface::RefCounter ref_counter(*capability); + + std::optional audit_scope; + if (const std::string& audit_key = capability->audit_plugin_key(); !audit_key.empty()) + audit_scope.emplace(audit_key, capability->name()); + + pybind11::object py_capability = pybind11::cast(capability); + pybind11::object returned = py_capability.attr("execute")(); + + if (py_is_coroutine(returned)) { + invocation.is_async = true; + invocation.awaitable = std::move(returned); + return invocation; + } + + invocation.result = returned.cast(); + } catch (pybind11::error_already_set& err) { + const bool audit_denial = PluginAuditManager::instance().audit_denial_pending(); + if (audit_denial) + PluginAuditManager::instance().clear_current_plugin(); + invocation.error = err.what(); + log_python_exception_keep(err); + if (audit_denial) + PluginAuditManager::instance().clear_audit_denial(); + } catch (const std::exception& ex) { + invocation.error = ex.what(); + } + + return invocation; +} + template class PyPluginCommonTrampoline : public Base { public: @@ -102,9 +178,9 @@ public: // mistake), both fall back to the base's empty object rather than writing `"cap_config": null`. nlohmann::json get_default_config() const override { + pybind11::gil_scoped_acquire gil; ORCA_PY_AUDIT_SCOPE(); try { - pybind11::gil_scoped_acquire gil; pybind11::function override = pybind11::get_override(static_cast(this), "get_default_config"); if (!override) return Base::get_default_config(); diff --git a/src/slic3r/plugin/PythonInterpreter.cpp b/src/slic3r/plugin/PythonInterpreter.cpp index 89dc91723c..ca0dfa16f4 100644 --- a/src/slic3r/plugin/PythonInterpreter.cpp +++ b/src/slic3r/plugin/PythonInterpreter.cpp @@ -2,6 +2,7 @@ #include "GeneratedConfig.hpp" #include "libslic3r/Utils.hpp" #include "PluginAuditManager.hpp" +#include "PythonPluginBridge.hpp" #include #include #include @@ -664,6 +665,11 @@ bool PythonInterpreter::initialize() // background-thread exceptions) to /log/python_*.log. install_python_stderr_redirect(); + // Attribute plugin-spawned Python threads to the plugin/capability that created them. + // Must run while the GIL is still held here, after the audit hook is in place and + // before the GIL is released below. + install_python_thread_audit_shim(); + // Release the GIL so other threads can acquire it via PyGILState_Ensure. // Without this, calls from background threads will block trying to acquire the GIL. m_main_thread_state = PyEval_SaveThread(); diff --git a/src/slic3r/plugin/PythonPluginBridge.cpp b/src/slic3r/plugin/PythonPluginBridge.cpp index 103de8e362..7e203f2b61 100644 --- a/src/slic3r/plugin/PythonPluginBridge.cpp +++ b/src/slic3r/plugin/PythonPluginBridge.cpp @@ -49,7 +49,7 @@ thread_local std::string g_active_plugin_key; std::mutex g_registry_mutex; std::unordered_map> g_pending_capabilities; std::unordered_map g_pending_package; -std::unordered_map> g_pending_fs_read_permissions; +std::unordered_map g_pending_permissions; struct PluginInstanceHandle { // The C++ plugin interface points into a Python object. Keep both alive through one @@ -88,7 +88,7 @@ void discard_pending_capture_without_python(const std::string& plugin_key) g_pending_package.erase(package); } - g_pending_fs_read_permissions.erase(plugin_key); + g_pending_permissions.erase(plugin_key); } } // namespace @@ -113,7 +113,7 @@ void PythonPluginBridge::begin_plugin_capture(const std::string& plugin_key) // for this same entry path. g_pending_capabilities.erase(plugin_key); g_pending_package.erase(plugin_key); - g_pending_fs_read_permissions.erase(plugin_key); + g_pending_permissions.erase(plugin_key); } // From now until finalize/cancel, @orca.plugin and register_capability() calls made by // Python code on this thread are attributed to this plugin. @@ -144,7 +144,7 @@ std::vector PythonPluginBridge::finalize_plugin_capture(cons std::lock_guard lock(g_registry_mutex); g_pending_capabilities.erase(capture_key); g_pending_package.erase(capture_key); - g_pending_fs_read_permissions.erase(capture_key); + g_pending_permissions.erase(capture_key); }; try { @@ -177,23 +177,27 @@ std::vector PythonPluginBridge::finalize_plugin_capture(cons // Permission declarations are collected while register_capabilities() runs so the // plugin can describe its needs without touching wx from the Python load worker. Ask // only after registration returns, before capability instances are materialized. - std::vector fs_read_permissions; + PluginPermissions requested_permissions; { std::lock_guard lock(g_registry_mutex); - auto it = g_pending_fs_read_permissions.find(capture_key); - if (it != g_pending_fs_read_permissions.end()) { - fs_read_permissions = std::move(it->second); - g_pending_fs_read_permissions.erase(it); + auto it = g_pending_permissions.find(capture_key); + if (it != g_pending_permissions.end()) { + requested_permissions = std::move(it->second); + g_pending_permissions.erase(it); } } - if (!fs_read_permissions.empty()) { + const bool has_permission_request = + !requested_permissions.fs_read.empty() || !requested_permissions.fs_readwrite.empty() || + !requested_permissions.network_http.empty() || !requested_permissions.network_socket.empty() || + !requested_permissions.process.empty() || !requested_permissions.threading.empty(); + if (has_permission_request) { bool granted = false; { py::gil_scoped_release release; - granted = PluginAuditManager::instance().request_filesystem_read_permissions(plugin_key, fs_read_permissions); + granted = PluginAuditManager::instance().request_permissions(plugin_key, requested_permissions); } if (!granted) { - error = _u8L("Plugin filesystem read permission request denied"); + error = _u8L("Plugin permission request denied"); BOOST_LOG_TRIVIAL(warning) << error << " for key " << plugin_key; discard_pending_for_key(); clear_active_key(); @@ -322,7 +326,7 @@ void PythonPluginBridge::cancel_plugin_capture(const std::string& plugin_key) // may already have registered under this key. g_pending_capabilities.erase(plugin_key); g_pending_package.erase(plugin_key); - g_pending_fs_read_permissions.erase(plugin_key); + g_pending_permissions.erase(plugin_key); } if (g_active_plugin_key == plugin_key) @@ -349,7 +353,7 @@ void PythonPluginBridge::clear_pending_captures() (void) pkg.release(); } g_pending_package.clear(); - g_pending_fs_read_permissions.clear(); + g_pending_permissions.clear(); g_active_plugin_key.clear(); return; } @@ -358,7 +362,7 @@ void PythonPluginBridge::clear_pending_captures() BOOST_LOG_TRIVIAL(info) << "Clearing " << g_pending_capabilities.size() << " pending Python plugin capture(s)"; g_pending_capabilities.clear(); g_pending_package.clear(); - g_pending_fs_read_permissions.clear(); + g_pending_permissions.clear(); g_active_plugin_key.clear(); } @@ -558,24 +562,92 @@ void bind_python_api(pybind11::module_& m) m.def( "request_permissions", - [](const std::vector& fs_read) { + [](const std::vector& fs_read, + const std::vector& fs_readwrite, + const std::vector& network_http, + const std::vector& network_socket, + const std::vector& process, + bool threading, + const std::vector& network) { if (g_active_plugin_key.empty()) throw py::value_error("request_permissions() called outside plugin discovery context"); - std::lock_guard lock(g_registry_mutex); - auto& requested = g_pending_fs_read_permissions[g_active_plugin_key]; - for (const std::string& path : fs_read) { - if (path.empty()) - throw py::value_error("request_permissions(fs_read=...) does not accept empty paths"); - if (std::find(requested.begin(), requested.end(), path) == requested.end()) - requested.push_back(path); + // Validate and canonicalize everything before touching the pending registry, so a + // partially invalid call cannot leave a half-recorded request behind. + const auto reject_empty = [](const char* name, const std::vector& targets) { + for (const std::string& target : targets) + if (target.empty()) + throw py::value_error(std::string("request_permissions(") + name + + "=...) does not accept empty values"); + }; + reject_empty("fs_read", fs_read); + reject_empty("fs_readwrite", fs_readwrite); + reject_empty("network_http", network_http); + reject_empty("network_socket", network_socket); + reject_empty("process", process); + + // A network URL is reduced to scheme://host, so one grant covers every path, query + // and port on that host. It is recorded as an HTTP grant; network_permission_matches + // applies that grant to raw socket events for the same host too. + std::vector normalized_network; + normalized_network.reserve(network.size()); + for (const std::string& url : network) { + const std::string normalized = PluginAuditManager::normalize_network_url(url); + if (normalized.empty()) + throw py::value_error( + "request_permissions(network=...) requires an http:// or https:// URL with a host"); + if (std::find(normalized_network.begin(), normalized_network.end(), normalized) == + normalized_network.end()) + normalized_network.push_back(normalized); } + + std::lock_guard lock(g_registry_mutex); + PluginPermissions& requested = g_pending_permissions[g_active_plugin_key]; + + const auto add_targets = [](std::vector& bucket, const std::vector& targets) { + for (const std::string& target : targets) + if (std::find(bucket.begin(), bucket.end(), target) == bucket.end()) + bucket.push_back(target); + }; + + add_targets(requested.fs_read, fs_read); + add_targets(requested.fs_readwrite, fs_readwrite); + add_targets(requested.network_http, network_http); + add_targets(requested.network_http, normalized_network); + add_targets(requested.network_socket, network_socket); + add_targets(requested.process, process); + + if (threading && std::find(requested.threading.begin(), requested.threading.end(), + kThreadPermissionTarget) == requested.threading.end()) + requested.threading.emplace_back(kThreadPermissionTarget); }, py::arg("fs_read") = std::vector{}, - R"pbdoc(Request filesystem read permissions while OrcaSlicer loads your module. + py::arg("fs_readwrite") = std::vector{}, + py::arg("network_http") = std::vector{}, + py::arg("network_socket") = std::vector{}, + py::arg("process") = std::vector{}, + py::arg("threading") = false, + py::arg("network") = std::vector{}, + R"pbdoc(Request permissions while OrcaSlicer loads your module. -The host presents the request to the user after register_capabilities() returns. Denying the -request aborts the plugin load.)pbdoc"); +Each bucket takes the target strings the plugin expects the corresponding audit event to +report: filesystem paths for fs_read and fs_readwrite, URLs for network_http, socket addresses +for network_socket, and commands for process. threading=True requests permission to start +threads. Targets already granted to the plugin are not asked for again. + +A filesystem target may end in "/*" to grant a whole directory tree, for example +"/path/to/folder/*". That covers the folder itself and every path beneath it, at any depth. +"*" is the only wildcard and is recognized only as the final path component; a "*" anywhere +else in a target is an ordinary character. Wildcards apply to fs_read and fs_readwrite only, +and a grant in one of those buckets never authorizes the other direction. Tree grants are +matched on canonical paths, so a symlink below the granted folder does not extend the grant +outside it. Paths the host denies by name or keyword stay denied even when a wildcard covers +them. + +`network` also lists http(s) URLs, but each is reduced to its scheme and host, so one grant covers +every path, query and port on that host and also authorizes raw socket events for it. The host +presents one request to the user after register_capabilities() returns and before any capability +instance is created. Denying the request aborts the plugin load.)pbdoc"); m.def("plugin", [](py::object cls) { if (g_active_plugin_key.empty()) @@ -603,6 +675,93 @@ request aborts the plugin load.)pbdoc"); } +void install_python_thread_audit_shim() +{ + // Runs with the GIL held from PythonInterpreter::initialize(). CPython's own thread bootstrap + // calls the target with no knowledge of the audit context that created it: the calling + // thread is the only place the plugin key and capability are still available. Capture them + // here, then re-establish the same ScopedPluginAuditContext inside the spawned thread before + // the plugin body runs. The identity lives only in this C++ closure -- no Python-visible + // setter is added. + try { + py::object thread_module = py::module_::import("_thread"); + + const int installed = PyObject_HasAttrString(thread_module.ptr(), "_orca_thread_audit_shim_installed"); + if (installed == 1) { + BOOST_LOG_TRIVIAL(debug) << "[AUDIT] Python thread attribution shim already installed"; + return; + } + if (installed < 0) + PyErr_Clear(); + + py::object original = py::reinterpret_steal( + PyObject_GetAttrString(thread_module.ptr(), "start_new_thread")); + if (!original || !PyCallable_Check(original.ptr())) { + PyErr_Clear(); + BOOST_LOG_TRIVIAL(error) << "[AUDIT] _thread.start_new_thread is missing or not callable; " + "plugin threads will run without audit attribution"; + return; + } + + py::object shim = py::cpp_function( + [original](py::object function, py::object args, py::object kwargs) -> py::object { + const std::string plugin_key = PluginAuditManager::instance().current_plugin(); + if (plugin_key.empty()) { + // Not called from a plugin: preserve the stock implementation untouched. + return kwargs.is_none() ? original(function, args) : original(function, args, kwargs); + } + const std::string capability = PluginAuditManager::instance().current_capability(); + + py::object guarded = py::cpp_function( + [function, plugin_key, capability](py::args call_args, py::kwargs call_kwargs) -> py::object { + ScopedPluginAuditContext audit_scope(plugin_key, capability); + PyObject* result = PyObject_Call(function.ptr(), call_args.ptr(), call_kwargs.ptr()); + if (result == nullptr) + throw py::error_already_set(); + return py::reinterpret_steal(result); + }); + return kwargs.is_none() ? original(guarded, args) : original(guarded, args, kwargs); + }, + py::arg("function"), py::arg("args"), py::arg("kwargs") = py::none()); + + if (PyObject_SetAttrString(thread_module.ptr(), "start_new_thread", shim.ptr()) < 0) { + PyErr_Clear(); + BOOST_LOG_TRIVIAL(error) + << "[AUDIT] Failed to install Python thread attribution shim on _thread.start_new_thread"; + return; + } + if (PyObject_SetAttrString(thread_module.ptr(), "_orca_thread_audit_shim_installed", Py_True) < 0) + PyErr_Clear(); + + // threading.py caches the function at import time (as `_start_new_thread` in 3.12, and as + // `start_new_thread` in older versions). Patch the cached reference too when the module is + // already loaded; otherwise its Thread.start() would keep calling the unwrapped original. + py::object sys_modules = py::module_::import("sys").attr("modules"); + PyObject* threading_module = PyDict_GetItemString(sys_modules.ptr(), "threading"); + if (threading_module && threading_module != Py_None) { + const char* cached_names[] = {"_start_new_thread", "start_new_thread"}; + for (const char* cached_name : cached_names) { + const int has_cached_name = PyObject_HasAttrString(threading_module, cached_name); + if (has_cached_name < 0) { + PyErr_Clear(); + continue; + } + if (has_cached_name != 1) + continue; + if (PyObject_SetAttrString(threading_module, cached_name, shim.ptr()) < 0) { + PyErr_Clear(); + BOOST_LOG_TRIVIAL(warning) << "[AUDIT] Failed to update threading." << cached_name + << " with the Python thread attribution shim"; + } + } + } + + BOOST_LOG_TRIVIAL(info) << "[AUDIT] Python thread attribution shim installed"; + } catch (const std::exception& ex) { + BOOST_LOG_TRIVIAL(error) << "[AUDIT] Failed to install Python thread attribution shim: " << ex.what(); + } +} + } // namespace Slic3r #ifdef ORCA_PYTHON_STUBGEN_MODULE diff --git a/src/slic3r/plugin/PythonPluginBridge.hpp b/src/slic3r/plugin/PythonPluginBridge.hpp index 5178c6f5db..39d6191702 100644 --- a/src/slic3r/plugin/PythonPluginBridge.hpp +++ b/src/slic3r/plugin/PythonPluginBridge.hpp @@ -13,6 +13,15 @@ namespace Slic3r { class PluginCapabilityInterface; } namespace Slic3r { +// Install the thread-attribution shim: wraps `_thread.start_new_thread` (and the reference +// cached by an already-imported `threading` module) so a thread spawned from inside a plugin +// call runs with that call's plugin key/capability audit scope. The captured identity is held +// in a private C++ wrapper; nothing is exposed to Python that could set it. +// +// Call with the GIL held, after PluginAuditManager::install_hook() and before the interpreter +// releases the GIL. Safe to call more than once per interpreter. +void install_python_thread_audit_shim(); + // One materialized capability returned from finalize_plugin_capture: the C++ instance // and its resolved get_name() (cached while the GIL was held). struct CapturedCapability diff --git a/src/slic3r/plugin/host/PluginHostPresets.cpp b/src/slic3r/plugin/host/PluginHostPresets.cpp index 4f032e0808..6997e4e6bc 100644 --- a/src/slic3r/plugin/host/PluginHostPresets.cpp +++ b/src/slic3r/plugin/host/PluginHostPresets.cpp @@ -2,6 +2,7 @@ #include "PluginHostUi.hpp" #include "slic3r/plugin/PluginBindingUtils.hpp" +#include #include #include #include @@ -11,18 +12,21 @@ #include #include -#include - #include #include #include #include +#include // TabPresetComboBox::set_filament_idx #include #include +#include + +#include #include #include +#include #include namespace py = pybind11; @@ -48,6 +52,543 @@ PresetCollection& printer_presets(PresetBundle& bundle) return static_cast(bundle.printers); } +// Handle to one category of currently edited preset. It is a category, not a snapshot: it always +// resolves the preset the matching tab edits now, so it stays valid across preset switches. +struct PresetEditor +{ + Preset::Type type = Preset::TYPE_INVALID; +}; + +const char* preset_tab_name(Preset::Type type) +{ + switch (type) { + case Preset::TYPE_PRINT: return "process"; + case Preset::TYPE_FILAMENT: return "filament"; + case Preset::TYPE_PRINTER: return "printer"; + default: return "preset"; + } +} + +PresetCollection& collection_for(PresetBundle& bundle, Preset::Type type) +{ + switch (type) { + case Preset::TYPE_PRINT: return bundle.prints; + case Preset::TYPE_FILAMENT: return bundle.filaments; + case Preset::TYPE_PRINTER: return printer_presets(bundle); + default: throw std::invalid_argument("Unsupported preset category"); + } +} + +// Marker for a user-declined selection: Tab::select_preset() returned false. It derives from +// std::runtime_error (pybind11 maps the base to RuntimeError), so callers see it as an ordinary +// failed transaction and no staged setting or slot assignment is created. +struct SelectionCancelled : std::runtime_error +{ + using std::runtime_error::runtime_error; +}; + +// -------------------------------------------------------------------------- +// The staged preset update lifecycle described in docs/HLSD/preset-plugin-api.md. +// +// begin_update() resolves and binds one target (selecting it through the normal UI flow when +// the caller asked for a preset that is not already active), returns a PresetTransaction that +// stages changes with set(), and applies them only on commit(). The transaction holds names, +// never preset pointers, so it stays valid across reloads; a target or filament slot that changed +// between begin_update() and commit() is rejected instead of silently editing the new mapping. +// +// begin_update() is synchronous: it runs on the background Script worker, marshals the target +// selection to the UI thread with PluginHostUi::run_on_ui_thread(), and blocks that worker until +// the selection and any unsaved-edit dialog settle. The UI thread stays responsive because the +// Script capability owns its worker thread. No GUI or preset pointer outlives the call; the +// returned transaction holds copied category/name/slot values. The update() shorthand shares the +// same target resolution and is safe only from that worker, never from the UI thread or a slicing +// pipeline hook. +// +// Known limits of this implementation, kept explicit rather than hidden: +// * A requested preset_name is resolved by the exact name its dropdown entry shows: the item's +// display label or its stored item alias (the internal preset name). A name two entries carry +// is rejected as ambiguous instead of being resolved by position. Process and printer resolve +// against the tab dropdown; a filament preset_name resolves against the requested slot's own +// sidebar selector, not the tab's, so its compatibility filter is the one that applies. A +// target the selector does not offer fails before the flow's unsaved-edit prompt. The flow +// itself is unchanged and the target is still confirmed as the edited preset afterwards. +// * A filament preset_name that names a different preset for a slot selects it through +// Tab::select_preset() (the normal flow, honouring unsaved-edit prompts) and then updates the +// slot mapping with PresetBundle::set_filament_preset() plus every dependent side effect the +// sidebar selection path performs: the project-dirty/selection refresh, the dynamic filament +// list, the slot's own combo (re-run so it lists and selects the assigned target), the +// conditional support-filament flushing recalc and the slot's AMS sync badge (read from the +// slot combo's own flag). The private Plater::priv::on_select_preset() path cannot be reused +// from here, so this mirrors its filament branch rather than calling it. +// * A user-declined selection does not undo decisions the user already accepted in an earlier +// dialog. It aborts before any slot assignment or transaction is created, so no staged +// setting is applied. +// -------------------------------------------------------------------------- + +// Outcome of one committed transaction. Identifies the target, whether selecting it switched +// anything, and for filament (whose preset may be shared) which slots share the edited preset. +struct PresetUpdateResult +{ + Preset::Type type = Preset::TYPE_INVALID; + std::string target_name; + bool selection_changed = false; + int slot_number = -1; // 1-based for filament, -1 otherwise + bool slot_assignment_changed = false; + std::vector shared_slots; + std::vector keys; + bool dirty = false; +}; + +struct PresetTransaction +{ + Preset::Type type = Preset::TYPE_INVALID; + std::string target_name; + bool filament = false; + int slot_number = 0; // 1-based, filament only + std::string slot_assignment_snapshot; // slot's assigned preset as of begin_update() + bool selection_changed = false; + bool slot_assignment_changed = false; + + std::vector> staged; + std::set staged_keys; + bool committed = false; + + void set(const std::string& key, const std::string& value); + PresetUpdateResult commit(); +}; + +GUI::GUI_App& require_gui_app() +{ + GUI::GUI_App& app = GUI::wxGetApp(); + if (app.is_closing()) + throw std::runtime_error("OrcaSlicer is closing"); + if (app.preset_bundle == nullptr) + throw std::runtime_error("Preset bundle is not available"); + if (app.plater() == nullptr) + throw std::runtime_error("OrcaSlicer main window is not available"); + return app; +} + +GUI::Tab* require_tab(GUI::GUI_App& app, Preset::Type type) +{ + GUI::Tab* tab = app.get_tab(type); + if (tab == nullptr) + throw std::runtime_error(std::string("The ") + preset_tab_name(type) + " preset tab is not available"); + // The tab for this preset type exists, but the selected printer's technology may not use it + // (the print tab no-ops under SLA); refuse instead of writing a value the UI cannot apply. + if (!tab->supports_printer_technology(app.preset_bundle->printers.get_selected_preset().printer_technology())) + throw std::runtime_error(std::string("The ") + preset_tab_name(type) + + " preset is not available for the selected printer technology"); + return tab; +} + +// True for a combo row that is a group header, a marker or a disabled row: it carries a marker in +// its client data and is not a selectable preset. +bool combo_item_is_marker(GUI::PresetComboBox& combo, int item) +{ + const auto marker = reinterpret_cast(combo.GetClientData(item)); + return marker >= GUI::PresetComboBox::LABEL_ITEM_DISABLED && marker < GUI::PresetComboBox::LABEL_ITEM_MAX; +} + +// How a caller-supplied name resolved against a combo's actual items. +struct ComboPresetMatch +{ + int item = -1; // first matching item, or -1 + bool ambiguous = false; // two distinct items carry this name + std::string internal_name; // internal preset name of the match (empty when none) +}; + +// Resolve `requested` by the name each combo item shows: its display label, or its stored item +// alias (the internal preset name, or the printer model for a system printer preset). Names are +// compared with the modified-dirty suffix removed, i.e. exactly what the dropdown shows. Reading +// the combo's own items means this respects the combo's real selectable model (visibility, its +// show-incompatible state and, for a slot combo, that slot's compatibility). A name that two +// distinct items carry is reported ambiguous instead of being resolved by position. +ComboPresetMatch resolve_combo_preset(GUI::PresetComboBox& combo, const std::string& requested) +{ + ComboPresetMatch match; + const std::string want = Preset::remove_suffix_modified(requested); + const int item_count = combo.GetCount(); + for (int item = 0; item < item_count; ++item) { + if (combo_item_is_marker(combo, item)) + continue; + const wxString alias = combo.GetItemAlias(item); + const std::string alias_name = alias.empty() ? std::string() + : Preset::remove_suffix_modified(alias.ToUTF8().data()); + const std::string label_name = Preset::remove_suffix_modified(combo.GetString(item).ToUTF8().data()); + if ((alias_name.empty() || alias_name != want) && label_name != want) + continue; + if (match.item >= 0 && match.item != item) { + match.ambiguous = true; + return match; + } + match.item = item; + match.internal_name = alias_name.empty() ? label_name : alias_name; + } + return match; +} + +// Index of the item whose internal name is `preset_name`, or -1. Used for per-item flags (the AMS +// sync badge); the internal name is unique, so no ambiguity handling is needed here. +int combo_item_for_preset(GUI::PresetComboBox& combo, const std::string& preset_name) +{ + const std::string want = Preset::remove_suffix_modified(preset_name); + const int item_count = combo.GetCount(); + for (int item = 0; item < item_count; ++item) { + if (combo_item_is_marker(combo, item)) + continue; + const wxString alias = combo.GetItemAlias(item); + const std::string alias_name = alias.empty() ? std::string() + : Preset::remove_suffix_modified(alias.ToUTF8().data()); + if (!alias_name.empty() && alias_name == want) + return item; + } + return -1; +} + +// Resolve `requested` to the internal preset name its dropdown entry names, or throw. `category` +// and `selector` are used only for the error text. A name the selector does not offer, or that two +// entries share, raises std::invalid_argument. +std::string resolve_preset_in_combo(GUI::PresetComboBox& combo, const std::string& requested, + const std::string& category, const std::string& selector) +{ + const ComboPresetMatch match = resolve_combo_preset(combo, requested); + if (match.ambiguous) + throw std::invalid_argument("The " + category + " name \"" + requested + "\" is ambiguous in the " + selector + + "; more than one entry shows it, so name the preset by its own entry"); + if (match.item < 0) + throw std::invalid_argument("The " + category + " preset \"" + requested + "\" is not offered by the " + selector); + return match.internal_name; +} + +// The preset a filament slot currently resolves to, by its internal name. A slot whose stored +// name is empty or does not resolve yields an error identifying the slot. +std::string resolved_slot_preset(PresetBundle& bundle, int slot_number) +{ + if (slot_number < 1 || static_cast(slot_number) > bundle.filament_presets.size()) + throw std::out_of_range("Filament slot " + std::to_string(slot_number) + + " is out of range; slot numbers are 1-based and this printer has " + + std::to_string(bundle.filament_presets.size()) + " filament slot(s)"); + const std::string& assigned_name = bundle.filament_presets[static_cast(slot_number) - 1]; + if (assigned_name.empty()) + throw std::runtime_error("Filament slot " + std::to_string(slot_number) + " has no assigned filament preset"); + Preset* preset = bundle.filaments.find_preset(assigned_name); + if (preset == nullptr) + throw std::runtime_error("Filament slot " + std::to_string(slot_number) + " is assigned \"" + assigned_name + + "\", which does not resolve to a filament preset"); + return preset->name; +} + +void PresetTransaction::set(const std::string& key, const std::string& value) +{ + if (committed) + throw std::runtime_error("This preset transaction has already been committed; start a new begin_update()"); + if (key.empty()) + throw std::invalid_argument("A setting key is required"); + // Conflicting duplicate writes to one setting are rejected rather than resolved by order. + if (!staged_keys.insert(key).second) + throw std::invalid_argument("Setting \"" + key + "\" is already staged in this transaction; " + "conflicting duplicate writes to one setting are rejected"); + staged.emplace_back(key, value); +} + +PresetUpdateResult PresetTransaction::commit() +{ + if (committed) + throw std::runtime_error("This preset transaction has already been committed; start a new begin_update()"); + if (type == Preset::TYPE_INVALID) + throw std::runtime_error("This preset transaction has no target"); + + PresetUpdateResult result; + PluginHostUi::run_on_ui_thread([&] { + GUI::GUI_App& app = require_gui_app(); + GUI::Tab* tab = require_tab(app, type); + PresetBundle& bundle = *app.preset_bundle; + PresetCollection& collection = collection_for(bundle, type); + + // The target must still be the edited preset: the user may have switched away while the + // transaction was staged, and editing a different preset would break "explicit target". + const std::string edited = collection.get_edited_preset().name; + if (edited != target_name) + throw std::runtime_error("The edited " + std::string(preset_tab_name(type)) + " preset is \"" + edited + + "\", not this transaction's target \"" + target_name + + "\"; nothing was applied"); + + if (filament) { + // Reject a stale slot mapping instead of editing whatever the slot now points at. + const std::string now_assigned = resolved_slot_preset(bundle, slot_number); + if (now_assigned != slot_assignment_snapshot) + throw std::runtime_error("Filament slot " + std::to_string(slot_number) + " now holds \"" + now_assigned + + "\", not \"" + slot_assignment_snapshot + + "\" as when this transaction was created; the slot mapping changed, so nothing was applied"); + } + + // Apply the whole batch through the tab's batch path: it validates every key and value before + // touching the preset, rejects duplicate keys, runs the same per-setting commit path a hand + // edit uses (validation, on_change, dirty state) and refreshes once for the batch. A failure + // restores the edited preset, so no staged setting survives a failed commit. + tab->apply_preset_config_values(staged); + + result.type = type; + result.target_name = target_name; + result.selection_changed = selection_changed; + result.slot_number = filament ? slot_number : -1; + result.slot_assignment_changed = slot_assignment_changed; + result.keys.reserve(staged.size()); + for (const auto& entry : staged) + result.keys.push_back(entry.first); + result.dirty = collection.get_edited_preset().is_dirty; + + if (filament) { + // Every slot whose assigned preset resolves to the edited one is affected: the preset + // is shared, not a per-slot override. + for (std::size_t index = 0; index < bundle.filament_presets.size(); ++index) { + Preset* preset = bundle.filaments.find_preset(bundle.filament_presets[index]); + if (preset != nullptr && preset->name == target_name) + result.shared_slots.push_back(static_cast(index) + 1); + } + } + }); + + committed = true; + return result; +} + +// Process/printer target resolution: the active preset when no name is given, otherwise the named +// preset selected through the normal tab-selection flow (which enforces the dropdown/compatibility +// rules and the unsaved-edit prompt). Binds only after confirming the requested preset is edited. +// Runs on the UI thread with the GIL released, called from begin_preset_update(). +void bind_preset_target(Preset::Type type, const std::string& preset_name, PresetTransaction& transaction) +{ + GUI::GUI_App& app = require_gui_app(); + GUI::Tab* tab = require_tab(app, type); + PresetCollection& collection = collection_for(*app.preset_bundle, type); + + const std::string current = collection.get_edited_preset().name; + std::string target = current; + bool selection_changed = false; + + if (!preset_name.empty()) { + // Resolve by the name the tab's dropdown actually shows (display label or item alias), so a + // plugin can pass exactly what the user sees. With no populated dropdown there is nothing + // to resolve against, so fall back to collection internal names. + GUI::TabPresetComboBox* combo = tab->get_combo_box(); + std::string resolved; + if (combo != nullptr && combo->GetCount() > 0) + resolved = resolve_preset_in_combo(*combo, preset_name, preset_tab_name(type), + "preset selector for the selected printer"); + else + resolved = preset_name; + + Preset* requested = collection.find_preset(resolved); + if (requested == nullptr) + throw std::invalid_argument("No " + std::string(preset_tab_name(type)) + " preset named \"" + resolved + + "\" is available to select"); + target = requested->name; + if (target != current) { + // Normal UI selection: honours the unsaved-edit prompt; a declined prompt returns false + // and is a user cancellation, distinct from any other resolution failure. + if (!tab->select_preset(target)) + throw SelectionCancelled("Switching the edited " + std::string(preset_tab_name(type)) + " preset to \"" + + target + "\" was canceled; nothing was staged"); + selection_changed = true; + } + } + + // select_preset() can still leave a different preset edited (e.g. the target is not an + // allowed dropdown choice), so confirm before binding. + if (collection.get_edited_preset().name != target) + throw std::runtime_error("The edited " + std::string(preset_tab_name(type)) + " preset is \"" + + collection.get_edited_preset().name + "\", not \"" + target + + "\"; the transaction was not created"); + + transaction.type = type; + transaction.target_name = target; + transaction.selection_changed = selection_changed; +} + +// Blocking form used by begin_update() and update(). +PresetTransaction begin_preset_update(Preset::Type type, const std::string& preset_name) +{ + PresetTransaction transaction; + PluginHostUi::run_on_ui_thread([&] { bind_preset_target(type, preset_name, transaction); }); + return transaction; +} + +// Filament target resolution: slot_number identifies the slot; an omitted preset_name keeps the +// preset assigned to it. A supplied preset_name selects that preset for the slot through the normal +// tab-selection flow, then records the slot assignment and its dependent Plater side effects (the +// ones the sidebar selection path performs) only after that flow succeeds, so a canceled prompt +// changes neither. A mixed-color virtual slot is rejected before any of this, with or without a +// preset_name. A requested preset the requested slot's own dropdown does not offer is rejected +// before the selection flow, so no dialog is raised for it; the one exception is the slot's own +// current assignment, which stays targetable when the dropdown hides it. A different preset the +// tab happens to edit is a globally edited target, not an offered choice for this slot, and is +// rejected. +// Runs on the UI thread with the GIL released, called from begin_filament_update(). +void bind_filament_target(int slot_number, const std::string& preset_name, PresetTransaction& transaction) +{ + GUI::GUI_App& app = require_gui_app(); + PresetBundle& bundle = *app.preset_bundle; + GUI::Plater* plater = app.plater(); + + // A mixed-color virtual slot has no single filament preset behind it, so every form of this + // call is rejected: with or without a preset_name there is no one preset to edit or assign. + // Range-guarded so an out-of-range slot still gets resolved_slot_preset()'s clear error. + if (slot_number >= 1 && static_cast(slot_number) <= bundle.filament_presets.size() + && bundle.is_mixed_filament(static_cast(slot_number) - 1)) + throw std::invalid_argument("Filament slot " + std::to_string(slot_number) + + " is a mixed-color virtual slot; it has no single filament preset to edit or assign"); + + // Resolve and validate before any selection, so a bad slot fails without a prompt. + const std::string assigned_internal = resolved_slot_preset(bundle, slot_number); + + GUI::Tab* tab = require_tab(app, Preset::TYPE_FILAMENT); + + const size_t slot_index = static_cast(slot_number) - 1; + + std::string target = assigned_internal; + if (!preset_name.empty()) { + // Resolve against the requested sidebar slot's own selector, not the tab's: that is the + // model the user picks this slot's filament from, including its compatibility filter. The + // selector matches the exact name shown (display label or item alias). + std::vector& slot_combos = plater->sidebar().combos_filament(); + GUI::PlaterPresetComboBox* slot_combo = slot_index < slot_combos.size() ? slot_combos[slot_index] : nullptr; + std::string resolved; + if (slot_combo != nullptr && slot_combo->GetCount() > 0) { + const ComboPresetMatch match = resolve_combo_preset(*slot_combo, preset_name); + if (match.ambiguous) + throw std::invalid_argument("The filament name \"" + preset_name + + "\" is ambiguous in the filament preset selector for filament slot " + + std::to_string(slot_number) + + "; more than one entry shows it, so name the preset by its own entry"); + if (match.item >= 0) { + resolved = match.internal_name; + } else { + // Not shown by this slot's selector. Only the slot's current assignment stays + // targetable (a hidden or incompatible-but-selected preset the dropdown omits); + // resolve it by internal name or by display alias and accept only that preset. A + // different preset the tab happens to edit is a globally edited target, not an + // offered choice for this slot, and is rejected. + Preset* by_name = bundle.filaments.find_preset(preset_name); + if (by_name == nullptr) { + const std::string& alias_name = bundle.filaments.get_preset_name_by_alias(preset_name); + by_name = bundle.filaments.find_preset(alias_name); + } + if (by_name == nullptr || by_name->name != assigned_internal) + throw std::invalid_argument("Filament preset \"" + preset_name + + "\" is not offered by the filament preset selector for filament slot " + + std::to_string(slot_number)); + resolved = by_name->name; + } + } else { + // The slot selector is not populated; fall back to the tab selector, then to collection + // internal names, so the call still works when the sidebar has not been laid out. + GUI::TabPresetComboBox* tab_combo = tab->get_combo_box(); + if (tab_combo != nullptr && tab_combo->GetCount() > 0) + resolved = resolve_preset_in_combo(*tab_combo, preset_name, "filament", + "filament preset selector for the selected printer"); + else + resolved = preset_name; + } + + Preset* requested = bundle.filaments.find_preset(resolved); + if (requested == nullptr) + throw std::invalid_argument("No filament preset named \"" + resolved + "\" is available to select"); + target = requested->name; + } + + bool selection_changed = false; + if (bundle.filaments.get_edited_preset().name != target) { + // A declined prompt is a user cancellation: it is thrown before any slot-assignment change, + // so neither the mapping nor a setting is touched. + if (!tab->select_preset(target)) + throw SelectionCancelled("Switching the edited filament preset to \"" + target + "\" for filament slot " + + std::to_string(slot_number) + + " was canceled; neither the slot assignment nor any setting was changed"); + if (bundle.filaments.get_edited_preset().name != target) + throw std::runtime_error("The edited filament preset is \"" + bundle.filaments.get_edited_preset().name + + "\", not \"" + target + "\"; the transaction was not created"); + selection_changed = true; + } + + bool assignment_changed = false; + if (!preset_name.empty() && target != assigned_internal) { + if (app.app_config == nullptr) + throw std::runtime_error("Application configuration is not available"); + // Mirror the filament branch of Plater::priv::on_select_preset() (the sidebar's normal + // preset selection): update the mapping, then every dependent project/UI side effect, + // rather than the vector entry alone. + const bool was_support = GUI::is_support_filament(static_cast(slot_index)); + bundle.set_filament_preset(slot_index, target); + plater->update_project_dirty_from_presets(); + bundle.export_selections(*app.app_config); + plater->sidebar().update_dynamic_filament_list(); + // Assigning a support filament (or moving away from one) changes which filaments the + // flush rules apply to, so the normal flow recalculates the flushing volumes when + // auto-calc covers every filament. + if (GUI::is_support_filament(static_cast(slot_index)) != was_support + && app.app_config->get("auto_calculate_flush") == "all") + plater->sidebar().auto_calc_flushing_volumes(static_cast(slot_index)); + // Refresh the requested slot's own sidebar combo so its list and current selection show the + // newly assigned target (the list may not have contained it), matching the sidebar + // selection path. Fetch the pointer after update_dynamic_filament_list(), which may + // rebuild the combo vector. + std::vector& slot_combos = plater->sidebar().combos_filament(); + if (slot_index < slot_combos.size() && slot_combos[slot_index] != nullptr) { + GUI::PlaterPresetComboBox* slot_combo = slot_combos[slot_index]; + slot_combo->update(); + // Keep the slot's AMS sync badge truthful, reading the item's own flag, the same source + // on_select_preset() reads, so no UI state is invented here. + const int item = combo_item_for_preset(*slot_combo, target); + if (item >= 0) + slot_combo->set_sync_badge(slot_combo->GetFlag(item) + == static_cast(GUI::PresetComboBox::FilamentAMSType::FROM_AMS)); + } + plater->on_filament_change(slot_index); + assignment_changed = true; + } + + // Match PlaterPresetComboBox::switch_to_tab(): record which 0-based filament slot this tab + // combobox now edits, so the GUI shows the slot the value was written for. + if (GUI::TabPresetComboBox* combo = tab->get_combo_box()) + combo->set_filament_idx(slot_number - 1); + + transaction.type = Preset::TYPE_FILAMENT; + transaction.filament = true; + transaction.slot_number = slot_number; + transaction.target_name = target; + transaction.selection_changed = selection_changed; + transaction.slot_assignment_changed = assignment_changed; + // Snapshot the mapping after the explicit assignment, as the slot's resolved internal name, + // so commit() compares like with like (a stored alias resolves to the same internal preset). + transaction.slot_assignment_snapshot = resolved_slot_preset(bundle, slot_number); +} + +// Blocking form used by begin_update() and update(). +PresetTransaction begin_filament_update(int slot_number, const std::string& preset_name) +{ + PresetTransaction transaction; + PluginHostUi::run_on_ui_thread([&] { bind_filament_target(slot_number, preset_name, transaction); }); + return transaction; +} + +// Compatibility shorthand: one staged setting, committed immediately through the same +// begin_update()/set()/commit() path, so targeting, selection, validation and commit are shared. +void update_edited_preset(Preset::Type type, const std::string& key, const std::string& value) +{ + PresetTransaction transaction = begin_preset_update(type, std::string()); + transaction.set(key, value); + transaction.commit(); +} + +void update_filament_slot(int slot_number, const std::string& key, const std::string& value) +{ + PresetTransaction transaction = begin_filament_update(slot_number, std::string()); + transaction.set(key, value); + transaction.commit(); +} + void reload_local_bundle(const std::string& bundle_id) { bool reloaded = false; @@ -100,7 +641,7 @@ std::vector list_bundle_ids() void host_bindings::register_presets(py::module_& host) { - auto preset = host.def_submodule("preset", "Preset operations"); + auto preset = host.def_submodule("preset", "Preset operations"); auto bundles = preset.def_submodule("bundles", "Local preset bundle operations"); bundles.def("reload_local", &reload_local_bundle, py::arg("bundle_id"), "Reload one local preset bundle from the active user's _local directory."); @@ -119,6 +660,145 @@ void host_bindings::register_presets(py::module_& host) .value("Plate", Preset::TYPE_PLATE) .value("Model", Preset::TYPE_MODEL); + py::class_(preset, "PresetUpdateResult", + "Outcome of one committed preset transaction. target_name is the preset that was " + "edited; selection_changed says whether begin_update() switched the active preset; " + "for filament, slot_number is the 1-based target slot, slot_assignment_changed " + "says whether selecting the requested preset reassigned that slot, and shared_slots " + "lists every 1-based slot whose assigned preset is the edited (shared) one. keys " + "lists the settings applied, in order, and dirty says whether the edited preset " + "now differs from its saved state.") + .def_readonly("type", &PresetUpdateResult::type) + .def_readonly("target_name", &PresetUpdateResult::target_name) + .def_readonly("selection_changed", &PresetUpdateResult::selection_changed) + .def_readonly("slot_number", &PresetUpdateResult::slot_number) + .def_readonly("slot_assignment_changed", &PresetUpdateResult::slot_assignment_changed) + .def_readonly("shared_slots", &PresetUpdateResult::shared_slots) + .def_readonly("keys", &PresetUpdateResult::keys) + .def_readonly("dirty", &PresetUpdateResult::dirty) + .def_property_readonly("category", [](const PresetUpdateResult& result) { return preset_tab_name(result.type); }) + .def("__repr__", [](const PresetUpdateResult& result) { + return std::string(""; + }); + + py::class_(preset, "PresetTransaction", + "A staged, single-target preset edit returned by begin_update(). set() stages a " + "serialized value without mutating the preset; commit() validates and applies the " + "whole batch through the normal setting-change path. begin_update() blocks the " + "background Script worker until any selection or unsaved-edit dialog is answered, " + "while the UI thread stays responsive; set() and commit() run synchronously on the " + "same worker. Nothing is saved to disk: the edited preset stays dirty until the user " + "saves it.") + .def_readonly("type", &PresetTransaction::type) + .def_readonly("target_name", &PresetTransaction::target_name) + .def_readonly("selection_changed", &PresetTransaction::selection_changed) + .def_property_readonly("slot_number", [](const PresetTransaction& transaction) { + return transaction.filament ? transaction.slot_number : -1; + }) + .def_property_readonly("category", [](const PresetTransaction& transaction) { return preset_tab_name(transaction.type); }) + .def_property_readonly("staged_keys", [](const PresetTransaction& transaction) { + std::vector keys; + keys.reserve(transaction.staged.size()); + for (const auto& entry : transaction.staged) + keys.push_back(entry.first); + return keys; + }) + .def("set", &PresetTransaction::set, py::arg("key"), py::arg("value"), + "Stage one setting change. key must be a setting of the target preset category and value its " + "serialized string form; staging validates neither, so commit() is where an invalid key or value " + "fails. Staging the same key twice in one transaction raises ValueError (conflicting duplicate " + "writes are rejected). After commit() the transaction is closed.") + .def("commit", &PresetTransaction::commit, + "Validate and apply every staged setting through the same path as editing it in the GUI, then return " + "a PresetUpdateResult. An invalid key or value raises ValueError; a changed target or filament slot " + "mapping raises RuntimeError; a failure leaves none of the staged settings applied. The edited preset " + "becomes dirty until the user saves it."); + + py::class_(preset, "PresetEditor", + "Handle to a category of currently edited preset. It is not a snapshot: it always " + "resolves the preset the matching tab edits now, so it stays usable across preset " + "switches. update() edits the preset in place; the change is not saved to disk.") + .def_readonly("type", &PresetEditor::type) + .def( + "begin_update", + [](const PresetEditor& editor, const std::string& preset_name) { + if (editor.type == Preset::TYPE_FILAMENT) + throw std::invalid_argument("begin_update on the filament editor takes " + "(slot_number, preset_name=\"\"); use orca.host.preset.filament.begin_update(slot_number, ...)"); + return begin_preset_update(editor.type, preset_name); + }, + py::arg("preset_name") = "", + "Resolve and bind this category's target preset and return a PresetTransaction. With no preset_name the " + "currently active preset is targeted; a preset_name must be a preset this category can select, and is " + "selected through the normal preset-selection flow (which prompts about unsaved edits). The call blocks " + "the background Script worker until any such dialog is answered, leaving the UI thread responsive. A " + "selection the user cancels raises RuntimeError; an unavailable or invalid target raises ValueError. " + "Either failure creates no transaction and stages no setting. Call it from the background Script worker, " + "never from the UI thread. This form is for process and printer; filament takes " + "begin_update(slot_number, preset_name=\"\").") + .def( + "begin_update", + [](const PresetEditor& editor, int slot_number, const std::string& preset_name) { + if (editor.type != Preset::TYPE_FILAMENT) + throw std::invalid_argument("The slot_number form of begin_update() is only available on " + "orca.host.preset.filament; call begin_update(preset_name=\"\") on this editor"); + return begin_filament_update(slot_number, preset_name); + }, + py::arg("slot_number"), py::arg("preset_name") = "", + "Resolve and bind a filament preset by 1-based slot and return a PresetTransaction. Omitting preset_name " + "targets the preset assigned to the slot; supplying a different name selects it for the slot through the " + "normal flow (prompting about unsaved edits) and, once that succeeds, records the new slot assignment with " + "the same Plater side effects the sidebar selection performs (project/selection refresh, dynamic filament " + "list, conditional support-filament flushing recalc and the slot's AMS sync badge). A requested preset " + "this slot's dropdown does not offer is rejected before that flow, so it raises no prompt; the slot's own " + "current assignment stays targetable even when the dropdown hides it. A selection the user cancels raises " + "RuntimeError and changes neither the slot assignment nor any setting. An out-of-range, empty or " + "unresolved slot is rejected, and a mixed-color virtual slot is rejected whether or not preset_name is " + "given. The transaction edits the shared preset, so every slot assigned to it is affected. The call " + "blocks the background Script worker until the selection settles, leaving the UI thread responsive; call " + "it from that worker, never from the UI thread.") + .def( + "update", + [](const PresetEditor& editor, const std::string& key, const std::string& value) { + update_edited_preset(editor.type, key, value); + }, + py::arg("key"), py::arg("value"), + "Set one setting of the currently edited preset and run the same committed-change path as " + "editing the setting in the GUI; the edited preset becomes dirty until saved/exported. " + "key must be a setting of this preset category and value its serialized string form, " + "otherwise ValueError is raised and nothing is written. A setting edited through a field " + "runs that field's validation even before its page has been opened; one the GUI edits " + "outside a field (such as compatible printers) also recomputes preset compatibility. " + "Equivalent to begin_update() with the active preset as target, then set(key, value) " + "and commit(); like begin_update() this call blocks the background Script worker.") + .def( + "update", + [](const PresetEditor& editor, int slot_number, const std::string& key, const std::string& value) { + if (editor.type != Preset::TYPE_FILAMENT) + throw std::invalid_argument("The slot_number form of update() is only available on " + "orca.host.preset.filament; call update(key, value) on this editor"); + update_filament_slot(slot_number, key, value); + }, + py::arg("slot_number"), py::arg("key"), py::arg("value"), + "Set one setting of the filament preset assigned to a 1-based filament slot. When that preset " + "is not the one currently edited the call switches to it through the normal preset-selection " + "flow, so an unsaved edited preset still prompts the user and a declined prompt cancels the " + "call with an error and no change. An out-of-range, empty or unresolved slot is rejected with " + "a clear error, as is a mixed-color virtual slot, which has no single preset to edit. Other " + "preset editors accept only update(key, value); this form raises " + "ValueError on them. Equivalent to begin_update(slot_number) with an omitted preset_name " + "(the slot's current assignment is kept), then set(key, value) and commit(); like " + "begin_update() this call blocks the background Script worker."); + + // The three preset categories edited by the main tabs. `process` is the print/process preset, + // `printer` the machine preset and `filament` the currently edited filament preset (its + // 3-argument form addresses a 1-based filament slot); each only accepts its own settings, so a + // printer setting passed to `process` is rejected instead of written silently. + preset.attr("process") = py::cast(PresetEditor{Preset::TYPE_PRINT}); + preset.attr("printer") = py::cast(PresetEditor{Preset::TYPE_PRINTER}); + preset.attr("filament") = py::cast(PresetEditor{Preset::TYPE_FILAMENT}); + py::class_>(host, "Preset") .def_readonly("type", &Preset::type) .def_readonly("name", &Preset::name) diff --git a/src/slic3r/plugin/pluginTypes/printerAgent/PrinterAgentPluginCapabilityTrampoline.hpp b/src/slic3r/plugin/pluginTypes/printerAgent/PrinterAgentPluginCapabilityTrampoline.hpp index 790f6e3ac6..812d69c072 100644 --- a/src/slic3r/plugin/pluginTypes/printerAgent/PrinterAgentPluginCapabilityTrampoline.hpp +++ b/src/slic3r/plugin/pluginTypes/printerAgent/PrinterAgentPluginCapabilityTrampoline.hpp @@ -282,11 +282,11 @@ public: int request_bind_ticket(std::string* ticket) override { try { - ORCA_PY_AUDIT_SCOPE(); ::Slic3r::PluginCapabilityInterface::RefCounter _orca_ref_counter(*this); ::Slic3r::PythonGILState gil; if (!gil) throw std::runtime_error("Python interpreter is shutting down"); + ORCA_PY_AUDIT_SCOPE(); pybind11::function override = pybind11::get_override(static_cast(this), "request_bind_ticket"); if (!override) diff --git a/tests/cli/test_cli_project_missing_keys.sh b/tests/cli/test_cli_project_missing_keys.sh index f20a2eb822..00df605cfc 100644 --- a/tests/cli/test_cli_project_missing_keys.sh +++ b/tests/cli/test_cli_project_missing_keys.sh @@ -8,6 +8,9 @@ # key, one process key and two filament keys (one per filament, one per extruder variant) are changed # without being listed, one process key and the first filament's density are changed and listed, and it # is sliced again: as is, with --uptodate, and with --load-filaments replacing only the second filament. +# Without any entry in different_settings_to_system the project does not say which values it changed: +# a plain run then keeps every stored value and takes only the removed keys, three filament keys among +# them, from the system presets, while --uptodate still refreshes the unlisted ones. # # usage: test_cli_project_missing_keys.sh set -u @@ -71,11 +74,12 @@ with zipfile.ZipFile(src) as zin, zipfile.ZipFile(dst, "w", zipfile.ZIP_DEFLATED config[key] = str(int(float(config[key])) + 1) for key in ("filament_cost", "filament_max_volumetric_speed"): expected[key] = config[key] - config[key] = [str(float(v) + 1) for v in config[key]] + # Written as the slicer writes them, so the value a project keeps reads back the same. + config[key] = ["%g" % (float(v) + 1) for v in config[key]] expected["wall_loops"] = str(int(config["wall_loops"]) + 1) config["wall_loops"] = expected["wall_loops"] expected["filament_density"] = [str(float(config["filament_density"][0]) + 1)] + config["filament_density"][1:] - config["filament_density"] = [expected["filament_density"][0]] + [str(float(v) + 1) for v in config["filament_density"][1:]] + config["filament_density"] = [expected["filament_density"][0]] + ["%g" % (float(v) + 1) for v in config["filament_density"][1:]] # One entry for the process, one per filament, one for the printer. different = config["different_settings_to_system"] different[0] = ";".join([k for k in different[0].split(";") if k] + ["wall_loops"]) @@ -86,8 +90,9 @@ with open(dst + ".expected.json", "w") as f: json.dump(expected, f) EOF +# check [expected.json] check() { - if ! "$PY" - "$WORK/$1/out.3mf" "$WORK/old.3mf.expected.json" "$1" <<'EOF' + if ! "$PY" - "$WORK/$1/out.3mf" "${2:-$WORK/old.3mf.expected.json}" "$1" <<'EOF' import json, sys, zipfile with zipfile.ZipFile(sys.argv[1]) as z: @@ -112,4 +117,46 @@ check uptodate # The replaced second filament takes the system values the refresh would have given it. slice partial "$WORK/old.3mf" --load-filaments ";$PROFILES/filament/Bambu PLA Basic @BBL P1S 0.4 nozzle.json" check partial + +# The same project with no list and with an empty entry for every preset, and without two per-variant +# filament keys and one filament_dev key. A plain run keeps the stored values; --uptodate refreshes them +# all, and the listed keys have no system value to expect. +"$PY" - "$WORK/old.3mf" "$WORK/old.3mf.expected.json" "$WORK" <<'EOF' || exit $? +import json, sys, zipfile + +src, expected_path, work = sys.argv[1:] +with open(expected_path) as f: + expected = json.load(f) +# Read every entry first: writestr() updates the ZipInfo it is given, so zin could not read it again. +with zipfile.ZipFile(src) as zin: + items = [(item, zin.read(item.filename)) for item in zin.infolist()] +config = json.loads(next(data for item, data in items if item.filename == "Metadata/project_settings.config")) +stored = {key: config.get(key, want) for key, want in expected.items()} +refreshed = {key: want for key, want in expected.items() if key not in ("wall_loops", "filament_density")} +# The removed filament keys, with their option defaults from PrintConfig.cpp. +for key, default in (("nozzle_temperature", "200"), ("filament_flow_ratio", "1"), ("filament_dev_ams_drying_time", "0")): + if default in config[key]: + print("SKIP: %s is %s in the system preset, the option default, so the test cannot tell them apart" % (key, default)) + sys.exit(77) + stored[key] = refreshed[key] = config.pop(key) +for name, different in (("unlisted", None), ("empty_list", [""] * len(config["different_settings_to_system"]))): + if different is None: + config.pop("different_settings_to_system") + else: + config["different_settings_to_system"] = different + with zipfile.ZipFile("%s/%s.3mf" % (work, name), "w", zipfile.ZIP_DEFLATED) as zout: + for item, data in items: + if item.filename == "Metadata/project_settings.config": + data = json.dumps(config, indent=4) + zout.writestr(item, data) +for name, values in (("stored", stored), ("refreshed", refreshed)): + with open("%s/%s.expected.json" % (work, name), "w") as f: + json.dump(values, f) +EOF +slice unlisted "$WORK/unlisted.3mf" +check unlisted "$WORK/stored.expected.json" +slice empty_list "$WORK/empty_list.3mf" +check empty_list "$WORK/stored.expected.json" +slice unlisted_uptodate "$WORK/unlisted.3mf" --uptodate +check unlisted_uptodate "$WORK/refreshed.expected.json" echo "PASS" diff --git a/tests/data/seam_contour_benchy_split.txt b/tests/data/seam_contour_benchy_split.txt new file mode 100644 index 0000000000..9e030f2d75 --- /dev/null +++ b/tests/data/seam_contour_benchy_split.txt @@ -0,0 +1,582 @@ +1 +0 0.41999998688697815 0.4 287 +11.697874069213867 -8.5420131683349609 +11.807644844055176 -8.5151939392089844 +11.885490417480469 -8.4626426696777344 +11.955679893493652 -8.3574113845825195 +11.976012229919434 -8.2445869445800781 +11.975451469421387 -6.5400009155273438 +12.276429176330566 -6.5400009155273438 +12.276576995849609 -5.215482234954834 +10.389512062072754 -5.215482234954834 +10.388867378234863 -6.8882331848144531 +-6.7026500701904297 -5.9390401840209961 +-6.7026500701904297 5.9390377998352051 +-6.502957820892334 5.9501276016235352 +-6.3032655715942383 5.9612178802490234 +-6.1035733222961426 5.9723076820373535 +-5.9038810729980469 5.9833979606628418 +-5.7041888236999512 5.9944877624511719 +-5.5044965744018555 6.0055780410766602 +-5.3048038482666016 6.0166678428649902 +-5.1051115989685059 6.0277581214904785 +-4.9054193496704102 6.0388479232788086 +-4.7057271003723145 6.0499382019042969 +-4.5060348510742188 6.061028003692627 +-4.3063421249389648 6.0721182823181152 +-4.1066498756408691 6.0832080841064453 +-3.9069576263427734 6.0942983627319336 +-3.7072653770446777 6.1053881645202637 +-3.5075728893280029 6.116478443145752 +-3.3078806400299072 6.127568244934082 +-3.1081883907318115 6.1386585235595703 +-2.9084959030151367 6.1497483253479004 +-2.7088038921356201 6.1608386039733887 +-2.5091118812561035 6.1719284057617188 +-2.3094196319580078 6.183018684387207 +-2.1097273826599121 6.1941084861755371 +-1.9100356101989746 6.2051987648010254 +-1.7103433609008789 6.2162885665893555 +-1.5106511116027832 6.2273788452148438 +-1.3109593391418457 6.2384686470031738 +-1.11126708984375 6.2495589256286621 +-0.9115748405456543 6.2606487274169922 +-0.7118830680847168 6.2717390060424805 +-0.51219081878662109 6.2828288078308105 +-0.31249856948852539 6.2939190864562988 +-0.11280679702758789 6.3050088882446289 +0.086885452270507812 6.3160991668701172 +0.28657770156860352 6.3271889686584473 +0.48626947402954102 6.3382787704467773 +0.68596172332763672 6.3493690490722656 +0.88565397262573242 6.3604588508605957 +1.0853457450866699 6.371549129486084 +1.2850379943847656 6.3826389312744141 +1.4847307205200195 6.3937292098999023 +1.684422492980957 6.4048190116882324 +1.8841152191162109 6.4159092903137207 +2.0838069915771484 6.4269990921020508 +2.2834987640380859 6.4380893707275391 +2.4831914901733398 6.4491791725158691 +2.6828832626342773 6.4602694511413574 +2.8825750350952148 6.4713592529296875 +3.0822677612304688 6.4824495315551758 +3.2819595336914062 6.4935393333435059 +3.4816513061523438 6.5046296119689941 +3.6813440322875977 6.5157194137573242 +3.8810358047485352 6.5268096923828125 +4.0807275772094727 6.5378994941711426 +4.2804203033447266 6.5489892959594727 +4.4801120758056641 6.5600795745849609 +4.6798038482666016 6.571169376373291 +4.8794965744018555 6.5822596549987793 +5.079188346862793 6.5933494567871094 +5.2788801193237305 6.6044397354125977 +5.4785728454589844 6.6155295372009277 +5.6782646179199219 6.626619815826416 +5.8779563903808594 6.6377096176147461 +6.0776491165161133 6.6487998962402344 +6.2773408889770508 6.6598896980285645 +6.4770326614379883 6.6709799766540527 +6.6767253875732422 6.6820697784423828 +6.8764171600341797 6.6931600570678711 +7.0761089324951172 6.7042498588562012 +7.2758016586303711 6.7153401374816895 +7.4754934310913086 6.7264299392700195 +7.6751852035522461 6.7375202178955078 +7.8748779296875 6.7486100196838379 +8.0745697021484375 6.759699821472168 +8.274261474609375 6.7707901000976562 +8.4739542007446289 6.7818799018859863 +8.6736459732055664 6.7929701805114746 +8.8733377456665039 6.8040599822998047 +9.0730304718017578 6.815150260925293 +9.2727222442626953 6.826240062713623 +9.4724140167236328 6.8373303413391113 +9.6721076965332031 6.8484201431274414 +9.8718013763427734 6.8595104217529297 +10.071493148803711 6.870600700378418 +10.271186828613281 6.881690502166748 +10.388867378234863 6.8882260322570801 +10.389512062072754 5.2154779434204102 +12.276576995849609 5.2154779434204102 +12.276429176330566 6.5400009155273438 +11.975607872009277 6.5400009155273438 +11.974886894226074 8.2683258056640625 +11.942225456237793 8.3868656158447266 +11.873661994934082 8.4729747772216797 +11.778239250183105 8.5271291732788086 +11.658943176269531 8.542170524597168 +-8.0029592514038086 7.4495530128479004 +-8.1317710876464844 7.413823127746582 +-8.2030715942382812 7.3597521781921387 +-8.2685146331787109 7.249596118927002 +-8.283625602722168 7.1527981758117676 +-8.283625602722168 6.9527983665466309 +-8.283625602722168 6.7527980804443359 +-8.283625602722168 6.5527982711791992 +-8.283625602722168 6.3527979850769043 +-8.283625602722168 6.1527981758117676 +-8.283625602722168 5.9527978897094727 +-8.283625602722168 5.7527980804443359 +-8.283625602722168 5.5527982711791992 +-8.283625602722168 5.3527979850769043 +-8.283625602722168 5.1527976989746094 +-8.283625602722168 4.9527978897094727 +-8.283625602722168 4.7527980804443359 +-8.283625602722168 4.552797794342041 +-8.283625602722168 4.3527975082397461 +-8.283625602722168 4.1527976989746094 +-8.283625602722168 3.9527976512908936 +-8.283625602722168 3.7527976036071777 +-8.283625602722168 3.5527975559234619 +-8.283625602722168 3.3527975082397461 +-8.283625602722168 3.1527976989746094 +-8.283625602722168 2.9527978897094727 +-8.283625602722168 2.7527980804443359 +-8.283625602722168 2.5527982711791992 +-8.283625602722168 2.3527984619140625 +-8.283625602722168 2.1527986526489258 +-8.283625602722168 1.9527988433837891 +-8.283625602722168 1.7527990341186523 +-8.283625602722168 1.5527992248535156 +-8.283625602722168 1.3527994155883789 +-8.283625602722168 1.1527996063232422 +-8.283625602722168 0.95279979705810547 +-8.283625602722168 0.75279998779296875 +-8.283625602722168 0.55280017852783203 +-8.283625602722168 0.35280036926269531 +-8.283625602722168 0.15280055999755859 +-8.283625602722168 -0.047199249267578125 +-8.283625602722168 -0.24719905853271484 +-8.283625602722168 -0.44719886779785156 +-8.283625602722168 -0.64719867706298828 +-8.283625602722168 -0.847198486328125 +-8.283625602722168 -1.0471987724304199 +-8.283625602722168 -1.2471985816955566 +-8.283625602722168 -1.4471983909606934 +-8.283625602722168 -1.6471982002258301 +-8.283625602722168 -1.8471980094909668 +-8.283625602722168 -2.0471978187561035 +-8.283625602722168 -2.2471976280212402 +-8.283625602722168 -2.447197437286377 +-8.283625602722168 -2.6471972465515137 +-8.283625602722168 -2.8471970558166504 +-8.283625602722168 -3.0471968650817871 +-8.283625602722168 -3.2471966743469238 +-8.283625602722168 -3.4471964836120605 +-8.283625602722168 -3.6471962928771973 +-8.283625602722168 -3.847196102142334 +-8.283625602722168 -4.0471959114074707 +-8.283625602722168 -4.2471957206726074 +-8.283625602722168 -4.4471955299377441 +-8.283625602722168 -4.6471953392028809 +-8.283625602722168 -4.8471951484680176 +-8.283625602722168 -5.0471949577331543 +-8.283625602722168 -5.247194766998291 +-8.283625602722168 -5.4471945762634277 +-8.283625602722168 -5.6471943855285645 +-8.283625602722168 -5.8471941947937012 +-8.283625602722168 -6.0471940040588379 +-8.283625602722168 -6.2471938133239746 +-8.283625602722168 -6.4471936225891113 +-8.283625602722168 -6.647193431854248 +-8.283625602722168 -6.8471932411193848 +-8.283625602722168 -7.0471930503845215 +-8.283625602722168 -7.1494722366333008 +-8.2683954238891602 -7.2499008178710938 +-8.2184553146362305 -7.3418078422546387 +-8.0947837829589844 -7.430692195892334 +-8.0006170272827148 -7.4496769905090332 +-7.8009238243103027 -7.4607505798339844 +-7.6012306213378906 -7.4718241691589355 +-7.4015374183654785 -7.4828977584838867 +-7.2018442153930664 -7.4939713478088379 +-7.0021510124206543 -7.5050449371337891 +-6.8024578094482422 -7.516118049621582 +-6.6027646064758301 -7.5271916389465332 +-6.403071403503418 -7.5382652282714844 +-6.2033777236938477 -7.5493388175964355 +-6.0036849975585938 -7.5604124069213867 +-5.8039913177490234 -7.5714859962463379 +-5.6042985916137695 -7.5825595855712891 +-5.4046049118041992 -7.5936331748962402 +-5.2049117088317871 -7.6047067642211914 +-5.005218505859375 -7.6157803535461426 +-4.8055253028869629 -7.6268539428710938 +-4.6058320999145508 -7.6379270553588867 +-4.4061384201049805 -7.6490006446838379 +-4.2064456939697266 -7.6600742340087891 +-4.0067524909973145 -7.6711478233337402 +-3.8070592880249023 -7.6822214126586914 +-3.6073665618896484 -7.6932950019836426 +-3.4076733589172363 -7.7043685913085938 +-3.2079806327819824 -7.7154421806335449 +-3.0082874298095703 -7.7265157699584961 +-2.8085942268371582 -7.7375888824462891 +-2.6089015007019043 -7.7486624717712402 +-2.4092082977294922 -7.7597360610961914 +-2.2095155715942383 -7.7708096504211426 +-2.0098223686218262 -7.7818832397460938 +-1.8101291656494141 -7.7929568290710449 +-1.6104364395141602 -7.8040304183959961 +-1.410743236541748 -7.8151040077209473 +-1.2110505104064941 -7.8261775970458984 +-1.011357307434082 -7.8372507095336914 +-0.81166410446166992 -7.8483242988586426 +-0.61197137832641602 -7.8593978881835938 +-0.41227817535400391 -7.8704714775085449 +-0.21258544921875 -7.8815450668334961 +-0.012892246246337891 -7.8926186561584473 +0.18680095672607422 -7.9036922454833984 +0.38649463653564453 -7.9147658348083496 +0.58618736267089844 -7.9258394241333008 +0.78588008880615234 -7.9369125366210938 +0.98557376861572266 -7.9479861259460449 +1.1852664947509766 -7.9590597152709961 +1.3849592208862305 -7.9701333045959473 +1.5846519470214844 -7.9812068939208984 +1.7843456268310547 -7.9922804832458496 +1.9840383529663086 -8.0033540725708008 +2.1837310791015625 -8.0144271850585938 +2.3834247589111328 -8.0255012512207031 +2.5831174850463867 -8.0365743637084961 +2.7828102111816406 -8.0476484298706055 +2.9825038909912109 -8.0587215423583984 +3.1821966171264648 -8.0697956085205078 +3.3818893432617188 -8.0808687210083008 +3.5815820693969727 -8.0919418334960938 +3.781275749206543 -8.1030158996582031 +3.9809684753417969 -8.1140890121459961 +4.1806612014770508 -8.1251630783081055 +4.3803548812866211 -8.1362361907958984 +4.580047607421875 -8.1473102569580078 +4.7797403335571289 -8.1583833694458008 +4.9794340133666992 -8.1694564819335938 +5.1791267395019531 -8.1805305480957031 +5.378819465637207 -8.1916036605834961 +5.5785121917724609 -8.2026777267456055 +5.7782058715820312 -8.2137508392333984 +5.9778985977172852 -8.2248249053955078 +6.1775913238525391 -8.2358980178833008 +6.3772850036621094 -8.2469720840454102 +6.5769777297973633 -8.2580451965332031 +6.7766704559326172 -8.2691192626953125 +6.9763641357421875 -8.2801923751831055 +7.1760568618774414 -8.2912654876708984 +7.3757495880126953 -8.3023395538330078 +7.5754423141479492 -8.3134126663208008 +7.7751359939575195 -8.3244867324829102 +7.9748287200927734 -8.3355598449707031 +8.1745214462280273 -8.3466339111328125 +8.3742151260375977 -8.3577070236206055 +8.573908805847168 -8.3687810897827148 +8.7736043930053711 -8.3798542022705078 +8.9732980728149414 -8.3909282684326172 +9.1729917526245117 -8.4020013809204102 +9.372685432434082 -8.4130754470825195 +9.5723791122436523 -8.4241485595703125 +9.7720727920532227 -8.4352226257324219 +9.9717683792114258 -8.4462957382202148 +10.171462059020996 -8.4573688507080078 +10.371155738830566 -8.4684429168701172 +10.570849418640137 -8.4795169830322266 +10.770543098449707 -8.4905900955200195 +10.970236778259277 -8.5016632080078125 +11.169930458068848 -8.5127372741699219 +11.369626045227051 -8.5238113403320312 +11.569319725036621 -8.5348844528198242 +11.697874069213867 -8.5420131683349609 +2 +1 0.41999998688697815 0.4 93 +10.401542663574219 -4.8054819107055664 +10.401542663574219 4.8054780960083008 +10.401542663574219 4.8054780960083008 +10.401542663574219 6.8931269645690918 +-6.7068581581115723 5.9429759979248047 +-6.7068581581115723 -5.9429788589477539 +-6.5071659088134766 -5.9540691375732422 +-6.3074736595153809 -5.9651594161987305 +-6.1077814102172852 -5.9762496948242188 +-5.9080891609191895 -5.987339973449707 +-5.7083969116210938 -5.9984302520751953 +-5.5087041854858398 -6.0095205307006836 +-5.3090119361877441 -6.0206108093261719 +-5.1093196868896484 -6.0317010879516602 +-4.9096274375915527 -6.0427913665771484 +-4.709935188293457 -6.0538816452026367 +-4.5102424621582031 -6.064971923828125 +-4.3105506896972656 -6.0760622024536133 +-4.1108579635620117 -6.0871524810791016 +-3.911165714263916 -6.0982427597045898 +-3.7114734649658203 -6.1093330383300781 +-3.5117809772491455 -6.1204233169555664 +-3.3120887279510498 -6.1315135955810547 +-3.1123964786529541 -6.142603874206543 +-2.9127039909362793 -6.1536941528320312 +-2.7130119800567627 -6.1647844314575195 +-2.5133199691772461 -6.1758747100830078 +-2.3136277198791504 -6.1869649887084961 +-2.1139354705810547 -6.1980552673339844 +-1.9142436981201172 -6.2091455459594727 +-1.7145514488220215 -6.2202358245849609 +-1.5148591995239258 -6.2313261032104492 +-1.3151674270629883 -6.2424163818359375 +-1.1154751777648926 -6.2535066604614258 +-0.91578292846679688 -6.2645969390869141 +-0.71609115600585938 -6.2756872177124023 +-0.51639890670776367 -6.2867774963378906 +-0.31670665740966797 -6.2978677749633789 +-0.11701488494873047 -6.3089580535888672 +0.082677364349365234 -6.3200483322143555 +0.28236961364746094 -6.3311386108398438 +0.48206138610839844 -6.342228889465332 +0.68175363540649414 -6.3533191680908203 +0.88144588470458984 -6.3644094467163086 +1.0811376571655273 -6.3754997253417969 +1.280829906463623 -6.3865900039672852 +1.480522632598877 -6.3976802825927734 +1.6802144050598145 -6.4087705612182617 +1.8799071311950684 -6.41986083984375 +2.0795989036560059 -6.4309511184692383 +2.2792906761169434 -6.4420413970947266 +2.4789834022521973 -6.4531316757202148 +2.6786751747131348 -6.4642219543457031 +2.8783669471740723 -6.4753122329711914 +3.0780596733093262 -6.4864025115966797 +3.2777514457702637 -6.497492790222168 +3.4774432182312012 -6.5085830688476562 +3.6771359443664551 -6.5196733474731445 +3.8768277168273926 -6.5307636260986328 +4.0765194892883301 -6.5418539047241211 +4.276212215423584 -6.5529441833496094 +4.4759039878845215 -6.5640344619750977 +4.675595760345459 -6.5751247406005859 +4.8752884864807129 -6.5862150192260742 +5.0749802589416504 -6.5973052978515625 +5.2746720314025879 -6.6083955764770508 +5.4743647575378418 -6.6194858551025391 +5.6740565299987793 -6.6305761337280273 +5.8737483024597168 -6.6416664123535156 +6.0734410285949707 -6.6527566909790039 +6.2731328010559082 -6.6638469696044922 +6.4728245735168457 -6.6749372482299805 +6.6725172996520996 -6.6860275268554688 +6.8722090721130371 -6.697117805480957 +7.0719008445739746 -6.7082080841064453 +7.2715935707092285 -6.7192983627319336 +7.471285343170166 -6.7303886413574219 +7.6709771156311035 -6.7414789199829102 +7.8706698417663574 -6.7525691986083984 +8.0703620910644531 -6.7636594772338867 +8.2700538635253906 -6.774749755859375 +8.4697456359863281 -6.7858400344848633 +8.6694374084472656 -6.7969303131103516 +8.8691291809082031 -6.8080205917358398 +9.0688228607177734 -6.8191108703613281 +9.2685146331787109 -6.8302011489868164 +9.4682064056396484 -6.8412914276123047 +9.6679000854492188 -6.852381706237793 +9.8675937652587891 -6.8634719848632812 +10.067285537719727 -6.8745622634887695 +10.266979217529297 -6.8856525421142578 +10.401542663574219 -6.8931260108947754 +10.401542663574219 -4.8054819107055664 +0 0.41999998688697815 0.4 197 +12.289004325866699 4.8054780960083008 +12.289004325866699 6.5400009155273438 +11.988205909729004 6.5400009155273438 +11.987482070922852 8.2732219696044922 +11.954745292663574 8.3918991088867188 +11.886277198791504 8.4778499603271484 +11.790833473205566 8.5320243835449219 +11.671573638916016 8.5470714569091797 +-8.0071420669555664 7.4535188674926758 +-8.1360998153686523 7.4177150726318359 +-8.2072591781616211 7.3637189865112305 +-8.2727594375610352 7.253410816192627 +-8.2878179550170898 7.1567649841308594 +-8.2878179550170898 6.9567651748657227 +-8.2878179550170898 6.7567648887634277 +-8.2878179550170898 6.556765079498291 +-8.2878179550170898 6.3567647933959961 +-8.2878179550170898 6.1567649841308594 +-8.2878179550170898 5.9567651748657227 +-8.2878179550170898 5.7567648887634277 +-8.2878179550170898 5.5567646026611328 +-8.2878179550170898 5.3567647933959961 +-8.2878179550170898 5.1567649841308594 +-8.2878179550170898 4.9567646980285645 +-8.2878179550170898 4.7567644119262695 +-8.2878179550170898 4.5567646026611328 +-8.2878179550170898 4.3567647933959961 +-8.2878179550170898 4.1567645072937012 +-8.2878179550170898 3.9567644596099854 +-8.2878179550170898 3.7567644119262695 +-8.2878179550170898 3.5567643642425537 +-8.2878179550170898 3.3567643165588379 +-8.2878179550170898 3.1567645072937012 +-8.2878179550170898 2.9567646980285645 +-8.2878179550170898 2.7567648887634277 +-8.2878179550170898 2.556765079498291 +-8.2878179550170898 2.3567652702331543 +-8.2878179550170898 2.1567654609680176 +-8.2878179550170898 1.9567656517028809 +-8.2878179550170898 1.7567658424377441 +-8.2878179550170898 1.5567660331726074 +-8.2878179550170898 1.3567662239074707 +-8.2878179550170898 1.156766414642334 +-8.2878179550170898 0.95676660537719727 +-8.2878179550170898 0.75676679611206055 +-8.2878179550170898 0.55676698684692383 +-8.2878179550170898 0.35676717758178711 +-8.2878179550170898 0.15676736831665039 +-8.2878179550170898 -0.043232440948486328 +-8.2878179550170898 -0.24323225021362305 +-8.2878179550170898 -0.44323205947875977 +-8.2878179550170898 -0.64323186874389648 +-8.2878179550170898 -0.8432316780090332 +-8.2878179550170898 -1.0432319641113281 +-8.2878179550170898 -1.2432317733764648 +-8.2878179550170898 -1.4432315826416016 +-8.2878179550170898 -1.6432313919067383 +-8.2878179550170898 -1.843231201171875 +-8.2878179550170898 -2.0432310104370117 +-8.2878179550170898 -2.2432308197021484 +-8.2878179550170898 -2.4432306289672852 +-8.2878179550170898 -2.6432304382324219 +-8.2878179550170898 -2.8432302474975586 +-8.2878179550170898 -3.0432300567626953 +-8.2878179550170898 -3.243229866027832 +-8.2878179550170898 -3.4432296752929688 +-8.2878179550170898 -3.6432294845581055 +-8.2878179550170898 -3.8432292938232422 +-8.2878179550170898 -4.0432291030883789 +-8.2878179550170898 -4.2432289123535156 +-8.2878179550170898 -4.4432287216186523 +-8.2878179550170898 -4.6432285308837891 +-8.2878179550170898 -4.8432283401489258 +-8.2878179550170898 -5.0432281494140625 +-8.2878179550170898 -5.2432279586791992 +-8.2878179550170898 -5.4432277679443359 +-8.2878179550170898 -5.6432275772094727 +-8.2878179550170898 -5.8432273864746094 +-8.2878179550170898 -6.0432271957397461 +-8.2878179550170898 -6.2432270050048828 +-8.2878179550170898 -6.4432268142700195 +-8.2878179550170898 -6.6432266235351562 +-8.2878179550170898 -6.843226432800293 +-8.2878179550170898 -7.0432262420654297 +-8.2878179550170898 -7.1534209251403809 +-8.2725563049316406 -7.2539710998535156 +-8.2225713729858398 -7.3458738327026367 +-8.0987958908081055 -7.4347281455993652 +-8.0047931671142578 -7.4536409378051758 +-7.8051013946533203 -7.4647378921508789 +-7.6054096221923828 -7.4758353233337402 +-7.4057173728942871 -7.4869322776794434 +-7.2060256004333496 -7.4980297088623047 +-7.0063338279724121 -7.5091266632080078 +-6.8066415786743164 -7.5202240943908691 +-6.6069498062133789 -7.5313210487365723 +-6.4072580337524414 -7.5424180030822754 +-6.2075657844543457 -7.5535154342651367 +-6.0078740119934082 -7.5646123886108398 +-5.8081817626953125 -7.5757098197937012 +-5.608489990234375 -7.5868067741394043 +-5.4087982177734375 -7.5979042053222656 +-5.2091064453125 -7.6090011596679688 +-5.0094146728515625 -7.6200981140136719 +-4.8097224235534668 -7.6311955451965332 +-4.6100301742553711 -7.6422924995422363 +-4.4103384017944336 -7.6533899307250977 +-4.2106466293334961 -7.6644868850708008 +-4.0109548568725586 -7.6755843162536621 +-3.8112630844116211 -7.6866812705993652 +-3.6115713119506836 -7.6977782249450684 +-3.4118795394897461 -7.7088756561279297 +-3.2121882438659668 -7.7199726104736328 +-3.0124964714050293 -7.7310695648193359 +-2.8128046989440918 -7.7421669960021973 +-2.6131129264831543 -7.7532639503479004 +-2.4134211540222168 -7.7643613815307617 +-2.2137293815612793 -7.7754583358764648 +-2.0140376091003418 -7.7865557670593262 +-1.8143463134765625 -7.7976527214050293 +-1.614654541015625 -7.8087496757507324 +-1.4149627685546875 -7.8198471069335938 +-1.21527099609375 -7.8309440612792969 +-1.0155792236328125 -7.8420414924621582 +-0.815887451171875 -7.8531384468078613 +-0.6161961555480957 -7.8642354011535645 +-0.4165043830871582 -7.8753328323364258 +-0.2168126106262207 -7.8864297866821289 +-0.017120838165283203 -7.8975272178649902 +0.1825714111328125 -7.9086241722106934 +0.38226318359375 -7.9197211265563965 +0.5819549560546875 -7.9308185577392578 +0.781646728515625 -7.9419155120849609 +0.9813385009765625 -7.9530129432678223 +1.1810302734375 -7.9641098976135254 +1.3807210922241211 -7.9752068519592285 +1.5804128646850586 -7.9863042831420898 +1.7801046371459961 -7.997401237487793 +1.9797964096069336 -8.0084981918334961 +2.1794881820678711 -8.0195960998535156 +2.3791799545288086 -8.0306930541992188 +2.5788717269897461 -8.0417900085449219 +2.7785634994506836 -8.052886962890625 +2.9782552719116211 -8.0639839172363281 +3.1779470443725586 -8.0750808715820312 +3.3776388168334961 -8.0861787796020508 +3.5773305892944336 -8.0972757339477539 +3.7770223617553711 -8.108372688293457 +3.9767141342163086 -8.1194696426391602 +4.1764049530029297 -8.1305675506591797 +4.3760967254638672 -8.1416645050048828 +4.5757884979248047 -8.1527614593505859 +4.7754802703857422 -8.1638584136962891 +4.9751720428466797 -8.1749553680419922 +5.1748638153076172 -8.1860523223876953 +5.3745555877685547 -8.1971502304077148 +5.5742473602294922 -8.208247184753418 +5.7739391326904297 -8.2193441390991211 +5.9736309051513672 -8.2304410934448242 +6.1733226776123047 -8.2415390014648438 +6.3730144500732422 -8.2526359558105469 +6.5727062225341797 -8.26373291015625 +6.7723970413208008 -8.2748298645019531 +6.9720888137817383 -8.2859268188476562 +7.1717805862426758 -8.2970237731933594 +7.3714723587036133 -8.3081216812133789 +7.5711641311645508 -8.319218635559082 +7.7708559036254883 -8.3303155899047852 +7.9705476760864258 -8.3414125442504883 +8.1702384948730469 -8.3525104522705078 +8.3699321746826172 -8.3636074066162109 +8.5696239471435547 -8.3747043609619141 +8.769317626953125 -8.3858013153076172 +8.9690093994140625 -8.3968992233276367 +9.1687030792236328 -8.4079961776733398 +9.3683948516845703 -8.419093132019043 +9.5680885314941406 -8.4301900863647461 +9.7677803039550781 -8.4412879943847656 +9.9674739837646484 -8.4523849487304688 +10.167165756225586 -8.4634819030761719 +10.366859436035156 -8.474578857421875 +10.566551208496094 -8.4856767654418945 +10.766242980957031 -8.4967737197875977 +10.965936660766602 -8.5078706741333008 +11.165628433227539 -8.5189676284790039 +11.365322113037109 -8.5300655364990234 +11.565013885498047 -8.5411624908447266 +11.610186576843262 -8.5436725616455078 +11.75560188293457 -8.541447639465332 +11.872749328613281 -8.4889593124389648 +11.953274726867676 -8.3947839736938477 +11.988609313964844 -8.2494831085205078 +11.98805046081543 -6.5400009155273438 +12.289004325866699 -6.5400009155273438 +12.289004325866699 -4.8054819107055664 +12.289004325866699 -4.8054819107055664 +12.289004325866699 4.8054780960083008 diff --git a/tests/data/texture_import/README.md b/tests/data/texture_import/README.md new file mode 100644 index 0000000000..c398b0ac28 --- /dev/null +++ b/tests/data/texture_import/README.md @@ -0,0 +1,20 @@ +`two_color_jpeg.glb` is a generated, closed tetrahedron with four faces, UVs, and +an embedded 8×8 red/blue JPEG base-color texture. Its coordinates span 20 mm. + +The core tests load all three fixtures through `Model::read_from_file`, convert +textures or MTL colors to painting with boundary smoothing, and match red and blue +to filaments. They run in CI without a display. A separate layout check compares +the smoothing search-tree type seen by a core consumer with the same type compiled +inside `libslic3r_cgal`. The mismatch is checked directly because undefined behavior +can be masked by which inline template implementations the linker selects. + +`two_color_sphere/test_two_color_sphere.obj` and its matching MTL are the original +red/blue material-color sphere supplied by RF47 in +[the PR discussion](https://github.com/OrcaSlicer/OrcaSlicer/pull/16607#issuecomment-6244475095). +They contain solid `Kd` colors and no texture images. + +`test_two_color_sphere_textured.obj` is a derived version of that sphere. Its MTL +uses white `Kd` values and references `textures/two_color.jpg` by a relative path; +the two face groups sample different halves of that image through their UVs. +The JPEG is extracted unchanged from `two_color_jpeg.glb`. This case must retain +both colors from the external texture, rather than fall back to MTL colors. diff --git a/tests/data/texture_import/two_color_jpeg.glb b/tests/data/texture_import/two_color_jpeg.glb new file mode 100644 index 0000000000..35ca7f9069 Binary files /dev/null and b/tests/data/texture_import/two_color_jpeg.glb differ diff --git a/tests/data/texture_import/two_color_sphere/test_two_color_sphere.mtl b/tests/data/texture_import/two_color_sphere/test_two_color_sphere.mtl new file mode 100644 index 0000000000..2c5433836b --- /dev/null +++ b/tests/data/texture_import/two_color_sphere/test_two_color_sphere.mtl @@ -0,0 +1,11 @@ +# test model for OrcaSlicer tex2color +newmtl Red +Ka 0.0000 0.0000 0.0000 +Kd 0.7500 0.2500 0.2500 +Ks 0.0000 0.0000 0.0000 +d 1.0000 +newmtl Blue +Ka 0.0000 0.0000 0.0000 +Kd 0.0700 0.2100 0.7000 +Ks 0.0000 0.0000 0.0000 +d 1.0000 diff --git a/tests/data/texture_import/two_color_sphere/test_two_color_sphere.obj b/tests/data/texture_import/two_color_sphere/test_two_color_sphere.obj new file mode 100644 index 0000000000..eb22031864 --- /dev/null +++ b/tests/data/texture_import/two_color_sphere/test_two_color_sphere.obj @@ -0,0 +1,457 @@ +# test model for OrcaSlicer tex2color +mtllib test_two_color_sphere.mtl +v 0.000000 0.000000 20.000000 +v 7.653669 0.000000 18.477591 +v 7.071068 2.928932 18.477591 +v 5.411961 5.411961 18.477591 +v 2.928932 7.071068 18.477591 +v 0.000000 7.653669 18.477591 +v -2.928932 7.071068 18.477591 +v -5.411961 5.411961 18.477591 +v -7.071068 2.928932 18.477591 +v -7.653669 0.000000 18.477591 +v -7.071068 -2.928932 18.477591 +v -5.411961 -5.411961 18.477591 +v -2.928932 -7.071068 18.477591 +v -0.000000 -7.653669 18.477591 +v 2.928932 -7.071068 18.477591 +v 5.411961 -5.411961 18.477591 +v 7.071068 -2.928932 18.477591 +v 14.142136 0.000000 14.142136 +v 13.065630 5.411961 14.142136 +v 10.000000 10.000000 14.142136 +v 5.411961 13.065630 14.142136 +v 0.000000 14.142136 14.142136 +v -5.411961 13.065630 14.142136 +v -10.000000 10.000000 14.142136 +v -13.065630 5.411961 14.142136 +v -14.142136 0.000000 14.142136 +v -13.065630 -5.411961 14.142136 +v -10.000000 -10.000000 14.142136 +v -5.411961 -13.065630 14.142136 +v -0.000000 -14.142136 14.142136 +v 5.411961 -13.065630 14.142136 +v 10.000000 -10.000000 14.142136 +v 13.065630 -5.411961 14.142136 +v 18.477591 0.000000 7.653669 +v 17.071068 7.071068 7.653669 +v 13.065630 13.065630 7.653669 +v 7.071068 17.071068 7.653669 +v 0.000000 18.477591 7.653669 +v -7.071068 17.071068 7.653669 +v -13.065630 13.065630 7.653669 +v -17.071068 7.071068 7.653669 +v -18.477591 0.000000 7.653669 +v -17.071068 -7.071068 7.653669 +v -13.065630 -13.065630 7.653669 +v -7.071068 -17.071068 7.653669 +v -0.000000 -18.477591 7.653669 +v 7.071068 -17.071068 7.653669 +v 13.065630 -13.065630 7.653669 +v 17.071068 -7.071068 7.653669 +v 20.000000 0.000000 0.000000 +v 18.477591 7.653669 0.000000 +v 14.142136 14.142136 0.000000 +v 7.653669 18.477591 0.000000 +v 0.000000 20.000000 0.000000 +v -7.653669 18.477591 0.000000 +v -14.142136 14.142136 0.000000 +v -18.477591 7.653669 0.000000 +v -20.000000 0.000000 0.000000 +v -18.477591 -7.653669 0.000000 +v -14.142136 -14.142136 0.000000 +v -7.653669 -18.477591 0.000000 +v -0.000000 -20.000000 0.000000 +v 7.653669 -18.477591 0.000000 +v 14.142136 -14.142136 0.000000 +v 18.477591 -7.653669 0.000000 +v 18.477591 0.000000 -7.653669 +v 17.071068 7.071068 -7.653669 +v 13.065630 13.065630 -7.653669 +v 7.071068 17.071068 -7.653669 +v 0.000000 18.477591 -7.653669 +v -7.071068 17.071068 -7.653669 +v -13.065630 13.065630 -7.653669 +v -17.071068 7.071068 -7.653669 +v -18.477591 0.000000 -7.653669 +v -17.071068 -7.071068 -7.653669 +v -13.065630 -13.065630 -7.653669 +v -7.071068 -17.071068 -7.653669 +v -0.000000 -18.477591 -7.653669 +v 7.071068 -17.071068 -7.653669 +v 13.065630 -13.065630 -7.653669 +v 17.071068 -7.071068 -7.653669 +v 14.142136 0.000000 -14.142136 +v 13.065630 5.411961 -14.142136 +v 10.000000 10.000000 -14.142136 +v 5.411961 13.065630 -14.142136 +v 0.000000 14.142136 -14.142136 +v -5.411961 13.065630 -14.142136 +v -10.000000 10.000000 -14.142136 +v -13.065630 5.411961 -14.142136 +v -14.142136 0.000000 -14.142136 +v -13.065630 -5.411961 -14.142136 +v -10.000000 -10.000000 -14.142136 +v -5.411961 -13.065630 -14.142136 +v -0.000000 -14.142136 -14.142136 +v 5.411961 -13.065630 -14.142136 +v 10.000000 -10.000000 -14.142136 +v 13.065630 -5.411961 -14.142136 +v 7.653669 0.000000 -18.477591 +v 7.071068 2.928932 -18.477591 +v 5.411961 5.411961 -18.477591 +v 2.928932 7.071068 -18.477591 +v 0.000000 7.653669 -18.477591 +v -2.928932 7.071068 -18.477591 +v -5.411961 5.411961 -18.477591 +v -7.071068 2.928932 -18.477591 +v -7.653669 0.000000 -18.477591 +v -7.071068 -2.928932 -18.477591 +v -5.411961 -5.411961 -18.477591 +v -2.928932 -7.071068 -18.477591 +v -0.000000 -7.653669 -18.477591 +v 2.928932 -7.071068 -18.477591 +v 5.411961 -5.411961 -18.477591 +v 7.071068 -2.928932 -18.477591 +v 0.000000 0.000000 -20.000000 +vt 0 0 +vn 0.000000 -0.000000 1.000000 +vn 0.439605 0.035510 0.897489 +vn 0.392553 0.201037 0.897489 +vn 0.285739 0.335958 0.897489 +vn 0.135423 0.419732 0.897489 +vn -0.035510 0.439605 0.897489 +vn -0.201037 0.392553 0.897489 +vn -0.335958 0.285739 0.897489 +vn -0.419732 0.135423 0.897489 +vn -0.439605 -0.035510 0.897489 +vn -0.392553 -0.201037 0.897489 +vn -0.285739 -0.335958 0.897489 +vn -0.135423 -0.419732 0.897489 +vn 0.035510 -0.439605 0.897489 +vn 0.201037 -0.392553 0.897489 +vn 0.335958 -0.285739 0.897489 +vn 0.419732 -0.135423 0.897489 +vn 0.725001 0.027230 0.688209 +vn 0.659393 0.302603 0.688209 +vn 0.493399 0.531907 0.688209 +vn 0.252289 0.680234 0.688209 +vn -0.027230 0.725001 0.688209 +vn -0.302603 0.659393 0.688209 +vn -0.531907 0.493399 0.688209 +vn -0.680234 0.252289 0.688209 +vn -0.725001 -0.027230 0.688209 +vn -0.659393 -0.302603 0.688209 +vn -0.493399 -0.531907 0.688209 +vn -0.252289 -0.680234 0.688209 +vn 0.027230 -0.725001 0.688209 +vn 0.302603 -0.659393 0.688209 +vn 0.531907 -0.493399 0.688209 +vn 0.680234 -0.252289 0.688209 +vn 0.927851 0.014745 0.372658 +vn 0.851580 0.368696 0.372658 +vn 0.645664 0.666516 0.372658 +vn 0.341451 0.862865 0.372658 +vn -0.014745 0.927851 0.372658 +vn -0.368696 0.851580 0.372658 +vn -0.666516 0.645664 0.372658 +vn -0.862865 0.341451 0.372658 +vn -0.927851 -0.014745 0.372658 +vn -0.851580 -0.368696 0.372658 +vn -0.645664 -0.666516 0.372658 +vn -0.341451 -0.862865 0.372658 +vn 0.014745 -0.927851 0.372658 +vn 0.368696 -0.851580 0.372658 +vn 0.666516 -0.645664 0.372658 +vn 0.862865 -0.341451 0.372658 +vn 1.000000 -0.000000 -0.000000 +vn 0.923880 0.382683 0.000000 +vn 0.707107 0.707107 0.000000 +vn 0.382683 0.923880 0.000000 +vn 0.000000 1.000000 0.000000 +vn -0.382683 0.923880 0.000000 +vn -0.707107 0.707107 0.000000 +vn -0.923880 0.382683 0.000000 +vn -1.000000 0.000000 0.000000 +vn -0.923880 -0.382683 -0.000000 +vn -0.707107 -0.707107 0.000000 +vn -0.382683 -0.923880 -0.000000 +vn -0.000000 -1.000000 -0.000000 +vn 0.382683 -0.923880 0.000000 +vn 0.707107 -0.707107 0.000000 +vn 0.923880 -0.382683 -0.000000 +vn 0.927851 -0.014745 -0.372658 +vn 0.862865 0.341451 -0.372658 +vn 0.666516 0.645664 -0.372658 +vn 0.368696 0.851580 -0.372658 +vn 0.014745 0.927851 -0.372658 +vn -0.341451 0.862865 -0.372658 +vn -0.645664 0.666516 -0.372658 +vn -0.851580 0.368696 -0.372658 +vn -0.927851 0.014745 -0.372658 +vn -0.862865 -0.341451 -0.372658 +vn -0.666516 -0.645664 -0.372658 +vn -0.368696 -0.851580 -0.372658 +vn -0.014745 -0.927851 -0.372658 +vn 0.341451 -0.862865 -0.372658 +vn 0.645664 -0.666516 -0.372658 +vn 0.851580 -0.368696 -0.372658 +vn 0.725001 -0.027230 -0.688209 +vn 0.680234 0.252289 -0.688209 +vn 0.531907 0.493399 -0.688209 +vn 0.302603 0.659393 -0.688209 +vn 0.027230 0.725001 -0.688209 +vn -0.252289 0.680234 -0.688209 +vn -0.493399 0.531907 -0.688209 +vn -0.659393 0.302603 -0.688209 +vn -0.725001 0.027230 -0.688209 +vn -0.680234 -0.252289 -0.688209 +vn -0.531907 -0.493399 -0.688209 +vn -0.302603 -0.659393 -0.688209 +vn -0.027230 -0.725001 -0.688209 +vn 0.252289 -0.680234 -0.688209 +vn 0.493399 -0.531907 -0.688209 +vn 0.659393 -0.302603 -0.688209 +vn 0.439605 -0.035510 -0.897489 +vn 0.419732 0.135423 -0.897489 +vn 0.335958 0.285739 -0.897489 +vn 0.201037 0.392553 -0.897489 +vn 0.035510 0.439605 -0.897489 +vn -0.135423 0.419732 -0.897489 +vn -0.285739 0.335958 -0.897489 +vn -0.392553 0.201037 -0.897489 +vn -0.439605 0.035510 -0.897489 +vn -0.419732 -0.135423 -0.897489 +vn -0.335958 -0.285739 -0.897489 +vn -0.201037 -0.392553 -0.897489 +vn -0.035510 -0.439605 -0.897489 +vn 0.135423 -0.419732 -0.897489 +vn 0.285739 -0.335958 -0.897489 +vn 0.392553 -0.201037 -0.897489 +vn 0.000000 -0.000000 -1.000000 +usemtl Red +f 1/1/1 2/1/2 3/1/3 +f 1/1/1 3/1/3 4/1/4 +f 1/1/1 4/1/4 5/1/5 +f 1/1/1 5/1/5 6/1/6 +f 1/1/1 6/1/6 7/1/7 +f 1/1/1 7/1/7 8/1/8 +f 1/1/1 8/1/8 9/1/9 +f 1/1/1 9/1/9 10/1/10 +f 1/1/1 10/1/10 11/1/11 +f 1/1/1 11/1/11 12/1/12 +f 1/1/1 12/1/12 13/1/13 +f 1/1/1 13/1/13 14/1/14 +f 1/1/1 14/1/14 15/1/15 +f 1/1/1 15/1/15 16/1/16 +f 1/1/1 16/1/16 17/1/17 +f 1/1/1 17/1/17 2/1/2 +f 2/1/2 18/1/18 19/1/19 +f 2/1/2 19/1/19 3/1/3 +f 3/1/3 19/1/19 20/1/20 +f 3/1/3 20/1/20 4/1/4 +f 4/1/4 20/1/20 21/1/21 +f 4/1/4 21/1/21 5/1/5 +f 5/1/5 21/1/21 22/1/22 +f 5/1/5 22/1/22 6/1/6 +f 6/1/6 22/1/22 23/1/23 +f 6/1/6 23/1/23 7/1/7 +f 7/1/7 23/1/23 24/1/24 +f 7/1/7 24/1/24 8/1/8 +f 8/1/8 24/1/24 25/1/25 +f 8/1/8 25/1/25 9/1/9 +f 9/1/9 25/1/25 26/1/26 +f 9/1/9 26/1/26 10/1/10 +f 10/1/10 26/1/26 27/1/27 +f 10/1/10 27/1/27 11/1/11 +f 11/1/11 27/1/27 28/1/28 +f 11/1/11 28/1/28 12/1/12 +f 12/1/12 28/1/28 29/1/29 +f 12/1/12 29/1/29 13/1/13 +f 13/1/13 29/1/29 30/1/30 +f 13/1/13 30/1/30 14/1/14 +f 14/1/14 30/1/30 31/1/31 +f 14/1/14 31/1/31 15/1/15 +f 15/1/15 31/1/31 32/1/32 +f 15/1/15 32/1/32 16/1/16 +f 16/1/16 32/1/32 33/1/33 +f 16/1/16 33/1/33 17/1/17 +f 17/1/17 33/1/33 18/1/18 +f 17/1/17 18/1/18 2/1/2 +f 18/1/18 34/1/34 35/1/35 +f 18/1/18 35/1/35 19/1/19 +f 19/1/19 35/1/35 36/1/36 +f 19/1/19 36/1/36 20/1/20 +f 20/1/20 36/1/36 37/1/37 +f 20/1/20 37/1/37 21/1/21 +f 21/1/21 37/1/37 38/1/38 +f 21/1/21 38/1/38 22/1/22 +f 22/1/22 38/1/38 39/1/39 +f 22/1/22 39/1/39 23/1/23 +f 23/1/23 39/1/39 40/1/40 +f 23/1/23 40/1/40 24/1/24 +f 24/1/24 40/1/40 41/1/41 +f 24/1/24 41/1/41 25/1/25 +f 25/1/25 41/1/41 42/1/42 +f 25/1/25 42/1/42 26/1/26 +f 26/1/26 42/1/42 43/1/43 +f 26/1/26 43/1/43 27/1/27 +f 27/1/27 43/1/43 44/1/44 +f 27/1/27 44/1/44 28/1/28 +f 28/1/28 44/1/44 45/1/45 +f 28/1/28 45/1/45 29/1/29 +f 29/1/29 45/1/45 46/1/46 +f 29/1/29 46/1/46 30/1/30 +f 30/1/30 46/1/46 47/1/47 +f 30/1/30 47/1/47 31/1/31 +f 31/1/31 47/1/47 48/1/48 +f 31/1/31 48/1/48 32/1/32 +f 32/1/32 48/1/48 49/1/49 +f 32/1/32 49/1/49 33/1/33 +f 33/1/33 49/1/49 34/1/34 +f 33/1/33 34/1/34 18/1/18 +f 34/1/34 50/1/50 51/1/51 +f 34/1/34 51/1/51 35/1/35 +f 35/1/35 51/1/51 52/1/52 +f 35/1/35 52/1/52 36/1/36 +f 36/1/36 52/1/52 53/1/53 +f 36/1/36 53/1/53 37/1/37 +f 37/1/37 53/1/53 54/1/54 +f 37/1/37 54/1/54 38/1/38 +f 38/1/38 54/1/54 55/1/55 +f 38/1/38 55/1/55 39/1/39 +f 39/1/39 55/1/55 56/1/56 +f 39/1/39 56/1/56 40/1/40 +f 40/1/40 56/1/56 57/1/57 +f 40/1/40 57/1/57 41/1/41 +f 41/1/41 57/1/57 58/1/58 +f 41/1/41 58/1/58 42/1/42 +f 42/1/42 58/1/58 59/1/59 +f 42/1/42 59/1/59 43/1/43 +f 43/1/43 59/1/59 60/1/60 +f 43/1/43 60/1/60 44/1/44 +f 44/1/44 60/1/60 61/1/61 +f 44/1/44 61/1/61 45/1/45 +f 45/1/45 61/1/61 62/1/62 +f 45/1/45 62/1/62 46/1/46 +f 46/1/46 62/1/62 63/1/63 +f 46/1/46 63/1/63 47/1/47 +f 47/1/47 63/1/63 64/1/64 +f 47/1/47 64/1/64 48/1/48 +f 48/1/48 64/1/64 65/1/65 +f 48/1/48 65/1/65 49/1/49 +f 49/1/49 65/1/65 50/1/50 +f 49/1/49 50/1/50 34/1/34 +usemtl Blue +f 50/1/50 66/1/66 67/1/67 +f 50/1/50 67/1/67 51/1/51 +f 51/1/51 67/1/67 68/1/68 +f 51/1/51 68/1/68 52/1/52 +f 52/1/52 68/1/68 69/1/69 +f 52/1/52 69/1/69 53/1/53 +f 53/1/53 69/1/69 70/1/70 +f 53/1/53 70/1/70 54/1/54 +f 54/1/54 70/1/70 71/1/71 +f 54/1/54 71/1/71 55/1/55 +f 55/1/55 71/1/71 72/1/72 +f 55/1/55 72/1/72 56/1/56 +f 56/1/56 72/1/72 73/1/73 +f 56/1/56 73/1/73 57/1/57 +f 57/1/57 73/1/73 74/1/74 +f 57/1/57 74/1/74 58/1/58 +f 58/1/58 74/1/74 75/1/75 +f 58/1/58 75/1/75 59/1/59 +f 59/1/59 75/1/75 76/1/76 +f 59/1/59 76/1/76 60/1/60 +f 60/1/60 76/1/76 77/1/77 +f 60/1/60 77/1/77 61/1/61 +f 61/1/61 77/1/77 78/1/78 +f 61/1/61 78/1/78 62/1/62 +f 62/1/62 78/1/78 79/1/79 +f 62/1/62 79/1/79 63/1/63 +f 63/1/63 79/1/79 80/1/80 +f 63/1/63 80/1/80 64/1/64 +f 64/1/64 80/1/80 81/1/81 +f 64/1/64 81/1/81 65/1/65 +f 65/1/65 81/1/81 66/1/66 +f 65/1/65 66/1/66 50/1/50 +f 66/1/66 82/1/82 83/1/83 +f 66/1/66 83/1/83 67/1/67 +f 67/1/67 83/1/83 84/1/84 +f 67/1/67 84/1/84 68/1/68 +f 68/1/68 84/1/84 85/1/85 +f 68/1/68 85/1/85 69/1/69 +f 69/1/69 85/1/85 86/1/86 +f 69/1/69 86/1/86 70/1/70 +f 70/1/70 86/1/86 87/1/87 +f 70/1/70 87/1/87 71/1/71 +f 71/1/71 87/1/87 88/1/88 +f 71/1/71 88/1/88 72/1/72 +f 72/1/72 88/1/88 89/1/89 +f 72/1/72 89/1/89 73/1/73 +f 73/1/73 89/1/89 90/1/90 +f 73/1/73 90/1/90 74/1/74 +f 74/1/74 90/1/90 91/1/91 +f 74/1/74 91/1/91 75/1/75 +f 75/1/75 91/1/91 92/1/92 +f 75/1/75 92/1/92 76/1/76 +f 76/1/76 92/1/92 93/1/93 +f 76/1/76 93/1/93 77/1/77 +f 77/1/77 93/1/93 94/1/94 +f 77/1/77 94/1/94 78/1/78 +f 78/1/78 94/1/94 95/1/95 +f 78/1/78 95/1/95 79/1/79 +f 79/1/79 95/1/95 96/1/96 +f 79/1/79 96/1/96 80/1/80 +f 80/1/80 96/1/96 97/1/97 +f 80/1/80 97/1/97 81/1/81 +f 81/1/81 97/1/97 82/1/82 +f 81/1/81 82/1/82 66/1/66 +f 82/1/82 98/1/98 99/1/99 +f 82/1/82 99/1/99 83/1/83 +f 83/1/83 99/1/99 100/1/100 +f 83/1/83 100/1/100 84/1/84 +f 84/1/84 100/1/100 101/1/101 +f 84/1/84 101/1/101 85/1/85 +f 85/1/85 101/1/101 102/1/102 +f 85/1/85 102/1/102 86/1/86 +f 86/1/86 102/1/102 103/1/103 +f 86/1/86 103/1/103 87/1/87 +f 87/1/87 103/1/103 104/1/104 +f 87/1/87 104/1/104 88/1/88 +f 88/1/88 104/1/104 105/1/105 +f 88/1/88 105/1/105 89/1/89 +f 89/1/89 105/1/105 106/1/106 +f 89/1/89 106/1/106 90/1/90 +f 90/1/90 106/1/106 107/1/107 +f 90/1/90 107/1/107 91/1/91 +f 91/1/91 107/1/107 108/1/108 +f 91/1/91 108/1/108 92/1/92 +f 92/1/92 108/1/108 109/1/109 +f 92/1/92 109/1/109 93/1/93 +f 93/1/93 109/1/109 110/1/110 +f 93/1/93 110/1/110 94/1/94 +f 94/1/94 110/1/110 111/1/111 +f 94/1/94 111/1/111 95/1/95 +f 95/1/95 111/1/111 112/1/112 +f 95/1/95 112/1/112 96/1/96 +f 96/1/96 112/1/112 113/1/113 +f 96/1/96 113/1/113 97/1/97 +f 97/1/97 113/1/113 98/1/98 +f 97/1/97 98/1/98 82/1/82 +f 114/1/114 99/1/99 98/1/98 +f 114/1/114 100/1/100 99/1/99 +f 114/1/114 101/1/101 100/1/100 +f 114/1/114 102/1/102 101/1/101 +f 114/1/114 103/1/103 102/1/102 +f 114/1/114 104/1/104 103/1/103 +f 114/1/114 105/1/105 104/1/104 +f 114/1/114 106/1/106 105/1/105 +f 114/1/114 107/1/107 106/1/106 +f 114/1/114 108/1/108 107/1/107 +f 114/1/114 109/1/109 108/1/108 +f 114/1/114 110/1/110 109/1/109 +f 114/1/114 111/1/111 110/1/110 +f 114/1/114 112/1/112 111/1/111 +f 114/1/114 113/1/113 112/1/112 +f 114/1/114 98/1/98 113/1/113 diff --git a/tests/data/texture_import/two_color_sphere/test_two_color_sphere_textured.mtl b/tests/data/texture_import/two_color_sphere/test_two_color_sphere_textured.mtl new file mode 100644 index 0000000000..a4fb020656 --- /dev/null +++ b/tests/data/texture_import/two_color_sphere/test_two_color_sphere_textured.mtl @@ -0,0 +1,8 @@ +# Derived texture-file regression: color comes from map_Kd, not Kd. +newmtl Red +Kd 1 1 1 +map_Kd textures/two_color.jpg + +newmtl Blue +Kd 1 1 1 +map_Kd textures/two_color.jpg diff --git a/tests/data/texture_import/two_color_sphere/test_two_color_sphere_textured.obj b/tests/data/texture_import/two_color_sphere/test_two_color_sphere_textured.obj new file mode 100644 index 0000000000..a62f0fefb6 --- /dev/null +++ b/tests/data/texture_import/two_color_sphere/test_two_color_sphere_textured.obj @@ -0,0 +1,458 @@ +# test model for OrcaSlicer tex2color +mtllib test_two_color_sphere_textured.mtl +v 0.000000 0.000000 20.000000 +v 7.653669 0.000000 18.477591 +v 7.071068 2.928932 18.477591 +v 5.411961 5.411961 18.477591 +v 2.928932 7.071068 18.477591 +v 0.000000 7.653669 18.477591 +v -2.928932 7.071068 18.477591 +v -5.411961 5.411961 18.477591 +v -7.071068 2.928932 18.477591 +v -7.653669 0.000000 18.477591 +v -7.071068 -2.928932 18.477591 +v -5.411961 -5.411961 18.477591 +v -2.928932 -7.071068 18.477591 +v -0.000000 -7.653669 18.477591 +v 2.928932 -7.071068 18.477591 +v 5.411961 -5.411961 18.477591 +v 7.071068 -2.928932 18.477591 +v 14.142136 0.000000 14.142136 +v 13.065630 5.411961 14.142136 +v 10.000000 10.000000 14.142136 +v 5.411961 13.065630 14.142136 +v 0.000000 14.142136 14.142136 +v -5.411961 13.065630 14.142136 +v -10.000000 10.000000 14.142136 +v -13.065630 5.411961 14.142136 +v -14.142136 0.000000 14.142136 +v -13.065630 -5.411961 14.142136 +v -10.000000 -10.000000 14.142136 +v -5.411961 -13.065630 14.142136 +v -0.000000 -14.142136 14.142136 +v 5.411961 -13.065630 14.142136 +v 10.000000 -10.000000 14.142136 +v 13.065630 -5.411961 14.142136 +v 18.477591 0.000000 7.653669 +v 17.071068 7.071068 7.653669 +v 13.065630 13.065630 7.653669 +v 7.071068 17.071068 7.653669 +v 0.000000 18.477591 7.653669 +v -7.071068 17.071068 7.653669 +v -13.065630 13.065630 7.653669 +v -17.071068 7.071068 7.653669 +v -18.477591 0.000000 7.653669 +v -17.071068 -7.071068 7.653669 +v -13.065630 -13.065630 7.653669 +v -7.071068 -17.071068 7.653669 +v -0.000000 -18.477591 7.653669 +v 7.071068 -17.071068 7.653669 +v 13.065630 -13.065630 7.653669 +v 17.071068 -7.071068 7.653669 +v 20.000000 0.000000 0.000000 +v 18.477591 7.653669 0.000000 +v 14.142136 14.142136 0.000000 +v 7.653669 18.477591 0.000000 +v 0.000000 20.000000 0.000000 +v -7.653669 18.477591 0.000000 +v -14.142136 14.142136 0.000000 +v -18.477591 7.653669 0.000000 +v -20.000000 0.000000 0.000000 +v -18.477591 -7.653669 0.000000 +v -14.142136 -14.142136 0.000000 +v -7.653669 -18.477591 0.000000 +v -0.000000 -20.000000 0.000000 +v 7.653669 -18.477591 0.000000 +v 14.142136 -14.142136 0.000000 +v 18.477591 -7.653669 0.000000 +v 18.477591 0.000000 -7.653669 +v 17.071068 7.071068 -7.653669 +v 13.065630 13.065630 -7.653669 +v 7.071068 17.071068 -7.653669 +v 0.000000 18.477591 -7.653669 +v -7.071068 17.071068 -7.653669 +v -13.065630 13.065630 -7.653669 +v -17.071068 7.071068 -7.653669 +v -18.477591 0.000000 -7.653669 +v -17.071068 -7.071068 -7.653669 +v -13.065630 -13.065630 -7.653669 +v -7.071068 -17.071068 -7.653669 +v -0.000000 -18.477591 -7.653669 +v 7.071068 -17.071068 -7.653669 +v 13.065630 -13.065630 -7.653669 +v 17.071068 -7.071068 -7.653669 +v 14.142136 0.000000 -14.142136 +v 13.065630 5.411961 -14.142136 +v 10.000000 10.000000 -14.142136 +v 5.411961 13.065630 -14.142136 +v 0.000000 14.142136 -14.142136 +v -5.411961 13.065630 -14.142136 +v -10.000000 10.000000 -14.142136 +v -13.065630 5.411961 -14.142136 +v -14.142136 0.000000 -14.142136 +v -13.065630 -5.411961 -14.142136 +v -10.000000 -10.000000 -14.142136 +v -5.411961 -13.065630 -14.142136 +v -0.000000 -14.142136 -14.142136 +v 5.411961 -13.065630 -14.142136 +v 10.000000 -10.000000 -14.142136 +v 13.065630 -5.411961 -14.142136 +v 7.653669 0.000000 -18.477591 +v 7.071068 2.928932 -18.477591 +v 5.411961 5.411961 -18.477591 +v 2.928932 7.071068 -18.477591 +v 0.000000 7.653669 -18.477591 +v -2.928932 7.071068 -18.477591 +v -5.411961 5.411961 -18.477591 +v -7.071068 2.928932 -18.477591 +v -7.653669 0.000000 -18.477591 +v -7.071068 -2.928932 -18.477591 +v -5.411961 -5.411961 -18.477591 +v -2.928932 -7.071068 -18.477591 +v -0.000000 -7.653669 -18.477591 +v 2.928932 -7.071068 -18.477591 +v 5.411961 -5.411961 -18.477591 +v 7.071068 -2.928932 -18.477591 +v 0.000000 0.000000 -20.000000 +vt 0.25 0.5 +vt 0.75 0.5 +vn 0.000000 -0.000000 1.000000 +vn 0.439605 0.035510 0.897489 +vn 0.392553 0.201037 0.897489 +vn 0.285739 0.335958 0.897489 +vn 0.135423 0.419732 0.897489 +vn -0.035510 0.439605 0.897489 +vn -0.201037 0.392553 0.897489 +vn -0.335958 0.285739 0.897489 +vn -0.419732 0.135423 0.897489 +vn -0.439605 -0.035510 0.897489 +vn -0.392553 -0.201037 0.897489 +vn -0.285739 -0.335958 0.897489 +vn -0.135423 -0.419732 0.897489 +vn 0.035510 -0.439605 0.897489 +vn 0.201037 -0.392553 0.897489 +vn 0.335958 -0.285739 0.897489 +vn 0.419732 -0.135423 0.897489 +vn 0.725001 0.027230 0.688209 +vn 0.659393 0.302603 0.688209 +vn 0.493399 0.531907 0.688209 +vn 0.252289 0.680234 0.688209 +vn -0.027230 0.725001 0.688209 +vn -0.302603 0.659393 0.688209 +vn -0.531907 0.493399 0.688209 +vn -0.680234 0.252289 0.688209 +vn -0.725001 -0.027230 0.688209 +vn -0.659393 -0.302603 0.688209 +vn -0.493399 -0.531907 0.688209 +vn -0.252289 -0.680234 0.688209 +vn 0.027230 -0.725001 0.688209 +vn 0.302603 -0.659393 0.688209 +vn 0.531907 -0.493399 0.688209 +vn 0.680234 -0.252289 0.688209 +vn 0.927851 0.014745 0.372658 +vn 0.851580 0.368696 0.372658 +vn 0.645664 0.666516 0.372658 +vn 0.341451 0.862865 0.372658 +vn -0.014745 0.927851 0.372658 +vn -0.368696 0.851580 0.372658 +vn -0.666516 0.645664 0.372658 +vn -0.862865 0.341451 0.372658 +vn -0.927851 -0.014745 0.372658 +vn -0.851580 -0.368696 0.372658 +vn -0.645664 -0.666516 0.372658 +vn -0.341451 -0.862865 0.372658 +vn 0.014745 -0.927851 0.372658 +vn 0.368696 -0.851580 0.372658 +vn 0.666516 -0.645664 0.372658 +vn 0.862865 -0.341451 0.372658 +vn 1.000000 -0.000000 -0.000000 +vn 0.923880 0.382683 0.000000 +vn 0.707107 0.707107 0.000000 +vn 0.382683 0.923880 0.000000 +vn 0.000000 1.000000 0.000000 +vn -0.382683 0.923880 0.000000 +vn -0.707107 0.707107 0.000000 +vn -0.923880 0.382683 0.000000 +vn -1.000000 0.000000 0.000000 +vn -0.923880 -0.382683 -0.000000 +vn -0.707107 -0.707107 0.000000 +vn -0.382683 -0.923880 -0.000000 +vn -0.000000 -1.000000 -0.000000 +vn 0.382683 -0.923880 0.000000 +vn 0.707107 -0.707107 0.000000 +vn 0.923880 -0.382683 -0.000000 +vn 0.927851 -0.014745 -0.372658 +vn 0.862865 0.341451 -0.372658 +vn 0.666516 0.645664 -0.372658 +vn 0.368696 0.851580 -0.372658 +vn 0.014745 0.927851 -0.372658 +vn -0.341451 0.862865 -0.372658 +vn -0.645664 0.666516 -0.372658 +vn -0.851580 0.368696 -0.372658 +vn -0.927851 0.014745 -0.372658 +vn -0.862865 -0.341451 -0.372658 +vn -0.666516 -0.645664 -0.372658 +vn -0.368696 -0.851580 -0.372658 +vn -0.014745 -0.927851 -0.372658 +vn 0.341451 -0.862865 -0.372658 +vn 0.645664 -0.666516 -0.372658 +vn 0.851580 -0.368696 -0.372658 +vn 0.725001 -0.027230 -0.688209 +vn 0.680234 0.252289 -0.688209 +vn 0.531907 0.493399 -0.688209 +vn 0.302603 0.659393 -0.688209 +vn 0.027230 0.725001 -0.688209 +vn -0.252289 0.680234 -0.688209 +vn -0.493399 0.531907 -0.688209 +vn -0.659393 0.302603 -0.688209 +vn -0.725001 0.027230 -0.688209 +vn -0.680234 -0.252289 -0.688209 +vn -0.531907 -0.493399 -0.688209 +vn -0.302603 -0.659393 -0.688209 +vn -0.027230 -0.725001 -0.688209 +vn 0.252289 -0.680234 -0.688209 +vn 0.493399 -0.531907 -0.688209 +vn 0.659393 -0.302603 -0.688209 +vn 0.439605 -0.035510 -0.897489 +vn 0.419732 0.135423 -0.897489 +vn 0.335958 0.285739 -0.897489 +vn 0.201037 0.392553 -0.897489 +vn 0.035510 0.439605 -0.897489 +vn -0.135423 0.419732 -0.897489 +vn -0.285739 0.335958 -0.897489 +vn -0.392553 0.201037 -0.897489 +vn -0.439605 0.035510 -0.897489 +vn -0.419732 -0.135423 -0.897489 +vn -0.335958 -0.285739 -0.897489 +vn -0.201037 -0.392553 -0.897489 +vn -0.035510 -0.439605 -0.897489 +vn 0.135423 -0.419732 -0.897489 +vn 0.285739 -0.335958 -0.897489 +vn 0.392553 -0.201037 -0.897489 +vn 0.000000 -0.000000 -1.000000 +usemtl Red +f 1/1/1 2/1/2 3/1/3 +f 1/1/1 3/1/3 4/1/4 +f 1/1/1 4/1/4 5/1/5 +f 1/1/1 5/1/5 6/1/6 +f 1/1/1 6/1/6 7/1/7 +f 1/1/1 7/1/7 8/1/8 +f 1/1/1 8/1/8 9/1/9 +f 1/1/1 9/1/9 10/1/10 +f 1/1/1 10/1/10 11/1/11 +f 1/1/1 11/1/11 12/1/12 +f 1/1/1 12/1/12 13/1/13 +f 1/1/1 13/1/13 14/1/14 +f 1/1/1 14/1/14 15/1/15 +f 1/1/1 15/1/15 16/1/16 +f 1/1/1 16/1/16 17/1/17 +f 1/1/1 17/1/17 2/1/2 +f 2/1/2 18/1/18 19/1/19 +f 2/1/2 19/1/19 3/1/3 +f 3/1/3 19/1/19 20/1/20 +f 3/1/3 20/1/20 4/1/4 +f 4/1/4 20/1/20 21/1/21 +f 4/1/4 21/1/21 5/1/5 +f 5/1/5 21/1/21 22/1/22 +f 5/1/5 22/1/22 6/1/6 +f 6/1/6 22/1/22 23/1/23 +f 6/1/6 23/1/23 7/1/7 +f 7/1/7 23/1/23 24/1/24 +f 7/1/7 24/1/24 8/1/8 +f 8/1/8 24/1/24 25/1/25 +f 8/1/8 25/1/25 9/1/9 +f 9/1/9 25/1/25 26/1/26 +f 9/1/9 26/1/26 10/1/10 +f 10/1/10 26/1/26 27/1/27 +f 10/1/10 27/1/27 11/1/11 +f 11/1/11 27/1/27 28/1/28 +f 11/1/11 28/1/28 12/1/12 +f 12/1/12 28/1/28 29/1/29 +f 12/1/12 29/1/29 13/1/13 +f 13/1/13 29/1/29 30/1/30 +f 13/1/13 30/1/30 14/1/14 +f 14/1/14 30/1/30 31/1/31 +f 14/1/14 31/1/31 15/1/15 +f 15/1/15 31/1/31 32/1/32 +f 15/1/15 32/1/32 16/1/16 +f 16/1/16 32/1/32 33/1/33 +f 16/1/16 33/1/33 17/1/17 +f 17/1/17 33/1/33 18/1/18 +f 17/1/17 18/1/18 2/1/2 +f 18/1/18 34/1/34 35/1/35 +f 18/1/18 35/1/35 19/1/19 +f 19/1/19 35/1/35 36/1/36 +f 19/1/19 36/1/36 20/1/20 +f 20/1/20 36/1/36 37/1/37 +f 20/1/20 37/1/37 21/1/21 +f 21/1/21 37/1/37 38/1/38 +f 21/1/21 38/1/38 22/1/22 +f 22/1/22 38/1/38 39/1/39 +f 22/1/22 39/1/39 23/1/23 +f 23/1/23 39/1/39 40/1/40 +f 23/1/23 40/1/40 24/1/24 +f 24/1/24 40/1/40 41/1/41 +f 24/1/24 41/1/41 25/1/25 +f 25/1/25 41/1/41 42/1/42 +f 25/1/25 42/1/42 26/1/26 +f 26/1/26 42/1/42 43/1/43 +f 26/1/26 43/1/43 27/1/27 +f 27/1/27 43/1/43 44/1/44 +f 27/1/27 44/1/44 28/1/28 +f 28/1/28 44/1/44 45/1/45 +f 28/1/28 45/1/45 29/1/29 +f 29/1/29 45/1/45 46/1/46 +f 29/1/29 46/1/46 30/1/30 +f 30/1/30 46/1/46 47/1/47 +f 30/1/30 47/1/47 31/1/31 +f 31/1/31 47/1/47 48/1/48 +f 31/1/31 48/1/48 32/1/32 +f 32/1/32 48/1/48 49/1/49 +f 32/1/32 49/1/49 33/1/33 +f 33/1/33 49/1/49 34/1/34 +f 33/1/33 34/1/34 18/1/18 +f 34/1/34 50/1/50 51/1/51 +f 34/1/34 51/1/51 35/1/35 +f 35/1/35 51/1/51 52/1/52 +f 35/1/35 52/1/52 36/1/36 +f 36/1/36 52/1/52 53/1/53 +f 36/1/36 53/1/53 37/1/37 +f 37/1/37 53/1/53 54/1/54 +f 37/1/37 54/1/54 38/1/38 +f 38/1/38 54/1/54 55/1/55 +f 38/1/38 55/1/55 39/1/39 +f 39/1/39 55/1/55 56/1/56 +f 39/1/39 56/1/56 40/1/40 +f 40/1/40 56/1/56 57/1/57 +f 40/1/40 57/1/57 41/1/41 +f 41/1/41 57/1/57 58/1/58 +f 41/1/41 58/1/58 42/1/42 +f 42/1/42 58/1/58 59/1/59 +f 42/1/42 59/1/59 43/1/43 +f 43/1/43 59/1/59 60/1/60 +f 43/1/43 60/1/60 44/1/44 +f 44/1/44 60/1/60 61/1/61 +f 44/1/44 61/1/61 45/1/45 +f 45/1/45 61/1/61 62/1/62 +f 45/1/45 62/1/62 46/1/46 +f 46/1/46 62/1/62 63/1/63 +f 46/1/46 63/1/63 47/1/47 +f 47/1/47 63/1/63 64/1/64 +f 47/1/47 64/1/64 48/1/48 +f 48/1/48 64/1/64 65/1/65 +f 48/1/48 65/1/65 49/1/49 +f 49/1/49 65/1/65 50/1/50 +f 49/1/49 50/1/50 34/1/34 +usemtl Blue +f 50/2/50 66/2/66 67/2/67 +f 50/2/50 67/2/67 51/2/51 +f 51/2/51 67/2/67 68/2/68 +f 51/2/51 68/2/68 52/2/52 +f 52/2/52 68/2/68 69/2/69 +f 52/2/52 69/2/69 53/2/53 +f 53/2/53 69/2/69 70/2/70 +f 53/2/53 70/2/70 54/2/54 +f 54/2/54 70/2/70 71/2/71 +f 54/2/54 71/2/71 55/2/55 +f 55/2/55 71/2/71 72/2/72 +f 55/2/55 72/2/72 56/2/56 +f 56/2/56 72/2/72 73/2/73 +f 56/2/56 73/2/73 57/2/57 +f 57/2/57 73/2/73 74/2/74 +f 57/2/57 74/2/74 58/2/58 +f 58/2/58 74/2/74 75/2/75 +f 58/2/58 75/2/75 59/2/59 +f 59/2/59 75/2/75 76/2/76 +f 59/2/59 76/2/76 60/2/60 +f 60/2/60 76/2/76 77/2/77 +f 60/2/60 77/2/77 61/2/61 +f 61/2/61 77/2/77 78/2/78 +f 61/2/61 78/2/78 62/2/62 +f 62/2/62 78/2/78 79/2/79 +f 62/2/62 79/2/79 63/2/63 +f 63/2/63 79/2/79 80/2/80 +f 63/2/63 80/2/80 64/2/64 +f 64/2/64 80/2/80 81/2/81 +f 64/2/64 81/2/81 65/2/65 +f 65/2/65 81/2/81 66/2/66 +f 65/2/65 66/2/66 50/2/50 +f 66/2/66 82/2/82 83/2/83 +f 66/2/66 83/2/83 67/2/67 +f 67/2/67 83/2/83 84/2/84 +f 67/2/67 84/2/84 68/2/68 +f 68/2/68 84/2/84 85/2/85 +f 68/2/68 85/2/85 69/2/69 +f 69/2/69 85/2/85 86/2/86 +f 69/2/69 86/2/86 70/2/70 +f 70/2/70 86/2/86 87/2/87 +f 70/2/70 87/2/87 71/2/71 +f 71/2/71 87/2/87 88/2/88 +f 71/2/71 88/2/88 72/2/72 +f 72/2/72 88/2/88 89/2/89 +f 72/2/72 89/2/89 73/2/73 +f 73/2/73 89/2/89 90/2/90 +f 73/2/73 90/2/90 74/2/74 +f 74/2/74 90/2/90 91/2/91 +f 74/2/74 91/2/91 75/2/75 +f 75/2/75 91/2/91 92/2/92 +f 75/2/75 92/2/92 76/2/76 +f 76/2/76 92/2/92 93/2/93 +f 76/2/76 93/2/93 77/2/77 +f 77/2/77 93/2/93 94/2/94 +f 77/2/77 94/2/94 78/2/78 +f 78/2/78 94/2/94 95/2/95 +f 78/2/78 95/2/95 79/2/79 +f 79/2/79 95/2/95 96/2/96 +f 79/2/79 96/2/96 80/2/80 +f 80/2/80 96/2/96 97/2/97 +f 80/2/80 97/2/97 81/2/81 +f 81/2/81 97/2/97 82/2/82 +f 81/2/81 82/2/82 66/2/66 +f 82/2/82 98/2/98 99/2/99 +f 82/2/82 99/2/99 83/2/83 +f 83/2/83 99/2/99 100/2/100 +f 83/2/83 100/2/100 84/2/84 +f 84/2/84 100/2/100 101/2/101 +f 84/2/84 101/2/101 85/2/85 +f 85/2/85 101/2/101 102/2/102 +f 85/2/85 102/2/102 86/2/86 +f 86/2/86 102/2/102 103/2/103 +f 86/2/86 103/2/103 87/2/87 +f 87/2/87 103/2/103 104/2/104 +f 87/2/87 104/2/104 88/2/88 +f 88/2/88 104/2/104 105/2/105 +f 88/2/88 105/2/105 89/2/89 +f 89/2/89 105/2/105 106/2/106 +f 89/2/89 106/2/106 90/2/90 +f 90/2/90 106/2/106 107/2/107 +f 90/2/90 107/2/107 91/2/91 +f 91/2/91 107/2/107 108/2/108 +f 91/2/91 108/2/108 92/2/92 +f 92/2/92 108/2/108 109/2/109 +f 92/2/92 109/2/109 93/2/93 +f 93/2/93 109/2/109 110/2/110 +f 93/2/93 110/2/110 94/2/94 +f 94/2/94 110/2/110 111/2/111 +f 94/2/94 111/2/111 95/2/95 +f 95/2/95 111/2/111 112/2/112 +f 95/2/95 112/2/112 96/2/96 +f 96/2/96 112/2/112 113/2/113 +f 96/2/96 113/2/113 97/2/97 +f 97/2/97 113/2/113 98/2/98 +f 97/2/97 98/2/98 82/2/82 +f 114/2/114 99/2/99 98/2/98 +f 114/2/114 100/2/100 99/2/99 +f 114/2/114 101/2/101 100/2/100 +f 114/2/114 102/2/102 101/2/101 +f 114/2/114 103/2/103 102/2/102 +f 114/2/114 104/2/104 103/2/103 +f 114/2/114 105/2/105 104/2/104 +f 114/2/114 106/2/106 105/2/105 +f 114/2/114 107/2/107 106/2/106 +f 114/2/114 108/2/108 107/2/107 +f 114/2/114 109/2/109 108/2/108 +f 114/2/114 110/2/110 109/2/109 +f 114/2/114 111/2/111 110/2/110 +f 114/2/114 112/2/112 111/2/111 +f 114/2/114 113/2/113 112/2/112 +f 114/2/114 98/2/98 113/2/113 diff --git a/tests/data/texture_import/two_color_sphere/textures/two_color.jpg b/tests/data/texture_import/two_color_sphere/textures/two_color.jpg new file mode 100644 index 0000000000..7c4e3aa676 Binary files /dev/null and b/tests/data/texture_import/two_color_sphere/textures/two_color.jpg differ diff --git a/tests/fff_print/CMakeLists.txt b/tests/fff_print/CMakeLists.txt index a8e0f1575d..8c0281efb7 100644 --- a/tests/fff_print/CMakeLists.txt +++ b/tests/fff_print/CMakeLists.txt @@ -6,6 +6,7 @@ add_executable(${_TEST_NAME}_tests test_cooling.cpp test_extrusion_entity.cpp test_extrusion_processor.cpp + test_exclusion_volumes.cpp test_fill.cpp test_flow.cpp test_gcode_processor.cpp @@ -18,6 +19,7 @@ add_executable(${_TEST_NAME}_tests test_imex_slice_offset.cpp test_model.cpp test_multifilament.cpp + test_multimaterial_segmentation.cpp test_perimeters.cpp # Seam geometry and pipeline regressions share the existing Print fixtures. test_precise_seam.cpp diff --git a/tests/fff_print/test_cooling.cpp b/tests/fff_print/test_cooling.cpp index 1645d99a75..a1a840c745 100644 --- a/tests/fff_print/test_cooling.cpp +++ b/tests/fff_print/test_cooling.cpp @@ -40,7 +40,7 @@ TEST_CASE("Arc fitting remains active with overhang fan control", "[Cooling][Reg { DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); config.set_deserialize_strict({ - { "enable_arc_fitting", true }, + { "enable_arc_fitting", "enabled" }, { "enable_overhang_bridge_fan", true }, { "enable_overhang_speed", true }, { "initial_layer_print_height", 0.2 }, @@ -99,7 +99,7 @@ TEST_CASE("Overhang fan transitions do not depend on overhang speed", "[Cooling] DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); config.set_deserialize_strict({ { "bridge_speed", 2.0 }, - { "enable_arc_fitting", false }, + { "enable_arc_fitting", "disabled" }, { "enable_overhang_bridge_fan", true }, { "enable_overhang_speed", false }, { "initial_layer_print_height", 0.3 }, diff --git a/tests/fff_print/test_exclusion_volumes.cpp b/tests/fff_print/test_exclusion_volumes.cpp new file mode 100644 index 0000000000..6b20d07973 --- /dev/null +++ b/tests/fff_print/test_exclusion_volumes.cpp @@ -0,0 +1,812 @@ +#include +#include +#include +#include +#include +#include "libslic3r/Config.hpp" +#include "libslic3r/ExPolygon.hpp" +#include "libslic3r/Model.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/Polygon.hpp" +#include "libslic3r/Polyline.hpp" +#include "libslic3r/TriangleMesh.hpp" +#include "libslic3r/libslic3r.h" +#include +#include +#include +#include +#include + +#include "libslic3r/GCode/ExclusionVolumePathCheck.hpp" +#include "libslic3r/GCode/ExclusionVolumeTravelAvoidance.hpp" +#include "libslic3r/GCode/GCodeProcessor.hpp" +#include "libslic3r/ClipperUtils.hpp" +#include "libslic3r/Print.hpp" +#include "libslic3r/PrintConfig.hpp" +#include "libslic3r/Support/SupportCommon.hpp" +#include "libslic3r/Support/SupportLayer.hpp" + +#include "test_helpers.hpp" +#include "test_utils.hpp" + +#include +#include +#include +#include +#include + +using namespace Slic3r; +using Catch::Matchers::WithinAbs; + +namespace { + +DynamicPrintConfig exclusion_config( + BedExcludeVolumeMode mode = BedExcludeVolumeMode::Shared, + const std::string &shared = "0..10;40x40,60x40,60x60,40x60", + const std::vector &per_extruder = {}) +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + const size_t extruder_count = std::max(1, per_extruder.size()); + config.set_num_extruders(extruder_count); + config.set_key_value("nozzle_diameter", new ConfigOptionFloats(extruder_count, 0.4)); + config.set_key_value("extruder_offset", new ConfigOptionPoints(extruder_count, Vec2d::Zero())); + config.set_key_value("extruder_printable_height", new ConfigOptionFloatsNullable(extruder_count, 100.0)); + config.set_key_value("printable_height", new ConfigOptionFloat(100.0)); + config.set_key_value("printable_area", new ConfigOptionPoints{ + Vec2d(0.0, 0.0), Vec2d(100.0, 0.0), Vec2d(100.0, 100.0), Vec2d(0.0, 100.0), + }); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(mode)); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString(shared)); + if (!per_extruder.empty()) + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings(per_extruder)); + return config; +} + +DynamicPrintConfig legacy_exclusion_config() +{ + DynamicPrintConfig config = exclusion_config(); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString()); + config.set_deserialize_strict("bed_exclude_area", "40x40,60x40,60x60,40x60"); + return config; +} + +FullPrintConfig static_config(const DynamicPrintConfig &dynamic) +{ + FullPrintConfig config; + // full_print_config() also contains GUI/profile-only keys which are not + // members of the static slicing config used by these lower-level classes. + config.apply(dynamic, true); + return config; +} + +Polyline travel(std::initializer_list points) +{ + Points scaled_points; + scaled_points.reserve(points.size()); + for (const Vec2d &point : points) + scaled_points.emplace_back(Point::new_scale(point)); + return Polyline(std::move(scaled_points)); +} + +Vec2d to_mm(const Point &point) +{ + return point.cast() * SCALING_FACTOR; +} + +struct Rect +{ + double min_x; + double min_y; + double max_x; + double max_y; +}; + +bool point_inside_open_rect(const Vec2d &point, const Rect &rect) +{ + return point.x() > rect.min_x && point.x() < rect.max_x && + point.y() > rect.min_y && point.y() < rect.max_y; +} + +// Independent Liang-Barsky-style test oracle for the simple rectangular +// obstacles used here. This deliberately does not call the production path +// checker, so matching bugs in the checker and router cannot hide each other. +bool segment_enters_open_rect(const Vec2d &from, const Vec2d &to, const Rect &rect) +{ + if (point_inside_open_rect(from, rect) || point_inside_open_rect(to, rect)) + return true; + + double t_min = 0.0; + double t_max = 1.0; + const Vec2d delta = to - from; + const auto clip_axis = [&](double origin, double direction, double min_value, double max_value, + double &lower, double &upper) { + if (std::abs(direction) < 1e-12) + return origin > min_value && origin < max_value; + double first = (min_value - origin) / direction; + double second = (max_value - origin) / direction; + if (first > second) + std::swap(first, second); + lower = std::max(lower, first); + upper = std::min(upper, second); + return lower < upper; + }; + + if (!clip_axis(from.x(), delta.x(), rect.min_x, rect.max_x, t_min, t_max)) + return false; + if (!clip_axis(from.y(), delta.y(), rect.min_y, rect.max_y, t_min, t_max)) + return false; + if (t_min >= t_max) + return false; + + const double midpoint_t = 0.5 * (std::max(0.0, t_min) + std::min(1.0, t_max)); + return midpoint_t >= 0.0 && midpoint_t <= 1.0 && + point_inside_open_rect(from + midpoint_t * delta, rect); +} + +void check_path_avoids_rect(const Polyline &path, const Rect &rect) +{ + REQUIRE(path.points.size() >= 2); + for (size_t idx = 1; idx < path.points.size(); ++idx) + CHECK_FALSE(segment_enters_open_rect(to_mm(path.points[idx - 1]), to_mm(path.points[idx]), rect)); +} + +ExclusionVolumePathChecker configured_checker(const FullPrintConfig &config) +{ + ExclusionVolumePathChecker checker; + checker.configure(config); + return checker; +} + +void check_motion( + ExclusionVolumePathChecker &checker, + const Vec3d &from, + const Vec3d &to, + int extruder_id = 0, + ExclusionVolumeMotionType type = ExclusionVolumeMotionType::Travel, + bool start_xy_known = true, + bool end_xy_known = true, + bool start_z_known = true, + bool end_z_known = true, + unsigned int gcode_id = 17, + size_t move_id = 23) +{ + checker.check_motion( + from, to, start_xy_known, end_xy_known, start_z_known, end_z_known, + extruder_id, type, 7, gcode_id, move_id); +} + +struct ProcessorExclusionResult +{ + bool checked {false}; + bool conflict {false}; + bool travel_conflict {false}; + bool extrusion_conflict {false}; + int conflict_extruder_id {-1}; +}; + +class ScopedBblPrinterMode +{ +public: + explicit ScopedBblPrinterMode(bool enabled) + : m_previous(GCodeProcessor::s_IsBBLPrinter) + { + GCodeProcessor::s_IsBBLPrinter = enabled; + } + + ~ScopedBblPrinterMode() { GCodeProcessor::s_IsBBLPrinter = m_previous; } + +private: + bool m_previous; +}; + +ProcessorExclusionResult run_processor(const FullPrintConfig &config, const std::string &gcode) +{ + ScopedTemporaryFile file(".gcode"); + { + std::ofstream output(file.string()); + output << gcode; + } + + // The processor exposes this mode as shared state. Restore it after each + // invocation so these tests remain independent of Catch2 execution order. + ScopedBblPrinterMode printer_mode(false); + GCodeProcessor processor; + processor.apply_config(config); + processor.configure_exclusion_volume_path_check(config); + processor.process_file(file.string()); + const GCodeProcessorResult &result = processor.get_result(); + return { + result.exclusion_volume_path_checked, + result.exclusion_volume_path_conflict, + result.exclusion_volume_travel_conflict, + result.exclusion_volume_extrusion_conflict, + result.exclusion_volume_conflict_extruder_id, + }; +} + +Polygon rectangle(double min_x, double min_y, double max_x, double max_y) +{ + Polygon polygon({ + Point::new_scale(min_x, min_y), + Point::new_scale(max_x, min_y), + Point::new_scale(max_x, max_y), + Point::new_scale(min_x, max_y), + }); + polygon.make_counter_clockwise(); + return polygon; +} + +bool polygons_cover(const Polygons &polygons, double x, double y) +{ + const Point point = Point::new_scale(x, y); + const ExPolygons expolygons = union_ex(polygons); + return std::any_of(expolygons.begin(), expolygons.end(), + [&point](const ExPolygon &polygon) { return polygon.contains(point); }); +} + +struct BrimRun +{ + double total_length {0.0}; + bool intersects_test_region {false}; + bool leaves_bed {false}; +}; + +BrimRun generate_brim(const std::string &exclusion_definition, const Vec2d &object_position = Vec2d(40.0, 40.0)) +{ + DynamicPrintConfig config = exclusion_config(BedExcludeVolumeMode::Shared, exclusion_definition); + // Brim clipping normally receives the cached bed polygon initialized by + // the application. Give this headless fixture an explicit nozzle-reachable + // area so it exercises the same boundary path without mutating global state. + config.set_key_value("extruder_printable_area", new ConfigOptionPointsGroups{{ + Vec2d(0.0, 0.0), Vec2d(100.0, 0.0), Vec2d(100.0, 100.0), Vec2d(0.0, 100.0), + }}); + config.set_deserialize_strict({ + {"skirt_loops", "0"}, + {"brim_type", "outer_only"}, + {"brim_width", "10"}, + {"initial_layer_line_width", "0.5"}, + }); + + TriangleMesh mesh = make_cube(20.0, 20.0, 20.0); + mesh.translate(float(object_position.x()), float(object_position.y()), 0.0f); + Print print; + Model model; + Test::init_print(std::vector{std::move(mesh)}, print, model, config, nullptr, false); + print.process(); + + Polylines paths; + for (const Print::SkirtBrimGroup &group : print.skirt_brim_groups()) + for (const Print::SkirtBrimGroup::Brim &brim : group.brims) { + Polylines current = brim.brim.as_polylines(); + paths.insert(paths.end(), std::make_move_iterator(current.begin()), std::make_move_iterator(current.end())); + } + + BrimRun result; + for (const Polyline &path : paths) + result.total_length += path.length(); + result.intersects_test_region = + !intersection_pl(paths, Polygons{rectangle(32.0, 35.0, 38.0, 65.0)}).empty(); + result.leaves_bed = std::any_of(paths.begin(), paths.end(), [](const Polyline &path) { + return std::any_of(path.points.begin(), path.points.end(), [](const Point &point) { + const Vec2d position = to_mm(point); + return position.x() < -EPSILON || position.x() > 100.0 + EPSILON || + position.y() < -EPSILON || position.y() > 100.0 + EPSILON; + }); + }); + return result; +} + +DynamicPrintConfig support_config(int support_filament, int interface_filament) +{ + DynamicPrintConfig config = exclusion_config( + BedExcludeVolumeMode::PerExtruder, "", + {"0..10;4x4,12x4,12x12,4x12", "0..10;22x4,30x4,30x12,22x12"}); + // PrintObject clamps support role ids against the number of logical + // filaments, represented by filament_diameter in the static config. + config.set_key_value("filament_diameter", new ConfigOptionFloats{1.75, 1.75}); + config.set_key_value("filament_map_mode", new ConfigOptionEnum(fmmManual)); + config.set_key_value("filament_map", new ConfigOptionInts{1, 2}); + config.set_key_value("support_filament", new ConfigOptionInt(support_filament)); + config.set_key_value("support_interface_filament", new ConfigOptionInt(interface_filament)); + return config; +} + +struct SupportPrintFixture +{ + Model model; + Print print; + + explicit SupportPrintFixture(const DynamicPrintConfig &config) + { + ModelObject *object = model.add_object(); + ModelVolume *first = object->add_volume(make_cube(20.0, 20.0, 20.0)); + ModelVolume *second = object->add_volume(make_cube(20.0, 20.0, 20.0)); + first->config.set("extruder", 1); + second->config.set("extruder", 2); + // Pin the role assignments on the object as well as the process + // config. This fixture intentionally exercises support exclusion + // selection, not the separate preset-remapping subsystem. + object->config.set("support_filament", config.opt_int("support_filament")); + object->config.set("support_interface_filament", config.opt_int("support_interface_filament")); + object->add_instance(); + object->ensure_on_bed(); + print.apply(model, config); + } + + PrintObject &object() { return *print.objects_mutable().front(); } +}; + +} // namespace + +TEST_CASE("Path checker ignores clear motions and motions outside the active Z slab", "[ExclusionVolume][GCode]") +{ + const FullPrintConfig config = static_config(exclusion_config()); + + SECTION("clear XY") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(10.0, 10.0, 5.0), Vec3d(20.0, 20.0, 5.0)); + CHECK_FALSE(checker.result().has_any_conflict); + } + + SECTION("above volume") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(20.0, 50.0, 20.0), Vec3d(80.0, 50.0, 20.0)); + CHECK_FALSE(checker.result().has_any_conflict); + } + + SECTION("below volume") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(20.0, 50.0, -5.0), Vec3d(80.0, 50.0, -5.0)); + CHECK_FALSE(checker.result().has_any_conflict); + } +} + +TEST_CASE("Legacy excluded areas do not constrain machine motion", "[ExclusionVolume][GCode][Compatibility]") +{ + const FullPrintConfig config = static_config(legacy_exclusion_config()); + const Polyline direct = travel({Vec2d(20.0, 50.0), Vec2d(80.0, 50.0)}); + + auto checker = configured_checker(config); + check_motion(checker, Vec3d(20.0, 50.0, 5.0), Vec3d(80.0, 50.0, 5.0)); + CHECK_FALSE(checker.result().has_any_conflict); + + ExclusionVolumeTravelAvoidance router; + router.init(config, Vec3d::Zero()); + const auto route = router.route(direct, 5.0, 5.0, 0); + CHECK(route.status == ExclusionVolumeTravelAvoidance::Status::Unchanged); + CHECK(route.detail == ExclusionVolumeTravelAvoidance::Detail::NoActiveObstacles); + CHECK(route.path.points == direct.points); +} + +TEST_CASE("G-code preview retains the bed area alongside collision volumes", "[ExclusionVolume][GCode][Compatibility][Regression]") +{ + const auto mode = GENERATE(BedExcludeVolumeMode::Shared, BedExcludeVolumeMode::ToolheadOffset, + BedExcludeVolumeMode::PerExtruder); + DynamicPrintConfig config = exclusion_config(mode, "0..10;70x70,80x70,80x80,70x80", + {"0..10;70x70,80x70,80x80,70x80"}); + config.set_deserialize_strict("bed_exclude_area", "0x0,18x0,18x28,0x28"); + ScopedTemporaryFile file(".gcode"); + { + std::ofstream output(file.string()); + REQUIRE(output.is_open()); + output << "; generated by OrcaSlicer\nG90\nM83\nG1 X30 Y30 Z0.2 F3000\n" + << "; CONFIG_BLOCK_START\n"; + for (const std::string &key : config.keys()) + output << "; " << key << " = " << config.opt_serialize(key) << '\n'; + output << "; CONFIG_BLOCK_END\n"; + REQUIRE(output.good()); + } + ScopedBblPrinterMode printer_mode(false); + GCodeProcessor processor; + // Standalone preview loading uses the embedded DynamicPrintConfig, not + // the streaming writer's PrintConfig overload. + processor.process_file(file.string()); + CHECK(processor.get_result().bed_exclude_area == config.option("bed_exclude_area")->values); +} + +TEST_CASE("Collision volumes preserve the configured cutter travel points", "[ExclusionVolume][GCode][Compatibility][Regression]") +{ + DynamicPrintConfig config = Test::multifilament_config(2, { + {"enable_prime_tower", "0"}, {"gcode_flavor", "klipper"}, + {"start_end_points", "20x-3,60x90"}, {"bed_exclude_area", "0x0,18x0,18x28,0x28"}, + {"change_filament_gcode", ";CUTTER_PATH [travel_point_1_x],[travel_point_1_y];[travel_point_2_x],[travel_point_2_y];[travel_point_3_x],[travel_point_3_y]"}, + }); + const auto cutter_path = [](const DynamicPrintConfig &settings) { + Model model; + Print print; + const std::vector> overrides{ + {{"extruder", "1"}}, {{"extruder", "2"}}}; + std::vector meshes; + for (const double x : {30.0, 45.0}) { + TriangleMesh mesh = make_cube(5.0, 5.0, 0.6); + mesh.translate(Vec3f(float(x), 40.0f, 0.0f)); + meshes.push_back(std::move(mesh)); + } + Test::init_print(std::move(meshes), print, model, settings, &overrides, false); + const std::string gcode = Test::gcode(print); + const size_t marker = gcode.find(";CUTTER_PATH "); + REQUIRE(marker != std::string::npos); + return gcode.substr(marker, gcode.find('\n', marker) - marker); + }; + const std::string expected = cutter_path(config); + // The configured endpoint differs from the fallback (54, 245), so this + // comparison cannot pass by silently disabling the cutter-area calculation. + CHECK_THAT(expected, Catch::Matchers::ContainsSubstring("60")); + CHECK_THAT(expected, Catch::Matchers::ContainsSubstring("90")); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString("0..10;80x80,90x80,90x90,80x90")); + CHECK(cutter_path(config) == expected); +} + +TEST_CASE("Path checker detects crossing inside and boundary motions", "[ExclusionVolume][GCode]") +{ + const FullPrintConfig config = static_config(exclusion_config()); + const auto [from, to] = GENERATE(table({ + {Vec3d(20.0, 50.0, 5.0), Vec3d(80.0, 50.0, 5.0)}, + {Vec3d(45.0, 45.0, 5.0), Vec3d(55.0, 55.0, 5.0)}, + {Vec3d(20.0, 40.0, 5.0), Vec3d(80.0, 40.0, 5.0)}, + {Vec3d(50.0, 20.0, -5.0), Vec3d(50.0, 80.0, 15.0)}, + })); + + auto checker = configured_checker(config); + check_motion(checker, from, to); + CHECK(checker.result().has_any_conflict); + REQUIRE(checker.result().first_hit.has_value()); + CHECK(checker.result().first_hit->extruder_id == 0); +} + +TEST_CASE("Path checker records motion classification and stable first-hit metadata", "[ExclusionVolume][GCode]") +{ + const auto [type, travel_hit, extrusion_hit, other_hit] = GENERATE(table({ + {ExclusionVolumeMotionType::Travel, true, false, false}, + {ExclusionVolumeMotionType::Extrude, false, true, false}, + {ExclusionVolumeMotionType::Other, false, false, true }, + })); + + auto checker = configured_checker(static_config(exclusion_config())); + check_motion(checker, Vec3d(20.0, 50.0, 5.0), Vec3d(80.0, 50.0, 5.0), 0, type, + true, true, true, true, 101, 202); + check_motion(checker, Vec3d(20.0, 50.0, 5.0), Vec3d(80.0, 50.0, 5.0), 0, type, + true, true, true, true, 303, 404); + + const ExclusionVolumePathCheckResult &result = checker.result(); + CHECK(result.has_travel_conflict == travel_hit); + CHECK(result.has_extrusion_conflict == extrusion_hit); + CHECK(result.has_other_motion_conflict == other_hit); + REQUIRE(result.first_hit.has_value()); + CHECK(result.first_hit->gcode_id == 101); + CHECK(result.first_hit->move_id == 202); + CHECK(result.first_hit->source_move_type == 7); +} + +TEST_CASE("Path checker handles unknown coordinates conservatively without inventing XY", "[ExclusionVolume][GCode]") +{ + const FullPrintConfig config = static_config(exclusion_config()); + + SECTION("unknown XY start is ignored") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(0.0, 0.0, 5.0), Vec3d(80.0, 50.0, 5.0), 0, + ExclusionVolumeMotionType::Travel, false, true); + CHECK_FALSE(checker.result().has_any_conflict); + } + + SECTION("unknown Z checks every height and marks the result") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(20.0, 50.0, 100.0), Vec3d(80.0, 50.0, 100.0), 0, + ExclusionVolumeMotionType::Travel, true, true, false, false); + REQUIRE(checker.result().first_hit.has_value()); + CHECK(checker.result().first_hit->used_unknown_z); + } +} + +TEST_CASE("Path checker selects the active nozzle and applies its XY offset", "[ExclusionVolume][GCode][MultiNozzle]") +{ + DynamicPrintConfig dynamic = exclusion_config( + BedExcludeVolumeMode::PerExtruder, "", {"", "0..10;40x40,60x40,60x60,40x60"}); + dynamic.set_key_value("extruder_offset", new ConfigOptionPoints{Vec2d::Zero(), Vec2d(20.0, 0.0)}); + const FullPrintConfig config = static_config(dynamic); + + SECTION("unrelated nozzle remains clear") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(20.0, 50.0, 5.0), Vec3d(80.0, 50.0, 5.0), 0); + CHECK_FALSE(checker.result().has_any_conflict); + } + + SECTION("active nozzle offset converts emitted coordinates into model space") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(0.0, 50.0, 5.0), Vec3d(50.0, 50.0, 5.0), 1); + REQUIRE(checker.result().first_hit.has_value()); + CHECK(checker.result().first_hit->extruder_id == 1); + CHECK_THAT(checker.result().first_hit->from.x(), WithinAbs(20.0, 1e-9)); + } + + SECTION("unknown active nozzle checks all physical nozzles") { + auto checker = configured_checker(config); + check_motion(checker, Vec3d(0.0, 50.0, 5.0), Vec3d(50.0, 50.0, 5.0), -1); + REQUIRE(checker.result().first_hit.has_value()); + CHECK(checker.result().first_hit->extruder_id == 1); + } +} + +TEST_CASE("Travel router leaves clear and vertically separated paths unchanged", "[ExclusionVolume][TravelRouting]") +{ + ExclusionVolumeTravelAvoidance router; + router.init(static_config(exclusion_config()), Vec3d::Zero()); + + const Polyline clear = travel({Vec2d(10.0, 10.0), Vec2d(90.0, 10.0)}); + auto result = router.route(clear, 5.0, 5.0, 0); + CHECK(result.status == ExclusionVolumeTravelAvoidance::Status::Unchanged); + CHECK(result.detail == ExclusionVolumeTravelAvoidance::Detail::NoIntersection); + CHECK(result.path.points == clear.points); + + const Polyline crossing = travel({Vec2d(20.0, 50.0), Vec2d(80.0, 50.0)}); + result = router.route(crossing, 20.0, 20.0, 0); + CHECK(result.status == ExclusionVolumeTravelAvoidance::Status::Unchanged); + CHECK(result.detail == ExclusionVolumeTravelAvoidance::Detail::NoActiveObstacles); +} + +TEST_CASE("Travel router produces a safe in-bed detour around an active volume", "[ExclusionVolume][TravelRouting]") +{ + ExclusionVolumeTravelAvoidance router; + router.init(static_config(exclusion_config()), Vec3d::Zero()); + const Polyline direct = travel({Vec2d(20.0, 50.0), Vec2d(80.0, 50.0)}); + + const auto result = router.route(direct, 5.0, 5.0, 0); + REQUIRE(result.status == ExclusionVolumeTravelAvoidance::Status::Rerouted); + REQUIRE(result.path.points.size() > 2); + CHECK(result.path.points.front() == direct.points.front()); + CHECK(result.path.points.back() == direct.points.back()); + check_path_avoids_rect(result.path, Rect{40.0, 40.0, 60.0, 60.0}); + for (const Point &point : result.path.points) { + const Vec2d position = to_mm(point); + CHECK(position.x() >= 0.0); + CHECK(position.x() <= 100.0); + CHECK(position.y() >= 0.0); + CHECK(position.y() <= 100.0); + } +} + +TEST_CASE("Travel router activates volumes touched by a sloped Z move", "[ExclusionVolume][TravelRouting]") +{ + ExclusionVolumeTravelAvoidance router; + router.init(static_config(exclusion_config()), Vec3d::Zero()); + const Polyline direct = travel({Vec2d(20.0, 50.0), Vec2d(80.0, 50.0)}); + + const auto result = router.route(direct, -5.0, 15.0, 0); + REQUIRE(result.status == ExclusionVolumeTravelAvoidance::Status::Rerouted); + check_path_avoids_rect(result.path, Rect{40.0, 40.0, 60.0, 60.0}); +} + +TEST_CASE("Travel router reports unsafe endpoints unknown tools and blocked beds", "[ExclusionVolume][TravelRouting]") +{ + SECTION("endpoint inside") { + ExclusionVolumeTravelAvoidance router; + router.init(static_config(exclusion_config()), Vec3d::Zero()); + const auto result = router.route(travel({Vec2d(50.0, 50.0), Vec2d(80.0, 50.0)}), 5.0, 5.0, 0); + CHECK(result.status == ExclusionVolumeTravelAvoidance::Status::EndpointInside); + CHECK(result.detail == ExclusionVolumeTravelAvoidance::Detail::EndpointInside); + } + + SECTION("unknown tool") { + ExclusionVolumeTravelAvoidance router; + router.init(static_config(exclusion_config()), Vec3d::Zero()); + const auto result = router.route(travel({Vec2d(20.0, 50.0), Vec2d(80.0, 50.0)}), 5.0, 5.0, -1); + CHECK(result.status == ExclusionVolumeTravelAvoidance::Status::Failed); + CHECK(result.detail == ExclusionVolumeTravelAvoidance::Detail::UnknownExtruder); + } + + SECTION("obstacle separates the bed") { + ExclusionVolumeTravelAvoidance router; + router.init(static_config(exclusion_config( + BedExcludeVolumeMode::Shared, "0..10;45x0,55x0,55x100,45x100")), Vec3d::Zero()); + const auto result = router.route(travel({Vec2d(20.0, 50.0), Vec2d(80.0, 50.0)}), 5.0, 5.0, 0); + CHECK(result.status == ExclusionVolumeTravelAvoidance::Status::Failed); + } +} + +TEST_CASE("Travel router uses only the active nozzle exclusion set", "[ExclusionVolume][TravelRouting][MultiNozzle]") +{ + const FullPrintConfig config = static_config(exclusion_config( + BedExcludeVolumeMode::PerExtruder, "", {"0..10;40x40,60x40,60x60,40x60", ""})); + ExclusionVolumeTravelAvoidance router; + router.init(config, Vec3d::Zero()); + const Polyline direct = travel({Vec2d(20.0, 50.0), Vec2d(80.0, 50.0)}); + + CHECK(router.route(direct, 5.0, 5.0, 0).status == ExclusionVolumeTravelAvoidance::Status::Rerouted); + const auto clear = router.route(direct, 5.0, 5.0, 1); + CHECK(clear.status == ExclusionVolumeTravelAvoidance::Status::Unchanged); + CHECK(clear.detail == ExclusionVolumeTravelAvoidance::Detail::NoActiveObstacles); +} + +TEST_CASE("Travel router accepts firmware positions outside the printable boundary", "[ExclusionVolume][TravelRouting]") +{ + ExclusionVolumeTravelAvoidance router; + router.init(static_config(exclusion_config()), Vec3d::Zero()); + + SECTION("start outside") { + const auto result = router.route( + travel({Vec2d(-5.0, 50.0), Vec2d(80.0, 50.0)}), 5.0, 5.0, 0); + REQUIRE(result.status == ExclusionVolumeTravelAvoidance::Status::Rerouted); + check_path_avoids_rect(result.path, Rect{40.0, 40.0, 60.0, 60.0}); + } + + SECTION("end outside") { + const auto result = router.route( + travel({Vec2d(20.0, 50.0), Vec2d(105.0, 50.0)}), 5.0, 5.0, 0); + REQUIRE(result.status == ExclusionVolumeTravelAvoidance::Status::Rerouted); + check_path_avoids_rect(result.path, Rect{40.0, 40.0, 60.0, 60.0}); + } +} + +TEST_CASE("G-code processor ignores the artificial first XY origin and checks subsequent travel", "[ExclusionVolume][GCodeProcessor]") +{ + const FullPrintConfig config = static_config(exclusion_config()); + + SECTION("first explicit position has no invented start") { + const ProcessorExclusionResult result = run_processor(config, "G90\nG1 X80 Y50 Z5 F6000\n"); + CHECK(result.checked); + CHECK_FALSE(result.conflict); + } + + SECTION("next motion starts at the established position") { + const ProcessorExclusionResult result = run_processor(config, "G90\nG1 X80 Y50 Z5 F6000\nG1 X20 Y50\n"); + CHECK(result.conflict); + CHECK(result.travel_conflict); + } +} + +TEST_CASE("G-code processor tracks absolute relative and reset coordinate state", "[ExclusionVolume][GCodeProcessor]") +{ + const FullPrintConfig config = static_config(exclusion_config()); + + SECTION("relative move crosses the volume") { + const ProcessorExclusionResult result = run_processor( + config, "G90\nG1 X20 Y50 Z5\nG91\nG1 X60 Y0\n"); + CHECK(result.conflict); + } + + SECTION("G92 preserves a known transformed coordinate frame") { + const ProcessorExclusionResult result = run_processor( + config, "G90\nG1 X20 Y50 Z5\nG92 X0 Y0\nG1 X60 Y0\n"); + CHECK(result.conflict); + } + + SECTION("homing does not create a synthetic checked move") { + const ProcessorExclusionResult result = run_processor(config, "G28\nG1 X80 Y50 Z5\n"); + CHECK_FALSE(result.conflict); + } + + SECTION("full or XY homing makes the XY start position unknown") { + const std::string homing = GENERATE( + std::string("G28"), std::string("G28 X"), std::string("G28 X Y"), + std::string("G28 XY"), std::string("G28 X0 Y0"), std::string("G28 XYZ"), + std::string("G28 W")); + const ProcessorExclusionResult result = run_processor( + config, "G90\nG1 X20 Y50 Z5\n" + homing + "\nG1 X80 Y50 Z5\n"); + CHECK_FALSE(result.conflict); + } + + SECTION("Z-only homing preserves the known XY position") { + const std::string homing = GENERATE( + std::string("G28 Z P0"), std::string("G28 Z Z_OFFSET -0.07")); + const ProcessorExclusionResult result = run_processor( + config, "G90\nG1 X20 Y50 Z5\n" + homing + "\nG1 X80 Y50 Z5\n"); + CHECK(result.conflict); + } +} + +TEST_CASE("G-code processor classifies extrusion conflicts", "[ExclusionVolume][GCodeProcessor]") +{ + const FullPrintConfig config = static_config(exclusion_config()); + const ProcessorExclusionResult result = run_processor( + config, "G90\nM83\nG1 X20 Y50 Z5\nG1 X80 Y50 E1\n"); + + CHECK(result.conflict); + CHECK(result.extrusion_conflict); + CHECK_FALSE(result.travel_conflict); +} + +TEST_CASE("G-code processor changes the active physical nozzle at tool selection", "[ExclusionVolume][GCodeProcessor][MultiNozzle]") +{ + const FullPrintConfig config = static_config(exclusion_config( + BedExcludeVolumeMode::PerExtruder, "", {"", "0..10;40x40,60x40,60x60,40x60"})); + + const ProcessorExclusionResult first_tool = run_processor(config, "G90\nT0\nG1 X20 Y50 Z5\nG1 X80 Y50\n"); + CHECK_FALSE(first_tool.conflict); + + const ProcessorExclusionResult second_tool = run_processor(config, "G90\nT1\nG1 X20 Y50 Z5\nG1 X80 Y50\n"); + CHECK(second_tool.conflict); + CHECK(second_tool.conflict_extruder_id == 1); +} + +TEST_CASE("Brim paths are clipped only by exclusions active on the first layer", "[ExclusionVolume][Brim]") +{ + const BrimRun active = generate_brim("0..1;32x35,38x35,38x65,32x65"); + const BrimRun raised = generate_brim("10..20;32x35,38x35,38x65,32x65"); + + REQUIRE(active.total_length > 0.0); + REQUIRE(raised.total_length > 0.0); + CHECK_FALSE(active.intersects_test_region); + CHECK(raised.intersects_test_region); + CHECK(active.total_length < raised.total_length); +} + +TEST_CASE("Brim paths remain clipped to the bed without collision volumes", "[ExclusionVolume][Brim][Regression]") +{ + const BrimRun brim = generate_brim("", Vec2d(21.0, 5.0)); + REQUIRE(brim.total_length > 0.0); + CHECK_FALSE(brim.leaves_bed); +} + +TEST_CASE("Support exclusion masks follow explicit and current-filament roles", "[ExclusionVolume][Support][MultiNozzle]") +{ + SECTION("explicit support roles select one physical nozzle each") { + SupportPrintFixture fixture(support_config(1, 2)); + CHECK(support_exclusion_filaments(fixture.object(), false) == std::vector{0}); + CHECK(support_exclusion_filaments(fixture.object(), true) == std::vector{1}); + + const auto base_masks = support_exclusion_areas_for_layers(fixture.object(), {{0.0, 1.0}}, false); + const auto interface_masks = support_exclusion_areas_for_layers(fixture.object(), {{0.0, 1.0}}, true); + REQUIRE(base_masks.size() == 1); + REQUIRE(interface_masks.size() == 1); + // PrintObject support geometry is centred around the object's local + // origin; the plate-space regions above are shifted by (10, 10). + CHECK(polygons_cover(base_masks.front(), -4.0, -4.0)); + CHECK_FALSE(polygons_cover(base_masks.front(), 14.0, -4.0)); + CHECK_FALSE(polygons_cover(interface_masks.front(), -4.0, -4.0)); + CHECK(polygons_cover(interface_masks.front(), 14.0, -4.0)); + } + + SECTION("current filament remains conservative across every used nozzle") { + SupportPrintFixture fixture(support_config(0, 2)); + std::vector filaments = support_exclusion_filaments(fixture.object(), false); + std::sort(filaments.begin(), filaments.end()); + CHECK(filaments == std::vector{0, 1}); + + const auto masks = support_exclusion_areas_for_layers(fixture.object(), {{0.0, 1.0}, {11.0, 12.0}}, false); + REQUIRE(masks.size() == 2); + CHECK(polygons_cover(masks[0], -4.0, -4.0)); + CHECK(polygons_cover(masks[0], 14.0, -4.0)); + CHECK(masks[1].empty()); + } +} + +TEST_CASE("Support trimming applies the correct nozzle mask to every polygon category", "[ExclusionVolume][Support][MultiNozzle]") +{ + SupportPrintFixture fixture(support_config(1, 2)); + const Polygon source = rectangle(-20.0, -20.0, 40.0, 20.0); + + SupportGeneratorLayer base; + base.layer_type = SupporLayerType::Base; + base.print_z = 1.0; + base.height = 0.2; + base.polygons = {source}; + base.contact_polygons = std::make_unique(Polygons{source}); + base.overhang_polygons = std::make_unique(Polygons{source}); + base.enforcer_polygons = std::make_unique(Polygons{source}); + + SupportGeneratorLayer interface; + interface.layer_type = SupporLayerType::TopInterface; + interface.print_z = 1.0; + interface.height = 0.2; + interface.polygons = {source}; + + const SupportGeneratorLayersPtr none; + const SupportGeneratorLayersPtr base_layers{&base}; + const SupportGeneratorLayersPtr interface_layers{&interface}; + trim_support_layers_by_exclusion_volumes( + fixture.object(), none, none, none, base_layers, interface_layers, none); + + // Base support uses filament 1 and interface support uses filament 2. + CHECK_FALSE(polygons_cover(base.polygons, -4.0, -4.0)); + CHECK(polygons_cover(base.polygons, 14.0, -4.0)); + CHECK(polygons_cover(interface.polygons, -4.0, -4.0)); + CHECK_FALSE(polygons_cover(interface.polygons, 14.0, -4.0)); + + // The same sanitization is mandatory for the auxiliary support categories. + REQUIRE(base.contact_polygons != nullptr); + REQUIRE(base.overhang_polygons != nullptr); + REQUIRE(base.enforcer_polygons != nullptr); + CHECK_FALSE(polygons_cover(*base.contact_polygons, -4.0, -4.0)); + CHECK_FALSE(polygons_cover(*base.overhang_polygons, -4.0, -4.0)); + CHECK_FALSE(polygons_cover(*base.enforcer_polygons, -4.0, -4.0)); +} diff --git a/tests/fff_print/test_fill.cpp b/tests/fff_print/test_fill.cpp index 1fbedcda8f..f6e7c55b4b 100644 --- a/tests/fff_print/test_fill.cpp +++ b/tests/fff_print/test_fill.cpp @@ -37,7 +37,7 @@ #include "libslic3r/Fill/Fill.hpp" #include "libslic3r/Fill/FillAdaptive.hpp" #include "libslic3r/Fill/FillGyroid.hpp" -#include "libslic3r/Fill/FillTpmsAdaptive.hpp" +#include "libslic3r/Fill/AdaptiveInfillField.hpp" #include "libslic3r/Flow.hpp" #include "libslic3r/Geometry.hpp" #include "libslic3r/IntersectionPoints.hpp" @@ -1392,6 +1392,27 @@ TEST_CASE("Gyroid infill of an object matches the infill of a larger object with } } +TEST_CASE("Multiline infill keeps its lines parallel around a corner", "[Fill]") +{ + // A left turn by 135 degrees, drawn as two lines half of the 0.4 mm spacing to each side of it. + const double turn = 0.75 * PI; + Polylines paths{ Polyline{ Point::new_scale(0., 0.), Point::new_scale(10., 0.), + Point::new_scale(10. + 10. * std::cos(turn), 10. * std::sin(turn)) } }; + FillParams params; + params.multiline = 2; + multiline_fill(paths, params, 0.4f); + REQUIRE(paths.size() == 1); + + // The outer line turns at the miter point, where the lines 0.2 mm out from both legs meet. + const Point miter = Point::new_scale(10. + 0.2 * std::tan(0.5 * turn), -0.2); + double nearest = std::numeric_limits::max(); + for (const Point &point : paths.front().points) + nearest = std::min(nearest, (point - miter).cast().norm()); + REQUIRE(nearest < scaled(0.001)); + // The round ends are flattened to a fraction of the offset rather than to the integer grid. + REQUIRE(paths.front().size() < 100); +} + TEST_CASE("Multiline cubic infill follows the cubic lines without crossing itself", "[Fill]") { const int multiline = GENERATE(2, 3); @@ -1719,9 +1740,10 @@ TEST_CASE("Smoothing multiline lightning infill keeps its outlines connected", " const SparseInfillShape smooth = shape_for("100%"); REQUIRE(sharp.path_count > 0); - // Smoothing should leave the loop count about where it was; uncapping the smoothing reach, the - // regression this guards against, adds about 10%. - const size_t allowed_extra = sharp.path_count / 50; // 2% + // Smoothing should leave the path count about where it was; uncapping the smoothing reach, the + // regression this guards against, adds a quarter to a third. Outline ends next to each other are + // joined into one path, so a few loops more or less are a larger share of the count. + const size_t allowed_extra = sharp.path_count / 10; // 10% REQUIRE(smooth.path_count <= sharp.path_count + allowed_extra); // The outlines are still rounded. REQUIRE(smooth.point_count > sharp.point_count); @@ -2060,9 +2082,9 @@ TEST_CASE("Adaptive TPMS infill thins out from the surface to the interior densi Slic3r::Test::init_and_process_print({Slic3r::Test::cube(60)}, print, {{"sparse_infill_pattern", pattern}, {"sparse_infill_density", "25%"}, - {"tpms_adaptive", adaptive}, - {"tpms_interior_density", "5%"}, - {"tpms_adaptive_gradient", "linear"}, + {"adaptive_infill_mode", adaptive}, + {"adaptive_infill_interior_density", "5%"}, + {"adaptive_infill_gradient", "linear"}, {"layer_height", 0.4}, {"initial_layer_print_height", 0.4}}); }; @@ -2089,9 +2111,9 @@ TEST_CASE("Adaptive TPMS infill of a tall object is sparsest at its middle heigh Slic3r::Test::init_and_process_print({make_cube(30., 30., 90.)}, print, {{"sparse_infill_pattern", "tpmsd"}, {"sparse_infill_density", "25%"}, - {"tpms_adaptive", "lobes"}, - {"tpms_interior_density", "5%"}, - {"tpms_adaptive_gradient", "linear"}, + {"adaptive_infill_mode", "lobes"}, + {"adaptive_infill_interior_density", "5%"}, + {"adaptive_infill_gradient", "linear"}, {"layer_height", 0.4}, {"initial_layer_print_height", 0.4}}); const Polygons core = centered_square(5.); @@ -2111,9 +2133,9 @@ TEST_CASE("2D adaptive TPMS infill does not change along its axis", "[Fill]") Slic3r::Test::init_and_process_print({along_x ? make_cube(90., 30., 30.) : make_cube(30., 30., 90.)}, print, {{"sparse_infill_pattern", "gyroid"}, {"sparse_infill_density", "25%"}, - {"tpms_adaptive", adaptive}, - {"tpms_interior_density", "5%"}, - {"tpms_adaptive_gradient", "linear"}, + {"adaptive_infill_mode", adaptive}, + {"adaptive_infill_interior_density", "5%"}, + {"adaptive_infill_gradient", "linear"}, {"layer_height", 0.4}, {"initial_layer_print_height", 0.4}}); }; @@ -2147,9 +2169,9 @@ TEST_CASE("Adaptive TPMS shells and blend keep the whole deep core of a tall obj Slic3r::Test::init_and_process_print({make_cube(30., 30., 90.)}, print, {{"sparse_infill_pattern", "tpmsd"}, {"sparse_infill_density", "25%"}, - {"tpms_adaptive", adaptive}, - {"tpms_interior_density", "5%"}, - {"tpms_adaptive_gradient", "linear"}, + {"adaptive_infill_mode", adaptive}, + {"adaptive_infill_interior_density", "5%"}, + {"adaptive_infill_gradient", "linear"}, {"layer_height", 0.4}, {"initial_layer_print_height", 0.4}}); }; @@ -2179,9 +2201,9 @@ TEST_CASE("Adaptive TPMS infill is sparse at the center of both of two united sp Slic3r::Test::init_and_process_print({TriangleMesh(spheres)}, print, {{"sparse_infill_pattern", "gyroid"}, {"sparse_infill_density", "25%"}, - {"tpms_adaptive", adaptive}, - {"tpms_interior_density", "5%"}, - {"tpms_adaptive_gradient", "linear"}, + {"adaptive_infill_mode", adaptive}, + {"adaptive_infill_interior_density", "5%"}, + {"adaptive_infill_gradient", "linear"}, {"layer_height", 0.4}, {"initial_layer_print_height", 0.4}}); }; @@ -2209,9 +2231,9 @@ TEST_CASE("Adaptive TPMS gradients keep the surface density deeper in the order Slic3r::Test::init_and_process_print({Slic3r::Test::cube(40)}, print, {{"sparse_infill_pattern", "tpmsd"}, {"sparse_infill_density", "25%"}, - {"tpms_adaptive", "lobes"}, - {"tpms_interior_density", "5%"}, - {"tpms_adaptive_gradient", gradient}, + {"adaptive_infill_mode", "lobes"}, + {"adaptive_infill_interior_density", "5%"}, + {"adaptive_infill_gradient", gradient}, {"layer_height", 0.4}, {"initial_layer_print_height", 0.4}}); return sparse_infill_length(print, 0., 40., centered_square(20.)); @@ -2236,9 +2258,9 @@ TEST_CASE("Adaptive TPMS settings leave the infill unchanged when they do not ap {{"sparse_infill_pattern", pattern}, {"sparse_infill_density", "20%"}, {"layer_height", 0.2}, - {"tpms_adaptive", adaptive}, - {"tpms_interior_density", "40%"}, - {"tpms_adaptive_gradient", "exponential"}}); + {"adaptive_infill_mode", adaptive}, + {"adaptive_infill_interior_density", "40%"}, + {"adaptive_infill_gradient", "exponential"}}); const SparseInfillShape expected = sparse_infill_shape(reference); REQUIRE(expected.path_count > 0); CHECK(sparse_infill_shape(tuned).sequence == expected.sequence); @@ -2252,7 +2274,7 @@ TEST_CASE("Adaptive gyroid infill ignores the Z-buckling optimization", "[Fill]" {{"sparse_infill_pattern", "gyroid"}, {"sparse_infill_density", "10%"}, {"gyroid_optimized", gyroid_optimized}, - {"tpms_adaptive", "lobes"}, + {"adaptive_infill_mode", "lobes"}, {"layer_height", 0.2}}); return sparse_infill_shape(print); }; @@ -2268,10 +2290,10 @@ TEST_CASE("Adaptive TPMS infill of a region matches the infill of a larger regio // An 80 x 80 x 40 mm box around both regions, which share its radial field. const ExPolygons box{ExPolygon(Points{Point::new_scale(60., 20.), Point::new_scale(140., 20.), Point::new_scale(140., 100.), Point::new_scale(60., 100.)})}; - std::vector slices; + std::vector slices; for (int i = 0; i < 200; ++i) slices.push_back({0.2 * i, 0.2 * (i + 1), &box}); - const TpmsRadialField field(slices, get_extents(box), TpmsAdaptiveMode::Lobes, [] {}); + const AdaptiveInfillField field(slices, get_extents(box), AdaptiveInfillMode::Lobes, [] {}); auto circle = [](double radius) { Polygon contour = make_circle_num_segments(scale_(radius), 120); @@ -2285,13 +2307,13 @@ TEST_CASE("Adaptive TPMS infill of a region matches the infill of a larger regio filler->spacing = 0.45; filler->angle = float(M_PI / 7.); filler->z = z; - filler->tpms_radial_field = &field; + filler->adaptive_infill_field = &field; FillParams params; params.density = 0.2f; - params.tpms_adaptive = TpmsAdaptiveMode::Lobes; - params.tpms_interior_density = 0.05f; - params.tpms_adaptive_gradient = TpmsAdaptiveGradient::Linear; + params.adaptive_infill_mode = AdaptiveInfillMode::Lobes; + params.adaptive_infill_interior_density = 0.05f; + params.adaptive_infill_gradient = AdaptiveInfillGradient::Linear; params.layer_height = 0.2; params.dont_adjust = true; Surface surface(stInternal, expolygon); @@ -2328,8 +2350,8 @@ TEST_CASE("Adaptive TPMS anchors match the printed infill", "[Fill][InternalBrid Slic3r::Test::init_and_process_print({Slic3r::Test::cube(30)}, print, {{"sparse_infill_pattern", pattern}, {"sparse_infill_density", "25%"}, - {"tpms_adaptive", "lobes"}, - {"tpms_interior_density", "5%"}, + {"adaptive_infill_mode", "lobes"}, + {"adaptive_infill_interior_density", "5%"}, {"layer_height", 0.2}, {"initial_layer_print_height", 0.2}, {"resolution", 0.012}}); @@ -2353,3 +2375,133 @@ TEST_CASE("Adaptive TPMS anchors match the printed infill", "[Fill][InternalBrid max_distance = std::max(max_distance, printed_tree.distance_from_lines(point)); CHECK(unscale(max_distance) <= 0.012); } + +TEST_CASE("Infill lines whose ends are next to each other join into one path", "[Fill]") +{ + // An out-and-back pair 1 mm apart, as multiline infill leaves, and a line 19 mm away. + Polylines lines { Polyline(Point::new_scale(0., 0.), Point::new_scale(10., 0.)), Polyline(Point::new_scale(0., 1.), Point::new_scale(10., 1.)), + Polyline(Point::new_scale(0., 20.), Point::new_scale(10., 20.)) }; + join_close_ends(lines, scale_(1.5), true); + + REQUIRE(lines.size() == 2); + const auto joined = std::find_if(lines.begin(), lines.end(), [](const Polyline &pl) { return pl.size() == 4; }); + REQUIRE(joined != lines.end()); + // Both lines plus the 1 mm between them, joined at one end only, as joining the other end too would close a loop. + CHECK_THAT(unscale(joined->length()), Catch::Matchers::WithinAbs(21., 1e-6)); + CHECK(joined->first_point() != joined->last_point()); +} + +TEST_CASE("Joined infill lines print each line once", "[Fill]") +{ + // The middle line comes first and both of its ends get joined, so the group has to be walked from an outer line. + Polylines lines { Polyline(Point::new_scale(0., 0.), Point::new_scale(10., 0.)), Polyline(Point::new_scale(0., 1.), Point::new_scale(10., 1.)), + Polyline(Point::new_scale(10., -1.), Point::new_scale(0., -1.)) }; + join_close_ends(lines, scale_(1.5), true); + + REQUIRE(lines.size() == 1); + CHECK(lines.front().size() == 6); + // Three 10 mm lines and two 1 mm joins. + CHECK_THAT(unscale(lines.front().length()), Catch::Matchers::WithinAbs(32., 1e-6)); +} + +TEST_CASE("Infill line ends are not joined across another line", "[Fill]") +{ + // A pair 1 mm apart whose left ends have a third line running between them, which a join there would cross. + Polylines lines { Polyline(Point::new_scale(0., 0.), Point::new_scale(10., 0.)), Polyline(Point::new_scale(0., 1.), Point::new_scale(10., 1.)), + Polyline(Point::new_scale(-5., 0.5), Point::new_scale(5., 0.5)) }; + join_close_ends(lines, scale_(1.5), true); + + REQUIRE(lines.size() == 2); + const auto joined = std::find_if(lines.begin(), lines.end(), [](const Polyline &pl) { return pl.size() == 4; }); + REQUIRE(joined != lines.end()); + // Joined on the right, where nothing is in between, so the left ends stay open. + CHECK(joined->first_point().x() == 0); + CHECK(joined->last_point().x() == 0); +} + +TEST_CASE("Infill lines that cannot reverse join only end to start", "[Fill]") +{ + const Point a(Point::new_scale(0., 0.)), b(Point::new_scale(10., 0.)), c(Point::new_scale(10., 1.)), d(Point::new_scale(0., 1.)); + SECTION("Ends that would need a reversal stay apart") { + Polylines lines { Polyline(a, b), Polyline(d, c) }; + join_close_ends(lines, scale_(1.5), false); + CHECK(lines.size() == 2); + } + SECTION("The end of one line joins the start of the next, both kept in their direction") { + Polylines lines { Polyline(c, d), Polyline(a, b) }; + join_close_ends(lines, scale_(1.5), false); + REQUIRE(lines.size() == 1); + const Points &points = lines.front().points; + REQUIRE(points.size() == 4); + auto position = [&points](const Point &p) { return std::find(points.begin(), points.end(), p) - points.begin(); }; + CHECK(position(a) < position(b)); + CHECK(position(c) < position(d)); + } +} + +// Orca: the top surface fills of the topmost layer, which keep their order, each as its extrusions in print order. +static std::vector> top_surface_fills(const Print &print) +{ + std::vector> fills; + for (const LayerRegion *region : print.objects().front()->layers().back()->regions()) + for (const ExtrusionEntity *entity : region->fills.entities) + if (auto *fill = dynamic_cast(entity); fill && fill->no_sort) + if (std::any_of(fill->entities.begin(), fill->entities.end(), [](const ExtrusionEntity *ee) { return ee->role() == erTopSolidInfill; })) + fills.emplace_back(fill->entities.begin(), fill->entities.end()); + return fills; +} + +static double travel_between(const std::vector &extrusions) +{ + double travel = 0.; + for (size_t i = 1; i < extrusions.size(); ++ i) + travel += unscale((extrusions[i]->first_point() - extrusions[i - 1]->last_point()).cast().norm()); + return travel; +} + +TEST_CASE("Monotonic line top surfaces print their gap fill next to their lines and keep the lines in order", "[Fill]") +{ + // The slanted legs of the letter A leave gap fill along the walls where the lines end. + auto slice_letter = [](Print &print, Model &model, const char *gap_fill_target) { + auto config = DynamicPrintConfig::full_print_config(); + config.set_deserialize_strict({{"top_surface_pattern", "monotonicline"}, + {"gap_fill_target", gap_fill_target}, + {"filter_out_gap_fill", 0}, + {"top_shell_layers", 3}, + {"layer_height", 0.2}, + {"initial_layer_print_height", 0.2}}); + Slic3r::Test::init_print({Slic3r::Test::TestMesh::A}, print, model, config); + print.process(); + }; + Print print_without, print_with; + Model model_without, model_with; + slice_letter(print_without, model_without, "nowhere"); + slice_letter(print_with, model_with, "topbottom"); + const auto without = top_surface_fills(print_without); + const auto with = top_surface_fills(print_with); + REQUIRE(with.size() == without.size()); + + auto is_gap_fill = [](const ExtrusionEntity *ee) { return ee->role() == erGapFill; }; + size_t gap_fills = 0, gap_fills_before_a_line = 0; + for (size_t i = 0; i < with.size(); ++ i) { + std::vector lines, gaps; + std::partition_copy(with[i].begin(), with[i].end(), std::back_inserter(gaps), std::back_inserter(lines), is_gap_fill); + const auto last_line = std::find_if_not(with[i].rbegin(), with[i].rend(), is_gap_fill); + gap_fills += gaps.size(); + gap_fills_before_a_line += std::count_if(last_line, with[i].rend(), is_gap_fill); + // The lines are those of the surface without gap fill, in the same order and direction. + REQUIRE(lines.size() == without[i].size()); + for (size_t j = 0; j < lines.size(); ++ j) { + CHECK(lines[j]->first_point() == without[i][j]->first_point()); + CHECK(lines[j]->last_point() == without[i][j]->last_point()); + } + // Printed where they are, the gap fills travel less than printed after the last line. + if (! gaps.empty()) { + std::vector appended = lines; + appended.insert(appended.end(), gaps.begin(), gaps.end()); + CHECK(travel_between(with[i]) < travel_between(appended)); + } + } + REQUIRE(gap_fills > 0); + CHECK(gap_fills_before_a_line > 0); +} diff --git a/tests/fff_print/test_gcode.cpp b/tests/fff_print/test_gcode.cpp index bfdb760dd3..b99289cc29 100644 --- a/tests/fff_print/test_gcode.cpp +++ b/tests/fff_print/test_gcode.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include "libslic3r/BoundingBox.hpp" #include "libslic3r/Config.hpp" @@ -18,11 +19,14 @@ #include "libslic3r/TriangleMesh.hpp" #include "libslic3r/Point.hpp" +#include "libslic3r/libslic3r.h" +#include #include -#include #include #include #include +#include +#include #include #include #include @@ -223,6 +227,54 @@ TEST_CASE("The G-code header names the first object's filament when printing by CHECK(header_value("first_layer_temperature") == 250); } +// A filament that starts above the first layer, such as a support interface, never touches the bed. Heating the +// bed to its temperature would soften the filament the part stands on, so only first layer filaments count. +TEST_CASE("The highest temperature bed formula ignores filaments that start above the first layer", "[GCode]") +{ + // Filament 1: bed 65 on the first layer, 60 after it. Filament 2: bed 100. A 30 mm cap on a 10 mm tall stem prints + // with filament 1 and is supported from the bed, the support with filament 1 and its interface under the cap + // with filament 2. + TriangleMesh mesh = make_cube(10, 10, 10); + mesh.translate(10, 10, 0); + TriangleMesh cap = make_cube(30, 30, 2); + cap.translate(0, 0, 10); + mesh.merge(cap); + DynamicPrintConfig config = Test::multifilament_config(2, { + {"bed_temperature_formula", "by_highest_temp"}, + {"enable_prime_tower", 0}, + {"enable_support", 1}, + {"support_filament", 1}, + {"support_interface_filament", 2}, + {"supertack_plate_temp_initial_layer", "65,100"}, + {"cool_plate_temp_initial_layer", "65,100"}, + {"textured_cool_plate_temp_initial_layer", "65,100"}, + {"eng_plate_temp_initial_layer", "65,100"}, + {"hot_plate_temp_initial_layer", "65,100"}, + {"textured_plate_temp_initial_layer", "65,100"}, + {"supertack_plate_temp", "60,100"}, + {"cool_plate_temp", "60,100"}, + {"textured_cool_plate_temp", "60,100"}, + {"eng_plate_temp", "60,100"}, + {"hot_plate_temp", "60,100"}, + {"textured_plate_temp", "60,100"}, + {"skirt_loops", 0}, + {"brim_type", "no_brim"}, + }); + const std::string gcode = Test::slice({mesh}, config); + REQUIRE(gcode.find("\nT1") != std::string::npos); + + std::vector bed_temps; + std::istringstream lines(gcode); + for (std::string line; std::getline(lines, line);) + if (line.rfind("M140 S", 0) == 0 || line.rfind("M190 S", 0) == 0) + bed_temps.push_back(std::stoi(line.substr(6))); + INFO("bed temperatures: " << Catch::Detail::stringify(bed_temps)); + REQUIRE_FALSE(bed_temps.empty()); + CHECK(bed_temps.front() == 65); + CHECK(std::find(bed_temps.begin(), bed_temps.end(), 60) != bed_temps.end()); + CHECK(std::find(bed_temps.begin(), bed_temps.end(), 100) == bed_temps.end()); +} + TEST_CASE("Object label comments number each object and copy with or without exclude object", "[GCode]") { // repetier has no exclude-object commands, so set_object_info() writes nothing for it. @@ -260,6 +312,40 @@ TEST_CASE("Object label comments number each object and copy with or without exc } } +TEST_CASE("Sparse infill only arc fitting emits arcs in the sparse infill alone", "[GCode]") +{ + const auto arcs_per_type = [](const char *arc_fitting) { + // 360 facets keep the walls and the concentric infill within the resolution of a circle, so both fit arcs. + const std::string gcode = Test::slice({ make_cylinder(25.0, 10.0, 2.0 * PI / 360.0) }, { + { "enable_arc_fitting", arc_fitting }, + { "sparse_infill_pattern", "concentric" }, + { "sparse_infill_density", "20%" }, + { "z_hop", "0" }, + }); + std::map arcs; + std::istringstream input(gcode); + std::string line, type; + while (std::getline(input, line)) { + if (line.rfind(";TYPE:", 0) == 0) + type = line.substr(6); + else if (line.rfind("G2 ", 0) == 0 || line.rfind("G3 ", 0) == 0) + ++arcs[type]; + } + return arcs; + }; + + CHECK(arcs_per_type("enabled").count("Outer wall") == 1); + + const std::map sparse_only = arcs_per_type("sparse_infill"); + CHECK(sparse_only.count("Sparse infill") == 1); + for (const auto &[type, count] : sparse_only) { + INFO(type << ": " << count << " arcs"); + CHECK(type == "Sparse infill"); + } + + CHECK(arcs_per_type("disabled").empty()); +} + TEST_CASE("An exported G-code's settings load back as the settings it was sliced with", "[GCode]") { // Two filaments, so the config block carries the flush matrix already multiplied by flush_multiplier. diff --git a/tests/fff_print/test_gcode_timing.cpp b/tests/fff_print/test_gcode_timing.cpp index b3388340dc..cb1b2c4062 100644 --- a/tests/fff_print/test_gcode_timing.cpp +++ b/tests/fff_print/test_gcode_timing.cpp @@ -2,15 +2,18 @@ #include #include +#include #include #include #include "libslic3r/GCode/GCodeProcessor.hpp" #include "libslic3r/MultiNozzleUtils.hpp" #include "libslic3r/PrintConfig.hpp" +#include "libslic3r/libslic3r.h" #include "libslic3r/Utils.hpp" #include "test_utils.hpp" +#include #include #include #include @@ -30,6 +33,7 @@ namespace Slic3r { enum ExtrusionRole : uint8_t; } using namespace Slic3r; using Catch::Matchers::WithinAbs; +using Catch::Matchers::WithinRel; // Regression coverage for filament/tool-change time being folded into the first // pending motion block (an extrusion move) instead of the tool-change move, and @@ -570,6 +574,33 @@ double planned_corner_speed(GCodeFlavor flavor, double corner_velocity, double j } // namespace +TEST_CASE("Klipper extrusion ratio changes use its own corner velocity, not E jerk", "[GCodeTiming][JunctionDeviation]") +{ + const double jerk_e = GENERATE(0.0, 100.0); + auto config = make_junction_config(gcfKlipper, 5.0, 0.0); + config.machine_max_jerk_e.values = {jerk_e, jerk_e}; + GCodeProcessor processor; + run_processor(processor, config, + "G90\nM83\nSET_VELOCITY_LIMIT ACCEL=1000 MINIMUM_CRUISE_RATIO=0\n" + "G1 X20 Y60 F6000\nM400\n" + "G1 X60 Y60 E0.8 F6000\nG1 X100 Y60 E1.6 F6000\nM400\n"); + // A 0.02 -> 0.04 extrusion ratio change is capped at 1 / 0.02 = 50 mm/s. + REQUIRE_THAT(corner_speed(processor.get_result()), Catch::Matchers::WithinAbs(50.0, 0.01)); +} + +TEST_CASE("Klipper legacy smoothing stays absolute across acceleration changes", "[GCodeTiming][Klipper]") +{ + const bool modern = GENERATE(false, true); + auto config = make_junction_config(gcfKlipper, 5.0, 0.0); + const std::string gcode = std::string("G90\nSET_VELOCITY_LIMIT ACCEL=1000 ") + + (modern ? "MINIMUM_CRUISE_RATIO=0.75\n" : "ACCEL_TO_DECEL=250\n") + + "G1 X40 F30000\nM400\nM204 S2000\nG1 X0\nM400\n"; + GCodeProcessor processor; + run_processor(processor, config, gcode.c_str()); + const double expected = modern ? 0.5 + 0.25 * std::sqrt(2.0) : 0.95; + REQUIRE_THAT(processor.get_time(PrintEstimatedStatistics::ETimeMode::Normal), WithinAbs(expected, 1e-5)); +} + TEST_CASE("Klipper corners are planned with junction deviation derived from the square corner velocity", "[GCodeTiming][JunctionDeviation]") { @@ -669,3 +700,172 @@ TEST_CASE("How fast a corner is taken does not depend on how much is extruded th Catch::Matchers::WithinRel(marlin, 0.02)); } } + +// Expected times are Klipper's own planner math (klippy/toolhead.py). For a move from rest to rest, +// LookAheadQueue.flush() reduces to cruise_v2 = min(vmax^2, d * accel, d * pseudo_accel) with +// pseudo_accel = accel * (1 - minimum_cruise_ratio), and Move.set_junction() to a trapezoid at accel; +// a move too short to reach its speed still spends that ratio of its length cruising. +namespace { + +constexpr double klipper_accel = 1000.0; // make_junction_config's acceleration +constexpr double klipper_cruise_ratio = 0.5; +constexpr double klipper_pseudo_accel = klipper_accel * (1.0 - klipper_cruise_ratio); + +// Time of a move that starts and ends at rest. +double rest_to_rest_time(double distance, double max_speed, double accel, double pseudo_accel) +{ + const double cruise_v2 = std::min(sqr(max_speed), distance * pseudo_accel); + const double cruise = std::sqrt(cruise_v2); + return 2.0 * cruise / accel + (distance - cruise_v2 / accel) / cruise; +} + +// Every run states the cruise ratio rather than relying on the estimator's built-in default. +void run_klipper(GCodeProcessor& proc, const std::string& gcode, + const FullPrintConfig& config = make_junction_config(gcfKlipper, 5.0, 0.0)) +{ + const std::string limits = "SET_VELOCITY_LIMIT MINIMUM_CRUISE_RATIO=" + std::to_string(klipper_cruise_ratio) + "\n"; + run_processor(proc, config, (limits + gcode).c_str()); +} + +double klipper_time(const std::string& gcode, const FullPrintConfig& config = make_junction_config(gcfKlipper, 5.0, 0.0)) +{ + GCodeProcessor proc; + run_klipper(proc, gcode, config); + return proc.get_time(PrintEstimatedStatistics::ETimeMode::Normal); +} + +double time_after_retract(const GCodeProcessorResult& r) +{ + double t = 0.0; + bool after = false; + for (const auto& mv : r.moves) { + if (mv.type == EMoveType::Retract) + after = true; + else if (after) + t += mv.time[NORMAL]; + } + return t; +} + +} // namespace + +TEST_CASE("A straight line split into short segments is planned as one move", "[GCodeTiming][Klipper]") +{ + // 100 mm at 50 mm/s queues 2 s of motion, so the look-ahead flushes lazily part-way along the + // line; at 10 mm/s^2 the ramps span many segments and the cruise ratio caps the speed. + const int segments = GENERATE(1, 100, 1000); + std::ostringstream gcode; + gcode << "SET_VELOCITY_LIMIT ACCEL=10\n" << std::fixed << std::setprecision(3); + for (int i = 1; i <= segments; ++i) + gcode << "G1 X" << 100.0 * i / segments << " F3000\n"; + REQUIRE_THAT(klipper_time(gcode.str()), + WithinRel(rest_to_rest_time(100.0, 50.0, 10.0, 10.0 * (1.0 - klipper_cruise_ratio)), 1e-6)); +} + +TEST_CASE("Where the look-ahead flushes does not change the estimate", "[GCodeTiming][Klipper]") +{ + // A retraction stops the toolhead, so the zig-zag after it is planned on its own; the straight run + // before it only shifts where the queue flushes lazily (1 s of motion after a stop, then every 0.15 s). + auto zigzag_time = [](int run_moves) { + std::string gcode = "M83\nG91\n"; + for (int i = 0; i < run_moves; ++i) + gcode += "G1 X1 F6000\n"; + gcode += "G1 E-1 F2400\n"; + const char* moves[] = {"G1 X2 F3000\n", "G1 Y2 F9000\n", "G1 X2 F1200\n", "G1 Y-2 F9000\n"}; + for (int i = 0; i < 24; ++i) + gcode += moves[i % 4]; + GCodeProcessor proc; + run_klipper(proc, gcode); + return time_after_retract(proc.get_result()); + }; + const double reference = zigzag_time(0); + REQUIRE(reference > 0.0); + for (int run_moves : {30, 80, 105, 130}) { + INFO("run moves = " << run_moves); + REQUIRE_THAT(zigzag_time(run_moves), WithinAbs(reference, 1e-9)); + } +} + +TEST_CASE("A short move into a corner is limited by the centripetal term, not the corner velocity", + "[GCodeTiming][Klipper]") +{ + // A 50 mm/s square corner velocity allows 50 mm/s through the right angle; the 1 mm move into it + // allows sqrt(0.5 * 1 * 1000 * tan(45 deg)) = 22.4 mm/s (Move.calc_junction's move_centripetal_v2). + GCodeProcessor proc; + run_klipper(proc, "G90\nG1 X59 Y60 F6000\nM400\nG1 X60 Y60 F9000\nG1 X60 Y100 F9000\n", + make_junction_config(gcfKlipper, 50.0, 0.0)); + REQUIRE_THAT(corner_speed(proc.get_result()), WithinRel(std::sqrt(500.0), 1e-6)); +} + +TEST_CASE("A corner keeps the square corner velocity when the acceleration changes between its moves", + "[GCodeTiming][Klipper]") +{ + GCodeProcessor proc; + run_klipper(proc, "G90\nG1 X20 Y60 F6000\nM400\nG1 X60 Y60 F9000\nM204 S4000\nG1 X60 Y100 F9000\n"); + REQUIRE_THAT(corner_speed(proc.get_result()), WithinRel(5.0, 1e-6)); +} + +TEST_CASE("A retraction stops the toolhead and runs at the extruder's own limits", "[GCodeTiming][Klipper]") +{ + // An E acceleration of 0 is unset, and the retraction then uses the retract acceleration. + const auto [e_accel, retract_accel] = GENERATE(table({{20000.0, 20000.0}, {0.0, 3000.0}})); + auto config = make_junction_config(gcfKlipper, 5.0, 0.0); + config.machine_max_acceleration_e.values = {e_accel, e_accel}; + config.machine_max_acceleration_retracting.values = {3000.0, 3000.0}; + GCodeProcessor proc; + run_klipper(proc, "G90\nM83\nG1 X60 Y60 F9000\nG1 E-1 F2400\nG1 X100 Y60 F9000\n", config); + REQUIRE_THAT(corner_speed(proc.get_result()), WithinAbs(0.0, 1e-6)); + const double expected = rest_to_rest_time(std::sqrt(2.0) * 60.0, 150.0, klipper_accel, klipper_pseudo_accel) + + rest_to_rest_time(1.0, 40.0, retract_accel, std::min(retract_accel, klipper_pseudo_accel)) + + rest_to_rest_time(40.0, 150.0, klipper_accel, klipper_pseudo_accel); + REQUIRE_THAT(proc.get_time(PrintEstimatedStatistics::ETimeMode::Normal), WithinRel(expected, 1e-6)); +} + +TEST_CASE("Extruder limits apply to retractions, not to extrusion along a path", "[GCodeTiming][Klipper]") +{ + auto config = make_junction_config(gcfKlipper, 5.0, 0.0); + config.machine_max_speed_e.values = {10.0, 10.0}; + config.machine_max_acceleration_e.values = {10.0, 10.0}; + REQUIRE_THAT(klipper_time("M83\nG1 X40 E20 F30000\n", config), + WithinRel(rest_to_rest_time(40.0, 500.0, klipper_accel, klipper_pseudo_accel), 1e-6)); + REQUIRE_THAT(klipper_time("M83\nG1 E-1 F2400\n", config), + WithinRel(rest_to_rest_time(1.0, 10.0, 10.0, 10.0), 1e-6)); +} + +TEST_CASE("A Z move is limited by the Z axis speed and acceleration", "[GCodeTiming][Klipper]") +{ + auto config = make_junction_config(gcfKlipper, 5.0, 0.0); + config.machine_max_speed_z.values = {20.0, 20.0}; + config.machine_max_acceleration_z.values = {100.0, 100.0}; + REQUIRE_THAT(klipper_time("G1 Z10 F1200\n", config), + WithinRel(rest_to_rest_time(10.0, 20.0, 100.0, 100.0), 1e-6)); +} + +TEST_CASE("M204 sets the acceleration from S, or the smaller of P and T", "[GCodeTiming][Klipper]") +{ + const char* m204 = GENERATE("M204 S500", "M204 P500 T2000", "M204 P2000 T500"); + REQUIRE_THAT(klipper_time(std::string(m204) + "\nG1 X100 F30000\n"), + WithinRel(rest_to_rest_time(100.0, 500.0, 500.0, 500.0 * (1.0 - klipper_cruise_ratio)), 1e-6)); +} + +TEST_CASE("SET_VELOCITY_LIMIT applies every limit on the line and ignores the comment", "[GCodeTiming][Klipper]") +{ + REQUIRE_THAT(klipper_time("SET_VELOCITY_LIMIT VELOCITY=80 ACCEL=500 MINIMUM_CRUISE_RATIO=0.2 ; ACCEL=9999\n" + "G1 X20 F30000\n"), + WithinRel(rest_to_rest_time(20.0, 80.0, 500.0, 500.0 * (1.0 - 0.2)), 1e-6)); +} + +TEST_CASE("ACCEL_TO_DECEL is ignored on a line that also sets the minimum cruise ratio", "[GCodeTiming][Klipper]") +{ + // Klipper 0.13 prefers the cruise ratio and later releases no longer read ACCEL_TO_DECEL at all. + // ACCEL_TO_DECEL comes last, so applying the parameters in line order would let it win. + REQUIRE_THAT(klipper_time("SET_VELOCITY_LIMIT MINIMUM_CRUISE_RATIO=" + std::to_string(klipper_cruise_ratio) + + " ACCEL_TO_DECEL=100\nG1 X40 F30000\n"), + WithinRel(rest_to_rest_time(40.0, 500.0, klipper_accel, klipper_pseudo_accel), 1e-6)); +} + +TEST_CASE("M400 without a delay waits for the queue to drain", "[GCodeTiming][Klipper]") +{ + REQUIRE_THAT(klipper_time("G90\nG1 X40 F30000\nM400\nG1 X80\n"), + WithinRel(2.0 * rest_to_rest_time(40.0, 500.0, klipper_accel, klipper_pseudo_accel), 1e-6)); +} diff --git a/tests/fff_print/test_gcodeprocessor.cpp b/tests/fff_print/test_gcodeprocessor.cpp index 48cf3e8ae9..f57bd0895a 100644 --- a/tests/fff_print/test_gcodeprocessor.cpp +++ b/tests/fff_print/test_gcodeprocessor.cpp @@ -282,6 +282,48 @@ TEST_CASE("A seam takes the actual speed of the move it follows", "[GCodeProcess REQUIRE(seams > 0); } +TEST_CASE("A pause keeps the moves around it in order and on their own layers", "[GCodeProcessor][Regression]") +{ + // libvgcode numbers layers from the order of the moves, so the moves around a pause must stay in layer and + // line order. The pause vertex itself moves to the first extrusion after it and keeps its own line. + std::ostringstream gcode; + gcode << "M83\nG90\n"; + for (int layer = 1; layer <= 3; ++layer) { + gcode << "; CHANGE_LAYER\n; LAYER_HEIGHT: 0.2\n"; + if (layer == 2) + gcode << "G1 E-0.8 F3000\n; PAUSE_PRINTING\nM601\n"; + gcode << "G1 X10 Y10 F12000\nG1 Z" << 0.2 * layer << "\n"; + if (layer == 2) + gcode << "G1 E0.8 F3000\n"; + gcode << "; FEATURE: Outer wall\n" + << "G1 X50 Y10 E2 F3000\nG1 X50 Y50 E2\nG1 X10 Y50 E2\nG1 X10 Y10 E2\n"; + } + GCodeProcessorResult result; + process_gcode(gcode.str(), result); + const auto &moves = result.moves; + + REQUIRE(result.custom_gcode_per_print_z.size() == 1); + CHECK_THAT(result.custom_gcode_per_print_z.front().print_z, Catch::Matchers::WithinAbs(0.4, 1e-4)); + REQUIRE(std::count_if(moves.begin(), moves.end(), [](const auto &move) { return move.internal_only; }) > 0); + + const auto pause = std::find_if(moves.begin(), moves.end(), [](const auto &move) { return move.type == EMoveType::Pause_Print; }); + REQUIRE(pause != moves.end()); + CHECK(pause->layer_id == 1); + CHECK_THAT(pause->position.z(), Catch::Matchers::WithinAbs(0.4f, 1e-4f)); + + const GCodeProcessorResult::MoveVertex *previous = nullptr; + for (const auto &move : moves) { + if (move.type == EMoveType::Pause_Print) + continue; + if (previous != nullptr) { + CAPTURE(previous->gcode_id, move.gcode_id, static_cast(move.type)); + CHECK(move.layer_id >= previous->layer_id); + CHECK(move.gcode_id >= previous->gcode_id); + } + previous = &move; + } +} + TEST_CASE("Line ends of the exported G-code mark every newline in the file", "[GCodeProcessor]") { struct Case diff --git a/tests/fff_print/test_gcodewriter.cpp b/tests/fff_print/test_gcodewriter.cpp index e101849e5e..840b41bfc1 100644 --- a/tests/fff_print/test_gcodewriter.cpp +++ b/tests/fff_print/test_gcodewriter.cpp @@ -514,7 +514,7 @@ TEST_CASE("Acceleration and velocity limit commands print their values in genera const Case c = GENERATE(values({ {gcfKlipper, Command::KlipperLimits, 2000000, 25. / 3., false, {"SET_VELOCITY_LIMIT ACCEL=2000000 ", "ACCEL_TO_DECEL=1e+06 ", "SQUARE_CORNER_VELOCITY=8.33333\n"}, {}}, - {gcfKlipper, Command::KlipperLimits, 12345, 0., false, {"ACCEL=12345 ", "ACCEL_TO_DECEL=6172.5\n"}, {"SQUARE_CORNER_VELOCITY"}}, + {gcfKlipper, Command::KlipperLimits, 12345, 0., false, {"ACCEL=12345 ", "ACCEL_TO_DECEL=6172.5 ", "MINIMUM_CRUISE_RATIO=0.5\n"}, {"SQUARE_CORNER_VELOCITY"}}, {gcfKlipper, Command::KlipperLimits, 0, 0.25, true, {"SQUARE_CORNER_VELOCITY=0.25 ", "; adjust VELOCITY_LIMIT"}, {"ACCEL"}}, {gcfKlipper, Command::Print, 3001, 0., true, {"ACCEL=3001 ", "ACCEL_TO_DECEL=1500.5 ", "; adjust ACCEL_TO_DECEL", "; adjust acceleration"}, {}}, {gcfMarlinFirmware, Command::Print, 2500, 0., false, {"M204 P2500\n"}, {}}, @@ -1272,6 +1272,41 @@ TEST_CASE("Custom G-code motion limits are restored before generated moves", "[G REQUIRE(gcode.find("M205 X8 Y8 ; adjust jerk", custom_gcode_pos) != std::string::npos); } +TEST_CASE("Klipper acceleration commands send accel_to_decel both as ACCEL_TO_DECEL and as the cruise ratio", "[GCodeWriter]") +{ + // Klipper 0.13 defines MINIMUM_CRUISE_RATIO = 1 - ACCEL_TO_DECEL / ACCEL; older releases read only the + // first parameter and current ones only the second, so both have to describe the same limit. + GCodeWriter writer; + writer.config.gcode_flavor.value = gcfKlipper; + writer.config.accel_to_decel_enable.value = true; + // The writer appends "; adjust ..." comments by default; keep them out so the line ends at the ratio. + struct CommentGuard + { + bool saved = GCodeWriter::full_gcode_comment; + ~CommentGuard() { GCodeWriter::full_gcode_comment = saved; } + } comment_guard; + GCodeWriter::full_gcode_comment = false; + + SECTION("a 25% factor") { + writer.config.accel_to_decel_factor.value = 25; + REQUIRE_THAT(writer.set_print_acceleration(2000), + Catch::Matchers::StartsWith("SET_VELOCITY_LIMIT ACCEL=2000 ACCEL_TO_DECEL=500 MINIMUM_CRUISE_RATIO=0.75")); + REQUIRE_THAT(writer.set_accel_and_jerk(3000, 0.0), + Catch::Matchers::StartsWith("SET_VELOCITY_LIMIT ACCEL=3000 ACCEL_TO_DECEL=750 MINIMUM_CRUISE_RATIO=0.75")); + } + SECTION("a 100% factor turns the cruise ratio off") { + writer.config.accel_to_decel_factor.value = 100; + REQUIRE_THAT(writer.set_print_acceleration(2000), + Catch::Matchers::StartsWith("SET_VELOCITY_LIMIT ACCEL=2000 ACCEL_TO_DECEL=2000 MINIMUM_CRUISE_RATIO=0\n")); + } + SECTION("neither is sent while the option is off") { + writer.config.accel_to_decel_enable.value = false; + const std::string line = writer.set_print_acceleration(2000); + REQUIRE_THAT(line, Catch::Matchers::StartsWith("SET_VELOCITY_LIMIT ACCEL=2000")); + REQUIRE_THAT(line, !Catch::Matchers::ContainsSubstring("ACCEL_TO_DECEL") && !Catch::Matchers::ContainsSubstring("MINIMUM_CRUISE_RATIO")); + } +} + // Regression test for the belt-printer "illegal gantry move at print start" bug. // // On a belt printer the layer-change z-hop is deferred (lazy_lift) and consumed diff --git a/tests/fff_print/test_multifilament.cpp b/tests/fff_print/test_multifilament.cpp index b7fccf2890..6557f64b2e 100644 --- a/tests/fff_print/test_multifilament.cpp +++ b/tests/fff_print/test_multifilament.cpp @@ -315,6 +315,152 @@ TEST_CASE("Per-object wall filament override is honored", "[MultiFilament]") CHECK(tools_for_role(gcode, "infill") == std::set{ 0 }); // infill not overridden: stays on F1 } +// 0-based tool indices extruding under the ";TYPE:" marker of `feature`. +static std::set tools_for_feature(const std::string& gcode, std::string_view feature) +{ + std::set tools; + int current_tool = 0; + bool in_feature = false; + GCodeReader reader; + reader.parse_buffer(gcode, [&](GCodeReader& self, const GCodeReader::GCodeLine& line) { + const std::string cmd(line.cmd()); + if (cmd.size() >= 2 && cmd[0] == 'T' && std::isdigit((unsigned char)cmd[1])) + current_tool = std::stoi(cmd.substr(1)); + else if (cmd.empty() && line.comment().substr(0, 5) == "TYPE:") + in_feature = line.comment().substr(5) == feature; + // Toolchange purges extrude in place under the previous feature's marker. + else if (in_feature && line.extruding(self) && line.dist_XY(self) > 0) + tools.insert(current_tool); + }); + return tools; +} + +// A 20x20mm slab on a 4x4mm pillar: on the slab's first layer both walls are overhangs from end to end, so +// only their wall index tells the inner wall from the outer one. +TEST_CASE("Overhanging inner walls print with the inner wall filament", "[MultiFilament]") +{ + const char *wall_generator = GENERATE("classic", "arachne"); + CAPTURE(wall_generator); + + TriangleMesh mesh = make_cube(4., 4., 5.); + mesh.translate(8.f, 8.f, 0.f); + TriangleMesh slab = make_cube(20., 20., 2.); + slab.translate(0.f, 0.f, 5.f); + mesh.merge(slab); + + const std::string gcode = slice({ mesh }, + multifilament_config(2, { + { "wall_generator", wall_generator }, + { "wall_loops", 2 }, + { "outer_wall_filament_id", 1 }, + { "inner_wall_filament_id", 2 }, + { "sparse_infill_filament_id", 1 }, + { "internal_solid_filament_id", 1 }, + { "top_surface_filament_id", 1 }, + { "bottom_surface_filament_id", 1 }, + { "detect_overhang_wall", true }, + { "extra_perimeters_on_overhangs", false }, + { "enable_support", false }, + { "skirt_loops", 0 }, + { "brim_type", "no_brim" }, + })); + CHECK(tools_for_feature(gcode, "Outer wall") == std::set{ 0 }); + CHECK(tools_for_feature(gcode, "Inner wall") == std::set{ 1 }); + CHECK(tools_for_feature(gcode, "Overhang wall") == std::set{ 0, 1 }); +} + +// Tool changes on a layer after which that tool extrudes nothing before the next tool or layer change. +static int idle_tool_changes(const std::string& gcode) +{ + int idle = 0; + bool in_layers = false, changed = false, extruded = false; + GCodeReader reader; + reader.parse_buffer(gcode, [&](GCodeReader& self, const GCodeReader::GCodeLine& line) { + const std::string cmd(line.cmd()); + const bool tool_change = cmd.size() >= 2 && cmd[0] == 'T' && std::isdigit((unsigned char)cmd[1]); + if (tool_change || line.comment() == "LAYER_CHANGE") { + if (changed && !extruded) + ++idle; + in_layers |= !tool_change; + changed = tool_change && in_layers; + extruded = false; + } else if (line.extruding(self) && line.dist_XY(self) > 0) + extruded = true; + }); + return idle + (changed && !extruded ? 1 : 0); +} + +// The fill of a top or bottom surface carries the gap fill around it, which must not move the surface to the +// internal solid filament, nor leave the surface's own filament scheduled with nothing to print. The round top and +// bottom of a cylinder leave gaps along their edge. +TEST_CASE("Top and bottom surfaces with gap fill print with their filaments", "[MultiFilament]") +{ + const std::string gcode = slice({ make_cylinder(10., 10.) }, + multifilament_config(4, { + { "wall_generator", "arachne" }, + { "gap_fill_target", "topbottom" }, + { "outer_wall_filament_id", 1 }, + { "inner_wall_filament_id", 1 }, + { "sparse_infill_filament_id", 1 }, + { "internal_solid_filament_id", 2 }, + { "top_surface_filament_id", 3 }, + { "bottom_surface_filament_id", 4 }, + { "skirt_loops", 0 }, + { "brim_type", "no_brim" }, + })); + REQUIRE_FALSE(tools_for_feature(gcode, "Gap infill").empty()); + CHECK(tools_for_feature(gcode, "Top surface") == std::set{ 2 }); + CHECK(tools_for_feature(gcode, "Bottom surface") == std::set{ 3 }); + CHECK(idle_tool_changes(gcode) == 0); +} + +// A 1.9mm plate leaves no room for sparse infill between its classic walls, only gap fill, which prints with the walls. +TEST_CASE("Gap fill between walls does not schedule the sparse infill filament", "[MultiFilament]") +{ + const std::string gcode = slice({ make_cube(20., 1.9, 5.) }, + multifilament_config(2, { + { "wall_generator", "classic" }, + { "wall_loops", 2 }, + { "outer_wall_filament_id", 1 }, + { "inner_wall_filament_id", 1 }, + { "sparse_infill_filament_id", 2 }, + { "internal_solid_filament_id", 1 }, + { "top_surface_filament_id", 1 }, + { "bottom_surface_filament_id", 1 }, + { "skirt_loops", 0 }, + { "brim_type", "no_brim" }, + })); + REQUIRE(tools_for_feature(gcode, "Gap infill") == std::set{ 0 }); + CHECK(tools_for_feature(gcode, "Sparse infill").empty()); + CHECK(idle_tool_changes(gcode) == 0); +} + +// A 20x20x2mm base carrying a 0.5mm fin: the fin's layers fit a single wall, so they must not switch to the inner +// wall filament the base uses. +TEST_CASE("A layer without inner walls does not switch to the inner wall filament", "[MultiFilament]") +{ + TriangleMesh mesh = make_cube(20., 20., 2.); + TriangleMesh fin = make_cube(20., 0.5, 5.); + fin.translate(0.f, 9.75f, 2.f); + mesh.merge(fin); + + const std::string gcode = slice({ mesh }, + multifilament_config(2, { + { "wall_generator", "arachne" }, + { "wall_loops", 2 }, + { "outer_wall_filament_id", 1 }, + { "inner_wall_filament_id", 2 }, + { "sparse_infill_filament_id", 1 }, + { "internal_solid_filament_id", 1 }, + { "top_surface_filament_id", 1 }, + { "bottom_surface_filament_id", 1 }, + { "skirt_loops", 0 }, + { "brim_type", "no_brim" }, + })); + CHECK(tools_for_feature(gcode, "Inner wall") == std::set{ 1 }); + CHECK(idle_tool_changes(gcode) == 0); +} + // FanMover's guard against splitting a G1 inside custom gcode keys off the ";_FAN_MOVER_SKIP_START/END" // markers GCode::set_extruder() must emit around change_filament_gcode's output. Direct // toolchanges and Type2's wipe-tower toolchange (append_tcr2() calls set_extruder()) both go @@ -388,6 +534,50 @@ TEST_CASE("Toolchange gcode is bracketed against FanMover splitting its moves", CHECK(count_occurrences(gcode_str, ";_FAN_MOVER_SKIP_START") <= 1); } +TEST_CASE("Filament start and end G-code get the same placeholders on every toolchange path", "[MultiFilament]") +{ + const std::string path = GENERATE(as{}, "direct", "type1"); + CAPTURE(path); + + DynamicPrintConfig config = multifilament_config(2, { + { "skirt_loops", 0 }, + { "brim_type", "no_brim" }, + }); + std::vector> per_object_overrides; + if (path == "direct") { + config.set_deserialize_strict({ { "print_sequence", "by object" } }); + per_object_overrides = { {}, { { "outer_wall_filament_id", "2" }, { "inner_wall_filament_id", "2" } } }; + } else { + config.set_deserialize_strict({ + { "enable_prime_tower", true }, + { "wipe_tower_type", "type1" }, + { "prime_tower_width", 35 }, + { "wipe_tower_x", 120 }, + { "wipe_tower_y", 120 }, + { "printable_area", "0x0,200x0,200x200,0x200" }, + }); + per_object_overrides = { { { "extruder", "1" } }, { { "extruder", "2" } } }; + } + const std::string start = "; filament start [filament_extruder_id] [layer_num] [layer_z] [max_layer_z]"; + const std::string end = "; filament end [filament_extruder_id] [layer_num] [layer_z] [max_layer_z]"; + config.set_key_value("filament_start_gcode", new ConfigOptionStrings({ start, start })); + config.set_key_value("filament_end_gcode", new ConfigOptionStrings({ end, end })); + + std::string gcode; + REQUIRE_NOTHROW(gcode = slice_with_object_overrides({ cube(20), cube(20) }, config, per_object_overrides)); + CHECK(gcode.find("\n; filament start 1 ") != std::string::npos); + if (path == "direct") { + CHECK(gcode.find("\n; filament end 0 ") != std::string::npos); + } else { + // Most layers unload filament 1, which the extruder index (always 0 on this single nozzle) can't show, + // and the end of the print adds at most one such line. + size_t unloads_of_1 = 0; + for (size_t pos = gcode.find("\n; filament end 1 "); pos != std::string::npos; pos = gcode.find("\n; filament end 1 ", pos + 1)) + ++unloads_of_1; + CHECK(unloads_of_1 > 1); + } +} + // With wait_for_temp_on_wipe_tower the blocking M109 moves from right after the Tn command to // a stop point parked beside the wipe tower (heat-up drool falls next to the tower, not onto // its top): tagged with _WAIT_FOR_TEMP_ON_WIPE_TOWER, after the toolchange and before the diff --git a/tests/fff_print/test_multimaterial_segmentation.cpp b/tests/fff_print/test_multimaterial_segmentation.cpp new file mode 100644 index 0000000000..2636d4c44b --- /dev/null +++ b/tests/fff_print/test_multimaterial_segmentation.cpp @@ -0,0 +1,90 @@ +#include +#include +#include + +#include +#include +#include + +#include "libslic3r/BoundingBox.hpp" +#include "libslic3r/Layer.hpp" +#include "libslic3r/Model.hpp" +#include "libslic3r/Print.hpp" +#include "libslic3r/PrintConfig.hpp" +#include "libslic3r/TriangleMesh.hpp" +#include "libslic3r/TriangleSelector.hpp" +#include "libslic3r/libslic3r.h" + +#include "test_helpers.hpp" + +using namespace Slic3r; + +namespace { + +// Paints the top face of `volume` with filament 2 and its bottom face with filament 3. +void paint_top_and_bottom(ModelVolume &volume) +{ + const TriangleMesh &mesh = volume.mesh(); + const BoundingBoxf3 bbox = mesh.bounding_box(); + TriangleSelector selector(mesh); + for (int i = 0; i < int(mesh.its.indices.size()); ++i) { + bool top = true, bottom = true; + for (int j = 0; j < 3; ++j) { + const double z = mesh.its.vertices[mesh.its.indices[i][j]].z(); + top = top && std::abs(z - bbox.max.z()) < EPSILON; + bottom = bottom && std::abs(z - bbox.min.z()) < EPSILON; + } + if (top) + selector.set_facet(i, EnforcerBlockerType::Extruder2); + else if (bottom) + selector.set_facet(i, EnforcerBlockerType::Extruder3); + } + REQUIRE(volume.mmu_segmentation_facets.set(selector)); +} + +size_t layers_with_filament(const PrintObject &object, int filament_id) +{ + size_t count = 0; + for (const Layer *layer : object.layers()) + for (const LayerRegion *region : layer->regions()) + if (region->region().config().outer_wall_filament_id.value == filament_id && !region->slices.empty()) { + ++count; + break; + } + return count; +} + +} // namespace + +TEST_CASE("Painted top and bottom surfaces color their paint penetration layers", "[MultiMaterialSegmentation]") +{ + // 0 follows the shell layers; other values apply as set, below or above the shell. + const auto [top_penetration, bottom_penetration, expected_top, expected_bottom] = + GENERATE(table({{0, 0, 5, 4}, {2, 3, 2, 3}, {7, 6, 7, 6}})); + CAPTURE(top_penetration, bottom_penetration); + + // A 4 mm cube at 0.2 mm layers has 20 layers, enough to keep the top and bottom bands apart. + DynamicPrintConfig config = Test::multifilament_config(3, { + {"layer_height", "0.2"}, + {"initial_layer_print_height", "0.2"}, + {"top_shell_layers", "5"}, + {"bottom_shell_layers", "4"}, + {"top_color_penetration_layers", std::to_string(top_penetration)}, + {"bottom_color_penetration_layers", std::to_string(bottom_penetration)}, + {"gcode_comments", "1"}, // Match init_print so the second apply changes only the model. + }); + + Print print; + Model model; + Test::init_print({TriangleMesh(its_make_cube(20, 20, 4))}, print, model, config); + paint_top_and_bottom(*model.objects.front()->volumes.front()); + print.apply(model, config); + + REQUIRE(print.objects().size() == 1); + PrintObject &object = *print.get_object(0); + object.slice(); + REQUIRE(object.layers().size() == 20); + + CHECK(layers_with_filament(object, 2) == expected_top); + CHECK(layers_with_filament(object, 3) == expected_bottom); +} diff --git a/tests/fff_print/test_print.cpp b/tests/fff_print/test_print.cpp index 670c2aa7c1..bd51352b60 100644 --- a/tests/fff_print/test_print.cpp +++ b/tests/fff_print/test_print.cpp @@ -22,6 +22,7 @@ #include "libslic3r/TriangleMesh.hpp" #include #include +#include #include @@ -285,6 +286,39 @@ size_t count_opt_key(const std::vector& warnings, const s [&](const StringObjectException& w) { return w.opt_key == key; }); } +DynamicPrintConfig dual_extruder_exclusion_config( + BedExcludeVolumeMode mode, + const std::vector &per_extruder, + const std::vector &filament_map = {1}) +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_num_extruders(2); + config.set_key_value("nozzle_diameter", new ConfigOptionFloats{0.4, 0.4}); + config.set_key_value("extruder_offset", new ConfigOptionPoints{Vec2d::Zero(), Vec2d(20.0, 0.0)}); + config.set_key_value("extruder_printable_height", new ConfigOptionFloatsNullable{256.0, 256.0}); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(mode)); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings(per_extruder)); + config.set_key_value("filament_map_mode", new ConfigOptionEnum(fmmManual)); + config.set_key_value("filament_map", new ConfigOptionInts(filament_map)); + return config; +} + +StringObjectException validate_multimaterial_cube(const DynamicPrintConfig &config) +{ + Model model; + ModelObject *object = model.add_object(); + ModelVolume *first = object->add_volume(cube(20)); + ModelVolume *second = object->add_volume(cube(20)); + first->config.set("extruder", 1); + second->config.set("extruder", 2); + object->add_instance(); + object->ensure_on_bed(); + + Print print; + print.apply(model, config); + return print.validate(); +} + // Make `default_acceleration` exceed the machine's extruding-acceleration limit. void trigger_acceleration_warning(DynamicPrintConfig& c) { @@ -311,6 +345,73 @@ void trigger_precise_wall_warning(DynamicPrintConfig& c) } // namespace +TEST_CASE("Print validation applies individual exclusion volumes to the mapped physical extruder", "[Print][ExclusionVolume][MultiNozzle]") +{ + const std::string colliding = "0..256;-100x-100,300x-100,300x300,-100x300"; + std::vector warnings; + + SECTION("mapped colliding extruder is rejected") { + const DynamicPrintConfig config = dual_extruder_exclusion_config( + BedExcludeVolumeMode::PerExtruder, {colliding, ""}, {1}); + const StringObjectException error = validate_cubes(config, warnings); + CHECK(error.string.find("extruder 1") != std::string::npos); + } + + SECTION("mapped clear extruder is accepted") { + const DynamicPrintConfig config = dual_extruder_exclusion_config( + BedExcludeVolumeMode::PerExtruder, {colliding, ""}, {2}); + const StringObjectException error = validate_cubes(config, warnings); + CHECK(error.string.empty()); + } + + SECTION("an unrelated nozzle exclusion does not reject the object") { + const DynamicPrintConfig config = dual_extruder_exclusion_config( + BedExcludeVolumeMode::PerExtruder, {"", colliding}, {1}); + const StringObjectException error = validate_cubes(config, warnings); + CHECK(error.string.empty()); + } +} + +TEST_CASE("Print validation applies shared exclusions and ignores volumes above the object", "[Print][ExclusionVolume]") +{ + std::vector warnings; + + SECTION("shared volume intersects") { + DynamicPrintConfig config = dual_extruder_exclusion_config(BedExcludeVolumeMode::Shared, {"", ""}, {2}); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString("0..30;-100x-100,300x-100,300x300,-100x300")); + const StringObjectException error = validate_cubes(config, warnings); + CHECK(error.string.find("extruder 2") != std::string::npos); + } + + SECTION("elevated shared volume clears a 20mm cube") { + DynamicPrintConfig config = dual_extruder_exclusion_config(BedExcludeVolumeMode::Shared, {"", ""}, {1}); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString("30..50;-100x-100,300x-100,300x300,-100x300")); + const StringObjectException error = validate_cubes(config, warnings); + CHECK(error.string.empty()); + } +} + +TEST_CASE("Legacy excluded areas retain object placement validation", "[Print][ExclusionVolume][Compatibility]") +{ + DynamicPrintConfig config = dual_extruder_exclusion_config( + BedExcludeVolumeMode::Shared, {"", ""}, {1}); + config.set_deserialize_strict("bed_exclude_area", "-100x-100,300x-100,300x300,-100x300"); + + std::vector warnings; + const StringObjectException error = validate_cubes(config, warnings); + CHECK_FALSE(error.string.empty()); +} + +TEST_CASE("Print validation checks every nozzle used by a multimaterial object", "[Print][ExclusionVolume][MultiNozzle]") +{ + const std::string colliding = "0..256;-100x-100,300x-100,300x300,-100x300"; + const DynamicPrintConfig config = dual_extruder_exclusion_config( + BedExcludeVolumeMode::PerExtruder, {"", colliding}, {1, 2}); + + const StringObjectException error = validate_multimaterial_cube(config); + CHECK(error.string.find("extruder 2") != std::string::npos); +} + // --------------------------------------------------------------------------- // {first_object_name} filename placeholder // --------------------------------------------------------------------------- @@ -724,15 +825,49 @@ TEST_CASE("Custom G-code placeholders are substituted", "[Print]") }) .find("; between-object-gcode") != std::string::npos); - // [layer_num] keeps counting across sequentially printed objects (199 then 399). + // [layer_num] keeps counting across sequentially printed objects (199 then 399), and [max_layer_z] + // stays at the first object's 20mm top while the second object starts. const std::string per_layer = slice_two_cubes_arranged({ { "print_sequence", "by object" }, - { "layer_change_gcode", ";Layer:[layer_num] ([layer_z] mm)" }, + { "layer_change_gcode", ";Layer:[layer_num] ([layer_z] mm) max [max_layer_z]" }, { "layer_height", 0.1 }, { "initial_layer_print_height", 0.1 }, }); CHECK(per_layer.find(";Layer:199 ") != std::string::npos); CHECK(per_layer.find(";Layer:399 ") != std::string::npos); + CHECK(per_layer.find(";Layer:200 (0.1 mm) max 20\n") != std::string::npos); +} + +TEST_CASE("Timelapse G-code gets the snapshot placeholders on bed slingers and other printers", "[Print]") +{ + const std::string structure = GENERATE(as{}, "i3", "corexy"); + CAPTURE(structure); + std::string gcode; + REQUIRE_NOTHROW(gcode = slice({ cube(20) }, { + { "printer_structure", structure }, + { "printable_area", "0x0,200x0,200x200,0x200" }, + { "bed_exclude_area", "0x0" }, + { "extruder_clearance_radius", 40 }, + { "timelapse_type", "0" }, + { "time_lapse_gcode", "; Timelapse {if has_timelapse_safe_pos}safe{else}none{endif} [timelapse_pos_x] " + "[clear_to_x0] [curr_physical_extruder_id]" }, + })); + CHECK(gcode.find("\n; Timelapse safe ") != std::string::npos); +} + +TEST_CASE("The first filament start G-code on Bambu Lab printers gets the layer placeholders", "[Print]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_key_value("filament_start_gcode", new ConfigOptionStrings({ "; Start [layer_num] [layer_z] [max_layer_z]" })); + Print print; + Model model; + init_print({ cube(20) }, print, model, config); + print.is_BBL_printer() = true; + + std::string gcode; + REQUIRE_NOTHROW(gcode = Slic3r::Test::gcode(print)); + // The first filament start G-code runs before the first layer. + CHECK(gcode.find("\n; Start -1 ") != std::string::npos); } // The final print statistics are known only after the whole G-code is generated, yet every custom G-code, @@ -794,6 +929,20 @@ TEST_CASE("Print statistics in custom G-code match the final print statistics", } } +TEST_CASE("Print statistics in custom G-code cannot be used in a calculation", "[Print]") +{ + const std::string key = GENERATE(as{}, "total_weight", "used_filament", "total_cost", "print_time", "normal_print_time", + "silent_print_time", "total_wipe_tower_cost", "total_wipe_tower_filament", "print_time_total_sec", + "print_time_day", "print_time_hour", "print_time_minute", "print_time_sec", "used_filament_length"); + CAPTURE(key); + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_deserialize_strict({ { "file_start_gcode", "; {" + key + " + 1}\n" } }); + Print print; + Model model; + init_print({ cube(20) }, print, model, config); + CHECK_THROWS_WITH(Slic3r::Test::gcode(print), Catch::Matchers::ContainsSubstring("known only after the G-code is generated")); +} + TEST_CASE("export_gcode writes G-code without a result pointer", "[Print][export_gcode]") { Print print; diff --git a/tests/fff_print/test_seam_placer.cpp b/tests/fff_print/test_seam_placer.cpp index 3aea296fc7..594b461a25 100644 --- a/tests/fff_print/test_seam_placer.cpp +++ b/tests/fff_print/test_seam_placer.cpp @@ -7,11 +7,14 @@ #include #include "test_helpers.hpp" #include "libslic3r/GCode/SeamPlacer.hpp" +#include "libslic3r/GCode/SeamContour.hpp" #include "libslic3r/Layer.hpp" #include "libslic3r/TriangleSelector.hpp" #include #include +#include +#include #include "libslic3r/Model.hpp" #include "libslic3r/PrintConfig.hpp" #include "libslic3r/TriangleMesh.hpp" @@ -35,9 +38,9 @@ struct PipelineFixture { Print print; DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); - explicit PipelineFixture(bool trapezoid = false) + explicit PipelineFixture(bool trapezoid = false, float height = 0.4f) { - auto mesh = its_make_cube(20, 20, 0.4); + auto mesh = its_make_cube(20, 20, height); if (trapezoid) { // Opposite painted sides have deliberately different lengths: 20 mm and 6 mm. for (auto &vertex : mesh.vertices) @@ -105,24 +108,32 @@ struct PipelineFixture { } }; -void append_loop(LayerRegion ®ion, Points points, bool separate_paths = false) +// Wall loop of the given role, as one path or one path per edge; inset_idx is set the way the perimeter generators do. +ExtrusionLoop make_loop(Points points, ExtrusionRole role, int inset_idx, bool separate_paths = false) { - // Inject deterministic external loops while keeping the real layer, region and paint-query machinery. REQUIRE(points.size() >= 3); points.push_back(points.front()); ExtrusionPaths paths; if (separate_paths) { for (size_t i = 1; i < points.size(); ++i) { - ExtrusionPath path(erExternalPerimeter, 0.08, 0.4f, 0.2f); + ExtrusionPath path(role, 0.08, 0.4f, 0.2f); path.polyline = Polyline3(Polyline(Points{points[i - 1], points[i]})); paths.push_back(std::move(path)); } } else { - ExtrusionPath path(erExternalPerimeter, 0.08, 0.4f, 0.2f); + ExtrusionPath path(role, 0.08, 0.4f, 0.2f); path.polyline = Polyline3(Polyline(std::move(points))); paths.push_back(std::move(path)); } - region.perimeters.append(ExtrusionLoop(std::move(paths))); + ExtrusionLoop loop(std::move(paths)); + loop.inset_idx = inset_idx; + return loop; +} + +void append_loop(LayerRegion ®ion, Points points, bool separate_paths = false) +{ + // Inject deterministic external loops while keeping the real layer, region and paint-query machinery. + region.perimeters.append(make_loop(std::move(points), erExternalPerimeter, -1, separate_paths)); } LayerRegion &clear_first_layer(PrintObject &object) @@ -131,8 +142,91 @@ LayerRegion &clear_first_layer(PrintObject &object) for (LayerRegion *region : layer.regions()) region->perimeters.clear(); return *layer.get_region(0); } + +// Replaces the perimeters of every layer with one external loop through outline(layer index). +template void set_loop_on_every_layer(PrintObject &object, Outline &&outline) +{ + for (size_t i = 0; i < object.layers().size(); ++i) { + Layer &layer = *object.layers()[i]; + for (LayerRegion *region : layer.regions()) region->perimeters.clear(); + append_loop(*layer.get_region(0), outline(i)); + } +} + +// Start of each layer's loop after the seam is placed, in unscaled XY. +std::vector placed_seams(const SeamPlacer &placer, const PrintObject &object) +{ + std::vector starts; + for (const Layer *layer : object.layers()) { + const auto *loop = dynamic_cast(layer->get_region(0)->perimeters.entities.front()); + REQUIRE(loop != nullptr); + ExtrusionLoop copy = *loop; + float overhang = 0.0f; + placer.place_seam(layer, copy, Point(0, 0), overhang); + starts.push_back(unscale(copy.first_point())); + } + return starts; +} + +using SeamType = SeamPlacerImpl::EnforcedBlockedSeamPoint; + +// Seam candidates of one loop through xy at z = 0; Neutral with angle 0 unless given. The loop starts at +// `offset`, after candidates of another loop. +std::vector loop_candidates(SeamPlacerImpl::Perimeter &perimeter, const std::vector &xy, + const std::vector &types = {}, + const std::vector &angles = {}, size_t offset = 0) +{ + static SeamPlacerImpl::Perimeter other; + perimeter.start_index = offset; + perimeter.end_index = offset + xy.size(); + std::vector points; + points.reserve(offset + xy.size()); + for (size_t i = 0; i < offset; ++i) + points.emplace_back(Vec3f(100.0f + float(i), 100.0f, 0.0f), other, 0.0f, SeamType::Enforced); + for (size_t i = 0; i < xy.size(); ++i) + points.emplace_back(Vec3f(float(xy[i].x()), float(xy[i].y()), 0.0f), perimeter, angles.empty() ? 0.0f : angles[i], + types.empty() ? SeamType::Neutral : types[i]); + return points; +} + +Vec2d placed_xy(const std::vector &points, size_t index, const Vec2d &target) +{ + return SeamPlacerImpl::place_on_loop(points, index, Vec3f(float(target.x()), float(target.y()), 0.0f)) + .head<2>() + .cast(); +} } // namespace +TEST_CASE("Paint proximity beyond painted facet heights remains a soft seam preference", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture; + auto &volume = *fixture.model.objects.front()->volumes.front(); + const auto &mesh = volume.mesh(); + const double bottom = mesh.bounding_box().min.z(); + TriangleSelector selector(mesh); + // Only paint below the slicing plane: intersecting side paint exercises the separate exact-range tests. + for (size_t i = 0; i < mesh.its.indices.size(); ++i) { + const auto &face = mesh.its.indices[i]; + bool on_bottom = true; + for (int j = 0; j < 3; ++j) + on_bottom = on_bottom && std::abs(mesh.its.vertices[face[j]].z() - bottom) < 1e-6; + if (on_bottom) selector.set_facet(int(i), EnforcerBlockerType::ENFORCER); + } + volume.seam_facets.set(selector); + fixture.print.apply(fixture.model, fixture.config); + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + append_loop(region, fixture.points_in_layer(object, {{0, 0}, {20, 0}, {20, 20}, {0, 20}})); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 1); + // The horizontal painted face is below the slice, but the old paint-radius test still marks candidates. + CHECK(std::count_if(data.points.begin(), data.points.end(), [](const auto &point) { + return point.type == SeamPlacerImpl::EnforcedBlockedSeamPoint::Enforced; + }) > 0); +} + TEST_CASE("Painted seams prefer the longer candidate patch regardless of contour origin", "[SeamPlacer][Regression]") { const bool clockwise = GENERATE(false, true); @@ -193,24 +287,785 @@ TEST_CASE("Painted seams prefer the longer candidate patch regardless of contour CHECK(centers == 1); // The old wrapped-length formula instead selected the short top patch. } -TEST_CASE("Entirely painted contours keep valid enforced seam candidates", "[SeamPlacer]") +TEST_CASE("Full surface paint preserves unpainted candidates and placed seams", "[SeamPlacer][Regression]") { - PipelineFixture fixture; - fixture.paint(true); + const std::string mode = GENERATE("back", "aligned", "random"); + const bool bevel = GENERATE(false, true); + CAPTURE(mode, bevel); + std::vector> expected_candidates; + std::vector expected_seams; + for (const bool painted : {false, true}) { + PipelineFixture fixture(false, 2.0f); + fixture.config.set_deserialize_strict("seam_position", mode); + if (painted) fixture.paint(true); + fixture.print.apply(fixture.model, fixture.config); // Apply the requested seam mode in both comparisons. + PrintObject &object = fixture.prepare(); + const std::vector outline = bevel ? + std::vector{{0, 1}, {1, 0}, {19, 0}, {20, 1}, {20, 19}, {19, 20}, {1, 20}, {0, 19}} : + std::vector{{0, 0}, {20, 0}, {20, 20}, {0, 20}}; + set_loop_on_every_layer(object, [&](size_t) { return fixture.points_in_layer(object, outline); }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &layers = placer.m_seam_per_object.at(&object).layers; + if (!painted) { + for (const auto &layer : layers) { + std::vector positions; + for (const auto &candidate : layer.points) positions.push_back(candidate.position); + expected_candidates.push_back(std::move(positions)); + } + expected_seams = placed_seams(placer, object); + } else { + REQUIRE(layers.size() == expected_candidates.size()); + for (size_t i = 0; i < layers.size(); ++i) { + // Equality of candidates catches paint oversampling even when a sharp seam happens to match. + REQUIRE(layers[i].points.size() == expected_candidates[i].size()); + for (size_t j = 0; j < layers[i].points.size(); ++j) { + const auto &candidate = layers[i].points[j]; + CHECK(candidate.type == SeamType::Neutral); + CHECK_FALSE(candidate.central_enforcer); + CHECK_THAT(double((candidate.position - expected_candidates[i][j]).norm()), + Catch::Matchers::WithinAbs(0.0, 1e-6)); + } + } + const auto actual = placed_seams(placer, object); + REQUIRE(actual.size() == expected_seams.size()); + for (size_t i = 0; i < actual.size(); ++i) + CHECK_THAT((actual[i] - expected_seams[i]).norm(), Catch::Matchers::WithinAbs(0.0, 1e-6)); + } + } +} + +TEST_CASE("Full surface paint preserves strong Precise Seam positions", "[SeamPlacer][PreciseSeam][Regression]") +{ + std::vector expected; + for (const bool painted : {false, true}) { + PipelineFixture fixture(false, 2.0f); + fixture.config.set_deserialize_strict("seam_position", "aligned"); + if (painted) fixture.paint(true); + auto *part = fixture.model.objects.front()->volumes.front(); + const Vec3d center = part->get_matrix() * (part->mesh().bounding_box().min + Vec3d(10, 0, 1)); + auto *helper = fixture.model.objects.front()->add_volume(make_cube(4, 4, 4)); + helper->set_type(ModelVolumeType::PRECISE_SEAM_CENTER); + helper->set_offset(center); // Cross the front side without adding another printing surface. + fixture.print.apply(fixture.model, fixture.config); + PrintObject &object = fixture.prepare(); + set_loop_on_every_layer(object, [&](size_t) { + return fixture.points_in_layer(object, {{0, 0}, {20, 0}, {20, 20}, {0, 20}}); + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + for (const auto &layer : placer.m_seam_per_object.at(&object).layers) { + REQUIRE(layer.perimeters.size() == 1); + const auto &perimeter = layer.perimeters.front(); + REQUIRE(perimeter.precise_seam_point.has_value()); + // Strong placement stays exact. + CHECK_THAT(double((perimeter.final_seam_position - *perimeter.precise_seam_point).norm()), + Catch::Matchers::WithinAbs(0.0, 1e-6)); + } + const auto actual = placed_seams(placer, object); + if (!painted) expected = actual; + else { + REQUIRE(actual.size() == expected.size()); + for (size_t i = 0; i < actual.size(); ++i) + CHECK_THAT((actual[i] - expected[i]).norm(), Catch::Matchers::WithinAbs(0.0, 1e-6)); + } + } +} + +TEST_CASE("Complete side-wall paint is neutral away from unpainted caps", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture(false, 2.0f); + auto &volume = *fixture.model.objects.front()->volumes.front(); + const auto &mesh = volume.mesh(); + TriangleSelector selector(mesh); + for (size_t i = 0; i < mesh.its.indices.size(); ++i) { + const auto &face = mesh.its.indices[i]; + const auto &a = mesh.its.vertices[face[0]], &b = mesh.its.vertices[face[1]], &c = mesh.its.vertices[face[2]]; + if (std::abs((b - a).cross(c - a).z()) < 1e-6) + selector.set_facet(int(i), EnforcerBlockerType::ENFORCER); // Keep the top and bottom gray. + } + volume.seam_facets.set(selector); + fixture.print.apply(fixture.model, fixture.config); + PrintObject &object = fixture.prepare(); + set_loop_on_every_layer(object, [&](size_t) { + return fixture.points_in_layer(object, {{0, 0}, {20, 0}, {20, 20}, {0, 20}}); + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &layers = placer.m_seam_per_object.at(&object).layers; + REQUIRE(layers.size() == 10); + for (const auto &candidate : layers[4].points) CHECK(candidate.type == SeamType::Neutral); + // Near a gray cap the proof is intentionally conservative and retains the old paint semantics. + CHECK(std::any_of(layers.front().points.begin(), layers.front().points.end(), [](const auto &candidate) { + return candidate.type == SeamType::Enforced; + })); +} + +TEST_CASE("A nearby gray or blocked facet prevents full-green normalization", "[SeamPlacer][Regression]") +{ + const auto other = GENERATE(EnforcerBlockerType::NONE, EnforcerBlockerType::BLOCKER); + PipelineFixture fixture(false, 2.0f); + auto &volume = *fixture.model.objects.front()->volumes.front(); + const auto &mesh = volume.mesh(); + const float front = mesh.bounding_box().min.y(); + TriangleSelector selector(mesh); + bool changed = false; + for (size_t i = 0; i < mesh.its.indices.size(); ++i) { + selector.set_facet(int(i), EnforcerBlockerType::ENFORCER); + const auto &face = mesh.its.indices[i]; + if (!changed && std::abs(mesh.its.vertices[face[0]].y() - front) < 1e-6 && + std::abs(mesh.its.vertices[face[1]].y() - front) < 1e-6 && + std::abs(mesh.its.vertices[face[2]].y() - front) < 1e-6) { + selector.set_facet(int(i), other); // Vertices may still see neighboring green facets within line width. + changed = true; + } + } + REQUIRE(changed); + volume.seam_facets.set(selector); + fixture.print.apply(fixture.model, fixture.config); PrintObject &object = fixture.prepare(); auto ®ion = clear_first_layer(object); append_loop(region, fixture.points_in_layer(object, {{0, 0}, {20, 0}, {20, 20}, {0, 20}})); SeamPlacer placer; placer.init(fixture.print, [] {}); + const auto &points = placer.m_seam_per_object.at(&object).layers.front().points; + CHECK(std::any_of(points.begin(), points.end(), [](const auto &candidate) { return candidate.type == SeamType::Enforced; })); + if (other == EnforcerBlockerType::BLOCKER) + CHECK(std::any_of(points.begin(), points.end(), [](const auto &candidate) { return candidate.type == SeamType::Blocked; })); +} + +TEST_CASE("Painted seams run smoothly along a smooth contour", "[SeamPlacer][Regression]") +{ + // 10 layers of 0.2 mm: enough for the seams to be aligned as one string. + PipelineFixture fixture(false, 2.0f); + fixture.paint(false); + PrintObject &object = fixture.prepare(); + REQUIRE(object.layers().size() == 10); + // A circle of radius 6 mm touching the painted front face only near its lowest point. Its vertices + // rotate by an irregular fraction of a vertex step on every layer, so the candidates differ between layers. + const Vec2d center(10.0, 6.2); + const double radius = 6.0; + const size_t vertex_count = 120; + const double vertex_step = 2.0 * PI / double(vertex_count); + const double phases[] = {0.0, 0.62, 0.21, 0.87, 0.40, 0.05, 0.73, 0.31, 0.94, 0.18}; + set_loop_on_every_layer(object, [&](size_t layer) { + std::vector xy; + const double phase = phases[layer] * vertex_step; + for (size_t i = 0; i < vertex_count; ++i) { + const double angle = phase + vertex_step * double(i); + xy.emplace_back(center + radius * Vec2d(std::cos(angle), std::sin(angle))); + } + return fixture.points_in_layer(object, xy); + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + + const Vec2d placed_center = unscale(fixture.points_in_layer(object, {center}).front()); + const std::vector seams = placed_seams(placer, object); + std::vector along; // Seam position along the loop, mm. + for (size_t i = 0; i < seams.size(); ++i) { + const Vec2d offset = seams[i] - placed_center; + const double angle = std::atan2(offset.y(), offset.x()); + CAPTURE(i, seams[i].x(), seams[i].y()); + // The seam stays near the lowest point, where the circle meets the painted face (+-0.3 rad). + CHECK_THAT(angle, Catch::Matchers::WithinAbs(-PI / 2.0, 0.3)); + along.push_back(radius * angle); + } + // The seam line may lean with the curve fitted to the candidates, but must neither step nor kink between + // layers. The scale is the candidate spacing near paint: a 0.4 pull toward the candidate passes at least + // 0.4 of it into the seam, while the step must stay below a quarter of it and its change below 0.15 of it. + const double spacing = SeamPlacer::enforcer_oversampling_distance; + for (size_t i = 1; i < along.size(); ++i) { + CAPTURE(i, along[i - 1], along[i]); + CHECK_THAT(along[i] - along[i - 1], Catch::Matchers::WithinAbs(0.0, 0.25 * spacing)); + } + for (size_t i = 1; i + 1 < along.size(); ++i) { + CAPTURE(i, along[i - 1], along[i], along[i + 1]); + CHECK_THAT(along[i + 1] - 2.0 * along[i] + along[i - 1], Catch::Matchers::WithinAbs(0.0, 0.15 * spacing)); + } +} + +TEST_CASE("Seam strings leave out no layer below their start", "[SeamPlacer][Regression]") +{ + // 41 layers of 0.2 mm with one square each. Painting the top face enforces the candidates of the top + // two layers only (paint radius 0.4 mm), so the aligned string starts at layer 39, the first of them. + // Layer 40 is a small square in the middle, out of reach of layer 39's seam, so the string cannot + // continue upward and turns down from layer 39. The string is long enough that alignment tries only + // some alternative starts, so a layer skipped when turning down stays out of it. + PipelineFixture fixture(false, 8.2f); + { + auto &volume = *fixture.model.objects.front()->volumes.front(); + const auto &mesh = volume.mesh(); + const double top = mesh.bounding_box().max.z(); + TriangleSelector selector(mesh); + for (size_t i = 0; i < mesh.its.indices.size(); ++i) { + bool on_top = true; + for (int j = 0; j < 3; ++j) + on_top = on_top && std::abs(double(mesh.its.vertices[mesh.its.indices[i][j]].z()) - top) < 1e-6; + if (on_top) + selector.set_facet(int(i), EnforcerBlockerType::ENFORCER); + } + volume.seam_facets.set(selector); + fixture.print.apply(fixture.model, fixture.config); + } + PrintObject &object = fixture.prepare(); + REQUIRE(object.layers().size() == 41); + set_loop_on_every_layer(object, [&](size_t layer) { + if (layer == 40) + return fixture.points_in_layer(object, {{9, 9}, {11, 9}, {11, 11}, {9, 11}}); + return fixture.points_in_layer(object, {{0, 0}, {20, 0}, {20, 20}, {0, 20}}); + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &layers = placer.m_seam_per_object.at(&object).layers; + // Layer 0 is left out: with no layer below, its own seam differs and it does not join the string here. + for (size_t i = 1; i <= 39; ++i) { + CAPTURE(i); + REQUIRE(layers[i].perimeters.size() == 1); + CHECK(layers[i].perimeters.front().finalized); + } +} + +TEST_CASE("Painted seams stay at a corner of the painted side", "[SeamPlacer]") +{ + const std::string mode = GENERATE("back", "aligned"); + CAPTURE(mode); + PipelineFixture fixture(false, 2.0f); + fixture.config.set_deserialize_strict("seam_position", mode); + fixture.paint(false); + PrintObject &object = fixture.prepare(); + const std::vector square = {{0, 0}, {20, 0}, {20, 20}, {0, 20}}; + set_loop_on_every_layer(object, [&](size_t) { return fixture.points_in_layer(object, square); }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + + const Points corners = fixture.points_in_layer(object, square); + for (const Vec2d &seam : placed_seams(placer, object)) { + double nearest = std::numeric_limits::max(); + for (const Point &corner : corners) + nearest = std::min(nearest, (unscale(corner) - seam).norm()); + CAPTURE(seam.x(), seam.y()); + // Painted sides are y = 0 and y = 20; candidates of the side walls are painted up to the 0.4 mm + // line width from them, so the seam lies on a painted corner or within that width of it. + CHECK(nearest <= 0.45); + } +} + +namespace { +// Paints the front face (lowest y) of the fixture's box only. +void paint_front_face(PipelineFixture &fixture, EnforcerBlockerType type = EnforcerBlockerType::ENFORCER) +{ + auto &volume = *fixture.model.objects.front()->volumes.front(); + const auto &mesh = volume.mesh(); + const double front = mesh.bounding_box().min.y(); + TriangleSelector selector(mesh); + for (size_t i = 0; i < mesh.its.indices.size(); ++i) { + bool on_front = true; + for (int j = 0; j < 3; ++j) + on_front = on_front && std::abs(double(mesh.its.vertices[mesh.its.indices[i][j]].y()) - front) < 1e-6; + if (on_front) + selector.set_facet(int(i), type); + } + volume.seam_facets.set(selector); + fixture.print.apply(fixture.model, fixture.config); +} +} // namespace + +TEST_CASE("Painted ranges end exactly where the paint contour crosses the layer", "[SeamPlacer][Regression]") +{ + // The front face spans x 0..20; the loop runs 0.2 mm in front of it from x = -5 to 25. Points within the + // 0.4 mm line width of the paint used to be Enforced up to about 0.35 mm past the face, and only from the + // vertex before the face, so the middle candidate was off the middle of the face. + PipelineFixture fixture; + paint_front_face(fixture); + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + append_loop(region, fixture.points_in_layer(object, {{-5, 0.2}, {-0.3, 0.2}, {25, 0.2}, {25, 10}, {-5, 10}})); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 1); + CHECK(data.perimeters.front().exact_enforced_ends); + + const auto face = fixture.points_in_layer(object, {{0, 0.2}, {20, 0.2}, {10, 0.2}}); + double first = std::numeric_limits::max(), last = std::numeric_limits::lowest(); + size_t centers = 0; + for (const auto &candidate : data.points) { + if (candidate.type != SeamType::Enforced) + continue; + first = std::min(first, double(candidate.position.x())); + last = std::max(last, double(candidate.position.x())); + if (candidate.central_enforcer) { + ++centers; + CHECK((candidate.position.head<2>().cast() - unscale(face[2])).norm() < 1e-3); + } + } + CHECK_THAT(first, Catch::Matchers::WithinAbs(unscale(face[0].x()), 1e-3)); + CHECK_THAT(last, Catch::Matchers::WithinAbs(unscale(face[1].x()), 1e-3)); + CHECK(centers == 1); +} + +TEST_CASE("Exact paint ends do not depend on where the loop starts", "[SeamPlacer][Regression]") +{ + // The paint ends project onto the front corners of the loop. A loop repeats its first point, so at its + // first vertex the edge behind it has zero length; origin 0 puts the end with paint behind it there. + const int origin = GENERATE(0, 1, 2, 3); + CAPTURE(origin); + PipelineFixture fixture; + paint_front_face(fixture); + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + auto outline = fixture.points_in_layer(object, {{19.8, 0.2}, {19.8, 19.8}, {0.2, 19.8}, {0.2, 0.2}}); + std::rotate(outline.begin(), outline.begin() + origin, outline.end()); + append_loop(region, std::move(outline)); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 1); + CHECK(data.perimeters.front().exact_enforced_ends); + + const auto corners = fixture.points_in_layer(object, {{0.2, 0.2}, {19.8, 0.2}}); + double first = std::numeric_limits::max(), last = std::numeric_limits::lowest(); + for (const auto &candidate : data.points) { + if (candidate.type != SeamType::Enforced) + continue; + CHECK_THAT(double(candidate.position.y()), Catch::Matchers::WithinAbs(unscale(corners[0].y()), 1e-3)); + first = std::min(first, double(candidate.position.x())); + last = std::max(last, double(candidate.position.x())); + } + CHECK_THAT(first, Catch::Matchers::WithinAbs(unscale(corners[0].x()), 1e-3)); + CHECK_THAT(last, Catch::Matchers::WithinAbs(unscale(corners[1].x()), 1e-3)); +} + +TEST_CASE("Random seams stay inside exact green ranges and keep varying", "[SeamPlacer][Regression]") +{ + const int origin = GENERATE(0, 1, 2); + const bool partial_blocker = GENERATE(false, true); + CAPTURE(origin, partial_blocker); + // One hundred layers exercise the outgoing edge of the last green sample at many random offsets. + PipelineFixture fixture(false, 20.0f); + fixture.config.set_deserialize_strict("seam_position", "random"); + paint_front_face(fixture); + if (partial_blocker) { + const auto *part = fixture.model.objects.front()->volumes.front(); + const Vec3d center = part->get_matrix() * (part->mesh().bounding_box().min + Vec3d(10, 0, 10)); + auto *modifier = fixture.model.objects.front()->add_volume(make_cube(4, 4, 22)); + modifier->set_type(ModelVolumeType::PRECISE_SEAM_BLOCKED); + modifier->set_offset(center); // Block x = 8..12 on the green face, throughout the object's height. + fixture.print.apply(fixture.model, fixture.config); + } + PrintObject &object = fixture.prepare(); + REQUIRE(object.layers().size() == 100); + set_loop_on_every_layer(object, [&](size_t) { + auto outline = fixture.points_in_layer(object, {{-5, 0.2}, {10, 0.2}, {25, 0.2}, {25, 10}, {-5, 10}}); + // Origin 1 wraps the green range; origin 2 tests its closing edge after modifier normalization. + std::rotate(outline.begin(), outline.begin() + origin, outline.end()); + return outline; + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + for (const auto &layer : placer.m_seam_per_object.at(&object).layers) { + REQUIRE(layer.perimeters.size() == 1); + CHECK(layer.perimeters.front().exact_enforced_ends); + if (origin == 2 && partial_blocker) { + const auto &perimeter = layer.perimeters.front(); + // Modifiers remove the repeated loop endpoint, exposing the Enforced-to-Neutral closing edge. + CHECK(layer.points[perimeter.end_index - 1].type == SeamType::Enforced); + CHECK(layer.points[perimeter.start_index].type == SeamType::Neutral); + } + if (partial_blocker) + CHECK(std::any_of(layer.points.begin(), layer.points.end(), [](const auto &candidate) { + return candidate.type == SeamType::Blocked; + })); + } + const auto bounds = fixture.points_in_layer(object, {{0, 0.2}, {20, 0.2}, {8, 0.2}, {12, 0.2}}); + const Vec2d first = unscale(bounds[0]), last = unscale(bounds[1]); + const double blocked_begin = unscale(bounds[2].x()), blocked_end = unscale(bounds[3].x()); + double min_x = std::numeric_limits::max(), max_x = std::numeric_limits::lowest(); + // Check the actual split loop start: an Enforced candidate alone does not constrain Random's edge. + for (const Vec2d &seam : placed_seams(placer, object)) { + CAPTURE(seam.x(), seam.y()); + CHECK_THAT(seam.y(), Catch::Matchers::WithinAbs(first.y(), 1e-3)); + CHECK(seam.x() >= first.x() - 1e-3); + CHECK(seam.x() <= last.x() + 1e-3); + if (partial_blocker) { + const bool inside_blocker = seam.x() > blocked_begin + 1e-3 && seam.x() < blocked_end - 1e-3; + CHECK_FALSE(inside_blocker); + } + min_x = std::min(min_x, seam.x()); + max_x = std::max(max_x, seam.x()); + } + CHECK(max_x - min_x > 1.0); // Reject a false fix that pins every layer to one green endpoint. +} + +TEST_CASE("Projected paint boundaries do not color a distant contour detour", "[SeamPlacer][Regression]") +{ + const auto paint = GENERATE(EnforcerBlockerType::ENFORCER, EnforcerBlockerType::BLOCKER); + PipelineFixture fixture; + paint_front_face(fixture, paint); + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + // The projected ends span x=0..20, but the middle of this contour leaves the painted front face. + append_loop(region, fixture.points_in_layer(object, + {{-5, 0.2}, {5, 0.2}, {5, 10}, {15, 10}, {15, 0.2}, {25, 0.2}, {25, 15}, {-5, 15}})); + SeamPlacer placer; + placer.init(fixture.print, [] {}); const auto &data = placer.m_seam_per_object.at(&object).layers.front(); REQUIRE(data.perimeters.size() == 1); const auto &perimeter = data.perimeters.front(); - CHECK(perimeter.seam_index >= perimeter.start_index); - CHECK(perimeter.seam_index < perimeter.end_index); - for (const auto &candidate : data.points) { - CHECK(candidate.type == SeamPlacerImpl::EnforcedBlockedSeamPoint::Enforced); - CHECK_FALSE(candidate.central_enforcer); // There is no bounded patch to mark as central. + CHECK((paint == EnforcerBlockerType::ENFORCER ? perimeter.exact_enforced_ends : perimeter.exact_blocked_ends)); + const auto gray = fixture.points_in_layer(object, {{5, 10}, {15, 10}}); + for (const auto &point : gray) { + const auto position = unscale(point); + const auto candidate = std::find_if(data.points.begin(), data.points.end(), [&](const SeamPlacerImpl::SeamCandidate &p) { + return (p.position.head<2>().cast() - position).norm() < 1e-3; + }); + REQUIRE(candidate != data.points.end()); + CHECK(candidate->type == SeamType::Neutral); } + const auto expected = paint == EnforcerBlockerType::ENFORCER ? SeamType::Enforced : SeamType::Blocked; + CHECK(std::any_of(data.points.begin(), data.points.end(), [&](const auto &p) { return p.type == expected; })); +} + +TEST_CASE("Aligned painted seams follow the middle of the painted band", "[SeamPlacer][Regression]") +{ + // 10 layers with the loop of the previous test; the vertex before the face moves on every layer, which + // used to move the middle candidate and with it the seam. + PipelineFixture fixture(false, 2.0f); + fixture.config.set_deserialize_strict("seam_position", "aligned"); + paint_front_face(fixture); + PrintObject &object = fixture.prepare(); + REQUIRE(object.layers().size() == 10); + set_loop_on_every_layer(object, [&](size_t layer) { + const double before = -0.05 - 0.04 * double(layer); + return fixture.points_in_layer(object, {{-5, 0.2}, {before, 0.2}, {25, 0.2}, {25, 10}, {-5, 10}}); + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + + const Vec2d middle = unscale(fixture.points_in_layer(object, {{10, 0.2}}).front()); + for (const Vec2d &seam : placed_seams(placer, object)) { + CAPTURE(seam.x(), seam.y()); + CHECK((seam - middle).norm() < 1e-3); + } +} + +TEST_CASE("Red paint blocks its exact range without blocking the nearby gray contour", "[SeamPlacer][Regression]") +{ + const bool reverse = GENERATE(false, true); + const bool wrap = GENERATE(false, true); + PipelineFixture fixture; + paint_front_face(fixture, EnforcerBlockerType::BLOCKER); + PrintObject &object = fixture.prepare(); + auto outline = fixture.points_in_layer(object, {{-5, 0.2}, {-0.1, 0.2}, {10, 0.2}, {20.1, 0.2}, + {25, 0.2}, {25, 10}, {-5, 10}}); + if (wrap) std::rotate(outline.begin(), outline.begin() + 2, outline.end()); // Red range crosses the loop origin. + if (reverse) std::reverse(outline.begin(), outline.end()); + append_loop(clear_first_layer(object), std::move(outline)); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 1); + CHECK(data.perimeters.front().exact_blocked_ends); + const auto front = fixture.points_in_layer(object, {{0, 0.2}, {20, 0.2}, {-0.1, 0.2}, {20.1, 0.2}}); + const double lower = unscale(front[0].x()), upper = unscale(front[1].x()); + std::vector gray_near_edge(2, false); + double blocked_min = std::numeric_limits::max(), blocked_max = -blocked_min; + for (size_t i = 0; i < data.points.size(); ++i) { + const auto &candidate = data.points[i]; + const double x = candidate.position.x(); + if (candidate.type == SeamType::Blocked) { + blocked_min = std::min(blocked_min, x); + blocked_max = std::max(blocked_max, x); + CHECK(x >= lower - 1e-3); + CHECK(x <= upper + 1e-3); + } + for (const size_t index : {size_t(2), size_t(3)}) + if ((candidate.position.head<2>().cast() - unscale(front[index])).norm() < 1e-4) { + gray_near_edge[index - 2] = true; // A closed extrusion can repeat its start vertex. + CHECK(candidate.type == SeamType::Neutral); // Old radius test blocked both of these vertices. + const auto target = Vec3f(float(0.5 * (lower + upper)), candidate.position.y(), candidate.position.z()); + const auto projected = SeamPlacerImpl::place_on_loop(data.points, i, target); + // The normal projection may reach either end of the same permitted gray arc. + const double edge_distance = projected.x() < lower ? lower - projected.x() : projected.x() - upper; + CHECK(edge_distance > 0.0); + CHECK(edge_distance < 3e-3); // The stop follows the actual red edge, not the old gray vertex. + } + } + CHECK(gray_near_edge[0]); + CHECK(gray_near_edge[1]); + CHECK_THAT(blocked_min, Catch::Matchers::WithinAbs(lower, 1e-3)); + CHECK_THAT(blocked_max, Catch::Matchers::WithinAbs(upper, 1e-3)); +} + +TEST_CASE("Seams in every mode stay outside the exact red range", "[SeamPlacer][Regression]") +{ + const std::string mode = GENERATE(std::string("aligned"), std::string("aligned_back"), std::string("back"), + std::string("nearest"), std::string("random")); + PipelineFixture fixture(false, 2.0f); + fixture.config.set_deserialize_strict("seam_position", mode); + paint_front_face(fixture, EnforcerBlockerType::BLOCKER); + PrintObject &object = fixture.prepare(); + set_loop_on_every_layer(object, [&](size_t) { + return fixture.points_in_layer(object, {{-5, 0.2}, {-0.1, 0.2}, {10, 0.2}, {20.1, 0.2}, + {25, 0.2}, {25, 10}, {-5, 10}}); + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto front = fixture.points_in_layer(object, {{0, 0.2}, {20, 0.2}}); + const double lower = unscale(front[0].x()), upper = unscale(front[1].x()); + const double y = unscale(front[0].y()); + for (const auto &layer : placer.m_seam_per_object.at(&object).layers) { + const auto &perimeter = layer.perimeters.front(); + const size_t selected = perimeter.seam_index; + CHECK(layer.points[selected].type != SeamType::Blocked); + } + for (const Vec2d &seam : placed_seams(placer, object)) { + const bool inside_red = seam.x() >= lower && seam.x() <= upper && std::abs(seam.y() - y) < 1e-3; + CHECK_FALSE(inside_red); + } +} + +TEST_CASE("Entire red surface retains the existing all-blocked seam fallback", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture; + auto &volume = *fixture.model.objects.front()->volumes.front(); + TriangleSelector selector(volume.mesh()); + for (size_t i = 0; i < volume.mesh().its.indices.size(); ++i) + selector.set_facet(int(i), EnforcerBlockerType::BLOCKER); // No legal gray arc exists. + volume.seam_facets.set(selector); + fixture.print.apply(fixture.model, fixture.config); + PrintObject &object = fixture.prepare(); + set_loop_on_every_layer(object, [&](size_t) { + return fixture.points_in_layer(object, {{0.2, 0.2}, {19.8, 0.2}, {19.8, 19.8}, {0.2, 19.8}}); + }); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + CHECK_FALSE(data.perimeters.front().exact_blocked_ends); + for (const auto &candidate : data.points) CHECK(candidate.type == SeamType::Blocked); + CHECK(placed_seams(placer, object).front().allFinite()); +} + +TEST_CASE("Seams placed on a regular polygon with an even vertex count lie on the ray from its center", "[SeamPlacer]") +{ + const Vec2d center(3.0, -2.0); + const double radius = 5.0; + const size_t count = 24; + const double step = 2.0 * PI / double(count); + std::vector xy; + for (size_t i = 0; i < count; ++i) + xy.emplace_back(center + radius * Vec2d(std::cos((0.3 + double(i)) * step), std::sin((0.3 + double(i)) * step))); + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, xy); + // Targets inside and outside the loop around vertex 5, placed from two neighboring candidates. + for (const double offset : {-0.1, -0.03, 0.0, 0.05, 0.12}) + for (const double distance : {3.5, 5.0, 6.5}) { + const double angle = (5.3 * step) + offset; + const Vec2d target = center + distance * Vec2d(std::cos(angle), std::sin(angle)); + const Vec2d from_5 = placed_xy(points, 5, target); + const Vec2d from_6 = placed_xy(points, 6, target); + CAPTURE(offset, distance, from_5.x(), from_5.y()); + CHECK_THAT(std::atan2(from_5.y() - center.y(), from_5.x() - center.x()), Catch::Matchers::WithinAbs(angle, 1e-5)); + CHECK((from_5 - center).norm() <= radius + 1e-5); + CHECK((from_5 - center).norm() >= radius * std::cos(step / 2.0) - 1e-5); + CHECK((from_6 - from_5).norm() < 1e-5); + } +} + +TEST_CASE("Seams placed on the loop do not depend on the chosen candidate", "[SeamPlacer]") +{ + // Inserted candidates at (0, 0) and (0.2, 0) on an asymmetric painted contour; a chord around the + // candidate would turn the target's offset across the bottom edge into a move along it. + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, {{-1, 0}, {0, 0}, {0.2, 0}, {1, 0}, {1, 5}, {-6, 5}}, + std::vector(6, SeamType::Enforced)); + for (const Vec2d &target : {Vec2d(0, 3), Vec2d(0, 0.5), Vec2d(0.5, 1)}) { + const Vec2d from_1 = placed_xy(points, 1, target); + const Vec2d from_2 = placed_xy(points, 2, target); + CAPTURE(target.x(), target.y(), from_1.x(), from_1.y(), from_2.x(), from_2.y()); + CHECK((from_2 - from_1).norm() < 1e-5); + } + // Straight above the candidate the seam stays on the bottom edge. + CHECK((placed_xy(points, 2, {0, 0.5}) - Vec2d(0, 0)).norm() < 1e-5); +} + +TEST_CASE("Seams placed on a short loop follow a moving target continuously", "[SeamPlacer]") +{ + // A 2 x 2 mm painted square with a candidate inserted at (0, 0); the target goes up along the right + // side and beyond the loop, up to 5 mm from the candidate. + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, {{-1, 0}, {0, 0}, {1, 0}, {1, 2}, {-1, 2}}, + std::vector(5, SeamType::Enforced)); + Vec2d previous = placed_xy(points, 1, {1, 0}); + for (int i = 1; i <= 500; ++i) { + const Vec2d target(1.0, 0.01 * i); + const Vec2d seam = placed_xy(points, 1, target); + CAPTURE(target.y(), seam.x(), seam.y()); + if (target.y() <= 2.0) + CHECK((seam - target).norm() < 1e-5); // A target on the loop is the seam. + CHECK((seam - previous).norm() <= 0.0101); + previous = seam; + } + // Above the loop the normals of the top side point to the square's center. + CHECK((previous - Vec2d(0.25, 2.0)).norm() < 1e-5); +} + +TEST_CASE("Seams placed on the loop stay in the allowed arc", "[SeamPlacer]") +{ + // A circle of 60 vertices; the target lies on vertex 16, beyond the arc allowed from candidate 12. + const size_t count = 60; + std::vector xy; + for (size_t i = 0; i < count; ++i) + xy.emplace_back(10.0 * Vec2d(std::cos(2.0 * PI * double(i) / count), std::sin(2.0 * PI * double(i) / count))); + const Vec2d target = xy[16]; + const Vec2d run_end = xy[13]; + const Vec2d past_end = run_end + 0.2 * (xy[14] - run_end).normalized(); + const auto placed = [&](const std::vector &types, bool exact_ends = false) { + SeamPlacerImpl::Perimeter perimeter; + perimeter.exact_enforced_ends = exact_ends; + const auto points = loop_candidates(perimeter, xy, types); + return placed_xy(points, 12, target); + }; + std::vector types(count, SeamType::Neutral); + // Enforced run 10..13: the seam may go 0.2 mm past its end, but not into a Blocked candidate. + std::fill(types.begin() + 10, types.begin() + 14, SeamType::Enforced); + CHECK((placed(types) - past_end).norm() < 1e-5); + // A run ending exactly at the paint is not extended. + CHECK((placed(types, true) - run_end).norm() < 1e-5); + types[14] = SeamType::Blocked; + CHECK((placed(types) - run_end).norm() < 1e-5); + // A candidate that is not Enforced stays between the Blocked candidates around it. + std::fill(types.begin() + 10, types.begin() + 14, SeamType::Neutral); + types[40] = SeamType::Blocked; + CHECK((placed(types) - run_end).norm() < 1e-5); + // With the target reachable around the loop, it is the seam. + types[40] = SeamType::Neutral; + CHECK((placed(types) - target).norm() < 1e-5); + types[14] = SeamType::Neutral; + CHECK((placed(types) - target).norm() < 1e-5); +} + +TEST_CASE("Seams placed on a short loop keep to the closest solution as the target moves", "[SeamPlacer][Regression]") +{ + // On a short painted square, the target moves upward left of the candidate: the solution on the left + // side stays the closest one, and must not be traded for the farther one on the right side. + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, {{-1, 0}, {0, 0}, {1, 0}, {1, 2}, {-1, 2}}, + std::vector(5, SeamType::Enforced)); + Vec2d previous = placed_xy(points, 1, {-0.1, 1.0}); + for (int i = 1; i <= 1000; ++i) { + const Vec2d target(-0.1, 1.0 + 0.0001 * i); + const Vec2d seam = placed_xy(points, 1, target); + CAPTURE(target.y(), seam.x(), seam.y()); + CHECK(std::abs(seam.x() + 1.0) < 1e-5); + CHECK((seam - previous).norm() <= 0.0011); + previous = seam; + } +} + +TEST_CASE("Seams placed on the loop respect a painted run ending on the closing edge", "[SeamPlacer][Regression]") +{ + // The Enforced run goes around the loop from C and leaves 0.1 mm of its extension for the 10 mm closing + // edge back to C: the target on that edge lies outside the allowed arc. The loop is also placed after + // another loop and rotated, so that it does not start at index 0 and its run wraps around the array end. + const std::vector xy = {{0, 0}, {10, 0}, {10, 10}, {-10, 10}, {-10, 0.1}, {-10, 0}}; + std::vector types(6, SeamType::Enforced); + types[5] = SeamType::Neutral; + for (const size_t rotation : {size_t(0), size_t(3)}) { + std::vector rotated_xy = xy; + std::vector rotated_types = types; + std::rotate(rotated_xy.begin(), rotated_xy.begin() + rotation, rotated_xy.end()); + std::rotate(rotated_types.begin(), rotated_types.begin() + rotation, rotated_types.end()); + for (const size_t offset : {size_t(0), size_t(4)}) { + CAPTURE(rotation, offset); + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, rotated_xy, rotated_types, {}, offset); + const size_t candidate = offset + (6 - rotation) % 6; + // The end of the allowed arc closer to the target: 0.2 mm from C toward the Neutral candidate. + CHECK((placed_xy(points, candidate, {-5, 0}) - Vec2d(-0.2, 0)).norm() < 1e-5); + } + } +} + +TEST_CASE("Seams held at the allowed arc keep their end across the arc midpoint", "[SeamPlacer][Regression]") +{ + // A single Enforced candidate; the target moves along the far side of the loop, past the point halfway + // around the loop from C. The end of the allowed arc closer to the target stays the same. + std::vector types(5, SeamType::Neutral); + types[0] = SeamType::Enforced; + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, {{0, 0}, {10, 0}, {10, 1}, {-1, 1}, {-1, 0}}, types); + for (int i = 0; i <= 200; ++i) { + const Vec2d target(8.9 + 0.001 * i, 1.0); + CAPTURE(target.x()); + CHECK((placed_xy(points, 0, target) - Vec2d(0.2, 0)).norm() < 1e-5); + } +} + +TEST_CASE("Seams placed on the loop stay at the arc end their solution leaves through", "[SeamPlacer][Regression]") +{ + // The Enforced run of C = (4.2, 0) goes around the loop and ends 0.2 mm past (0, 0); the gap up to + // 0.2 mm before C is not allowed. The target follows the normal line through (x, 0) at a height of + // 2.15 mm, so that (x, 0) is its closest solution, while the target stays closer to the other arc end. + std::vector types(6, SeamType::Enforced); + types[1] = SeamType::Neutral; + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, {{0, 0}, {3, 0}, {4.2, 0}, {100, 0}, {100, 100}, {0, 100}}, types); + const double a = 1.0 / std::sqrt(2.0); + for (int i = 0; i <= 200; ++i) { + // Normal at (x, 0), blended between (a, a) at (0, 0) and (0, 1) at (3, 0). + const double x = 0.1 + 0.001 * i; + const Vec2d normal(a * (1.0 - x / 3.0), a + (1.0 - a) * x / 3.0); + const Vec2d target(x + 2.15 * normal.x() / normal.y(), 2.15); + CAPTURE(x); + // The float target moves the solution by about 1e-5 mm here; the sweep step is 1e-3 mm. + CHECK((placed_xy(points, 2, target) - Vec2d(std::min(x, 0.2), 0)).norm() < 1e-4); + } +} + +TEST_CASE("Seams placed on the loop do not jump at duplicated points", "[SeamPlacer][Regression]") +{ + // Extrusion loops repeat the shared end points of their paths; both copies of the corner must get the + // same normal. + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, {{0, 0}, {9, 0}, {10, 0}, {10, 0}, {10, 10}, {0, 10}}); + Vec2d previous = placed_xy(points, 1, {10.1, 0.0}); + for (int i = 1; i <= 200; ++i) { + const Vec2d target(10.1, -0.001 * i); + const Vec2d seam = placed_xy(points, 1, target); + CAPTURE(target.y(), seam.x(), seam.y()); + CHECK((seam - previous).norm() <= 0.0011); + CHECK((seam - Vec2d(10, 0)).norm() <= 0.11); + previous = seam; + } +} + +TEST_CASE("Corner influence is full near a corner and fades out along the loop", "[SeamPlacer]") +{ + // Candidates every 0.1 mm along the bottom of a 3 x 3 mm loop; angles are set directly. + std::vector xy; + for (int i = 0; i <= 30; ++i) + xy.emplace_back(0.1 * i, 0.0); + xy.emplace_back(3.0, 3.0); + xy.emplace_back(0.0, 3.0); + const auto influence = [&](float corner_angle, size_t index) { + std::vector angles(xy.size(), 0.0f); + angles[10] = corner_angle; + SeamPlacerImpl::Perimeter perimeter; + const auto points = loop_candidates(perimeter, xy, {}, angles); + return double(SeamPlacerImpl::enforced_corner_influence(points, index, 0.4f, 0.8f)); + }; + const float deg = float(PI) / 180.0f; + using Catch::Matchers::WithinAbs; + CHECK_THAT(influence(45.0f * deg, 10), WithinAbs(1.0, 1e-4)); + CHECK_THAT(influence(-45.0f * deg, 14), WithinAbs(1.0, 1e-4)); // Within R0 = 0.4 mm, either turn. + CHECK_THAT(influence(45.0f * deg, 6), WithinAbs(1.0, 1e-4)); + CHECK_THAT(influence(45.0f * deg, 16), WithinAbs(0.5, 1e-4)); // Halfway through the fade band. + CHECK_THAT(influence(45.0f * deg, 18), WithinAbs(0.0, 1e-4)); // R1 = 0.8 mm. + CHECK_THAT(influence(45.0f * deg, 25), WithinAbs(0.0, 1e-4)); + CHECK_THAT(influence(22.5f * deg, 10), WithinAbs(0.5, 1e-4)); // Halfway between 15 and 30 degrees. + CHECK_THAT(influence(10.0f * deg, 10), WithinAbs(0.0, 1e-4)); } TEST_CASE("Seam painting acts only from model parts and negative volumes", "[SeamPlacer]") @@ -405,3 +1260,281 @@ TEST_CASE("Precise Seam volume changes invalidate only G-code export", "[SeamPla CHECK(object->is_step_done(posSlice)); CHECK(object->is_step_done(posPerimeters)); } + +namespace { +// Axis-aligned rectangle given by two opposite corners in layer coordinates, as placed by the fixture. +BoundingBoxf layer_rectangle(const PipelineFixture &fixture, const PrintObject &object, const Vec2d &a, const Vec2d &b) +{ + std::vector corners; + for (const Point &corner : fixture.points_in_layer(object, {a, b})) + corners.push_back(unscale(corner)); + return BoundingBoxf(corners); +} + +// True if the point lies within `tolerance` mm of the boundary of the rectangle. +bool near_rectangle_boundary(const Vec3f &p, const BoundingBoxf &rect, double tolerance) +{ + const double dx = std::min(std::abs(p.x() - rect.min.x()), std::abs(p.x() - rect.max.x())); + const double dy = std::min(std::abs(p.y() - rect.min.y()), std::abs(p.y() - rect.max.y())); + const bool inside_x = p.x() > rect.min.x() - tolerance && p.x() < rect.max.x() + tolerance; + const bool inside_y = p.y() > rect.min.y() - tolerance && p.y() < rect.max.y() + tolerance; + return (dx < tolerance && inside_y) || (dy < tolerance && inside_x); +} + +// Checks that every seam candidate of the layer lies on the boundary of exactly one rectangle and that +// a perimeter never mixes candidates of two rectangles (a merged fallback polygon would). Rectangles +// must be at least 1 mm apart. Returns how many perimeters draw their candidates from each rectangle. +template +std::vector perimeters_per_rectangle(const LayerSeamsT &data, const std::vector &rects) +{ + std::vector result(rects.size(), 0); + for (const auto &perimeter : data.perimeters) { + std::vector hits(rects.size(), 0); + for (size_t i = perimeter.start_index; i < perimeter.end_index; ++i) { + const Vec3f &p = data.points[i].position; + size_t matched = 0; + for (size_t r = 0; r < rects.size(); ++r) + if (near_rectangle_boundary(p, rects[r], 0.5)) { + ++hits[r]; + ++matched; + } + CAPTURE(p.x(), p.y()); + CHECK(matched == 1); // A candidate off every outline comes from an inner loop. + } + size_t used = 0; + for (size_t r = 0; r < rects.size(); ++r) + if (hits[r] > 0) { + ++used; + ++result[r]; + } + CHECK(used <= 1); + } + return result; +} +} // namespace + +TEST_CASE("Fully overhanging outer loop is its own seam perimeter regardless of island order", "[SeamPlacer][Regression]") +{ + const bool overhang_first = GENERATE(false, true); + CAPTURE(overhang_first); + PipelineFixture fixture; + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + + // Island A: ordinary outer wall. Island B: the outer wall is entirely overhang but keeps inset_idx 0, + // followed by an inner wall that is overhang as well. + ExtrusionEntityCollection island_a, island_b; + island_a.append(make_loop(fixture.points_in_layer(object, {{2, 2}, {8, 2}, {8, 8}, {2, 8}}), erExternalPerimeter, 0)); + island_b.append(make_loop(fixture.points_in_layer(object, {{12, 2}, {18, 2}, {18, 8}, {12, 8}}), erOverhangPerimeter, 0)); + island_b.append(make_loop(fixture.points_in_layer(object, {{13.5, 3.5}, {16.5, 3.5}, {16.5, 6.5}, {13.5, 6.5}}), erOverhangPerimeter, 1)); + if (overhang_first) { + region.perimeters.append(std::move(island_b)); + region.perimeters.append(std::move(island_a)); + } else { + region.perimeters.append(std::move(island_a)); + region.perimeters.append(std::move(island_b)); + } + + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + // Exactly the two outer loops are registered; the inner loop is not merged into either of them. + REQUIRE(data.perimeters.size() == 2); + const auto counts = perimeters_per_rectangle(data, {layer_rectangle(fixture, object, {2, 2}, {8, 8}), + layer_rectangle(fixture, object, {12, 2}, {18, 8})}); + CHECK(counts == std::vector{1, 1}); +} + +TEST_CASE("External role selects the outer loop when inset_idx is unknown", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture; + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + + // Thin-wall style loops carry the external role without a stored depth. + ExtrusionEntityCollection island; + island.append(make_loop(fixture.points_in_layer(object, {{2, 2}, {8, 2}, {8, 8}, {2, 8}}), erExternalPerimeter, -1)); + island.append(make_loop(fixture.points_in_layer(object, {{3.5, 3.5}, {6.5, 3.5}, {6.5, 6.5}, {3.5, 6.5}}), erPerimeter, -1)); + region.perimeters.append(std::move(island)); + + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 1); + const auto counts = perimeters_per_rectangle(data, {layer_rectangle(fixture, object, {2, 2}, {8, 8})}); + CHECK(counts == std::vector{1}); +} + +TEST_CASE("A collection without a recognizable outer loop gets its own fallback polygon", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture; + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + + // The second collection has neither an external path nor a stored depth (for example, a loop loaded + // from the slicing cache). It must not be skipped just because an earlier collection added polygons. + ExtrusionEntityCollection island_a, island_b; + island_a.append(make_loop(fixture.points_in_layer(object, {{2, 2}, {8, 2}, {8, 8}, {2, 8}}), erExternalPerimeter, 0)); + island_b.append(make_loop(fixture.points_in_layer(object, {{12, 2}, {18, 2}, {18, 8}, {12, 8}}), erOverhangPerimeter, -1)); + region.perimeters.append(std::move(island_a)); + region.perimeters.append(std::move(island_b)); + + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 2); + const auto counts = perimeters_per_rectangle(data, {layer_rectangle(fixture, object, {2, 2}, {8, 8}), + layer_rectangle(fixture, object, {12, 2}, {18, 8})}); + CHECK(counts == std::vector{1, 1}); +} + +TEST_CASE("Mixed overhang and external outer loop is taken once", "[SeamPlacer][Regression]") +{ + // Whether or not the generator stored the depth, the external path alone identifies the loop. + const int outer_inset_idx = GENERATE(0, -1); + CAPTURE(outer_inset_idx); + PipelineFixture fixture; + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + + // The outer loop consists of one overhang path and external paths. + ExtrusionLoop mixed = make_loop(fixture.points_in_layer(object, {{2, 2}, {8, 2}, {8, 8}, {2, 8}}), erExternalPerimeter, + outer_inset_idx, true); + mixed.paths.front().set_extrusion_role(erOverhangPerimeter); + ExtrusionEntityCollection island; + island.append(std::move(mixed)); + island.append(make_loop(fixture.points_in_layer(object, {{3.5, 3.5}, {6.5, 3.5}, {6.5, 6.5}, {3.5, 6.5}}), erPerimeter, + outer_inset_idx == 0 ? 1 : -1)); + region.perimeters.append(std::move(island)); + + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 1); + const auto counts = perimeters_per_rectangle(data, {layer_rectangle(fixture, object, {2, 2}, {8, 8})}); + CHECK(counts == std::vector{1}); +} + +TEST_CASE("Contour boundary type is independent of extrusion direction", "[SeamPlacer]") +{ + const bool hole = GENERATE(false, true); + const bool clockwise = GENERATE(false, true); + PipelineFixture fixture; + PrintObject &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + append_loop(region, fixture.points_in_layer(object, {{2, 2}, {18, 2}, {18, 18}, {2, 18}}), false); + auto *loop = static_cast(region.perimeters.entities.front()); + loop->set_loop_role(hole ? elrHole : elrDefault); + if (clockwise) loop->make_clockwise(); else loop->make_counter_clockwise(); + // Geometric hole/outer identity must survive either choice of printing direction. + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &data = placer.m_seam_per_object.at(&object).layers.front(); + REQUIRE(data.perimeters.size() == 1); + CHECK(data.perimeters.front().is_hole == hole); +} + +TEST_CASE("Seam strings retain the legacy search when geometry finds no continuation", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture(false, 2.0f); + PrintObject &object = fixture.prepare(); + REQUIRE(object.layers().size() == 10); + set_loop_on_every_layer(object, [&](size_t) { + return fixture.points_in_layer(object, {{2, 2}, {18, 2}, {18, 18}, {2, 18}}); + }); + for (size_t i = 0; i < object.layers().size(); ++i) { + auto *loop = static_cast(object.layers()[i]->get_region(0)->perimeters.entities.front()); + // Alternating roles deliberately fail geometric admissibility while preserving legacy candidates. + loop->set_loop_role(i % 2 == 0 ? elrDefault : elrHole); + } + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &layers = placer.m_seam_per_object.at(&object).layers; + for (size_t i = 1; i < layers.size(); ++i) { + CAPTURE(i); + REQUIRE(layers[i].perimeters.size() == 1); + CHECK(layers[i].perimeters.front().finalized); + } + SeamContour::Layers geometry(2); + for (size_t i = 0; i < 2; ++i) { + const auto &perimeter = layers[i].perimeters.front(); + SeamContour::Contour contour; + contour.hole = perimeter.is_hole; + contour.width = perimeter.flow_width; + for (size_t j = perimeter.start_index; j < perimeter.end_index; ++j) + contour.points.push_back(layers[i].points[j].position.head<2>().cast()); + geometry[i].push_back(std::move(contour)); + } + // Finalization alone could also pass through Unique; explicitly certify this fixture's empty result. + const auto &start = layers.front().perimeters.front(); + CHECK(SeamContour::Resolver(std::move(geometry)).resolve(0, 0, start.seam_index-start.start_index, 1).outcome + == SeamContour::Outcome::None); + +} + +TEST_CASE("Seam strings search all nondominated contour alternatives", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture(false, 2.0f); + PrintObject &object = fixture.prepare(); + REQUIRE(object.layers().size() == 10); + for (size_t i = 0; i < object.layers().size(); ++i) { + Layer &layer = *object.layers()[i]; + for (LayerRegion *region : layer.regions()) region->perimeters.clear(); + auto ®ion = *layer.get_region(0); + if (i % 2 == 0) { + append_loop(region, fixture.points_in_layer(object, {{2, 2}, {18, 2}, {18, 18}, {2, 18}})); + } else { + // Both continuations share the rear edge, but their bounds defeat unique fast matching. + append_loop(region, fixture.points_in_layer(object, {{2, 2}, {20, 2}, {18, 18}, {2, 18}})); + append_loop(region, fixture.points_in_layer(object, {{2, 2}, {21, 2}, {18, 18}, {2, 18}})); + } + } + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &layers = placer.m_seam_per_object.at(&object).layers; + for (size_t i = 1; i < layers.size(); ++i) { + CAPTURE(i); + // Rejecting a nonunique geometric set would leave every short string unfinalized. + CHECK(std::any_of(layers[i].perimeters.begin(), layers[i].perimeters.end(), + [](const auto &perimeter) { return perimeter.finalized; })); + } +} + +TEST_CASE("Seam alignment remains cancellable after a string is finalized", "[SeamPlacer][Regression]") +{ + PipelineFixture fixture(false, 2.0f); + PrintObject &object = fixture.prepare(); + set_loop_on_every_layer(object, [&](size_t) { + return fixture.points_in_layer(object, {{2, 2}, {18, 2}, {18, 18}, {2, 18}}); + }); + SeamPlacer placer; + struct AlignmentCanceled {}; + CHECK_THROWS_AS(placer.init(fixture.print, [&] { + const auto found = placer.m_seam_per_object.find(&object); + if (found == placer.m_seam_per_object.end()) return; + // Cancel only after real alignment progress, rather than during earlier pipeline callbacks. + for (const auto &layer : found->second.layers) + if (std::any_of(layer.perimeters.begin(), layer.perimeters.end(), + [](const auto &perimeter) { return perimeter.finalized; })) + throw AlignmentCanceled{}; + }), AlignmentCanceled); +} + +TEST_CASE("Seam extraction preserves unknown boundary roles for open extrusion paths", "[SeamPlacer][Regression]") +{ + const bool open = GENERATE(false, true); + PipelineFixture fixture; + auto &object = fixture.prepare(); + auto ®ion = clear_first_layer(object); + const auto points = fixture.points_in_layer(object, {{2,2},{18,2},{18,18}}); + if (open) { + ExtrusionPath path(erExternalPerimeter, 0.08, 0.4f, 0.2f); + path.polyline = Polyline3(Polyline(points)); + region.perimeters.append(path); // A path has no closed-loop role even if its points look polygonal. + } else append_loop(region, points); + SeamPlacer placer; + placer.init(fixture.print, [] {}); + const auto &perimeters = placer.m_seam_per_object.at(&object).layers.front().perimeters; + REQUIRE(perimeters.size() == 1); + CHECK(perimeters.front().contour_reliable == !open); +} diff --git a/tests/fff_print/test_skirt_brim.cpp b/tests/fff_print/test_skirt_brim.cpp index c51dd5ebc6..c732c54793 100644 --- a/tests/fff_print/test_skirt_brim.cpp +++ b/tests/fff_print/test_skirt_brim.cpp @@ -212,6 +212,36 @@ TEST_CASE("Object brims are generated per instance", "[SkirtBrim]") } } +TEST_CASE("Brim groups the parts of an object by contact", "[SkirtBrim]") +{ + // 10 mm cubes along X as the parts of one object: A and B overlap, C and D touch, and E stands 0.5 mm clear of D. + const std::vector part_x{ 0., 8., 30., 40., 50.5 }; + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_deserialize_strict({ { "skirt_loops", 0 }, { "brim_type", "outer_only" }, { "brim_width", 3 }, { "layer_height", 0.2 } }); + Print print; + Model model; + init_print({ cube(10) }, print, model, config, nullptr, false); + for (size_t i = 1; i < part_x.size(); ++ i) { + TriangleMesh part = cube(10); + part.translate(float(part_x[i]), 0.f, 0.f); + model.objects.front()->add_volume(std::move(part), ModelVolumeType::MODEL_PART, false); + } + print.apply(model, config); + print.process(); + + const PrintObject &object = *print.objects().front(); + std::set> groups; + for (const groupedVolumeSlices &group : object.firstLayerObjGroups()) { + std::set parts; + for (const ObjectID &volume_id : group.volume_ids) + for (size_t i = 0; i < object.model_object()->volumes.size(); ++ i) + if (object.model_object()->volumes[i]->id() == volume_id) + parts.insert(i); + groups.insert(parts); + } + CHECK(groups == std::set>{ { 0, 1 }, { 2, 3 }, { 4 } }); +} + TEST_CASE("Uncombined neighboring brims precede their respective objects", "[SkirtBrim]") { Print print; @@ -1091,6 +1121,32 @@ TEST_CASE("Belt brim is absent when both widths are zero", "[SkirtBrim][belt]") } } +TEST_CASE("Belt brim layers give layer change G-code every layer change placeholder", "[SkirtBrim][belt]") +{ + DynamicPrintConfig config = belt_brim_config(); + config.set_deserialize_strict({ + { "brim_type", "outer_only" }, + { "brim_width", 10 }, + { "leading_brim_length", 30 }, + { "brim_object_gap", 0 }, + { "layer_change_gcode", "G92 E0\n; LC [layer_num] [most_used_physical_extruder_id] [curr_y_acceleration_limit] " + "[curr_accumulated_mass] [curr_layer_mass]\n" }, + }); + Print print; + Model model; + init_print({ cube(20) }, print, model, config); + print.process(); + const int bands = belt_brim_apron_bands(*print.objects().front()); + REQUIRE(bands > 0); + std::string gc; + REQUIRE_NOTHROW(gc = gcode(print)); + // The apron bands print first, so they are layers 0 to bands - 1. + for (int layer = 0; layer < bands; ++ layer) { + INFO(layer); + CHECK(gc.find("\n; LC " + std::to_string(layer) + " 0 ") != std::string::npos); + } +} + TEST_CASE("Leading brim length alone produces a belt brim", "[SkirtBrim][belt]") { // Exercises the leading_brim_length-only enablement path and the downhill sweep. diff --git a/tests/fff_print/test_wipe_tower.cpp b/tests/fff_print/test_wipe_tower.cpp index c094a656f7..20b6ef373c 100644 --- a/tests/fff_print/test_wipe_tower.cpp +++ b/tests/fff_print/test_wipe_tower.cpp @@ -8,7 +8,9 @@ #include #include "libslic3r/Model.hpp" #include "libslic3r/Print.hpp" +#include #include +#include #include #include @@ -22,9 +24,11 @@ #include "libslic3r/ClipperUtils.hpp" #include "libslic3r/GCode/GCodeProcessor.hpp" #include "libslic3r/GCode/WipeTower.hpp" +#include "libslic3r/LocalesUtils.hpp" #include "libslic3r/PrintConfig.hpp" #include "test_helpers.hpp" +#include "test_utils.hpp" #include "libslic3r/PrintBase.hpp" #include "libslic3r/TriangleMesh.hpp" @@ -202,6 +206,78 @@ TEST_CASE("The wipe tower's toolchange planner flush follows the gcode flavor", } } +TEST_CASE("The wipe tower sets Klipper's acceleration and accel_to_decel on one line", "[WipeTower]") +{ + // On separate lines, current Klipper finds nothing it reads on the ACCEL_TO_DECEL one and 0.13 + // derives the cruise ratio from the acceleration before the change. + DynamicPrintConfig config = wipe_tower_toolchange_config("klipper"); + // Type 2 towers leave the acceleration to the main G-code writer. + config.set_deserialize_strict({ { "wipe_tower_type", "type1" }, + { "accel_to_decel_enable", "1" }, { "accel_to_decel_factor", "50%" }, + { "default_acceleration", "1000" }, { "travel_acceleration", "2000" }, + { "machine_max_acceleration_extruding", "5000" } }); + const std::string tower = wipe_tower_regions(slice_with_prime_tower(config)); + REQUIRE_THAT(tower, Catch::Matchers::ContainsSubstring("SET_VELOCITY_LIMIT ACCEL=")); + CHECK_THAT(tower, Catch::Matchers::ContainsSubstring(" MINIMUM_CRUISE_RATIO=0.5\n")); + CHECK_THAT(tower, !Catch::Matchers::ContainsSubstring("SET_VELOCITY_LIMIT ACCEL_TO_DECEL") && + !Catch::Matchers::ContainsSubstring("M204")); +} + +TEST_CASE("The wipe tower's G-code moves keep a decimal point in a comma-decimal locale", "[WipeTower]") +{ + // The GUI slices on a thread that keeps the user's numeric locale. + CommaNumericLocale comma; + CNumericLocalesSetter restore; + if (! comma.apply()) + SKIP("no locale with a comma decimal separator is installed"); + DynamicPrintConfig config = wipe_tower_toolchange_config("klipper"); + // Type 1 towers join their toolchange blocks with a travel move of their own. + config.set_deserialize_strict({ { "wipe_tower_type", "type1" } }); + const std::string gcode = slice_with_prime_tower(config); + REQUIRE_FALSE(wipe_tower_regions(gcode).empty()); + std::istringstream lines(gcode); + for (std::string line; std::getline(lines, line);) + if (! line.empty() && line.front() == 'G' && line.find(',') != std::string::npos) + FAIL_CHECK(line); +} + +TEST_CASE("The wipe tower's flow tags keep a decimal point in a comma-decimal locale", "[WipeTower]") +{ + // GCodeProcessor parses these values with the C locale: a comma makes it log an error and + // ignore the tag, leaving the extrusion width and height it assumes to its own defaults. + CommaNumericLocale comma; + CNumericLocalesSetter restore; + if (! comma.apply()) + SKIP("no locale with a comma decimal separator is installed"); + DynamicPrintConfig config = wipe_tower_toolchange_config("klipper"); + config.set_deserialize_strict({ { "wipe_tower_type", "type1" } }); + const std::string gcode = slice_with_prime_tower(config); + // WipeTowerWriter forces the BBL flag, so the tower writes these spellings on every printer. + // By the time the test asks, export has reset the flag for this Klipper config and + // reserved_tag() would hand back the main G-code's ";HEIGHT:" / ";WIDTH:" instead. + // The width and height tags are both written by the writer's constructor, before the + // tower's start tag, so scan the whole slice. + const std::string height_tag = "; LAYER_HEIGHT: "; + const std::string width_tag = "; LINE_WIDTH: "; + size_t heights = 0; + size_t widths = 0; + std::istringstream lines(gcode); + for (std::string line; std::getline(lines, line);) { + const bool is_height = line.compare(0, height_tag.size(), height_tag) == 0; + const bool is_width = line.compare(0, width_tag.size(), width_tag) == 0; + if (! is_height && ! is_width) + continue; + if (is_height) + ++heights; + else + ++widths; + if (line.find(',') != std::string::npos) + FAIL_CHECK(line); + } + CHECK(heights > 0); + CHECK(widths > 0); +} + // What Print feeds the shared estimate. The libslic3r WipeTowerEstimate cases cannot see this: // they call the estimator directly. The estimate counts the filaments the print really uses, // so the two-filament shape gives the outer wall the second one. @@ -459,3 +535,41 @@ TEST_CASE("A tower printed without a tool change is still validated against the CHECK(print.wipe_tower_data(1).depth > 0.f); CHECK_THAT(print.validate().string, Catch::Matchers::ContainsSubstring("printable area")); } + +TEST_CASE("Only a cone wall gives the tower a stabilization cone", "[WipeTower]") +{ + // The cone angle stays in the config for every wall type, but only a cone wall prints the + // cone. A 120 mm object makes the tower tall enough that a 30 degree cone would reach the + // thin plate in front of the tower, which the real rectangle or rib tower stays clear of. + const std::string wall_type = GENERATE("rectangle", "rib", "cone"); + DynamicPrintConfig config = tower_estimate_config(wall_type.c_str()); + config.set_deserialize_strict({ { "wipe_tower_type", "type2" }, + { "wipe_tower_cone_angle", "30" }, + { "wipe_tower_x", "30" }, + { "wipe_tower_y", "80" }, + { "layer_height", "0.3" } }); + + TriangleMesh tall = make_cube(20., 20., 120.); + tall.translate(150.f, 150.f, 0.f); + TriangleMesh plate = make_cube(30., 32., 2.); + plate.translate(40.f, 30.f, 0.f); + const double plate_max_y = 30. + 32.; + + Print print; + Model model; + init_print({ std::move(tall), std::move(plate) }, print, model, config, nullptr, false); + print.apply(model, config); + print.process(); + REQUIRE(print.has_wipe_tower()); + + const BoundingBox footprint(print.first_layer_wipe_tower_corners()); + INFO("wall type " << wall_type << ", tower depth " << print.wipe_tower_data().depth << ", footprint min y " + << unscaled(footprint.min.y())); + if (wall_type == "cone") { + CHECK(unscaled(footprint.min.y()) < plate_max_y); + CHECK(print.get_conflict_result().has_value()); + } else { + CHECK(unscaled(footprint.min.y()) > plate_max_y); + CHECK_FALSE(print.get_conflict_result().has_value()); + } +} diff --git a/tests/libslic3r/CMakeLists.txt b/tests/libslic3r/CMakeLists.txt index 1f72f83478..ef23b52203 100644 --- a/tests/libslic3r/CMakeLists.txt +++ b/tests/libslic3r/CMakeLists.txt @@ -1,5 +1,9 @@ get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +# Observe the geometry backend's actual CGAL layout without duplicating its flags. +# This source is only added when the test suite is enabled. +target_sources(libslic3r_cgal PRIVATE texture_import_cgal.cpp) + add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests.cpp test_3mf.cpp @@ -8,6 +12,8 @@ add_executable(${_TEST_NAME}_tests test_precise_seam_3mf.cpp # Pure perimeter extraction is independent of Print/Layer fixtures. test_precise_seam.cpp + # Contour correspondence is pure geometry; Print integration stays in fff_print. + test_seam_contour.cpp test_aabbindirect.cpp test_appconfig.cpp test_arachne_walls.cpp @@ -31,12 +37,15 @@ add_executable(${_TEST_NAME}_tests test_preset_diff.cpp test_vendor_cache.cpp test_preset_options.cpp + test_edge_grid.cpp test_elephant_foot_compensation.cpp + test_exclusion_volumes.cpp test_fill_corner_smoothing.cpp test_filament_mixer.cpp test_fill_plane_path.cpp - test_fill_tpms_adaptive.cpp + test_adaptive_infill_field.cpp test_geometry.cpp + test_kdtree.cpp test_imex_arrange.cpp test_imex_helpers.cpp test_imex_zones.cpp @@ -61,16 +70,19 @@ add_executable(${_TEST_NAME}_tests test_utils.cpp test_miniz_extension.cpp test_timeutils.cpp + test_semver.cpp test_voronoi.cpp test_wipe_tower_estimate.cpp test_wipe_tower.cpp test_wipe_path.cpp test_optimizers.cpp test_ordering_strategies.cpp + test_shortest_path.cpp # test_png_io.cpp test_indexed_triangle_set.cpp test_connected_bodies.cpp test_texture_displacement.cpp + test_texture_import.cpp test_instance_lock.cpp ../libnest2d/printer_parts.cpp ) diff --git a/tests/libslic3r/test_3mf.cpp b/tests/libslic3r/test_3mf.cpp index 7287b9d5d3..00721b952f 100644 --- a/tests/libslic3r/test_3mf.cpp +++ b/tests/libslic3r/test_3mf.cpp @@ -1,5 +1,6 @@ #include +#include #include #include #include @@ -51,6 +52,7 @@ #include #include #include +#include #include #include #include // for std::enable_if_t @@ -180,6 +182,78 @@ SCENARIO("Export+Import geometry to/from 3mf file cycle", "[3mf]") { } } +TEST_CASE("Volumetric per-extruder exclusions survive a 3MF round-trip", "[3mf][ExclusionVolume][MultiNozzle]") +{ + // The importer creates a backup tree for the reloaded model. Give that + // process-global temp root a writable, isolated location on every OS. + ScopedSlic3rTemporaryDir temporary_dir("orca_exclusion"); + + Model model; + ModelObject *object = model.add_object(); + object->add_volume(make_cube(10.0, 10.0, 10.0)); + object->add_instance(); + + // Keep the project config intentionally sparse: this test owns only the + // exclusion settings and should not depend on unrelated printer-profile + // defaults surviving the project archive round-trip. + DynamicPrintConfig source; + source.set_key_value("bed_exclude_volume_mode", + new ConfigOptionEnum(BedExcludeVolumeMode::PerExtruder)); + source.set_deserialize_strict("bed_exclude_area", "0x0,10x0,10x10,0x10"); + source.set_key_value("bed_exclude_volumes", new ConfigOptionString("0..10;1x1,2x1,2x2,1x2")); + source.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings{ + "0..25;5x5,15x5,15x15,5x15", + "30..80;40x40,55x40,55x55,40x55|0..5;70x10,80x10,80x20,70x20", + }); + + const boost::filesystem::path backup_dir = temporary_dir.path() / "source_backup"; + model.set_backup_path(backup_dir.string()); + + const boost::filesystem::path path = temporary_dir.path() / "round_trip.3mf"; + const std::string path_string = path.string(); + auto plate = std::make_unique(); + plate->plate_index = 0; + StoreParams store_params; + store_params.path = path_string.c_str(); + store_params.model = &model; + store_params.config = &source; + store_params.plate_data_list.push_back(plate.get()); + store_params.strategy = SaveStrategy::Zip64 | SaveStrategy::Silence; + REQUIRE(store_bbs_3mf(store_params)); + + Model reloaded_model; + DynamicPrintConfig reloaded; + ConfigSubstitutionContext substitutions{ForwardCompatibilitySubstitutionRule::Disable}; + PlateDataPtrs reloaded_plates; + std::vector project_presets; + bool is_bbl_3mf = false; + bool is_orca_3mf = false; + Semver file_version; + const bool loaded = load_bbs_3mf( + path_string.c_str(), &reloaded, &substitutions, &reloaded_model, &reloaded_plates, + &project_presets, &is_bbl_3mf, &is_orca_3mf, &file_version, nullptr, + LoadStrategy::LoadModel | LoadStrategy::LoadConfig); + release_PlateData_list(reloaded_plates); + + REQUIRE(loaded); + REQUIRE(reloaded.option>("bed_exclude_volume_mode") != nullptr); + CHECK(reloaded.option>("bed_exclude_volume_mode")->value == + BedExcludeVolumeMode::PerExtruder); + + const auto *areas = reloaded.option("extruder_bed_exclude_volumes"); + REQUIRE(areas != nullptr); + REQUIRE(areas->values.size() == 2); + CHECK(areas->values == source.option("extruder_bed_exclude_volumes")->values); + + const auto *shared_volumes = reloaded.option("bed_exclude_volumes"); + REQUIRE(shared_volumes != nullptr); + CHECK(shared_volumes->value == source.opt_string("bed_exclude_volumes")); + + const auto *legacy = reloaded.option("bed_exclude_area"); + REQUIRE(legacy != nullptr); + CHECK(legacy->serialize() == "0x0,10x0,10x10,0x10"); +} + SCENARIO("Mirrored instance transforms survive 3mf round trips", "[3mf][Regression]") { const bool bbs_format = GENERATE(false, true); diff --git a/tests/libslic3r/test_fill_tpms_adaptive.cpp b/tests/libslic3r/test_adaptive_infill_field.cpp similarity index 73% rename from tests/libslic3r/test_fill_tpms_adaptive.cpp rename to tests/libslic3r/test_adaptive_infill_field.cpp index d150ae8d7b..ab422bb95d 100644 --- a/tests/libslic3r/test_fill_tpms_adaptive.cpp +++ b/tests/libslic3r/test_adaptive_infill_field.cpp @@ -13,7 +13,7 @@ #include "libslic3r/BoundingBox.hpp" #include "libslic3r/ClipperUtils.hpp" #include "libslic3r/ExPolygon.hpp" -#include "libslic3r/Fill/FillTpmsAdaptive.hpp" +#include "libslic3r/Fill/AdaptiveInfillField.hpp" #include "libslic3r/Point.hpp" #include "libslic3r/Polygon.hpp" #include "libslic3r/PrintConfig.hpp" @@ -30,24 +30,24 @@ ExPolygon rectangle(double x0, double y0, double x1, double y1) } // The expolygons stacked in 0.2 mm layers from z = 0 to height. -TpmsRadialField radial_field(const ExPolygons &expolygons, double height, TpmsAdaptiveMode mode = TpmsAdaptiveMode::Lobes) +AdaptiveInfillField radial_field(const ExPolygons &expolygons, double height, AdaptiveInfillMode mode = AdaptiveInfillMode::Lobes) { - std::vector slices; + std::vector slices; for (int i = 0; 0.2 * (i + 1) < height + EPSILON; ++i) slices.push_back({0.2 * i, 0.2 * (i + 1), &expolygons}); - return TpmsRadialField(slices, get_extents(expolygons), mode, [] {}); + return AdaptiveInfillField(slices, get_extents(expolygons), mode, [] {}); } -double radial(const TpmsRadialField &field, const Vec3d &pt) +double radial(const AdaptiveInfillField &field, const Vec3d &pt) { - TpmsRadialField::Radials radials; + AdaptiveInfillField::Radials radials; field.radial(pt, radials); return radials[0].t; } -Vec3d center(const TpmsRadialField &field, const Vec3d &pt) +Vec3d center(const AdaptiveInfillField &field, const Vec3d &pt) { - TpmsRadialField::Radials radials; + AdaptiveInfillField::Radials radials; field.radial(pt, radials); return radials[0].center; } @@ -57,11 +57,11 @@ constexpr double Tolerance = 0.075; } // namespace -TEST_CASE("TPMS radial field is zero at the center of a cube and one at its faces", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field is zero at the center of a cube and one at its faces", "[AdaptiveInfillField]") { // A 20 mm cube, 10 mm from its center to every face. const ExPolygons square{rectangle(0., 0., 20., 20.)}; - const TpmsRadialField field = radial_field(square, 20.); + const AdaptiveInfillField field = radial_field(square, 20.); const Vec3d c = center(field, {10., 10., 10.}); CHECK_THAT(c.x(), WithinAbs(10., 0.5)); @@ -74,10 +74,10 @@ TEST_CASE("TPMS radial field is zero at the center of a cube and one at its face } } -TEST_CASE("TPMS radial field grows linearly from the center of a cube to its faces", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field grows linearly from the center of a cube to its faces", "[AdaptiveInfillField]") { const ExPolygons square{rectangle(0., 0., 20., 20.)}; - const TpmsRadialField field = radial_field(square, 20.); + const AdaptiveInfillField field = radial_field(square, 20.); for (double d = 1.; d < 10.; d += 1.) { CAPTURE(d); CHECK_THAT(radial(field, {10. - d, 10., 10.}), WithinAbs(d / 10., Tolerance)); @@ -85,11 +85,11 @@ TEST_CASE("TPMS radial field grows linearly from the center of a cube to its fac } } -TEST_CASE("TPMS radial field of a tall box is centered at its middle height", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field of a tall box is centered at its middle height", "[AdaptiveInfillField]") { // 20 x 20 x 60 mm: 10 mm from the center to the sides, 30 mm to the top and the bottom. const ExPolygons square{rectangle(0., 0., 20., 20.)}; - const TpmsRadialField field = radial_field(square, 60.); + const AdaptiveInfillField field = radial_field(square, 60.); CHECK_THAT(center(field, {10., 10., 45.}).z(), WithinAbs(30., 0.5)); CHECK_THAT(radial(field, {10., 10., 15.}), WithinAbs(0.5, Tolerance)); @@ -97,10 +97,10 @@ TEST_CASE("TPMS radial field of a tall box is centered at its middle height", "[ CHECK_THAT(radial(field, {15., 10., 30.}), WithinAbs(0.5, Tolerance)); } -TEST_CASE("TPMS radial field grades every body towards its own center", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field grades every body towards its own center", "[AdaptiveInfillField]") { const ExPolygons squares{rectangle(0., 0., 20., 20.), rectangle(30., 0., 50., 20.)}; - const TpmsRadialField field = radial_field(squares, 20.); + const AdaptiveInfillField field = radial_field(squares, 20.); CHECK_THAT(center(field, {5., 10., 10.}).x(), WithinAbs(10., 0.5)); CHECK_THAT(center(field, {45., 10., 10.}).x(), WithinAbs(40., 0.5)); @@ -108,20 +108,20 @@ TEST_CASE("TPMS radial field grades every body towards its own center", "[FillTp CHECK_THAT(radial(field, {30., 10., 10.}), WithinAbs(1., Tolerance)); } -TEST_CASE("TPMS radial field is beyond one outside of the object", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field is beyond one outside of the object", "[AdaptiveInfillField]") { const ExPolygons square{rectangle(0., 0., 20., 20.)}; - const TpmsRadialField field = radial_field(square, 20.); + const AdaptiveInfillField field = radial_field(square, 20.); CHECK(radial(field, {-5., 10., 10.}) > 1.); CHECK(radial(field, {10., 10., 30.}) > 1.); } -TEST_CASE("TPMS radial field grades every lobe of a body towards its own center", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field grades every lobe of a body towards its own center", "[AdaptiveInfillField]") { // Two spheres of 10 mm united, their centers 16 mm apart: the neck between them is 6 mm deep. const Vec3d c1(10., 10., 10.), c2(26., 10., 10.); std::vector layers; - std::vector slices; + std::vector slices; for (int i = 0; i < 100; ++i) { const double z = 0.2 * i + 0.1, r = std::sqrt(std::max(0., 100. - sqr(z - 10.))); Polygons circles; @@ -134,7 +134,7 @@ TEST_CASE("TPMS radial field grades every lobe of a body towards its own center" } for (int i = 0; i < 100; ++i) slices.push_back({0.2 * i, 0.2 * (i + 1), &layers[i]}); - const TpmsRadialField field(slices, get_extents(layers[50]), TpmsAdaptiveMode::Lobes, [] {}); + const AdaptiveInfillField field(slices, get_extents(layers[50]), AdaptiveInfillMode::Lobes, [] {}); for (const Vec3d &c : {c1, c2}) { CAPTURE(c.x()); @@ -143,7 +143,7 @@ TEST_CASE("TPMS radial field grades every lobe of a body towards its own center" CHECK_THAT(radial(field, c + Vec3d(0., 0., 9.5)), WithinAbs(1., 2. * Tolerance)); } // The side between the lobes is half way to the surface, where both patterns morph into each other. - TpmsRadialField::Radials radials; + AdaptiveInfillField::Radials radials; REQUIRE(field.radial(0.5 * (c1 + c2), radials) == 2); for (size_t i = 0; i < 2; ++i) { CHECK_THAT(radials[i].t, WithinAbs(0.5, 2. * Tolerance)); @@ -151,12 +151,12 @@ TEST_CASE("TPMS radial field grades every lobe of a body towards its own center" } } -TEST_CASE("TPMS radial field blends the lobes meeting at a junction continuously", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field blends the lobes meeting at a junction continuously", "[AdaptiveInfillField]") { // Three spheres of 10 mm united, their centers on a triangle of 16 mm sides: the necks meet at its middle. const std::array centers{Vec3d(10., 10., 10.), Vec3d(26., 10., 10.), Vec3d(18., 10. + 8. * std::sqrt(3.), 10.)}; std::vector layers; - std::vector slices; + std::vector slices; for (int i = 0; i < 100; ++i) { const double z = 0.2 * i + 0.1, r = std::sqrt(std::max(0., 100. - sqr(z - 10.))); Polygons circles; @@ -169,7 +169,7 @@ TEST_CASE("TPMS radial field blends the lobes meeting at a junction continuously } for (int i = 0; i < 100; ++i) slices.push_back({0.2 * i, 0.2 * (i + 1), &layers[i]}); - const TpmsRadialField field(slices, get_extents(layers[50]), TpmsAdaptiveMode::Lobes, [] {}); + const AdaptiveInfillField field(slices, get_extents(layers[50]), AdaptiveInfillMode::Lobes, [] {}); // Around the junction the nearest lobes swap, but the weight of every lobe changes smoothly. const Vec3d junction = (centers[0] + centers[1] + centers[2]) / 3.; @@ -179,7 +179,7 @@ TEST_CASE("TPMS radial field blends the lobes meeting at a junction continuously for (int row = 0; row <= 100; ++row) { std::array previous{}; for (int step = 0; step <= 200; ++step) { - TpmsRadialField::Radials radials; + AdaptiveInfillField::Radials radials; const size_t count = field.radial(junction + Vec3d(0.01 * step - 1., 0.02 * row - 1., 0.), radials); max_count = std::max(max_count, count); std::array weights{}; @@ -201,23 +201,23 @@ TEST_CASE("TPMS radial field blends the lobes meeting at a junction continuously CHECK(max_jump < 0.05); } -TEST_CASE("TPMS radial field is empty when the object is thinner than the grid cells", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field is empty when the object is thinner than the grid cells", "[AdaptiveInfillField]") { // A 0.3 mm square bar between the nodes of a grid sized by a 200 mm bounding box, with cells of 0.5 mm or more. const ExPolygons bar{rectangle(0.1, 0.1, 0.4, 0.4)}; - std::vector slices; + std::vector slices; for (int i = 0; i < 1000; ++i) slices.push_back({0.2 * i, 0.2 * (i + 1), &bar}); - const TpmsRadialField field(slices, BoundingBox(Point::new_scale(0., 0.), Point::new_scale(200., 200.)), - TpmsAdaptiveMode::Lobes, [] {}); + const AdaptiveInfillField field(slices, BoundingBox(Point::new_scale(0., 0.), Point::new_scale(200., 200.)), + AdaptiveInfillMode::Lobes, [] {}); CHECK(field.empty()); } -TEST_CASE("TPMS depth follows the distance to the surface relative to the deepest point", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill depth follows the distance to the surface relative to the deepest point", "[AdaptiveInfillField]") { // 20 x 20 x 60 mm: from 10 to 50 mm high the axis is 10 mm deep, as deep as the center. const ExPolygons square{rectangle(0., 0., 20., 20.)}; - const TpmsRadialField field = radial_field(square, 60., TpmsAdaptiveMode::SmoothBlend); + const AdaptiveInfillField field = radial_field(square, 60., AdaptiveInfillMode::SmoothBlend); for (double z : {15., 30., 45.}) { CAPTURE(z); CHECK_THAT(field.depth({10., 10., z}), WithinAbs(1., Tolerance)); @@ -227,18 +227,18 @@ TEST_CASE("TPMS depth follows the distance to the surface relative to the deepes CHECK_THAT(field.depth({0., 10., 30.}), WithinAbs(0., Tolerance)); } -TEST_CASE("TPMS radial field in Distance warp mode follows the distance to the surface", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field in Distance warp mode follows the distance to the surface", "[AdaptiveInfillField]") { // In a cube the depth falls linearly along every ray from the center, so Distance warp matches Lobes. const ExPolygons square{rectangle(0., 0., 20., 20.)}; - const TpmsRadialField cube = radial_field(square, 20., TpmsAdaptiveMode::DistanceWarp); + const AdaptiveInfillField cube = radial_field(square, 20., AdaptiveInfillMode::DistanceWarp); CHECK_THAT(radial(cube, {10., 10., 10.}), WithinAbs(0., Tolerance)); CHECK_THAT(radial(cube, {15., 10., 10.}), WithinAbs(0.5, Tolerance)); CHECK_THAT(radial(cube, {10., 10., 20.}), WithinAbs(1., Tolerance)); // 20 x 20 x 60 mm: Lobes grades the axis towards the top and the bottom, Distance warp keeps it deep. - const TpmsRadialField lobes = radial_field(square, 60.); - const TpmsRadialField warp = radial_field(square, 60., TpmsAdaptiveMode::DistanceWarp); + const AdaptiveInfillField lobes = radial_field(square, 60.); + const AdaptiveInfillField warp = radial_field(square, 60., AdaptiveInfillMode::DistanceWarp); for (double z : {15., 45.}) { CAPTURE(z); CHECK_THAT(radial(lobes, {10., 10., z}), WithinAbs(0.5, Tolerance)); @@ -247,12 +247,12 @@ TEST_CASE("TPMS radial field in Distance warp mode follows the distance to the s CHECK_THAT(radial(warp, {0., 10., 30.}), WithinAbs(1., Tolerance)); } -TEST_CASE("TPMS stepped shells split a layer by depth from the surface inwards", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill stepped shells split a layer by depth from the surface inwards", "[AdaptiveInfillField]") { // The middle layer of a 40 mm cube, 20 mm from its center to every face, 20% at the surface to 5% inside. const ExPolygons square{rectangle(0., 0., 40., 40.)}; - const TpmsRadialField field = radial_field(square, 40., TpmsAdaptiveMode::SteppedShells); - const std::vector shells = make_tpms_shells(field, square.front(), 20., 0.2f, 0.05f, TpmsAdaptiveGradient::Linear); + const AdaptiveInfillField field = radial_field(square, 40., AdaptiveInfillMode::SteppedShells); + const std::vector shells = make_adaptive_infill_shells(field, square.front(), 20., 0.2f, 0.05f, AdaptiveInfillGradient::Linear); REQUIRE(shells.size() == 5); CHECK_THAT(shells.front().density, WithinAbs(0.2, 1e-6)); CHECK_THAT(shells.back().density, WithinAbs(0.05, 1e-6)); @@ -270,11 +270,11 @@ TEST_CASE("TPMS stepped shells split a layer by depth from the surface inwards", [¢er](const ExPolygon &expolygon) { return expolygon.contains(center); })); } -TEST_CASE("TPMS radial field in 2D grades every section normal to the axis on its own", "[FillTpmsAdaptive]") +TEST_CASE("Adaptive infill field in 2D grades every section normal to the axis on its own", "[AdaptiveInfillField]") { // 20 x 20 x 60 mm: every section normal to Z is 10 mm from its center to the sides, whatever its height. const ExPolygons square{rectangle(0., 0., 20., 20.)}; - const TpmsRadialField normal_z = radial_field(square, 60., TpmsAdaptiveMode::NormalZ); + const AdaptiveInfillField normal_z = radial_field(square, 60., AdaptiveInfillMode::NormalZ); for (double z : {5., 30., 55.}) { CAPTURE(z); CHECK_THAT(radial(normal_z, {10., 10., z}), WithinAbs(0., Tolerance)); @@ -283,7 +283,7 @@ TEST_CASE("TPMS radial field in 2D grades every section normal to the axis on it } // Normal to X, the sections are 20 x 60 mm: 10 mm from the center to the sides, 30 mm to the top and the bottom. - const TpmsRadialField normal_x = radial_field(square, 60., TpmsAdaptiveMode::NormalX); + const AdaptiveInfillField normal_x = radial_field(square, 60., AdaptiveInfillMode::NormalX); for (double x : {3., 10., 17.}) { CAPTURE(x); CHECK_THAT(radial(normal_x, {x, 15., 30.}), WithinAbs(0.5, Tolerance)); diff --git a/tests/libslic3r/test_appconfig.cpp b/tests/libslic3r/test_appconfig.cpp index 01ceebc538..d4149c4fce 100644 --- a/tests/libslic3r/test_appconfig.cpp +++ b/tests/libslic3r/test_appconfig.cpp @@ -8,6 +8,17 @@ using namespace Slic3r; +TEST_CASE("Full collision-volume previews are opt-in and retain the user's preference", "[AppConfig][ExclusionVolume]") +{ + AppConfig config; + config.set_defaults(); + CHECK_FALSE(config.get_bool("show_collision_volumes")); + + config.set_bool("show_collision_volumes", true); + config.set_defaults(); + CHECK(config.get_bool("show_collision_volumes")); +} + TEST_CASE("AppConfig network version helpers", "[AppConfig]") { AppConfig config; diff --git a/tests/libslic3r/test_arrange.cpp b/tests/libslic3r/test_arrange.cpp index 030dd9e4b6..68669949a6 100644 --- a/tests/libslic3r/test_arrange.cpp +++ b/tests/libslic3r/test_arrange.cpp @@ -220,11 +220,39 @@ TEST_CASE("An item larger than the bed cannot be placed", "[Arrange]") ArrangePolygons items; items.emplace_back(make_square(scaled(20.))); items.emplace_back(make_square(scaled(400.))); // far bigger than the bed + // An item that cannot be placed keeps the position it came in with, so the + // caller can leave it where the user had it. + items[1].translation = {scaled(10.), scaled(20.)}; arrange(items, bed(200, 200), quiet_params(scaled(1.))); REQUIRE(items[0].bed_idx == 0); REQUIRE(items[1].bed_idx == UNARRANGED); + REQUIRE(items[1].translation.x() == scaled(10.)); + REQUIRE(items[1].translation.y() == scaled(20.)); +} + +TEST_CASE("An item filling the printable area is arranged", "[Arrange]") +{ + // The arrange bed keeps a margin from the printable area and the item is widened by + // its brim. Neither may keep an item that fits the printable area from being placed. + DynamicPrintConfig cfg = bed_config(); // 200 x 200 + ArrangeParams p = quiet_params(); + + ArrangePolygons items = squares(1, 197.); + items.front().brim_width = 1.; + update_arrange_params(p, &cfg, items); + update_selected_items_inflation(items, &cfg, p); + arrange(items, get_shrink_bedpts(&cfg, p), p); + REQUIRE(items.front().bed_idx == 0); + + // Larger than the printable area is still refused. + ArrangeParams p_large = quiet_params(); + ArrangePolygons large = squares(1, 201.); + update_arrange_params(p_large, &cfg, large); + update_selected_items_inflation(large, &cfg, p_large); + arrange(large, get_shrink_bedpts(&cfg, p_large), p_large); + REQUIRE(large.front().bed_idx == UNARRANGED); } TEST_CASE("Items overflowing one bed spill onto virtual beds", "[Arrange]") @@ -477,3 +505,71 @@ TEST_CASE("Layered printing does not floor the object distance", "[Arrange]") update_selected_items_inflation(items, &cfg, p); CHECK(p.min_obj_distance == 0); } + +TEST_CASE("Bed exclusions apply by physical nozzle and overlapping Z range", "[Arrange][ExclusionVolume][MultiNozzle]") +{ + ArrangePolygon object = make_square(scaled(20.)); + object.has_z_range = true; + object.z_min = 0.0; + object.z_max = 20.0; + object.bed_exclusion_extruder_ids = {1}; + + ArrangePolygon exclusion = make_square(scaled(20.)); + exclusion.is_bed_exclusion = true; + exclusion.has_z_range = true; + exclusion.z_min = 10.0; + exclusion.z_max = 30.0; + exclusion.bed_exclusion_extruder_id = 1; + + CHECK(bed_exclusion_applies(object, exclusion)); + + exclusion.bed_exclusion_extruder_id = 0; + CHECK_FALSE(bed_exclusion_applies(object, exclusion)); + + // Empty physical-nozzle assignments mean unresolved, so arrangement stays conservative. + object.bed_exclusion_extruder_ids.clear(); + CHECK(bed_exclusion_applies(object, exclusion)); + + object.bed_exclusion_extruder_ids = {0}; + object.z_max = 9.0; + CHECK_FALSE(bed_exclusion_applies(object, exclusion)); + + // Touching at one Z plane is intentionally treated as a collision. + object.z_max = 10.0; + CHECK(bed_exclusion_applies(object, exclusion)); +} + +TEST_CASE("Shared bed exclusions apply to every arranged object", "[Arrange][ExclusionVolume]") +{ + ArrangePolygon object = make_square(scaled(20.)); + object.bed_exclusion_extruder_ids = {1}; + + ArrangePolygon shared = make_square(scaled(20.)); + shared.is_bed_exclusion = true; + shared.bed_exclusion_extruder_id = -1; + + CHECK(has_bed_exclusion_regions({shared})); + CHECK_FALSE(has_bed_exclusion_regions({object})); + CHECK(bed_exclusion_applies(object, shared)); +} + +TEST_CASE("Arrange keeps relevant objects outside conditional exclusion obstacles", "[Arrange][ExclusionVolume]") +{ + ArrangePolygon exclusion = make_square(scaled(30.)); + exclusion.translation = Vec2crd(scaled(35.0), scaled(35.0)); + exclusion.is_bed_exclusion = true; + exclusion.bed_exclusion_extruder_id = 0; + + ArrangePolygons items = squares(4, 20.0); + for (ArrangePolygon &item : items) + item.bed_exclusion_extruder_ids = {0}; + + arrange(items, {exclusion}, bed(100.0, 100.0), quiet_params(scaled(1.0))); + + const ExPolygon excluded_shape = exclusion.transformed_poly(); + for (const ArrangePolygon &item : items) { + REQUIRE(item.bed_idx == 0); + CHECK(intersection(ExPolygons{item.transformed_poly()}, ExPolygons{excluded_shape}).empty()); + } + require_no_overlap(items); +} diff --git a/tests/libslic3r/test_clipper_utils.cpp b/tests/libslic3r/test_clipper_utils.cpp index c9026a9ba2..00c2fd56e3 100644 --- a/tests/libslic3r/test_clipper_utils.cpp +++ b/tests/libslic3r/test_clipper_utils.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include #include "libslic3r/Polygon.hpp" @@ -7,14 +9,21 @@ #include "libslic3r/libslic3r.h" #include #include +#include #include #include #include +#include +#include #include +#include #include +#include +#include #include "libslic3r/ClipperUtils.hpp" #include "libslic3r/ExPolygon.hpp" +#include "libslic3r/MultiPoint.hpp" #include "libslic3r/Point.hpp" using namespace Slic3r; @@ -300,3 +309,497 @@ TEST_CASE("Top level expolygons of an even-odd union", "[ClipperUtils]") { REQUIRE(area_sum == Catch::Approx(area(top_level) + area(nested))); REQUIRE(top_level_expolygons(reference).size() == 1); } + +// Rings flattened to x,y,x,y... and sorted, with each ring rotated to start at its lowest point: two +// encodings of the same geometry compare equal however the pieces came back or wherever a ring started. +static std::vector> canonical_rings(const ExPolygons &expolygons) +{ + std::vector> rings; + const auto add = [&rings](const Polygon &poly) { + if (poly.points.empty()) + return; + Points pts = poly.points; + std::rotate(pts.begin(), + std::min_element(pts.begin(), pts.end(), [](const Point &a, const Point &b) { + return std::make_pair(a.x(), a.y()) < std::make_pair(b.x(), b.y()); + }), + pts.end()); + std::vector flat; + flat.reserve(pts.size() * 2); + for (const Point &p : pts) { + flat.emplace_back(p.x()); + flat.emplace_back(p.y()); + } + rings.emplace_back(std::move(flat)); + }; + for (const ExPolygon &expoly : expolygons) { + add(expoly.contour); + for (const Polygon &hole : expoly.holes) + add(hole); + } + std::sort(rings.begin(), rings.end()); + return rings; +} + +// The same rings, every coordinate within `tolerance`. +static bool same_rings(const ExPolygons &a, const ExPolygons &b, coord_t tolerance) +{ + const std::vector> ra = canonical_rings(a), rb = canonical_rings(b); + return std::equal(ra.begin(), ra.end(), rb.begin(), rb.end(), [tolerance](const std::vector &x, const std::vector &y) { + return std::equal(x.begin(), x.end(), y.begin(), y.end(), [tolerance](coord_t u, coord_t v) { return std::abs(u - v) <= tolerance; }); + }); +} + +TEST_CASE("Tiled diff and intersection return the same polygons as the plain calls", "[ClipperUtils]") { + // A grid of disjoint framed squares, enough of them to be split into several tiles. + const int n = 40; + const coord_t cell = scaled(2.), side = scaled(1.5), frame = scaled(0.3); + ExPolygons subject; + for (int y = 0; y < n; ++ y) + for (int x = 0; x < n; ++ x) { + const Point o(x * cell, y * cell); + ExPolygon square(Polygon({ o, o + Point(side, 0), o + Point(side, side), o + Point(0, side) })); + Polygon hole({ o + Point(frame, frame), o + Point(frame, side - frame), o + Point(side - frame, side - frame), o + Point(side - frame, frame) }); + square.holes.emplace_back(std::move(hole)); + subject.emplace_back(std::move(square)); + } + // Clip polygons crossing many squares, one of them large with holes of its own. + Polygons clip; + const coord_t span = n * cell; + for (int i = 0; i < 8; ++ i) { + const coord_t y0 = coord_t(i) * span / 8, y1 = y0 + scaled(0.9); + clip.emplace_back(Polygon({ Point(- cell, y0), Point(span, y0 + cell * 3), Point(span, y1 + cell * 3), Point(- cell, y1) })); + } + ExPolygon big(Polygon({ Point(span / 4, span / 4), Point(3 * span / 4, span / 4), Point(3 * span / 4, 3 * span / 4), Point(span / 4, 3 * span / 4) })); + for (int i = 0; i < 4; ++ i) { + const Point o(span / 4 + scaled(3.1) + i * scaled(9.7), span / 4 + scaled(5.3)); + big.holes.emplace_back(Polygon({ o, o + Point(0, scaled(20.)), o + Point(scaled(5.), scaled(20.)), o + Point(scaled(5.), 0) })); + } + polygons_append(clip, to_polygons(big)); + + const ApplySafetyOffset safety = GENERATE(ApplySafetyOffset::No, ApplySafetyOffset::Yes); + + // The point of the fixture: below 128 pieces the helpers fall back to a single tile and the tiled + // path under test is never taken. + REQUIRE(ClipperUtils::tile_expolygons(subject, 32).size() > 1); + + // With the safety offset a tile unites fewer clip polygons, so Clipper2 can round a crossing 1 unit differently. + const coord_t tolerance = safety == ApplySafetyOffset::Yes ? 1 : 0; + + const ExPolygons diff_plain = diff_ex(subject, clip, safety); + const ExPolygons diff_tiled = diff_ex_by_piece(subject, clip, safety); + REQUIRE(area(diff_plain) > 0.); + CHECK(same_rings(diff_tiled, diff_plain, tolerance)); + + const ExPolygons intersection_plain = intersection_ex(subject, clip, safety); + const ExPolygons intersection_tiled = intersection_ex_by_piece(subject, clip, safety); + REQUIRE(area(intersection_plain) > 0.); + CHECK(same_rings(intersection_tiled, intersection_plain, tolerance)); +} + +TEST_CASE("Subtracting a far expansion gives the same polygons as diff with expand", "[ClipperUtils]") { + // As bridge_over_infill uses it: the lower layer's solids, each shrunk by the solid infill spacing on its own, expanded by + // two or four spacings. + const float spacing = scaled(0.45); + const float delta = GENERATE(2.f, 4.f) * spacing; + const auto expanded_diff = [delta](const Polygons &subject, const Polygons &clip) { return diff(subject, expand(clip, delta)); }; + // Whether the smaller round expansion that diff_expanded tries first covers the subject on its own. + const auto coarse_covers = [delta](const Polygons &subject, const Polygons &coarse) { + return diff(subject, expand(coarse, 0.7f * delta, jtRound, 0.01 * delta)).empty(); + }; + const auto rectangle = [](double x0, double y0, double x1, double y1) { + return Polygon::new_scale({ { x0, y0 }, { x1, y0 }, { x1, y1 }, { x0, y1 } }); + }; + // A rectangle whose sides are sawteeth 12 µm deep, as the slices of a relief are. + const auto sawtooth = [](double x0, double y0, double x1, double y1) { + const Vec2d corners[] = { { x0, y0 }, { x1, y0 }, { x1, y1 }, { x0, y1 } }; + Polygon out; + for (size_t i = 0; i < 4; ++ i) { + const Vec2d a = corners[i], b = corners[(i + 1) % 4], outward = Vec2d((b - a).y(), (a - b).x()).normalized(); + const int teeth = int(std::round((b - a).norm() / 0.024)); + for (int t = 0; t < teeth; ++ t) { + out.points.emplace_back(Point::new_scale(a + (b - a) * (t / double(teeth)))); + out.points.emplace_back(Point::new_scale(a + (b - a) * ((t + 0.5) / teeth) + 0.012 * outward)); + } + } + return out; + }; + + SECTION("A crack between solids shrunk apart is covered") { + const Polygons solids = shrink(Polygons{ rectangle(0., 0., 10., 10.), rectangle(10., 0., 20., 10.) }, spacing); + const Polygons subject{ rectangle(2., 2., 18., 8.) }; + REQUIRE_FALSE(diff(subject, solids).empty()); + CHECK(coarse_covers(subject, polygons_simplify(solids, delta / 8.))); + CHECK(expanded_diff(subject, solids).empty()); + CHECK(diff_expanded(subject, solids, delta).empty()); + } + SECTION("A crack between detailed solids shrunk apart is covered") { + const Polygons solids = shrink(Polygons{ sawtooth(0., 0., 10., 10.), sawtooth(10., 0., 20., 10.) }, spacing); + const Polygons subject{ rectangle(2., 2., 18., 8.) }; + REQUIRE_FALSE(diff(subject, solids).empty()); + // The shrink's miters cut steep teeth about 1.4 spacings deep, which widens the crack to about what the coarse + // expansion reaches at two spacings. So only the default reach, four spacings, is sure to take the early-out. + if (delta > 3.f * spacing) + CHECK(coarse_covers(subject, polygons_simplify(solids, delta / 8.))); + CHECK(expanded_diff(subject, solids).empty()); + CHECK(diff_expanded(subject, solids, delta).empty()); + } + SECTION("Strips too thin to survive the shrink leave the subject unsupported") { + const Polygons solids = shrink(Polygons{ rectangle(0., 0., 10., 10.), rectangle(10., 0., 10.6, 10.), rectangle(11.2, 0., 11.8, 10.), + rectangle(12.4, 0., 13., 10.) }, + spacing); + const Polygons subject{ rectangle(1., 1., 14., 9.) }; + const Polygons expected = expanded_diff(subject, solids); + REQUIRE_FALSE(expected.empty()); + CHECK(diff_expanded(subject, solids, delta) == expected); + } + SECTION("A hole wider than the expansion leaves the subject over it") { + Polygon hole = rectangle(5., 5., 15., 15.); + hole.reverse(); + const Polygons solids{ rectangle(0., 0., 20., 20.), hole }; + const Polygons subject{ rectangle(2., 2., 18., 18.) }; + const Polygons expected = expanded_diff(subject, solids); + REQUIRE_FALSE(expected.empty()); + CHECK(diff_expanded(subject, solids, delta) == expected); + } + SECTION("A hole that simplification removes is covered") { + Polygon hole = rectangle(5., 9.975, 10., 10.025); + hole.reverse(); + const Polygons solids{ rectangle(0., 0., 20., 20.), hole }; + const Polygons subject{ rectangle(2., 2., 18., 18.) }; + REQUIRE(polygons_simplify({ hole }, delta / 8.).empty()); + CHECK(expanded_diff(subject, solids).empty()); + CHECK(diff_expanded(subject, solids, delta).empty()); + } + SECTION("A thin C that simplification would turn into a hole is kept as it is") { + // A C 100 µm wide over a 10 mm radius at a tolerance of 0.5 mm, scaled with the tolerance. Arcs of 3,200 and 2,500 + // points leave 0.05 radians open at each end, and the path starts 4,500 points in. + const double scale = delta / 8. / scaled(0.5); + const auto arc = [](double radius, int n, Points &out) { + for (int i = 0; i < n; ++ i) { + const double a = 0.05 + (2. * PI - 0.1) * i / (n - 1); + out.emplace_back(coord_t(std::round(radius * std::cos(a))), coord_t(std::round(radius * std::sin(a)))); + } + }; + Points outer, inner; + arc(std::round(scale * scaled(10.)) + std::round(scale * scaled(0.1)), 3200, outer); + arc(std::round(scale * scaled(10.)), 2500, inner); + Polygon c(std::move(outer)); + c.points.insert(c.points.end(), inner.rbegin(), inner.rend()); + std::rotate(c.points.begin(), c.points.begin() + 4500, c.points.end()); + REQUIRE(c.is_counter_clockwise()); + REQUIRE(area(polygons_simplify({ c }, delta / 8.)) < 0.); + // A square beside the C, halfway round, which its own round expansion covers. + const coord_t x = coord_t(-scale * scaled(10.05)), half = coord_t(scale * scaled(0.2)); + const Polygons subject{ Polygon({ { x - half, -half }, { x + half, -half }, { x + half, half }, { x - half, half } }) }; + CHECK(coarse_covers(subject, { c })); + CHECK(expanded_diff(subject, { c }).empty()); + CHECK(diff_expanded(subject, { c }, delta).empty()); + } + SECTION("A path that simplifies into several contours and holes keeps its sign") { + // A band 1 mm wide winding once and a radian more, its end 20 µm outside its start, then on as a strand 40 µm wide for + // two radians. Simplified, the end crosses the start, closing a ring around holes, and the strand's sides cross each other. + const double radius = scaled(5.), width = scaled(1.), pitch = width + scaled(0.02), band_end = 2. * PI + 1., + end = band_end + 2.; + const int n = 6000; + Points outer, inner; + for (int i = 0; i < n; ++ i) { + const double t = end * i / (n - 1), centre = radius + pitch * t / (2. * PI), half = t <= band_end ? width / 2. : scaled(0.02); + outer.emplace_back(coord_t(std::round((centre + half) * std::cos(t))), coord_t(std::round((centre + half) * std::sin(t)))); + inner.emplace_back(coord_t(std::round((centre - half) * std::cos(t))), coord_t(std::round((centre - half) * std::sin(t)))); + } + Polygon band(std::move(outer)); + band.points.insert(band.points.end(), inner.rbegin(), inner.rend()); + REQUIRE(band.is_counter_clockwise()); + Points path = MultiPoint::_douglas_peucker(to_polyline(band).points, delta / 8.); + path.pop_back(); + const Polygons simplified = polygons_simplify({ band }, delta / 8.); + const size_t contours = size_t(std::count_if(simplified.begin(), simplified.end(), [](const Polygon &p) { return p.is_counter_clockwise(); })); + CHECK(contours >= 2); + CHECK(simplified.size() - contours >= 1); + CHECK((area(simplified) > 0.) == (Polygon(path).area() > 0.)); + const Polygons subject{ rectangle(-8., -8., 8., 8.) }; + CHECK(diff_expanded(subject, { band }, delta) == expanded_diff(subject, { band })); + } + SECTION("Random solids give the same polygons") { + // Overlapping rectangles, some too thin to survive the shrink, and jittered rings, under the region they cover and on + // every other seed a rectangle more. + size_t empty = 0, unsupported = 0; + for (unsigned seed = 1; seed <= 24; ++ seed) { + std::mt19937 rng(seed); + const auto uniform = [&rng](double from, double to) { return from + (to - from) * double(rng()) / double(std::mt19937::max()); }; + Polygons solids; + for (int i = 0; i < 6; ++ i) { + const double x = uniform(0., 40.), y = uniform(0., 40.); + solids.emplace_back(rectangle(x, y, x + uniform(0.3, 12.), y + uniform(0.3, 12.))); + } + for (int i = 0; i < 2; ++ i) { + const Vec2d centre(uniform(5., 45.), uniform(5., 45.)); + const double r = uniform(2., 8.), r_hole = r * uniform(0.3, 0.7); + Polygon ring, hole; + for (int k = 0; k < 96; ++ k) { + const Vec2d direction(std::cos(2. * PI * k / 96), std::sin(2. * PI * k / 96)); + ring.points.emplace_back(Point::new_scale(centre + r * uniform(0.97, 1.03) * direction)); + hole.points.emplace_back(Point::new_scale(centre + r_hole * uniform(0.97, 1.03) * direction)); + } + hole.reverse(); + solids.emplace_back(std::move(ring)); + solids.emplace_back(std::move(hole)); + } + Polygons covered = solids; + if (seed % 2 == 0) { + const double x = uniform(0., 40.), y = uniform(0., 40.); + covered.emplace_back(rectangle(x, y, x + uniform(2., 10.), y + uniform(2., 10.))); + } + const Polygons subject = shrink(union_(covered), spacing); + const Polygons shrunk = shrink(solids, spacing); + const Polygons expected = expanded_diff(subject, shrunk); + CHECK(diff_expanded(subject, shrunk, delta) == expected); + ++ (expected.empty() ? empty : unsupported); + } + // The seeds give both outcomes: subjects the solids support entirely, and subjects with unsupported parts left. + CHECK(empty > 0); + CHECK(unsupported > 0); + } +} + +// An outline with a small clockwise hole well inside it, cut along its edge by three clip polygons that never reach the +// hole. Clipper2 puts the hole at the top level of its PolyTree, beside the outline rather than under it. The coordinates +// come from a sliced layer reduced to the few paths that still do this; most changes to them don't. +static const Polygons misnesting_subject{ + Polygon({ { 23000000, 31000000 }, { 7500000, 25900000 }, { 200000, 26450004 }, { 0, 26450004 }, { 0, 26550004 }, + { -100000, 26550004 }, { -300000, 26600000 }, { 13000000, 0 } }), + Polygon({ { 10200000, 24250000 }, { 10500000, 24250000 }, { 9800000, 24000000 } }), + Polygon({ { 4500000, 22500000 }, { 5000000, 22000000 }, { 4000000, 22000000 } }), +}; +static const Polygons misnesting_clip{ + Polygon({ { 0, 26550004 }, { -200000, 26550004 }, { -200000, 26000000 } }), + Polygon({ { 0, 26450004 }, { 100000, 26450004 }, { 0, 26000000 } }), + Polygon({ { 10000000, 24000000 }, { 10199999, 24250000 }, { 10500000, 24250000 }, { 8000000, 26500000 } }), +}; + +// The case above inside a frame, a square outline with a square hole around the case, and with an island in its hole. +// Clipper2 then puts the hole beside the outline inside the frame's hole, where the frame and the outline both enclose +// it, and the island under the misplaced hole. +static Polygons misnesting_framed_subject() +{ + Polygons subject = misnesting_subject; + subject.emplace_back(Polygon({ { -2000000, -2000000 }, { 25000000, -2000000 }, { 25000000, 33000000 }, { -2000000, 33000000 } })); + subject.emplace_back(Polygon({ { -1000000, -1000000 }, { -1000000, 32000000 }, { 24000000, 32000000 }, { 24000000, -1000000 } })); + subject.emplace_back(Polygon({ { 4400000, 22100000 }, { 4600000, 22100000 }, { 4500000, 22300000 } })); + return subject; +} +// In the hole of the framed case, beside its island. +static const Point in_framed_hole(4500000, 22400000); +// In the island of the framed case. +static const Point in_framed_island(4500000, 22150000); + +static void check_orientation(const ExPolygons &expolygons) +{ + for (const ExPolygon &expoly : expolygons) { + CHECK(expoly.contour.is_counter_clockwise()); + for (const Polygon &hole : expoly.holes) + CHECK(hole.is_clockwise()); + } +} + +// How many of the expolygons contain the point, each on its own, as a per-piece operation sees them. +static size_t pieces_containing(const ExPolygons &expolygons, const Point &pt) +{ + return std::count_if(expolygons.begin(), expolygons.end(), [&pt](const ExPolygon &expoly) { return expoly.contains(pt); }); +} + +TEST_CASE("Every hole of a boolean result belongs to the expolygon around it", "[ClipperUtils]") { + const Polygon &hole = misnesting_subject.back(); + REQUIRE(hole.is_clockwise()); + const ExPolygons result = diff_ex(misnesting_subject, misnesting_clip); + check_orientation(result); + CHECK(pieces_containing(result, hole.centroid()) == 0); + CHECK_THAT(area(result), Catch::Matchers::WithinRel(area(diff(misnesting_subject, misnesting_clip)), 1e-9)); +} + +TEST_CASE("A misplaced hole goes to the innermost contour around it, an island in it stays filled", "[ClipperUtils]") { + const Polygons subject = misnesting_framed_subject(); + const ExPolygons result = diff_ex(subject, misnesting_clip); + check_orientation(result); + // Given to the frame instead of the outline, the hole would leave the outline covering it. + CHECK(pieces_containing(result, in_framed_hole) == 0); + CHECK(pieces_containing(result, in_framed_island) == 1); + CHECK_THAT(area(result), Catch::Matchers::WithinRel(area(diff(subject, misnesting_clip)), 1e-9)); +} + +TEST_CASE("A misplaced hole touching the contour around it goes to that contour", "[ClipperUtils]") { + // The first two vertices of the hole the subject's triangle cuts round a fraction of a unit outside the outline, the + // third is well inside it. Reduced from a sliced layer; Clipper2 puts the hole at the top level of its PolyTree. + const Polygons subject{ + Polygon({ { 1000000, 5000000 }, { 1000000, 4000000 }, { 6000000, 0 } }), + Polygon({ { 1024999, 4500000 }, { 1100011, 4574998 }, { 1100011, 4450000 } }), + }; + const Polygons clip{ + Polygon({ { 1500000, 5000000 }, { 1062508, 4612507 }, { 1212486, 4462504 } }), + Polygon({ { 1100000, 4430000 }, { 1024998, 4500001 }, { 2000000, 3000000 } }), + }; + const ExPolygons result = diff_ex(subject, clip); + check_orientation(result); + CHECK(pieces_containing(result, subject.back().centroid()) == 0); + CHECK_THAT(area(result), Catch::Matchers::WithinRel(area(diff(subject, clip)), 1e-9)); +} + +TEST_CASE("A misplaced island comes out as an expolygon of its own", "[ClipperUtils]") { + // Clipper2 puts the island of this result directly under the outer contour, at the level of its holes, instead of + // under the hole around it. Reduced from a sliced layer. + const Polygons subject{ + Polygon({ { 5200000, 700000 }, { 0, 5000000 }, { 0, 0 } }), + Polygon({ { 3100000, 825000 }, { 3250000, 900001 }, { 3250000, 1000000 }, { 4000000, 1500000 }, { 3000000, 500000 } }), + }; + const Polygons clip{ + Polygon({ { 4500000, 1200000 }, { 4000000, 1000000 }, { 5000000, 800000 } }), + Polygon({ { 3250000, 900001 }, { 3250000, 1000000 }, { 3000000, 1000000 }, { 3500000, 1100000 }, { 3100000, 1000000 }, { 3183343, 866672 } }), + Polygon({ { 4000000, 1000000 }, { 4000000, 1000000 }, { 4000000, 1000000 } }), + }; + const ExPolygons result = diff_ex(subject, clip); + check_orientation(result); + // In the island. + CHECK(pieces_containing(result, Point(3230000, 1020000)) == 1); + CHECK_THAT(area(result), Catch::Matchers::WithinRel(area(diff(subject, clip)), 1e-9)); +} + +TEST_CASE("Nested islands of an even-odd union keep their misplaced holes", "[ClipperUtils]") { + // The framed case as one even-odd union: the frame is the top level, everything in its hole is nested, and Clipper2 + // puts the case's hole beside the outline among the nested islands. + ExPolygons input; + for (const Polygon &polygon : misnesting_framed_subject()) + input.emplace_back(polygon); + for (const Polygon &polygon : misnesting_clip) + input.emplace_back(polygon); + ExPolygons nested; + const ExPolygons top_level = top_level_expolygons(input, &nested); + REQUIRE(top_level.size() == 1); + check_orientation(nested); + CHECK(pieces_containing(nested, in_framed_hole) == 0); + CHECK(pieces_containing(nested, in_framed_island) == 1); +} + +TEST_CASE("Loops chained outside in keep their nesting where Clipper2 misplaces one", "[ClipperUtils]") { + // An even-odd union of the case's paths leaves the hole at the top level of the PolyTree, among the outer loops. + Polygons loops = misnesting_subject; + polygons_append(loops, misnesting_clip); + const Polygons chained = union_pt_chained_outside_in(loops); + REQUIRE(chained.size() == 7); + for (const Polygon &loop : chained) + CHECK(loop.is_counter_clockwise()); + // The hole's loop comes right after the outline's, which has no other loop inside it. + const auto outline = std::max_element(chained.begin(), chained.end(), [](const Polygon &a, const Polygon &b) { return a.area() < b.area(); }); + REQUIRE(outline + 1 != chained.end()); + CHECK((outline + 1)->area() == Catch::Approx(- misnesting_subject.back().area())); +} + +TEST_CASE("A misplaced hole hugging an island inside it still goes to the outline", "[ClipperUtils]") { + // The case's hole with an island filling most of it, 20 units from it: the hole's vertices all lie close to the + // island and its middle inside it, yet the island is inside the hole, not around it. + Polygons subject = misnesting_subject; + subject.emplace_back(Polygon({ { 4000020, 22000010 }, { 4500000, 22150000 }, { 4999980, 22000010 }, + { 4650000, 22160000 }, { 4500000, 22499980 }, { 4350000, 22160000 } })); + const ExPolygons result = diff_ex(subject, misnesting_clip); + check_orientation(result); + // In the hole below the island, and in the island. + CHECK(pieces_containing(result, Point(4500000, 22050000)) == 0); + CHECK(pieces_containing(result, Point(4500000, 22300000)) == 1); + CHECK_THAT(area(result), Catch::Matchers::WithinRel(area(diff(subject, misnesting_clip)), 1e-9)); +} + +TEST_CASE("A concave misplaced hole touching the outline at every vertex goes to it", "[ClipperUtils]") { + // The case with the outline drawn in to two more vertices and the hole replaced by a concave pentagon, each of its + // vertices within 3 units of the outline; the middle of its bounding box is outside both. + Polygons subject = misnesting_subject; + subject.front().points.insert(subject.front().points.end(), { { 7000000, 20000000 }, { 20000000, 22000000 } }); + subject.back() = Polygon({ { 1500002, 22999999 }, { 20333332, 22999999 }, { 19999999, 22000001 }, { 6999998, 20000001 }, { 12999995, 13 } }); + const ExPolygons result = diff_ex(subject, misnesting_clip); + check_orientation(result); + CHECK(pieces_containing(result, Point(10000000, 22500000)) == 0); + CHECK_THAT(area(result), Catch::Matchers::WithinRel(area(diff(subject, misnesting_clip)), 1e-9)); +} + +TEST_CASE("A point strictly inside a polygon, where there is one", "[ClipperUtils]") { + // A notch with a horizontal edge at the middle of its bounding box, so a line through that middle runs along the edge; + // two lobes joined by a one unit neck and a square with a one unit spike, where the widest band between vertex heights + // runs through the thin part. + const Polygons wide{ + Polygon({ { 0, 0 }, { 2000000, 0 }, { 2000000, 5000000 }, { 8000000, 5000000 }, { 8000000, 0 }, { 10000000, 0 }, + { 10000000, 10000000 }, { 0, 10000000 } }), + Polygon({ { 0, 0 }, { 100, 0 }, { 100, 5 }, { 51, 5 }, { 51, 25 }, { 100, 25 }, { 100, 30 }, { 0, 30 }, { 0, 25 }, + { 50, 25 }, { 50, 5 }, { 0, 5 } }), + Polygon({ { 0, 0 }, { 1000000, 0 }, { 1000000, 1000000 }, { 500001, 1000000 }, { 500001, 5000000 }, { 500000, 5000000 }, + { 500000, 1000000 }, { 0, 1000000 } }), + }; + for (Polygon polygon : wide) + for (int winding = 0; winding < 2; ++ winding, polygon.reverse()) { + const std::optional pt = ClipperUtils::interior_point(polygon); + REQUIRE(pt); + CHECK(contains(polygon, *pt, false)); + } + // One unit thick everywhere, these hold no grid point strictly inside: a strip, and rows one unit high joined at the + // left. + CHECK_FALSE(ClipperUtils::interior_point(Polygon({ { 0, 0 }, { 1000, 0 }, { 1000, 1 }, { 0, 1 } }))); + Polygon rows({ { 0, 0 }, { 100, 0 } }); + for (coord_t y = 1; y < 100; y += 2) + rows.points.insert(rows.points.end(), { { 100, y }, { 1, y }, { 1, y + 1 }, { 100, y + 1 } }); + rows.points.emplace_back(0, 100); + CHECK_FALSE(ClipperUtils::interior_point(rows)); +} + +TEST_CASE("A correctly nested result converts in the order of its tree", "[ClipperUtils]") { + // Two squares, one with a hole holding an island, the other with two holes and a corner cut off. Clipper2 nests this + // correctly, so the expolygons follow its tree, each path as Clipper2 returned it: an outline with its holes in tree + // order, then the islands of those holes, outline by outline. + const Polygons subject{ + Polygon({ { 0, 0 }, { 10000000, 0 }, { 10000000, 10000000 }, { 0, 10000000 } }), + Polygon({ { 2000000, 2000000 }, { 2000000, 8000000 }, { 8000000, 8000000 }, { 8000000, 2000000 } }), + Polygon({ { 4000000, 4000000 }, { 6000000, 4000000 }, { 6000000, 6000000 }, { 4000000, 6000000 } }), + Polygon({ { 20000000, 0 }, { 32000000, 0 }, { 32000000, 12000000 }, { 20000000, 12000000 } }), + Polygon({ { 21000000, 1000000 }, { 21000000, 4000000 }, { 24000000, 4000000 }, { 24000000, 1000000 } }), + Polygon({ { 26000000, 6000000 }, { 26000000, 10000000 }, { 30000000, 10000000 }, { 30000000, 6000000 } }), + }; + const Polygons clip{ Polygon({ { 31000000, -1000000 }, { 33000000, -1000000 }, { 33000000, 1000000 }, { 31000000, 1000000 } }) }; + ExPolygons expected(3); + expected[0].contour = Polygon({ { 31000000, 1000000 }, { 32000000, 1000000 }, { 32000000, 12000000 }, { 20000000, 12000000 }, + { 20000000, 0 }, { 31000000, 0 } }); + expected[0].holes = { Polygon({ { 26000000, 10000000 }, { 30000000, 10000000 }, { 30000000, 6000000 }, { 26000000, 6000000 } }), + Polygon({ { 21000000, 4000000 }, { 24000000, 4000000 }, { 24000000, 1000000 }, { 21000000, 1000000 } }) }; + expected[1].contour = Polygon({ { 10000000, 10000000 }, { 0, 10000000 }, { 0, 0 }, { 10000000, 0 } }); + expected[1].holes = { Polygon({ { 2000000, 8000000 }, { 8000000, 8000000 }, { 8000000, 2000000 }, { 2000000, 2000000 } }) }; + expected[2].contour = Polygon({ { 6000000, 6000000 }, { 4000000, 6000000 }, { 4000000, 4000000 }, { 6000000, 4000000 } }); + CHECK(diff_ex(subject, clip) == expected); +} + +TEST_CASE("Loops of a correctly nested union chain in the order of its tree", "[ClipperUtils]") { + // Three nested squares and two more beside them, as concentric fill hands them over: chained outside in, depth first, + // each loop as Clipper2 returned it, the holes reversed to run counter-clockwise. + const Polygons loops{ + Polygon({ { 0, 0 }, { 10000000, 0 }, { 10000000, 10000000 }, { 0, 10000000 } }), + Polygon({ { 1000000, 1000000 }, { 9000000, 1000000 }, { 9000000, 9000000 }, { 1000000, 9000000 } }), + Polygon({ { 2000000, 2000000 }, { 8000000, 2000000 }, { 8000000, 8000000 }, { 2000000, 8000000 } }), + Polygon({ { 20000000, 0 }, { 32000000, 0 }, { 32000000, 12000000 }, { 20000000, 12000000 } }), + Polygon({ { 21000000, 1000000 }, { 31000000, 1000000 }, { 31000000, 11000000 }, { 21000000, 11000000 } }), + }; + const Polygons expected{ + Polygon({ { 10000000, 10000000 }, { 0, 10000000 }, { 0, 0 }, { 10000000, 0 } }), + Polygon({ { 9000000, 1000000 }, { 9000000, 9000000 }, { 1000000, 9000000 }, { 1000000, 1000000 } }), + Polygon({ { 8000000, 8000000 }, { 2000000, 8000000 }, { 2000000, 2000000 }, { 8000000, 2000000 } }), + Polygon({ { 32000000, 12000000 }, { 20000000, 12000000 }, { 20000000, 0 }, { 32000000, 0 } }), + Polygon({ { 31000000, 1000000 }, { 31000000, 11000000 }, { 21000000, 11000000 }, { 21000000, 1000000 } }), + }; + CHECK(union_pt_chained_outside_in(loops) == expected); +} + +TEST_CASE("A clockwise sliver with nothing around it comes back as Clipper2 returned it", "[ClipperUtils]") { + // Rounding leaves a clockwise sliver of half a square unit beside the result's one piece, outside it. Reduced from a + // sliced layer. It is no hole of anything, so it stays a contour of its own, neither dropped nor given to the piece. + const Polygons subject{ Polygon({ { 875000, 200000 }, { 900002, 175002 }, { 950001, 150004 } }) }; + const Polygons clip{ Polygon({ { 879409, 185299 }, { 950000, 150004 }, { 1000000, 200000 } }) }; + const ExPolygons result = diff_ex(subject, clip); + REQUIRE(result.size() == 2); + CHECK(std::count_if(result.begin(), result.end(), [](const ExPolygon &expoly) { return expoly.contour.is_clockwise() && expoly.holes.empty(); }) == 1); + CHECK(std::all_of(result.begin(), result.end(), [](const ExPolygon &expoly) { return expoly.holes.empty(); })); + CHECK_THAT(area(result), Catch::Matchers::WithinRel(area(diff(subject, clip)), 1e-9)); +} diff --git a/tests/libslic3r/test_config.cpp b/tests/libslic3r/test_config.cpp index 20177bcc07..fdab25bafb 100644 --- a/tests/libslic3r/test_config.cpp +++ b/tests/libslic3r/test_config.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -1263,6 +1264,55 @@ TEST_CASE("read_cli rejects an invalid scalar numeric value", "[Config]") { REQUIRE_FALSE(config.read_cli(3, argv, &extra, &keys)); } +TEST_CASE("A scalar option keeps its value when deserializing fails", "[Config]") { + using Catch::Matchers::WithinAbs; + + SECTION("float") { + ConfigOptionFloat opt(7.5); + REQUIRE_FALSE(opt.deserialize("abc")); + CHECK_THAT(opt.value, WithinAbs(7.5, 1e-9)); + } + SECTION("int") { + ConfigOptionInt opt(3); + REQUIRE_FALSE(opt.deserialize("abc")); + CHECK(opt.value == 3); + } + SECTION("percent") { + ConfigOptionPercent opt(40.); + REQUIRE_FALSE(opt.deserialize("abc%")); + CHECK_THAT(opt.value, WithinAbs(40., 1e-9)); + } + SECTION("float or percent") { + ConfigOptionFloatOrPercent opt(0.4, false); + REQUIRE_FALSE(opt.deserialize("abc%")); + CHECK_THAT(opt.value, WithinAbs(0.4, 1e-9)); + CHECK_FALSE(opt.percent); + } + SECTION("point") { + ConfigOptionPoint opt(Vec2d(1., 2.)); + REQUIRE_FALSE(opt.deserialize("5,abc")); + CHECK(opt.value == Vec2d(1., 2.)); + } + SECTION("point3") { + ConfigOptionPoint3 opt(Vec3d(1., 2., 3.)); + REQUIRE_FALSE(opt.deserialize("5,6,abc")); + CHECK(opt.value == Vec3d(1., 2., 3.)); + } +} + +TEST_CASE("A scalar option still takes a valid value", "[Config]") { + using Catch::Matchers::WithinAbs; + + ConfigOptionFloatOrPercent opt(0.4, false); + REQUIRE(opt.deserialize("50%")); + CHECK_THAT(opt.value, WithinAbs(50., 1e-9)); + CHECK(opt.percent); + + ConfigOptionPoint point; + REQUIRE(point.deserialize("3x4")); + CHECK(point.value == Vec2d(3., 4.)); +} + TEST_CASE("read_cli appends values when a vector option is repeated", "[Config]") { Slic3r::DynamicPrintConfig config; t_config_option_keys extra, keys; @@ -1457,6 +1507,47 @@ TEST_CASE("min_object_distance yields no floor when an FFF config lacks the opti } } +TEST_CASE("handle_legacy maps the boolean arc fitting values to modes", "[Config]") { + const auto [value, mode] = GENERATE(table({ + { "0", ArcFittingMode::Disabled }, + { "false", ArcFittingMode::Disabled }, + { "1", ArcFittingMode::Enabled }, + { "true", ArcFittingMode::Enabled }, + { "sparse_infill", ArcFittingMode::SparseInfill }, + })); + INFO(value); + ConfigSubstitutionContext ctxt(ForwardCompatibilitySubstitutionRule::Disable); + DynamicPrintConfig config; + config.set_deserialize("enable_arc_fitting", value, ctxt); + CHECK(config.opt_enum("enable_arc_fitting") == mode); +} + +TEST_CASE("handle_legacy migrates the adaptive TPMS keys", "[Config]") { + ConfigSubstitutionContext ctxt(ForwardCompatibilitySubstitutionRule::Enable); + DynamicPrintConfig config; + config.set_deserialize("tpms_adaptive", "stepped_shells", ctxt); + config.set_deserialize("tpms_interior_density", "12%", ctxt); + config.set_deserialize("tpms_adaptive_gradient", "quadratic", ctxt); + + CHECK(config.opt_enum("adaptive_infill_mode") == AdaptiveInfillMode::SteppedShells); + CHECK(config.option("adaptive_infill_interior_density")->value == Catch::Approx(12.)); + CHECK(config.opt_enum("adaptive_infill_gradient") == AdaptiveInfillGradient::Quadratic); + CHECK(ctxt.substitutions.empty()); +} + +TEST_CASE("silent_mode is no longer saved and is dropped on load", "[Config]") { + DynamicPrintConfig full; + full.apply(FullPrintConfig::defaults()); + CHECK_FALSE(full.has("silent_mode")); + + // Projects saved before its removal still carry it. + ConfigSubstitutionContext ctxt(ForwardCompatibilitySubstitutionRule::Enable); + DynamicPrintConfig config; + config.set_deserialize("silent_mode", "0", ctxt); + CHECK_FALSE(config.has("silent_mode")); + CHECK(ctxt.unrecogized_keys == std::vector{"silent_mode"}); +} + TEST_CASE("handle_legacy migrates every IDEX/IQEX key testers already have", "[Config]") { // Three eras of saved profiles: the feature shipped as iXex (is_ixex + ixex_*), the clearance // pair was renamed to say what it measures, then the whole prefix became imex_. Driven from the @@ -1665,3 +1756,98 @@ TEST_CASE("Default options of enum lists get their definition's keys map", "[Con } CHECK(enum_lists > 0); } + +TEST_CASE("Custom G-code placeholder lists are keyed by option keys", "[Config]") +{ + const auto &placeholders = custom_gcode_specific_placeholders(); + REQUIRE_FALSE(placeholders.empty()); + for (const auto &[gcode_key, keys] : placeholders) { + INFO(gcode_key); + CHECK(print_config_def.has(gcode_key)); + } + + // Multiline text options that aren't custom G-code; add any new one that isn't G-code here. + const std::set not_gcode = { "notes", "filament_notes", "printer_notes", "post_process", + "adaptive_pressure_advance_model", "small_area_infill_flow_compensation_model" }; + size_t gcode_options = 0; + for (const auto &[key, def] : print_config_def.options) { + if (!def.multiline || not_gcode.count(key) > 0) + continue; + INFO(key); + CHECK(placeholders.count(key) == 1); + ++gcode_options; + } + CHECK(gcode_options == placeholders.size()); +} + +TEST_CASE("A disabled filament override survives the merge with a parent that sets it", "[Config][Variant]") +{ + std::set no_keys; + Slic3r::DynamicPrintConfig parent; + parent.set_deserialize_strict("filament_retract_before_wipe", "100%"); + parent.set_deserialize_strict("filament_ironing_flow", "15%"); + Slic3r::DynamicPrintConfig child; + child.set_deserialize_strict("filament_retract_before_wipe", "nil"); + child.set_deserialize_strict("filament_ironing_flow", "nil"); + parent.update_diff_values_to_child_config(child, "", "filament_extruder_variant", + Slic3r::filament_options_with_variant, no_keys); + CHECK(parent.opt_serialize("filament_retract_before_wipe") == "nil"); + CHECK(parent.opt_serialize("filament_ironing_flow") == "nil"); +} + +SCENARIO("A two-variant child's disabled override column is matched to the parent's variant by name", "[Config][Variant]") +{ + std::set no_keys; + GIVEN("A two-variant filament parent") { + Slic3r::DynamicPrintConfig parent; + parent.set_deserialize_strict("filament_extruder_variant", "Direct Drive Standard;Direct Drive High Flow"); + parent.set_deserialize_strict("filament_retract_before_wipe", "100%,100%"); + parent.set_deserialize_strict("filament_flow_ratio", "1,1"); + WHEN("the child disables the override on one variant and leaves a plain option nil on it") { + Slic3r::DynamicPrintConfig child; + child.set_deserialize_strict("filament_extruder_variant", "Direct Drive Standard;Direct Drive High Flow"); + child.set_deserialize_strict("filament_retract_before_wipe", "nil,100%"); + child.set_deserialize_strict("filament_flow_ratio", "nil,1.1"); + parent.update_diff_values_to_child_config(child, "", "filament_extruder_variant", + Slic3r::filament_options_with_variant, no_keys); + THEN("the override column is disabled while the plain option's nil column inherits") { + CHECK(parent.opt_serialize("filament_retract_before_wipe") == "nil,100%"); + CHECK(parent.opt_serialize("filament_flow_ratio") == "1,1.1"); + } + } + WHEN("the child lists the same variants in the other order") { + Slic3r::DynamicPrintConfig child; + child.set_deserialize_strict("filament_extruder_variant", "Direct Drive High Flow;Direct Drive Standard"); + child.set_deserialize_strict("filament_retract_before_wipe", "70%,nil"); + child.set_deserialize_strict("filament_flow_ratio", "1.1,nil"); + parent.update_diff_values_to_child_config(child, "", "filament_extruder_variant", + Slic3r::filament_options_with_variant, no_keys); + THEN("columns are matched by variant name, the disabled one included") { + CHECK(parent.opt_serialize("filament_retract_before_wipe") == "nil,70%"); + CHECK(parent.opt_serialize("filament_flow_ratio") == "1,1.1"); + } + } + WHEN("the child was saved with a single variant") { + Slic3r::DynamicPrintConfig child; + child.set_deserialize_strict("filament_extruder_variant", "Direct Drive Standard"); + child.set_deserialize_strict("filament_retract_before_wipe", "nil"); + parent.update_diff_values_to_child_config(child, "", "filament_extruder_variant", + Slic3r::filament_options_with_variant, no_keys); + THEN("its one value applies to every variant of that extruder, as slicing does") { + CHECK(parent.opt_serialize("filament_retract_before_wipe") == "nil,nil"); + } + } + } +} + +TEST_CASE("Every listed filament override is nullable", "[Config]") +{ + std::set overrides(Slic3r::filament_extruder_override_keys.begin(), Slic3r::filament_extruder_override_keys.end()); + overrides.insert({ "filament_retract_length_nc", "filament_ironing_flow", "filament_ironing_spacing", "filament_ironing_inset", "filament_ironing_speed" }); + for (const auto &[key, def] : Slic3r::print_config_def.options) { + INFO(key); + CHECK(Slic3r::is_filament_extruder_override_key(key) == (overrides.count(key) == 1)); + if (overrides.count(key) == 1) + CHECK(def.nullable); + } +} diff --git a/tests/libslic3r/test_connected_bodies.cpp b/tests/libslic3r/test_connected_bodies.cpp index b4e897ffe3..56e604e46d 100644 --- a/tests/libslic3r/test_connected_bodies.cpp +++ b/tests/libslic3r/test_connected_bodies.cpp @@ -23,6 +23,21 @@ namespace { ExPolygon rectangle(double x, double width) { return ExPolygon(Polygon::new_scale({ { x, 0. }, { x + width, 0. }, { x + width, 10. }, { x, 10. } })); } +// A ring from 0 to 30 mm with a hole from 5 to 25 mm, an island from 10 to 20 mm in that hole, and one from 40 to 50 mm alone. +ExPolygons ring_inner_alone() +{ + const auto square = [](double from, double to) { + return Polygon::new_scale({ { from, from }, { to, from }, { to, to }, { from, to } }); + }; + Polygon hole = square(5., 25.); + hole.make_clockwise(); + ExPolygon ring(square(0., 30.)); + ring.holes.emplace_back(hole); + return { ring, ExPolygon(square(10., 20.)), ExPolygon(square(40., 50.)) }; +} + +Point at(double x, double y) { return Point::new_scale(x, y); } + } // namespace TEST_CASE("Islands overlapping their neighbors' make one body", "[ConnectedBodies]") @@ -48,17 +63,8 @@ TEST_CASE("Islands overlapping their neighbors' make one body", "[ConnectedBodie TEST_CASE("The island locator tests the outlines only where boxes overlap", "[ConnectedBodies]") { - const auto square = [](double from, double to) { - return Polygon::new_scale({ { from, from }, { to, from }, { to, to }, { from, to } }); - }; - Polygon hole = square(5., 25.); - hole.make_clockwise(); - ExPolygon ring(square(0., 30.)); - ring.holes.emplace_back(hole); - ExPolygon alone(square(40., 50.)); - const ExPolygons islands = { ring, ExPolygon(square(10., 20.)), alone }; + const ExPolygons islands = ring_inner_alone(); const IslandLocator locator(islands, scaled(1.)); - const auto at = [](double x, double y) { return Point::new_scale(x, y); }; CHECK(locator.find(at(2., 2.)).first == 0); CHECK(locator.find(at(15., 15.)).first == 1); @@ -77,6 +83,23 @@ TEST_CASE("The island locator tests the outlines only where boxes overlap", "[Co CHECK(locator.find(at(35., 45.)).first == -1); } +TEST_CASE("Islands not told apart are found by their boxes", "[ConnectedBodies]") +{ + const ExPolygons islands = ring_inner_alone(); + const IslandLocator locator(islands, scaled(1.), false); + + // In the ring's hole, outside the island within it, the ring's box holds the point. + CHECK(locator.holds(0, at(7., 15.))); + const auto [island, distance] = locator.find(at(7., 15.)); + CHECK(island == 0); + CHECK_THAT(distance, WithinAbs(0., 0.)); + // A strict call still tests the outline: the ring is only the nearest, 2 mm away. + CHECK_FALSE(locator.holds(0, at(7., 15.), true)); + const auto [nearest, strict_distance] = locator.find(at(7., 15.), true); + CHECK(nearest == 0); + CHECK_THAT(strict_distance, WithinRel(sqr(scaled(2.)), 1e-6)); +} + TEST_CASE("Separate solids are separate bodies", "[ConnectedBodies]") { const indexed_triangle_set cube = its_make_cube(10., 10., 10.); diff --git a/tests/libslic3r/test_edge_grid.cpp b/tests/libslic3r/test_edge_grid.cpp new file mode 100644 index 0000000000..406ea198cf --- /dev/null +++ b/tests/libslic3r/test_edge_grid.cpp @@ -0,0 +1,33 @@ +#include +#include +#include "catch2/matchers/catch_matchers.hpp" +#include "libslic3r/BoundingBox.hpp" +#include "libslic3r/EdgeGrid.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/Polygon.hpp" +#include "libslic3r/libslic3r.h" + +using namespace Slic3r; + +TEST_CASE("EdgeGrid propagates signed distances across the interior and exterior", "[EdgeGrid][Regression]") +{ + const Polygon rectangle {Point::new_scale(-10., -12.), Point::new_scale(10., -12.), + Point::new_scale(10., 12.), Point::new_scale(-10., 12.)}; + const Polygons outlines {rectangle}; + const BoundingBox bounds(Point::new_scale(-30., -32.), Point::new_scale(30., 32.)); + EdgeGrid::Grid grid(bounds); + grid.create(outlines, scale_(1.)); + // Distances beyond the initialized edge band require backward propagation. + // With -fsanitize=shift, this also checks negative neighbour offsets. + grid.calculate_sdf(); + const auto distance = [&](double x, double y) { + return grid.signed_distance_bilinear(Point::new_scale(x, y)) * SCALING_FACTOR; + }; + REQUIRE_THAT(distance(0., 0.), Catch::Matchers::WithinAbs(-10., 0.01)); + for (double sign : {-1., 1.}) { + REQUIRE_THAT(distance(sign * 5., 0.), Catch::Matchers::WithinAbs(-5., 0.01)); + REQUIRE_THAT(distance(0., sign * 7.), Catch::Matchers::WithinAbs(-5., 0.01)); + REQUIRE_THAT(distance(sign * 20., 0.), Catch::Matchers::WithinAbs(10., 0.01)); + REQUIRE_THAT(distance(0., sign * 22.), Catch::Matchers::WithinAbs(10., 0.01)); + } +} diff --git a/tests/libslic3r/test_exclusion_volumes.cpp b/tests/libslic3r/test_exclusion_volumes.cpp new file mode 100644 index 0000000000..d006e88b54 --- /dev/null +++ b/tests/libslic3r/test_exclusion_volumes.cpp @@ -0,0 +1,601 @@ +#include +#include +#include +#include +#include +#include "libslic3r/Config.hpp" +#include "libslic3r/ExPolygon.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/Polygon.hpp" +#include "libslic3r/libslic3r.h" + +#include "libslic3r/BoundingBox.hpp" +#include "libslic3r/ExclusionVolumeGeometry.hpp" +#include "libslic3r/Model.hpp" +#include "libslic3r/PrintConfig.hpp" +#include "libslic3r/TriangleMesh.hpp" + +#include +#include +#include +#include +#include +#include + +using namespace Slic3r; +using Catch::Matchers::WithinAbs; + +namespace { + +Polygon rectangle(double min_x, double min_y, double max_x, double max_y) +{ + Polygon polygon({ + Point::new_scale(min_x, min_y), + Point::new_scale(max_x, min_y), + Point::new_scale(max_x, max_y), + Point::new_scale(min_x, max_y), + }); + polygon.make_counter_clockwise(); + return polygon; +} + +BedExcludeRegion region(double min_x, double min_y, double max_x, double max_y, + double z_min, double z_max, bool has_z_range = true) +{ + return {rectangle(min_x, min_y, max_x, max_y), z_min, z_max, + BedExcludeRegion::Purpose::CollisionVolume, has_z_range}; +} + +DynamicPrintConfig two_extruder_config() +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_num_extruders(2); + config.set_key_value("nozzle_diameter", new ConfigOptionFloats{0.4, 0.6}); + config.set_key_value("extruder_offset", new ConfigOptionPoints{Vec2d(0.0, 0.0), Vec2d(20.0, 5.0)}); + config.set_key_value("extruder_printable_height", new ConfigOptionFloatsNullable{200.0, 200.0}); + config.set_key_value("master_extruder_id", new ConfigOptionInt(1)); + config.set_key_value("printable_height", new ConfigOptionFloat(200.0)); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString("10..30;0x0,10x0,10x10,0x10")); + return config; +} + +BoundingBox bounds(const BedExcludeRegion ®ion) +{ + return get_extents(region.polygon); +} + +double unscaled_x(coord_t value) +{ + return unscale(value); +} + +bool contains(const ExPolygons &polygons, double x, double y) +{ + const Point point = Point::new_scale(x, y); + return std::any_of(polygons.begin(), polygons.end(), [&](const ExPolygon &polygon) { + return polygon.contains(point); + }); +} + +struct CubeModel +{ + Model model; + ModelInstance *instance {nullptr}; + + explicit CubeModel(const Vec3d &offset = Vec3d::Zero(), const Vec3d &size = Vec3d(20.0, 20.0, 20.0)) + { + ModelObject *object = model.add_object(); + object->add_volume(make_cube(size.x(), size.y(), size.z())); + instance = object->add_instance(); + instance->set_offset(offset); + } +}; + +} // namespace + +TEST_CASE("Legacy exclusion polygons keep their point representation", "[ExclusionVolume][PrintConfig]") +{ + ConfigOptionPoints option; + REQUIRE(option.deserialize("0x0,10x0,10x10,0x10")); + REQUIRE(option.values.size() == 4); + CHECK(option.serialize() == "0x0,10x0,10x10,0x10"); + CHECK_FALSE(is_bed_exclusion_volume_syntax(option.serialize())); +} + +TEST_CASE("Belt material keep-outs are projected once without projecting collision volumes", "[ExclusionVolume][PrintConfig][Belt][Regression]") +{ + const auto [belt, axis, angle, scale_x, scale_y] = GENERATE(table({ + {true, BeltRotationAxis::X, 60.0, 1.0, 0.5}, + {true, BeltRotationAxis::X, -60.0, 1.0, 0.5}, + {true, BeltRotationAxis::Y, 60.0, 0.5, 1.0}, + {true, BeltRotationAxis::Z, 60.0, 1.0, 1.0}, + {true, BeltRotationAxis::None, 60.0, 1.0, 1.0}, + {false, BeltRotationAxis::X, 60.0, 1.0, 1.0}, + })); + const auto mode = GENERATE(BedExcludeVolumeMode::Shared, BedExcludeVolumeMode::ToolheadOffset, + BedExcludeVolumeMode::PerExtruder); + DynamicPrintConfig config = two_extruder_config(); + config.set_key_value("belt_printer", new ConfigOptionBool(belt)); + config.set_key_value("belt_slice_rotation", new ConfigOptionEnum(axis)); + config.set_key_value("belt_slice_rotation_angle", new ConfigOptionFloat(angle)); + config.set_deserialize_strict("bed_exclude_area", "100x100,150x100,150x150,100x150"); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(mode)); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings{ + "10..30;0x0,10x0,10x10,0x10", "10..30;20x5,30x5,30x15,20x15"}); + + PrintConfig fixed; + fixed.apply(config, true); + const auto dynamic_regions = get_bed_excluded_regions_by_extruder(config); + const auto fixed_regions = get_bed_excluded_regions_by_extruder(fixed); + REQUIRE(dynamic_regions.size() == 2); + REQUIRE(fixed_regions.size() == 2); + for (size_t nozzle = 0; nozzle < dynamic_regions.size(); ++nozzle) { + REQUIRE(dynamic_regions[nozzle].size() == 2); + REQUIRE(fixed_regions[nozzle].size() == 2); + const BoundingBox area = bounds(dynamic_regions[nozzle][0]); + CHECK_THAT(unscale(area.min.x()), WithinAbs(100.0 * scale_x, 1e-5)); + CHECK_THAT(unscale(area.min.y()), WithinAbs(100.0 * scale_y, 1e-5)); + CHECK_THAT(unscale(area.max.x()), WithinAbs(150.0 * scale_x, 1e-5)); + CHECK_THAT(unscale(area.max.y()), WithinAbs(150.0 * scale_y, 1e-5)); + CHECK(dynamic_regions[nozzle][0].polygon.points == fixed_regions[nozzle][0].polygon.points); + const double offset_x = mode == BedExcludeVolumeMode::Shared ? 0.0 : 20.0 * nozzle; + const double offset_y = mode == BedExcludeVolumeMode::Shared ? 0.0 : 5.0 * nozzle; + CHECK(dynamic_regions[nozzle][1].polygon.points == rectangle(offset_x, offset_y, offset_x + 10.0, offset_y + 10.0).points); + CHECK(dynamic_regions[nozzle][1].polygon.points == fixed_regions[nozzle][1].polygon.points); + } + // The older polygon API must not apply the projection a second time. + const Polygons projected = get_bed_excluded_area(fixed); + REQUIRE(projected.size() == 1); + CHECK(projected.front().points == fixed_regions.front().front().polygon.points); + CHECK(config.option("bed_exclude_area")->serialize() == "100x100,150x100,150x150,100x150"); +} + +TEST_CASE("Belt object intersections use the projected bed area", "[ExclusionVolume][PrintConfig][Belt][Regression]") +{ + const auto [y, collides] = GENERATE(table({ + {80.0, true}, {95.0, true}, {110.0, false}, {125.0, false}, {140.0, false}, + })); + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_key_value("belt_printer", new ConfigOptionBool(true)); + config.set_key_value("belt_slice_rotation", new ConfigOptionEnum(BeltRotationAxis::X)); + config.set_key_value("belt_slice_rotation_angle", new ConfigOptionFloat(45.0)); + config.set_deserialize_strict("bed_exclude_area", "100x100,150x100,150x150,100x150"); + const auto regions = get_bed_excluded_regions(config); + REQUIRE(regions.size() == 1); + CubeModel cube(Vec3d(120.0, y, 0.0), Vec3d(10.0, 10.0, 10.0)); + CHECK(cube.instance->intersects_bed_exclude_region(regions.front()) == collides); +} + +TEST_CASE("Legacy point options reject collision-volume syntax", "[ExclusionVolume][PrintConfig]") +{ + const std::string definition = "0..10;0x0,10x0,10x10,0x10|20x20,30x20,30x30,20x30"; + ConfigOptionPoints option; + CHECK_FALSE(option.deserialize(definition)); + CHECK(option.values.empty()); + CHECK(is_bed_exclusion_volume_syntax(definition)); +} + +TEST_CASE("A bed-area polygon can also define a full-height collision volume", "[ExclusionVolume][PrintConfig]") +{ + const std::string definition = "0x0,20x0,20x10,10x10,10x20,0x20"; + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_deserialize_strict("bed_exclude_area", definition); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString(definition)); + const auto regions = get_bed_excluded_regions(config); + REQUIRE(regions.size() == 2); + CHECK(regions[0].polygon.points == regions[1].polygon.points); +} + +TEST_CASE("Copied volumes preserve the bed area, existing definitions and nozzle mode", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + const std::string converted = "40x40,50x40,50x50,40x50"; + DynamicPrintConfig config = two_extruder_config(); + config.set_deserialize_strict("bed_exclude_area", converted); + + SECTION("toolhead-relative definitions remain shared") { + config.set_key_value("bed_exclude_volume_mode", + new ConfigOptionEnum(BedExcludeVolumeMode::ToolheadOffset)); + append_bed_exclude_volumes(config, converted); + + CHECK(config.opt_enum("bed_exclude_volume_mode") == BedExcludeVolumeMode::ToolheadOffset); + CHECK(config.opt_string("bed_exclude_volumes") == + "10..30;0x0,10x0,10x10,0x10|40x40,50x40,50x50,40x50"); + } + + SECTION("individual definitions receive the former shared keep-out") { + config.set_key_value("bed_exclude_volume_mode", + new ConfigOptionEnum(BedExcludeVolumeMode::PerExtruder)); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings{"", "60x60,70x60,70x70,60x70"}); + append_bed_exclude_volumes(config, converted); + + CHECK(config.opt_enum("bed_exclude_volume_mode") == BedExcludeVolumeMode::PerExtruder); + const ConfigOptionStrings *per_extruder = config.option("extruder_bed_exclude_volumes"); + REQUIRE(per_extruder != nullptr); + REQUIRE(per_extruder->values.size() == 2); + CHECK(per_extruder->values[0] == converted); + CHECK(per_extruder->values[1] == "60x60,70x60,70x70,60x70|40x40,50x40,50x50,40x50"); + } + + CHECK(config.option("bed_exclude_area")->serialize() == converted); + + // Resetting just the opt-in settings must leave the original keep-out intact. + config.set_key_value("bed_exclude_volumes", new ConfigOptionString()); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings{""}); + CHECK_FALSE(has_bed_exclude_volumes(config)); + CHECK(config.option("bed_exclude_area")->serialize() == converted); +} + +TEST_CASE("Exclusion syntax validation accepts supported forms and rejects malformed regions", "[ExclusionVolume][PrintConfig]") +{ + const auto [definition, valid] = GENERATE(table({ + {"", true}, + {"0x0,10x0,10x10,0x10", true}, + {"0..10;0x0,10x0,10x10,0x10", true}, + {"0.5..10.5;0x0,10x0,10x10,0x10", true}, + {"..10;0x0,10x0,10x10,0x10", true}, + {"10..;0x0,10x0,10x10,0x10", true}, + {"0x0,10x0,10x10,0x10|20x20,30x20,30x30,20x30", true}, + {"20..10;0x0,10x0,10x10,0x10", false}, + {"10..10;0x0,10x0,10x10,0x10", false}, + {"300..400;0x0,10x0,10x10,0x10", false}, + {"zero..10;0x0,10x0,10x10,0x10", false}, + {"0..10;0x0,10x0", false}, + {"0..10;", false}, + {"|", false}, + })); + + DYNAMIC_SECTION(definition) { + CHECK(is_valid_bed_exclude_volumes_string(definition, 200.0) == valid); + } +} + +TEST_CASE("Extended exclusion Z ranges are defaulted and clamped to printable height", "[ExclusionVolume][PrintConfig]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_key_value("printable_height", new ConfigOptionFloat(100.0)); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString( + "-20..25;0x0,10x0,10x10,0x10|75..150;20x0,30x0,30x10,20x10|..;40x0,50x0,50x10,40x10")); + + const std::vector regions = get_bed_excluded_regions(config); + REQUIRE(regions.size() == 3); + CHECK_THAT(regions[0].z_min, WithinAbs(0.0, 1e-9)); + CHECK_THAT(regions[0].z_max, WithinAbs(25.0, 1e-9)); + CHECK_THAT(regions[1].z_min, WithinAbs(75.0, 1e-9)); + CHECK_THAT(regions[1].z_max, WithinAbs(100.0, 1e-9)); + CHECK_THAT(regions[2].z_min, WithinAbs(0.0, 1e-9)); + CHECK_THAT(regions[2].z_max, WithinAbs(100.0, 1e-9)); +} + +TEST_CASE("CLI keeps legacy areas and collision volumes on separate options", "[ExclusionVolume][PrintConfig][CLI]") +{ + const char *legacy_area_argv[] = { + "orca-slicer", "--bed-exclude-area", "0x0,10x0,10x10,0x10" + }; + DynamicPrintAndCLIConfig legacy_area_config; + t_config_option_keys extra; + t_config_option_keys keys; + REQUIRE(legacy_area_config.read_cli(3, legacy_area_argv, &extra, &keys)); + REQUIRE(legacy_area_config.opt("bed_exclude_area") != nullptr); + CHECK(legacy_area_config.opt("bed_exclude_area")->values.size() == 4); + + const char *volume_argv[] = { + "orca-slicer", "--bed-exclude-volumes", "0..10;0x0,10x0,10x10,0x10" + }; + DynamicPrintAndCLIConfig volume_config; + extra.clear(); + keys.clear(); + REQUIRE(volume_config.read_cli(3, volume_argv, &extra, &keys)); + CHECK(volume_config.opt_string("bed_exclude_volumes") == volume_argv[2]); + + const char *legacy_argv[] = { + "orca-slicer", "--bed-exclude-area", "0..10;0x0,10x0,10x10,0x10" + }; + DynamicPrintAndCLIConfig legacy_config; + extra.clear(); + keys.clear(); + CHECK_FALSE(legacy_config.read_cli(3, legacy_argv, &extra, &keys)); +} + +TEST_CASE("Legacy areas and collision volumes remain additive", "[ExclusionVolume][PrintConfig]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_key_value("printable_height", new ConfigOptionFloat(100.0)); + config.set_deserialize_strict("bed_exclude_area", "0x0,10x0,10x10,0x10"); + + auto regions = get_bed_excluded_regions(config); + REQUIRE(regions.size() == 1); + CHECK_FALSE(regions.front().is_collision_volume()); + CHECK_FALSE(has_bed_exclude_volumes(config)); + + config.set_key_value("bed_exclude_volumes", new ConfigOptionString("20x20,30x20,30x30,20x30")); + regions = get_bed_excluded_regions(config); + REQUIRE(regions.size() == 2); + CHECK_FALSE(regions[0].is_collision_volume()); + CHECK(regions[0].polygon.contains(Point::new_scale(5.0, 5.0))); + CHECK(regions[1].is_collision_volume()); + CHECK(regions[1].polygon.contains(Point::new_scale(25.0, 25.0))); +} + +TEST_CASE("An invalid collision-volume definition does not suppress the legacy area", "[ExclusionVolume][PrintConfig]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_deserialize_strict("bed_exclude_area", "0x0,10x0,10x10,0x10"); + config.set_key_value("bed_exclude_volumes", new ConfigOptionString("not a polygon")); + + CHECK(has_bed_exclude_volumes(config)); + const auto regions = get_bed_excluded_regions(config); + REQUIRE(regions.size() == 1); + CHECK_FALSE(regions.front().is_collision_volume()); + CHECK_FALSE(is_valid_bed_exclude_volumes_string(config.opt_string("bed_exclude_volumes"), 100.0)); +} + +TEST_CASE("An empty collision-volume configuration falls back to the legacy area", "[ExclusionVolume][PrintConfig]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + config.set_num_extruders(2); + config.set_deserialize_strict("bed_exclude_area", "0x0,10x0,10x10,0x10"); + config.set_key_value("bed_exclude_volume_mode", + new ConfigOptionEnum(BedExcludeVolumeMode::PerExtruder)); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings{"", ""}); + + CHECK_FALSE(has_bed_exclude_volumes(config)); + CHECK(active_bed_exclude_volume_mode(config) == BedExcludeVolumeMode::Shared); + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + REQUIRE(groups[0].size() == 1); + REQUIRE(groups[1].size() == 1); + CHECK_FALSE(groups[0][0].is_collision_volume()); +} + +TEST_CASE("Shared exclusion volumes resolve identically for every extruder", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + DynamicPrintConfig config = two_extruder_config(); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(BedExcludeVolumeMode::Shared)); + + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + REQUIRE(groups[0].size() == 1); + REQUIRE(groups[1].size() == 1); + CHECK(groups[0][0].polygon.points == groups[1][0].polygon.points); + CHECK_THAT(groups[0][0].z_min, WithinAbs(10.0, 1e-9)); + CHECK_THAT(groups[0][0].z_max, WithinAbs(30.0, 1e-9)); + + // A shared compatibility view contains one definition, not one duplicate per nozzle. + CHECK(get_bed_excluded_regions(config).size() == 1); +} + +TEST_CASE("Toolhead-relative exclusion volumes follow nozzle offset deltas", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + DynamicPrintConfig config = two_extruder_config(); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(BedExcludeVolumeMode::ToolheadOffset)); + + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + REQUIRE(groups[0].size() == 1); + REQUIRE(groups[1].size() == 1); + const BoundingBox reference = bounds(groups[0][0]); + const BoundingBox shifted = bounds(groups[1][0]); + CHECK_THAT(unscaled_x(shifted.min.x() - reference.min.x()), WithinAbs(20.0, 1e-6)); + CHECK_THAT(unscaled_x(shifted.min.y() - reference.min.y()), WithinAbs(5.0, 1e-6)); +} + +TEST_CASE("Toolhead-relative mode offsets collision volumes but not the shared legacy area", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + DynamicPrintConfig config = two_extruder_config(); + config.set_deserialize_strict("bed_exclude_area", "70x70,80x70,80x80,70x80"); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(BedExcludeVolumeMode::ToolheadOffset)); + + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + REQUIRE(groups[0].size() == 2); + REQUIRE(groups[1].size() == 2); + CHECK_FALSE(groups[0][0].is_collision_volume()); + CHECK_FALSE(groups[1][0].is_collision_volume()); + CHECK(groups[0][0].polygon.points == groups[1][0].polygon.points); + CHECK(groups[0][1].polygon.points != groups[1][1].polygon.points); + + const auto flattened = get_bed_excluded_regions(config); + CHECK(flattened.size() == 3); + CHECK(std::count_if(flattened.begin(), flattened.end(), + [](const BedExcludeRegion ®ion) { return !region.is_collision_volume(); }) == 1); +} + +TEST_CASE("Toolhead-relative exclusions honour a non-default reference extruder", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + DynamicPrintConfig config = two_extruder_config(); + config.set_key_value("master_extruder_id", new ConfigOptionInt(2)); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(BedExcludeVolumeMode::ToolheadOffset)); + + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + const BoundingBox first = bounds(groups[0][0]); + const BoundingBox reference = bounds(groups[1][0]); + CHECK_THAT(unscaled_x(first.min.x() - reference.min.x()), WithinAbs(-20.0, 1e-6)); + CHECK_THAT(unscaled_x(first.min.y() - reference.min.y()), WithinAbs(-5.0, 1e-6)); +} + +TEST_CASE("Individual exclusion volumes remain authoritative per extruder", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + DynamicPrintConfig config = two_extruder_config(); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(BedExcludeVolumeMode::PerExtruder)); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings{ + "0..25;0x0,8x0,8x8,0x8|40..60;20x20,30x20,30x30,20x30", + "", + }); + + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + CHECK(groups[0].size() == 2); + CHECK(groups[1].empty()); + CHECK(get_bed_excluded_regions(config).size() == 2); +} + +TEST_CASE("Individual collision volumes retain the shared legacy area", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + DynamicPrintConfig config = two_extruder_config(); + config.set_deserialize_strict("bed_exclude_area", "70x70,80x70,80x80,70x80"); + config.set_key_value("bed_exclude_volume_mode", new ConfigOptionEnum(BedExcludeVolumeMode::PerExtruder)); + config.set_key_value("extruder_bed_exclude_volumes", new ConfigOptionStrings{ + "0..25;0x0,8x0,8x8,0x8", "0..25;20x0,28x0,28x8,20x8" + }); + + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + REQUIRE(groups[0].size() == 2); + REQUIRE(groups[1].size() == 2); + CHECK_FALSE(groups[0][0].is_collision_volume()); + CHECK(groups[0][0].polygon.points == groups[1][0].polygon.points); + CHECK(groups[0][1].is_collision_volume()); + CHECK(groups[1][1].is_collision_volume()); +} + +TEST_CASE("Individual exclusion validation accepts omitted trailing extruders", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + DynamicPrintConfig dynamic = two_extruder_config(); + dynamic.set_key_value("bed_exclude_volume_mode", + new ConfigOptionEnum(BedExcludeVolumeMode::PerExtruder)); + dynamic.set_key_value("extruder_bed_exclude_volumes", + new ConfigOptionStrings{"0..25;0x0,8x0,8x8,0x8"}); + + FullPrintConfig config; + config.apply(dynamic, true); + const std::map errors = validate(config); + CHECK(errors.find("extruder_bed_exclude_volumes") == errors.end()); + + const auto groups = get_bed_excluded_regions_by_extruder(config); + REQUIRE(groups.size() == 2); + CHECK(groups[0].size() == 1); + CHECK(groups[1].empty()); +} + +TEST_CASE("Legacy bed helpers include only regions touching the first layer", "[ExclusionVolume][PrintConfig]") +{ + DynamicPrintConfig dynamic = DynamicPrintConfig::full_print_config(); + dynamic.set_key_value("printable_height", new ConfigOptionFloat(100.0)); + dynamic.set_key_value("bed_exclude_volumes", new ConfigOptionString( + "0..5;0x0,10x0,10x10,0x10|20..30;20x0,30x0,30x10,20x10")); + PrintConfig config; + config.apply(dynamic, true); + + const Polygons bed_regions = get_bed_excluded_area(config); + REQUIRE(bed_regions.size() == 1); + CHECK(bed_regions.front().contains(Point::new_scale(5.0, 5.0))); + CHECK_FALSE(bed_regions.front().contains(Point::new_scale(25.0, 5.0))); +} + +TEST_CASE("Filament mapping resolves physical exclusion extruders conservatively", "[ExclusionVolume][PrintConfig][MultiNozzle]") +{ + CHECK(bed_exclusion_extruder_for_filament(0, {2, 1}, fmmManual, false, true, 2) == 1); + CHECK(bed_exclusion_extruder_for_filament(1, {2, 1}, fmmManual, false, true, 2) == 0); + + // Generic automatic multi-tool printers use matching logical and physical ids. + CHECK(bed_exclusion_extruder_for_filament(1, {1, 1}, fmmAutoForMatch, false, false, 2) == 1); + + // Until Bambu automatic grouping has produced a concrete mapping, every nozzle remains possible. + CHECK(bed_exclusion_extruder_for_filament(0, {1}, fmmAutoForMatch, true, false, 2) == -1); + CHECK(bed_exclusion_extruder_for_filament(0, {2}, fmmAutoForMatch, true, true, 2) == 1); + CHECK(bed_exclusion_extruder_for_filament(3, {}, fmmManual, false, true, 2) == -1); +} + +TEST_CASE("Exclusion Z overlap treats touching slabs conservatively", "[ExclusionVolume][Geometry]") +{ + CHECK(bed_exclusion_z_ranges_overlap(0.0, 10.0, 10.0, 20.0)); + CHECK(bed_exclusion_z_ranges_overlap(10.0, 0.0, 20.0, 10.0)); + CHECK_FALSE(bed_exclusion_z_ranges_overlap(0.0, 9.0, 10.0, 20.0)); +} + +TEST_CASE("Arrange keeps convex exclusions exact and bounds concave exclusions", "[ExclusionVolume][Geometry][Arrange]") +{ + const Polygon convex = rectangle(0.0, 0.0, 10.0, 10.0); + CHECK(bed_exclusion_arrange_polygon(convex).points == convex.points); + + Polygon concave({ + Point::new_scale(0.0, 0.0), Point::new_scale(10.0, 0.0), + Point::new_scale(10.0, 4.0), Point::new_scale(4.0, 4.0), + Point::new_scale(4.0, 10.0), Point::new_scale(0.0, 10.0), + }); + concave.make_counter_clockwise(); + REQUIRE_FALSE(concave.contains(Point::new_scale(8.0, 8.0))); + + const Polygon blocker = bed_exclusion_arrange_polygon(concave); + CHECK(blocker.points.size() == 4); + CHECK(blocker.contains(Point::new_scale(8.0, 8.0))); +} + +TEST_CASE("Active exclusion footprints select Z range nozzle translation and clearance", "[ExclusionVolume][Geometry][MultiNozzle]") +{ + const std::vector> regions_by_extruder{ + {region(0.0, 0.0, 10.0, 10.0, 0.0, 5.0)}, + {region(20.0, 0.0, 30.0, 10.0, 10.0, 20.0)}, + }; + + ExPolygons active = active_bed_exclusion_footprints( + regions_by_extruder, {1, 1, 99}, 12.0, 13.0, Point::new_scale(5.0, 2.0), scale_(1.0)); + REQUIRE(active.size() == 1); + CHECK(contains(active, 26.0, 3.0)); + CHECK(contains(active, 35.5, 3.0)); + CHECK_FALSE(contains(active, 5.0, 5.0)); + + CHECK(active_bed_exclusion_footprints(regions_by_extruder, {0}, 6.0, 9.0).empty()); +} + +TEST_CASE("Exact model intersection respects XY Z and preview collection", "[ExclusionVolume][Model]") +{ + CubeModel cube(Vec3d(30.0, 40.0, 0.0)); + + // Cross the cube's outer surface so this case can also verify the red + // preview, which is built from clipped surface triangles. The enclosed + // prism topology is covered separately below. + const BedExcludeRegion crossing = region(45.0, 45.0, 55.0, 55.0, 5.0, 15.0); + const BedExcludeRegion above = region(45.0, 45.0, 55.0, 55.0, 25.0, 30.0); + const BedExcludeRegion outside = region(60.0, 70.0, 70.0, 80.0, 0.0, 20.0); + + CHECK(cube.instance->intersects_bed_exclude_region(crossing)); + CHECK_FALSE(cube.instance->intersects_bed_exclude_region(above)); + CHECK_FALSE(cube.instance->intersects_bed_exclude_region(outside)); + + indexed_triangle_set preview; + CHECK(cube.instance->intersects_bed_exclude_region(crossing, &preview)); + CHECK_FALSE(preview.empty()); + CHECK_FALSE(cube.instance->intersects_bed_exclude_region(above, &preview)); + CHECK(preview.empty()); +} + +TEST_CASE("Exact model intersection follows instance and volume transforms", "[ExclusionVolume][Model]") +{ + CubeModel cube(Vec3d(50.0, 50.0, 0.0)); + cube.instance->set_rotation(Vec3d(0.0, 0.0, PI / 4.0)); + cube.instance->set_scaling_factor(Vec3d(1.5, 0.5, 1.0)); + + CHECK(cube.instance->intersects_bed_exclude_region(region(50.0, 50.0, 55.0, 55.0, 0.0, 20.0))); + CHECK_FALSE(cube.instance->intersects_bed_exclude_region(region(100.0, 100.0, 110.0, 110.0, 0.0, 20.0))); +} + +TEST_CASE("Exact model intersection detects an exclusion prism enclosed by a solid", "[ExclusionVolume][Model]") +{ + // A surface-only test misses this topology: the exclusion prism is fully + // enclosed, so none of the block's surface triangles enters the prism. + CubeModel block(Vec3d(200.0, 300.0, 0.0), Vec3d(100.0, 100.0, 60.0)); + const BedExcludeRegion enclosed = region(230.0, 330.0, 260.0, 358.0, 8.0, 22.0); + const BedExcludeRegion enclosing = region(190.0, 290.0, 310.0, 410.0, -5.0, 65.0); + const BedExcludeRegion above = region(230.0, 330.0, 260.0, 358.0, 65.0, 75.0); + + CHECK(block.instance->intersects_bed_exclude_region(enclosed)); + CHECK_FALSE(block.instance->intersects_bed_exclude_region(above)); + + indexed_triangle_set preview; + CHECK(block.instance->intersects_bed_exclude_region(enclosed, &preview)); + // There is no model surface inside a fully enclosed prism from which to + // build the usual red clipped-surface preview. + CHECK(preview.empty()); + + // Pin the opposite containment topology too. Here the model surface lies + // inside the prism, so the existing clipped preview remains available. + CHECK(block.instance->intersects_bed_exclude_region(enclosing, &preview)); + CHECK_FALSE(preview.empty()); + + // The multi-region wrapper must preserve the collision result even when + // that optional surface preview is empty. + CHECK(block.instance->intersects_bed_exclude_regions({above, enclosed}, &preview)); + CHECK(preview.empty()); +} diff --git a/tests/libslic3r/test_fill_corner_smoothing.cpp b/tests/libslic3r/test_fill_corner_smoothing.cpp index 6991917655..35296809b1 100644 --- a/tests/libslic3r/test_fill_corner_smoothing.cpp +++ b/tests/libslic3r/test_fill_corner_smoothing.cpp @@ -8,8 +8,12 @@ #include #include +#include +#include #include "libslic3r/Fill/FillCornerSmoothing.hpp" +#include "libslic3r/Line.hpp" #include "libslic3r/Polyline.hpp" +#include "libslic3r/libslic3r.h" using namespace Slic3r; @@ -32,20 +36,40 @@ double max_turn_cosine(const Polyline &polyline) return sharpest; } -bool contains(const Polyline &polyline, const Point &point) +// How far before the corner at (10, 0) the path leaves the straight leg along the x axis. +double departure_before_corner(const Polyline &polyline) { - return std::find(polyline.points.begin(), polyline.points.end(), point) != polyline.points.end(); + double departure = 0.; + for (const Point &point : polyline.points) + if (point.y() == 0) + departure = std::max(departure, unscale(point.x())); + return 10. - departure; +} + +// The distance from a point to the nearest edge of a path. +double distance_to(const Polyline &polyline, const Point &point) +{ + double distance = std::numeric_limits::max(); + for (size_t i = 1; i < polyline.size(); ++i) + distance = std::min(distance, Line(polyline[i - 1], polyline[i]).distance_to(point)); + return distance; } const double tolerance = scaled(0.0125); +// The smoothing at the given factor, flattened to the given resolution. +CornerSmoothing smoothing(double factor, double resolution = tolerance) +{ + return CornerSmoothing{ factor, resolution }; +} + } // namespace TEST_CASE("Corner smoothing replaces a sharp vertex by a curve", "[FillCornerSmoothing]") { const Polyline sharp = asymmetric_corner(); Polyline smooth = sharp; - smooth_polyline_corners(smooth, 1., tolerance); + smooth_polyline_corners(smooth, smoothing(1.)); REQUIRE(smooth.size() > sharp.size()); REQUIRE(smooth.front() == sharp.front()); @@ -61,11 +85,11 @@ TEST_CASE("Corner smoothing keeps the path untouched at a zero factor", "[FillCo const Polyline sharp = asymmetric_corner(); Polyline none = sharp; - smooth_polyline_corners(none, 0., tolerance); + smooth_polyline_corners(none, smoothing(0.)); REQUIRE(none.points == sharp.points); Polyline invalid = sharp; - smooth_polyline_corners(invalid, std::numeric_limits::quiet_NaN(), tolerance); + smooth_polyline_corners(invalid, smoothing(std::numeric_limits::quiet_NaN())); REQUIRE(invalid.points == sharp.points); } @@ -73,32 +97,33 @@ TEST_CASE("Corner smoothing consumes at most half of the shorter leg", "[FillCor { // The curve must not reach beyond the middle of either adjoining segment, otherwise the curves of // two adjacent corners would overlap. The shorter leg is 10mm long, so the corner at (10, 0) is - // left 5mm before it and rejoined 5mm past it, even though the other leg is 100mm long. + // rounded within 5mm of it on both legs, even though the other leg is 100mm long. Polyline smooth = asymmetric_corner(); - smooth_polyline_corners(smooth, 1., tolerance); + smooth_polyline_corners(smooth, smoothing(1.)); - REQUIRE(contains(smooth, Point::new_scale(5., 0.))); - REQUIRE(contains(smooth, Point::new_scale(10., 5.))); - // A Bezier curve stays within the convex hull of its control points, so the rounded path stays - // inside the box spanned by the two legs. + REQUIRE(departure_before_corner(smooth) > 0.); + REQUIRE(departure_before_corner(smooth) <= 5.); + // The rounded corner is the polygon of the curve's tangents, which stays inside the box spanned by the + // two legs, and every vertex of it is within 5mm of the corner along the outgoing leg. for (const Point &point : smooth.points) { REQUIRE(point.x() >= 0); REQUIRE(point.y() >= 0); REQUIRE(point.x() <= Point::new_scale(10., 0.).x()); REQUIRE(point.y() <= Point::new_scale(0., 100.).y()); + if (point.x() == Point::new_scale(10., 0.).x() && point != smooth.back()) + REQUIRE(point.y() <= Point::new_scale(0., 5.).y()); } } TEST_CASE("Corner smoothing scales the curve with the factor", "[FillCornerSmoothing]") { Polyline half = asymmetric_corner(); - smooth_polyline_corners(half, 0.5, tolerance); + smooth_polyline_corners(half, smoothing(0.5)); Polyline full = asymmetric_corner(); - smooth_polyline_corners(full, 1., tolerance); + smooth_polyline_corners(full, smoothing(1.)); - // Half of the factor leaves the 10mm leg half as far from the corner. - REQUIRE(contains(half, Point::new_scale(7.5, 0.))); - REQUIRE(contains(full, Point::new_scale(5., 0.))); + // Half of the factor leaves the 10mm leg closer to the corner. + REQUIRE(departure_before_corner(half) < departure_before_corner(full)); // A larger factor rounds a wider portion of the legs, cutting more of the corner off. REQUIRE(full.length() < half.length()); } @@ -109,16 +134,16 @@ TEST_CASE("Corner smoothing leaves hairpins sharp", "[FillCornerSmoothing]") // into a degenerate loop instead of a tip. Polyline hairpin{ Point::new_scale(0., 0.), Point::new_scale(10., 0.), Point::new_scale(0., 0.5) }; const Polyline sharp = hairpin; - smooth_polyline_corners(hairpin, 1., tolerance); + smooth_polyline_corners(hairpin, smoothing(1.)); REQUIRE(hairpin == sharp); } TEST_CASE("Corner smoothing follows the flattening tolerance", "[FillCornerSmoothing]") { Polyline coarse = asymmetric_corner(); - smooth_polyline_corners(coarse, 1., scaled(0.2)); + smooth_polyline_corners(coarse, smoothing(1., scaled(0.2))); Polyline fine = asymmetric_corner(); - smooth_polyline_corners(fine, 1., scaled(0.001)); + smooth_polyline_corners(fine, smoothing(1., scaled(0.001))); REQUIRE(fine.size() > coarse.size()); REQUIRE(fine.front() == coarse.front()); @@ -131,7 +156,7 @@ TEST_CASE("Corner smoothing emits no zero length segments", "[FillCornerSmoothin Polyline zigzag; for (int i = 0; i < 8; ++i) zigzag.points.emplace_back(Point::new_scale(i, i % 2 ? 1. : 0.)); - smooth_polyline_corners(zigzag, 1., tolerance); + smooth_polyline_corners(zigzag, smoothing(1.)); for (size_t i = 1; i < zigzag.size(); ++i) REQUIRE((zigzag[i] - zigzag[i - 1]).cast().squaredNorm() > 0.); @@ -143,7 +168,7 @@ TEST_CASE("Corner smoothing rounds every vertex of a polygon", "[FillCornerSmoot const Polygon square{ Point::new_scale(0., 0.), Point::new_scale(10., 0.), Point::new_scale(10., 10.), Point::new_scale(0., 10.) }; Polygons smooth{ square }; - smooth_polygons_corners(smooth, 1., tolerance); + smooth_polygons_corners(smooth, smoothing(1.)); const Polyline rounded = smooth.front().split_at_first_point(); REQUIRE(smooth.front().size() > square.size()); @@ -168,7 +193,7 @@ TEST_CASE("Corner smoothing keeps the ends of a path that returns to its start", Polyline retrace{ Point::new_scale(0., 0.), Point::new_scale(10., 0.), Point::new_scale(10., 10.), Point::new_scale(5., 10.), Point::new_scale(0., 0.) }; const Polyline sharp = retrace; - smooth_polyline_corners(retrace, 1., tolerance); + smooth_polyline_corners(retrace, smoothing(1.)); REQUIRE(retrace.size() > sharp.size()); REQUIRE(retrace.front() == sharp.front()); @@ -187,11 +212,51 @@ TEST_CASE("Corner smoothing ignores vertices splitting a straight leg", "[FillCo split.points.insert(split.points.begin() + 2, Point::new_scale(15., 0.)); Polyline smooth_plain = plain; - smooth_polyline_corners(smooth_plain, 1., tolerance); + smooth_polyline_corners(smooth_plain, smoothing(1.)); Polyline smooth_split = split; - smooth_polyline_corners(smooth_split, 1., tolerance); + smooth_polyline_corners(smooth_split, smoothing(1.)); REQUIRE(smooth_split.points == smooth_plain.points); - // Both corners reach the middle of the 10mm run they share, which the extra vertex sat on. - REQUIRE(contains(smooth_plain, Point::new_scale(15., 0.))); + // Both corners reach equally far into the 10mm run they share. + double first = 20., last = 10.; + for (const Point &point : smooth_plain.points) + if (point.y() == 0) { + first = std::min(first, unscale(point.x())); + last = std::max(last, unscale(point.x())); + } + REQUIRE(first - 10. == Catch::Approx(20. - last).margin(1e-5)); +} + +TEST_CASE("Corner smoothing turns by the same angle at every vertex of a corner", "[FillCornerSmoothing]") +{ + Polyline smooth = asymmetric_corner(); + smooth_polyline_corners(smooth, smoothing(1.)); + REQUIRE(smooth.size() > 4); + double sharpest = 0., gentlest = PI; + for (size_t i = 1; i + 1 < smooth.size(); ++i) { + const Vec2d incoming = (smooth[i] - smooth[i - 1]).cast().normalized(); + const Vec2d outgoing = (smooth[i + 1] - smooth[i]).cast().normalized(); + const double turn = std::atan2(std::abs(cross2(incoming, outgoing)), incoming.dot(outgoing)); + sharpest = std::max(sharpest, turn); + gentlest = std::min(gentlest, turn); + } + // The vertices together make up the right angle of the corner. + REQUIRE_THAT(sharpest * double(smooth.size() - 2), Catch::Matchers::WithinRel(0.5 * PI, 0.02)); + REQUIRE_THAT(gentlest, Catch::Matchers::WithinRel(sharpest, 0.02)); +} + +TEST_CASE("Corner smoothing keeps within the resolution of its curve", "[FillCornerSmoothing]") +{ + // The curve itself, up to 0.2 microns. + Polyline fine = asymmetric_corner(); + smooth_polyline_corners(fine, smoothing(1., scaled(0.0002))); + auto vertices = [&fine](double resolution) { + Polyline smooth = asymmetric_corner(); + smooth_polyline_corners(smooth, smoothing(1., scaled(resolution))); + for (const Point &point : smooth.points) + REQUIRE(distance_to(fine, point) <= scaled(resolution + 0.0002)); + return smooth.size() - 2; + }; + // A coarser resolution takes fewer vertices. + REQUIRE(vertices(0.05) < vertices(0.0125)); } diff --git a/tests/libslic3r/test_fill_plane_path.cpp b/tests/libslic3r/test_fill_plane_path.cpp index e28d74b4fc..c12cabed72 100644 --- a/tests/libslic3r/test_fill_plane_path.cpp +++ b/tests/libslic3r/test_fill_plane_path.cpp @@ -6,10 +6,10 @@ #include "libslic3r/libslic3r.h" #include "libslic3r/Fill/FillBase.hpp" #include -#include #include "libslic3r/Config.hpp" #include #include +#include #include #include @@ -69,19 +69,18 @@ double path_length(const Points &points) return length; } -double discrete_curvature_at(const Points &points, const Point &point) +// The edges of the first rounded corner of the order 1 Hilbert curve, which leaves the leg x = 0 and joins the leg y = 1. +std::vector first_corner_edges(const Points &points) { - const auto point_it = std::find(points.begin(), points.end(), point); - REQUIRE(point_it != points.end()); - const size_t point_idx = size_t(std::distance(points.begin(), point_it)); - REQUIRE(point_idx > 0); - REQUIRE(point_idx + 1 < points.size()); - - const Vec2d incoming = (points[point_idx] - points[point_idx - 1]).cast() / output_scale; - const Vec2d outgoing = (points[point_idx + 1] - points[point_idx]).cast() / output_scale; - const Vec2d chord = incoming + outgoing; - const double cross = std::abs(incoming.x() * outgoing.y() - incoming.y() * outgoing.x()); - return 2. * cross / (incoming.norm() * outgoing.norm() * chord.norm()); + std::vector edges; + for (size_t i = 1; i < points.size(); ++i) { + if (points[i - 1].x() == 0 && points[i].x() == 0) + continue; + if (points[i - 1].y() == coord_t(output_scale) && points[i].y() == coord_t(output_scale)) + break; + edges.push_back((points[i] - points[i - 1]).cast().norm()); + } + return edges; } } // namespace @@ -140,44 +139,30 @@ TEST_CASE("Smoothed Hilbert curve honors path resolution", "[FillPlanePath]") REQUIRE(fine.back() == coarse.back()); } -TEST_CASE("Smoothed Hilbert corners use a uniform subdivision depth", "[FillPlanePath]") +TEST_CASE("Smoothed Hilbert corners turn by the same angle at every vertex", "[FillPlanePath]") { + // A planner slows down at a vertex by how much it turns, so a rounded corner spreads its turn evenly. const Points smooth = TestableHilbertCurve().generate_points(0.0035, 1., 1); - const Point curve_entry(0, coord_t(0.5 * output_scale)); - const Point curve_exit(coord_t(0.5 * output_scale), coord_t(output_scale)); - - const auto entry_it = std::find(smooth.begin(), smooth.end(), curve_entry); - REQUIRE(entry_it != smooth.end()); - const auto exit_it = std::find(entry_it, smooth.end(), curve_exit); - REQUIRE(exit_it != smooth.end()); - - const size_t segment_count = size_t(std::distance(entry_it, exit_it)); - REQUIRE(segment_count > 1); - REQUIRE((segment_count & (segment_count - 1)) == 0); - - double previous_length = (entry_it[1] - entry_it[0]).cast().norm(); - REQUIRE(previous_length > 0.); - double max_length_ratio = 1.; - for (size_t segment = 1; segment < segment_count; ++segment) { - const double current_length = (entry_it[segment + 1] - entry_it[segment]).cast().norm(); - REQUIRE(current_length > 0.); - max_length_ratio = std::max(max_length_ratio, - std::max(current_length / previous_length, previous_length / current_length)); - previous_length = current_length; + std::vector turns; + for (size_t i = 1; i + 1 < smooth.size(); ++i) { + const Vec2d incoming = (smooth[i] - smooth[i - 1]).cast().normalized(); + const Vec2d outgoing = (smooth[i + 1] - smooth[i]).cast().normalized(); + const double turn = std::atan2(std::abs(cross2(incoming, outgoing)), incoming.dot(outgoing)); + if (turn > 1e-6) + turns.push_back(turn); } - REQUIRE(max_length_ratio < 1.5); + REQUIRE(turns.size() > 2); + const auto [sharpest, gentlest] = std::minmax_element(turns.begin(), turns.end()); + REQUIRE_THAT(*gentlest, Catch::Matchers::WithinRel(*sharpest, 0.02)); } -TEST_CASE("Hilbert smoothing joins straight segments with continuous curvature", "[FillPlanePath]") +TEST_CASE("Hilbert smoothing eases into the turn", "[FillPlanePath]") { - const Points coarse = TestableHilbertCurve().generate_points(0.005, 0.5, 1); - const Points fine = TestableHilbertCurve().generate_points(0.0001, 0.5, 1); - const Point first_curve_entry(0, coord_t(0.75 * output_scale)); - - const double coarse_entry_curvature = discrete_curvature_at(coarse, first_curve_entry); - const double fine_entry_curvature = discrete_curvature_at(fine, first_curve_entry); - REQUIRE(coarse_entry_curvature > 0.); - REQUIRE(fine_entry_curvature < 0.25 * coarse_entry_curvature); + // Every vertex turns by the same angle, so the edges are as long as the curve is gentle. The curvature starts + // from zero at the legs, so the edges shorten away from them. + const std::vector edges = first_corner_edges(TestableHilbertCurve().generate_points(0.0002, 1., 1)); + REQUIRE(edges.size() >= 16); + REQUIRE(edges[0] / edges[1] > 1.1); } TEST_CASE("Octagram spiral smoothing rounds the turns of the spiral", "[FillPlanePath]") diff --git a/tests/libslic3r/test_kdtree.cpp b/tests/libslic3r/test_kdtree.cpp new file mode 100644 index 0000000000..fee8c0e98a --- /dev/null +++ b/tests/libslic3r/test_kdtree.cpp @@ -0,0 +1,72 @@ +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "libslic3r/KDTreeIndirect.hpp" +#include "libslic3r/Point.hpp" + +using namespace Slic3r; + +TEST_CASE("Visiting the nearby points gives what collecting them gives", "[KDTree]") { + std::mt19937 rng(19937); + std::uniform_real_distribution coord(-50.f, 50.f); + // Points in a box, so that a radius search returns anything from none of them to all of them. + std::vector points(2000); + for (Vec3f &p : points) + p = Vec3f(coord(rng), coord(rng), coord(rng)); + + auto coordinate = [&points](size_t idx, size_t dimension) { return points[idx](int(dimension)); }; + KDTreeIndirect<3, float, decltype(coordinate)> tree(coordinate); + std::vector indices(points.size()); + std::iota(indices.begin(), indices.end(), 0); + tree.build(indices); + + const float radius = GENERATE(0.5f, 5.f, 25.f, 200.f); + for (int i = 0; i < 20; ++ i) { + const Vec3f center(coord(rng), coord(rng), coord(rng)); + + const std::vector collected = find_nearby_points(tree, center, radius); + std::vector visited; + visit_nearby_points(tree, center, radius, [&visited](size_t idx) { visited.emplace_back(idx); }); + + // Same points, and in the same order: a caller that keeps the first of several equally good ones + // must get the same answer either way. + REQUIRE(visited == collected); + } +} + +TEST_CASE("A radius search returns every point within the radius and no other", "[KDTree]") { + std::mt19937 rng(2024); + std::uniform_real_distribution coord(-20.f, 20.f); + std::vector points(500); + for (Vec3f &p : points) + p = Vec3f(coord(rng), coord(rng), coord(rng)); + + auto coordinate = [&points](size_t idx, size_t dimension) { return points[idx](int(dimension)); }; + KDTreeIndirect<3, float, decltype(coordinate)> tree(coordinate); + std::vector indices(points.size()); + std::iota(indices.begin(), indices.end(), 0); + tree.build(indices); + + const Vec3f center(1.f, -2.f, 3.f); + const float radius = 7.f; + + std::vector expected; + for (size_t i = 0; i < points.size(); ++ i) + if ((points[i] - center).squaredNorm() < radius * radius) + expected.emplace_back(i); + + std::vector visited; + visit_nearby_points(tree, center, radius, [&visited](size_t idx) { visited.emplace_back(idx); }); + std::sort(visited.begin(), visited.end()); + + REQUIRE(! expected.empty()); + REQUIRE(visited == expected); +} diff --git a/tests/libslic3r/test_lay_on_face.cpp b/tests/libslic3r/test_lay_on_face.cpp index f1bb92a1e8..b72600807f 100644 --- a/tests/libslic3r/test_lay_on_face.cpp +++ b/tests/libslic3r/test_lay_on_face.cpp @@ -187,6 +187,23 @@ TEST_CASE("A part rests on its largest hull face even when parallel inner faces check_on_bed(plate); } +TEST_CASE("A box laid on its top face is turned over about X", "[LayOnFace]") +{ + // A face pointing straight up leaves the half turn's axis open to every horizontal + // direction. It must be the fixed X flip both times, keep the footprint and not follow + // rounding noise to an arbitrary angle. + Model model; + ModelObject &box = add_box_object(model, { 40, 20, 10 }); + lay_on_face(box, 0, { 0, 0, 1 }); + + check_size(box, { 40, 20, 10 }); + check_on_bed(box); + const Matrix3d rotation = box.instances.front()->get_matrix_no_offset().linear(); + CHECK_THAT(rotation(0, 0), WithinAbs(1., 1e-9)); + CHECK_THAT(rotation(1, 1), WithinAbs(-1., 1e-9)); + CHECK_THAT(rotation(2, 2), WithinAbs(-1., 1e-9)); +} + TEST_CASE("Faces are selected in object coordinates whatever the instance rotation", "[LayOnFace]") { Model model; diff --git a/tests/libslic3r/test_locales_utils.cpp b/tests/libslic3r/test_locales_utils.cpp index fc17e26ad1..03300d6815 100644 --- a/tests/libslic3r/test_locales_utils.cpp +++ b/tests/libslic3r/test_locales_utils.cpp @@ -1,55 +1,17 @@ #include -#include -#include - #include #include #include #include #include #include "libslic3r/LocalesUtils.hpp" +#include "test_utils.hpp" #include using namespace Slic3r; -namespace { - -// Switches this thread's numeric locale to one whose decimal separator is a comma, -// when the system has one installed. -struct CommaNumericLocale -{ -#ifdef _WIN32 - bool apply() - { - for (const char* name : { "de-DE", "German_Germany.1252" }) - if (std::setlocale(LC_NUMERIC, name) != nullptr) - return true; - return false; - } -#else - locale_t locale { (locale_t) 0 }; - bool apply() - { - for (const char* name : { "de_DE.UTF-8", "de_DE.utf8", "de_DE" }) - if ((locale = newlocale(LC_NUMERIC_MASK, name, (locale_t) 0)) != (locale_t) 0) { - uselocale(locale); - return true; - } - return false; - } - // Freed once the setters around apply() have put the thread's own locale back. - ~CommaNumericLocale() - { - if (locale != (locale_t) 0) - freelocale(locale); - } -#endif -}; - -} // namespace - TEST_CASE("Floats print as printf prints them in the C locale", "[LocalesUtils]") { const auto [value, precision, text] = GENERATE(table({ diff --git a/tests/libslic3r/test_ordering_strategies.cpp b/tests/libslic3r/test_ordering_strategies.cpp index 97e5a83f60..f4df7e8b5e 100644 --- a/tests/libslic3r/test_ordering_strategies.cpp +++ b/tests/libslic3r/test_ordering_strategies.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -12,10 +13,13 @@ #include "libslic3r/Point.hpp" #include "libslic3r/GCode/OrderingStrategies.hpp" +#include "libslic3r/ShortestPath.hpp" #include "libslic3r/Geometry.hpp" #include #include +#include +#include #include using namespace Slic3r; @@ -304,3 +308,60 @@ TEST_CASE("snake_core handles three points", "[Snake]") { REQUIRE(is_permutation(p2, 3)); } + +// The shortest cycle through the points, trying every order. +static double shortest_cycle_length(const Points& centers) +{ + std::vector path(centers.size()); + std::iota(path.begin(), path.end(), 0); + double best = std::numeric_limits::max(); + do { + best = std::min(best, tsp_cycle_path_length(path, centers)); + } while (std::next_permutation(path.begin() + 1, path.end())); + return best; +} + +static Points random_centers(unsigned seed, size_t count) +{ + std::mt19937 rng(seed); + std::uniform_real_distribution<> coordinate(0., 200.); + Points centers; + for (size_t i = 0; i < count; ++i) { + // One draw per statement, as the evaluation order of function arguments is unspecified. + const double x = coordinate(rng); + const double y = coordinate(rng); + centers.emplace_back(Point::new_scale(x, y)); + } + return centers; +} + +TEST_CASE("tsp_exact_cycle finds the shortest cycle", "[TSPPostProcessing]") { + const size_t count = GENERATE(4, 5, 6, 8); + for (unsigned seed = 1; seed <= 10; ++seed) { + const Points centers = random_centers(seed, count); + const std::vector path = tsp_exact_cycle(centers); + REQUIRE(is_permutation(path, count)); + CHECK(euclidean_path_length(path, centers) <= shortest_cycle_length(centers) + SCALED_EPSILON); + } +} + +TEST_CASE("Default ordering tours up to ten points along the shortest cycle", "[TSPPostProcessing]") { + const bool from_start = GENERATE(false, true); + const Point start = Point::new_scale(-20., -20.); + for (unsigned seed = 1; seed <= 5; ++seed) { + const Points centers = random_centers(seed, 9); + const std::vector path = chain_points_with_postprocessing(centers, from_start ? &start : nullptr); + REQUIRE(is_permutation(path, centers.size())); + CHECK(euclidean_path_length(path, centers) <= shortest_cycle_length(centers) + SCALED_EPSILON); + } +} + +TEST_CASE("Default ordering of many points is never longer than the greedy cycle", "[TSPPostProcessing]") { + for (unsigned seed = 1; seed <= 10; ++seed) { + const Points centers = random_centers(seed, 150); + const std::vector path = chain_points_with_postprocessing(centers, nullptr); + REQUIRE(is_permutation(path, centers.size())); + CHECK(euclidean_path_length(path, centers) <= euclidean_path_length(chain_points(centers, nullptr), centers) + SCALED_EPSILON); + CHECK_FALSE(has_crossings(path, centers)); + } +} diff --git a/tests/libslic3r/test_placeholder_parser.cpp b/tests/libslic3r/test_placeholder_parser.cpp index 0a490a6bdd..5ec8b6d801 100644 --- a/tests/libslic3r/test_placeholder_parser.cpp +++ b/tests/libslic3r/test_placeholder_parser.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include "libslic3r/PlaceholderParser.hpp" @@ -398,3 +399,53 @@ SCENARIO("Placeholder parser names in branches that are not taken", "[Placeholde CHECK(PlaceholderParser::evaluate_boolean_expression("false ? no_such_var == 1 : true", config)); } } + +TEST_CASE("Placeholder parser deferred values can be printed but not computed with", "[PlaceholderParser]") { + PlaceholderParser parser; + parser.set_deferred("total_weight", "@TOTAL_WEIGHT@"); + parser.set_deferred("used_filament", "@USED_FILAMENT_LENGTH@"); + parser.set("label", "W"); + PlaceholderParser::ContextData context; + context.global_config = std::make_unique(); + auto process = [&parser, &context](const std::string &templ) { return parser.process(templ, 0, nullptr, nullptr, &context); }; + + SECTION("printed") { + CHECK(process("{total_weight}") == "@TOTAL_WEIGHT@"); + CHECK(process("[total_weight]") == "@TOTAL_WEIGHT@"); + CHECK(process("{label + \": \" + total_weight + \"g\"}") == "W: @TOTAL_WEIGHT@g"); + CHECK(process("{total_weight + \"g, \" + used_filament + \"m\"}") == "@TOTAL_WEIGHT@g, @USED_FILAMENT_LENGTH@m"); + CHECK(process("{\"W \" + total_weight + \"g for \" + 3 + \" parts\"}") == "W @TOTAL_WEIGHT@g for 3 parts"); + CHECK(process("{true ? total_weight : 0}") == "@TOTAL_WEIGHT@"); + CHECK(process("{regex_replace(\"x\", /x/, total_weight)}") == "@TOTAL_WEIGHT@"); + CHECK(process("{local w = total_weight}{w}") == "@TOTAL_WEIGHT@"); + } + SECTION("used in a calculation or a comparison") { + const auto deferred_error = Catch::Matchers::ContainsSubstring("known only after the G-code is generated"); + for (const std::string templ : { + "{total_weight + 1}", "{1 + total_weight}", "{total_weight * 2}", "{-total_weight}", "{int(total_weight)}", + "{min(total_weight, 5)}", "{digits(total_weight, 5)}", "{total_weight + used_filament}", + "{if total_weight > 100}heavy{endif}", "{if total_weight == \"1\"}one{endif}", "{total_weight and true}", + "{total_weight ? 1 : 0}", "{if total_weight =~ /1.*/}one{endif}", "{one_of(total_weight, \"1\")}", + "{regex_replace(total_weight, /1/, \"2\")}", "{(\"W\" + total_weight) == \"W1\"}", "{filament_change(total_weight)}", + "{regex_replace(\"x\", /x/, total_weight) * 2}", "{if regex_replace(\"x\", /x/, \"W\" + total_weight) > \"W1\"}heavy{endif}", + // A deferred value copied to a variable is still deferred. + "{local w = total_weight}{w > 1}", "{global g = \"W\" + total_weight}{if g == \"W1\"}one{endif}" }) { + CAPTURE(templ); + CHECK_THROWS_WITH(process(templ), deferred_error); + } + // A mistake unrelated to the value being deferred keeps its own message. + CHECK_THROWS_WITH(process("{global v = (1, 2)}{global v = \"W\" + total_weight}"), + Catch::Matchers::ContainsSubstring("Cannot assign a scalar value to a vector variable")); + } + SECTION("ignored in a branch that is not taken") { + CHECK(process("{if false}{total_weight * 2}{endif}ok") == "ok"); + struct Restore { ~Restore() { PlaceholderParser::check_inactive_branches = false; } } restore; + PlaceholderParser::check_inactive_branches = true; + CHECK(process("{if false}{total_weight * 2}{endif}ok") == "ok"); + } + SECTION("other strings keep their behavior") { + CHECK(process("{label + 1}") == "W1"); + CHECK(process("{if label > \"A\"}yes{endif}") == "yes"); + CHECK(process("{if regex_replace(label, /X/, total_weight) == \"W\"}yes{endif}") == "yes"); + } +} diff --git a/tests/libslic3r/test_preset_bundle_loading.cpp b/tests/libslic3r/test_preset_bundle_loading.cpp index 1b4927f08c..9053fc5496 100644 --- a/tests/libslic3r/test_preset_bundle_loading.cpp +++ b/tests/libslic3r/test_preset_bundle_loading.cpp @@ -8417,3 +8417,58 @@ TEST_CASE("An empty choice list in a G-code's settings keeps the value it had be CHECK(config.opt_serialize("nozzle_volume_type") == "High Flow"); CHECK(config.option("filament_multi_colour")->values.empty()); } + +TEST_CASE("A disabled filament override is saved and reloaded column by column", "[Preset][Bundle]") +{ + ScopedPresetDataDir data_dir; + PresetBundle bundle; + + Preset &parent = add_inmemory_preset(bundle.filaments, "Parent PLA @System"); + parent.config.option("filament_extruder_variant", true)->values = { "Direct Drive Standard", "Direct Drive High Flow" }; + parent.config.option("filament_retract_before_wipe", true)->values = { 100., 100. }; + parent.config.option("filament_flow_ratio", true)->values = { 1., 1. }; + + // The child turns the override off on the first variant and changes a plain option on the second. + const fs::path file = data_dir.tmp.path() / PRESET_FILAMENT_NAME / "Child PLA.json"; + Preset child(Preset::TYPE_FILAMENT, "Child PLA"); + child.file = file.string(); + child.version = *Semver::parse("1.0.0"); + child.config = parent.config; + child.config.option(BBL_JSON_KEY_INHERITS, true)->value = parent.name; + child.config.option("filament_retract_before_wipe")->set_at_to_nil(0); + child.config.option("filament_flow_ratio")->values = { 1., 1.1 }; + REQUIRE(child.save(&parent.config)); + + // On disk the override keeps every column, so its nil can only mean "off"; a plain + // option still stores nil for the columns that match the parent. + DynamicPrintConfig saved; + std::map key_values; + std::string reason; + saved.load_from_json(file.string(), ForwardCompatibilitySubstitutionRule::EnableSilent, key_values, reason); + REQUIRE(reason.empty()); + CHECK(saved.opt_serialize("filament_retract_before_wipe") == "nil,100%"); + CHECK(saved.opt_serialize("filament_flow_ratio") == "nil,1.1"); + + PresetsConfigSubstitutions substitutions; + bundle.filaments.load_presets(data_dir.tmp.path().string(), PRESET_FILAMENT_NAME, substitutions, + ForwardCompatibilitySubstitutionRule::EnableSilent); + const Preset *loaded = bundle.filaments.find_preset("Child PLA"); + REQUIRE(loaded != nullptr); + CHECK(loaded->config.opt_serialize("filament_retract_before_wipe") == "nil,100%"); + CHECK(loaded->config.opt_serialize("filament_flow_ratio") == "1,1.1"); +} + +TEST_CASE("The cloud diff force-emits a disabled override only where the cloud would fill a value in", "[Preset][Bundle]") +{ + PresetBundle bundle; + add_inmemory_preset(bundle.filaments, "Parent PLA @System"); + Preset &child = add_inmemory_preset(bundle.filaments, "Child PLA", "Parent PLA @System"); + // Every override is nil in both parent and child, so none is in the plain diff. + std::map key_values; + REQUIRE(bundle.filaments.get_differed_values_to_update(child, key_values) >= 0); + // Retract Before Wipe defaults to 100%: an absent key would come back as 100%, so nil is sent. + CHECK(key_values.count("filament_retract_before_wipe") == 1); + CHECK(key_values["filament_retract_before_wipe"] == "nil"); + // An ironing override defaults to nil: an absent key stays nil, so it is not sent. + CHECK(key_values.count("filament_ironing_flow") == 0); +} diff --git a/tests/libslic3r/test_seam_contour.cpp b/tests/libslic3r/test_seam_contour.cpp new file mode 100644 index 0000000000..c019cd243f --- /dev/null +++ b/tests/libslic3r/test_seam_contour.cpp @@ -0,0 +1,400 @@ +#include +#include +#include "libslic3r/GCode/SeamContour.hpp" +#include "libslic3r/Point.hpp" +#include +#include +#include +#include +#include +#include +#include + +using namespace Slic3r; +using namespace Slic3r::SeamContour; +namespace { +Contour circle(double radius, double x, bool hole = false, size_t count = 64) { + Contour c; + c.hole = hole; + for (size_t i = 0; i < count; ++i) { + const double a = 2.0 * std::acos(-1.0) * double(i) / double(count); + c.points.emplace_back(x + radius * std::cos(a), radius * std::sin(a)); + } + return c; +} +Contour rectangle(double left, double right, double bottom, double top) { + Contour c; + c.points = {Vec2d(left, bottom), Vec2d(right, bottom), Vec2d(right, top), Vec2d(left, top)}; + return c; +} +} // namespace + +TEST_CASE("Indexed continuation preserves local holes among many distant contours", "[SeamContour][Regression]") { + const size_t side = GENERATE(1, 10, 40); + const double shrink = GENERATE(0.0, 0.1); + const bool reverse_order = GENERATE(false, true); + Layers layers(2); + for (size_t layer = 0; layer < 2; ++layer) { + layers[layer].push_back(rectangle(-2, 3*double(side), -2, 3*double(side))); + for (size_t y = 0; y < side; ++y) + for (size_t x = 0; x < side; ++x) { + Contour hole = circle(0.8 - layer*shrink, 3*double(x), true, 16); + for (auto &p : hole.points) p.y() += 3*double(y); + layers[layer].push_back(std::move(hole)); + } + if (reverse_order) std::reverse(layers[layer].begin(), layers[layer].end()); + } + Resolver resolver(std::move(layers)); + const size_t count = side*side; + for (size_t hole : {size_t(0), count/2, count-1}) { + const size_t index = reverse_order ? count-1-hole : hole+1; + const auto result = resolver.resolve(0, index, 0, 1); + REQUIRE(result.outcome == Outcome::Unique); + REQUIRE(result.contours.size() == 1); + CHECK(result.contours.front() == index); + } +} + +TEST_CASE("Unknown boundary geometry preserves unrestricted continuation near either layer", "[SeamContour][Regression]") { + const size_t unknown_layer = GENERATE(0, 1); + const bool nearby = GENERATE(false, true); + Layers layers{{rectangle(0, 10, 0, 10)}, {rectangle(0.2, 10.2, 0.2, 10.2)}}; + Contour unknown = nearby ? rectangle(-1, 11, -1, 11) : rectangle(100, 110, 100, 110); + unknown.reliable = false; // Its artificial closing edge cannot establish a material state. + layers[unknown_layer].push_back(std::move(unknown)); + Resolver resolver(std::move(layers)); + const auto result = resolver.resolve(0, 0, 0, 1); + if (nearby) { + CHECK(result.outcome == Outcome::None); + CHECK(result.contours.empty()); + } else { + REQUIRE(result.outcome == Outcome::Unique); + CHECK(result.contours.front() == 0); + } + CHECK(resolver.resolve(unknown_layer, 1, 0, unknown_layer == 0 ? 1 : -1).outcome == Outcome::None); +} + +TEST_CASE("Unknown reverse geometry preserves both split continuations for the legacy search", "[SeamContour][Regression]") { + const bool mirrored = GENERATE(false, true); + const bool descending = GENERATE(false, true); + const size_t unknown_layer = GENERATE(0, 1); + Contour source = rectangle(0, 10, 0, 10); + source.points.insert(source.points.begin() + 1, Vec2d(5, 0)); + Layers layers{{source}, {rectangle(0, mirrored ? 3.8 : 4.9, 0, 10), + rectangle(mirrored ? 5.1 : 6.2, 10, 0, 10)}}; + if (descending) std::reverse(layers.begin(), layers.end()); + const size_t source_layer = descending ? 1 : 0; + const int direction = descending ? -1 : 1; + // Both reliable walls remain eligible before the unknown path is introduced. + const auto baseline = Resolver(layers).resolve(source_layer, 0, 1, direction); + REQUIRE(baseline.outcome == Outcome::Multiple); + REQUIRE(baseline.contours == (std::vector{0, 1})); + Contour unknown; + const double x = mirrored ? 2.8 : 7.2; + unknown.points = {Vec2d(x, -0.2), Vec2d(x, 0.2)}; + unknown.reliable = false; + // Outside the direct query, this path is near only one candidate's reverse query. + layers[unknown_layer].push_back(std::move(unknown)); + const auto result = Resolver(std::move(layers)).resolve(source_layer, 0, 1, direction); + CHECK(result.outcome == Outcome::None); + CHECK(result.contours.empty()); +} + +TEST_CASE("Unknown reverse geometry invalidates a bounds certificate for the legacy search", "[SeamContour][Regression]") { + const bool descending = GENERATE(false, true); + const size_t unknown_layer = GENERATE(0, 1); + Layers layers{{rectangle(0, 10, 0, 10)}, + {rectangle(0.02, 10.02, 0.02, 10.02), rectangle(-10, -0.08, 0, 10)}}; + if (descending) std::reverse(layers.begin(), layers.end()); + const size_t source_layer = descending ? 1 : 0; + const int direction = descending ? -1 : 1; + // The near-coincident wall wins the reliable fast path, without a competing noise-band wall. + const auto baseline = Resolver(layers).resolve(source_layer, 0, 0, direction); + REQUIRE(baseline.outcome == Outcome::Unique); + REQUIRE(baseline.method == Method::Bounds); + REQUIRE(baseline.contours == (std::vector{0})); + Contour unknown; + unknown.points = {Vec2d(1.61, 0), Vec2d(1.61, 0.04)}; + unknown.reliable = false; + // The shifted foot sees this path; the direct query and the alternative foot do not. + layers[unknown_layer].push_back(std::move(unknown)); + const auto result = Resolver(std::move(layers)).resolve(source_layer, 0, 0, direction); + CHECK(result.outcome == Outcome::None); + CHECK(result.contours.empty()); +} + +TEST_CASE("Unknown geometry near a rejected tube wall preserves the reliable continuation", "[SeamContour][Regression]") { + const bool descending = GENERATE(false, true); + const size_t unknown_layer = GENERATE(0, 1); + const double width = 0.4, outer_radius = 4.0, inner_radius = 3.0, shift = 0.3; + Options options; + options.radius_width_factor = 4.0; + const double radius = width * options.radius_width_factor; + Layers layers{{circle(outer_radius, 0), circle(inner_radius, 0, true)}, + {circle(outer_radius, shift, false, 97), circle(inner_radius, shift, true, 93)}}; + for (auto &layer : layers) + for (auto &contour : layer) contour.width = contour.nozzle = width; + if (descending) std::reverse(layers.begin(), layers.end()); + const size_t source_layer = descending ? 1 : 0; + const int direction = descending ? -1 : 1; + // The shifted outer wall is a local match; the hole's opposing normal rejects it first. + const auto baseline = Resolver(layers, options).resolve(source_layer, 0, 0, direction, radius); + REQUIRE(baseline.outcome == Outcome::Unique); + REQUIRE(baseline.method == Method::Local); + REQUIRE(baseline.contours == (std::vector{0})); + Contour unknown; + const double x = inner_radius + shift - radius + 0.2; + // Only a premature reverse query from the rejected hole would encounter this path. + unknown.points = {Vec2d(x, -0.05), Vec2d(x, 0.05)}; + unknown.reliable = false; + layers[unknown_layer].push_back(std::move(unknown)); + const auto result = Resolver(std::move(layers), options).resolve(source_layer, 0, 0, direction, radius); + CHECK(result.outcome == Outcome::Unique); + CHECK(result.contours == (std::vector{0})); +} + +TEST_CASE("A split or merge keeps ambiguous continuations near the slit", "[SeamContour][Regression]") { + Resolver resolver({{rectangle(0, 10, 0, 10)}, + {rectangle(0, 4.8, 0, 10), rectangle(5.2, 10, 0, 10)}}); + REQUIRE(resolver.resolve(0, 0, 0, 1).outcome == Outcome::Unique); + CHECK(resolver.resolve(0, 0, 0, 1).contours.front() == 0); + const auto merged = resolver.resolve(1, 0, 0, -1); + REQUIRE(merged.outcome == Outcome::Unique); + CHECK(merged.contours.front() == 0); + // A vertex at the slit belongs to a separate source outline with the same bottom edge. + Contour source = rectangle(0, 10, 0, 10); + source.points.insert(source.points.begin()+1, Vec2d(5,0)); + Resolver at_slit({{source}, {rectangle(0,4.8,0,10), rectangle(5.2,10,0,10)}}); + const auto ambiguous = at_slit.resolve(0,0,1,1); + CHECK(ambiguous.outcome == Outcome::Multiple); + CHECK(ambiguous.contours == (std::vector{0,1})); +} + +TEST_CASE("Contour continuation preserves both tube walls despite candidate ordering", "[SeamContour]") { + const double thickness = GENERATE(0.8, 1.2, 2.0); + const double shift = GENERATE(0.0, 0.1, 0.4); + Resolver resolver({{circle(4, 0), circle(4-thickness, 0, true)}, + {circle(4-thickness, shift, true, 93), circle(4, shift, false, 97)}}); + for (size_t wall = 0; wall < 2; ++wall) + for (size_t vertex = 0; vertex < 64; ++vertex) { + const auto result = resolver.resolve(0, wall, vertex, 1); + REQUIRE(result.outcome == Outcome::Unique); + CHECK(result.contours.front() == 1-wall); + } +} + +TEST_CASE("Contour continuation follows an open wall after it becomes a hole", "[SeamContour][Regression]") { + const bool reverse_order = GENERATE(false, true); + Contour open = rectangle(0, 10, 0, 10); + // Closing the right-hand slit changes boundary type without changing its local material side. + open.points = {Vec2d(0, 0), Vec2d(10, 0), Vec2d(10, 1.2), Vec2d(6, 1.2), + Vec2d(6, 2.4), Vec2d(10, 2.4), Vec2d(10, 10), Vec2d(0, 10)}; + Contour hole = rectangle(6.004, 9.8, 1.204, 2.396); + hole.hole = true; + std::vector closed{rectangle(0, 10, 0, 10), hole}; + if (reverse_order) std::reverse(closed.begin(), closed.end()); + const size_t hole_index = reverse_order ? 0 : 1; + Resolver resolver({{open}, closed}); + const auto forward = resolver.resolve(0, 0, 3, 1); + REQUIRE(forward.outcome == Outcome::Unique); + REQUIRE(forward.contours.size() == 1); + CHECK(forward.contours.front() == hole_index); + CHECK(forward.method == Method::Local); + const auto backward = resolver.resolve(1, hole_index, 0, -1); + REQUIRE(backward.outcome == Outcome::Unique); + REQUIRE(backward.contours.size() == 1); + CHECK(backward.contours.front() == 0); +} + +TEST_CASE("Matching contour bounds cannot certify a transverse wall across material", "[SeamContour][Regression]") { + Contour open = rectangle(0, 10, 0, 10); + open.points = {Vec2d(0, 0), Vec2d(10, 0), Vec2d(10, 1.2), Vec2d(6, 1.2), + Vec2d(6, 2.4), Vec2d(10, 2.4), Vec2d(10, 10), Vec2d(0, 10)}; + // The box is identical and the wrong outer wall is inside the legacy search radius. + Resolver resolver({{open}, {rectangle(0, 10, 0, 10)}}); + const auto result = resolver.resolve(0, 0, 3, 1); + CHECK(result.outcome == Outcome::None); + CHECK(result.contours.empty()); +} + +TEST_CASE("A bounds match cannot hide another near-coincident local continuation", "[SeamContour][Regression]") { + Contour source = rectangle(0, 10, 0, 10); + source.points.insert(source.points.begin()+1, Vec2d(5, 0)); + // Only one box matches, but both local bottom edges are equally plausible. + Resolver resolver({{source}, {rectangle(0, 10, 0, 10), rectangle(0, 13, 0, 10)}}); + const auto result = resolver.resolve(0, 0, 1, 1); + CHECK(result.outcome == Outcome::Multiple); + CHECK(result.contours.size() == 2); +} + +TEST_CASE("A printed Benchy edge continues into the new hole after the opening closes", "[SeamContour][Regression]") { + std::ifstream input(std::string(TEST_DATA_DIR) + "/seam_contour_benchy_split.txt"); + REQUIRE(bool(input)); + Layers layers(2); + // Immutable printed contours from adjacent layers reproduce the real failure independently of chain weights. + for (auto &layer : layers) { + size_t count = 0; + input >> count; + layer.resize(count); + for (Contour &c : layer) { + size_t points = 0; + input >> c.hole >> c.width >> c.nozzle >> points; + for (size_t i = 0; i < points; ++i) { + double x = 0., y = 0.; + input >> x >> y; + c.points.emplace_back(x, y); + } + } + } + REQUIRE(bool(input)); + Resolver resolver(std::move(layers)); + const auto forward = resolver.resolve(0, 0, 9, 1); + REQUIRE(forward.outcome == Outcome::Unique); + REQUIRE(forward.contours.size() == 1); + CHECK(forward.contours.front() == 0); + CHECK(forward.method == Method::Local); + const auto backward = resolver.resolve(1, 0, 91, -1); + REQUIRE(backward.outcome == Outcome::Unique); + REQUIRE(backward.contours.size() == 1); + CHECK(backward.contours.front() == 0); +} + +TEST_CASE("Contour fallback rejects the translated-annulus false positive", "[SeamContour]") { + // The true outer wall is outside the radius; the closer hole must never replace it. + Resolver resolver({{circle(2, 0), circle(1, 0, true)}, {circle(2, 1.8), circle(1, 1.8, true)}}); + CHECK(resolver.resolve(0, 0, 0, 1).outcome != Outcome::Unique); +} + +TEST_CASE("Contour fallback follows a local wall despite changed global bounds", "[SeamContour]") { + Resolver resolver({{rectangle(0, 10, 0, 10)}, {rectangle(0, 13, 0, 10)}}); + const auto result = resolver.resolve(0, 0, 0, 1); + REQUIRE(result.outcome == Outcome::Unique); + CHECK(result.method == Method::Local); + CHECK(result.contours.front() == 0); +} + +TEST_CASE("Contour fallback handles an inclined wall without raster overlap", "[SeamContour]") { + Resolver resolver({{rectangle(0, 10, 0, 10)}, {rectangle(-0.7, 13, -0.7, 10)}}); + const auto result = resolver.resolve(0, 0, 0, 1); + CHECK(result.outcome == Outcome::Unique); + CHECK(result.method == Method::Local); +} + +TEST_CASE("Contour fallback does not resolve coincident competing surfaces by index", "[SeamContour]") { + Resolver resolver({{rectangle(0, 10, 0, 10)}, + {rectangle(0, 13, 0, 10), rectangle(0, 14, 0, 10)}}); + const auto result = resolver.resolve(0, 0, 0, 1); + CHECK(result.outcome == Outcome::Multiple); + CHECK(result.contours.size() == 2); +} + +TEST_CASE("Contour proximity includes a long edge with distant endpoints", "[SeamContour]") { + Contour current = rectangle(0, 10, 0, 10); + current.points.insert(current.points.begin()+1, Vec2d(5, 0)); + Resolver resolver({{current}, {rectangle(0, 10, 0, 10)}}); + CHECK(resolver.resolve(0, 0, 1, 1).outcome == Outcome::Unique); +} + +TEST_CASE("Contour dominance needs an advantage in distance and normal agreement", "[SeamContour]") { + const bool reverse = GENERATE(false, true); + Contour source = rectangle(-5, 5, 0, 10); + source.points.insert(source.points.begin()+1, Vec2d(0, 0)); + Contour tilted = rectangle(0.3, 5, 0, 13); + tilted.points[1].y() = 4.7 * std::tan(10.0 * std::acos(-1.0) / 180.0); + // Both branches are admissible, but the left one wins by both configured margins. + std::vector target{rectangle(-5, -0.02, 0, 13), tilted}; + if (reverse) std::reverse(target.begin(), target.end()); + const auto result = Resolver({{source}, target}).resolve(0, 0, 1, 1); + REQUIRE(result.outcome == Outcome::Unique); + REQUIRE(result.contours.size() == 1); + CHECK(result.contours.front() == (reverse ? 1 : 0)); +} + +TEST_CASE("Contour dominance keeps alternatives without enough distance advantage", "[SeamContour]") { + Contour source = rectangle(-5, 5, 0, 10); + source.points.insert(source.points.begin()+1, Vec2d(0, 0)); + Contour tilted = rectangle(0.08, 5, 0, 13); + tilted.points[1].y() = 4.92 * std::tan(10.0 * std::acos(-1.0) / 180.0); + const Layers layers{{source}, {rectangle(-5, -0.02, 0, 13), tilted}}; + const auto tied = Resolver(layers).resolve(0, 0, 1, 1); + CHECK(tied.outcome == Outcome::Multiple); + CHECK(tied.contours.size() == 2); + Options options; + options.dominance_width_factor = 0.1; // A smaller distance margin permits elimination. + const auto result = Resolver(layers, options).resolve(0, 0, 1, 1); + REQUIRE(result.outcome == Outcome::Unique); + CHECK(result.contours.front() == 0); +} + +TEST_CASE("Contour dominance keeps alternatives without enough angular advantage", "[SeamContour]") { + Contour source = rectangle(-5, 5, 0, 10); + source.points.insert(source.points.begin()+1, Vec2d(0, 0)); + Contour tilted = rectangle(0.3, 5, 0, 13); + tilted.points[1].y() = 4.7 * std::tan(3.0 * std::acos(-1.0) / 180.0); + const Layers layers{{source}, {rectangle(-5, -0.02, 0, 13), tilted}}; + CHECK(Resolver(layers).resolve(0, 0, 1, 1).contours.size() == 2); + Options options; + options.dominance_angle_degrees = 1.0; // Distance alone is insufficient with the default angular margin. + CHECK(Resolver(layers, options).resolve(0, 0, 1, 1).contours.size() == 1); +} + +TEST_CASE("Contour dominance keeps a farther branch with better normal agreement", "[SeamContour]") { + Contour source = rectangle(-5, 5, 0, 10); + source.points.insert(source.points.begin()+1, Vec2d(0, 0)); + Contour tilted = rectangle(-5, -0.02, 0, 13); + tilted.points[0].y() = -4.98 * std::tan(10.0 * std::acos(-1.0) / 180.0); + // The nearer branch is worse in orientation, so neither may discard the other. + const auto result = Resolver({{source}, {tilted, rectangle(0.3, 5, 0, 13)}}).resolve(0, 0, 1, 1); + CHECK(result.outcome == Outcome::Multiple); + CHECK(result.contours.size() == 2); +} + +TEST_CASE("Contour fallback accepts a source included in several reverse continuations", "[SeamContour]") { + // A merge can legitimately map back to both lower contours. + Resolver resolver({{rectangle(-5, -0.02, 0, 10), rectangle(0.02, 5, 0, 10)}, + {rectangle(-5, 5, 0, 13)}}); + const auto result = resolver.resolve(0, 0, 1, 1); + CHECK(result.outcome == Outcome::Unique); + CHECK(result.contours.size() == 1); +} + +TEST_CASE("Contour continuation refuses a disappeared wall and handles layer ends", "[SeamContour]") { + Resolver resolver({{circle(2, 0)}, {circle(2, 20)}}); + CHECK(resolver.resolve(0, 0, 0, 1).outcome == Outcome::None); + CHECK(resolver.resolve(0, 0, 0, -1).outcome == Outcome::None); +} + +TEST_CASE("Contour continuation is independent of loop start and duplicates", "[SeamContour]") { + Contour next = circle(2, 0.1); + std::rotate(next.points.begin(), next.points.begin()+17, next.points.end()); + next.points.push_back(next.points.front()); + Resolver resolver({{circle(2, 0)}, {next}}); + const auto first = resolver.resolve(0, 0, 0, 1); + const auto cached = resolver.resolve(0, 0, 0, 1); + REQUIRE(first.outcome == Outcome::Unique); + CHECK(cached.outcome == first.outcome); + CHECK(cached.contours == first.contours); +} + +TEST_CASE("Contour continuation finds the facing side of a shifted thin contour", "[SeamContour][Regression]") { + Contour source = rectangle(0.2, 0.7, 0, 10); + source.points.insert(source.points.begin()+2, Vec2d(0.7, 5)); + // The nearer left edge opposes the source normal; the right edge is its valid continuation. + Resolver resolver({{source}, {rectangle(0.5, 1.0, 0, 10)}}); + const auto result = resolver.resolve(0, 0, 2, 1); + REQUIRE(result.outcome == Outcome::Unique); + CHECK(result.contours.front() == 0); + CHECK(result.method == Method::Local); +} + +TEST_CASE("Contour continuation respects the caller radius across cached queries", "[SeamContour][Regression]") { + Contour source = rectangle(0, 10, 0, 10); + source.width = 0.1; + source.points.insert(source.points.begin()+2, Vec2d(10, 5)); + Resolver resolver({{source}, {rectangle(2, 12, 0, 10)}}); + // A wider seed permits this wall; the current layer's narrow width must not silently replace it. + CHECK(resolver.resolve(0, 0, 2, 1, 2.4).outcome == Outcome::Unique); + CHECK(resolver.resolve(0, 0, 2, 1, 0.4).outcome == Outcome::None); + CHECK(resolver.resolve(0, 0, 2, 1).outcome == Outcome::None); + CHECK(resolver.resolve(0, 0, 2, 1, 2.4).outcome == Outcome::Unique); +} diff --git a/tests/libslic3r/test_semver.cpp b/tests/libslic3r/test_semver.cpp new file mode 100644 index 0000000000..81abd967be --- /dev/null +++ b/tests/libslic3r/test_semver.cpp @@ -0,0 +1,32 @@ +#include +#include +#include + +#include "libslic3r/Semver.hpp" + +#include +#include + +using namespace Slic3r; + +TEST_CASE("A dev build ranks above its alpha and beta and below its release", "[Semver]") { + const auto [lower, higher] = GENERATE(table({ + { "2.5.0-alpha", "2.5.0-dev" }, + { "2.5.0-beta", "2.5.0-dev" }, + { "2.5.0-rc", "2.5.0-dev" }, + { "2.5.0-alpha", "2.5.0-beta" }, + { "2.5.0-dev", "2.5.0" }, + { "2.4.2", "2.5.0-dev" }, + { "2.5.0", "2.6.0-dev" }, + })); + INFO(lower << " < " << higher); + const Semver lo(lower); + const Semver hi(higher); + CHECK(lo < hi); + CHECK(hi > lo); + CHECK_FALSE(hi < lo); +} + +TEST_CASE("Two dev builds of the same version are equal", "[Semver]") { + CHECK(Semver("2.5.0-dev") == Semver("2.5.0-dev")); +} diff --git a/tests/libslic3r/test_shortest_path.cpp b/tests/libslic3r/test_shortest_path.cpp new file mode 100644 index 0000000000..e4b8c60ddc --- /dev/null +++ b/tests/libslic3r/test_shortest_path.cpp @@ -0,0 +1,202 @@ +#include +#include +#include +#include + +#include "libslic3r/ExtrusionEntity.hpp" +#include "libslic3r/ExtrusionEntityCollection.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/Polyline.hpp" +#include "libslic3r/ShortestPath.hpp" +#include "libslic3r/libslic3r.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace Slic3r; + +namespace { + +// Infill-like paths: lines of 1 to 30 mm scattered over a 100 mm square. The collection owns them, and entities hands +// them out as the raw pointers chain_and_reorder_extrusion_entities() reorders. +struct Paths +{ + ExtrusionEntityCollection collection; + std::vector entities; + + Paths(unsigned seed, size_t count, bool can_reverse) + { + std::mt19937 rng(seed); + std::uniform_real_distribution<> coordinate(0., 100.), length(1., 30.), angle(0., 2. * M_PI); + Polylines lines; + for (size_t i = 0; i < count; ++ i) { + // One draw per statement, as the evaluation order of function arguments is unspecified. + const double x = coordinate(rng); + const double y = coordinate(rng); + const double l = length(rng); + const double t = angle(rng); + const Vec2d a(x, y); + const Vec2d b = a + l * Vec2d(std::cos(t), std::sin(t)); + lines.emplace_back(Point::new_scale(a), Point::new_scale(b)); + } + extrusion_entities_append_paths(collection.entities, std::move(lines), erInternalInfill, 0.1, 0.45f, 0.2f, can_reverse); + entities = collection.entities; + } +}; + +double travel(const std::vector &entities, const Point &start) +{ + double length = 0.; + Point last = start; + for (const ExtrusionEntity *ee : entities) { + length += (ee->first_point() - last).cast().norm(); + last = ee->last_point(); + } + return length; +} + +// Travel of the chain that always goes on to the nearest free path end. +double nearest_next_travel(const std::vector &entities, bool can_reverse, const Point &from) +{ + std::vector taken(entities.size(), 0); + double length = 0.; + Point last = from; + for (size_t step = 0; step < entities.size(); ++ step) { + double best = std::numeric_limits::max(); + size_t best_idx = 0; + bool best_reversed = false; + for (size_t i = 0; i < entities.size(); ++ i) + for (const bool reversed : { false, true }) + if (! taken[i] && (can_reverse || ! reversed)) { + const double d = ((reversed ? entities[i]->last_point() : entities[i]->first_point()) - last).cast().norm(); + if (d < best) { + best = d; + best_idx = i; + best_reversed = reversed; + } + } + taken[best_idx] = 1; + length += best; + last = best_reversed ? entities[best_idx]->first_point() : entities[best_idx]->last_point(); + } + return length; +} + +// The shortest travel over every order and allowed reversal of the paths, from start. +double shortest_travel(const std::vector &entities, bool can_reverse, const Point &from) +{ + std::vector order(entities.size()); + std::iota(order.begin(), order.end(), 0); + double best = std::numeric_limits::max(); + do { + for (size_t mask = 0; mask < (size_t(1) << order.size()) && (can_reverse || mask == 0); ++ mask) { + double length = 0.; + Point last = from; + for (size_t k = 0; k < order.size(); ++ k) { + const ExtrusionEntity *ee = entities[order[k]]; + const bool reversed = (mask >> k & 1) != 0; + length += ((reversed ? ee->last_point() : ee->first_point()) - last).cast().norm(); + last = reversed ? ee->first_point() : ee->last_point(); + } + best = std::min(best, length); + } + } while (std::next_permutation(order.begin(), order.end())); + return best; +} + +const Point start = Point::new_scale(-10., -10.); + +} // namespace + +TEST_CASE("An improved infill chain is never longer than the greedy or nearest-next one and keeps every path", "[ShortestPath]") +{ + const size_t count = GENERATE(2, 3, 10, 60, 300); + const bool can_reverse = GENERATE(true, false); + double greedy_total = 0., improved_total = 0.; + for (unsigned seed = 1; seed <= 20; ++ seed) { + Paths greedy(seed, count, can_reverse), improved(seed, count, can_reverse); + const double nearest_travel = nearest_next_travel(improved.entities, can_reverse, start); + chain_and_reorder_extrusion_entities(greedy.entities, &start); + chain_and_reorder_extrusion_entities(improved.entities, start); + + std::vector sorted = improved.entities; + std::sort(sorted.begin(), sorted.end()); + REQUIRE(std::unique(sorted.begin(), sorted.end()) == sorted.end()); + REQUIRE(sorted.size() == count); + + const double greedy_travel = travel(greedy.entities, start), improved_travel = travel(improved.entities, start); + CHECK(improved_travel <= greedy_travel + SCALED_EPSILON); + CHECK(improved_travel <= nearest_travel + SCALED_EPSILON); + greedy_total += greedy_travel; + improved_total += improved_travel; + } + // Twenty random sets of ten or more paths always leave the greedy chain something to shorten. + if (count >= 10) + CHECK(improved_total < 0.95 * greedy_total); +} + +TEST_CASE("Improving an infill chain keeps the direction of paths that cannot reverse", "[ShortestPath]") +{ + Paths paths(7, 100, false); + std::map first_points; + for (const ExtrusionEntity *ee : paths.entities) + first_points.emplace(ee, ee->first_point()); + + chain_and_reorder_extrusion_entities(paths.entities, start); + + for (const ExtrusionEntity *ee : paths.entities) + CHECK(ee->first_point() == first_points.at(ee)); +} + +TEST_CASE("Chains of a few paths are the shortest possible", "[ShortestPath]") +{ + const size_t count = GENERATE(2, 3, 4, 5, 6); + const bool can_reverse = GENERATE(true, false); + for (unsigned seed = 1; seed <= 10; ++ seed) { + Paths paths(seed, count, can_reverse); + const double shortest = shortest_travel(paths.entities, can_reverse, start); + chain_and_reorder_extrusion_entities(paths.entities, start); + CHECK(travel(paths.entities, start) <= shortest + SCALED_EPSILON); + } +} + +TEST_CASE("The greedy chain of two to four paths is the shortest possible", "[ShortestPath]") +{ + const size_t count = GENERATE(2, 3, 4); + const bool can_reverse = GENERATE(true, false); + for (unsigned seed = 1; seed <= 10; ++ seed) { + Paths paths(seed, count, can_reverse); + const double shortest = shortest_travel(paths.entities, can_reverse, start); + chain_and_reorder_extrusion_entities(paths.entities, &start); + CHECK(travel(paths.entities, start) <= shortest + SCALED_EPSILON); + } +} + +TEST_CASE("A short chain need not start with the path nearest to its start", "[ShortestPath]") +{ + // The nearest end leads 10 mm away from the two other paths, so the shortest chain leaves that path for last. + const Point from = Point::new_scale(0., 0.); + for (const bool greedy : { false, true }) { + ExtrusionEntityCollection collection; + extrusion_entities_append_paths(collection.entities, + Polylines{ Polyline(Point::new_scale(-0.9, 0.), Point::new_scale(-10., 0.)), Polyline(Point::new_scale(1., 0.), Point::new_scale(2., 0.)), + Polyline(Point::new_scale(3., 1.), Point::new_scale(4., 1.)) }, + erInternalInfill, 0.1, 0.45f, 0.2f); + std::vector entities = collection.entities; + const double shortest = shortest_travel(entities, true, from); + if (greedy) + chain_and_reorder_extrusion_entities(entities, &from); + else + chain_and_reorder_extrusion_entities(entities, from); + CHECK(entities.back() == collection.entities.front()); + CHECK_THAT(travel(entities, from), Catch::Matchers::WithinAbs(shortest, SCALED_EPSILON)); + } +} diff --git a/tests/libslic3r/test_texture_displacement.cpp b/tests/libslic3r/test_texture_displacement.cpp index 4c3e74d705..d9b3ad3d90 100644 --- a/tests/libslic3r/test_texture_displacement.cpp +++ b/tests/libslic3r/test_texture_displacement.cpp @@ -2424,6 +2424,89 @@ TEST_CASE("TextureDisplacement: moving the model about the plate does not move t CHECK(max_diff < 1e-3f); } +TEST_CASE("Parts anchored at one point carry one continuous texture", "[TextureDisplacement]") +{ + // The same surface, once as a part whose origin is the anchor and once as a part whose own origin + // sits `offset` away from it - the way the bodies of a multibody object are each centred on their + // own origin. Anchored at the same point they must bake the same relief; anchored at their own + // origins, the second is the tiled pattern shifted by `offset`. + const indexed_triangle_set cube = subdivide_mesh_uniform(its_make_cube(10.f, 10.f, 10.f), 1.f, 6); + // Not a multiple of the 4 mm tile, and exact in binary like the grid itself: the checkerboard's steps + // fall right on grid vertices, so a vertex rounded across a step would bake the other side of it. + const Vec3d offset(1.25, 2.5, 0.75); + indexed_triangle_set shifted = cube; + for (Vec3f &v : shifted.vertices) + v -= offset.cast(); + const Transform3d shifted_to_world = Transform3d(Eigen::Translation3d(offset)); + + TextureDisplacementLayer layer; + layer.slot = 0; + layer.image_data = make_checkerboard_png(16, 16); + layer.tiling_scale = 4.f; + layer.depth_mm = 0.5f; + TextureDisplacementFacetsData facets; + facets[0] = paint_whole_mesh(cube); + + const indexed_triangle_set reference = build_texture_displacement(cube, { layer }, facets, classic_options()); + const Vec3d anchor = Vec3d::Zero(); + const indexed_triangle_set anchored = build_texture_displacement(shifted, { layer }, facets, classic_options(), {}, + nullptr, shifted_to_world, nullptr, nullptr, + nullptr, &anchor); + const indexed_triangle_set own_origin = build_texture_displacement(shifted, { layer }, facets, classic_options(), {}, + nullptr, shifted_to_world); + REQUIRE(anchored.vertices.size() == reference.vertices.size()); + REQUIRE(own_origin.vertices.size() == reference.vertices.size()); + + float anchored_diff = 0.f, own_origin_diff = 0.f; + for (size_t i = 0; i < reference.vertices.size(); ++i) { + anchored_diff = std::max(anchored_diff, (anchored.vertices[i] + offset.cast() - reference.vertices[i]).norm()); + own_origin_diff = std::max(own_origin_diff, (own_origin.vertices[i] + offset.cast() - reference.vertices[i]).norm()); + } + CHECK(anchored_diff < 1e-3f); + CHECK(own_origin_diff > 0.1f); +} + +TEST_CASE("A part held above the plate keeps the relief on its underside", "[TextureDisplacement]") +{ + // A fully painted cube displaces its bottom face straight down by the full depth. On its own, that + // relief is clamped to the cube's bottom (see "relief is never driven below the model's resting + // plane"); as a part of an object resting `drop` below it, it is clamped only at the object's plane. + const bool v2 = GENERATE(false, true); + const indexed_triangle_set cube = subdivide_mesh_uniform(its_make_cube(10.f, 10.f, 10.f), 2.f, 6); + + TextureDisplacementFacetsData facets{}; + facets[0] = paint_whole_mesh(cube); + TextureDisplacementLayer layer; + layer.slot = 0; + layer.depth_mm = 2.0f; + layer.tiling_scale = 5.0f; + layer.image_data = make_flat_gray_png(255); // full depth everywhere + + TextureDisplacementOptions options = classic_options(); + options.pipeline_v2 = v2; + options.v2_refine_mm = 2.f; + options.v2_max_triangles_k = 0; + + const auto lowest_after = [&](float drop) { + const indexed_triangle_set out = build_texture_displacement(cube, { layer }, facets, options, {}, nullptr, + Transform3d::Identity(), nullptr, nullptr, nullptr, + nullptr, drop); + REQUIRE_FALSE(out.vertices.empty()); + float lowest = std::numeric_limits::max(); + for (const Vec3f &v : out.vertices) + lowest = std::min(lowest, v.z()); + return lowest; + }; + + CAPTURE(v2); + // The cube's bottom is z = 0. With the object resting 5 mm lower, the 2 mm relief fits above it... + CHECK_THAT(lowest_after(5.f), WithinAbs(-2.0f, 1e-3f)); + // ...with the object resting 1 mm lower, it is clamped at that plane... + CHECK_THAT(lowest_after(1.f), WithinAbs(-1.0f, 1e-3f)); + // ...and as the lowest part, at its own bottom. + CHECK_THAT(lowest_after(0.f), WithinAbs(0.0f, 1e-3f)); +} + // Longest edge over the shortest altitude: 1.15 for an equilateral triangle, 2 for a right isosceles // one, unbounded for a needle. static float triangle_aspect(const Vec3f &a, const Vec3f &b, const Vec3f &c) diff --git a/tests/libslic3r/test_texture_import.cpp b/tests/libslic3r/test_texture_import.cpp new file mode 100644 index 0000000000..1106045847 --- /dev/null +++ b/tests/libslic3r/test_texture_import.cpp @@ -0,0 +1,76 @@ +#include +#include + +#include "libslic3r/Model.hpp" +#include "libslic3r/TexturePainting.hpp" +#include "texture_import_cgal.hpp" + +#include +#include +#include +#include + +namespace { + +void check_texture_import(const std::string& fixture) +{ + const std::string filename = std::string(TEST_DATA_DIR) + "/texture_import/" + fixture; + INFO(filename); + const Slic3r::Model model = Slic3r::Model::read_from_file(filename); + REQUIRE_FALSE(model.objects.empty()); + REQUIRE(model.texture_mesh); + const Slic3r::TexturedMesh& mesh = *model.texture_mesh; + + Slic3r::TexturePaintingSettings settings; + settings.target_colors_num = 0; // Match the dialog's initial automatic color count. + settings.smooth_weight = 0.5; + settings.mesh_repair_decision = Slic3r::TexturePaintingSettings::MeshRepairDecision::ImportWithoutRepair; + Slic3r::PaintedMesh painted; + // Follow the dialog worker's format-dependent path, including the boundary + // smoothing that needs a consistent CGAL Kd_tree layout across libraries. + if (!mesh.precomputed_face_colors.empty()) + REQUIRE(Slic3r::face_colors_to_painting(mesh, painted, settings)); + else + REQUIRE(Slic3r::texture_to_painting(mesh, painted, settings)); + + REQUIRE_FALSE(painted.indices.empty()); + REQUIRE(painted.face_colors.size() == painted.indices.size()); + REQUIRE(std::any_of(painted.face_colors.begin(), painted.face_colors.end(), + [](const auto& color) { return color[0] > color[2]; })); + REQUIRE(std::any_of(painted.face_colors.begin(), painted.face_colors.end(), + [](const auto& color) { return color[2] > color[0]; })); + + const std::vector> filament_colors{ + {1.f, 0.f, 0.f, 1.f}, {0.f, 0.f, 1.f, 1.f}}; + const auto matches = Slic3r::match_clusters_to_filaments( + painted.cluster_colors, filament_colors, {"Red PLA", "Blue PLA"}); + REQUIRE(matches.size() == painted.cluster_colors.size()); + REQUIRE(std::any_of(matches.begin(), matches.end(), + [](const auto& match) { return match.filament_index == 0; })); + REQUIRE(std::any_of(matches.begin(), matches.end(), + [](const auto& match) { return match.filament_index == 1; })); +} + +} // namespace + +TEST_CASE("Color-boundary smoothing shares its CGAL tree layout with the geometry backend", "[TextureImport][CGAL][Regression]") +{ + // An ABI mismatch need not crash every link of the importer. Compare the + // layouts directly so a lucky choice of inline symbols cannot mask it. + REQUIRE(sizeof(TextureImportTest::SearchTree) == TextureImportTest::backend_search_tree_size()); +} + +TEST_CASE("A JPEG textured GLB retains both colors through filament matching", "[TextureImport][Regression]") +{ + check_texture_import("two_color_jpeg.glb"); +} + +TEST_CASE("An OBJ preserves both MTL colors through filament matching", "[TextureImport][OBJ][Regression]") +{ + check_texture_import("two_color_sphere/test_two_color_sphere.obj"); +} + +TEST_CASE("An OBJ resolves its MTL and external JPEG through filament matching", "[TextureImport][OBJ][Regression]") +{ + check_texture_import("two_color_sphere/test_two_color_sphere_textured.obj"); +} diff --git a/tests/libslic3r/test_wipe_tower_estimate.cpp b/tests/libslic3r/test_wipe_tower_estimate.cpp index 22117e686d..220358bd5e 100644 --- a/tests/libslic3r/test_wipe_tower_estimate.cpp +++ b/tests/libslic3r/test_wipe_tower_estimate.cpp @@ -20,6 +20,7 @@ #include "libslic3r/Point.hpp" #include "libslic3r/libslic3r.h" #include +#include #include #include #include "libslic3r/clonable_ptr.hpp" @@ -426,3 +427,107 @@ TEST_CASE("prime_tower_is_printed follows the option the user set", "[WipeTowerE config.set_key_value("enable_prime_tower", new ConfigOptionBool(true)); CHECK(prime_tower_is_printed(config, 0, 1, false)); } + +// A size x size mm footprint anchored at its lower-left corner, on a plate whose anchors may +// lie anywhere in [0, 90] x [0, 90]. +static Polygon square_footprint(double size) { return Polygon({ {0, 0}, {scaled(size), 0}, {scaled(size), scaled(size)}, {0, scaled(size)} }); } +static Polygon box(double x0, double y0, double x1, double y1) +{ + return Polygon({ {scaled(x0), scaled(y0)}, {scaled(x1), scaled(y0)}, {scaled(x1), scaled(y1)}, {scaled(x0), scaled(y1)} }); +} +static const BoundingBox plate_anchors(Point(0, 0), Point(scaled(90.), scaled(90.))); + +// The footprint placed at `anchor` overlaps no obstacle: at most it touches one. +static bool clear_of(Polygon footprint, const Point &anchor, const Polygons &obstacles) +{ + footprint.translate(anchor); + double overlap = 0.; + for (const Polygon &shared : intersection(Polygons{ footprint }, obstacles)) + overlap += std::abs(shared.area()); + return overlap < scaled(0.01) * scaled(0.01); +} + +TEST_CASE("A tower already clear of every object stays where it is", "[WipeTowerEstimate]") { + const Point target(scaled(10.), scaled(70.)); + const std::optional anchor = nearest_clear_wipe_tower_anchor(plate_anchors, square_footprint(10.), { box(40., 0., 60., 100.) }, target); + REQUIRE(anchor.has_value()); + CHECK(*anchor == target); +} + +TEST_CASE("A tower that lands on an object moves to the nearest side of it", "[WipeTowerEstimate]") { + // A strip from x 40 to 60 covers the plate's full depth. Anchored at x 42 the footprint + // spans 42-52, so it clears the strip at x 30 (12 mm left) or x 60 (18 mm right). + const Polygons obstacles = { box(40., 0., 60., 100.) }; + const std::optional anchor = nearest_clear_wipe_tower_anchor(plate_anchors, square_footprint(10.), obstacles, + Point(scaled(42.), scaled(50.))); + REQUIRE(anchor.has_value()); + CHECK(clear_of(square_footprint(10.), *anchor, obstacles)); + CHECK_THAT(unscaled(anchor->x()), WithinAbs(30., 1e-3)); + CHECK_THAT(unscaled(anchor->y()), WithinAbs(50., 1e-3)); +} + +TEST_CASE("A tower is placed nearest its saved position even when that is off the plate", "[WipeTowerEstimate]") { + // Saved at y 120, past the plate. An object covers the top-left corner, so the nearest + // anchor on the plate is the top edge right of the object (x 30), not straight below. + const Polygons obstacles = { box(0., 60., 30., 100.) }; + const std::optional anchor = nearest_clear_wipe_tower_anchor(plate_anchors, square_footprint(10.), obstacles, + Point(scaled(20.), scaled(120.))); + REQUIRE(anchor.has_value()); + CHECK(clear_of(square_footprint(10.), *anchor, obstacles)); + CHECK_THAT(unscaled(anchor->x()), WithinAbs(30., 1e-3)); + CHECK_THAT(unscaled(anchor->y()), WithinAbs(90., 1e-3)); +} + +TEST_CASE("A rotated tower keeps its turned footprint off the objects", "[WipeTowerEstimate]") { + // Turned 90 degrees about its anchor, the footprint spans x - 10 to x. Saved at x 65 it + // would reach back to 55, so it moves right until it starts at the strip's edge. + Polygon footprint = square_footprint(10.); + footprint.rotate(PI / 2.); + const Polygons obstacles = { box(40., 0., 60., 100.) }; + const std::optional anchor = nearest_clear_wipe_tower_anchor(plate_anchors, footprint, obstacles, + Point(scaled(65.), scaled(50.))); + REQUIRE(anchor.has_value()); + CHECK(clear_of(footprint, *anchor, obstacles)); + CHECK_THAT(unscaled(anchor->x()), WithinAbs(70., 1e-3)); +} + +TEST_CASE("A plate with no room for the tower reports that no anchor is clear", "[WipeTowerEstimate]") { + CHECK_FALSE(nearest_clear_wipe_tower_anchor(plate_anchors, square_footprint(10.), { box(-5., -5., 105., 105.) }, + Point(scaled(50.), scaled(50.))) + .has_value()); +} + +TEST_CASE("A tower pinned to one coordinate by a cramped plate can still move along the other", "[WipeTowerEstimate]") { + // The plate is only as wide as the tower: every anchor has x 0. + const BoundingBox column(Point(0, 0), Point(0, scaled(90.))); + const Polygons obstacles = { box(-5., 42., 15., 62.) }; + const std::optional anchor = nearest_clear_wipe_tower_anchor(column, square_footprint(10.), obstacles, + Point(0, scaled(45.))); + // Blocked from y 32 to 62: down 13 mm beats up 17 mm. + REQUIRE(anchor.has_value()); + CHECK(clear_of(square_footprint(10.), *anchor, obstacles)); + CHECK_THAT(unscaled(anchor->x()), WithinAbs(0., 1e-3)); + CHECK_THAT(unscaled(anchor->y()), WithinAbs(32., 1e-3)); +} + +TEST_CASE("A single anchor is kept when clear and refused when taken", "[WipeTowerEstimate]") { + // Bounds that are one point ask whether that exact spot is clear. + const Point spot(scaled(10.), scaled(10.)); + const BoundingBox only_spot(spot, spot); + const std::optional clear = nearest_clear_wipe_tower_anchor(only_spot, square_footprint(10.), { box(40., 0., 60., 100.) }, spot); + REQUIRE(clear.has_value()); + CHECK(*clear == spot); + CHECK_FALSE(nearest_clear_wipe_tower_anchor(only_spot, square_footprint(10.), { box(15., 0., 60., 100.) }, spot).has_value()); +} + +TEST_CASE("A tower slides off a slanted side of an object", "[WipeTowerEstimate]") { + // The triangle's left side runs from (40, 0) to (50, 40), x = 40 + y / 4. The footprint's + // lower-right corner leads into it, so the clear anchors stop at x = 30 + y / 4, a line + // 13.75 / sqrt(1 + 1/16) mm from the saved anchor (45, 5): shorter than moving straight left. + const Polygons obstacles = { Polygon({ {scaled(40.), 0}, {scaled(60.), 0}, {scaled(50.), scaled(40.)} }) }; + const Point target(scaled(45.), scaled(5.)); + const std::optional anchor = nearest_clear_wipe_tower_anchor(plate_anchors, square_footprint(10.), obstacles, target); + REQUIRE(anchor.has_value()); + CHECK(clear_of(square_footprint(10.), *anchor, obstacles)); + CHECK_THAT(unscaled((*anchor - target).cast().norm()), WithinAbs(13.75 / std::sqrt(1. + 1. / 16.), 1e-3)); +} diff --git a/tests/libslic3r/texture_import_cgal.cpp b/tests/libslic3r/texture_import_cgal.cpp new file mode 100644 index 0000000000..d3ee691d46 --- /dev/null +++ b/tests/libslic3r/texture_import_cgal.cpp @@ -0,0 +1,8 @@ +#include "texture_import_cgal.hpp" + +#include + +std::size_t TextureImportTest::backend_search_tree_size() +{ + return sizeof(SearchTree); +} diff --git a/tests/libslic3r/texture_import_cgal.hpp b/tests/libslic3r/texture_import_cgal.hpp new file mode 100644 index 0000000000..62b3211da4 --- /dev/null +++ b/tests/libslic3r/texture_import_cgal.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace TextureImportTest { + +// The distance-query tree used by ColorUtils.cpp's boundary smoothing. Its +// type name stays the same when CGAL changes its storage for TBB support. +using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; +using Mesh = CGAL::Surface_mesh; +using Primitive = CGAL::AABB_face_graph_triangle_primitive; +using Traits = CGAL::AABB_traits_3; +using PointId = Traits::Point_and_primitive_id; +using SearchTraits = CGAL::Search_traits_adapter, Traits>; +using SearchTree = CGAL::Kd_tree; + +// Implemented inside the actual geometry target, using its private definitions. +std::size_t backend_search_tree_size(); + +} // namespace TextureImportTest diff --git a/tests/slic3rutils/CMakeLists.txt b/tests/slic3rutils/CMakeLists.txt index c9285b955e..a53f161797 100644 --- a/tests/slic3rutils/CMakeLists.txt +++ b/tests/slic3rutils/CMakeLists.txt @@ -2,6 +2,7 @@ get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp test_bambu_filament_ids.cpp + test_bed_exclusion_fields.cpp test_config_value_formatter.cpp test_creality_cfs_match.cpp test_dev_mapping.cpp @@ -11,6 +12,7 @@ add_executable(${_TEST_NAME}_tests test_filament_bitmap_utils.cpp test_colour_picker_field.cpp test_filament_color_picker.cpp + test_gcode_preview_colors.cpp test_device_progress.cpp test_device_manager_integration.cpp test_web_media_controller.cpp @@ -44,6 +46,7 @@ add_executable(${_TEST_NAME}_tests test_shortcuts.cpp test_texture_color_palette.cpp test_texture_island_view.cpp + test_timelapse_codecs.cpp test_file_url.cpp test_imgui_wrapper.cpp test_user_manager.cpp diff --git a/tests/slic3rutils/python_test_support.hpp b/tests/slic3rutils/python_test_support.hpp index e9b0aaac8d..347812f0aa 100644 --- a/tests/slic3rutils/python_test_support.hpp +++ b/tests/slic3rutils/python_test_support.hpp @@ -2,6 +2,15 @@ // Shared embedded-interpreter bootstrap for slic3rutils tests that need a live Python // interpreter (test_plugin_host_api.cpp, test_slicing_pipeline_bindings.cpp, ...). +// +// The runtime is process-wide: once initialized it stays up for the rest of the test process. +// CPython cannot be reinitialized after Py_Finalize (a second init aborts inside _datetime), and +// the app likewise finalizes it only at exit, so nothing here tears it down. +// slic3rutils_tests_main.cpp finalizes the production interpreter once, after the last test case. +// +// This bootstrap is separate from PythonInterpreter's runtime: whichever of the two brings Python +// up first in a process owns it, and the other cannot initialize it again. ctest runs one case per +// process, so that only matters if the binary is run directly. #include #include #include diff --git a/tests/slic3rutils/slic3rutils_tests_main.cpp b/tests/slic3rutils/slic3rutils_tests_main.cpp index f8d2b4fac5..b23e6731cd 100644 --- a/tests/slic3rutils/slic3rutils_tests_main.cpp +++ b/tests/slic3rutils/slic3rutils_tests_main.cpp @@ -1,8 +1,40 @@ #include #include +#include +#include + +#include +#include + +#include "catch2/interfaces/catch_interfaces_reporter.hpp" #include "slic3r/Utils/Http.hpp" +namespace { + +// Finalizes the embedded interpreter once, after the last test case, and never between cases. +// CPython cannot be reinitialized after Py_Finalize (a second init aborts inside _datetime), and +// the app likewise finalizes it only at exit, so the per-test fixtures tear down only the +// PluginManager. Running at the end of the run, rather than from a static destructor, also keeps +// shutdown()'s logging ahead of boost::log's teardown. +class PythonInterpreterRunEnd final : public Catch::EventListenerBase +{ +public: + using Catch::EventListenerBase::EventListenerBase; + + void testRunEnded(const Catch::TestRunStats&) override + { + if (!Slic3r::PythonInterpreter::instance().is_initialized()) + return; + Slic3r::PluginManager::instance().shutdown(); + Slic3r::PythonInterpreter::instance().shutdown(); + } +}; + +} // namespace + +CATCH_REGISTER_LISTENER(PythonInterpreterRunEnd) + TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") { Slic3r::Http g = Slic3r::Http::get("https://github.com/"); @@ -58,4 +90,3 @@ TEST_CASE("Http basic authentication", "[Http][NotWorking]") { REQUIRE(status == 200); } - diff --git a/tests/slic3rutils/test_bambu_filament_ids.cpp b/tests/slic3rutils/test_bambu_filament_ids.cpp index 7d9e0df1f1..fef2c8a224 100644 --- a/tests/slic3rutils/test_bambu_filament_ids.cpp +++ b/tests/slic3rutils/test_bambu_filament_ids.cpp @@ -81,3 +81,24 @@ TEST_CASE("Payload rewrite covers nested trays, calibration lists and mapping in CHECK(BBLPrinterAgent::from_orca_payload("not json") == "not json"); CHECK(BBLPrinterAgent::from_orca_payload(R"({"print":{"command":"pushall"}})") == R"({"print":{"command":"pushall"}})"); } + +TEST_CASE("Payload rewrite covers the nozzle rack status and the auto nozzle mapping request", "[BambuFilamentIds]") +{ + const ScopedRepoResourcesDir repo_resources; + const std::string petg_hf = orca_id_of("GFG96"); + + const std::string rack_status = + R"({"print":{"device":{"nozzle":{"info":[{"id":16,"fila_id":"GFG96","color_m":"FFFFFFFF"},{"id":17,"fila_id":"P22f54c9"}]}}}})"; + json inbound = json::parse(BBLPrinterAgent::to_orca_payload(rack_status)); + CHECK(inbound["print"]["device"]["nozzle"]["info"][0]["fila_id"] == petg_hf); + CHECK(inbound["print"]["device"]["nozzle"]["info"][1]["fila_id"] == "P22f54c9"); // user id: untouched + + const std::string request = R"({"print":{"command":"get_auto_nozzle_mapping","ams_mapping":[65535,65024],)" + R"("fila_info":[{"id":2,"cate":")" + petg_hf + R"(","color":"FFFFFFFF"}],)" + R"("nozzle_info":[{"pos":16,"cate":")" + petg_hf + R"(","color":"FFFFFFFF"},{"pos":1,"cate":""}]}})"; + json outbound = json::parse(BBLPrinterAgent::from_orca_payload(request)); + CHECK(outbound["print"]["fila_info"][0]["cate"] == "GFG96"); + CHECK(outbound["print"]["nozzle_info"][0]["cate"] == "GFG96"); + CHECK(outbound["print"]["nozzle_info"][1]["cate"] == ""); // empty nozzle + CHECK(outbound["print"]["ams_mapping"] == json::parse("[65535,65024]")); +} diff --git a/tests/slic3rutils/test_bed_exclusion_fields.cpp b/tests/slic3rutils/test_bed_exclusion_fields.cpp new file mode 100644 index 0000000000..2c02e5578a --- /dev/null +++ b/tests/slic3rutils/test_bed_exclusion_fields.cpp @@ -0,0 +1,39 @@ +#include +#include "libslic3r/Point.hpp" +#include + +#include "libslic3r/PrintConfig.hpp" +#include "slic3r/GUI/GUI.hpp" + +#include + +using namespace Slic3r; + +TEST_CASE("Pasted volume syntax leaves the saved bed area intact pending confirmation", "[ExclusionVolume][GUI][Regression]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + const std::string area = "0x0,20x0,20x10,10x10,10x20,0x20"; + config.set_deserialize_strict("bed_exclude_area", area); + const std::string pasted = "5..10;40x40,50x40,50x50,40x50"; + + // OptionsGroup updates the config before Tab asks whether to copy the text. + GUI::change_opt_value(config, "bed_exclude_area", boost::any(pasted)); + CHECK(config.option("bed_exclude_area")->serialize() == area); + CHECK_FALSE(has_bed_exclude_volumes(config)); + + append_bed_exclude_volumes(config, pasted); + CHECK(config.opt_string("bed_exclude_volumes") == pasted); + CHECK(config.option("bed_exclude_area")->serialize() == area); +} + +TEST_CASE("The normal bed-area field still accepts arbitrary polygons and clearing", "[ExclusionVolume][GUI][Regression]") +{ + DynamicPrintConfig config = DynamicPrintConfig::full_print_config(); + const Pointfs polygon{Vec2d(0, 0), Vec2d(20, 0), Vec2d(20, 10), Vec2d(10, 10), Vec2d(10, 20), Vec2d(0, 20)}; + GUI::change_opt_value(config, "bed_exclude_area", boost::any(polygon)); + CHECK(config.option("bed_exclude_area")->values == polygon); + CHECK_FALSE(has_bed_exclude_volumes(config)); + + GUI::change_opt_value(config, "bed_exclude_area", boost::any(Pointfs{})); + CHECK(config.option("bed_exclude_area")->values.empty()); +} diff --git a/tests/slic3rutils/test_gcode_preview_colors.cpp b/tests/slic3rutils/test_gcode_preview_colors.cpp new file mode 100644 index 0000000000..cc8d618ac4 --- /dev/null +++ b/tests/slic3rutils/test_gcode_preview_colors.cpp @@ -0,0 +1,78 @@ +// convert_filament_colors lives in libslic3r_gui; this is the only suite that links it. +#ifdef WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #ifndef NOMINMAX + #define NOMINMAX + #endif + #include +#endif + +#include +#include +#include + +#include +#include + +#include "libslic3r/Color.hpp" +#include "libvgcode/include/Types.hpp" +#include "slic3r/GUI/3DScene.hpp" +#include "slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp" + +using Catch::Matchers::WithinAbs; + +TEST_CASE("Filament colors keep their opacity for the G-code preview", "[GCodePreviewColors]") +{ + const libvgcode::PaletteWithAlpha palette = libvgcode::convert_filament_colors({ "#3366CC", "#3366CC80", "not a color" }); + REQUIRE(palette.size() == 3); + + CHECK(palette[0][3] == 255); + CHECK(palette[1][3] == 0x80); + for (size_t i = 0; i < 3; ++i) + CHECK(palette[1][i] == palette[0][i]); + + const libvgcode::ColorWithAlpha dummy{ libvgcode::DUMMY_COLOR[0], libvgcode::DUMMY_COLOR[1], libvgcode::DUMMY_COLOR[2], 255 }; + CHECK(palette[2] == dummy); +} + +TEST_CASE("An almost clear filament keeps its color at the least opacity", "[GCodePreviewColors]") +{ + Slic3r::ColorRGBA clear; + REQUIRE(Slic3r::decode_color("#3366CC10", clear)); + REQUIRE(clear.a() < FullyTransparentMaterialThreshold); + const Slic3r::ColorRGBA drawn = adjust_color_for_rendering(clear); + CHECK(drawn.r() == clear.r()); + CHECK(drawn.g() == clear.g()); + CHECK(drawn.b() == clear.b()); + CHECK(drawn.a() == FullyTransparentMaterialThreshold); + + const libvgcode::PaletteWithAlpha palette = libvgcode::convert_filament_colors({ "#3366CC10" }); + REQUIRE(palette.size() == 1); + for (int i = 0; i < 3; ++i) + CHECK(palette[0][i] == std::lround(255.0f * drawn[i])); + CHECK(palette[0][3] == std::lround(255.0f * drawn.a())); +} + +TEST_CASE("A translucent black filament is lifted to a grey that rises with its transparency", "[GCodePreviewColors]") +{ + const libvgcode::PaletteWithAlpha palette = libvgcode::convert_filament_colors({ "#000000", "#00000080", "#00000020" }); + REQUIRE(palette.size() == 3); + for (const libvgcode::ColorWithAlpha& color : palette) { + CHECK(color[1] == color[0]); + CHECK(color[2] == color[0]); + } + CHECK(palette[0][3] == 255); + CHECK(palette[1][3] == 0x80); + CHECK(palette[0][0] < palette[1][0]); + CHECK(palette[1][0] < palette[2][0]); + CHECK(palette[2][0] < 160); +} + +TEST_CASE("Preview filament colors convert back with their opacity", "[GCodePreviewColors]") +{ + const Slic3r::ColorRGBA color = libvgcode::convert(libvgcode::ColorWithAlpha{ 51, 102, 204, 128 }); + CHECK_THAT(color.r(), WithinAbs(51.0 / 255.0, 1e-6)); + CHECK_THAT(color.a(), WithinAbs(128.0 / 255.0, 1e-6)); +} diff --git a/tests/slic3rutils/test_imgui_wrapper.cpp b/tests/slic3rutils/test_imgui_wrapper.cpp index 544a3832f5..bdb6f24966 100644 --- a/tests/slic3rutils/test_imgui_wrapper.cpp +++ b/tests/slic3rutils/test_imgui_wrapper.cpp @@ -75,7 +75,27 @@ struct ImGuiFrames ImGui::End(); } - char text[16] = ""; + void draw_slider() + { + ImGui::Begin("window"); + ImGui::SliderFloat("##slider", &value, 0.f, 1.f); + const ImVec2 min = ImGui::GetItemRectMin(), max = ImGui::GetItemRectMax(); + slider_center = ImVec2((min.x + max.x) / 2, (min.y + max.y) / 2); + ImGui::End(); + } + + // Presses the left button at pos, or releases it, and draws the slider in two frames. + void mouse(const ImVec2& pos, bool down) + { + ImGui::GetIO().MousePos = pos; + ImGui::GetIO().MouseDown[0] = down; + frame([this] { draw_slider(); }); + frame([this] { draw_slider(); }); + } + + char text[16] = ""; + float value = 0.f; + ImVec2 slider_center; }; void draw_modal() @@ -84,6 +104,28 @@ void draw_modal() ImGui::EndPopup(); } +void draw_dropdown(bool open) +{ + ImGui::Begin("window"); + if (open) + ImGui::OpenPopup("dropdown"); + if (ImGui::BeginPopup("dropdown")) { + ImGui::Text("item"); + ImGui::EndPopup(); + } + ImGui::End(); +} + +wxKeyEvent key_event(wxEventType type, int key_code, int modifiers = wxMOD_NONE) +{ + wxKeyEvent evt(type); + evt.m_keyCode = key_code; + evt.SetControlDown(modifiers & wxMOD_CONTROL); + evt.SetShiftDown(modifiers & wxMOD_SHIFT); + evt.SetAltDown(modifiers & wxMOD_ALT); + return evt; +} + } // namespace TEST_CASE("a vertical wheel event steps ImGui's wheel in its own direction", "[ImGuiWrapper]") @@ -103,6 +145,21 @@ TEST_CASE("a wheel event with no rotation or on the horizontal axis does not ste CHECK_THAT(wheel_after(rotation, axis), WithinAbs(0.0, 0.0)); } +TEST_CASE("a mouse event replaces a modifier whose key-up went to another window", "[ImGuiWrapper][Regression]") +{ + ImGuiWrapper imgui; + imgui.set_display_size(800.f, 600.f); + ImGui::GetIO().KeyCtrl = true; + + wxMouseEvent move(wxEVT_MOTION); + imgui.update_mouse_data(move); + CHECK_FALSE(ImGui::GetIO().KeyCtrl); + + move.SetControlDown(true); + imgui.update_mouse_data(move); + CHECK(ImGui::GetIO().KeyCtrl); +} + TEST_CASE("an InputText counts as active only while it holds the keyboard", "[ImGuiWrapper]") { ImGuiFrames f; @@ -161,3 +218,137 @@ TEST_CASE("ImGui owns every key under a modal and text-editing keys in an active }); CHECK(f.imgui.owns_key(save)); } + +TEST_CASE("ImGui owns the whole keyboard under a modal or in an active InputText", "[ImGuiWrapper]") +{ + ImGuiFrames f; + CHECK_FALSE(f.imgui.owns_keyboard()); + + f.frame([&] { f.draw_input(true); }); + f.frame([&] { f.draw_input(false); }); + CHECK(f.imgui.owns_keyboard()); + + f.frame([] {}); + CHECK_FALSE(f.imgui.owns_keyboard()); + f.frame([] { + ImGui::OpenPopup("modal"); + draw_modal(); + }); + CHECK(f.imgui.owns_keyboard()); +} + +TEST_CASE("an open dropdown owns the whole keyboard until it is closed", "[ImGuiWrapper]") +{ + ImGuiFrames f; + f.frame([] { draw_dropdown(true); }); + CHECK(f.imgui.popup_open()); + CHECK(f.imgui.owns_keyboard()); + + f.imgui.close_top_popup(); + f.frame([] { draw_dropdown(false); }); + CHECK_FALSE(f.imgui.popup_open()); + CHECK_FALSE(f.imgui.owns_keyboard()); +} + +TEST_CASE("closing the top popup leaves a modal open", "[ImGuiWrapper]") +{ + ImGuiFrames f; + f.frame([] { + ImGui::OpenPopup("modal"); + draw_modal(); + }); + f.imgui.close_top_popup(); + f.frame([] { draw_modal(); }); + CHECK(f.imgui.modal_popup_open()); +} + +TEST_CASE("a held slider owns the keyboard but not the keys Global shortcuts use", "[ImGuiWrapper]") +{ + ImGuiFrames f; + f.mouse(ImVec2(0, 0), false); + CHECK_FALSE(f.imgui.item_held()); + f.mouse(f.slider_center, true); + CHECK(f.imgui.item_held()); + CHECK(f.imgui.owns_keyboard()); + CHECK_FALSE(f.imgui.owns_key(KeyChord{ 'M' })); + CHECK_FALSE(f.imgui.owns_key(KeyChord{ WXK_LEFT })); + + f.mouse(f.slider_center, false); + CHECK_FALSE(f.imgui.owns_keyboard()); +} + +TEST_CASE("a slider typed into once is not a text field when dragged", "[ImGuiWrapper][Regression]") +{ + ImGuiFrames f; + f.mouse(ImVec2(0, 0), false); + ImGui::GetIO().KeyCtrl = true; // Ctrl+click types a value + f.mouse(f.slider_center, true); + ImGui::GetIO().KeyCtrl = false; + f.mouse(f.slider_center, false); + REQUIRE(f.imgui.text_input_active()); + + f.mouse(ImVec2(0, 0), true); // a click elsewhere closes the field + f.mouse(ImVec2(0, 0), false); + f.mouse(f.slider_center, true); + REQUIRE(ImGui::GetInputTextState(ImGui::GetActiveID()) != nullptr); + CHECK_FALSE(f.imgui.text_input_active()); + CHECK_FALSE(f.imgui.owns_key(KeyChord{ 'M' })); +} + +TEST_CASE("a key's char event gets its key-down's answer", "[ImGuiWrapper]") +{ + ImGuiFrames f; + f.frame([&] { f.draw_input(true); }); + f.frame([&] { f.draw_input(false); }); + CHECK(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, 'A'))); + f.frame([] {}); // the field closes before the char arrives + REQUIRE_FALSE(f.imgui.text_input_active()); + CHECK(f.imgui.claim_key_event(key_event(wxEVT_CHAR, 'a'))); + + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, 'B'))); + f.frame([&] { f.draw_input(true); }); // the field opens before the char arrives + f.frame([&] { f.draw_input(false); }); + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_CHAR, 'b'))); + // A char with no key-down before it is decided on its own. + CHECK(f.imgui.claim_key_event(key_event(wxEVT_CHAR, 'c'))); +} + +TEST_CASE("a held key's repeats and release get its press's answer", "[ImGuiWrapper]") +{ + ImGuiFrames f; + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, WXK_RIGHT))); + f.frame([&] { f.draw_input(true); }); + f.frame([&] { f.draw_input(false); }); + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, WXK_RIGHT))); + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_KEY_UP, WXK_RIGHT))); + + CHECK(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, WXK_RIGHT))); + CHECK(f.imgui.claim_key_event(key_event(wxEVT_KEY_UP, WXK_RIGHT))); + // The release also clears the press's answer for a later char with no key-down. + f.frame([] {}); + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_CHAR, 'a'))); +} + +TEST_CASE("a key pressed again after the canvas lost the focus is decided afresh", "[ImGuiWrapper]") +{ + ImGuiFrames f; + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, 'M'))); + f.imgui.forget_key_claims(); // the key-up went to the window that took the focus + + f.frame([&] { f.draw_input(true); }); + f.frame([&] { f.draw_input(false); }); + CHECK(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, 'M'))); +} + +TEST_CASE("an active ImGui field claims every key, whether it edits text or not", "[ImGuiWrapper]") +{ + const int key = GENERATE(int('A'), int('D'), int(WXK_SHIFT)); + ImGuiFrames f; + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, key, wxMOD_CONTROL))); + CHECK_FALSE(f.imgui.claim_key_event(key_event(wxEVT_KEY_UP, key, wxMOD_CONTROL))); + + f.frame([&] { f.draw_input(true); }); + f.frame([&] { f.draw_input(false); }); + CHECK(f.imgui.claim_key_event(key_event(wxEVT_KEY_DOWN, key, wxMOD_CONTROL))); + CHECK(f.imgui.claim_key_event(key_event(wxEVT_KEY_UP, key, wxMOD_CONTROL))); +} diff --git a/tests/slic3rutils/test_moonraker_printer_agent.cpp b/tests/slic3rutils/test_moonraker_printer_agent.cpp index d3559cea1f..4d1d61a8c6 100644 --- a/tests/slic3rutils/test_moonraker_printer_agent.cpp +++ b/tests/slic3rutils/test_moonraker_printer_agent.cpp @@ -53,7 +53,8 @@ public: mutable unsigned fetch_count = 0; protected: - bool fetch_device_info(const std::string&, const std::string&, MoonrakerDeviceInfo& info, std::string&) const override + bool fetch_device_info( + const std::string&, const std::string&, MoonrakerDeviceInfo& info, std::string&, const std::function&) const override { ++fetch_count; info.dev_name = "Test printer"; @@ -61,13 +62,12 @@ protected: } }; -class StreamAgent : public MoonrakerPrinterAgent +// Connects without the app's printer preset, and counts the device info queries that have returned. +class ConnectAgent : public MoonrakerPrinterAgent { public: using MoonrakerPrinterAgent::MoonrakerPrinterAgent; - using MoonrakerPrinterAgent::start_status_stream; - using MoonrakerPrinterAgent::stop_status_stream; - using MoonrakerPrinterAgent::ws_timings; + std::shared_ptr> fetches_returned; protected: bool init_device_info( @@ -79,7 +79,32 @@ protected: return true; } - bool fetch_device_info(const std::string&, const std::string&, MoonrakerDeviceInfo& info, std::string&) const override + bool fetch_device_info(const std::string& base_url, + const std::string& api_key, + MoonrakerDeviceInfo& info, + std::string& error, + const std::function& cancelled) const override + { + // Copied first, since the base destructor that waits for this query runs after this class's members are gone + const std::shared_ptr> counter = fetches_returned; + const bool fetched = MoonrakerPrinterAgent::fetch_device_info(base_url, api_key, info, error, cancelled); + if (counter) + ++*counter; + return fetched; + } +}; + +class StreamAgent : public ConnectAgent +{ +public: + using ConnectAgent::ConnectAgent; + using MoonrakerPrinterAgent::start_status_stream; + using MoonrakerPrinterAgent::stop_status_stream; + using MoonrakerPrinterAgent::ws_timings; + +protected: + bool fetch_device_info( + const std::string&, const std::string&, MoonrakerDeviceInfo& info, std::string&, const std::function&) const override { info.dev_name = "Test printer"; return true; @@ -96,7 +121,7 @@ enum class Behavior { HangsUpWithoutAnswer, // Closes the websocket without sending anything IgnoresClose, // Reports Klippy disconnected, then never answers the close StallsObjectList, // Never answers the stream's object list request - StallsStatusQuery, // Never answers HTTP requests until released, then hangs up on them + StallsHttp, // Never answers HTTP requests until released, then hangs up on them }; class FakePrinter @@ -253,7 +278,7 @@ private: wait_for_release(); return; } - if (m_behavior == Behavior::StallsStatusQuery) { + if (m_behavior == Behavior::StallsHttp) { wait_for_release(); beast::error_code ec; socket.close(ec); @@ -401,6 +426,22 @@ struct StreamFixture StreamAgent agent{""}; }; +PrinterConnectionParams connection_to(const FakePrinter& printer) +{ + PrinterConnectionParams params; + params.dev_id = "printer"; + params.host = printer.host(); + params.port = printer.port(); + return params; +} + +// Destroys the agent, giving it `limit` to return. +template bool destroys_within(std::unique_ptr& agent, std::chrono::milliseconds limit) +{ + auto destroyed = std::async(std::launch::async, [&] { agent.reset(); }); + return destroyed.wait_for(limit) == std::future_status::ready; +} + } // namespace TEST_CASE("Moonraker discovery waits for a complete device identity", "[MoonrakerPrinterAgent][Discovery]") @@ -420,12 +461,13 @@ TEST_CASE("Moonraker discovery waits for a complete device identity", "[Moonrake agent.device_info.dev_id = "127.0.0.1:7125"; agent.device_info.dev_ip = agent.device_info.dev_id; agent.device_info.base_url = "http://127.0.0.1:7125"; + agent.device_info.model_name = "Test model"; agent.start_discovery(true, false); REQUIRE(announcements == 1); - REQUIRE(agent.fetch_count == 1); + REQUIRE(agent.fetch_count == 0); REQUIRE(announcement.at("dev_id") == agent.device_info.dev_id); REQUIRE(announcement.at("dev_ip") == agent.device_info.dev_ip); - REQUIRE(announcement.at("dev_name") == "Test printer"); + REQUIRE(announcement.at("dev_name") == "Test model"); } TEST_CASE("Stopping the status stream gives a silent printer no more than its timeouts", "[MoonrakerPrinterAgent][StatusStream]") @@ -573,12 +615,8 @@ TEST_CASE("The status stream sends no heartbeat while the printer has nothing ne TEST_CASE("A disconnect during the connection queries keeps the status stream from starting", "[MoonrakerPrinterAgent][StatusStream]") { - StreamFixture f(Behavior::StallsStatusQuery); - PrinterConnectionParams params; - params.dev_id = "printer"; - params.host = f.printer.host(); - params.port = f.printer.port(); - f.agent.connect_printer(params); + StreamFixture f(Behavior::StallsHttp); + f.agent.connect_printer(connection_to(f.printer)); REQUIRE(f.printer.wait_for_http_requests(1)); f.agent.disconnect_printer(); @@ -587,3 +625,32 @@ TEST_CASE("A disconnect during the connection queries keeps the status stream fr REQUIRE(f.printer.wait_for_http_hang_ups(1)); CHECK_FALSE(f.printer.wait_for_ready_connections(1, 500ms)); } + +TEST_CASE("Destroying the agent waits for the connection threads it superseded", "[MoonrakerPrinterAgent][Connect]") +{ + FakePrinter printer(Behavior::StallsHttp); + const auto fetches_returned = std::make_shared>(0); + auto agent = std::make_unique(""); + agent->fetches_returned = fetches_returned; + + agent->connect_printer(connection_to(printer)); + REQUIRE(printer.wait_for_http_requests(1)); + agent->connect_printer(connection_to(printer)); + REQUIRE(printer.wait_for_http_requests(2)); + agent->disconnect_printer(); + + // The stalled queries see the change within 1 s of curl progress. + CHECK(destroys_within(agent, 2s)); + CHECK(*fetches_returned == 2); +} + +TEST_CASE("Destroying the agent stops a stalled status query", "[MoonrakerPrinterAgent][Connect]") +{ + FakePrinter printer(Behavior::StallsHttp); + auto agent = std::make_unique(""); + agent->connect_printer(connection_to(printer)); + REQUIRE(printer.wait_for_http_requests(1)); + + // The stalled query sees the change within 1 s of curl progress. + CHECK(destroys_within(agent, 2s)); +} diff --git a/tests/slic3rutils/test_orca_cloud_agent.cpp b/tests/slic3rutils/test_orca_cloud_agent.cpp index 485b662c0b..f84a14ae76 100644 --- a/tests/slic3rutils/test_orca_cloud_agent.cpp +++ b/tests/slic3rutils/test_orca_cloud_agent.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -91,7 +92,9 @@ using boost::asio::ip::tcp; class LoopbackServer { public: - enum class Mode { Ok, Unavailable, Silent }; + // Session answers every request with the body given to set_session_body(), as the token endpoint + // does, after 200 ms so the client is still waiting when the test makes its next call. + enum class Mode { Ok, Unavailable, Silent, Session }; struct Request { @@ -113,6 +116,11 @@ public: std::string url() const { return "http://127.0.0.1:" + std::to_string(m_acceptor.local_endpoint().port()); } void set_mode(Mode mode) { m_mode = mode; } + void set_session_body(std::string body) + { + std::lock_guard lock(m_mutex); + m_session_body = std::move(body); + } bool wait_for_accepts(size_t count, std::chrono::milliseconds timeout) { @@ -172,13 +180,31 @@ private: const Mode mode = m_mode; if (mode == Mode::Silent) return; - const std::string_view response = mode == Mode::Ok ? - "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: 11\r\nConnection: close\r\n\r\n{\"ok\":true}" : - "HTTP/1.1 503 Service Unavailable\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"; - boost::asio::async_write(connection->socket, boost::asio::buffer(response), - [connection](boost::system::error_code, size_t) { - boost::system::error_code ignored; - connection->socket.shutdown(tcp::socket::shutdown_both, ignored); + auto response = std::make_shared(); + if (mode == Mode::Session) { + std::lock_guard lock(m_mutex); + *response = "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: " + + std::to_string(m_session_body.size()) + "\r\nConnection: close\r\n\r\n" + m_session_body; + } else { + *response = mode == Mode::Ok ? + "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: 11\r\nConnection: close\r\n\r\n{\"ok\":true}" : + "HTTP/1.1 503 Service Unavailable\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"; + } + auto write = [connection, response] { + boost::asio::async_write(connection->socket, boost::asio::buffer(*response), + [connection, response](boost::system::error_code, size_t) { + boost::system::error_code ignored; + connection->socket.shutdown(tcp::socket::shutdown_both, ignored); + }); + }; + if (mode != Mode::Session) { + write(); + return; + } + auto timer = std::make_shared(m_io, 200ms); + timer->async_wait([timer, write](boost::system::error_code ec) { + if (!ec) + write(); }); }); } @@ -192,8 +218,12 @@ private: std::condition_variable m_cv; std::vector m_requests; std::vector> m_connections; + std::string m_session_body; }; +// A JWT whose only claim is {"exp":4102444800} (2100-01-01); the agent reads nothing else from it. +constexpr const char* FAR_FUTURE_JWT = "eyJhbGciOiJub25lIn0.eyJleHAiOjQxMDI0NDQ4MDB9.sig"; + // What the agent reported through its callbacks, recorded on whichever thread delivers it so the // assertions can run on the test thread. struct CallbackLog @@ -515,3 +545,24 @@ TEST_CASE_METHOD(HealthCheckFixture, "The health check does no token work", "[Or CHECK(agent->is_user_login()); CHECK(agent->get_access_token() == "test-token"); } + +TEST_CASE_METHOD(HealthCheckFixture, "A token request made while start() refreshes waits for it instead of refreshing again", "[OrcaCloudServiceAgent]") +{ + // A session saved by a previous run: start() refreshes it on its own thread. + agent->persist_user_secret(nlohmann::json{{"refresh_token", "stored-refresh-token"}, {"user_id", "test-user-id"}}.dump()); + const std::string access_token = FAR_FUTURE_JWT; + server.set_session_body(nlohmann::json{{"access_token", access_token}, + {"refresh_token", "rotated-refresh-token"}, + {"user_id", "test-user-id"}}.dump()); + server.set_mode(LoopbackServer::Mode::Session); + + REQUIRE(agent->start() == BAMBU_NETWORK_SUCCESS); + CHECK(agent->ensure_token_fresh("test")); + CHECK(agent->get_access_token() == access_token); + + size_t token_posts = 0; + for (const auto& request : server.requests()) + if (boost::starts_with(request.request_line, "POST /auth/v1/token")) + ++token_posts; + CHECK(token_posts == 1); +} diff --git a/tests/slic3rutils/test_plugin_audit.cpp b/tests/slic3rutils/test_plugin_audit.cpp index 267cdb4099..a257e304ea 100644 --- a/tests/slic3rutils/test_plugin_audit.cpp +++ b/tests/slic3rutils/test_plugin_audit.cpp @@ -1,22 +1,48 @@ #include #include +#include #include #include #include // GCODEVIEWER_APP_KEY, SLIC3R_APP_KEY (via libslic3r_version.h) #include +#include +#include +#include +#include +#include +#include #include // secret_constants::USER_SECRET_FILENAME +#include #include +#include +#include #include "libslic3r_version.h" #include "plugin_test_utils.hpp" +#include "test_utils.hpp" #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include using namespace Slic3r; namespace fs = boost::filesystem; +namespace py = pybind11; namespace { @@ -43,7 +69,7 @@ void seed_denied_keywords() } // namespace -TEST_CASE("Plugin audit denies app config and token filenames anywhere", "[audit]") +TEST_CASE("Plugin audit denies host-managed filenames anywhere", "[audit]") { seed_denied_names(); const PluginAuditManager& mgr = PluginAuditManager::instance(); @@ -55,6 +81,7 @@ TEST_CASE("Plugin audit denies app config and token filenames anywhere", "[audit CHECK(mgr.is_denied_filename(fs::path(SLIC3R_APP_KEY ".ini"))); CHECK(mgr.is_denied_filename(fs::path(GCODEVIEWER_APP_KEY ".ini"))); CHECK(mgr.is_denied_filename(fs::path(secret_constants::USER_SECRET_FILENAME))); + CHECK(mgr.is_denied_filename(fs::path(".install_state.json"))); } SECTION("companions holding the same secrets are denied by the prefix rule") @@ -110,6 +137,7 @@ TEST_CASE("Plugin audit deny beats allowed roots", "[audit]") const fs::path conf = fs::path(data_dir()) / (SLIC3R_APP_KEY ".conf"); const fs::path token = fs::path(data_dir()) / secret_constants::USER_SECRET_FILENAME; + const fs::path install_state = fs::path(data_dir()) / "plugins" / "example" / ".install_state.json"; SECTION("a non-denied file inside the allowed root is writable (root really grants writes)") { @@ -150,6 +178,17 @@ TEST_CASE("Plugin audit deny beats allowed roots", "[audit]") CHECK_FALSE(decision.allowed); } + SECTION("plugin install state is blocked for reads and writes despite the allowed root") + { + AuditDecision read_decision = mgr.check_open(install_state.string(), "r"); + CHECK_FALSE(read_decision.allowed); + CHECK(read_decision.reason == "denied filename"); + + AuditDecision write_decision = mgr.check_open(install_state.string(), "w"); + CHECK_FALSE(write_decision.allowed); + CHECK(write_decision.reason == "denied filename"); + } + SECTION("a traversal path resolving to the config is blocked") { const fs::path traversal = fs::path(data_dir()) / "plugins" / ".." / (SLIC3R_APP_KEY ".conf"); @@ -262,6 +301,67 @@ TEST_CASE("Plugin audit denies secret/certificate/config-like paths by keyword", } } +TEST_CASE("Plugin audit checks denied keywords below data_dir, not in the directories above it", "[PluginAudit]") +{ + // Flatpak keeps the app's data folder under /.var/app//config/OrcaSlicer, so + // data_dir() itself has a "config" component. That ancestor describes the sandbox's layout, + // not what the folder holds, and must not hard-deny every path inside it. + ScopedDataDir data_dir_guard("plugin-audit-data-dir-keyword"); + const fs::path flatpak_data_dir = data_dir_guard.dir / "config" / "OrcaSlicer"; + set_data_dir(flatpak_data_dir.string()); + + seed_denied_names(); + seed_denied_keywords(); + + PluginAuditManager& mgr = PluginAuditManager::instance(); + // Reproduce install_hook()'s grant: data_dir() is a global allowed root. + mgr.add_global_allowed_root(data_dir()); + + ScopedPluginAuditContext ctx("test_plugin", ""); + + SECTION("the root and the paths below it that carry no keyword are allowed") + { + CHECK_FALSE(mgr.is_denied_path_keyword(flatpak_data_dir / "orca_plugins" / "state.json")); + CHECK(mgr.check_open(data_dir(), "r").allowed); + CHECK(mgr.check_open((flatpak_data_dir / "orca_plugins" / "test_plugin" / "state.json").string(), "r").allowed); + CHECK(mgr.check_open((flatpak_data_dir / "orca_plugins" / "test_plugin" / "state.json").string(), "w").allowed); + CHECK(mgr.check_open((flatpak_data_dir / "system" / "profiles" / "vendor.json").string(), "r").allowed); + } + + SECTION("a 'secrets' component below data_dir() is still denied") + { + AuditDecision decision = mgr.check_open((flatpak_data_dir / "secrets" / "token.json").string(), "r"); + CHECK_FALSE(decision.allowed); + CHECK(decision.reason == "denied path keyword"); + } + + SECTION("a 'config' component below data_dir() is still denied") + { + AuditDecision decision = mgr.check_open((flatpak_data_dir / "config" / "settings.json").string(), "r"); + CHECK_FALSE(decision.allowed); + CHECK(decision.reason == "denied path keyword"); + } + + SECTION("the app config below data_dir() is still denied by name") + { + AuditDecision decision = mgr.check_open((flatpak_data_dir / (SLIC3R_APP_KEY ".conf")).string(), "r"); + CHECK_FALSE(decision.allowed); + CHECK(decision.reason == "denied filename"); + } + + SECTION("an unrelated resources root keeps the full-path keyword check") + { + ScopedResourcesDir resources_dir_guard("plugin-audit-data-dir-keyword-resources"); + mgr.add_global_allowed_root(resources_dir(), /*allow_write=*/false); + + CHECK(mgr.check_open((fs::path(resources_dir()) / "profiles" / "vendor.json").string(), "r").allowed); + + AuditDecision decision = mgr.check_open((fs::path(resources_dir()) / "cert" / "slicer_base64.cer").string(), "r"); + CHECK_FALSE(decision.allowed); + CHECK(decision.reason == "denied path keyword"); + } +} + TEST_CASE("Plugin audit is_denied_path combines the filename and keyword registries", "[audit]") { seed_denied_names(); @@ -325,6 +425,117 @@ TEST_CASE("Plugin audit a read-only allowed root blocks writes but not reads", " } } +TEST_CASE("Plugin audit network permissions match by scheme and host", "[audit]") +{ + SECTION("a URL is reduced to its scheme and host") + { + CHECK(PluginAuditManager::normalize_network_url("https://API.Example.com:8443/v1/items?page=2#top") == + "https://api.example.com"); + CHECK(PluginAuditManager::normalize_network_url("http://example.com") == "http://example.com"); + CHECK(PluginAuditManager::normalize_network_url("https://[2001:db8::1]:443/path") == "https://[2001:db8::1]"); + } + + SECTION("non-http schemes and targets without a scheme are not network URLs") + { + CHECK(PluginAuditManager::normalize_network_url("ftp://example.com").empty()); + CHECK(PluginAuditManager::normalize_network_url("api.example.com").empty()); + CHECK(PluginAuditManager::normalize_network_url("https://").empty()); + } + + SECTION("a URL target matches the same scheme and host regardless of path and port") + { + const std::vector granted{"https://api.example.com"}; + CHECK(PluginAuditManager::network_permission_matches(granted, "https://api.example.com/v1/items?page=2")); + CHECK(PluginAuditManager::network_permission_matches(granted, "https://api.example.com:8443/upload")); + } + + SECTION("canonical host grants are broad but persisted full-URL grants stay exact") + { + const std::vector declared_host{"https://api.example.com"}; + CHECK(PluginAuditManager::network_permission_matches(declared_host, "https://api.example.com/v1")); + + const std::vector saved_url{"https://api.example.com/v1"}; + CHECK(PluginAuditManager::network_permission_matches(saved_url, "https://api.example.com/v1")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(saved_url, "https://api.example.com/v2")); + } + + SECTION("a URL target does not match a different host or a different scheme") + { + const std::vector granted{"https://api.example.com"}; + CHECK_FALSE(PluginAuditManager::network_permission_matches(granted, "https://evil.example.com/v1")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(granted, "http://api.example.com/v1")); + } + + SECTION("a bare host target matches the host of a grant") + { + const std::vector granted{"https://api.example.com"}; + CHECK(PluginAuditManager::network_permission_matches(granted, "api.example.com")); + CHECK(PluginAuditManager::network_permission_matches(granted, "api.example.com:443")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(granted, "other.example.com")); + } + + SECTION("a saved full URL does not authorize raw socket access to its host") + { + const std::vector saved_url{"https://api.example.com/v1"}; + CHECK(PluginAuditManager::network_permission_matches(saved_url, "https://api.example.com/v1")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(saved_url, "api.example.com")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(saved_url, "api.example.com:443")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(saved_url, "('api.example.com', 443)")); + + const std::vector saved_ipv6{"https://[2001:db8::1]/v1"}; + CHECK(PluginAuditManager::network_permission_matches(saved_ipv6, "https://[2001:db8::1]/v1")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(saved_ipv6, "2001:db8::1")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(saved_ipv6, "[2001:db8::1]:443")); + + // Canonical scheme://host grants still cover raw socket targets, IPv6 brackets aside. + const std::vector canonical{"https://api.example.com", "https://[2001:db8::1]"}; + CHECK(PluginAuditManager::network_permission_matches(canonical, "api.example.com")); + CHECK(PluginAuditManager::network_permission_matches(canonical, "2001:db8::1")); + + // Normalization lowercases the scheme and host, so case alone keeps a grant canonical. + const std::vector uppercase{"HTTPS://API.Example.com", "HTTPS://[2001:DB8::1]"}; + CHECK(PluginAuditManager::network_permission_matches(uppercase, "api.example.com")); + CHECK(PluginAuditManager::network_permission_matches(uppercase, "2001:db8::1")); + } + + SECTION("legacy persisted address tuples keep matching their host") + { + const std::vector legacy_granted{"('api.example.com', 443)"}; + CHECK(PluginAuditManager::network_permission_matches(legacy_granted, "api.example.com")); + + const std::vector granted{"https://api.example.com"}; + CHECK(PluginAuditManager::network_permission_matches(granted, "('api.example.com', 443)")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(granted, "('93.184.216.34', 443)")); + } + + SECTION("an IPv6 literal matches across bracketed and bare forms") + { + const std::vector granted{"https://[2001:db8::1]"}; + CHECK(PluginAuditManager::network_permission_matches(granted, "2001:db8::1")); + CHECK(PluginAuditManager::network_permission_matches(granted, "[2001:db8::1]:443")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(granted, "2001:db8::2")); + } + + SECTION("a non-http URL only matches an exact grant") + { + const std::vector granted{"ftp://example.com/file"}; + CHECK(PluginAuditManager::network_permission_matches(granted, "ftp://example.com/file")); + CHECK_FALSE(PluginAuditManager::network_permission_matches(granted, "ftp://example.com/other")); + + const std::vector https{"https://api.example.com"}; + CHECK_FALSE(PluginAuditManager::network_permission_matches(https, "ftp://api.example.com/file")); + } + + SECTION("an empty grant list or an empty target never matches") + { + const std::vector granted{}; + CHECK_FALSE(PluginAuditManager::network_permission_matches(granted, "https://api.example.com")); + + const std::vector any{"https://api.example.com"}; + CHECK_FALSE(PluginAuditManager::network_permission_matches(any, "")); + } +} + TEST_CASE("Plugin audit a scoped root can also be registered read-only", "[audit]") { ScopedDataDir data_dir_guard("plugin-audit-scoped-readonly"); @@ -349,3 +560,1103 @@ TEST_CASE("Plugin audit a scoped root can also be registered read-only", "[audit CHECK_FALSE(mgr.check_open((readonly_dir / "vendor.json").string(), "w").allowed); } } + +// --------------------------------------------------------------------------- +// The audit hook, run in the embedded interpreter +// --------------------------------------------------------------------------- +// +// Each TEST_CASE runs in its own process (catch_discover_tests), so each brings the plugin system +// up with the audit hook installed, once, and shuts it down at the end. The tests loop over their +// cases instead of using SECTIONs, which would restart the interpreter for every section. + +namespace { + +// Discovered, never loaded: the hook only needs the plugin's root and its sidecar. +const char* const AUDIT_PLUGIN_SOURCE = R"PY(# /// script +# requires-python = ">=3.12" +# +# [tool.orcaslicer.plugin] +# name = "Audit Plugin" +# description = "Plugin audit hook fixture" +# author = "OrcaSlicer" +# version = "1.0" +# type = "script" +# /// +)PY"; + +// A third-party library, installed outside the stdlib and outside the plugin. +const char* const LIBRARY_SOURCE = R"PY( +import socket +import urllib.request + +def read_all(paths): + for path in paths: + with open(path) as f: + f.read() + +def connect_from_host(port): + socket.gethostname() + socket.create_connection(("127.0.0.1", port)).close() + +def fetch(url): + with urllib.request.urlopen(url) as response: + return response.read() + +def fetch_each(urls): + for url in urls: + yield fetch(url) + +class ReadingHandler(urllib.request.BaseHandler): + """Reads a file while each response is processed.""" + def __init__(self, path): + self.path = path + self.outcome = None + + def http_response(self, request, response): + try: + open(self.path).close() + self.outcome = "ok" + except PermissionError: + self.outcome = "denied" + return response +)PY"; + +// Test-side Python, run outside any plugin context: files outside every allowed root, a local +// HTTP server, the library, and every module the tests use imported up front, so that no import +// happens inside a plugin context. Code from exec() runs as "", which is not stdlib, so +// attempt() and fetch() stand in for plugin code. +const char* const AUDIT_SETUP = R"PY( +import http.client, http.server, os, pathlib, shutil, socket, subprocess, sys, tempfile, threading +import urllib.request, zipfile +if os.name != "nt": + import pty + +APPROVED = os.path.join(OUTSIDE, "approved.txt") +PRIVATE = os.path.join(OUTSIDE, "private.txt") +MISSING = os.path.join(OUTSIDE, "missing") +TREE = os.path.join(OUTSIDE, "tree") +TRUE_COMMAND = ["cmd", "/c", "exit 0"] if os.name == "nt" else ["true"] +for path in (APPROVED, PRIVATE): + with open(path, "w") as f: + f.write("x") +for sub in ("one", "two"): + os.makedirs(os.path.join(TREE, sub)) + with open(os.path.join(TREE, sub, "f.txt"), "w") as f: + f.write("x") + +LIBRARY = os.path.join(OUTSIDE, "library") +os.makedirs(LIBRARY) +with open(os.path.join(LIBRARY, "netlib.py"), "w") as f: + f.write(LIBRARY_SOURCE) +sys.path.insert(0, LIBRARY) +import netlib + +class Handler(http.server.BaseHTTPRequestHandler): + def do_GET(self): + if self.path == "/redirect": + self.send_response(302) + self.send_header("Location", URL_B) + body = b"" + else: + self.send_response(200) + body = b"ok" + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def log_message(self, *args): + pass + +server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler) +server_thread = threading.Thread(target=server.serve_forever, daemon=True) +server_thread.start() +PORT = server.server_address[1] +BASE = "http://127.0.0.1:%d" % PORT +URL_A, URL_B, URL_REDIRECT = BASE + "/a", BASE + "/b", BASE + "/redirect" +urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler({}))) + +def fetch(url): + with urllib.request.urlopen(url) as response: + return response.read() + +fetch(URL_A) # urllib imports some modules on its first request + +def attempt(action): + try: + action() + return "ok" + except PermissionError: + return "denied" + +def spawn_checked(argv): + parent = os.getpid() + try: + return pty.spawn(argv) + finally: + if os.getpid() != parent: + os._exit(1) # a child whose exec was refused must not go on running the tests + +finalizer_outcomes = [] + +class TrackedRequest(urllib.request.Request): + def __del__(self): + finalizer_outcomes.append(attempt(lambda: open(PRIVATE).close())) +)PY"; + +struct Prompt +{ + std::string plugin; + std::string event; + std::vector targets; +}; + +// One line per prompt, "event: target ...", so a failed check shows every prompt. +std::string describe(const std::vector& prompts) +{ + std::string text; + for (const Prompt& prompt : prompts) { + text += prompt.event + ":"; + for (const std::string& target : prompt.targets) + text += " " + target; + text += "\n"; + } + return text; +} + +// The plugin system with the audit hook installed, and the permission dialog replaced by a +// recorder that answers with `approve`. Declare it first in a test, so it is destroyed last. +// +// Only the manager is torn down here; the interpreter is finalized once per test process by +// PythonInterpreterRunEnd in slic3rutils_tests_main.cpp. +struct AuditHarness +{ + // Before initialize(): the interpreter creates {data_dir}/python/packages and {data_dir}/log. + // data_dir() is a global allowed root from then on -- the first test to initialize Python in + // this process (under ctest, this one) -- so the test files live in `outside`. + ScopedDataDir data{"plugin-audit-hook"}; + bool initialized = PluginManager::instance().initialize(); + ScopedTemporaryDir outside{"orca-plugin-audit-outside"}; + std::vector prompts; + std::function approve = [](const Prompt&) { return false; }; + + AuditHarness() + { + PluginAuditManager& audit = PluginAuditManager::instance(); + audit.clear_current_plugin(); + audit.clear_current_capability(); + audit.clear_audit_denial(); + audit.clear_last_violation(); + PluginAuditManager::set_permission_prompt_for_testing( + [this](const std::string& event, const std::vector& targets) { + prompts.push_back({PluginAuditManager::instance().current_plugin(), event, targets}); + return approve(prompts.back()); + }); + } + + ~AuditHarness() + { + PluginAuditManager::set_permission_prompt_for_testing(nullptr); + PluginManager::instance().shutdown(); + } + + // Call before taking the GIL: discovery is not Python work. + void add_plugin(const std::string& key) + { + const fs::path root = data.plugins_dir() / key; + fs::create_directories(root); + std::ofstream((root / (key + ".py")).string(), std::ios::binary) << AUDIT_PLUGIN_SOURCE; + save_permissions(key, {}); + PluginManager::instance().discover_plugins(/*async=*/false, /*clear=*/true); + } + + // Grants as if saved in an earlier session. + void save_permissions(const std::string& key, const PluginPermissions& permissions) + { + PluginInstallState state; + state.installed_from = "local"; + state.installed_version = "1.0"; + state.plugin_name = key; + state.permissions = permissions; + REQUIRE(write_install_state(data.plugins_dir() / key, state)); + } + + PluginPermissions saved_permissions(const std::string& key) const + { + PluginInstallState state; + read_install_state(data.plugins_dir() / key, state); + return state.permissions; + } +}; + +// The test-side Python globals. Construct and destroy it with the GIL held; it stops the HTTP +// server before the test case ends, so nothing keeps serving once the test's temp dirs are gone. +struct PythonSide +{ + py::dict globals; + + explicit PythonSide(const AuditHarness& harness) + { + globals["OUTSIDE"] = harness.outside.path().string(); + globals["LIBRARY_SOURCE"] = LIBRARY_SOURCE; + exec(AUDIT_SETUP); + } + + // A Python error fails the test here, as text: an error_already_set left to propagate would + // outlive the test case and keep a traceback with references into the interpreter. + void exec(const char* code) + { + std::string error; + try { + py::exec(code, globals); + } catch (py::error_already_set& raised) { + error = raised.what(); + } + if (!error.empty()) + FAIL(error); + } + + ~PythonSide() + { + try { + // Stop the server thread while Python is still up: the interpreter now outlives the + // test case, so a daemon thread must not keep serving (and touching test temp dirs). + globals["server"].attr("shutdown")(); + globals["server"].attr("server_close")(); + globals["server_thread"].attr("join")(); + } catch (...) { + } + } + + std::string str(const char* name) const { return py::str(globals[name]).cast(); } + std::string eval(const char* expression) const { return py::str(py::eval(expression, globals)).cast(); } + std::vector strings(const char* name) const { return globals[name].cast>(); } + + // Runs `code` as `plugin_key`, as a trampoline call does: inside the caller's GIL, in an + // audit scope of its own. + void run_as(const std::string& plugin_key, const char* code) + { + ScopedPluginAuditContext audit(plugin_key); + exec(code); + } +}; + +PluginPermissions http_grants(std::vector urls) +{ + PluginPermissions permissions; + permissions.network_http = std::move(urls); + return permissions; +} + +const char* const PLUGIN = "AuditPlugin"; + +} // namespace + +TEST_CASE("A saved request grant covers the request's own connection in a later session", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + harness.save_permissions(PLUGIN, http_grants({python.str("URL_A")})); + + python.run_as(PLUGIN, "outcome = attempt(lambda: fetch(URL_A))"); + + CHECK(python.str("outcome") == "ok"); + CHECK(describe(harness.prompts).empty()); +} + +TEST_CASE("A saved request grant does not cover another URL or a redirect", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + harness.save_permissions(PLUGIN, http_grants({python.str("URL_A"), python.str("URL_REDIRECT")})); + + python.run_as(PLUGIN, R"PY( +outcomes = [attempt(lambda: fetch(url)) for url in (URL_A, URL_B, URL_REDIRECT)] +outcomes += [attempt(lambda: netlib.fetch(url)) for url in (URL_A, URL_B)] +outcomes.append(attempt(lambda: list(netlib.fetch_each([URL_A, URL_B])))) +)PY"); + + // The redirect target is asked for inside the approved redirecting request, and a library's + // wrapper or generator asks for the second URL as plain code does. + CHECK(python.strings("outcomes") == std::vector{"ok", "denied", "denied", "ok", "denied", "denied"}); + const std::string url_b = "urllib.Request: " + python.str("URL_B") + "\n"; + CHECK(describe(harness.prompts) == url_b + url_b + url_b + url_b); +} + +TEST_CASE("Code an approved operation calls back into is judged on its own", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + python.exec(R"PY( +CALLBACK_COPY = os.path.join(OUTSIDE, "callback-copy") +handler = netlib.ReadingHandler(PRIVATE) +handler_opener = urllib.request.build_opener(urllib.request.ProxyHandler({}), handler) +walk_outcomes = [] +copy_outcomes = [] + +def on_walk_error(error): + walk_outcomes.append(attempt(lambda: open(PRIVATE).close())) + +def copy_file(source, destination): + copy_outcomes.append(attempt(lambda: open(PRIVATE).close())) +)PY"); + PluginPermissions permissions = http_grants({python.str("URL_A")}); + permissions.fs_read = {python.str("APPROVED"), python.str("MISSING")}; + permissions.fs_readwrite = {python.str("TREE"), python.str("CALLBACK_COPY")}; + harness.save_permissions(PLUGIN, permissions); + + // A library handler that urllib calls while the approved request runs, the plugin's own + // os.walk error callback and copytree copy function (called once per file), and a library + // loop over a saved file and an unsaved one. + python.run_as(PLUGIN, R"PY( +request_outcome = attempt(lambda: handler_opener.open(URL_A).read()) +for _ in os.walk(MISSING, onerror=on_walk_error): + pass +shutil.copytree(TREE, CALLBACK_COPY, copy_function=copy_file) +loop_outcome = attempt(lambda: netlib.read_all([APPROVED, PRIVATE])) +)PY"); + + CHECK(python.str("request_outcome") == "ok"); + CHECK(python.eval("handler.outcome") == "denied"); + CHECK(python.strings("walk_outcomes") == std::vector{"denied"}); + CHECK(python.strings("copy_outcomes") == std::vector{"denied", "denied"}); + CHECK(python.str("loop_outcome") == "denied"); + const std::string private_file = "open: " + python.str("PRIVATE") + "\n"; + CHECK(describe(harness.prompts) == private_file + private_file + private_file + private_file + private_file); +} + +TEST_CASE("A saved directory walk covers each directory it lists", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + PluginPermissions permissions; + permissions.fs_read = {python.str("TREE"), python.str("APPROVED")}; + harness.save_permissions(PLUGIN, permissions); + + // The walk lists the tree's two subdirectories on later resumes, after the plugin's own + // audited reads in between. Abandoned walks leave frames whose generator is gone, which the + // next audited event lets go. + python.run_as(PLUGIN, R"PY( +walked = [] +for root, dirs, files in os.walk(TREE): + walked.append(root) + open(APPROVED).close() +globbed = list(pathlib.Path(TREE).glob("**/*")) + +abandoned = os.walk(TREE) +next(abandoned) +del abandoned +open(APPROVED).close() +for _ in pathlib.Path(TREE).glob("*"): + break +open(APPROVED).close() +)PY"); + + CHECK(py::len(python.globals["walked"]) == 3); + CHECK(py::len(python.globals["globbed"]) == 4); + CHECK(describe(harness.prompts).empty()); +} + +TEST_CASE("A freshly approved operation covers its nested events", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + + struct Case + { + const char* prompts; + const char* code; + }; + // Each operation names targets no earlier one saved, so each is asked once. FsCreate and + // FsDelete grants are never saved, so those operations are asked every time. Only the + // expected prompts are approved, so a nested event left uncovered fails the operation. + std::vector cases = { + {"shutil.copytree", "shutil.copytree(TREE, os.path.join(OUTSIDE, 'copy'))"}, + {"shutil.copyfile", "shutil.copyfile(APPROVED, os.path.join(OUTSIDE, 'copied.txt'))"}, + {"shutil.move", "shutil.move(os.path.join(OUTSIDE, 'copied.txt'), os.path.join(OUTSIDE, 'moved.txt'))"}, + {"shutil.copystat", "shutil.copystat(os.path.join(TREE, 'one', 'f.txt'), PRIVATE)"}, + {"shutil.make_archive", "shutil.make_archive(os.path.join(OUTSIDE, 'archive'), 'zip', root_dir=TREE)"}, + {"shutil.unpack_archive", "shutil.unpack_archive(os.path.join(OUTSIDE, 'archive.zip'), os.path.join(OUTSIDE, 'unpacked'))"}, + {"pathlib.Path.glob", "list(pathlib.Path(TREE).glob('**/*'))"}, + {"subprocess.Popen", "subprocess.run(TRUE_COMMAND, check=True)"}, + {"tempfile.mkdtemp", "tempfile.mkdtemp(dir=OUTSIDE)"}, + {"tempfile.mkstemp", "os.close(tempfile.mkstemp(dir=OUTSIDE)[0])"}, + {"shutil.rmtree", "shutil.rmtree(os.path.join(OUTSIDE, 'copy'))"}, + // The host grant from connect() also authorizes targetless send() events. + {"http.client.connect", + "connection = http.client.HTTPConnection('127.0.0.1', PORT)\n" + "connection.request('GET', '/a')\n" + "connection.getresponse().read()\n" + "connection.close()"}, + }; +#ifndef _WIN32 + cases.push_back({"os.fwalk", "list(os.fwalk(os.path.join(OUTSIDE, 'unpacked')))"}); + // The forked child's exec is covered by the spawn too: had it prompted, the child's own + // denial would end it with status 1. + cases.push_back({"pty.spawn", "spawn_status = spawn_checked(TRUE_COMMAND + ['spawned'])"}); +#endif + + for (const Case& operation : cases) { + INFO(operation.code); + const std::string expected = std::string(operation.prompts) + "\n"; + harness.approve = [&expected](const Prompt& prompt) { + return expected.find(prompt.event + "\n") != std::string::npos; + }; + harness.prompts.clear(); + python.run_as(PLUGIN, operation.code); + + std::string asked; + for (const Prompt& prompt : harness.prompts) + asked += (asked.empty() ? "" : "\n") + prompt.event; + CHECK(asked == operation.prompts); + } +#ifndef _WIN32 + CHECK(python.eval("spawn_status") == "0"); +#endif +} + +TEST_CASE("An event with no target is granted by name and remembered", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + harness.approve = [](const Prompt& prompt) { return prompt.event != "socket.sendto"; }; + py::gil_scoped_acquire gil; + PythonSide python(harness); + + python.run_as(PLUGIN, R"PY( +socket.socket().close() +udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +sendto_outcome = attempt(lambda: udp.sendto(b"x", ("127.0.0.1", 9))) +udp.close() +)PY"); + + // The socket is asked for once, without a target to show; the datagram's address is a target. + CHECK(python.str("sendto_outcome") == "denied"); + CHECK(describe(harness.prompts) == "socket.__new__:\nsocket.sendto: ('127.0.0.1', 9)\n"); + CHECK(harness.saved_permissions(PLUGIN).events == std::vector{"Socket:socket.__new__"}); + CHECK(harness.saved_permissions(PLUGIN).network_socket.empty()); + + harness.prompts.clear(); + python.run_as(PLUGIN, "socket.socket().close()"); + CHECK(describe(harness.prompts).empty()); + + // A grant for an event with no target covers nothing else: a library's approved + // gethostname() does not carry the connection it makes next. + harness.approve = [](const Prompt& prompt) { return prompt.event == "socket.gethostname"; }; + python.run_as(PLUGIN, "connect_outcome = attempt(lambda: netlib.connect_from_host(PORT))"); + CHECK(python.str("connect_outcome") == "denied"); + CHECK(describe(harness.prompts) == "socket.gethostname:\nsocket.getaddrinfo: 127.0.0.1\n"); + harness.prompts.clear(); + harness.approve = [](const Prompt&) { return true; }; + +#ifndef _WIN32 + // sendmsg() without an address names no target either. + python.run_as(PLUGIN, R"PY( +left, right = socket.socketpair() +left.sendmsg([b"x"]) +left.close() +right.close() +)PY"); + CHECK(describe(harness.prompts) == "socket.sendmsg:\n"); + CHECK(harness.saved_permissions(PLUGIN).events == + std::vector{"Socket:socket.__new__", "Socket:socket.gethostname", "Socket:socket.sendmsg"}); +#endif +} + +TEST_CASE("A saved network grant covers a network event that names no target", "[Audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + + // The connection is opened outside the plugin, so only the send itself is judged: it names + // no host, just the connection it writes to. + python.exec(R"PY( +connection = http.client.HTTPConnection("127.0.0.1", PORT) +connection.connect() +)PY"); + harness.save_permissions(PLUGIN, http_grants({"http://127.0.0.1"})); + + python.run_as(PLUGIN, R"PY( +send_outcome = attempt(lambda: connection.send(b"GET /")) +)PY"); + + // The host grant already covers the connection's send: no prompt, and no event grant. + CHECK(python.str("send_outcome") == "ok"); + CHECK(describe(harness.prompts).empty()); + CHECK(harness.saved_permissions(PLUGIN).events.empty()); + + // With no network grant there is nothing covering the send, so it is asked for by name. + harness.save_permissions(PLUGIN, http_grants({})); + python.run_as(PLUGIN, R"PY( +denied_outcome = attempt(lambda: connection.send(b"GET /")) +)PY"); + CHECK(python.str("denied_outcome") == "denied"); + CHECK(describe(harness.prompts) == "http.client.send:\n"); + CHECK(harness.saved_permissions(PLUGIN).events.empty()); + CHECK(harness.saved_permissions(PLUGIN).network_http.empty()); + + python.exec("connection.close()"); +} + +TEST_CASE("An event grant does not stand in for another access or a target of the same name", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + harness.approve = [asked = 0](const Prompt&) mutable { return asked++ == 0; }; + py::gil_scoped_acquire gil; + PythonSide python(harness); + python.exec(R"PY( +READ_FD = os.open(APPROVED, os.O_RDONLY) +WRITE_FD = os.open(os.path.join(OUTSIDE, "scratch.txt"), os.O_WRONLY | os.O_CREAT) +)PY"); + + // A file descriptor has no path to show or save: a granted read of one is not a write. + python.run_as(PLUGIN, R"PY( +fd_outcomes = [attempt(lambda: open(READ_FD, "r", closefd=False).close()), + attempt(lambda: open(WRITE_FD, "w", closefd=False).close())] +)PY"); + CHECK(python.strings("fd_outcomes") == std::vector{"ok", "denied"}); + CHECK(describe(harness.prompts) == "open:\nopen:\n"); + CHECK(harness.saved_permissions(PLUGIN).events == std::vector{"FsRead:open"}); + + // A saved os.fork event grant is not an os.system command named "os.fork". + PluginPermissions permissions; + permissions.events = {"FsRead:open", "ProcessCreate:os.fork"}; + harness.save_permissions(PLUGIN, permissions); + harness.prompts.clear(); + python.run_as(PLUGIN, R"PY( +reread_outcome = attempt(lambda: open(READ_FD, "r", closefd=False).close()) +system_outcome = attempt(lambda: os.system("os.fork")) +os.close(READ_FD) +os.close(WRITE_FD) +)PY"); + CHECK(python.str("reread_outcome") == "ok"); + CHECK(python.str("system_outcome") == "denied"); + REQUIRE(harness.prompts.size() == 1); + CHECK(harness.prompts.front().event == "os.system"); + CHECK(harness.saved_permissions(PLUGIN).process.empty()); +} + +TEST_CASE("A finalizer run when a root frame is let go is judged as the plugin without a prompt", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + PluginPermissions permissions = http_grants({python.str("URL_A")}); + permissions.fs_read = {python.str("APPROVED")}; + harness.save_permissions(PLUGIN, permissions); + PluginAuditManager& mgr = PluginAuditManager::instance(); + + // Once the request returns, only its held frame keeps the request object alive, and the + // request's finalizer reads a file the plugin was never granted. + python.run_as(PLUGIN, "fetch(TrackedRequest(URL_A))"); + CHECK(python.strings("finalizer_outcomes") == std::vector{"denied"}); // at scope end + CHECK(describe(harness.prompts).empty()); + CHECK_FALSE(mgr.audit_denial_pending()); + + python.exec("finalizer_outcomes.clear()"); + python.run_as(PLUGIN, R"PY( +fetch(TrackedRequest(URL_A)) +open(APPROVED).close() # the next event lets the returned request's frame go +outcomes_before_scope_end = list(finalizer_outcomes) +)PY"); + CHECK(python.strings("outcomes_before_scope_end") == std::vector{"denied"}); + CHECK(describe(harness.prompts).empty()); + + // The finalizer's denial during another event's decision leaves that event's own denial intact. + python.exec("finalizer_outcomes.clear()"); + python.run_as(PLUGIN, R"PY( +fetch(TrackedRequest(URL_A)) +try: + os.listdir(OUTSIDE) + outer_error = "" +except PermissionError as error: + outer_error = str(error) +)PY"); + CHECK(python.strings("finalizer_outcomes") == std::vector{"denied"}); + CHECK_THAT(python.str("outer_error"), Catch::Matchers::ContainsSubstring("os.listdir")); + CHECK(describe(harness.prompts) == "os.listdir: " + python.str("OUTSIDE") + "\n"); + AuditViolation violation; + REQUIRE(mgr.last_violation(violation)); + CHECK(violation.event_name == "os.listdir"); + CHECK(mgr.audit_denial_pending()); +} + +TEST_CASE("A nested audit scope does not see the outer scope's running operations", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin("PluginA"); + harness.add_plugin("PluginB"); + py::gil_scoped_acquire gil; + PythonSide python(harness); + PluginPermissions permissions; + permissions.fs_read = {python.str("TREE")}; + harness.save_permissions("PluginA", permissions); + + { + // Two walks plugin A started and suspended after listing the tree itself. + ScopedPluginAuditContext plugin_a("PluginA"); + python.exec("first = os.walk(TREE)\nnext(first)\nsecond = os.walk(TREE)\nnext(second)"); + { + // Plugin B resuming one of them is asked for each subdirectory, as plugin B. + ScopedPluginAuditContext plugin_b("PluginB"); + python.exec("listed_by_b = len(list(first))"); + } + // Back in plugin A's scope, its walks are covered again. + python.exec("listed_by_a = len(list(second))"); + } + + CHECK(python.globals["listed_by_b"].cast() == 0); + CHECK(python.globals["listed_by_a"].cast() == 2); + REQUIRE(harness.prompts.size() == 2); + for (const Prompt& prompt : harness.prompts) { + CHECK(prompt.plugin == "PluginB"); + CHECK(prompt.event == "os.scandir"); + } +} + +TEST_CASE("Root frames held when a capability call ends are let go with the GIL, as the plugin", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.approve = [](const Prompt& prompt) { return prompt.event == "os.walk"; }; + py::gil_scoped_acquire gil; + PythonSide python(harness); + (void) PythonPluginBridge::instance(); // force the embedded module registration into the binary + python.globals["orca"] = py::module_::import("orca"); + + // walk_and_drop() leaves a returned walk's frame held by the audit scope alone, with a marker + // in its locals; the frame is let go when the capability call ends, which runs the marker's + // finalizer. + python.exec(R"PY( +class Marker: + def __init__(self, action=None): + self.action = action + def __del__(self): + finalized.append(self.action() if self.action else "ran") + +finalized = [] + +def walk_and_drop(marker): + walker = os.walk(TREE, onerror=marker) + next(walker) + del walker + +class ConfigCapability(orca.PythonPluginBase): + def get_name(self): + return "config_cap" + def get_default_config(self): + walk_and_drop(Marker()) + return {"finalized_during_call": len(finalized)} + def has_config_ui(self): + walker = os.walk(TREE, onerror=Marker(lambda: attempt(lambda: open(PRIVATE).close()))) + next(walker) + attempt(lambda: os.listdir(OUTSIDE)) # denied: the trampoline clears the plugin key + del walker # the walk's frame is now held by the audit scope alone + raise RuntimeError("the capability fails after a denial") + +class TicketAgent(orca.printer_agent.PrinterAgentBase): + def get_name(self): + return "ticket_agent" + def request_bind_ticket(self): + walk_and_drop(Marker()) + return (0, "ticket") +)PY"); + + py::object config_instance = python.globals["ConfigCapability"](); + auto config_cap = config_instance.cast>(); + config_cap->set_audit_plugin_key("GilPlugin"); + config_cap->set_resolved_identity("config_cap", PluginCapabilityType::Script); + + py::object agent_instance = python.globals["TicketAgent"](); + auto agent_cap = agent_instance.cast>(); + agent_cap->set_audit_plugin_key("GilPlugin"); + agent_cap->set_resolved_identity("ticket_agent", PluginCapabilityType::PrinterConnection); + auto agent = std::dynamic_pointer_cast(agent_cap); + REQUIRE(agent); + + // A host call arrives without the GIL; both calls take it before their audit scope. + nlohmann::json config; + int ticket_result = -1; + std::string ticket; + { + py::gil_scoped_release released; + config = config_cap->get_default_config(); + ticket_result = agent->request_bind_ticket(&ticket); + } + CHECK(config == nlohmann::json{{"finalized_during_call", 0}}); + CHECK(ticket_result == 0); + CHECK(ticket == "ticket"); + CHECK(python.strings("finalized") == std::vector{"ran", "ran"}); + + // On the trampoline's denial path the frame is let go as the plugin, though the ambient key + // was cleared: the finalizer's read is audited and denied without a prompt. + python.exec("finalized.clear()"); + harness.prompts.clear(); + CHECK_THROWS_AS(config_cap->has_config_ui(), py::error_already_set); + CHECK(python.strings("finalized") == std::vector{"denied"}); + CHECK(describe(harness.prompts) == "os.walk: " + python.str("TREE") + "\nos.listdir: " + python.str("OUTSIDE") + "\n"); +} + +TEST_CASE("Stdlib code is recognized through a symlinked Python home", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + py::gil_scoped_acquire gil; + + const py::dict paths = py::module_::import("sysconfig").attr("get_paths")(); + const fs::path stdlib = py::str(paths["stdlib"]).cast(); + const fs::path purelib = py::str(paths["purelib"]).cast(); + const fs::path link = harness.outside.path() / "linked-stdlib"; + boost::system::error_code ec; + fs::create_directory_symlink(stdlib, link, ec); + if (ec) + SKIP("Cannot create a directory symlink here: " + ec.message()); + + CHECK(PluginAuditManager::is_stdlib_file((stdlib / "os.py").string())); + CHECK(PluginAuditManager::is_stdlib_file((link / "urllib" / "request.py").string())); + CHECK(PluginAuditManager::is_stdlib_file("")); + CHECK_FALSE(PluginAuditManager::is_stdlib_file((purelib / "requests" / "api.py").string())); + CHECK_FALSE(PluginAuditManager::is_stdlib_file((link / "site-packages" / "requests" / "api.py").string())); + CHECK_FALSE(PluginAuditManager::is_stdlib_file((harness.outside.path() / "plugin.py").string())); + CHECK_FALSE(PluginAuditManager::is_stdlib_file("")); +} + +TEST_CASE("A plugin may read the CPython stdlib without a prompt, but not site-packages or for writing", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + + const py::dict paths = py::module_::import("sysconfig").attr("get_paths")(); + const fs::path stdlib = py::str(paths["stdlib"]).cast(); + const fs::path purelib = py::str(paths["purelib"]).cast(); + // os.py ships with every CPython installation. A site-packages path is third-party code even + // when the directory is empty: the prompt must come before the missing file is noticed. + const fs::path stdlib_file = stdlib / "os.py"; + REQUIRE(fs::exists(stdlib_file)); + + python.globals["STDLIB_FILE"] = stdlib_file.string(); + python.globals["SITE_PACKAGE_FILE"] = (purelib / "regression_probe.py").string(); + python.run_as(PLUGIN, R"PY( +read_outcome = attempt(lambda: open(STDLIB_FILE).read()) +write_outcome = attempt(lambda: open(STDLIB_FILE, "r+").close()) +site_packages_outcome = attempt(lambda: open(SITE_PACKAGE_FILE).close()) +)PY"); + + CHECK(python.str("read_outcome") == "ok"); + CHECK(python.str("write_outcome") == "denied"); + CHECK(python.str("site_packages_outcome") == "denied"); + // Only the write and the site-packages read are asked about; the stdlib read is implicit. + const std::string write_prompt = "open: " + python.str("STDLIB_FILE") + "\n"; + const std::string site_packages_prompt = "open: " + python.str("SITE_PACKAGE_FILE") + "\n"; + CHECK(describe(harness.prompts) == write_prompt + site_packages_prompt); +} + +TEST_CASE("A filesystem wildcard grant covers the folder and its descendants at any depth", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + + python.exec(R"PY( +DEEP_FILE = os.path.join(TREE, "one", "deep", "deeper", "f.txt") +os.makedirs(os.path.dirname(DEEP_FILE)) +with open(DEEP_FILE, "w") as f: + f.write("x") +NESTED_FILE = os.path.join(TREE, "one", "f.txt") +SIBLING = TREE + "-sibling" +SIBLING_FILE = os.path.join(SIBLING, "f.txt") +os.makedirs(SIBLING) +with open(SIBLING_FILE, "w") as f: + f.write("x") +# Lexically under TREE, but ".." resolves outside the granted folder. +ESCAPE_FILE = os.path.join(TREE, "..", "private.txt") +)PY"); + + const std::string tree = python.str("TREE"); + PluginPermissions permissions; + permissions.fs_read = {tree + "/*"}; + harness.save_permissions(PLUGIN, permissions); + + python.run_as(PLUGIN, R"PY( +deep_outcome = attempt(lambda: open(DEEP_FILE).read()) +root_outcome = attempt(lambda: os.listdir(TREE)) +sibling_outcome = attempt(lambda: open(SIBLING_FILE).read()) +escape_outcome = attempt(lambda: open(ESCAPE_FILE).read()) +)PY"); + + // The tree grant covers the folder itself (listing it) and a file two directories below it. + CHECK(python.str("deep_outcome") == "ok"); + CHECK(python.str("root_outcome") == "ok"); + // A path sharing the folder's prefix is not a descendant, and ".." is resolved before the + // comparison, so neither escapes the grant; both are asked about. + CHECK(python.str("sibling_outcome") == "denied"); + CHECK(python.str("escape_outcome") == "denied"); + const std::string sibling_prompt = "open: " + python.str("SIBLING_FILE") + "\n"; + const std::string escape_prompt = "open: " + python.str("ESCAPE_FILE") + "\n"; + CHECK(describe(harness.prompts) == sibling_prompt + escape_prompt); + + // Only the final component may be a wildcard: a "*" inside it is an ordinary character. + permissions.fs_read = {tree + "/*.txt"}; + harness.save_permissions(PLUGIN, permissions); + harness.prompts.clear(); + python.run_as(PLUGIN, "literal_outcome = attempt(lambda: open(NESTED_FILE).read())"); + CHECK(python.str("literal_outcome") == "denied"); + const std::string literal_prompt = "open: " + python.str("NESTED_FILE") + "\n"; + CHECK(describe(harness.prompts) == literal_prompt); +} + +TEST_CASE("A tree grant compares canonical paths on both sides", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + + // A folder outside TREE, reached through a symlink planted inside it. + const fs::path tree = python.str("TREE"); + const fs::path outside_dir = harness.outside.path() / "symlink-target"; + const fs::path link = tree / "escape"; + fs::create_directories(outside_dir); + std::ofstream((outside_dir / "outside.txt").string(), std::ios::binary) << "x"; + + boost::system::error_code ec; + fs::create_directory_symlink(outside_dir, link, ec); + if (ec) + SKIP("Cannot create a directory symlink here: " + ec.message()); + + PluginPermissions permissions; + permissions.fs_read = {tree.string() + "/*"}; + harness.save_permissions(PLUGIN, permissions); + + const std::string escaped_file = (link / "outside.txt").string(); + python.globals["ESCAPED_FILE"] = escaped_file; + python.run_as(PLUGIN, "escaped_outcome = attempt(lambda: open(ESCAPED_FILE).read())"); + + // The target canonicalizes outside the canonical grant root, so the link does not inherit + // the tree grant. The read/write wildcard test covers a non-existing write tail. + CHECK(python.str("escaped_outcome") == "denied"); + CHECK(describe(harness.prompts) == "open: " + escaped_file + "\n"); + + // A grant rooted at the link applies to what the link points at, not just to its path. + permissions.fs_read = {link.string() + "/*"}; + harness.save_permissions(PLUGIN, permissions); + harness.prompts.clear(); + python.globals["TARGET_FILE"] = (outside_dir / "outside.txt").string(); + python.run_as(PLUGIN, "via_target_outcome = attempt(lambda: open(TARGET_FILE).read())"); + + CHECK(python.str("via_target_outcome") == "ok"); + CHECK(describe(harness.prompts).empty()); +} + +TEST_CASE("A write through a dangling symlink inside a granted tree is denied", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + + // Two links inside TREE whose targets do not exist yet, so both dangle: + // - "dangling" points outside the tree, the reported escape; + // - "dangling-inside" points at a not-yet-created file that would be inside the tree, to pin + // the fail-closed choice: a dangling link is rejected whatever its target. + const fs::path tree = python.str("TREE"); + const fs::path outside_file = harness.outside.path() / "written-through-link.txt"; + const fs::path link = tree / "dangling"; + const fs::path inside_target = tree / "not-created.txt"; + const fs::path inside_link = tree / "dangling-inside"; + boost::system::error_code ec; + fs::create_symlink(outside_file, link, ec); + if (ec) + SKIP("Cannot create a file symlink here: " + ec.message()); + fs::create_symlink(inside_target, inside_link, ec); + if (ec) + SKIP("Cannot create a file symlink here: " + ec.message()); + + PluginPermissions permissions; + permissions.fs_readwrite = {tree.string() + "/*"}; + harness.save_permissions(PLUGIN, permissions); + + python.globals["DANGLING_LINK"] = link.string(); + python.globals["DANGLING_INSIDE_LINK"] = inside_link.string(); + python.run_as(PLUGIN, R"PY( +inside_outcome = attempt(lambda: open(os.path.join(TREE, "inside.txt"), "w").close()) +outcome = attempt(lambda: open(DANGLING_LINK, "w").close()) +inside_link_outcome = attempt(lambda: open(DANGLING_INSIDE_LINK, "w").close()) +)PY"); + + // The wildcard still covers an ordinary new file in the tree. A dangling final symlink is not + // covered: the grant describes the path the plugin spelled, while a write through the link + // would land at its target, so the prompt is refused and neither destination is created. + CHECK(python.str("inside_outcome") == "ok"); + CHECK(python.str("outcome") == "denied"); + CHECK(python.str("inside_link_outcome") == "denied"); + CHECK(describe(harness.prompts) == "open: " + link.string() + "\nopen: " + inside_link.string() + "\n"); + CHECK_FALSE(fs::exists(outside_file)); + CHECK_FALSE(fs::exists(inside_target)); +} + +TEST_CASE("A relative wildcard permission request is shown and stored as an absolute grant", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + PluginAuditManager& mgr = PluginAuditManager::instance(); + + // The plugin declares the grant relative to the working directory of the request, while the + // audit hook reports absolute targets. Resolve against the directory the request is made in. + const std::string relative_grant = "tree/*"; + PluginPermissions requested; + requested.fs_readwrite = {relative_grant}; + + const fs::path original_cwd = fs::current_path(); + boost::system::error_code ec; + fs::current_path(harness.outside.path(), ec); + REQUIRE_FALSE(ec); + const fs::path request_dir = fs::current_path(); + + std::string shown; + PluginAuditManager::set_permission_message_prompt_for_testing( + [&shown](const std::string& message) { shown = message; return true; }); + const bool granted = mgr.request_permissions(PLUGIN, requested); + PluginAuditManager::set_permission_message_prompt_for_testing(nullptr); + fs::current_path(original_cwd, ec); + + const std::string absolute_grant = (request_dir / "tree" / "*").string(); + + REQUIRE(granted); + // The prompt names the resolved scope, not the relative declaration. + CHECK(shown.find(absolute_grant) != std::string::npos); + CHECK(shown.find("\n" + relative_grant + "\n") == std::string::npos); + CHECK(harness.saved_permissions(PLUGIN).fs_readwrite == std::vector{absolute_grant}); + + // The saved absolute grant is the effective one: an absolute target below the resolved + // directory is covered, so the write is not asked about again. + python.globals["RESOLVED_FILE"] = (harness.outside.path() / "tree" / "written.txt").string(); + python.run_as(PLUGIN, "outcome = attempt(lambda: open(RESOLVED_FILE, 'w').close())"); + CHECK(python.str("outcome") == "ok"); + CHECK(describe(harness.prompts).empty()); +} + +TEST_CASE("A filesystem wildcard keeps read and write grants separate", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + + python.exec(R"PY( +NESTED_FILE = os.path.join(TREE, "one", "f.txt") +NEW_FILE = os.path.join(TREE, "one", "new.txt") +)PY"); + const std::string tree = python.str("TREE"); + PluginPermissions permissions; + permissions.fs_read = {tree + "/*"}; + harness.save_permissions(PLUGIN, permissions); + + python.run_as(PLUGIN, R"PY( +read_outcome = attempt(lambda: open(NESTED_FILE).read()) +write_outcome = attempt(lambda: open(NEW_FILE, "w").close()) +)PY"); + CHECK(python.str("read_outcome") == "ok"); + CHECK(python.str("write_outcome") == "denied"); + // A read grant does not cover the write-shaped open, so that one is asked about. + const std::string write_prompt = "open: " + python.str("NEW_FILE") + "\n"; + CHECK(describe(harness.prompts) == write_prompt); + + // The reverse direction is separate too: a read/write wildcard leaves plain reads in the + // read bucket, which is now empty. + permissions.fs_read.clear(); + permissions.fs_readwrite = {tree + "/*"}; + harness.save_permissions(PLUGIN, permissions); + harness.prompts.clear(); + python.run_as(PLUGIN, R"PY( +write_outcome = attempt(lambda: open(NEW_FILE, "w").close()) +reread_outcome = attempt(lambda: open(NESTED_FILE).read()) +)PY"); + CHECK(python.str("write_outcome") == "ok"); + CHECK(python.str("reread_outcome") == "denied"); + const std::string reread_prompt = "open: " + python.str("NESTED_FILE") + "\n"; + CHECK(describe(harness.prompts) == reread_prompt); +} + +TEST_CASE("A filesystem wildcard does not override a denied path", "[audit][Python]") +{ + AuditHarness harness; + if (!harness.initialized) + SKIP("Bundled Python interpreter unavailable: " + PythonInterpreter::instance().last_error()); + harness.add_plugin(PLUGIN); + py::gil_scoped_acquire gil; + PythonSide python(harness); + PluginAuditManager& mgr = PluginAuditManager::instance(); + + python.exec(R"PY( +DENIED_DIR = os.path.join(OUTSIDE, "secrets") +os.makedirs(DENIED_DIR) +with open(os.path.join(DENIED_DIR, "token.txt"), "w") as f: + f.write("x") +)PY"); + + // A grant wide enough to cover the deny registry's target still loses to the deny. + PluginPermissions permissions; + permissions.fs_read = {python.str("OUTSIDE") + "/*"}; + harness.save_permissions(PLUGIN, permissions); + + python.run_as(PLUGIN, "denied_outcome = attempt(lambda: open(os.path.join(DENIED_DIR, 'token.txt')).read())"); + + CHECK(python.str("denied_outcome") == "denied"); + CHECK(describe(harness.prompts).empty()); + AuditViolation violation; + REQUIRE(mgr.last_violation(violation)); + CHECK(violation.reason == "denied path"); +} diff --git a/tests/slic3rutils/test_plugin_capability_config.cpp b/tests/slic3rutils/test_plugin_capability_config.cpp index bbd0368d26..bd8a91e356 100644 --- a/tests/slic3rutils/test_plugin_capability_config.cpp +++ b/tests/slic3rutils/test_plugin_capability_config.cpp @@ -27,10 +27,10 @@ using json = nlohmann::json; namespace { -// Brings the plugin system up for the duration of one test and tears it down at the end — same -// idiom as ScopedPluginManager in test_plugin_lifecycle.cpp, and for the same reason: shutdown() -// logs via boost::log, so it must run before boost::log tears down its thread-local storage, not be -// left to a static destructor at process exit. +// Brings the plugin system up for the duration of one test and tears the manager down at the end — +// same idiom as ScopedPluginManager in test_plugin_lifecycle.cpp. The interpreter itself is +// process-wide and finalized once by PythonInterpreterRunEnd in slic3rutils_tests_main.cpp: +// CPython cannot be reinitialized after Py_Finalize. // // Needed here (unlike a bare pybind11::scoped_interpreter): has_config_ui()/get_config_ui()/ // get_name()/etc. all cross PyPluginCommonTrampoline's ORCA_PY_OVERRIDE_AUDITED, which refuses to @@ -40,7 +40,7 @@ namespace { // // initialize() leaves the GIL released (production code re-acquires it per call via PythonGILState); // every TEST_CASE below pairs this with a py::gil_scoped_acquire, declared second so it releases -// before this destructor's shutdown() runs. +// before this destructor runs. struct ScopedPluginManager { // Before initialize(): the interpreter creates {data_dir}/python/packages and {data_dir}/log, @@ -48,11 +48,7 @@ struct ScopedPluginManager ScopedDataDir python_data_dir{"plugin-python"}; bool initialized = PluginManager::instance().initialize(); - ~ScopedPluginManager() - { - PluginManager::instance().shutdown(); - PythonInterpreter::instance().shutdown(); - } + ~ScopedPluginManager() { PluginManager::instance().shutdown(); } }; py::module_ import_orca_module() diff --git a/tests/slic3rutils/test_plugin_cloud_metadata.cpp b/tests/slic3rutils/test_plugin_cloud_metadata.cpp index 95ae6fcd43..3e3735a6ca 100644 --- a/tests/slic3rutils/test_plugin_cloud_metadata.cpp +++ b/tests/slic3rutils/test_plugin_cloud_metadata.cpp @@ -27,12 +27,11 @@ using json = nlohmann::json; namespace { -// Brings the plugin manager up and shuts both singletons down while boost::log is still alive; -// left to their static destructors, shutdown()'s logging runs after boost::log tears down its -// thread-local storage and crashes the process on exit (same reason ScopedPluginManager exists in -// test_plugin_lifecycle.cpp). initialize() IS needed here: the plugin under test is a -// slicing-pipeline script, so discover_plugins() brings up the Python interpreter to parse it, -// same as any other plugin. +// Brings the plugin manager up for the duration of one test and tears the manager down at the end. +// The interpreter itself is process-wide: PythonInterpreterRunEnd in slic3rutils_tests_main.cpp +// finalizes it once, after the last test case, because CPython cannot be reinitialized after +// Py_Finalize. initialize() IS needed here: the plugin under test is a slicing-pipeline script, so +// discover_plugins() brings up the Python interpreter to parse it, same as any other plugin. struct ScopedManagerShutdown { // Before initialize(): the interpreter creates {data_dir}/python/packages and {data_dir}/log, @@ -40,11 +39,7 @@ struct ScopedManagerShutdown ScopedDataDir python_data_dir{"plugin-python"}; bool initialized = PluginManager::instance().initialize(); - ~ScopedManagerShutdown() - { - PluginManager::instance().shutdown(); - PythonInterpreter::instance().shutdown(); - } + ~ScopedManagerShutdown() { PluginManager::instance().shutdown(); } }; const char* const CLOUD_PLUGIN_SOURCE = R"PY(# /// script diff --git a/tests/slic3rutils/test_plugin_host_api.cpp b/tests/slic3rutils/test_plugin_host_api.cpp index 301acbc7cc..bcb95ecceb 100644 --- a/tests/slic3rutils/test_plugin_host_api.cpp +++ b/tests/slic3rutils/test_plugin_host_api.cpp @@ -1,3 +1,20 @@ +// why: keep the Windows headers ahead of libslic3r. Model.hpp pulls in Format/STEP.hpp, and +// OCCT's Standard_Macro.hxx defines NOUSER and NOGDI on Windows so that windows.h does not +// collide with OCCT's identifiers. Defined that early they also hide the USER and GDI +// declarations, and the wx MSW headers Field.hpp reaches (wx/wxprec.h -> wx/msw/private.h) +// need WNDPROC, RGB and the ::GetWindowRect family. Including windows.h first, as +// libslic3r_gui does through pchheader.hpp or win_platform.hpp, keeps them. +#ifdef WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #ifndef NOMINMAX + #define NOMINMAX + #endif + #include + #include +#endif + #include #include @@ -6,8 +23,12 @@ #include #include #include +#include #include +#include +#include + #include #include #include @@ -137,6 +158,143 @@ TEST_CASE("Plugin host API exposes host-owned bundle and preset surface to Pytho CHECK(printers.attr("find_preset")(printer_preset.name).attr("name").cast() == printer_preset.name); } +TEST_CASE("Plugin host API exposes the editable preset category handles and guards them before Orca app initialization", + "[PluginHost][Python]") +{ + py::object host = import_orca_module().attr("host"); + py::object preset = host.attr("preset"); + + REQUIRE(has_attr(preset, "PresetEditor")); + REQUIRE(has_attr(preset, "process")); + REQUIRE(has_attr(preset, "printer")); + REQUIRE(has_attr(preset, "filament")); + + py::object process = preset.attr("process"); + py::object printer = preset.attr("printer"); + py::object filament = preset.attr("filament"); + + CHECK(process.attr("type").cast() == Slic3r::Preset::TYPE_PRINT); + CHECK(printer.attr("type").cast() == Slic3r::Preset::TYPE_PRINTER); + CHECK(filament.attr("type").cast() == Slic3r::Preset::TYPE_FILAMENT); + for (const py::object& editor : { process, printer, filament }) + CHECK(has_attr(editor, "update")); + + // With no wx application the call must fail cleanly, like the rest of host.preset, and must not + // be mistaken for a missing attribute or an argument error. + for (const py::object& editor : { process, printer, filament }) { + try { + editor.attr("update")("layer_height", "0.25"); + FAIL("preset editor update unexpectedly succeeded without a wx application"); + } catch (const py::error_already_set& error) { + CHECK(error.matches(PyExc_RuntimeError)); + CHECK(std::string(error.what()).find("OrcaSlicer application is not initialized") != std::string::npos); + } + } +} + +TEST_CASE("Plugin host API exposes the filament slot form of preset update and guards it", "[PluginHost][Python]") +{ + py::object host = import_orca_module().attr("host"); + py::object preset = host.attr("preset"); + + // The filament editor accepts update(slot_number, key, value) as well as update(key, value); with + // no wx application it reaches the same clean failure as the rest of host.preset. The slot + // validation and the switch/cancel path need a running app, so they are not exercised here. + try { + preset.attr("filament").attr("update")(1, "layer_height", "0.25"); + FAIL("slot-addressed filament update unexpectedly succeeded without a wx application"); + } catch (const py::error_already_set& error) { + CHECK(error.matches(PyExc_RuntimeError)); + CHECK(std::string(error.what()).find("OrcaSlicer application is not initialized") != std::string::npos); + } + + // The process and printer editors accept only update(key, value); the slot form is rejected + // before any application access, naming the editor that does accept it. + for (const char* name : { "process", "printer" }) { + CAPTURE(name); + try { + preset.attr(name).attr("update")(1, "layer_height", "0.25"); + FAIL("slot-addressed update on a non-filament editor unexpectedly succeeded"); + } catch (const py::error_already_set& error) { + CHECK(error.matches(PyExc_ValueError)); + CHECK(std::string(error.what()).find("only available on") != std::string::npos); + } + } +} + +TEST_CASE("Plugin host API exposes staged preset update transactions", "[PluginHost][Python]") +{ + py::object preset = import_orca_module().attr("host").attr("preset"); + py::object transaction_type = preset.attr("PresetTransaction"); + py::object result_type = preset.attr("PresetUpdateResult"); + + CHECK(has_attr(transaction_type, "set")); + CHECK(has_attr(transaction_type, "commit")); + CHECK(has_attr(result_type, "target_name")); + CHECK(has_attr(result_type, "selection_changed")); + CHECK(has_attr(result_type, "slot_assignment_changed")); + CHECK(has_attr(result_type, "shared_slots")); + + for (const char* name : { "process", "printer" }) { + CAPTURE(name); + py::object editor = preset.attr(name); + CHECK(has_attr(editor, "begin_update")); + try { + editor.attr("begin_update")(); + FAIL("begin_update unexpectedly succeeded without a wx application"); + } catch (const py::error_already_set& error) { + CHECK(error.matches(PyExc_RuntimeError)); + CHECK(std::string(error.what()).find("OrcaSlicer application is not initialized") != std::string::npos); + } + } + + py::object filament = preset.attr("filament"); + CHECK(has_attr(filament, "begin_update")); + try { + filament.attr("begin_update")(1); + FAIL("filament begin_update unexpectedly succeeded without a wx application"); + } catch (const py::error_already_set& error) { + CHECK(error.matches(PyExc_RuntimeError)); + CHECK(std::string(error.what()).find("OrcaSlicer application is not initialized") != std::string::npos); + } +} + +TEST_CASE("A settings group resolves an option's id from its option map", "[PluginHost]") +{ + using Slic3r::GUI::option_id_in_map; + using Slic3r::GUI::t_opt_map; + + // The map ConfigOptionsGroup::get_option leaves: a scalar option, and a per-extruder option + // whose entries carry their index. + t_opt_map options; + options.emplace("layer_height", std::make_pair(std::string("layer_height"), -1)); + options.emplace("nozzle_diameter#0", std::make_pair(std::string("nozzle_diameter"), 0)); + options.emplace("nozzle_diameter#1", std::make_pair(std::string("nozzle_diameter"), 1)); + + // A negative index resolves a scalar option and yields its own (negative) index. + int index = -1; + CHECK(option_id_in_map(options, "layer_height", index) == "layer_height"); + CHECK(index == -1); + + // A negative index on a vector option matches several entries, so it resolves to nothing. + index = -1; + CHECK(option_id_in_map(options, "nozzle_diameter", index).empty()); + + // An explicit index selects that entry. + index = 1; + CHECK(option_id_in_map(options, "nozzle_diameter", index) == "nozzle_diameter#1"); + CHECK(index == 1); + + // An index no entry carries, and a key the map does not own, resolve to nothing. + index = 7; + CHECK(option_id_in_map(options, "nozzle_diameter", index).empty()); + index = -1; + CHECK(option_id_in_map(options, "wall_loops", index).empty()); + + const t_opt_map empty; + CHECK(option_id_in_map(empty, "layer_height", index).empty()); +} + TEST_CASE("Plugin host API reports unavailable GUI objects before Orca app initialization", "[PluginHost][Python]") { py::object host = import_orca_module().attr("host"); diff --git a/tests/slic3rutils/test_plugin_json_depth.cpp b/tests/slic3rutils/test_plugin_json_depth.cpp index ad3c834b93..85f84d40e8 100644 --- a/tests/slic3rutils/test_plugin_json_depth.cpp +++ b/tests/slic3rutils/test_plugin_json_depth.cpp @@ -3,7 +3,6 @@ #include #include -#include #include "plugin_test_utils.hpp" @@ -19,17 +18,14 @@ using namespace Slic3r; namespace { -// Brings the embedded interpreter up for one test and tears it down before boost::log does, -// mirroring the ScopedPluginManager idiom in the other plugin tests. +// Brings the embedded interpreter up for one test and tears the manager down afterwards; the +// interpreter itself is process-wide and finalized once by PythonInterpreterRunEnd in +// slic3rutils_tests_main.cpp (CPython cannot be reinitialized after Py_Finalize). struct ScopedPluginManager { ScopedDataDir python_data_dir{"plugin-json-depth"}; bool initialized = PluginManager::instance().initialize(); - ~ScopedPluginManager() - { - PluginManager::instance().shutdown(); - PythonInterpreter::instance().shutdown(); - } + ~ScopedPluginManager() { PluginManager::instance().shutdown(); } }; } // namespace diff --git a/tests/slic3rutils/test_plugin_lifecycle.cpp b/tests/slic3rutils/test_plugin_lifecycle.cpp index 0a1a94dcef..fc32511336 100644 --- a/tests/slic3rutils/test_plugin_lifecycle.cpp +++ b/tests/slic3rutils/test_plugin_lifecycle.cpp @@ -41,16 +41,19 @@ namespace fs = boost::filesystem; // -> unload. // // Each Catch2 test case runs in its own process (catch_discover_tests), so the PluginManager and -// interpreter singletons are brought up at most once per test. +// interpreter singletons are brought up at most once per test. Running the binary directly runs +// every case in one process: the interpreter is then initialized once and finalized after the +// last case (see PythonInterpreterRunEnd in slic3rutils_tests_main.cpp). namespace { -// Brings the plugin system up, and tears it down explicitly at the end of the test. +// Brings the plugin system up, and tears the manager down at the end of the test. // -// Shutting the interpreter down here, rather than leaving it to PythonInterpreter's static -// destructor, mirrors what the app does (GUI_App finalizes it before exit). Left to static -// destruction, shutdown()'s logging runs after boost::log has torn down its thread-local storage -// and throws, aborting the process after the tests have already passed. +// The interpreter itself is not finalized here: it is process-wide. CPython cannot be +// reinitialized after Py_Finalize (a second init aborts inside _datetime), and the app likewise +// finalizes it only at exit (GUI_App). slic3rutils_tests_main.cpp finalizes it once, after the +// last test case and before static destruction, where shutdown()'s logging is still ahead of +// boost::log's teardown. // // Declare this FIRST in a test so it is destroyed last. struct ScopedPluginManager @@ -61,11 +64,7 @@ struct ScopedPluginManager bool initialized = false; ScopedPluginManager() { initialized = PluginManager::instance().initialize(); } - ~ScopedPluginManager() - { - PluginManager::instance().shutdown(); - PythonInterpreter::instance().shutdown(); - } + ~ScopedPluginManager() { PluginManager::instance().shutdown(); } }; // A minimal script plugin exposing exactly one capability, "Echo". diff --git a/tests/slic3rutils/test_plugin_printer_agent.cpp b/tests/slic3rutils/test_plugin_printer_agent.cpp index fc504c806a..7b5c2ca9f9 100644 --- a/tests/slic3rutils/test_plugin_printer_agent.cpp +++ b/tests/slic3rutils/test_plugin_printer_agent.cpp @@ -26,7 +26,9 @@ using namespace Slic3r; namespace { // Same idiom as ScopedPluginManager in test_plugin_lifecycle.cpp: the trampolines refuse to call -// into Python unless PythonInterpreter::instance() reports initialized. +// into Python unless PythonInterpreter::instance() reports initialized. Only the manager is torn +// down here; the interpreter is finalized once per test process by PythonInterpreterRunEnd in +// slic3rutils_tests_main.cpp. struct ScopedPluginManager { // Before initialize(): the interpreter creates {data_dir}/python/packages and {data_dir}/log, @@ -34,11 +36,7 @@ struct ScopedPluginManager ScopedDataDir python_data_dir{"plugin-python"}; bool initialized = PluginManager::instance().initialize(); - ~ScopedPluginManager() - { - PluginManager::instance().shutdown(); - PythonInterpreter::instance().shutdown(); - } + ~ScopedPluginManager() { PluginManager::instance().shutdown(); } }; // The host reaches a printer agent plugin through IPrinterAgent, so the tests do too. The Python diff --git a/tests/slic3rutils/test_plugin_resource_texture.cpp b/tests/slic3rutils/test_plugin_resource_texture.cpp index c57a39b5e1..c4c9feab9e 100644 --- a/tests/slic3rutils/test_plugin_resource_texture.cpp +++ b/tests/slic3rutils/test_plugin_resource_texture.cpp @@ -69,8 +69,10 @@ namespace fs = boost::filesystem; namespace { -// Brings the plugin system up, and tears it down explicitly at the end of the test, as -// test_plugin_lifecycle.cpp does. Declare this FIRST in a test so it is destroyed last. +// Brings the plugin system up for the duration of one test and tears the manager down at the end, +// as test_plugin_lifecycle.cpp does. The interpreter is process-wide and finalized once by +// PythonInterpreterRunEnd in slic3rutils_tests_main.cpp; CPython cannot be reinitialized after +// Py_Finalize. Declare this FIRST in a test so it is destroyed last. struct ScopedPluginManager { // Before initialize(): the interpreter creates {data_dir}/python/packages and {data_dir}/log. @@ -78,11 +80,7 @@ struct ScopedPluginManager bool initialized = false; ScopedPluginManager() { initialized = PluginManager::instance().initialize(); } - ~ScopedPluginManager() - { - PluginManager::instance().shutdown(); - PythonInterpreter::instance().shutdown(); - } + ~ScopedPluginManager() { PluginManager::instance().shutdown(); } }; // The app installs these in GUI_App::init_plugin_gui_wiring. Without an app the callbacks run inline diff --git a/tests/slic3rutils/test_shortcuts.cpp b/tests/slic3rutils/test_shortcuts.cpp index d36c1d3b39..036c769dc0 100644 --- a/tests/slic3rutils/test_shortcuts.cpp +++ b/tests/slic3rutils/test_shortcuts.cpp @@ -221,7 +221,9 @@ TEST_CASE("Every shortcut is listed under the section of its table row", "[Short CHECK(shortcut_section(Shortcut::GizmoBrimEars) == ShortcutSection::Gizmos); CHECK(shortcut_section(Shortcut::MovesSliderEnd) == ShortcutSection::Sliders); CHECK(shortcut_section(Shortcut::ViewDefault) == ShortcutSection::Camera); + CHECK(shortcut_section(Shortcut::ShowCollisionVolumes) == ShortcutSection::Display); CHECK(shortcut_section(Shortcut::KeyboardShortcuts) == ShortcutSection::Application); + CHECK(shortcut_section(Shortcut::Quit) == ShortcutSection::Application); CHECK(std::string(section_name(ShortcutSection::SlicingAndPrinting)) == "Slicing and printing"); } diff --git a/tests/slic3rutils/test_slicing_pipeline_config.cpp b/tests/slic3rutils/test_slicing_pipeline_config.cpp index 0dc12639a0..73a3840577 100644 --- a/tests/slic3rutils/test_slicing_pipeline_config.cpp +++ b/tests/slic3rutils/test_slicing_pipeline_config.cpp @@ -53,11 +53,9 @@ struct ScopedPluginManager bool initialized = false; ScopedPluginManager() { initialized = PluginManager::instance().initialize(); } - ~ScopedPluginManager() - { - PluginManager::instance().shutdown(); - PythonInterpreter::instance().shutdown(); - } + // The interpreter is process-wide; PythonInterpreterRunEnd in slic3rutils_tests_main.cpp + // finalizes it once, after the last test case. + ~ScopedPluginManager() { PluginManager::instance().shutdown(); } }; const char* const CONFIG_PROBE_SOURCE = R"PY(# /// script diff --git a/tests/slic3rutils/test_timelapse_codecs.cpp b/tests/slic3rutils/test_timelapse_codecs.cpp new file mode 100644 index 0000000000..ede43d8f06 --- /dev/null +++ b/tests/slic3rutils/test_timelapse_codecs.cpp @@ -0,0 +1,100 @@ +#include + +#include "libslic3r/GCode/ThumbnailData.hpp" +#include "libslic3r/GCode/Thumbnails.hpp" +#include "libslic3r/PrintConfig.hpp" +#include "libslic3r/TexturePainting.hpp" +#include "slic3r/GUI/AVVideoDecoder.hpp" +#include "slic3r/GUI/Printer/BambuTunnel.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +TEST_CASE("JPEG texture decoding coexists with thumbnails and video frames", "[TimelapseCodecs][Regression]") +{ +#if defined(__linux__) + if (!std::getenv("DISPLAY") && !std::getenv("WAYLAND_DISPLAY")) + SKIP("This integration test needs a display (for example, xvfb-run)."); +#endif + wxInitializer init; + REQUIRE(init.IsOk()); + wxInitAllImageHandlers(); + + // Generate a JPEG through the same encoder used for G-code thumbnails. + constexpr int width = 160, height = 90, iterations = 1000; + Slic3r::ThumbnailData thumbnail; + thumbnail.set(width, height); + for (std::size_t i = 0; i < thumbnail.pixels.size(); i += 4) { + thumbnail.pixels[i] = 180; + thumbnail.pixels[i + 1] = 70; + thumbnail.pixels[i + 2] = 30; + thumbnail.pixels[i + 3] = 255; + } + const auto jpeg = Slic3r::GCodeThumbnails::compress_thumbnail(thumbnail, Slic3r::GCodeThumbnailsFormat::JPG); + REQUIRE(jpeg); + REQUIRE(jpeg->size > 0); + const auto* bytes = static_cast(jpeg->data); + Slic3r::TextureImage texture; + texture.width = texture.height = -1; + texture.data.assign(bytes, bytes + jpeg->size); + + std::atomic texture_ok{true}; + std::thread texture_worker([&] { + for (int i = 0; i < iterations; ++i) { + std::vector pixels; + int decoded_width = 0, decoded_height = 0; + if (!Slic3r::decode_texture_to_pixels(texture, pixels, decoded_width, decoded_height) || + decoded_width != width || decoded_height != height || pixels.size() != width * height * 3) + texture_ok = false; + } + }); + + // PrinterFileSystem decodes timelapse thumbnails with wxImage. Do not + // assert until the worker is joined: Catch assertions can unwind the scope. + bool thumbnails_ok = true; + for (int i = 0; i < iterations; ++i) { + wxMemoryInputStream stream(jpeg->data, jpeg->size); + wxImage image(stream, "image/jpeg"); + if (!image.IsOk() || image.GetWidth() != width || image.GetHeight() != height || + image.GetRed(width / 2, height / 2) < 170 || image.GetGreen(width / 2, height / 2) > 80) + thumbnails_ok = false; + } + texture_worker.join(); + REQUIRE(texture_ok.load()); + REQUIRE(thumbnails_ok); + + // Exercise Orca's real FFmpeg decoder and its platform display conversion. + AVVideoDecoder decoder; + Bambu_StreamInfo info{}; + info.type = VIDE; + info.sub_type = MJPG; + info.format_type = video_jpeg; + REQUIRE(decoder.open(info) == 0); + Bambu_Sample sample{}; + sample.size = static_cast(jpeg->size); + sample.buffer = bytes; + for (int i = 0; i < iterations; ++i) { + REQUIRE(decoder.decode(sample) == 0); + wxImage image; + REQUIRE(decoder.toWxImage(image, wxSize(width, height))); + REQUIRE(image.IsOk()); + REQUIRE(image.GetWidth() == width); + REQUIRE(image.GetHeight() == height); +#ifdef _WIN32 + // Playback uses this raw 32-bit bitmap conversion only on Windows. + wxBitmap bitmap; + REQUIRE(decoder.toWxBitmap(bitmap, wxSize(width, height))); + REQUIRE(bitmap.IsOk()); + REQUIRE(bitmap.GetWidth() == width); + REQUIRE(bitmap.GetHeight() == height); +#endif + } +} diff --git a/tests/test_utils.hpp b/tests/test_utils.hpp index cffa05cb15..f677b2de0b 100644 --- a/tests/test_utils.hpp +++ b/tests/test_utils.hpp @@ -12,12 +12,16 @@ #include #include +#include #include #include +#include #include #include #include +#include + #if defined(WIN32) || defined(_WIN32) #define PATH_SEPARATOR R"(\)" #else @@ -223,4 +227,36 @@ private: std::optional m_previous; }; +// Switches this thread's numeric locale to one whose decimal separator is a comma, +// when the system has one installed. +struct CommaNumericLocale +{ +#ifdef _WIN32 + bool apply() + { + for (const char* name : { "de-DE", "German_Germany.1252" }) + if (std::setlocale(LC_NUMERIC, name) != nullptr) + return true; + return false; + } +#else + locale_t locale { (locale_t) 0 }; + bool apply() + { + for (const char* name : { "de_DE.UTF-8", "de_DE.utf8", "de_DE" }) + if ((locale = newlocale(LC_NUMERIC_MASK, name, (locale_t) 0)) != (locale_t) 0) { + uselocale(locale); + return true; + } + return false; + } + // Freed once the setters around apply() have put the thread's own locale back. + ~CommaNumericLocale() + { + if (locale != (locale_t) 0) + freelocale(locale); + } +#endif +}; + #endif // SLIC3R_TEST_UTILS