mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-18 22:42:37 +00:00
Port the MCP verb surface: run_verb / list_verbs / sketch_set_value
Carries snaporca 39fac9b725. Parity re-verified: 17 files identical, 8 diverging by their expected counts, DesignPanel.cpp still at 32 — the mirrored files were copied and the two divergent ones patched hunk by hunk, so the counts returning to their expected values is the proof each landed on the right side. All 90 offer verbs are now firable by name over the socket, which matters because a deck key can only send a keystroke and 49 of them have no shortcut at all. sketch_set_value calls the same apply_dimension the in-canvas value field calls, so a typed dimension can be asserted with no window manager in the way. Three guards came with it, each confirmed against the source: on_mass_properties bounds-checks m_sel_solid_body (it defaults to -1, and run_verb bypasses the menu grey-out that used to hide that); sketch_set_value validates its value at the boundary because apply_dimension records a driving constraint even for values it refused to apply; and run_verb refuses btn:/fly: verbs that do not apply to the selection while leaving key: verbs alone, so the socket offers exactly what the GUI offers. Dispatch is deferred through CallAfter so no modal verb can wedge the socket thread. GUI target builds and links against the rebuilt deps image. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
5d7fc8c545
commit
fbf858ba47
@@ -110,5 +110,23 @@ call("sketch_construction")
|
||||
r = call("sketch_describe")
|
||||
check(r["buildable"], "turning it back closes it again")
|
||||
|
||||
print("6. re-dimensioning one side keeps the rectangle a single closed loop")
|
||||
call("sketch_cancel")
|
||||
call("sketch_begin", plane="XY")
|
||||
call("sketch_add", rect=[0, 0, 60, 40])
|
||||
r = call("sketch_describe")
|
||||
check(areas(r) == [2400.0], f"one loop of 2400 mm^2 (got {areas(r)})")
|
||||
call("sketch_select", entities=[0]) # the bottom edge, y=0, from x=0 to x=60
|
||||
r = call("sketch_set_value", value=40)
|
||||
check(r["kind"] == "length", f"dimension kind is length (got {r['kind']})")
|
||||
check(near(r["before"], 60), f"the edge measured 60 before (got {r['before']})")
|
||||
r = call("sketch_describe")
|
||||
check(len(r["closed_loops"]) == 1, "the rectangle is still exactly one closed loop")
|
||||
check(r["open_ends"] == [], "no open ends after re-dimensioning")
|
||||
# The point of the whole section: a rectangle must SURVIVE one side being re-dimensioned. We do
|
||||
# not assert a specific area — only that the topology held — but print it so a topology-preserving
|
||||
# yet geometry-wrong result is visible in the output.
|
||||
print(f" note resulting rectangle area = {areas(r)} mm^2 (topology held; geometry is what it is)")
|
||||
|
||||
call("sketch_cancel")
|
||||
print("\nall sketch assertions held")
|
||||
|
||||
Reference in New Issue
Block a user