File I/O
yucad reads and writes AutoCAD DXF (round-trip fidelity with AutoCAD
itself) and its own native .yuc container. The file extension selects
the format.
CadFileOpen(dwg, hWin, "in.dxf"); // or in.yuc CadFileSaveAs(dwg, hWin, "out.dxf"); // or out.yuc
Formats by extension
| Extension | Behaviour |
|---|---|
.dxf (or none) | AutoCAD DXF (R2000 / AC1015) — the default. Clean-room reader/writer, validated by opening yucad output in AutoCAD. |
.yuc | yucad native container (see below). |
.dwg | Not yet supported. CadFileSaveAs
returns 0 (FALSE) rather than writing DXF content into a
.dwg file — an honest failure, not a corrupt file. Real DWG is a
planned add-on (external converter / SDK). |
The native .yuc format
A versioned binary container. It keeps the drawing at full AutoCAD fidelity (the body is the validated DXF serialization) while adding what DXF can't carry:
- App-data — the per-entity
park/waystrings (CadEntityPutParkData) and extended-data blobs, restored on load. - Embedded preview — a thumbnail so
CadExtractImagereturns a preview of a.yucfile without re-rendering it. - Single versioned file — future revisions extend it without breaking older readers.
Use .yuc for your application's own working files (fastest, loss-less
for yucad-specific data); export .dxf for interchange with other CAD
tools.
What the reader & writer cover
- Entities — line, ray, xline, circle, arc, ellipse (full & partial), polyline / lwpolyline with bulges, rational spline, point, text with alignment, mtext, hatch (solid + real pattern), dimensions incl. 4-point angular, leader, insert/block, 3DFACE, raster image reference.
- Tables & styles — layers (colour, linetype, lineweight, on/off/frozen), custom linetypes with dash patterns, text styles, dimension styles.
- Attributes — per-entity linetype (group 6), lineweight (370), linetype scale (48) and true colour (420).
- Header variables — the drawing settings AutoCAD expects so the file opens clean.
- Layouts & viewports — paper-space layout with plot settings and
floating viewports, written in AutoCAD's shape (active layout content in
ENTITIESflagged paper-space;LAYOUTobjects with plot settings). - XDATA — extended entity data is preserved through a read/write round-trip.
The layout/viewport and hatch-pattern output were validated by
opening yucad-written DXF directly in AutoCAD. When adding to the writer, compare
against a genuine AutoCAD export of the same construct rather than guessing group
codes.
Raster images
CadAddImage references an external raster file; the DXF carries the
IMAGE entity plus the IMAGEDEF/IMAGEDEF_REACTOR objects AutoCAD needs. Formats the
underlying image loader already handles include JPG, PNG, BMP, GIF, ICO and SVG.