feat(understand): drawing_diff - two revisions matched by geometric signature

engineering/understand/diff.py reads each revision once into entity
records and matches them in three stages: exact signature (type, layer,
geometry rounded to tol, text, block, rotation, scale, attributes;
handles ignored), then handle while at least half of the exact matches
kept theirs, then type + layer + nearest anchor within move_tol (default
2 % of the 1st-99th percentile diagonal). The report counts changes by
layer and type, says what changed per entity (moved by, text, attribute,
radius ... from -> to), compares named block definitions by content and
groups the changes into clusters.

drawing_diff opens group D's copy of SECTION 26. It is read-only unless
markup=True, which files revision clouds around the model-space clusters
on the current document through add_revision - refused before any read
with new_path, without a valid rev, or on an engine without revcloud.
A revision path that is neither .dxf nor .dwg is refused naming the
parameter (old_path: / new_path:), like every other path refusal.

Tests: the synthetic plant P&ID edited five ways (a move, a text, an
attribute, an add, a delete) under renumbered handles reports exactly
those five edits; renumbering alone reports nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
Umut CAN
2026-09-24 11:51:19 +03:00
co-authored by Claude Opus 5.5
parent 704a44b190
commit 54325e6de0
9 changed files with 1435 additions and 8 deletions
+16 -2
View File
@@ -3,13 +3,13 @@
"schema_version": 1,
"package_version": "1.5.1",
"totals": {
"tools": 241,
"tools": 242,
"resources": 8,
"prompts": 5,
"groups": 26
},
"groups": {
"analysis": 12,
"analysis": 13,
"architecture": 12,
"batch": 3,
"blocks": 9,
@@ -897,6 +897,20 @@
"destructiveHint": true
}
},
{
"name": "drawing_diff",
"group": "analysis",
"cost": "mutate",
"summary": "Compare two revisions of a drawing: what moved, changed, was added or removed.",
"tags": [
"analysis",
"query"
],
"annotations": {
"title": "Drawing: Diff Two Revisions",
"destructiveHint": false
}
},
{
"name": "drawing_export_dwg",
"group": "sheet",