Files
OneCAD/crates/ui-egui/tests/scenarios/sketch_pattern_circ_window.json
T
William Dunn 152418b624 A tool window for the circular sketch pattern (#801)
Circular sketch pattern gets a tool window with entities, center, quantity and total angle, replacing the click flow.
2026-10-13 16:34:00 -04:00

61 lines
3.8 KiB
JSON

[
{"note": "sketch.pattern.circular gets a tool window carrying Entities, Center, Quantity and Total angle. Its click flow sent a count hard-coded to 6 and never passed an angle at all."},
{"call": "engine.execute", "params": {"command": "sketch.create", "params": {"plane": "XY"}}},
{"call": "engine.execute", "params": {"command": "sketch.point", "params": {"point": [0, 0]}}},
{"call": "engine.execute", "params": {"command": "sketch.circle.center", "params": {"center": [30, 0], "radius": 10}}},
{"call": "ui.view", "params": {"view": "top"}},
{"expect": {"sketching": true, "sketch_curves": {"own": 1}, "errors": 0}},
{"note": "Starting the command opens the window and commits nothing. Picking the circle and the centre point still commits nothing."},
{"start": "sketch.pattern.circular"},
{"expect": {"dialog": "PatternCirc", "sketch_curves": {"own": 1}, "errors": 0}},
{"click": {"sketch": [40, 0]}},
{"click": {"handle": "dialog:Center"}},
{"click": {"sketch": [0, 0]}},
{"expect": {"dialog": "PatternCirc", "sketch_curves": {"own": 1}, "errors": 0}},
{"note": "A count of 4 over a total angle of 180 degrees: the old flow could only send 6 over the full turn. Four instances 60 degrees apart put the last one straight across the centre."},
{"click": {"handle": "dialog:Quantity"}},
{"key": "A", "cmd": true},
{"text": "4"},
{"click": {"handle": "dialog:Total angle"}},
{"key": "A", "cmd": true},
{"text": "180"},
{"click": {"handle": "dialog:OK"}},
{"expect": {"dialog": null, "errors": 0, "sketch_curves": {"own": 4}}},
{"note": "60 degrees around: 30 mm at 60 degrees is (15, 25.980762)."},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 1, "center_at", 0], "value": 15}}},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 1, "center_at", 1], "value": 25.980762113533157}}},
{"note": "180 degrees around: straight across the centre. The angle was applied, not ignored."},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 3, "center_at", 0], "value": -30}}},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 3, "center_at", 1], "value": 0}}},
{"shot": "sketch_pattern_circ_half_turn"},
{"note": "A full turn with a count that is not 6 either: four instances 90 degrees apart around a second centre. The half turn above reaches x = -30, and the second circle reaches y = 90, so refit before picking anything up there."},
{"call": "engine.execute", "params": {"command": "sketch.point", "params": {"point": [0, 60]}}},
{"call": "engine.execute", "params": {"command": "sketch.circle.center", "params": {"center": [0, 80], "radius": 10}}},
{"call": "ui.view", "params": {"view": "fit"}},
{"expect": {"sketch_curves": {"own": 5}, "errors": 0}},
{"start": "sketch.pattern.circular"},
{"click": {"sketch": [10, 80]}},
{"click": {"handle": "dialog:Center"}},
{"click": {"sketch": [0, 60]}},
{"click": {"handle": "dialog:Quantity"}},
{"key": "A", "cmd": true},
{"text": "4"},
{"click": {"handle": "dialog:OK"}},
{"expect": {"dialog": null, "errors": 0, "sketch_curves": {"own": 8}}},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 5, "center_at", 0], "value": -20}}},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 5, "center_at", 1], "value": 60}}},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 7, "center_at", 0], "value": 20}}},
{"expect": {"query": {"command": "sketch.inspect", "path": ["curves", 7, "center_at", 1], "value": 60}}},
{"shot": "sketch_pattern_circ_full_turn"},
{"note": "Escape closes the window and leaves the sketch and its undo history exactly as they were."},
{"start": "sketch.pattern.circular"},
{"click": {"sketch": [10, 80]}},
{"expect": {"dialog": "PatternCirc"}},
{"key": "Escape"},
{"expect": {"dialog": null, "errors": 0, "sketch_curves": {"own": 8}}}
]