mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-18 22:42:37 +00:00
Rename snaporca/SnapOrca to orca_cad so the OrcaSlicer PR carries no Snapmaker naming
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# SnapOrca-CAD vs Onshape — capability gap analysis
|
||||
# Orca-CAD vs Onshape — capability gap analysis
|
||||
|
||||
Generated 2026-07-22 by enumerating the source, not from recollection:
|
||||
`CadFeatureType` and `add_*` in `src/libslic3r/CAD/CadDocument.hpp`, `Tool` in
|
||||
@@ -6,19 +6,19 @@ Generated 2026-07-22 by enumerating the source, not from recollection:
|
||||
`SketchConstraintType` + `SketchEntity::Type` in `src/libslic3r/CAD/SketchEngine.hpp`,
|
||||
and the JSON-RPC dispatch in `src/slic3r/GUI/CAD/McpControl.cpp`.
|
||||
|
||||
**Scope note.** Onshape is a cloud PLM platform; SnapOrca is a Design tab inside a
|
||||
**Scope note.** Onshape is a cloud PLM platform; Orca is a Design tab inside a
|
||||
slicer. A large share of Onshape's surface (release management, branching, real-time
|
||||
collaboration, FEA, rendering, PDM) is out of scope by construction and is listed
|
||||
separately at the bottom rather than counted as a "missing tool".
|
||||
|
||||
---
|
||||
|
||||
## 1. What SnapOrca already has
|
||||
## 1. What Orca already has
|
||||
|
||||
### 2D sketcher — near parity with Onshape
|
||||
This is the strongest area. Very little is missing.
|
||||
|
||||
| Category | SnapOrca |
|
||||
| Category | Orca |
|
||||
|---|---|
|
||||
| Entities | Line, Polyline, Arc (3-point / tangent / center), Circle (center / 2-point / 3-point), Point, Ellipse, Elliptical arc, B-spline |
|
||||
| Shapes | Rectangle (corner / center / oblique / rounded), Slot, Arc-slot, Polygon |
|
||||
@@ -88,7 +88,7 @@ Studio + configurations are a core differentiator, and this is the cheapest Tier
|
||||
item to close for the size of the payoff.
|
||||
|
||||
**4. Surface modelling.** Absent. No surface extrude/revolve/loft/sweep, no fill,
|
||||
knit, trim/extend surface, offset surface, or thicken. SnapOrca is solid-only.
|
||||
knit, trim/extend surface, offset surface, or thicken. Orca is solid-only.
|
||||
*Impact:* organic/complex shapes and repair of imported junk geometry are impossible.
|
||||
OCCT already provides all of it (`TKOffset`, `TKBRep`), so the kernel is not the
|
||||
blocker — only UI and feature plumbing.
|
||||
@@ -106,7 +106,7 @@ blocker — only UI and feature plumbing.
|
||||
| **Split body** | Cut removes material; splitting one body into two independently-usable bodies is absent. Very relevant for print-in-parts. | Medium |
|
||||
| **Thicken** | Solid from a surface/face offset. | Needs surfaces |
|
||||
| **Rib** | Standard structural feature. | Medium |
|
||||
| **Delete face / move face / replace face** | Direct/dumb-solid editing — the main tool for fixing imported STEP. Given SnapOrca imports STEP *and* meshes, its absence is felt. | Medium |
|
||||
| **Delete face / move face / replace face** | Direct/dumb-solid editing — the main tool for fixing imported STEP. Given Orca imports STEP *and* meshes, its absence is felt. | Medium |
|
||||
| **Datum axis, coordinate system** | Only datum *planes* exist. Axes are needed for revolve/pattern references. | Yes |
|
||||
| **Mass properties** | `GeometryEngine` computes a volume internally, but there is no volume/mass/COM/inertia readout. For print cost/time estimation this is nearly free to expose. | Yes — trivial |
|
||||
| **Measure tool in the GUI** | `measure` exists over MCP but there is no interactive measure in the UI. | Yes |
|
||||
@@ -123,7 +123,7 @@ blocker — only UI and feature plumbing.
|
||||
Version control with branching/merging, release management, real-time multi-user
|
||||
collaboration, cloud PDM, FeatureScript custom-feature authoring, simulation/FEA,
|
||||
photorealistic rendering, app store/integrations. These are Onshape-the-platform,
|
||||
not Onshape-the-modeller. Not defects in SnapOrca.
|
||||
not Onshape-the-modeller. Not defects in Orca.
|
||||
|
||||
---
|
||||
|
||||
@@ -140,7 +140,7 @@ the most capability per unit of work:
|
||||
5. **Split body** — high value for print-in-parts workflows.
|
||||
6. **Project edges into sketch** — the sketcher's most conspicuous hole.
|
||||
7. **Surface modelling** — large, but OCCT already ships the algorithms.
|
||||
8. **Assemblies** — largest effort; only worth it if SnapOrca targets multi-part products.
|
||||
8. **Assemblies** — largest effort; only worth it if Orca targets multi-part products.
|
||||
|
||||
Deliberately last: drawings and sheet metal — high cost, low relevance to an
|
||||
FDM-oriented tool.
|
||||
@@ -149,7 +149,7 @@ FDM-oriented tool.
|
||||
|
||||
## 4. Honest summary
|
||||
|
||||
SnapOrca's **sketcher is at or near Onshape parity**, and its **solid feature set
|
||||
Orca's **sketcher is at or near Onshape parity**, and its **solid feature set
|
||||
covers the mainstream modelling path** (sketch → extrude/revolve/sweep/loft →
|
||||
dress-up → boolean/pattern). What is absent is *breadth*: assemblies, surfaces,
|
||||
sheet metal, drawings, and — most importantly for a tool calling itself parametric —
|
||||
|
||||
@@ -4,7 +4,7 @@ What the Design tab actually costs a maintainer who merges it. Written to be che
|
||||
every number below is reproducible with the command that produced it, and the places where
|
||||
a number is still missing say so instead of guessing.
|
||||
|
||||
Measured on Linux x86_64, OCCT V7_6_0, in the `snaporca-deps` build image.
|
||||
Measured on Linux x86_64, OCCT V7_6_0, in the `snapmaker-deps` build image.
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -75,7 +75,7 @@ producing them honestly needs a build this machine cannot do:
|
||||
|
||||
1. **Windows DLL delta.** OCCT builds shared on Windows, so the shipped cost there is real
|
||||
DLL bytes rather than linker-selected objects. That needs a Windows build to size —
|
||||
tracked as the cross-platform build proof (`snaporca-gix`).
|
||||
tracked as the cross-platform build proof (`gix`).
|
||||
2. **Clean-build time delta.** Measuring it means building the deps prefix twice, with the
|
||||
flag ON and OFF, on the same machine. The incremental figures from day-to-day work do not
|
||||
answer the question and are not offered as if they did.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Mate connectors: aligning with the mainstream CAD systems
|
||||
|
||||
Research date: 2026-08-05. Written against `orca_cad` / `snaporca` at the M8 state
|
||||
Research date: 2026-08-05. Written against `orca_cad` / `Snapmaker` at the M8 state
|
||||
(`CadDocument.{hpp,cpp}`, `apply_mate`, `datum_frame`, the `Mate` card in `DesignPanel.cpp`).
|
||||
|
||||
**Brief:** align with the mate-connector concept as the main CAD programs actually implement it,
|
||||
@@ -300,7 +300,7 @@ times.
|
||||
|
||||
**C2 — The roll is unspecified.** Aligning Z leaves one rotation about Z undetermined. Something must
|
||||
pin it, and if that something is world-derived, the frame does not rotate with its part. **This
|
||||
codebase shipped exactly this bug** (`snaporca-en4`): a face-only connector took Z from the face
|
||||
codebase shipped exactly this bug** (`en4`): a face-only connector took Z from the face
|
||||
normal but X from `coordsys_x_hint`, a world constant, so Fastened and Slider claimed to lock an
|
||||
orientation the frame could not see. Fixed 2026-07-26 by deriving X from the face's own first usable
|
||||
edge — but note the fix's own caveat: *"replaying an older document whose face-only connector fed a
|
||||
@@ -512,7 +512,7 @@ Source of record: `CadDocument.hpp:26,247-252,298-310`; `CadDocument.cpp:1669` (
|
||||
**Already aligned — do not "fix" these:** the five types and their DOF; the frame definition (A1);
|
||||
Z as the joint axis (A2); superimpose-then-relax (A3); the fixed/moving asymmetry in the data model
|
||||
(A5); DOF wording in the type list (A7); free-DOF preservation (A8); right-handed frames under mirror
|
||||
(R14); and `snaporca-en4`'s fix, which put roll derivation on the body where it belongs (C2).
|
||||
(R14); and `en4`'s fix, which put roll derivation on the body where it belongs (C2).
|
||||
|
||||
**The pattern worth naming: the kernel is in good shape and the concept is under-explained.** Half the
|
||||
requirements here are wording and drawing, not geometry. The two real engineering items are R9 (origin
|
||||
@@ -668,7 +668,7 @@ is a symbol, not a part — it must not shrink with the model. Nothing about tha
|
||||
The glyph was therefore implemented and driven on the rig. Screenshots: `g-0*.png`, left in the workspace `artifacts/shots/` and not moved into the repo.
|
||||
Five findings, none of which a mock could have produced:
|
||||
|
||||
**F1 — Three axis arms lose to one.** Rendered side by side (`SNAPORCA_GLYPH=A` vs default), the
|
||||
**F1 — Three axis arms lose to one.** Rendered side by side (`ORCA_CAD_GLYPH=A` vs default), the
|
||||
Onshape-style RGB trio crowds a 22 px disc: the arrowheads are as large as the disc, they bury the
|
||||
gold quadrant, and at an oblique angle the three heads pile into a coloured smudge. Worse, **it is
|
||||
indistinguishable from the move gizmo and the bed triad**, which are already RGB arrow trios in this
|
||||
@@ -827,7 +827,7 @@ conversation it arrived in points at "glyph".
|
||||
It changes the meaning of every stored document containing a mate. Options: (a) invert and migrate,
|
||||
writing `direction=Aligned` where `mate_flip` was false; (b) invert only for new mates and store
|
||||
`direction` explicitly from now on. (b) is safer and costs one field. Note this project has taken one
|
||||
such semantic hit knowingly before — the `snaporca-en4` fix — and the golden fixture survived, so the
|
||||
such semantic hit knowingly before — the `en4` fix — and the golden fixture survived, so the
|
||||
migration path is a known quantity. **If G3 (live preview) lands first, this matters much less.**
|
||||
|
||||
**D2 — How far to take origin candidates?** [R9]
|
||||
@@ -911,7 +911,7 @@ R18's loud refusals carrying the honesty.
|
||||
[Joint kinematics — the six lower pairs and their DOF](https://erc-bpgc.github.io/handbook/mechanical/Joint%20Kinematics/) ·
|
||||
[ISO 10303-105 — Kinematics (STEP integrated resource)](https://www.iso.org/standard/78589.html)
|
||||
|
||||
**Internal** — `snaporca-en4` (closed 2026-07-26, fixes C2 here) · `CadDocument.cpp:1669`
|
||||
**Internal** — `en4` (closed 2026-07-26, fixes C2 here) · `CadDocument.cpp:1669`
|
||||
`datum_frame` · `CadDocument.cpp:2961` `apply_mate` · `CadDocument.cpp:1302` `add_mate`
|
||||
|
||||
**Second opinion** — an independent review by Kimi Code (2026-08-05) contributed the
|
||||
|
||||
@@ -9,7 +9,7 @@ static const Vec2d kBearOutline[] = { // 12 verts, RDP eps 0.030, CCW
|
||||
static const Vec2d kBearChin[] = { // the CHIN BAR, flat. The muzzle is relief — see kBearCrest.
|
||||
{-0.2682, -0.3578}, {+0.2628, -0.3578}, {+0.2237, -0.1786},
|
||||
};
|
||||
// {cx, cy, r}: two eyes, then the cheek dot that carries handedness (snaporca-wi3z).
|
||||
// {cx, cy, r}: two eyes, then the cheek dot that carries handedness (wi3z).
|
||||
static const Vec3d kBearMarks[] = {
|
||||
{-0.1997, +0.1760, +0.0590},
|
||||
{+0.1947, +0.1760, +0.0590},
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<div class="wrap">
|
||||
|
||||
<header>
|
||||
<div class="eyebrow">SnapOrca Design · assembly</div>
|
||||
<div class="eyebrow">Orca Design · assembly</div>
|
||||
<h1>Mate connector glyph — polarity and verse</h1>
|
||||
<p class="sub">
|
||||
Onshape's core (disc + roll quadrant + Z arrow) is adopted unchanged because it is proven and
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Emit the simplified bear as a C++ table for the viewport glyph — snaporca-wi3z.
|
||||
"""Emit the simplified bear as a C++ table for the viewport glyph — wi3z.
|
||||
|
||||
Everything is normalised to the part's own bounding span and centred, so the renderer scales by
|
||||
one radius R in screen pixels and nothing here carries millimetres. Emitting rather than
|
||||
@@ -79,7 +79,7 @@ L.append("};")
|
||||
L.append(f"static const Vec2d kBearChin[] = {{ // the CHIN BAR, flat. The muzzle is relief — see kBearCrest.")
|
||||
L.append(" "+", ".join(f"{{{fmt(x)}, {fmt(y)}}}" for x,y in TRI)+",")
|
||||
L.append("};")
|
||||
L.append("// {cx, cy, r}: two eyes, then the cheek dot that carries handedness (snaporca-wi3z).")
|
||||
L.append("// {cx, cy, r}: two eyes, then the cheek dot that carries handedness (wi3z).")
|
||||
L.append("static const Vec3d kBearMarks[] = {")
|
||||
for cx,cy,r in E: L.append(f" {{{fmt(cx)}, {fmt(cy)}, {fmt(r)}}},")
|
||||
L.append(f" {{{fmt(DOT[0])}, {fmt(DOT[1])}, {fmt(DOT[2])}}},")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Render the SIMPLIFIED glyph exactly as render_mate_face() draws it — snaporca-x0kd.
|
||||
"""Render the SIMPLIFIED glyph exactly as render_mate_face() draws it — x0kd.
|
||||
|
||||
This is the panel the study was missing. simplify_study.py measured a FLAT outline and
|
||||
relief_sheet.py measured the FULL 1508-facet part; neither showed the simplified glyph WITH its
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Give the bear a handedness mark that survives rasterisation — snaporca-wi3z, Tommaso's call 2.
|
||||
"""Give the bear a handedness mark that survives rasterisation — wi3z, Tommaso's call 2.
|
||||
|
||||
The study showed the left/right cue lives in sub-millimetre corner radii and is therefore invisible
|
||||
at glyph size: one pixel is 2.6 mm at 32 px. Roll and verse are safe; handedness is not.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The muzzle has to READ, not just be present — snaporca-wi3z.
|
||||
"""The muzzle has to READ, not just be present — wi3z.
|
||||
|
||||
Faithfully scaled, the part's ridge is 11.3 mm on an 83 mm face: 13.6 % of the width. At glyph
|
||||
size that is a scratch. A glyph is a symbol, not a scale model, so the question is how much
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Flat glyph vs 3D relief, at the elevations that killed the disc — snaporca-wi3z.
|
||||
"""Flat glyph vs 3D relief, at the elevations that killed the disc — wi3z.
|
||||
|
||||
The flat study collapsed at 16 deg because anything drawn IN the connector's plane foreshortens by
|
||||
sin(elevation). This renders the SAME bear as its real relief (1508 facets off the supplied male)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Reduce the bear face to the fewest marks that still read at glyph size — snaporca-wi3z.
|
||||
"""Reduce the bear face to the fewest marks that still read at glyph size — wi3z.
|
||||
|
||||
Geometry comes from bear_outline.json, which extract_outline.py pulled off the supplied male
|
||||
B-rep's back plate: the outer wire IS the silhouette, the inner wires are the two eyes and the
|
||||
|
||||
+10
-10
@@ -1,13 +1,13 @@
|
||||
# Rig build traps
|
||||
|
||||
The build rig is two long-lived containers, `snaporca-gui` and `orcacad-gui`, one per fork. Each
|
||||
mounts only its fork's build volume (`snaporca_buildcache` / `orcacad_buildcache`) at
|
||||
The build rig is two long-lived containers, `snapmaker-gui` and `orcacad-gui`, one per fork. Each
|
||||
mounts only its fork's build volume (`snapmaker_buildcache` / `orcacad_buildcache`) at
|
||||
`/OrcaSlicer/build`, its fork's `resources/`, and a shots directory — nothing else. They run the
|
||||
binary; they do not build it. Rebuild with `scripts/CAD/build-gui.sh`.
|
||||
|
||||
| fork repo | project() | deps image | build volume | GUI container | binary |
|
||||
|---|---|---|---|---|---|
|
||||
| `snaporca` | `Snapmaker_Orca` | `snaporca-deps` | `snaporca_buildcache` | `snaporca-gui` | `snapmaker-orca` |
|
||||
| `Snapmaker` | `Snapmaker_Orca` | `snapmaker-deps` | `snapmaker_buildcache` | `snapmaker-gui` | `snapmaker-orca` |
|
||||
| `orca_cad` | `OrcaSlicer` | `orcacad-deps` | `orcacad_buildcache` | `orcacad-gui` | `orca-slicer` |
|
||||
|
||||
`scripts/CAD/build-gui.sh` exists alongside `scripts/CAD/build-gui-incremental.sh` for one reason: it does a
|
||||
@@ -29,7 +29,7 @@ reports an unknown target, and `orca-slicer` / `OrcaSlicer` have been replaced b
|
||||
|
||||
**Cause.** The GUI image's baked `/OrcaSlicer` tree is the Jun-13 Snapmaker-derived source
|
||||
(`project(Snapmaker_Orca)`, executable `snapmaker-orca`). `orcacad-deps` is layered on
|
||||
`snaporca-deps`, so even on the mainline fork the baked tree is the other fork's. A `cmake .`
|
||||
`snapmaker-deps`, so even on the mainline fork the baked tree is the other fork's. A `cmake .`
|
||||
there reconfigures the shared build dir under the wrong project name.
|
||||
|
||||
**Fix.** Build only via `scripts/CAD/build-gui.sh`, which starts a throwaway container from the deps
|
||||
@@ -64,10 +64,10 @@ Did you initialize submodules?` (the `FATAL_ERROR` guarding `PYBIND11_SOURCE_DIR
|
||||
fork's root `CMakeLists.txt`, near line 948).
|
||||
|
||||
**Cause.** The deps image predates that requirement. Only the mainline (`orca_cad`) fork has
|
||||
`deps_src/pybind11` and the requirement; snaporca has neither.
|
||||
`deps_src/pybind11` and the requirement; Snapmaker has neither.
|
||||
|
||||
**Fix.** Mount `deps_src` over the baked tree — `scripts/CAD/build-gui.sh` does. Corollary: mounting a
|
||||
snaporca tree into an `orcacad-deps` build reproduces this error exactly.
|
||||
Snapmaker tree into an `orcacad-deps` build reproduces this error exactly.
|
||||
|
||||
---
|
||||
|
||||
@@ -96,7 +96,7 @@ you ever configure by hand, run it twice.
|
||||
**Cause.** The cache carries `SLIC3R_CAD=ON`, but the root `CMakeLists.txt` actually configured is
|
||||
a stale baked copy that predates the gate and never runs `add_definitions(-DSLIC3R_CAD)` (the
|
||||
gate is `if (SLIC3R_CAD)` / `add_definitions(-DSLIC3R_CAD)` in the root list — line 179/180 in
|
||||
snaporca, 319/320 in orca_cad). Every `#ifdef SLIC3R_CAD` block therefore compiles out while the
|
||||
Snapmaker, 319/320 in orca_cad). Every `#ifdef SLIC3R_CAD` block therefore compiles out while the
|
||||
option still reads ON.
|
||||
|
||||
**Fix.** Always mount the live `CMakeLists.txt` and `cmake/` — never inherit them from the image.
|
||||
@@ -109,12 +109,12 @@ all mount both.
|
||||
|
||||
`ninja <target>` writes `/OrcaSlicer/build/src/Release/<binary>`; only `build_linux.sh`
|
||||
additionally packages to `/OrcaSlicer/build/package/bin/<binary>`. `orca_cad`'s
|
||||
`scripts/CAD/start-headless-gui.sh` defaults `BIN` to `src/Release/orca-slicer`, but snaporca's defaults to
|
||||
`package/bin/snapmaker-orca`. So after a target-only rebuild on snaporca, launching
|
||||
`scripts/CAD/start-headless-gui.sh` defaults `BIN` to `src/Release/orca-slicer`, but Snapmaker's defaults to
|
||||
`package/bin/snapmaker-orca`. So after a target-only rebuild on Snapmaker, launching
|
||||
`start-headless-gui.sh` with its default runs the **stale packaged** binary — the change under test is
|
||||
invisible and the session hunts a phantom. Pass `BIN` explicitly:
|
||||
|
||||
docker exec -e BIN=/OrcaSlicer/build/src/Release/snapmaker-orca snaporca-gui /OrcaSlicer/scripts/CAD/start-headless-gui.sh
|
||||
docker exec -e BIN=/OrcaSlicer/build/src/Release/snapmaker-orca snapmaker-gui /OrcaSlicer/scripts/CAD/start-headless-gui.sh
|
||||
|
||||
`scripts/CAD/build-gui.sh` prints the correct line for the current fork when it finishes.
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ def main():
|
||||
# A verb may carry a NOTE: the reason it exists, emitted as a C++ comment above its row.
|
||||
# Without somewhere to put it, a rationale written into the generated header is deleted by
|
||||
# the next regeneration — which is how the model-mode "Constrain sketch" row came to exist
|
||||
# in the header and not in the atlas at all (snaporca-ziam). The map exists once; so does
|
||||
# in the header and not in the atlas at all (ziam). The map exists once; so does
|
||||
# the explanation.
|
||||
for ln in ([v["note"]] if isinstance(v.get("note"), str) else v.get("note") or []):
|
||||
lines.append(f" // {ln}")
|
||||
|
||||
@@ -23,7 +23,7 @@ The verb in the name is the role:
|
||||
| `check-sketch-engine-corpus.py` | The same ladder graded against a systematic sample of real drawings instead of shapes we chose. | Kernel + corpus |
|
||||
| `check-gui-sketching.py` | The same profiles drawn the way a person draws them — synthetic mouse gestures and typed values. | Headless GUI |
|
||||
| `check-gui-context-menu.py` | That right-click is the pivot of the design gesture, and adapts to what was clicked. | Headless GUI |
|
||||
| `check-mcp-sketch.py` | The sketch layer driven over the MCP socket, asserting what decides whether a profile is buildable. | Headless GUI + `SNAPORCA_MCP` |
|
||||
| `check-mcp-sketch.py` | The sketch layer driven over the MCP socket, asserting what decides whether a profile is buildable. | Headless GUI + `ORCA_CAD_MCP` |
|
||||
|
||||
**`run-kernel-tests.sh` is the only one CI can run.** The rest need a live
|
||||
application with an OpenGL canvas and synthetic input, which hosted runners do not
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
# orcacad-deps, NOT snaporca-deps: see the note in run-kernel-tests.sh — the wrong image
|
||||
# orcacad-deps, NOT snapmaker-deps: see the note in run-kernel-tests.sh — the wrong image
|
||||
# fails at CMake configure, not at link time.
|
||||
IMAGE="${IMAGE:-orcacad-deps}"
|
||||
BUILD_VOL="${BUILD_VOL:-orcacad_buildcache}"
|
||||
@@ -32,11 +32,11 @@ echo "REPO=$REPO IMAGE=$IMAGE BUILD_VOL=$BUILD_VOL"
|
||||
# the build fails with "class GLCanvas3D has no member named set_design_sketch_tool".
|
||||
#
|
||||
# build_linux.sh must be mounted for the same reason, and here the stale copy is guaranteed
|
||||
# wrong rather than merely risky: orcacad-deps is layered on snaporca-deps, so the baked script
|
||||
# wrong rather than merely risky: orcacad-deps is layered on snapmaker-deps, so the baked script
|
||||
# is the OTHER fork's and builds `--target Snapmaker_Orca`. This fork's target is `OrcaSlicer`,
|
||||
# so without this mount configure succeeds and then ninja dies on "unknown target".
|
||||
# scripts/ likewise: build_linux.sh's packaging step sources scripts/appimage_lib_policy.sh,
|
||||
# which the baked snaporca tree does not have, so a fully successful link still exited
|
||||
# which the baked Snapmaker tree does not have, so a fully successful link still exited
|
||||
# non-zero with "missing AppImage helper" and the binary check never ran.
|
||||
|
||||
# ---- OOM guard (2026-08-21) -------------------------------------------------------------
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Rebuild the GUI binary the design rig launches — in a THROWAWAY container, writing into the
|
||||
# same build-cache volume the rig's long-lived GUI container reads from.
|
||||
#
|
||||
# NEVER build inside the GUI container (snaporca-gui / orcacad-gui). Its baked /OrcaSlicer tree
|
||||
# NEVER build inside the GUI container (snapmaker-gui / orcacad-gui). Its baked /OrcaSlicer tree
|
||||
# is the Jun-13 Snapmaker-derived source, so a `cmake .` in there silently reconfigures the
|
||||
# shared build dir as project(Snapmaker_Orca) and this fork's targets vanish. That is Trap 1 of
|
||||
# five; all of them, with symptoms and exact recovery commands, are in docs/rig_build_traps.md.
|
||||
@@ -21,7 +21,7 @@ REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
# the wrong volume the two forks silently trade build artefacts.
|
||||
PROJECT="$(sed -n 's/^project(\([A-Za-z_0-9]*\)).*/\1/p' "$REPO/CMakeLists.txt" | head -1)"
|
||||
case "$PROJECT" in
|
||||
Snapmaker_Orca) PREFIX=snaporca; BIN=snapmaker-orca ;;
|
||||
Snapmaker_Orca) PREFIX=snapmaker; BIN=snapmaker-orca ;;
|
||||
OrcaSlicer) PREFIX=orcacad; BIN=orca-slicer ;;
|
||||
*) echo "FATAL: unrecognised project($PROJECT) in $REPO/CMakeLists.txt" >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
@@ -14,7 +14,7 @@ again. A user cannot be told to click the field first; when they do not, they ge
|
||||
number and report "the label value is not editable". So this ladder types IMMEDIATELY after the
|
||||
field opens, exactly as a person does, and fails if the prefill is what gets committed.
|
||||
|
||||
WHAT IT GRADES. The app emits one line per event under SNAPORCA_UXTRACE=1:
|
||||
WHAT IT GRADES. The app emits one line per event under ORCA_CAD_UXTRACE=1:
|
||||
|
||||
[UX] open title=Length prefill=154.76
|
||||
[UX] commit title=Length typed=80 value=80.0000
|
||||
@@ -29,7 +29,7 @@ that matters — a field that is on screen but deaf commits its prefill, and eve
|
||||
scripts/CAD/check-gui-click-edit.py --display :10 --bin build/src/Release/orca-slicer
|
||||
|
||||
With --attach it drives an already-running app instead of launching one; the app must have been
|
||||
started with SNAPORCA_UXTRACE=1 and its stderr redirected to --trace.
|
||||
started with ORCA_CAD_UXTRACE=1 and its stderr redirected to --trace.
|
||||
Exit 0 = every field took what was typed.
|
||||
"""
|
||||
import argparse, json, os, re, shutil, signal, socket, subprocess, sys, tempfile, time
|
||||
@@ -175,7 +175,7 @@ def launch():
|
||||
# the process was alive, `xdotool search` on the rig display found nothing, and the window
|
||||
# was sitting on the user's own screen. Silent, and it drives a stray app at someone's face.
|
||||
env.pop("WAYLAND_DISPLAY", None)
|
||||
env.update(DISPLAY=DISP, GDK_BACKEND="x11", SNAPORCA_UXTRACE="1",
|
||||
env.update(DISPLAY=DISP, GDK_BACKEND="x11", ORCA_CAD_UXTRACE="1",
|
||||
LIBGL_ALWAYS_SOFTWARE="1", GALLIUM_DRIVER="llvmpipe",
|
||||
# The rig's Xvfb has no input-method daemon, and a dead ibus context makes a
|
||||
# GtkEntry drop every character while the app looks fine. It cannot affect the
|
||||
@@ -186,7 +186,7 @@ def launch():
|
||||
# the Design panel at all. Without it "the field never opened" is indistinguishable
|
||||
# from "we never got into sketch mode", and the first run of this ladder reported
|
||||
# seven product failures that were really one driver racing a still-loading app.
|
||||
SNAPORCA_KEYTRACE="1", SNAPORCA_MCP=A.sock,
|
||||
ORCA_CAD_KEYTRACE="1", ORCA_CAD_MCP=A.sock,
|
||||
SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt",
|
||||
WEBKIT_DISABLE_DMABUF_RENDERER="1", WEBKIT_DISABLE_COMPOSITING_MODE="1")
|
||||
if os.path.exists(A.sock):
|
||||
|
||||
@@ -11,16 +11,16 @@ action and no shortcut, so a key-driven ladder cannot reach them at all.
|
||||
This ladder drives the menu. Nothing here is asserted from pixels:
|
||||
|
||||
WHAT WAS CLICKED -> the offer's own [OFFER] trace, emitted by show_offer_menu from the same
|
||||
loop that builds the rows (SNAPORCA_KEYTRACE). It cannot drift from what
|
||||
loop that builds the rows (ORCA_CAD_KEYTRACE). It cannot drift from what
|
||||
the user is shown, which a hand-written expectation list would.
|
||||
WHAT IS OFFERED -> the same trace, compared against DesignOffer.hpp parsed independently.
|
||||
"The menu shows exactly the verbs the table says apply here" is a
|
||||
property; a copied list of row names is a transcription.
|
||||
WHAT IT PRODUCED -> the MCP socket, read-only, exactly as in the gesture ladder.
|
||||
|
||||
Run inside the rig container, with the app launched under SNAPORCA_KEYTRACE=1:
|
||||
Run inside the rig container, with the app launched under ORCA_CAD_KEYTRACE=1:
|
||||
|
||||
docker exec snaporca-gui python3 /OrcaSlicer/scripts/CAD/check-gui-context-menu.py [rung ...]
|
||||
docker exec orcacad-gui python3 /OrcaSlicer/scripts/CAD/check-gui-context-menu.py [rung ...]
|
||||
"""
|
||||
import importlib.util
|
||||
import math
|
||||
@@ -38,13 +38,13 @@ _spec = importlib.util.spec_from_file_location("gui_ladder", os.path.join(HERE,
|
||||
G = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(G)
|
||||
|
||||
LOG = os.environ.get("SNAPORCA_GUI_LOG", "/tmp/gui-session.log")
|
||||
LOG = os.environ.get("ORCA_CAD_GUI_LOG", "/tmp/gui-session.log")
|
||||
|
||||
# The rig container's /OrcaSlicer is the image's own baked source tree, not this checkout, so the
|
||||
# generated header is not where a repo-relative path expects it. Look in both places and say which
|
||||
# one was read — a ladder that silently graded against the WRONG table would be worse than one
|
||||
# that refuses to start.
|
||||
HEADER_CANDIDATES = [os.environ.get("SNAPORCA_OFFER_HPP", ""),
|
||||
HEADER_CANDIDATES = [os.environ.get("ORCA_CAD_OFFER_HPP", ""),
|
||||
os.path.join(HERE, "..", "src", "slic3r", "GUI", "CAD", "DesignOffer.hpp"),
|
||||
os.path.join(HERE, "DesignOffer.hpp")]
|
||||
|
||||
@@ -61,12 +61,12 @@ def load_table():
|
||||
"""Every verb in DesignOffer.hpp, as dicts. The independent half of the comparison.
|
||||
|
||||
Parsed from the generated header rather than from tool_atlas.json on purpose: the header is
|
||||
what the binary was compiled from, and the two have been out of step before (snaporca-ziam,
|
||||
what the binary was compiled from, and the two have been out of step before (ziam,
|
||||
where regenerating the header silently dropped the Constrain row).
|
||||
"""
|
||||
path = next((p for p in HEADER_CANDIDATES if p and os.path.exists(p)), None)
|
||||
if path is None:
|
||||
raise SystemExit("no DesignOffer.hpp found; set SNAPORCA_OFFER_HPP or copy it beside "
|
||||
raise SystemExit("no DesignOffer.hpp found; set ORCA_CAD_OFFER_HPP or copy it beside "
|
||||
"this script (tried: " + ", ".join(filter(None, HEADER_CANDIDATES)) + ")")
|
||||
print(f"offer table: {os.path.realpath(path)}")
|
||||
src = open(path).read()
|
||||
@@ -301,7 +301,7 @@ def rung_kinds():
|
||||
# Empty space first: nothing is selected, so the sketch vocabulary's no-selection row set.
|
||||
# Right-click has two jobs on a draw tool, and which one it does depends on whether an
|
||||
# anchor is down. Both are asserted here: the version that consumed EVERY right-click made
|
||||
# the offer unreachable from any armed tool (snaporca-ghcz), which is the goal's own
|
||||
# the offer unreachable from any armed tool (ghcz), which is the goal's own
|
||||
# mechanism failing silently.
|
||||
hi = y1 - (y1 - y0) * 0.12
|
||||
o = open_offer(cx, hi)
|
||||
@@ -766,7 +766,7 @@ def rung_curves():
|
||||
f"and it takes a typed radius exactly: {got:.9f} (asked 30.0)")
|
||||
# The DoF of ONE CIRCLE is three. Asserted here because it is where the lie showed:
|
||||
# after a delete the solver was never re-run, so this reported the DoF of the
|
||||
# geometry that had just been erased. snaporca-ua9g.
|
||||
# geometry that had just been erased. ua9g.
|
||||
G.check("VERTEX", G.describe()["dof"] == 2,
|
||||
f"and the sketch reports the DoF of what is actually in it: {G.describe()['dof']}")
|
||||
|
||||
@@ -1198,7 +1198,7 @@ def main():
|
||||
if not os.path.exists(LOG):
|
||||
G.die(f"no {LOG} — launch the app through scripts/CAD/start-headless-gui.sh")
|
||||
if "[OFFER]" not in open(LOG, errors="replace").read()[-400000:]:
|
||||
print(f"note: no [OFFER] lines in {LOG} yet — the app must run with SNAPORCA_KEYTRACE=1")
|
||||
print(f"note: no [OFFER] lines in {LOG} yet — the app must run with ORCA_CAD_KEYTRACE=1")
|
||||
want = sys.argv[1:] or list(RUNGS)
|
||||
# TWICE. From a cold launch the app shows the Home page over the Design tab, and the first
|
||||
# click only selects the tab — the second is what brings the viewport forward. A ladder that
|
||||
|
||||
@@ -9,16 +9,16 @@ cannot say the Design tab meets its goal. This one draws with synthetic clicks a
|
||||
values into the in-canvas field, then reads the result back through the socket, which is used
|
||||
here ONLY as an instrument, never as an author.
|
||||
|
||||
Runs INSIDE the headless rig container (Xvfb :10 + openbox + the app with SNAPORCA_MCP set):
|
||||
Runs INSIDE the headless rig container (Xvfb :10 + openbox + the app with ORCA_CAD_MCP set):
|
||||
|
||||
docker cp scripts/CAD/check-gui-sketching.py snaporca-gui:/tmp/ && \
|
||||
docker exec snaporca-gui python3 /tmp/check-gui-sketching.py [rung ...]
|
||||
docker cp scripts/CAD/check-gui-sketching.py orcacad-gui:/tmp/ && \
|
||||
docker exec orcacad-gui python3 /tmp/check-gui-sketching.py [rung ...]
|
||||
|
||||
With no arguments every rung runs. Exit 0 = every property held.
|
||||
"""
|
||||
import json, math, os, re, socket, subprocess, sys, time
|
||||
|
||||
SOCK = os.environ.get("SNAPORCA_MCP", "/tmp/mcp.sock")
|
||||
SOCK = os.environ.get("ORCA_CAD_MCP", "/tmp/mcp.sock")
|
||||
DISP = os.environ.get("DISPLAY", ":10")
|
||||
_n = 0
|
||||
_fail = 0
|
||||
@@ -225,7 +225,7 @@ def leave_sketch():
|
||||
# "no sketch opened after plane click + Shift+S"; the unshifted Construction checkbox reported
|
||||
# "0 construction axis". Both name the wrong subsystem. Canvas coordinates are immune because
|
||||
# clickmm() derives them from the live canvas geometry — only the chrome constants need this.
|
||||
CHROME_DY = int(os.environ.get("SNAPORCA_CHROME_DY", "26"))
|
||||
CHROME_DY = int(os.environ.get("ORCA_CAD_CHROME_DY", "26"))
|
||||
|
||||
DESIGN_TAB = (128, 29 + CHROME_DY)
|
||||
|
||||
@@ -1873,7 +1873,7 @@ def rung_scale():
|
||||
f"every cut-out is exactly {side:.6f} squared")
|
||||
# Now the part that matters: draw ONE more entity by hand, on top of all that.
|
||||
#
|
||||
# No Escape here, deliberately: this rung is the regression test for snaporca-j7gc, where a
|
||||
# No Escape here, deliberately: this rung is the regression test for j7gc, where a
|
||||
# bulk sketch_add made while a creation tool is armed was read as a drawn gesture, opened that
|
||||
# tool's value field and swallowed the next key and click until one Escape dismissed it. The
|
||||
# gesture below has to land on the FIRST try. Fixed by resyncing m_autoedit_seen in
|
||||
|
||||
@@ -8,7 +8,7 @@ cost a GUI session and a human. The socket verbs make each one a call, and this
|
||||
loop: build a known profile, ask the app what it thinks it has, compare against arithmetic.
|
||||
|
||||
RUN IT AGAINST A RUNNING APP:
|
||||
SNAPORCA_MCP=/tmp/mcp.sock <binary> # launch with the socket enabled
|
||||
ORCA_CAD_MCP=/tmp/mcp.sock <binary> # launch with the socket enabled
|
||||
python3 scripts/CAD/check-mcp-sketch.py [socket] # default /tmp/mcp.sock
|
||||
|
||||
Exit 0 = every assertion held. Anything else prints the first mismatch and stops.
|
||||
|
||||
@@ -35,7 +35,7 @@ import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
SOCK = os.environ.get("SNAPORCA_MCP", "/tmp/mcp.sock")
|
||||
SOCK = os.environ.get("ORCA_CAD_MCP", "/tmp/mcp.sock")
|
||||
TOL = 1e-6 # exact-comparison tolerance (all inputs are lines)
|
||||
WELD = 0.05 # endpoint-coincidence tolerance, in PDF units
|
||||
|
||||
@@ -295,7 +295,7 @@ def grade(pdf, name, report):
|
||||
# same rule the engine now uses (DesignSketchTool::region_loops). A vertex is exactly
|
||||
# where two loops touch in a real drawing, and a ray cast from a point lying ON the
|
||||
# polygon under test answers by rounding: that alone accounted for every one of the 6
|
||||
# sheets where the two attributions used to disagree. snaporca-5hvl.
|
||||
# sheets where the two attributions used to disagree. 5hvl.
|
||||
probes = [interior_point(r) for r in rings]
|
||||
mine_parent = {}
|
||||
for i, r in enumerate(rings):
|
||||
|
||||
@@ -15,7 +15,7 @@ Every rung asserts those. Area appears only as a cross-check, never as the verdi
|
||||
|
||||
Entirely 2D: sketch entities only, no extrude, revolve or any solid feature.
|
||||
|
||||
SNAPORCA_MCP=/tmp/mcp.sock <binary>
|
||||
ORCA_CAD_MCP=/tmp/mcp.sock <binary>
|
||||
python3 scripts/CAD/check-sketch-engine.py [socket]
|
||||
|
||||
Exit 0 = every rung held. Otherwise the first broken property is named and the run stops.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# FULL=1 scripts/CAD/run-all-checks.sh # corpus over ALL 997 sheets (~25 min)
|
||||
# SKIP_GUI=1 scripts/CAD/run-all-checks.sh # kernel only, for a machine with no rig
|
||||
#
|
||||
# The rig container is expected to be up with the app running and SNAPORCA_MCP set; bring it up
|
||||
# The rig container is expected to be up with the app running and ORCA_CAD_MCP set; bring it up
|
||||
# with scripts/CAD/start-headless-gui.sh inside it. The corpus lives at /corpus in that container.
|
||||
set -uo pipefail
|
||||
# ../.. -- this script lives in scripts/CAD/, so one level up is scripts/, not the repo
|
||||
@@ -19,7 +19,7 @@ set -uo pipefail
|
||||
# scripts/scripts/ and reporting instant failures that were all the same typo.
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 1
|
||||
|
||||
# orcacad-gui, NOT snaporca-gui: that is the other fork's rig, and defaulting to it makes
|
||||
# orcacad-gui, NOT snapmaker-gui: that is the other fork's rig, and defaulting to it makes
|
||||
# this gate verify the wrong fork's binary while reporting green. run-kernel-tests.sh
|
||||
# carries the same warning about the build volume, where the defect was found first.
|
||||
C="${C:-orcacad-gui}"
|
||||
@@ -53,13 +53,13 @@ run_in_rig() { # copy the script in fresh, then run it ther
|
||||
# FIRST, and it needs no rig: the offer table the menu is compiled from must be what the atlas
|
||||
# says. The header calls itself GENERATED and had been hand-edited anyway — which cost four rows
|
||||
# that existed only in the header, one row wired to the wrong action, and a count of 91 for a
|
||||
# 92-row array, so the last verb was unreachable (snaporca-z8rs, snaporca-ziam).
|
||||
# 92-row array, so the last verb was unreachable (z8rs, ziam).
|
||||
# docs/CAD/, not docs/: SoftFever moved the design docs into the CAD subfolder
|
||||
# (bbd1989e1e) and this line kept the old path, so the rung failed on a missing file
|
||||
# rather than on anything about the table. The other fork still has docs/ux/.
|
||||
step "offer table matches the atlas" python3 docs/CAD/ux/mockups/gen_offer_table.py --check
|
||||
|
||||
step "kernel suite" scripts/CAD/run-kernel-tests.sh --vol "${KVOL:-snaporca_kerneltest}"
|
||||
step "kernel suite" scripts/CAD/run-kernel-tests.sh --vol "${KVOL:-orcacad_kerneltest}"
|
||||
|
||||
if [ -z "${SKIP_GUI:-}" ]; then
|
||||
step "engine ladder (rungs 1-8, scripted geometry)" \
|
||||
@@ -71,7 +71,7 @@ if [ -z "${SKIP_GUI:-}" ]; then
|
||||
step "gesture ladder (mouse and keyboard)" \
|
||||
run_in_rig scripts/CAD/check-gui-sketching.py /tmp/check-gui-sketching.py
|
||||
# The offer ladder needs TWO extra things the others do not: the app must have been launched
|
||||
# with SNAPORCA_KEYTRACE=1 (its [OFFER] lines are the whole instrument), and it reads the
|
||||
# with ORCA_CAD_KEYTRACE=1 (its [OFFER] lines are the whole instrument), and it reads the
|
||||
# generated offer table to predict what each selection should show — which is not in the
|
||||
# container's own baked source tree, so it is copied in beside the script — /tmp, where
|
||||
# run_in_rig puts the script, is one of the paths the ladder looks in.
|
||||
|
||||
@@ -23,18 +23,18 @@
|
||||
set -euo pipefail
|
||||
|
||||
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
# orcacad-deps, NOT snaporca-deps: this fork is mainline-based and needs Eigen 5.0.1,
|
||||
# CGAL 5.6.3, wx 3.3.2 and Python 3.12 Development.Embed, none of which snaporca-deps has.
|
||||
# orcacad-deps, NOT snapmaker-deps: this fork is mainline-based and needs Eigen 5.0.1,
|
||||
# CGAL 5.6.3, wx 3.3.2 and Python 3.12 Development.Embed, none of which snapmaker-deps has.
|
||||
# With the wrong image CMake dies at configure, which is exactly why this fork went
|
||||
# M1-M8 without ever compiling (see commit 1633005bba).
|
||||
IMAGE="${IMAGE:-orcacad-deps}"
|
||||
# Must NOT default to snaporca_buildcache: that is the other fork's volume, and pointing
|
||||
# Must NOT default to snapmaker_buildcache: that is the other fork's volume, and pointing
|
||||
# this fork at it makes the two silently trade build artefacts. build-gui-incremental.sh had the
|
||||
# identical defect and was fixed to orcacad_buildcache; this script was missed.
|
||||
VOL="${BUILD_VOL:-orcacad_kerneltest}"
|
||||
# No exclusions. Both cases that used to be quarantined now run: the solver SIGABRT on
|
||||
# circle-line tangency is fixed (snaporca-tkz), and the internal-thread case turned out to have
|
||||
# correct geometry and a wrong reference in the test (snaporca-kzy). A green run here now means
|
||||
# circle-line tangency is fixed (tkz), and the internal-thread case turned out to have
|
||||
# correct geometry and a wrong reference in the test (kzy). A green run here now means
|
||||
# the whole CAD suite passed, not "everything except the two we gave up on".
|
||||
#
|
||||
# ...and that claim was still not true, because the default tag was [CadDocument] alone while
|
||||
|
||||
@@ -36,8 +36,8 @@ export LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe
|
||||
# them comes up looking perfectly healthy: the window is there, status says app up, and every
|
||||
# ladder then dies on "Connection refused" — which reads as a dead app rather than a rig that was
|
||||
# started without its instrument. The script that launches the rig is where they belong.
|
||||
export SNAPORCA_MCP="${SNAPORCA_MCP:-/tmp/mcp.sock}"
|
||||
export SNAPORCA_KEYTRACE="${SNAPORCA_KEYTRACE:-1}"
|
||||
export ORCA_CAD_MCP="${ORCA_CAD_MCP:-/tmp/mcp.sock}"
|
||||
export ORCA_CAD_KEYTRACE="${ORCA_CAD_KEYTRACE:-1}"
|
||||
export LD_LIBRARY_PATH="$LIBPY:$LIBPY2:${LD_LIBRARY_PATH:-}"
|
||||
mkdir -p /root/.config # startup dies in boost::filesystem::create_directory without this
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# Deps-only base image for fast iteration on SnapOrca.
|
||||
# Deps-only base image for fast iteration on Orca.
|
||||
# Identical system+pinned-dependency setup to scripts/Dockerfile, but STOPS after
|
||||
# `build_linux.sh -dr` (no slicer/AppImage build). Produces an image with the pinned
|
||||
# deps baked at /OrcaSlicer/deps/build/destdir, so the slicer can be rebuilt
|
||||
# incrementally via scripts/CAD/build-gui-incremental.sh without re-running the long deps build.
|
||||
#
|
||||
# Build once (rebuild only when deps/ changes, e.g. OCCT module flags):
|
||||
# docker build -t snaporca-deps -f scripts/Dockerfile.deps .
|
||||
# docker build -t snapmaker-deps -f scripts/Dockerfile.deps .
|
||||
FROM docker.io/ubuntu:24.04
|
||||
LABEL maintainer="SnapOrca CAD iteration base"
|
||||
LABEL maintainer="Orca CAD iteration base"
|
||||
|
||||
# Disable interactive package configuration
|
||||
RUN apt-get update && \
|
||||
@@ -80,11 +80,11 @@ RUN ./build_linux.sh -dr -j 12
|
||||
RUN ln -sfn /OrcaSlicer/deps/build/OrcaSlicer_dep /OrcaSlicer/deps/build/destdir
|
||||
|
||||
# The rig's GUI runtime. This used to arrive for free because orcacad-deps was layered on
|
||||
# snaporca-deps; that lineage is Trap 1 in docs/rig_build_traps.md (a baked project(Snapmaker_Orca)
|
||||
# snapmaker-deps; that lineage is Trap 1 in docs/rig_build_traps.md (a baked project(Snapmaker_Orca)
|
||||
# tree) and building from this Dockerfile is what removes it — along with the X stack the rig
|
||||
# needs. scripts/CAD/start-headless-gui.sh requires Xvfb and openbox (without a window manager `xdotool
|
||||
# windowactivate` aborts with "windowmanager claims not to support..."), drives the UI with
|
||||
# xdotool, and captures to /shots with scrot/ImageMagick. Same set snaporca-deps carries.
|
||||
# xdotool, and captures to /shots with scrot/ImageMagick. Same set snapmaker-deps carries.
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
imagemagick \
|
||||
openbox \
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#
|
||||
# The consequence was that scripts/CAD/run-kernel-tests.sh failed at CMake CONFIGURE time,
|
||||
# before a single source file compiled, so THIS FORK'S KERNEL SUITE COULD NOT RUN AT ALL.
|
||||
# Every kernel change ported here was parity-checked against snaporca and never independently
|
||||
# tested (snaporca-w80c). The Snapmaker fork does not hit this: its base requires neither
|
||||
# Every kernel change ported here was parity-checked against Snapmaker and never independently
|
||||
# tested (w80c). The Snapmaker fork does not hit this: its base requires neither
|
||||
# assimp nor OpenCV.
|
||||
#
|
||||
# WHY A LAYER AND NOT A FULL DEPS REBUILD. Rebuilding every dependency takes hours and would
|
||||
|
||||
@@ -325,7 +325,7 @@ void AppConfig::set_defaults()
|
||||
// Design tab: draw a mate connector as a face rather than as the abstract disc + roll
|
||||
// quadrant. Defaults ON — face orientation is hardwired perception, so the roll and the
|
||||
// verse read without being learned, which no abstract glyph achieves. Turning it off
|
||||
// restores the conventional CAD representation for users who expect it (snaporca-x0kd).
|
||||
// restores the conventional CAD representation for users who expect it (x0kd).
|
||||
if (get("design_connector_face_glyph").empty())
|
||||
set_bool("design_connector_face_glyph", true);
|
||||
#endif
|
||||
|
||||
@@ -2142,7 +2142,7 @@ TopoDS_Wire CadDocument::build_sketch_wire(const CadFeature& sketch, bool closed
|
||||
// legacy tail of this function ends in a default rectangle built from width/height,
|
||||
// which for an entity sketch are whatever they happened to be initialised to — so a
|
||||
// sketch entities_to_wire cannot handle (a circle coexisting with a line, two circles:
|
||||
// snaporca-88v) used to extrude into a box the user never drew, silently. Failing here
|
||||
// 88v) used to extrude into a box the user never drew, silently. Failing here
|
||||
// costs the caller an error message; falling through cost them wrong geometry that
|
||||
// looked deliberate. The legacy profile/shape paths below are still reached by sketches
|
||||
// that legitimately carry no entities at all.
|
||||
@@ -2751,7 +2751,7 @@ void CadDocument::apply_feature(TopoDS_Shape& result, bool& have_body,
|
||||
// Neutral plane = horizontal plane through the body's bbox bottom, pull direction +Z.
|
||||
// The face pivots about the line where it meets the neutral plane and tilts by the angle.
|
||||
// ponytail: neutral plane / pull direction fixed to world up; pick-based neutral plane
|
||||
// deferred (same as the datum-plane pick types, snaporca-dgv).
|
||||
// deferred (same as the datum-plane pick types, dgv).
|
||||
Bnd_Box bb; BRepBndLib::Add(result, bb);
|
||||
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
|
||||
bb.Get(xmin, ymin, zmin, xmax, ymax, zmax);
|
||||
@@ -3537,7 +3537,7 @@ void CadDocument::apply_mate(std::vector<CadBody>& bodies, const CadFeature& f)
|
||||
}
|
||||
|
||||
// Volume of a shape, 0 for anything that isn't a solid we can measure. Used to catch a
|
||||
// subtraction that removed nothing (snaporca-daf).
|
||||
// subtraction that removed nothing (daf).
|
||||
static double solid_volume(const TopoDS_Shape& s)
|
||||
{
|
||||
if (s.IsNull()) return 0.0;
|
||||
@@ -3591,7 +3591,7 @@ void CadDocument::route_feature(std::vector<CadBody>& bodies, const CadFeature&
|
||||
// an agent especially — then has no signal at all that the hole it asked for was never
|
||||
// drilled: same body, same volume, ok:true. Measure the volume across the op and refuse
|
||||
// the no-op. Only for removals: every other feature type may legitimately leave the volume
|
||||
// alone (a Transform certainly does). snaporca-daf.
|
||||
// alone (a Transform certainly does). daf.
|
||||
const bool removes = f.type == CadFeatureType::Hole
|
||||
|| f.type == CadFeatureType::Thread
|
||||
|| ((f.type == CadFeatureType::Extrude || f.type == CadFeatureType::Revolve
|
||||
@@ -3625,7 +3625,7 @@ bool CadDocument::recompute()
|
||||
// made a sketch-only design unsaveable AND unopenable: DesignPanel::recompute_guarded syncs
|
||||
// the 3MF recipe only "on success", so nothing was written, and deserialize_recipe ends with
|
||||
// `return recompute()`, so a project that did carry a recipe was refused on load with
|
||||
// "Could not restore the CAD model" while its features sat correctly in the list. snaporca-mtav.
|
||||
// "Could not restore the CAD model" while its features sat correctly in the list. mtav.
|
||||
bool any_solid_feature = false;
|
||||
try {
|
||||
// Parametric pass: evaluate document variables, then each feature's expression bindings,
|
||||
|
||||
@@ -403,7 +403,7 @@ static SketchSolveResult solve_system(std::vector<SketchEntity>& entities,
|
||||
// from the corpse. The fillet degrade ladder hit this on every corner — rung 1 (a
|
||||
// tangent on each leg) is legitimately over-constrained against the legs' own H/V, and
|
||||
// its wreckage then failed rungs 2 and 3, which solve cleanly on their own. The arc
|
||||
// ended up with no constraints at all and the solver snapped the corner shut. snaporca-pl5.
|
||||
// ended up with no constraints at all and the solver snapped the corner shut. pl5.
|
||||
if (!out.ok) return out;
|
||||
for (size_t i = 0; i < entities.size(); ++i) {
|
||||
SketchEntity& e = entities[i];
|
||||
|
||||
@@ -97,7 +97,7 @@ DesignCanvas::DesignCanvas(wxWindow* parent)
|
||||
// this point is known good (ImGui reports want_text=1 and our InputText active), so if these
|
||||
// lines do not appear the character never got past the panel's CHAR_HOOK / the focus chain,
|
||||
// and no amount of work inside the field will help. Skips always: a pure observer.
|
||||
if (m_canvas_widget != nullptr && std::getenv("SNAPORCA_UXTRACE")) {
|
||||
if (m_canvas_widget != nullptr && std::getenv("ORCA_CAD_UXTRACE")) {
|
||||
m_canvas_widget->Bind(wxEVT_CHAR, [](wxKeyEvent& e) {
|
||||
fprintf(stderr, "[UX] canvas_char key=%d\n", e.GetKeyCode());
|
||||
fflush(stderr);
|
||||
@@ -1240,7 +1240,7 @@ void DesignCanvas::set_status_text(const wxString& text, const wxColour& colour)
|
||||
}
|
||||
|
||||
// SetLabel + Wrap + Fit, in that order and always together. Moving the status out of the panel
|
||||
// removed the clipping of snaporca-8cc but not the underlying problem: the chip is a top-level
|
||||
// removed the clipping of 8cc but not the underlying problem: the chip is a top-level
|
||||
// popup that Fit()s to its text, so a long sentence simply grew past the right edge of the canvas
|
||||
// and hung over the window. Wrapping to the room actually available is what makes the earlier
|
||||
// promise — "a sentence can be a sentence" — true at every window width, including the charter's
|
||||
@@ -1274,7 +1274,7 @@ void DesignCanvas::place_status_hud()
|
||||
const wxPoint bl = m_canvas_widget->ClientToScreen(
|
||||
wxPoint(kLeftInset, cs.GetHeight() - hs.GetHeight() - 12));
|
||||
// No Raise() and no focus juggling: a popup neither takes focus nor falls behind. This was
|
||||
// caught with SNAPORCA_KEYTRACE — shift+S logged a line, the following R logged nothing, and
|
||||
// caught with ORCA_CAD_KEYTRACE — shift+S logged a line, the following R logged nothing, and
|
||||
// the only thing between them was the first status update showing this window.
|
||||
if (!m_status_hud->IsShown()) m_status_hud->Show(); // Show before Move (GTK ignores pre-map Move)
|
||||
m_status_hud->Move(bl);
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
void set_on_segment_drawn(std::function<void(double, double)> cb);
|
||||
void set_on_cursor_metrics(std::function<void(double, double, bool)> cb);
|
||||
void set_on_solve_state(std::function<void(int, bool, bool)> cb); // dof, ok, has_constraints
|
||||
// Live per-step guidance from the armed sketch tool (mode, step, picks). snaporca-1c0c.
|
||||
// Live per-step guidance from the armed sketch tool (mode, step, picks). 1c0c.
|
||||
void set_on_sketch_step(std::function<void(DesignSketchTool::Mode, int, int)> cb);
|
||||
void apply_segment_length(double len); // exact length, then commit & repaint
|
||||
void keep_segment_as_drawn(); // commit as-drawn & repaint
|
||||
@@ -219,12 +219,12 @@ public:
|
||||
void set_highlight_sketches(std::vector<std::pair<int, ColorRGBA>> hl);
|
||||
void set_datum_planes(std::vector<SketchPlane> planes,
|
||||
std::vector<Vec2d> sizes = {}); // draw datum/reference planes (u/v extents)
|
||||
// Mate connectors, drawn as frames so their verse and polarity are visible (snaporca-wgsc).
|
||||
// Mate connectors, drawn as frames so their verse and polarity are visible (wgsc).
|
||||
void set_mate_connectors(std::vector<DesignSketchTool::MateConnectorGlyph> g);
|
||||
void set_mate_links(std::vector<std::pair<Vec3d, Vec3d>> l);
|
||||
void set_body_highlight(bool on); // tint the solid when its feature is tree-selected
|
||||
// The status line, shown along the BASE OF THE VIEWPORT rather than in the side panel:
|
||||
// the panel clips it at ~73 characters with no warning (snaporca-8cc), the viewport's
|
||||
// the panel clips it at ~73 characters with no warning (8cc), the viewport's
|
||||
// bottom margin has the whole window width to spare. Empty text hides it.
|
||||
void set_status_text(const wxString& text, const wxColour& colour);
|
||||
// Take the status line down / bring it back when the Design page leaves and re-enters view.
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "slic3r/GUI/MainFrame.hpp"
|
||||
#include "slic3r/GUI/GUI_ObjectList.hpp"
|
||||
|
||||
// English-only pin for the Design tab (see snaporca-design-ux-contract): one lever
|
||||
// English-only pin for the Design tab (see design-ux-contract): one lever
|
||||
// de-translates this whole TU so our strings never half-translate against the host's
|
||||
// localized chrome. Host UI still follows the app locale; only this tab is pinned EN.
|
||||
// GOTCHA: every _L(...) in this file must take a STRING LITERAL (FromUTF8 wants const char*).
|
||||
@@ -452,7 +452,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
}
|
||||
};
|
||||
m_keys_sketch['Q'] = [this] {
|
||||
// With geometry selected, Q converts THAT geometry (snaporca-6zic) — the reading
|
||||
// With geometry selected, Q converts THAT geometry (6zic) — the reading
|
||||
// everyone arrives with from other sketchers. With nothing selected it keeps its
|
||||
// old meaning: arm construction for whatever you draw next.
|
||||
if (m_viewport && m_viewport->is_sketching() &&
|
||||
@@ -547,7 +547,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// still BUILT — that is what registers its "fly:<family>#<row>" address and its Shift+key —
|
||||
// but it is never placed on the bar. Hiding rather than skipping construction is deliberate:
|
||||
// the addresses are created inside the widget-building loops, so not building would silently
|
||||
// delete 42 verbs from the offer while they still rendered. snaporca-7ih records the cleanup
|
||||
// delete 42 verbs from the offer while they still rendered. 7ih records the cleanup
|
||||
// that lets the construction go away too.
|
||||
// What stays: the two doc-row imports (consumed by add_doc below) and the view controls,
|
||||
// which are chrome_only in the atlas and so have no offer row to fall back on.
|
||||
@@ -577,7 +577,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// outright for a family the bar no longer carries. It used to sit INSIDE the build
|
||||
// loop, so a retired family still had to be constructed and then Hide()n: skipping it
|
||||
// would have deleted 42 verbs from the offer while their rows still rendered and did
|
||||
// nothing when picked. snaporca-7ih.
|
||||
// nothing when picked. 7ih.
|
||||
// Keyed on "fly:<family>#<row>" so the generated table can name a variant without the
|
||||
// item struct growing a field at 26 call sites.
|
||||
for (size_t i = 0; i < vars.size(); ++i) {
|
||||
@@ -746,7 +746,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// Thicken and were then asked to point at something. Reached from the offer the
|
||||
// verb is invoked ON a face, so discarding it opened the card reading "(pick a
|
||||
// solid face)" over an immediate "thicken: face not found" — the user pointed at
|
||||
// the face and the card said it could not find one. snaporca-kgx.
|
||||
// the face and the card said it could not find one. kgx.
|
||||
// The index is per-body, so it only survives if the body combo landed on the body
|
||||
// it came from; selected_body_default() above returns exactly that when valid.
|
||||
if (m_thicken_body->GetSelection() != m_sel_solid_body)
|
||||
@@ -1267,7 +1267,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// The offer reaches each tool by its ratified address; without these the offer could
|
||||
// name a family but only ever arm its FIRST tool: picking "Rectangle" ran key:R and
|
||||
// gave you a corner rectangle, with oblique and rounded unreachable. Keyed on the icon
|
||||
// id (already unique per family) so no call site grows an argument. snaporca-6vs.
|
||||
// id (already unique per family) so no call site grows an argument. 6vs.
|
||||
for (size_t i = 0; i < vars.size(); ++i) {
|
||||
const DesignSketchTool::Mode mode = vars[i].mode;
|
||||
const wxString hint = vars[i].hint;
|
||||
@@ -1423,7 +1423,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// the offer's Create > Polygon submenu. They used to sit inline in this row, then in a
|
||||
// sidebar card; both put the choice somewhere you had to leave the geometry to reach,
|
||||
// and the count cannot be recovered afterwards (a drawn polygon's inline editor offers
|
||||
// Side and Angle, never the count). snaporca-e1p.
|
||||
// Side and Angle, never the count). e1p.
|
||||
auto arm_polygon = [this, select_tool] {
|
||||
push_polygon_params();
|
||||
select_tool(DesignSketchTool::Mode::Polygon,
|
||||
@@ -1444,7 +1444,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// where you chose the tool — not behind a card you must open to discover it existed.
|
||||
// Each address opens the tool exactly as its shortcut does, then says which one.
|
||||
// The members are read at INVOCATION, not capture: the cards are built after this row.
|
||||
// snaporca-e1p.
|
||||
// e1p.
|
||||
auto open_feature = [this](int key) {
|
||||
auto it = m_keys_feature.find(key);
|
||||
if (it != m_keys_feature.end() && it->second) it->second();
|
||||
@@ -1745,7 +1745,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// NO plane row. A sketch takes its plane from what is picked in the VIEWPORT — a planar face
|
||||
// on a solid, or one of the reference-plane ghosts clicked in 3D — resolved by
|
||||
// sketch_plane_from_selection(). A three-row XY/XZ/YZ combo could not express either of those
|
||||
// targets, so it displayed a value that was at best redundant and at worst false. snaporca-e1p.
|
||||
// targets, so it displayed a value that was at best redundant and at worst false. e1p.
|
||||
|
||||
m_width = make_spin(m_cards, 20);
|
||||
form->Add(new wxStaticText(m_cards, wxID_ANY, _L("Width / X")), 0, wxALIGN_CENTER_VERTICAL);
|
||||
@@ -1808,7 +1808,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// tool — the offer's Create > Polygon submenu names the common side counts and the two
|
||||
// fits, and arming from there sets both. A spin field on the left could not be reached
|
||||
// without leaving the geometry, and the count is unrecoverable afterwards: the inline
|
||||
// editor a drawn polygon opens offers Side and Angle, never the count. snaporca-e1p.
|
||||
// editor a drawn polygon opens offers Side and Angle, never the count. e1p.
|
||||
}
|
||||
|
||||
// --- Extrude dialog (consumes the selected sketch) ---
|
||||
@@ -3027,7 +3027,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// on a solid, or one of the reference-plane ghosts — because that is where the user is
|
||||
// looking and pointing. A combo duplicated that decision somewhere the geometry could not
|
||||
// see it, and once a face could be picked it went further and displayed a stale row that
|
||||
// contradicted the real target. snaporca-e1p.
|
||||
// contradicted the real target. e1p.
|
||||
// Kept as a member, not a local: the card has to be able to STOP saying this. It asked
|
||||
// for a plane even when one had just been picked, directly contradicting the status line
|
||||
// two inches below it, which by then read "Sketching on XZ".
|
||||
@@ -3138,7 +3138,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// "slow double-click renames" the old comment promised does not survive wxGTK, which fires
|
||||
// ITEM_ACTIVATED first), none of the seven header icons renames, and F2 is a function key
|
||||
// nothing announces. A user who wants to name a sketch tries the row, and now the row
|
||||
// answers. snaporca-rename.
|
||||
// answers. rename.
|
||||
m_tree->Bind(wxEVT_TREE_ITEM_RIGHT_CLICK, [this](wxTreeEvent& e) {
|
||||
m_tree->SelectItem(e.GetItem()); // right-click targets what it points at
|
||||
const int sel = tree_selection();
|
||||
@@ -3622,7 +3622,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// Selection no longer writes the status line: on_sketch_step owns it, says the same thing
|
||||
// for Select mode and — unlike this callback, which also fired while an edit-op mirrored its
|
||||
// picks into the selection — never claims "N selected, Delete removes them" in the middle of
|
||||
// a Mirror gesture, where Delete does nothing of the sort. snaporca-1c0c.
|
||||
// a Mirror gesture, where Delete does nothing of the sort. 1c0c.
|
||||
|
||||
// Onshape flow: clicking inside a closed-loop face commits the sketch and opens
|
||||
// the Extrude dialog (with a ghost preview) targeting that sketch.
|
||||
@@ -3667,7 +3667,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// exists to remove. Only a stroke hit carries an entity (an interior click is a region,
|
||||
// not a line), so a click inside a loop deliberately leaves the field alone rather than
|
||||
// resetting it to something arbitrary. The sketch picker follows the same pick, so
|
||||
// pointing at a line in a different sketch retargets both together. snaporca-3648.
|
||||
// pointing at a line in a different sketch retargets both together. 3648.
|
||||
if (m_active == Tool::Rib && entity >= 0) {
|
||||
if (m_rib_sketch != nullptr)
|
||||
for (unsigned i = 0; i < m_rib_sketch->GetCount(); ++i)
|
||||
@@ -3741,7 +3741,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
m_sel_solid_edge = (level == 3) ? edge : -1;
|
||||
m_sel_solid_vertex = (level == 4);
|
||||
// Keep the hit face even at whole-body level: the cycle's first click means "this body",
|
||||
// but the user pointed AT a face and a sketch should be able to use it. snaporca-3a2.
|
||||
// but the user pointed AT a face and a sketch should be able to use it. 3a2.
|
||||
m_pick_face_body = (level >= 1) ? body : -1;
|
||||
m_pick_face = (level >= 1) ? face : -1;
|
||||
// Last pick wins: selecting a solid drops any stale committed-sketch loop selection.
|
||||
@@ -3762,7 +3762,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
if (m_active == Tool::Dressup) { sync_dressup_target(); update_fillet_gizmo(); refresh_preview(); }
|
||||
// Boolean card open: the VIEWPORT is how you choose the two operands. Until now they
|
||||
// could only come from two combos — the one control the charter names for this tool
|
||||
// (e1p item 4), and the same pair snaporca-7xx caught silently resolving every row to
|
||||
// (e1p item 4), and the same pair 7xx caught silently resolving every row to
|
||||
// index 0. The highlight already flowed card -> viewport; this closes the loop the
|
||||
// other way. First pick is the target (kept), second is the tool (consumed); the
|
||||
// combos mirror both, so the typed half of L2 still works and still round-trips.
|
||||
@@ -3787,7 +3787,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
}
|
||||
}
|
||||
// Mirror card open: the body you point at is the body that gets mirrored. Same one-way
|
||||
// flow Boolean had (snaporca-310o) and the same fix — the combo stays as the typed half.
|
||||
// flow Boolean had (310o) and the same fix — the combo stays as the typed half.
|
||||
// Only one operand here, so there is no slot to alternate and no swap to do.
|
||||
if (m_active == Tool::Mirror && m_sel_solid_body >= 0 && m_mirror_body != nullptr &&
|
||||
m_sel_solid_body < int(m_mirror_body->GetCount())) {
|
||||
@@ -3914,12 +3914,12 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
m_status->SetForegroundColour(wxNullColour);
|
||||
const int nb = int(m_doc.bodies.size());
|
||||
const wxString bodytag = (nb > 1) ? wxString::Format(_L("Body %d "), body + 1) : wxString();
|
||||
// Each sub-element line ends by naming the NEXT click (snaporca-gem). Escalation to the
|
||||
// Each sub-element line ends by naming the NEXT click (gem). Escalation to the
|
||||
// whole body is a gesture nothing on screen would otherwise reveal, and the status line
|
||||
// is the only surface that can teach it at the moment it applies. It REPLACES the old
|
||||
// per-level verb hints ("right-click to push/pull it", "Fillet/Chamfer to dress it")
|
||||
// rather than joining them: the line is clipped at the panel edge past ~55 characters
|
||||
// (set_status's Wrap() does not take effect — snaporca-8cc), and those verbs are shown
|
||||
// (set_status's Wrap() does not take effect — 8cc), and those verbs are shown
|
||||
// with their icons in the offer anyway, while this gesture is shown nowhere else.
|
||||
// Both clauses fit now that the line is drawn over the viewport instead of squeezed
|
||||
// into the panel. Say "what applies to it", never "verbs" — that is this codebase's
|
||||
@@ -4173,13 +4173,13 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// select_tool() is what the sketch keys call — so the first letter after entering
|
||||
// sketch mode fell through to the feature map, matched nothing (feature keys are
|
||||
// Shift+letter), and did nothing. The mouse worked only because the toolbar flyout
|
||||
// reaches select_tool() directly. That is why all 17 keys read as dead. snaporca-0ud.
|
||||
// reaches select_tool() directly. That is why all 17 keys read as dead. 0ud.
|
||||
const bool sketch_mode = (m_ui_mode == UiMode::Sketch);
|
||||
// Never steal editing keys from a focused text field or an open in-canvas value field —
|
||||
// Delete/Ctrl+Z there must edit the text, not the model.
|
||||
const bool in_text = (dynamic_cast<wxTextCtrl*>(wxWindow::FindFocus()) != nullptr)
|
||||
|| (m_viewport && m_viewport->inline_busy());
|
||||
if (getenv("SNAPORCA_KEYTRACE")) {
|
||||
if (getenv("ORCA_CAD_KEYTRACE")) {
|
||||
wxWindow* fw = wxWindow::FindFocus();
|
||||
fprintf(stderr, "[KEYTRACE] key=%d ui_mode=%d is_sketching=%d in_text=%d inline_busy=%d focus=%s\n",
|
||||
key, int(m_ui_mode), (m_viewport && m_viewport->is_sketching()) ? 1 : 0, in_text ? 1 : 0,
|
||||
@@ -4256,7 +4256,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
// Delete — the selected sketch entities (or the last drawn one if none is selected), or the
|
||||
// selected feature in Feature mode. Focus-independent, same reason as undo above.
|
||||
// WXK_BACK too: on a keyboard whose Del is a chord (every laptop this runs on), Del is
|
||||
// the one destructive key nobody can reach, and Backspace is what users press. snaporca-oql1.
|
||||
// the one destructive key nobody can reach, and Backspace is what users press. oql1.
|
||||
if (!in_text && (key == WXK_DELETE || (key == WXK_BACK && sketching))) {
|
||||
if (sketching) { m_viewport->delete_selected_or_last_sketch_entity(); return; }
|
||||
if (m_ui_mode == UiMode::Feature && m_active == Tool::None
|
||||
@@ -4451,7 +4451,7 @@ void DesignPanel::set_ui_mode(UiMode m)
|
||||
if (m != UiMode::Sketch) m_sketch_on.clear(); // no stale "on the picked face" on the next hint
|
||||
// The DoF readout describes a SKETCH's constraint state, so it means nothing back in Feature
|
||||
// mode — where it nonetheless stayed on screen after every Confirm, Cancel and Escape
|
||||
// (snaporca-752). Cleared here rather than at those three exits because this is the one place
|
||||
// (752). Cleared here rather than at those three exits because this is the one place
|
||||
// all of them pass through, and a fourth exit added later would otherwise reintroduce it.
|
||||
// Constrain mode keeps it: that is where the number is the whole point.
|
||||
if (m == UiMode::Feature && m_dof_status != nullptr) {
|
||||
@@ -4691,7 +4691,7 @@ static void run_off_ui_thread(wxWindow* parent, const wxString& message, const s
|
||||
//
|
||||
// This used to be written in exactly ONE place — on_commit(), as a side effect of Commit to
|
||||
// Plate — so a user who modelled for an hour and pressed Ctrl+S saved a project containing no
|
||||
// feature history at all, and the app reported success (snaporca-vjk5). The 3MF exporter was
|
||||
// feature history at all, and the app reported success (vjk5). The 3MF exporter was
|
||||
// never at fault: nothing had handed it a recipe.
|
||||
//
|
||||
// Every save path (Ctrl+S, Save As, autosave, crash recovery) reads model.cad_recipe, so
|
||||
@@ -5080,7 +5080,7 @@ void DesignPanel::on_add_extrude()
|
||||
} else if (extrude_uses_loop()) {
|
||||
// Extrude just the selected loop (its entity subset), leaving the source sketch's
|
||||
// other loops intact and still selectable.
|
||||
if (::getenv("SNAPORCA_PICK_TRACE"))
|
||||
if (::getenv("ORCA_CAD_PICK_TRACE"))
|
||||
std::fprintf(stderr, "[pick] on_add_extrude: feat=%d reg=%d ents=%zu\n",
|
||||
m_extrude_sketch_ref, m_sel_sketch_region,
|
||||
m_viewport->selected_loop_entities().size());
|
||||
@@ -5152,11 +5152,11 @@ void DesignPanel::on_add_dressup()
|
||||
// Hole and Thread LATCH the geometry they were opened or picked on; Thicken / Shell / Draft read
|
||||
// the live selection instead. Both models are right for what they are — a placement tool with its
|
||||
// own plane state, versus an operation whose operand IS the selected face — and the latch is the
|
||||
// kinder of the two now that a click on empty canvas clears the selection (snaporca-od0): a stray
|
||||
// kinder of the two now that a click on empty canvas clears the selection (od0): a stray
|
||||
// click costs a Thicken pick, and costs a Hole nothing. What was missing is that nothing in the
|
||||
// Hole/Thread card NAMED the latched face, so after such a click the only words on screen were
|
||||
// the viewport's "Nothing selected" — over a ghost still drawn on the face Confirm would drill.
|
||||
// That reads as a contradiction and was filed as one (snaporca-200). The card now says what it
|
||||
// That reads as a contradiction and was filed as one (200). The card now says what it
|
||||
// holds, the way the other three cards already do. Pass -1 for "none, using the plane dropdown".
|
||||
void DesignPanel::set_hole_target_label(int face)
|
||||
{
|
||||
@@ -6025,7 +6025,7 @@ SketchPlane DesignPanel::plane_from_choice(int row) const
|
||||
// clicking one of the ghost planes in 3D (on_datum_base_picked) rather than by opening the combo.
|
||||
// Before this, a picked face was ignored and the only way onto it was to build a Coincident datum
|
||||
// plane first and then find it in a dropdown — three steps and a junk feature in the tree for the
|
||||
// most common gesture in solid modelling. snaporca-3a2.
|
||||
// most common gesture in solid modelling. 3a2.
|
||||
SketchPlane DesignPanel::sketch_plane_from_selection(wxString& what) const
|
||||
{
|
||||
SketchPlane p;
|
||||
@@ -6080,7 +6080,7 @@ bool DesignPanel::sketch_map_applies() const
|
||||
// actually REACHED, so the menu describes what is highlighted — a header that names a face while
|
||||
// the whole body is lit would be lying, and this menu's whole value is that it tells the truth
|
||||
// about the selection. (Sketching on the face you merely clicked is unaffected: that path is
|
||||
// sketch_plane_from_selection, which deliberately uses m_pick_face. snaporca-3a2.)
|
||||
// sketch_plane_from_selection, which deliberately uses m_pick_face. 3a2.)
|
||||
int DesignPanel::offer_selection_kind() const
|
||||
{
|
||||
if (sketch_map_applies()) {
|
||||
@@ -6203,7 +6203,7 @@ void DesignPanel::set_status(const wxString& text)
|
||||
// sets the colour on it just before calling here, so this stays the one place that knows
|
||||
// both. What the user reads is drawn along the BASE OF THE VIEWPORT: in the panel the line
|
||||
// was clipped at ~73 characters with no warning and no wrap (Wrap() never took effect —
|
||||
// snaporca-8cc), which silently length-limited every hint in the tab. The viewport's bottom
|
||||
// 8cc), which silently length-limited every hint in the tab. The viewport's bottom
|
||||
// margin has the whole window width, so a sentence can be a sentence.
|
||||
if (m_viewport != nullptr) {
|
||||
// wxNullColour means "no opinion", and the dark default text colour is nearly invisible
|
||||
@@ -6218,7 +6218,7 @@ void DesignPanel::set_status(const wxString& text)
|
||||
}
|
||||
|
||||
|
||||
// The sentence for the step the armed sketch tool is on (snaporca-1c0c). One table, so a tool's
|
||||
// The sentence for the step the armed sketch tool is on (1c0c). One table, so a tool's
|
||||
// gesture is described in one place and the description cannot drift from the code that reads the
|
||||
// clicks: the step counts here are the ones DesignSketchTool::render previews and on_mouse
|
||||
// consumes. `step` = anchors already placed (edit-ops: 0 none, 1 first pick down, 2 ready to
|
||||
@@ -6414,7 +6414,7 @@ wxMenuItem* DesignPanel::append_offer_item(wxMenu* menu, int id, const wxString&
|
||||
// honest source for that is the loop that builds the rows.
|
||||
static void offer_trace(const char* fmt, ...)
|
||||
{
|
||||
static const bool on = std::getenv("SNAPORCA_KEYTRACE") != nullptr;
|
||||
static const bool on = std::getenv("ORCA_CAD_KEYTRACE") != nullptr;
|
||||
if (!on) return;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@@ -6430,13 +6430,13 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
|
||||
const int kind = offer_selection_kind();
|
||||
const uint32_t bit = offer_bit(OfferSel(kind));
|
||||
// Which verb MAP applies is a question about the MODE, not about whether a session is
|
||||
// running — the same distinction the keyboard already had to learn (snaporca-0ud). Gated on
|
||||
// running — the same distinction the keyboard already had to learn (0ud). Gated on
|
||||
// is_sketching() the offer opened on entering a sketch showing the FEATURE rows, every one
|
||||
// of them refusing the sketch selection, so it read as a menu of nine dead entries.
|
||||
const bool sketching = sketch_map_applies();
|
||||
// The offer ladder reads THIS, not the pixels: the trace is emitted from the same loop that
|
||||
// builds the menu, so it cannot drift from what the user is shown. Gated on the existing
|
||||
// SNAPORCA_KEYTRACE so a rig run needs one env var, not two. snaporca-<offer ladder>.
|
||||
// ORCA_CAD_KEYTRACE so a rig run needs one env var, not two. <offer ladder>.
|
||||
offer_trace("open kind=%d sketching=%d bodies=%d", kind, sketching ? 1 : 0,
|
||||
int(m_doc.bodies.size()));
|
||||
|
||||
@@ -6551,7 +6551,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
|
||||
}
|
||||
}
|
||||
|
||||
// --- Mate palette section (snaporca-lukg part B) ---
|
||||
// --- Mate palette section (lukg part B) ---
|
||||
// Fed by CadDocument::mate_options() so the offer can never disagree with the kernel about
|
||||
// which assembly mates a connector pair admits. Shown only when the document holds at least
|
||||
// two ENABLED CoordSys features: below that the whole section would be one permanently dead
|
||||
@@ -7020,7 +7020,7 @@ wxString DesignPanel::idle_hint() const
|
||||
: _L("No solid yet — select a sketch and right-click it to Extrude.");
|
||||
}
|
||||
|
||||
// The Design tab is no longer the visible page (snaporca-dlj). The status line is a popup floating
|
||||
// The Design tab is no longer the visible page (dlj). The status line is a popup floating
|
||||
// over the GL canvas, so it does NOT go away when this page does — it stayed up over Prepare and
|
||||
// over the home screen, still reading like a live Design selection ("selected (whole body) —
|
||||
// right-click for what applies to it") on a tab that has no such selection and no such menu.
|
||||
@@ -7123,7 +7123,7 @@ void DesignPanel::refresh_tree()
|
||||
// recompute() returns FALSE for a document that has no solid ("no solid-producing features",
|
||||
// CadDocument.cpp) — which is precisely a document the user has only drawn sketches in. So
|
||||
// drawing a profile, pressing Confirm and saving wrote a 3MF with no orca_cad.bin in it
|
||||
// at all, and the app reported success: the whole design was gone on reopen (snaporca-mtav).
|
||||
// at all, and the app reported success: the whole design was gone on reopen (mtav).
|
||||
// The three sites that say "a lone sketch yields an empty body; that is expected" call
|
||||
// m_doc.recompute() directly and so never reached the sync either. One hook here covers all
|
||||
// of them, including the live sketch tool's own commit path.
|
||||
@@ -9092,7 +9092,7 @@ void DesignPanel::load_feature_into_dialog(const CadFeature& f)
|
||||
m_hole_through->SetValue(f.hole_through);
|
||||
m_hole_x->SetValue(f.hole_x);
|
||||
m_hole_y->SetValue(f.hole_y);
|
||||
// Re-latch the on-face state FROM THE STORED FEATURE (snaporca-uif9). m_hole_on_face is
|
||||
// Re-latch the on-face state FROM THE STORED FEATURE (uif9). m_hole_on_face is
|
||||
// only ever cleared by the Hole flyout and by the plane combo, so after any on-face hole
|
||||
// it stays true — and a re-edit then drilled on whatever face was latched last, which may
|
||||
// be a different face, a different body, or a body since rebuilt. f is the only source
|
||||
@@ -9123,7 +9123,7 @@ void DesignPanel::load_feature_into_dialog(const CadFeature& f)
|
||||
m_thread_x->SetValue(f.thread_x);
|
||||
m_thread_y->SetValue(f.thread_y);
|
||||
if (m_thread_std) m_thread_std->SetSelection(0); // Custom: spins reflect the stored feature
|
||||
// Same latch, same failure, same fix as Hole above (snaporca-uif9).
|
||||
// Same latch, same failure, same fix as Hole above (uif9).
|
||||
m_thread_on_face = !is_base_plane(f.plane, m_doc.modeling_origin);
|
||||
m_thread_face_plane = f.plane;
|
||||
m_thread_face_body = m_thread_on_face ? f.target_body : -1;
|
||||
@@ -9702,7 +9702,7 @@ CadFeature DesignPanel::build_candidate(Tool t) const
|
||||
// The plane is STRUCTURAL, like Extrude's profile source. While EDITING it is preserved
|
||||
// from the seeded original — the card carries no plane control and the old combo silently
|
||||
// collapsed a face plane to a base plane through the modeling origin. While ADDING it
|
||||
// comes from what is picked in the viewport. snaporca-e1p.
|
||||
// comes from what is picked in the viewport. e1p.
|
||||
if (!editing) { wxString where; f.plane = sketch_plane_from_selection(where); }
|
||||
f.width = m_width->GetValue();
|
||||
f.height = m_height->GetValue();
|
||||
@@ -10032,7 +10032,7 @@ void DesignPanel::update_fillet_gizmo()
|
||||
}
|
||||
|
||||
// Push the active Hole card's plane + position + diameter/depth to the viewport gizmo.
|
||||
// Grey the FEATURE buttons whose tool cannot run yet, and say why in the tooltip (snaporca-o9j).
|
||||
// Grey the FEATURE buttons whose tool cannot run yet, and say why in the tooltip (o9j).
|
||||
// Tommaso reported the array controls as MISSING; they were not, but Pattern with no body
|
||||
// accepted the click, opened nothing, and wrote its refusal somewhere other than where the click
|
||||
// happened — from the user's seat that is indistinguishable from a dead button. A control that
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
void clear_document(); // New Project / Open Project: drop the document with the project
|
||||
// Rebuild off the UI thread (progress dialog only if it turns out to be slow), so a feature
|
||||
// op on a heavy imported solid does not freeze the window. Returns m_doc.recompute()'s result.
|
||||
// Push the document's recipe into the Model so ANY save path persists it (snaporca-vjk5).
|
||||
// Push the document's recipe into the Model so ANY save path persists it (vjk5).
|
||||
void sync_recipe_to_model();
|
||||
bool recompute_guarded(const wxString& message);
|
||||
|
||||
@@ -173,7 +173,7 @@ private:
|
||||
// Which body a tool should act on when it opens: the one picked in the VIEWPORT, else
|
||||
// the first. Selection comes first and the tool consumes it — every body combo used to
|
||||
// default to index 0, so picking body 3 and opening Mirror silently mirrored body 1.
|
||||
// Clamped to the list, so it is safe to hand straight to SetSelection. snaporca-e1p.
|
||||
// Clamped to the list, so it is safe to hand straight to SetSelection. e1p.
|
||||
int selected_body_default() const;
|
||||
void populate_body_choices(int as_of_feature = -1);
|
||||
// Fill `c` with the bodies as they existed just before `as_of_feature` and select
|
||||
@@ -279,7 +279,7 @@ private:
|
||||
// The plane the Thread tool builds on: a picked cylindrical face (axis) or the dropdown.
|
||||
SketchPlane thread_plane() const;
|
||||
// Name the geometry the card has LATCHED, so it never has to be inferred from the viewport.
|
||||
// Pass -1 for "none, falling back to the plane dropdown". See snaporca-200.
|
||||
// Pass -1 for "none, falling back to the plane dropdown". See 200.
|
||||
void set_hole_target_label(int face);
|
||||
void set_thread_target_label(int face, int edge);
|
||||
CadFeature build_candidate(Tool t) const;
|
||||
@@ -489,13 +489,13 @@ private:
|
||||
// Polygon's two parameters are chosen FROM THE TOOL, in the offer's Polygon submenu, not
|
||||
// from a card on the left: the side count cannot be edited after drawing (the inline editor
|
||||
// offers Side and Angle only), so it has to be settled at the moment the tool is armed —
|
||||
// which is exactly where the offer already is. snaporca-e1p.
|
||||
// which is exactly where the offer already is. e1p.
|
||||
int m_poly_sides{6}; // 3..64; the submenu names the common ones
|
||||
bool m_poly_circumscribed{false};
|
||||
|
||||
// Which reference plane a sketch falls back to when no face is picked: 0/1/2 = XY/XZ/YZ,
|
||||
// >=3 indexes resolve_datum_planes(). Set by CLICKING a ghost plane in the viewport — there is
|
||||
// deliberately no dropdown for it. snaporca-e1p.
|
||||
// deliberately no dropdown for it. e1p.
|
||||
int m_ref_plane{0};
|
||||
// m_ref_plane is always a VALID plane, so it cannot itself distinguish "the user chose XY"
|
||||
// from "nobody has chosen anything yet". This does.
|
||||
@@ -703,7 +703,7 @@ private:
|
||||
// The face actually under the last solid click, INDEPENDENT of the whole/face/edge cycle level.
|
||||
// The first click on a solid selects the WHOLE body, but the ray has already resolved which face
|
||||
// it hit and the callback passes it. "Sketch on the face I clicked" must not require discovering
|
||||
// that a second click refines the selection, so keep it instead of throwing it away. snaporca-3a2.
|
||||
// that a second click refines the selection, so keep it instead of throwing it away. 3a2.
|
||||
int m_pick_face_body{-1};
|
||||
int m_pick_face{-1};
|
||||
// What the live sketch was actually opened on ("the picked face", "XY", a datum's name), so the
|
||||
@@ -767,7 +767,7 @@ private:
|
||||
double m_hole_umin{0}, m_hole_umax{0}, m_hole_vmin{0}, m_hole_vmax{0};
|
||||
// Says which face the latch above is holding. Thicken/Shell/Draft show theirs because their
|
||||
// face IS the live selection; this one has to be shown precisely BECAUSE it is not, and the
|
||||
// status line goes on saying "Nothing selected" while the ghost keeps drilling. snaporca-200.
|
||||
// status line goes on saying "Nothing selected" while the ghost keeps drilling. 200.
|
||||
wxStaticText* m_hole_target_label{nullptr};
|
||||
|
||||
ComboBox* m_thread_plane{nullptr};
|
||||
@@ -885,7 +885,7 @@ private:
|
||||
// The guidance sentence for the step the armed sketch tool is on, kept so a transient
|
||||
// readout (the live length/angle while a segment is being dragged) can be appended to it
|
||||
// instead of replacing it — the guidance used to vanish on the first mouse move after a
|
||||
// click, which is precisely when it is needed. snaporca-1c0c.
|
||||
// click, which is precisely when it is needed. 1c0c.
|
||||
wxString m_sketch_step;
|
||||
// mode is a DesignSketchTool::Mode; passed as an int because this header deliberately does
|
||||
// not include the tool's, and the .cpp (which does) casts it back.
|
||||
|
||||
@@ -308,7 +308,7 @@ void DesignSketchTool::set_tool(Mode mode)
|
||||
|
||||
void DesignSketchTool::cancel()
|
||||
{
|
||||
close_session_chrome(); // same orphaned-field freeze as finish() — see snaporca-yce
|
||||
close_session_chrome(); // same orphaned-field freeze as finish() — see yce
|
||||
m_active = false;
|
||||
m_step_mode_last = -1;
|
||||
m_points.clear();
|
||||
@@ -453,7 +453,7 @@ void DesignSketchTool::delete_selected()
|
||||
// now-deleted entity and freeze the flow" — it was simply never called from here. Measured:
|
||||
// delete a rectangle whose Width/Height were still queued, draw a circle, type its radius —
|
||||
// the field opens, the digits go in, and the radius does not move, because the field belongs
|
||||
// to a rectangle that no longer exists. snaporca-ua9g.
|
||||
// to a rectangle that no longer exists. ua9g.
|
||||
reset_autoedit();
|
||||
|
||||
// And re-solve, so the sketch's reported degrees of freedom describe the sketch that is
|
||||
@@ -463,7 +463,7 @@ void DesignSketchTool::delete_selected()
|
||||
if (on_selection_changed) on_selection_changed(0);
|
||||
}
|
||||
|
||||
// Convert the selection to/from construction geometry (snaporca-6zic). The Construction
|
||||
// Convert the selection to/from construction geometry (6zic). The Construction
|
||||
// checkbox only ever set the mode for what you draw NEXT, so a line drawn as real geometry
|
||||
// could never become a guide, nor a guide become real. Whole Feature groups flip together:
|
||||
// a rectangle is four Line entities and converting three of them is never what was meant.
|
||||
@@ -1390,7 +1390,7 @@ std::string DesignSketchTool::dimtype_title(DimType k) const {
|
||||
// tool at once, which reads like a total product failure and is not necessarily one.
|
||||
static void trace_autoedit(const char* why, size_t n)
|
||||
{
|
||||
if (!std::getenv("SNAPORCA_UXTRACE")) return;
|
||||
if (!std::getenv("ORCA_CAD_UXTRACE")) return;
|
||||
fprintf(stderr, "[UX] autoedit %s steps=%zu\n", why, n);
|
||||
fflush(stderr);
|
||||
}
|
||||
@@ -2408,7 +2408,7 @@ bool DesignSketchTool::try_add_constraints(const std::vector<SketchEntityConstra
|
||||
m_constraints.resize(mark); // roll back the conflicting batch
|
||||
// No re-solve to "restore": a failed solve no longer touches the geometry
|
||||
// (SketchSolver.cpp only writes back on success), so m_entities still holds the
|
||||
// prior solved state exactly. snaporca-pl5.
|
||||
// prior solved state exactly. pl5.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2516,11 +2516,11 @@ void DesignSketchTool::infer_auto_constraints(int base, double ang_tol_rad, doub
|
||||
// never costs the others. Every rule only pins a relation that is ALREADY true, so
|
||||
// nothing the user drew is moved by this.
|
||||
// A SCRIPTED ADD IS NOT A DRAWN GESTURE — the rule this function already states at its
|
||||
// bulk call site, which passes zero tolerances for exactly that reason (snaporca-8xg1).
|
||||
// bulk call site, which passes zero tolerances for exactly that reason (8xg1).
|
||||
// Relational inference must obey it too, and for a second reason beyond tolerance:
|
||||
// EqualRadius couples entities that are geometrically far apart, so on a real drawing it
|
||||
// merges independent connected components into one huge system and defeats the
|
||||
// component partitioning that makes large sketches solvable at all (snaporca-yww4).
|
||||
// component partitioning that makes large sketches solvable at all (yww4).
|
||||
// Measured 2026-08-31 on the corpus rung: geometry stayed correct (32/32 sheets clean)
|
||||
// but seven of the largest sheets hit main-thread timeout — MPD681 among them, the very
|
||||
// sheet named in the comment at the bulk call site. Exact-equality would not save it
|
||||
@@ -2651,7 +2651,7 @@ bool DesignSketchTool::add_imported_regions(
|
||||
// Art is not "just drawn", so it must NOT enter the draw-then-edit queue. Without this the
|
||||
// glyph contours are treated as fresh entities and a Length field opens on the first of
|
||||
// them — on a word, that is one value editor per segment, and an open field freezes the
|
||||
// canvas (snaporca-yce). reset_autoedit() marks every entity as already seen.
|
||||
// canvas (yce). reset_autoedit() marks every entity as already seen.
|
||||
reset_autoedit();
|
||||
// The new lines carry no constraints, so the solver has nothing to move; resolve anyway so
|
||||
// the degrees-of-freedom readout counts them instead of going stale.
|
||||
@@ -3122,7 +3122,7 @@ void DesignSketchTool::hit_display_sketch(const DisplaySketch& d, const Vec2d& p
|
||||
{
|
||||
const std::vector<RegionLoop> loops = region_loops(d.entities);
|
||||
// What did the sketch decompose into, and what is under the click? This is the trace that
|
||||
// settled snaporca-txp8 — it prints the loop table with each loop's hole count, so
|
||||
// settled txp8 — it prints the loop table with each loop's hole count, so
|
||||
// "containment is wrong" and "the click landed elsewhere" stop being indistinguishable.
|
||||
// Guarded rather than merely silent: hit_display_sketch runs on every pick, and the message
|
||||
// costs a string build and a heap allocation per loop even when nothing consumes it.
|
||||
@@ -3160,7 +3160,7 @@ void DesignSketchTool::hit_display_sketch(const DisplaySketch& d, const Vec2d& p
|
||||
if (h >= 0 && h < int(loops.size()) && point_in_poly(p, loops[h].poly)) { in_hole = true; break; }
|
||||
if (!in_hole) { face_feat = d.feature; face_reg = r; }
|
||||
}
|
||||
// edge_ent is printed because it is now DELIVERED (snaporca-3648) — a tool can ask for the
|
||||
// edge_ent is printed because it is now DELIVERED (3648) — a tool can ask for the
|
||||
// line you pointed at, not just its loop, and "which entity did that click resolve to" is
|
||||
// otherwise unanswerable from outside.
|
||||
dp_pick_trace("region hit -> feat=%d reg=%d (edge_feat=%d edge_reg=%d edge_ent=%d)",
|
||||
@@ -3264,11 +3264,11 @@ void DesignSketchTool::select_body(int body)
|
||||
|
||||
// Pick tracing. Selection failures on a real desktop have repeatedly turned out to be an
|
||||
// event that never arrived rather than a ray that missed, and the two look identical from
|
||||
// the UI. Set SNAPORCA_PICK_TRACE=1 and the whole press->release->ray path narrates itself
|
||||
// the UI. Set ORCA_CAD_PICK_TRACE=1 and the whole press->release->ray path narrates itself
|
||||
// on stderr. Off by default: no cost, no noise.
|
||||
static bool dp_pick_trace_on()
|
||||
{
|
||||
static const bool on = ::getenv("SNAPORCA_PICK_TRACE") != nullptr;
|
||||
static const bool on = ::getenv("ORCA_CAD_PICK_TRACE") != nullptr;
|
||||
return on;
|
||||
}
|
||||
|
||||
@@ -3294,7 +3294,7 @@ static void dp_pick_trace(const char* fmt, ...)
|
||||
//
|
||||
// ponytail: crossing over a triangle sample set. A rectangle small enough to sit entirely
|
||||
// inside one flat triangle selects nothing — drag a bigger one, or click. Real multi-body
|
||||
// selection (and the homogeneous-set rule that goes with it) is snaporca-9xw.
|
||||
// selection (and the homogeneous-set rule that goes with it) is 9xw.
|
||||
void DesignSketchTool::pick_bodies_in_rectangle()
|
||||
{
|
||||
if (m_solid_mesh == nullptr || m_solid_tri_body == nullptr || m_solid_bodies == nullptr)
|
||||
@@ -3486,7 +3486,7 @@ bool DesignSketchTool::handle_solid_click(GLCanvas3D& canvas, const wxMouseEvent
|
||||
m_sel_vertex_pt = p.vertex_pt;
|
||||
m_solid_sel = p.kind;
|
||||
|
||||
// CLICK AGAIN ON THE SAME THING -> THE WHOLE BODY (snaporca-gem). Pointing at a face and
|
||||
// CLICK AGAIN ON THE SAME THING -> THE WHOLE BODY (gem). Pointing at a face and
|
||||
// pointing at its body are different intents, and until now only the rubber band could
|
||||
// express the second one — so the status line said "face 0 selected" while the user
|
||||
// believed they had taken the body, and every body verb had to opt into the face kinds to
|
||||
@@ -3823,23 +3823,23 @@ void DesignSketchTool::clear_extrude_gizmo()
|
||||
// cone travels, an open collar receives. No surveyed CAD system encodes this at all; both ends of
|
||||
// their mates are drawn identically, which is why "which part moves?" is a standing complaint.
|
||||
//
|
||||
// SNAPORCA_GLYPH=A|B selects the treatment while this is being judged on the rig:
|
||||
// ORCA_CAD_GLYPH=A|B selects the treatment while this is being judged on the rig:
|
||||
// A three short axis arms, no head differentiation (the Onshape baseline)
|
||||
// B one-sided Z arrow, filled vs open head (the proposal) -- default
|
||||
void DesignSketchTool::render_mate_connectors()
|
||||
{
|
||||
if (m_mate_connectors.empty()) return;
|
||||
static const bool style_A = [] {
|
||||
const char* s = ::getenv("SNAPORCA_GLYPH");
|
||||
const char* s = ::getenv("ORCA_CAD_GLYPH");
|
||||
return s && (*s == 'A' || *s == 'a');
|
||||
}();
|
||||
// The face treatment, on by default. Read every frame rather than latched in a static, so
|
||||
// toggling the preference takes effect on the next repaint instead of at the next launch —
|
||||
// it is a look, and a look you cannot A/B without restarting will not get compared.
|
||||
// SNAPORCA_GLYPH=D forces the disc regardless, which is how the rig drives the other branch.
|
||||
// ORCA_CAD_GLYPH=D forces the disc regardless, which is how the rig drives the other branch.
|
||||
const bool face_style = !style_A
|
||||
&& wxGetApp().app_config->get_bool("design_connector_face_glyph")
|
||||
&& [] { const char* s = ::getenv("SNAPORCA_GLYPH");
|
||||
&& [] { const char* s = ::getenv("ORCA_CAD_GLYPH");
|
||||
return !(s && (*s == 'D' || *s == 'd')); }();
|
||||
|
||||
const Camera& cam = wxGetApp().plater()->get_camera();
|
||||
@@ -4021,7 +4021,7 @@ void DesignSketchTool::render_mate_connectors()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// THE FACE TREATMENT of the mate connector (snaporca-x0kd). The disc + roll quadrant answers
|
||||
// THE FACE TREATMENT of the mate connector (x0kd). The disc + roll quadrant answers
|
||||
// "where is X" with a shape that has to be learned; a face does not. Face orientation is
|
||||
// hardwired perception -- a toddler reads a face's roll and verse with no instruction at all --
|
||||
// and that is the whole reason this exists. Default ON, switchable in Preferences for users who
|
||||
@@ -4053,7 +4053,7 @@ static const Vec2d kBearOutline[] = { // 12 verts, RDP eps 0.030, CCW
|
||||
static const Vec2d kBearChin[] = { // the CHIN BAR, flat. The muzzle is relief — see kBearCrest.
|
||||
{-0.2682, -0.3578}, {+0.2628, -0.3578}, {+0.2237, -0.1786},
|
||||
};
|
||||
// {cx, cy, r}: two eyes, then the cheek dot that carries handedness (snaporca-wi3z).
|
||||
// {cx, cy, r}: two eyes, then the cheek dot that carries handedness (wi3z).
|
||||
static const Vec3d kBearMarks[] = {
|
||||
{-0.1997, +0.1760, +0.0590},
|
||||
{+0.1947, +0.1760, +0.0590},
|
||||
@@ -6436,7 +6436,7 @@ DesignSketchTool::region_loops(const std::vector<SketchEntity>& ents) const
|
||||
|
||||
// NESTING. A loop drawn inside another one is that one's HOLE. Without this a sketch is
|
||||
// just N disjoint filled polygons, so "the plate with the hole" is not expressible and the
|
||||
// multi-loop kernel path (snaporca-88v) is unreachable from the viewport — which is exactly
|
||||
// multi-loop kernel path (88v) is unreachable from the viewport — which is exactly
|
||||
// what Tommaso hit: a rectangle with a circle inside extruded to a plain box, because only
|
||||
// the rectangle loop could be picked and only its entities were passed on.
|
||||
//
|
||||
@@ -6450,7 +6450,7 @@ DesignSketchTool::region_loops(const std::vector<SketchEntity>& ents) const
|
||||
// polygon being tested answers by rounding, so the same drawing can be read either way.
|
||||
// Measured on the StudyCadCam corpus: the engine and an independent containment check
|
||||
// disagreed on 6 of 39 sheets, and every disagreement was a probe point sitting on the other
|
||||
// loop's boundary. snaporca-5hvl.
|
||||
// loop's boundary. 5hvl.
|
||||
auto poly_area = [](const std::vector<Vec2d>& q) {
|
||||
double a2 = 0.0;
|
||||
for (size_t i = 0, j = q.size() - 1; i < q.size(); j = i++)
|
||||
@@ -6550,7 +6550,7 @@ int DesignSketchTool::region_at(const Vec2d& p) const
|
||||
|
||||
// ---- rendering --------------------------------------------------------------
|
||||
|
||||
// Chop a polyline into dashes (snaporca-imlq). Construction geometry is dashed in every CAD;
|
||||
// Chop a polyline into dashes (imlq). Construction geometry is dashed in every CAD;
|
||||
// this one painted it solid grey, which against the under-constrained orange reads as "another
|
||||
// line", not as "reference only". The dash and gap arrive in WORLD units — the caller scales them
|
||||
// by units-per-pixel, so the dash keeps its size on screen at any zoom instead of turning into a
|
||||
@@ -7986,7 +7986,7 @@ void DesignSketchTool::confirm_op()
|
||||
// The sources as they stand BEFORE any of this op's constraints exist. Two jobs: every
|
||||
// copy is reflected from the untouched original (so a batch that moves the sketch cannot
|
||||
// feed a later copy moved geometry), and the invariant at the bottom has something to
|
||||
// compare against. snaporca-mirror-slot.
|
||||
// compare against. mirror-slot.
|
||||
const std::vector<SketchEntity> before = m_entities;
|
||||
const size_t cmark = m_constraints.size();
|
||||
std::vector<std::pair<int, SketchEntity>> fresh; // copy index -> its pristine reflection
|
||||
@@ -8033,7 +8033,7 @@ void DesignSketchTool::confirm_op()
|
||||
// postcondition on the geometry, and if a source moved it keeps the copies — which are
|
||||
// exactly what the preview showed — and drops the whole constraint web that moved them.
|
||||
// Restoring the sources needs no re-solve: the pre-batch state was itself solved, and a
|
||||
// failed solve does not write back (snaporca-pl5).
|
||||
// failed solve does not write back (pl5).
|
||||
// BOTH HALVES. Watching only the sources caught the slot (whose web dragged everything)
|
||||
// and missed the rounded rectangle, where the solver held the sources still and put the
|
||||
// COPIES somewhere else: an arc has five degrees of freedom and Symmetric on centre plus
|
||||
@@ -8449,7 +8449,7 @@ const ColorRGBA* DesignSketchTool::sketch_hl_color(int feature) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Which step of the armed gesture is live, reported only when it moves (snaporca-1c0c). Called
|
||||
// Which step of the armed gesture is live, reported only when it moves (1c0c). Called
|
||||
// from render(), which is the one place EVERY state change passes through — a per-call-site
|
||||
// notification would have to be added to each of the thirty-odd tool branches and would be
|
||||
// forgotten by the next one. Cheap: three ints compared per frame.
|
||||
@@ -8753,7 +8753,7 @@ void DesignSketchTool::render(GLCanvas3D& canvas)
|
||||
// Mirror's is the axis, Fillet/Chamfer's is the first of the two lines — and until now
|
||||
// every pick painted the same white, so the picture could not answer "what did I select
|
||||
// as what". Violet, not cyan: cyan means SELECTED here and nothing else may wear it.
|
||||
// snaporca-vd6v.
|
||||
// vd6v.
|
||||
const bool op_ref = is_edit_op_mode() && int(i) == m_op_a;
|
||||
ColorRGBA col;
|
||||
if (editing_this) col = editing;
|
||||
@@ -8833,7 +8833,7 @@ void DesignSketchTool::render(GLCanvas3D& canvas)
|
||||
if (!sel_handles.empty()) draw_vertices(m_highlight_model, sel_handles, sel_col);
|
||||
|
||||
// Midpoint of every segment, drawn smaller and cooler than the endpoint handles
|
||||
// (snaporca-te8v). Without it the Midpoint snap is invisible: it exists in the
|
||||
// (te8v). Without it the Midpoint snap is invisible: it exists in the
|
||||
// inference engine but the user has nothing to aim at. Construction lines get one
|
||||
// too — you constrain to them as readily as to real geometry.
|
||||
std::vector<Vec2d> mids;
|
||||
@@ -9355,7 +9355,7 @@ int DesignSketchTool::add_entities_scripted(const std::vector<SketchEntity>& ent
|
||||
// the 39 corpus drawings the loops that came back wrong were all TINY (1.4 to 13 mm^2), out
|
||||
// by up to 7e-4 relative, because a 0.005 degree tilt on a 0.3 mm chord is inside 1e-4.
|
||||
// With zero, only a segment that is EXACTLY axis-aligned is constrained, and constraining
|
||||
// something already true cannot move it. snaporca-8xg1.
|
||||
// something already true cannot move it. 8xg1.
|
||||
// The weld window closes too. Two endpoints a micron apart are not the same point when a
|
||||
// caller typed both of them: on MPD681, 20 of 363 scripted segments were dragged onto a
|
||||
// common point up to 0.0021 mm away, because welding is TRANSITIVE and three vertices near
|
||||
@@ -9370,7 +9370,7 @@ int DesignSketchTool::add_entities_scripted(const std::vector<SketchEntity>& ent
|
||||
// while m_awaiting_length) and swallows every letter (in_text includes inline_busy()). The
|
||||
// symptom was that the first key and click after sketch_add did nothing until one Escape had
|
||||
// dismissed the field. Resyncing the baseline here leaves an ALREADY open field alone; it
|
||||
// only stops this add from being read as something the user just drew. snaporca-j7gc.
|
||||
// only stops this add from being read as something the user just drew. j7gc.
|
||||
m_autoedit_seen = int(m_entities.size());
|
||||
return base;
|
||||
}
|
||||
@@ -9582,7 +9582,7 @@ bool DesignSketchTool::select_at_screen(GLCanvas3D& canvas, int sx, int sy)
|
||||
// counts only m_selection, so right-clicking a sketch point produced the EMPTY
|
||||
// vocabulary and every SkPoint row in the atlas was unreachable from the menu. Other
|
||||
// entities keep the handle pick: a line's endpoint is a drag target, not a thing with a
|
||||
// vocabulary of its own. snaporca-lnri.
|
||||
// vocabulary of its own. lnri.
|
||||
if (ei >= 0 && ei < int(m_entities.size())
|
||||
&& m_entities[ei].type == SketchEntity::Type::Point) {
|
||||
if (std::find(m_selection.begin(), m_selection.end(), ei) != m_selection.end())
|
||||
@@ -9664,8 +9664,8 @@ std::vector<int> DesignSketchTool::connected_loop(int seed) const
|
||||
// suppresses the menu whenever it is set, so right-click became a no-op that also hid the one door
|
||||
// to half the vocabulary (47 of 86 verbs have no shortcut). Measured on the rig: with Line armed,
|
||||
// two right-clicks in a row produced no menu and no tool change; only Escape freed it.
|
||||
// Same rule as snaporca-xmh6, which said it for the selection: clearing nothing is not a gesture
|
||||
// terminator. snaporca-ghcz.
|
||||
// Same rule as xmh6, which said it for the selection: clearing nothing is not a gesture
|
||||
// terminator. ghcz.
|
||||
bool DesignSketchTool::right_abandon()
|
||||
{
|
||||
if (m_points.empty())
|
||||
@@ -10000,7 +10000,7 @@ bool DesignSketchTool::on_mouse_impl(wxMouseEvent& evt, GLCanvas3D& canvas)
|
||||
// consumed from here on. Left-drag no longer orbits in this canvas — DesignCanvas puts
|
||||
// orbit on middle-drag and pan on right-drag, the CAD convention — so nothing downstream
|
||||
// is being starved of a gesture it used to own.
|
||||
// HOVER PRE-HIGHLIGHT (snaporca-9xw part 3): say what a click would take, before it is
|
||||
// HOVER PRE-HIGHLIGHT (9xw part 3): say what a click would take, before it is
|
||||
// taken. Plain motion only — no button down, no band running — because during a drag the
|
||||
// pointer is doing something else and a promise about clicking would be a lie. Returns
|
||||
// false so the event still reaches the camera; this only asks for a repaint, it does not
|
||||
@@ -10090,7 +10090,7 @@ bool DesignSketchTool::on_mouse_impl(wxMouseEvent& evt, GLCanvas3D& canvas)
|
||||
return true;
|
||||
}
|
||||
m_display_pick = -1; m_display_pick_region = -1; // clicked bare plate -> drop highlight
|
||||
// ...and the SOLID selection goes with it (snaporca-od0). A click that hits nothing has to
|
||||
// ...and the SOLID selection goes with it (od0). A click that hits nothing has to
|
||||
// mean what a rubber band that sweeps nothing already means — pick_bodies_in_rectangle
|
||||
// clears on an empty sweep, and the two gestures cannot disagree about the same outcome.
|
||||
// Until now the face survived a click on bare plate, so "click away, then click the face
|
||||
@@ -10738,7 +10738,7 @@ bool DesignSketchTool::on_mouse_impl(wxMouseEvent& evt, GLCanvas3D& canvas)
|
||||
return true;
|
||||
}
|
||||
if (evt.RightDown() && m_points.empty())
|
||||
return false; // no chain to end — snaporca-ghcz, let the offer open
|
||||
return false; // no chain to end — ghcz, let the offer open
|
||||
if (evt.RightDown()) {
|
||||
// END the chain — do NOT close it. This used to call push_closed_lines() for three
|
||||
// or more points, i.e. it drew a final segment from the last point back to the
|
||||
@@ -11117,7 +11117,7 @@ bool DesignSketchTool::on_mouse_impl(wxMouseEvent& evt, GLCanvas3D& canvas)
|
||||
return true;
|
||||
}
|
||||
if (evt.RightDown() && m_points.empty())
|
||||
return false; // no poles down — snaporca-ghcz, let the offer open
|
||||
return false; // no poles down — ghcz, let the offer open
|
||||
if (evt.LeftDClick() || evt.RightDown()) {
|
||||
if (m_points.size() >= 2) {
|
||||
const int base = int(m_entities.size());
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
Constrain };
|
||||
// Which tool is armed, and how many anchors it has down. Read-only, for the offer ladder:
|
||||
// "the menu armed the verb I chose" is otherwise unassertable, and a menu walk that lands one
|
||||
// row off arms a NEIGHBOURING tool and then grades whatever that drew. snaporca-ekt9.
|
||||
// row off arms a NEIGHBOURING tool and then grades whatever that drew. ekt9.
|
||||
Mode mode() const { return m_mode; }
|
||||
int pending_points() const { return int(m_points.size()); }
|
||||
void emit_step_hint(); // fires on_step_changed when the step actually moved
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
bool has_entities() const { return !m_entities.empty(); }
|
||||
bool on_mouse(wxMouseEvent& evt, GLCanvas3D& canvas);
|
||||
// Right-click on a draw tool: true when an in-progress anchor was abandoned, false when
|
||||
// there was nothing to abandon — and false is what lets the offer menu open. snaporca-ghcz.
|
||||
// there was nothing to abandon — and false is what lets the offer menu open. ghcz.
|
||||
bool right_abandon();
|
||||
// True if the LAST right-press was consumed as a gesture terminator (end a polyline chain,
|
||||
// abandon an anchor, exit a tool). Read-and-clear: the canvas asks on the matching release to
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
// feature index + the clicked closed-region index within it (-1 = no specific loop).
|
||||
// entity = the sketch entity index under the cursor when the click landed on a loop
|
||||
// STROKE, else -1 for an interior/region hit. Carried because a tool can legitimately
|
||||
// want the LINE you pointed at, not just the loop it belongs to (Rib, snaporca-3648).
|
||||
// want the LINE you pointed at, not just the loop it belongs to (Rib, 3648).
|
||||
std::function<void(int feature, int region, int entity)> on_display_sketch_selected;
|
||||
// Double-click on a committed sketch stroke: open THAT feature for editing. Selecting a line
|
||||
// and then hunting for an Edit button in a panel is the dependency this tab exists to remove.
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
|
||||
// Mate connectors. Until now a connector was visible only to a program — resolve_datum_coordsys
|
||||
// had exactly one consumer, the MCP socket — so the frame a mate is built on could not be seen
|
||||
// at all. The glyph has to answer two questions on sight (snaporca-wgsc): which way does Z point
|
||||
// at all. The glyph has to answer two questions on sight (wgsc): which way does Z point
|
||||
// (the VERSE), and which of the pair is anchored versus driven (the POLARITY). Nothing in any
|
||||
// surveyed CAD system encodes the second one.
|
||||
struct MateConnectorGlyph {
|
||||
@@ -440,7 +440,7 @@ public:
|
||||
// Live readout while drawing a Line/Polyline segment (anchor->cursor metrics).
|
||||
std::function<void(double length, double angle_deg, bool locked)> on_cursor_metrics;
|
||||
|
||||
// Live step guidance (snaporca-1c0c). The armed tool reports WHICH STEP of its gesture the
|
||||
// Live step guidance (1c0c). The armed tool reports WHICH STEP of its gesture the
|
||||
// user is on, every time that changes, so the status line can name the next click instead of
|
||||
// repeating the one-shot sentence written when the tool was armed. step = anchors/picks
|
||||
// already down (Mirror: 0 = no axis, 1 = axis down, 2 = ready to apply); picks = size of the
|
||||
@@ -679,7 +679,7 @@ private:
|
||||
// weld_tol: how far apart two endpoints may be and still be called Coincident.
|
||||
// Both default to GESTURE slack. A scripted add passes zero for both: the caller has
|
||||
// already said exactly what it means, and every non-zero window is a window in which the
|
||||
// inference rewrites it. snaporca-8xg1.
|
||||
// inference rewrites it. 8xg1.
|
||||
void infer_auto_constraints(int base, double ang_tol_rad = 3.0 * M_PI / 180.0,
|
||||
double weld_tol = 1e-3);
|
||||
|
||||
@@ -939,7 +939,7 @@ private:
|
||||
// A selectable sketch region: its own boundary, plus the loops nested INSIDE it, which
|
||||
// are its holes. Modelling holes is what makes "the plate with the hole in it" a thing the
|
||||
// user can point at — without it a sketch is N disjoint filled polygons and the only
|
||||
// selectable things are the rectangle alone or the circle alone (snaporca-txp8).
|
||||
// selectable things are the rectangle alone or the circle alone (txp8).
|
||||
struct RegionLoop {
|
||||
std::vector<Vec2d> poly;
|
||||
std::vector<int> ents;
|
||||
@@ -1165,7 +1165,7 @@ private:
|
||||
Vec3d vertex_pt{Vec3d::Zero()};
|
||||
};
|
||||
bool resolve_solid_pick(GLCanvas3D& canvas, int mx, int my, SolidPick& out) const;
|
||||
// HOVER PRE-HIGHLIGHT (snaporca-9xw part 3). Vertex-beats-edge-beats-face is a rule the user
|
||||
// HOVER PRE-HIGHLIGHT (9xw part 3). Vertex-beats-edge-beats-face is a rule the user
|
||||
// cannot see until after they commit to a click; showing the outcome under the pointer is
|
||||
// what makes the precedence learnable at all, and is the charter's L5 (one click, one visible
|
||||
// change) read honestly — the change has to be predictable before the click, not only after.
|
||||
|
||||
@@ -113,7 +113,7 @@ json describe_tools()
|
||||
// Hand-written descriptor. The bridge turns this into MCP tool schemas; later
|
||||
// slices grow this list (ideally from the kernel directly).
|
||||
return json{
|
||||
{"app", "SnapOrca CAD"},
|
||||
{"app", "Orca CAD"},
|
||||
{"protocol", "jsonrpc-2.0"},
|
||||
{"slice", 5},
|
||||
// Read this before using any face or edge id.
|
||||
@@ -2201,9 +2201,9 @@ void server_thread(std::string sock_path)
|
||||
|
||||
void start_mcp_control_if_enabled()
|
||||
{
|
||||
const char* env = std::getenv("SNAPORCA_MCP");
|
||||
const char* env = std::getenv("ORCA_CAD_MCP");
|
||||
if (!env || !*env) return;
|
||||
std::string path = (std::strcmp(env, "1") == 0) ? "/tmp/snaporca-mcp.sock" : env;
|
||||
std::string path = (std::strcmp(env, "1") == 0) ? "/tmp/orca-cad-mcp.sock" : env;
|
||||
static bool started = false;
|
||||
if (started) return;
|
||||
started = true;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
// MCP control surface (slice 1): a local JSON-RPC 2.0 server, line-delimited over a
|
||||
// Unix domain socket, that lets an external MCP bridge drive and perceive the Design
|
||||
// tab. Off unless the env var SNAPORCA_MCP is set:
|
||||
// SNAPORCA_MCP=1 -> socket at /tmp/snaporca-mcp.sock
|
||||
// SNAPORCA_MCP=/path/to.sock -> socket at that path
|
||||
// tab. Off unless the env var ORCA_CAD_MCP is set:
|
||||
// ORCA_CAD_MCP=1 -> socket at /tmp/orca-cad-mcp.sock
|
||||
// ORCA_CAD_MCP=/path/to.sock -> socket at that path
|
||||
// All CAD work is marshalled onto the wx main thread and runs through the SAME
|
||||
// CadDocument kernel the GUI uses (no parallel engine). Slice-1 methods:
|
||||
// describe_tools, describe_scene, extrude.
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
// Start the server thread iff SNAPORCA_MCP is set. Safe to call once after the
|
||||
// Start the server thread iff ORCA_CAD_MCP is set. Safe to call once after the
|
||||
// MainFrame + DesignPanel exist. No-op when the env var is unset or on Windows.
|
||||
void start_mcp_control_if_enabled();
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ bool parse_value(const char* text, double& out)
|
||||
|
||||
// One machine-readable line per event of the click-edit contract, for the UX check that runs
|
||||
// after every build (scripts/CAD/check-gui-click-edit.py). Deliberately NOT the same switch as
|
||||
// SNAPORCA_KEYTRACE: that one is a debugging firehose, this one is an assertion surface and its
|
||||
// ORCA_CAD_KEYTRACE: that one is a debugging firehose, this one is an assertion surface and its
|
||||
// format is a contract the script parses.
|
||||
//
|
||||
// The pair that matters is `open` vs `commit`: the check always types a value DIFFERENT from the
|
||||
@@ -61,7 +61,7 @@ bool parse_value(const char* text, double& out)
|
||||
// the user actually gets can.
|
||||
void ux_trace(const char* event, const std::string& title, const std::string& detail)
|
||||
{
|
||||
if (!std::getenv("SNAPORCA_UXTRACE")) return;
|
||||
if (!std::getenv("ORCA_CAD_UXTRACE")) return;
|
||||
std::fprintf(stderr, "[UX] %s title=%s %s\n", event, title.c_str(), detail.c_str());
|
||||
std::fflush(stderr);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ bool SketchInlineEditor::render(ImGuiWrapper& imgui, float scale)
|
||||
// different causes — no FRAMES (this canvas repaints on demand only, so an idle canvas never
|
||||
// processes ImGui's queued characters) versus frames that run while the input is not active —
|
||||
// and they are indistinguishable from outside.
|
||||
if (std::getenv("SNAPORCA_UXTRACE")) {
|
||||
if (std::getenv("ORCA_CAD_UXTRACE")) {
|
||||
const ImGuiIO& io = ImGui::GetIO();
|
||||
std::fprintf(stderr, "[UX] frame title=%s want_text=%d want_kb=%d active=%d buf=%s\n",
|
||||
m_title.c_str(), (int) io.WantTextInput, (int) io.WantCaptureKeyboard,
|
||||
|
||||
@@ -517,7 +517,7 @@ bool ImGuiWrapper::update_key_data(wxKeyEvent &evt)
|
||||
// runs handlers in reverse bind order, and on_char returns without Skip() whenever this
|
||||
// function returns true — so such a probe stays silent whether or not the key arrived.
|
||||
// A day was lost to reading that silence as evidence.
|
||||
if (std::getenv("SNAPORCA_UXTRACE")) {
|
||||
if (std::getenv("ORCA_CAD_UXTRACE")) {
|
||||
fprintf(stderr, "[UX] imgui_char unicode=%d keycode=%d want_text=%d\n",
|
||||
(int) key, evt.GetKeyCode(), (int) io.WantTextInput);
|
||||
fflush(stderr);
|
||||
|
||||
@@ -1361,7 +1361,7 @@ void MainFrame::init_tabpanel() {
|
||||
m_design_page = new wxPanel(this);
|
||||
m_design_page->SetSizer(new wxBoxSizer(wxVERTICAL));
|
||||
m_design_page->Hide();
|
||||
start_mcp_control_if_enabled(); // opens the MCP socket iff SNAPORCA_MCP is set
|
||||
start_mcp_control_if_enabled(); // opens the MCP socket iff ORCA_CAD_MCP is set
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <catch2/catch_all.hpp> // mainline OrcaSlicer ships Catch2 v3 (v2 was catch2/catch.hpp)
|
||||
|
||||
// Substring assertions, spelled so this file compiles UNCHANGED on both forks.
|
||||
// Catch2 v2 (snaporca) spells it Matchers::Contains; v3 (orca_cad / mainline) spells it
|
||||
// Catch2 v2 (Snapmaker) spells it Matchers::Contains; v3 (orca_cad / mainline) spells it
|
||||
// Matchers::ContainsSubstring and gives Contains an incompatible meaning — range-contains-
|
||||
// ELEMENT — which fails to compile against a std::string rather than failing a test.
|
||||
// Using find() sidesteps the rename entirely; INFO keeps the actual string in the report.
|
||||
@@ -613,7 +613,7 @@ TEST_CASE("entity constraints: point-on-line positions a centre onto an axis", "
|
||||
// vendored solver (slvs/dsc.h FindById, "Cannot find handle"), taking every later test with
|
||||
// it, and was quarantined for it. Fixed in SketchSolver: a full circle can no longer be handed
|
||||
// to SLVS_C_ARC_LINE_TANGENT, which dereferences arc endpoints a circle does not have. See
|
||||
// snaporca-tkz.
|
||||
// tkz.
|
||||
TEST_CASE("entity constraints: tangent/midpoint/symmetric/angle", "[CadDocument][sketch]")
|
||||
{
|
||||
using R = SketchPointRole;
|
||||
@@ -962,7 +962,7 @@ TEST_CASE("extrude taper + up-to-face distance", "[CadDocument]")
|
||||
}
|
||||
}
|
||||
|
||||
// Was [known-broken] until the numbers were actually measured (snaporca-kzy). The geometry
|
||||
// Was [known-broken] until the numbers were actually measured (kzy). The geometry
|
||||
// was right all along; the TEST compared against the wrong reference. An internal thread bores
|
||||
// at the MINOR radius (radius - depth) and then carves the groove out to radius + depth, so a
|
||||
// tapped hole keeps the crests between turns and therefore holds MORE material than a plain
|
||||
@@ -1330,7 +1330,7 @@ TEST_CASE("datum plane: offset + tilt resolution and sketching on it", "[CadDocu
|
||||
|
||||
// A datum-plane-only document has no solid, and that is a benign SUCCESS, not a benign
|
||||
// failure. It used to return false, and "benign failure" is exactly the phrasing that hid
|
||||
// snaporca-mtav: two callers read the false as "unusable document" and threw the design
|
||||
// mtav: two callers read the false as "unusable document" and threw the design
|
||||
// away — the 3MF recipe was never written, and a project that had one was refused on load.
|
||||
CadDocument only_plane;
|
||||
only_plane.add_plane(0, 10.0, 0.0, 0, "P");
|
||||
@@ -1416,7 +1416,7 @@ TEST_CASE("draft tapers a solid face about the body base", "[CadDocument]")
|
||||
|
||||
TEST_CASE("a split renumbers the bodies a later feature indexes", "[CadDocument][cut]")
|
||||
{
|
||||
// Pins the invariant the Design tab's re-edit path depends on (snaporca-oz7): a stored
|
||||
// Pins the invariant the Design tab's re-edit path depends on (oz7): a stored
|
||||
// target_body indexes the body list AS IT WAS when that feature ran, and a Cut placed
|
||||
// later in the tree changes that list. If this test ever fails, the GUI's
|
||||
// fill_body_choice() replay-to-timeline-slot assumption needs revisiting with it.
|
||||
@@ -2502,7 +2502,7 @@ TEST_CASE("datum plane construction methods", "[CadDocument][plane]")
|
||||
}
|
||||
}
|
||||
|
||||
// Mirrors the snaporca [Deviation] case (snaporca carries it in test_geometry.cpp; here it lives
|
||||
// Mirrors the Snapmaker [Deviation] case (Snapmaker carries it in test_geometry.cpp; here it lives
|
||||
// alongside the CAD suite). GeometryEngine::surface_deviation = one-sided Hausdorff used by the
|
||||
// MCP validate_against acceptance metric.
|
||||
TEST_CASE("surface_deviation: identical solids ~0, shifted solid ~shift", "[Deviation]")
|
||||
@@ -5310,7 +5310,7 @@ TEST_CASE("thicken-surface makes a solid from a sheet", "[CadDocument][surface]"
|
||||
REQUIRE_THAT(double(tx1), WithinAbs(double(sx1), 2.1));
|
||||
}
|
||||
|
||||
// Regression for snaporca-lu27, with the rig's own numbers. A 60x60x40 four-walled open box
|
||||
// Regression for lu27, with the rig's own numbers. A 60x60x40 four-walled open box
|
||||
// used to report volume 96000 and an inertia diagonal of [-4.2e7, -4.2e7, -6.9e7] — negative
|
||||
// principal moments, which no real body can have. VolumeProperties was being integrated over
|
||||
// an open shell as though it were closed, and std::abs() on the mass hid the only obvious tell.
|
||||
@@ -5352,7 +5352,7 @@ TEST_CASE("mass properties of a sheet body report area only, never a volume",
|
||||
REQUIRE(solid.inertia[8] > 0.0);
|
||||
}
|
||||
|
||||
// snaporca-wm4s. The wall of a thickened open box must contain the corner material. Thickening
|
||||
// wm4s. The wall of a thickened open box must contain the corner material. Thickening
|
||||
// each face along its own normal and sewing (MakeThickSolidBySimple) leaves the four vertical
|
||||
// corners empty and measured 29648.15 where the geometry requires 44000; the two controls below
|
||||
// were exact before and must stay exact, since they are what a corner-only fix must not disturb.
|
||||
@@ -7309,7 +7309,7 @@ TEST_CASE("interference: detects a clash created by a mate", "[CadDocument][inte
|
||||
// A filleted solid must reach the plate as a watertight mesh. OCCT emits one degenerate
|
||||
// triangle at the pole of every corner sphere patch; welded, its v->v edge counts as an open
|
||||
// edge and the slicer tells the user to go repair the model in another CAD application --
|
||||
// the exact round trip this feature exists to remove. snaporca-agw.
|
||||
// the exact round trip this feature exists to remove. agw.
|
||||
TEST_CASE("CadDocument filleted solid tessellates watertight", "[CadDocument]")
|
||||
{
|
||||
CadDocument doc;
|
||||
@@ -7339,7 +7339,7 @@ TEST_CASE("CadDocument filleted solid tessellates watertight", "[CadDocument]")
|
||||
// into the params whether or not it converged, so reading geometry back unconditionally made
|
||||
// every failed attempt destructive -- and the fillet degrade ladder tries a deliberately
|
||||
// over-constrained rung FIRST, so a filleted corner was wrecked before the rung that works
|
||||
// ever got a chance. snaporca-pl5.
|
||||
// ever got a chance. pl5.
|
||||
TEST_CASE("Failed sketch solve leaves geometry untouched", "[CadDocument]")
|
||||
{
|
||||
using R = SketchPointRole;
|
||||
@@ -7415,7 +7415,7 @@ TEST_CASE("Failed sketch solve leaves geometry untouched", "[CadDocument]")
|
||||
// A subtraction whose tool misses the target is a perfectly legal boolean that removes nothing,
|
||||
// so OCCT reports success and the feature lands in the recipe with ok:true and an unchanged body.
|
||||
// That is how a hole placed with world coordinates instead of plane-frame ones read as "drilled"
|
||||
// three times in a row while the volume never moved. snaporca-daf.
|
||||
// three times in a row while the volume never moved. daf.
|
||||
TEST_CASE("A cut that removes no material is an error, not a silent success", "[CadDocument]")
|
||||
{
|
||||
// 20 x 20 box, 20 tall, centred on the origin of the XY plane.
|
||||
@@ -7472,7 +7472,7 @@ TEST_CASE("A cut that removes no material is an error, not a silent success", "[
|
||||
// Anything else returns a null wire, and build_sketch_wire used to answer that by falling through
|
||||
// to its legacy tail — which ends in a rectangle built from width/height. For an entity sketch
|
||||
// those are whatever they were initialised to, so the extrude produced a box nobody drew.
|
||||
// snaporca-88v.
|
||||
// 88v.
|
||||
TEST_CASE("An entity sketch that forms no wire fails instead of extruding a default box", "[CadDocument]")
|
||||
{
|
||||
auto circle = [](Vec2d c, double r) {
|
||||
@@ -7562,7 +7562,7 @@ CadDocument plate_doc(const std::vector<SketchEntity>& entities, double distance
|
||||
|
||||
} // namespace
|
||||
|
||||
// snaporca-88v: a sketch may hold more than one closed loop. The Extrude path builds the
|
||||
// 88v: a sketch may hold more than one closed loop. The Extrude path builds the
|
||||
// sketch's planar region via SketchEngine::entities_to_wires + wires_to_face: the largest loop
|
||||
// is the outer boundary, every other loop a hole. Volumes are the proof — a plate with a hole
|
||||
// must subtract the hole, not merely "not throw".
|
||||
@@ -7637,7 +7637,7 @@ TEST_CASE("entities_to_wires returns one wire per loop", "[CadDocument][sketchwi
|
||||
// Sketching on a picked face is the most common gesture in solid modelling, and it was impossible:
|
||||
// the plane came from a combo of base + datum planes only, so the sole route onto a face was to
|
||||
// build a Coincident datum plane first. plane_of_face is the shared derivation that makes the
|
||||
// viewport selection usable directly. snaporca-3a2.
|
||||
// viewport selection usable directly. 3a2.
|
||||
TEST_CASE("plane_of_face gives a sketchable plane for a planar face only", "[CadDocument]")
|
||||
{
|
||||
// 20 x 20 x 20 box on XY, so its top face sits at z = 20 with +Z normal.
|
||||
@@ -7689,7 +7689,7 @@ TEST_CASE("plane_of_face gives a sketchable plane for a planar face only", "[Cad
|
||||
}
|
||||
}
|
||||
|
||||
// snaporca-5425 — POSITIVE-CONTRACT variant. A feature that left a body with a null
|
||||
// 5425 — POSITIVE-CONTRACT variant. A feature that left a body with a null
|
||||
// TopoDS_Shape used to be tolerated: recompute() returned true and the document kept
|
||||
// advertising the body. The new guard makes that a hard failure. This test asserts the
|
||||
// contract the guard preserves on the healthy side: a normal box + fillet document
|
||||
@@ -7727,7 +7727,7 @@ TEST_CASE("recompute on a healthy box + fillet leaves no body null and no error
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// snaporca-rgbj — does a chamfer chain degenerate from a KERNEL defect, or from
|
||||
// rgbj — does a chamfer chain degenerate from a KERNEL defect, or from
|
||||
// how the DRIVER captured its edge ids? Experiment, not a fix.
|
||||
//
|
||||
// CadFeature::dressup_edge is a GLOBAL edge id: an ordinal into
|
||||
@@ -8242,7 +8242,7 @@ TEST_CASE("add_extrude_entities builds a plate with a bore (clockwise circle)",
|
||||
}
|
||||
|
||||
|
||||
// snaporca-mtav. A document that has only sketches in it is not a broken document, it is the
|
||||
// mtav. A document that has only sketches in it is not a broken document, it is the
|
||||
// state every design passes through between drawing a profile and extruding it. recompute()
|
||||
// used to call that "no solid-producing features" and return false, and two things downstream
|
||||
// read that false as "the document is unusable": the GUI syncs the 3MF recipe only after a
|
||||
|
||||
@@ -113,7 +113,7 @@ TEST_CASE("slvs: over-constrained / inconsistent is detected", "[slvs]")
|
||||
CHECK_FALSE(res.ok); // SLVS_RESULT_INCONSISTENT
|
||||
}
|
||||
|
||||
// snaporca-yww4. libslvs sizes its System with a compile-time `MAX_UNKNOWNS = 1024`, and the
|
||||
// yww4. libslvs sizes its System with a compile-time `MAX_UNKNOWNS = 1024`, and the
|
||||
// solver is handed every entity in the sketch at 2 params per point — so a sketch of about 480
|
||||
// lines is the last one that fits and the next comes back TOO_MANY_UNKNOWNS. Because
|
||||
// try_add_constraints rolls a failed batch back, that turned into: every auto-inferred constraint
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Zero-dependency stdio MCP server bridging to the SnapOrca/Orca-CAD control socket.
|
||||
"""Zero-dependency stdio MCP server bridging to the Orca/Orca-CAD control socket.
|
||||
|
||||
Speaks MCP (JSON-RPC 2.0 over newline-delimited stdio) to an MCP client (Claude Code),
|
||||
and forwards each tool call to the app's Unix-domain control socket (opened by the GUI
|
||||
when launched with SNAPORCA_MCP set). The tool list is built *live* from the app's own
|
||||
when launched with ORCA_CAD_MCP set). The tool list is built *live* from the app's own
|
||||
`describe_tools` reply — introspection drives the schema, so new kernel methods surface
|
||||
without touching this file.
|
||||
|
||||
Usage: snaporca_mcp_bridge.py [SOCKET_PATH] (default /tmp/snaporca-mcp.sock)
|
||||
The app must be running with SNAPORCA_MCP set; if the socket is down, tools/list falls
|
||||
Usage: orca_cad_mcp_bridge.py [SOCKET_PATH] (default /tmp/orca-cad-mcp.sock)
|
||||
The app must be running with ORCA_CAD_MCP set; if the socket is down, tools/list falls
|
||||
back to the slice-1 set and tool calls report the connection error (never crash).
|
||||
"""
|
||||
import sys, os, json, socket, itertools
|
||||
|
||||
SOCK_PATH = sys.argv[1] if len(sys.argv) > 1 else "/tmp/snaporca-mcp.sock"
|
||||
SERVER_INFO = {"name": "snaporca-cad", "version": "0.1"}
|
||||
SOCK_PATH = sys.argv[1] if len(sys.argv) > 1 else "/tmp/orca-cad-mcp.sock"
|
||||
SERVER_INFO = {"name": "orca-cad", "version": "0.1"}
|
||||
_app_id = itertools.count(1)
|
||||
|
||||
# --- app control-socket round-trip --------------------------------------------
|
||||
Reference in New Issue
Block a user