Drawing: Finalize (validate + save + screenshot)
drawing_finalizeValidates and critiques the CAD drawing, saves it to disk, exports a screenshot, and returns the DWG path so you can confirm final quality before delivery.
Instructions
Premium completion gate: runs BOTH the 8-step validator AND the premium critique focuses (iso128, layer_color, dim_overlap, untrimmed_corner, duplicate_entities, construction_left, gdt, plus the P&ID focuses pid_dangling_line, pid_duplicate_tag, pid_incompatible_connection, pid_untagged_instrument, pid_illegal_tag, pid_unconnected_equipment — silent on a sheet with no P&ID symbols, plus the mechanical focuses mech_missing_centreline, mech_unhatched_section, mech_view_misaligned, mech_duplicate_dimension, mech_thread_unrepresented, mech_bom_balloon_mismatch — silent on a sheet with no mechanical part, plus the architectural focuses arch_room_unlabelled, arch_wall_gap, arch_opening_clash — silent on a sheet with no ACADMCP_ARCH record, plus the topology focuses topo_dangling_endpoint, topo_near_miss, topo_interior_crossing — on network layers no P&ID or architectural focus reads, silent on every sheet this server draws), then saves to disk, exports a screenshot, and returns the DWG path.
The validator and the critique share one read of the drawing - every entity of
every space, model and paper, with no cap (one DXF export on the live engine). A
drawing over MAX_QA_ENTITIES (default 2,000,000; 0 disables) is not read in part:
the validator reports scan_incomplete and each entity check reports an issue with
detail.code scan_incomplete, so the gate fails. A check that raises is an error
issue with detail.code check_failed, never a clean result.
Raises ToolError if any validator 'error' finding is present, or if critique reports an 'error' (or, with strict_critique=True, any critique issue). Critique warnings are surfaced under payload['critique'] without failing the gate by default. A quarantined document is refused.
With requirements (the drawing_verify_requirements shape) every requirement is
measured on the CAD geometry after the save: the payload adds geometry_acceptance
(the full report), drafting_quality (the score, unchanged), artifact_integrity
(the saved file's sha256 and reverified: every requirement measured again on the
saved file, read fresh and re-bound by handle, feature tag, then geometry, with the
before / after comparison; a saved file that cannot be re-read - a .dwg AutoCAD
will not let us copy - fails the acceptance) and coverage, and a requirement
that does not pass,
stale evidence or a dimension that disagrees with its geometry raises
failed_acceptance - a high drafting score never offsets it. Requirements that do
not parse are refused before anything is saved (invalid_args).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expected | No | Optional contract: {'part_type', 'helix_angle', 'must_have_bore', 'must_have_keyway'} | |
| save_path | No | If given, save drawing here before validation. Pass full path including extension. | |
| requirements | No | Source requirements to verify on the CAD geometry (the drawing_verify_requirements shape). A requirement that does not pass fails the gate (failed_acceptance), whatever the drafting score. | |
| screenshot_path | No | If given, write PNG screenshot to this path. | |
| strict_critique | No | If true, ANY critique issue (including warnings) fails the gate — the full premium discipline. Default false: only critique 'error' issues (e.g. leftover construction geometry) fail; warnings are surfaced in the payload. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||