Drawing Convert
drawing_convertConvert DXF or DWG drawings to PDF, SVG, PNG, or a different DXF release at true scale, with damaged files repaired where possible.
Instructions
Convert a DXF drawing (any version R12 to R2018, text or binary, damaged files repaired where possible) to PDF, SVG, PNG or another DXF version. Model space only. The drawing is converted at true scale: 1 drawing unit is $INSUNITS-to-millimetres millimetres on the page times the scale, so a 100 mm line at 1:1 is 100 mm on the page (283.465 pt in the PDF); a drawing with no unit is taken as millimetres and says so in a warning. output_format: pdf (vector, one page), svg (vector), png (the PDF rasterised, greyscale, 150 dpi or less) or dxf (rewritten to dxf_version: R12, R2000, R2004, R2007, R2010, R2013, R2018). sheet: auto (the drawing extents plus 10 mm on every side) or A4, A3, A2, A1, A0 (ISO 5457, landscape, portrait when only that fits). scale: auto (1:1 on an automatic sheet when the page fits A0, else the largest ISO 5455 scale that does; on a named sheet the largest one, never an enlargement, that fits inside the 10 mm margins) or an ISO 5455 scale (50:1, 20:1, 10:1, 5:1, 2:1, 1:1, 1:2, 1:5, 1:10, 1:20, 1:50, 1:100, 1:200, 1:500, 1:1000, 1:2000, 1:5000, 1:10000). A sheet and scale that do not fit together are refused, not clipped. All ink is black; line weights are kept in millimetres on the page; dashes are the drawing's linetypes. Text becomes glyph outlines (no text layer in PDF, SVG, PNG). data.losses lists everything the target cannot carry or the renderer did not draw (colour, fonts replaced, text not searchable, MTEXT formatting, hatch patterns, ACIS solids and proxy objects, hidden layers, images, paper space, external references; for DXF output the entity types and properties the chosen release lacks, found by writing the file and reading it back), and data.entities counts the entities drawn and skipped per type. A DWG (R12, R2000 to R2018; also one named .dxf) is converted to DXF first by LibreDWG's dwg2dxf, which the user must have installed (ENG_TOOLKIT_DWG2DXF or PATH; the toolkit runs it as a separate program with a time, memory and size limit) and the DXF is then converted like any other; data.dwg names the release and the tool version, and LibreDWG may lose or change content. Without the program a DWG returns engine.unavailable with what to install. The file is untrusted: it is converted in a separate process with a time and 2048 MB limit; files over 50 MB, over 200000 entities or over 1000000 units of work (entities, vertices and text characters, block references expanded), block references that loop or nest deeper than 16, coordinates beyond 1e+12 mm and pages over 5080 mm are refused or cut, with a reason. NaN and infinite coordinates are removed and listed. The input is never changed; the output is converted. in the job directory. Needs the optional drawing engine (uv sync --extra drawing); png also needs uv sync --extra png.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"input_path": "<input_path>",
"output_format": "<output_format>"
},
"name": "drawing_convert"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | pdf, svg, png only. auto or an ISO 5455 scale: 50:1, 20:1, 10:1, 5:1, 2:1, 1:1, 1:2, 1:5, 1:10, 1:20, 1:50, 1:100, 1:200, 1:500, 1:1000, 1:2000, 1:5000, 1:10000 | auto |
| sheet | No | pdf, svg, png only. auto (extents plus 10 mm) or one of A4, A3, A2, A1, A0 (ISO 5457) | auto |
| input_path | Yes | Path to the drawing: a .dxf, or a .dwg (needs LibreDWG's dwg2dxf, installed by the user; see the description) | |
| dxf_version | No | dxf only. One of R12, R2000, R2004, R2007, R2010, R2013, R2018 | R2018 |
| output_format | Yes | One of pdf, svg, png, dxf |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| data | No | Non-quantity payload (reports, listings) | |
| error | No | ||
| value | No | Primary quantity result | |
| values | No | All named quantity results (includes the primary) | |
| warnings | No | ||
| artifacts | No | ||
| provenance | Yes | What produced the result and from which inputs. | |
| review_status | No | unreviewed |