Repository navigation
0.3.128 - a drawing goes in
The 2026-11-14 report's P0-1, the last P0 item it opened: 147 tools and not
one of them could read a 2D drawing. The workaround it forced - pip install a PDF
renderer OUTSIDE the MCP, render to PNG, crop at high zoom, read the numbers with
a vision model, type them into 21 plan steps - is not a feature. It cannot be
repeated, and nothing links the model back to the drawing.
The fix is not OCR. It is reading the geometry the drawing already contains.
- TWO TOOLS
- catia_read_drawing - what is in this file: format, the file's own units and
the resulting mm per unit, contour and element counts, the layer table, how
small the smallest contour is (text and arrowheads are tiny), the bounds in
mm, and how many text runs were drawn as TEXT and are therefore unreadable.
IT NEVER CONNECTS TO CATIA, so it is safe to run while something else holds
the session, and it is the call to make BEFORE deciding on filters. - catia_import_drawing - the same parse, drawn into a new sketch at 1:1, one
call, closed at the end, with what CATIA then sees (element count, outline
length) in the reply beside the bounds in mm.
DXF (ASCII), SVG and VECTOR PDF, parsed with the standard library only: no
ezdxf, no svgpathtools, no PDF library - none of them is installed and none
was added.
- PIECES KEEP THEIR OWN KIND
Lines stay lines, arcs stay arcs - DXF BULGES included, which are arc segments
inside a polyline - and circles stay circles. A pad built on the import is not
faceted, which is the difference between a round hole and a 24-sided one.
Measured on B30 2026-11-14, one fresh document per case:
SVG 40 x 20 plate + D6 hole, pad 10 7717.26 mm3 vs 7717.26 analytic
DXF square as four separate LINEs 3600.00 vs 3600.00
DXF stadium, bulge=1 caps, pad 5 5570.80 vs 5570.80 (chords: 4000)
DXF 1 x 0.5 INCH ($INSUNITS=1), pad 2 645.16 vs 645.16
DXF 1 x 0.5 mm at 1:100 (scale=100) 10000.00 vs 10000.00
- STITCHING, BECAUSE A CAD EXPORT HAS ONE ENTITY PER EDGE
The workspace's A3 sample parses to 672 contours of which 83 are closed - and all
83 of those are 3.4-4.6 mm arrowheads. So closed_only used to remove the entire
model and a pad on the raw import was impossible. Edges that share an endpoint are
now joined into loops.
WHERE MORE THAN ONE UNUSED EDGE MEETS A JOINT, THE CHAIN STOPS and the count is
reported. A guess there is a profile the drawing never had, it pads to a
plausible-looking solid, and nothing in the reply would say so.
- IT REFUSES RATHER THAN TRUNCATES
Over 2000 sketch elements the import stops, with the element count, the contour
count and the smallest contour - enough to choose min_size / layers / region from
data instead of guessing. On the 6489-element vectorised sample the refusal IS
the right answer, and the audit checks the document still holds no sketch
afterwards.
CEILINGS, all measured and now in catia_diagnose: DWG is refused (binary
container; CATIA needs a translator too - re-save as DXF); raster images cannot
be read at all, a scan has no geometry; text drawn as text is not converted,
because a glyph's outline lives in the font program - the reply counts the runs
it skipped, so "the dimensions are missing" is stated rather than discovered.
Two ordering rules from earlier rounds, applied here before they could bite:
argument validation runs BEFORE the file is touched, and parse_* return the
file's own units with mm_per_unit beside them while read_drawing applies the
factor - so a test can check either half on its own.
2073 tests. 151 tools. 12/12 B30 checks. 421 files, 2188800 bytes.