forked from 1b-agent/opencadstudio-upstream
feat(python): chamfer, arrays, explode, join, break, stretch and lengthen wrappers
Each is written against the prompt sequence observed in the exploration harness and checked for exact geometry in the real-IPC audit. HATCH is left to create_entity because its command needs an interactive boundary pick. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1b1785eefb
commit
360dd853ed
5 files changed
+184
-46
No files matched your search
@@ -58,7 +58,7 @@ class DocumentModelTests(unittest.TestCase):
|
||||
outcome = {"status": "completed", "blocked_by": None, "command": "", "prompt": "", "accepts": [],
|
||||
"options": [], "entities": 0, "added": 0, "unconsumed": [], "error": None}
|
||||
outcome.update(self.step_outcome.get(kind, {}))
|
||||
if kind == "enter":
|
||||
if kind in ("enter", "entity"):
|
||||
new = max(self.records) + 1
|
||||
self.records[new] = {"handle": new, "kind": "Line", "layer": "0", "_editable": True}
|
||||
return outcome
|
||||
@@ -98,6 +98,22 @@ class DocumentModelTests(unittest.TestCase):
|
||||
entity_step = [c for c in self.calls if c[0] == "step" and c[1] == "entity"][0]
|
||||
self.assertEqual(entity_step[2]["point"], [1, 0, 5.0])
|
||||
|
||||
def test_more_modify_wrappers(self):
|
||||
self.step_outcome = {}
|
||||
self.doc.modify.chamfer(1, 2, 2, 3, at1=(0, 0, 0), at2=(1, 1, 0))
|
||||
texts = [c[2]["text"] for c in self.calls if c[0] == "step" and c[1] == "text"]
|
||||
self.assertEqual(texts, ["2", "3"])
|
||||
self.calls.clear()
|
||||
self.doc.modify.chamfer(1, 2, 4, at1=(0, 0, 0), at2=(1, 1, 0))
|
||||
texts = [c[2]["text"] for c in self.calls if c[0] == "step" and c[1] == "text"]
|
||||
self.assertEqual(texts, ["4", "4"])
|
||||
self.calls.clear()
|
||||
self.doc.modify.array_rect([1], 2, 3, 10, 20)
|
||||
self.assertEqual([c[2]["text"] for c in self.calls if c[0] == "step" and c[1] == "text"], ["2", "3", "10", "20"])
|
||||
self.calls.clear()
|
||||
self.doc.modify.stretch((0, 0), (1, 1), (0, 0), (5, 0))
|
||||
self.assertEqual([c[1] for c in self.calls if c[0] == "step"], ["start", "point", "point", "enter", "point", "point"])
|
||||
|
||||
def test_batch_edit_and_rollback(self):
|
||||
line = self.doc.entities[1]
|
||||
self.assertEqual(line.start, (1, 2, 3))
|
||||
|
||||
Reference in new issue
Block a user