fix(task-5): skip what the room reader cannot read, and one face carries one room
read_segments trusted any row with `points`. On a live seat an old-style AcDb2dPolyline's Coordinates are x, y, z triples (measured on AutoCAD 2026, 2026-09-23: [200,200,0, 4200,200,0, ...]) which the backend reads two at a time, so three closed ms.AddPolyline outlines on WALLS reported points like [[0,0],[0,8600],[0,0],[8600,5400],...] and rooms_detect answered five faces of 2.6-6.9 m2 for two 20 m2 rooms. Headless, the same POLYLINE arrives with no points and was dropped without a word; so were walls inside a block reference. The reader now reads LINE and the lightweight polyline only (LWPOLYLINE, and the live AcDbPolyline reported POLYLINE), and lists every other entity that could bound a room in `skipped` with its handle, type and reason: arcs and bulged edges as before, old-style polylines (2DPOLYLINE/3DPOLYLINE live, a vertex-less POLYLINE headless), block references (INSERT / BLOCKREFERENCE) and anything else not a line. Text, dimensions, leaders, points and hatches bound nothing and are passed over. Re-run live on AutoCAD 2026 through the real com_backend._entity_info rows: count 0 with the three polylines in skipped (was 5 wrong rooms); with a lightweight pair and a block added, count 1 at 20 000 000 mm2 plus the block reference in skipped. The backend's stride is left alone (shared file, other readers); this reader no longer trusts it. label_room refused a reused id but not a reused face: a second label in a labelled room (a retry after a transport timeout) wrote a second record with the same area, which a schedule total counts twice. It is now refused before anything is drawn, naming the record and label already there. rooms_detect reports `labels` (every record in the face; `label` stays the first) and `label_conflicts` for a face holding more than one. No new ActiveX member is called. 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:
co-authored by
Claude Opus 5.5
parent
67d578e09a
commit
a2996b0c95
@@ -9818,7 +9818,8 @@ async def arch_room(
|
||||
"""Label the room around (x, y) with its name, number and MEASURED area.
|
||||
|
||||
The area is never typed: the tool reads the wall faces on the `wall` layer
|
||||
of the arch set (LINE and polyline, both engines), finds the closed face
|
||||
of the arch set (LINE and lightweight polyline, both engines; anything else
|
||||
there is listed in `skipped`), finds the closed face
|
||||
the point lies in and writes that face's area - net of the wall thickness
|
||||
and of any column inside it - into the label and into an `ACADMCP_ARCH`
|
||||
room record on the name text, which `arch_schedule` reads. A door or window
|
||||
@@ -9828,8 +9829,10 @@ async def arch_room(
|
||||
Refused before anything is drawn: an unknown `lang` (named with en, tr), a
|
||||
`number`/`name` the room model refuses, a `room_id` already labelled on the
|
||||
drawing, a point in no closed face of the walls (draw or close them first,
|
||||
or read a plan drawn by other means with `arch_rooms_detect`), and a point
|
||||
inside a wall body.
|
||||
or read a plan drawn by other means with `arch_rooms_detect`), a point
|
||||
inside a wall body, and a point in a room that already carries a label (one
|
||||
face, one room record - a retried call does not add a second area to the
|
||||
schedule).
|
||||
"""
|
||||
from engineering.arch.rooms import label_room
|
||||
|
||||
@@ -9869,17 +9872,21 @@ async def arch_rooms_detect(
|
||||
) -> dict:
|
||||
"""Read the rooms of a plan - ours or a foreign one made of plain lines.
|
||||
|
||||
Every LINE and polyline on the layers is split where lines cross or touch,
|
||||
and the closed faces they bound are measured (mm², net of nested pieces).
|
||||
Every LINE and lightweight polyline on the layers is split where lines
|
||||
cross or touch, and the closed faces they bound are measured (mm², net of
|
||||
nested pieces).
|
||||
Faces under `min_area`, and thin faces (mean width under 600 mm - wall
|
||||
bodies and reveals, this reader's heuristic) are left out. Each room
|
||||
reports `confidence`: 1.0 when every edge lies on the arch wall layer, 0.6
|
||||
when any edge is a plain line from elsewhere - read `confidence_min` before
|
||||
trusting a foreign plan. A room label already on the drawing is reported
|
||||
with the face it sits in.
|
||||
trusting a foreign plan. Room labels already on the drawing are reported
|
||||
in `labels` with the face they sit in; a face with more than one is listed
|
||||
in `label_conflicts`.
|
||||
|
||||
Never modifies the drawing. Arcs and bulged polyline edges are listed in
|
||||
`skipped`, never flattened into chords. A foreign plan's open doorways are
|
||||
Never modifies the drawing. Arcs and bulged polyline edges, old-style
|
||||
POLYLINEs and block references are listed in `skipped` with their handle
|
||||
and reason - never flattened into chords, never dropped silently. Read
|
||||
`skipped` before trusting `count`. A foreign plan's open doorways are
|
||||
not closed - two rooms joined by one read as one face. Refused: a named
|
||||
layer the drawing does not have (with the list of the ones it has), and no
|
||||
layer matching WALL or DUVAR when `layers` is omitted.
|
||||
|
||||
Reference in New Issue
Block a user