Hide the Design tab's reference planes until a sketch needs them, with an Origin row to pin them

This commit is contained in:
SoftFever
2026-10-06 18:38:57 +08:00
parent 064eee8b84
commit 78a22fca93
5 changed files with 131 additions and 75 deletions
+14 -10
View File
@@ -480,10 +480,13 @@ def type_into_open_field(value, mark):
def enter_sketch(timeout=180):
"""Open a real sketch on a real plane, and PROVE it with the socket before drawing anything.
THE SEQUENCE MATTERS AND IT IS NOT OBVIOUS. Shift+S enters sketch MODE and pops the plane
offer; the offer must be dismissed; and the plane itself is chosen by clicking it in the
viewport BEFORE Shift+S. check-gui-sketching.py has always done all four steps. This ladder
did two of them — Design tab, then Shift+S — and went straight to the tool letters.
THE SEQUENCE MATTERS AND IT IS NOT OBVIOUS. The reference planes are hidden until Shift+S
enters sketch MODE, so the plane is clicked AFTER it. Entering with a plane an earlier rung
chose pops the plane offer at once, and a click outside a popup menu only closes it, so the
plane is clicked twice, apart: the second click always lands on the plane. No Escape — with
no offer up, Escape in an empty sketch leaves it. Then a tool letter starts the session.
check-gui-sketching.py does the same steps. This ladder once did two of them — Design tab,
then Shift+S — and went straight to the tool letters.
That intermediate state is the trap. `is_sketching` reads 1, every tool key is accepted and
traced, and not one click draws anything, because there is no plane under them. The ladder
@@ -499,9 +502,9 @@ def enter_sketch(timeout=180):
click(132, 53) # Design tab
time.sleep(2.0)
dismiss_modals()
click(*PLANE_PX) # pick the plane IN THE VIEWPORT — before Shift+S
key("shift+s", 1.0)
key("Escape", 0.5) # entering sketch mode pops the offer; dismiss it
key("shift+s", 1.0) # sketch mode brings the reference planes up
click(*PLANE_PX, pause=0.8) # closes the offer if an earlier rung's plane popped it...
click(*PLANE_PX) # ...so this is the click that picks the plane IN THE VIEWPORT
key("p", 0.6) # any sketch tool starts the session on that plane
if try_call("sketch_describe") is not None:
# NO Escape here. Every rung already opens with one to drop whatever tool the last
@@ -511,14 +514,15 @@ def enter_sketch(timeout=180):
# reported all eleven checks failed with "nothing opened" — the tools were arming
# into an empty Feature-mode document.
return
die("no sketch opened after plane click + Shift+S within "
die("no sketch opened after Shift+S + plane click within "
f"{timeout}s — sketch_describe never answered on {A.sock} (trace {TRACE})")
# tool key, the clicks that draw it, and one distinct value per queued field. The values are
# deliberately nothing like the as-drawn size, so a committed prefill cannot coincide with them.
# Where the plane label sits in the viewport before a sketch is open. Same constant the gesture
# ladder uses; it is a label on the 3D view, not a widget, so it moves only if the camera does.
# Where the plane label sits in the viewport once sketch mode has brought the planes up. Same
# constant the gesture ladder uses; it is a label on the 3D view, not a widget, so it moves only
# if the camera does.
PLANE_PX = (913, 359)
# Every coordinate below stays inside 1000..1400 x 500..760 — the box check-gui-sketching.py's
+12 -8
View File
@@ -229,7 +229,9 @@ CHROME_DY = int(os.environ.get("ORCA_CAD_CHROME_DY", "26"))
DESIGN_TAB = (128, 29 + CHROME_DY)
# Feature-tree rows, measured on the rig at 1920x1080: first row centre, then 23 px apart.
# Feature-tree rows, measured on the rig at 1920x1080: the list's first row is centred at y=215,
# then 23 px apart. That first row is the Origin, pinned above the features and never deleted, so
# the first FEATURE row is the second one: Delete on the Origin does nothing.
# x=300, not the label: a second click ON the label opens the inline rename, and Delete then
# edits the text instead of removing the feature.
#
@@ -237,7 +239,7 @@ DESIGN_TAB = (128, 29 + CHROME_DY)
# unshifted click lands 26 px BELOW the first row -- just past its 23 px height -- so the row is
# never selected, Delete does nothing, and reset_document spends 40 rounds on it before dying
# with "could not empty the feature tree". That names the feature tree, which is not the fault.
TREE_ROW0 = (300, 215 + CHROME_DY)
TREE_ROW0 = (300, 215 + 23 + CHROME_DY)
def go_design():
@@ -266,18 +268,20 @@ def reset_document():
def enter_sketch(tool_key, plane_px=(913, 359)):
"""Enter a sketch the way the design law says: pick the plane in the viewport, then the tool.
Shift+S enters sketch MODE and pops the offer; Escape dismisses it; the tool letter then
starts the session on the plane the click selected. All four steps are real input — nothing
here goes through the socket.
Shift+S enters sketch MODE, which brings the reference planes up; the click picks one; the
tool letter then starts the session on it. Entering with a plane an earlier rung chose pops
the offer at once, and a click outside a popup menu only closes it, so the plane is clicked
twice, apart. No Escape: with no offer up, Escape in an empty sketch leaves it. All of it is
real input — nothing here goes through the socket.
"""
leave_sketch()
click(*plane_px)
key("shift+s", 0.8)
key("Escape", 0.4) # entering sketch mode pops the offer; dismiss it
click(*plane_px, pause=0.8) # closes the offer if an earlier rung's plane popped it...
click(*plane_px) # ...so this is the click that picks the plane
key("p", 0.6)
if try_call("sketch_describe") is None:
shot("/shots/gl-enter-failed.png")
die("no sketch opened after plane click + Shift+S (see /shots/gl-enter-failed.png)")
die("no sketch opened after Shift+S + plane click (see /shots/gl-enter-failed.png)")
calibrate_here() # THIS sketch's own camera map, on THIS sketch's own plane
key(tool_key, 0.6)