Releases: pr0m1th3as/drafting
Release list
drafting-0.1.0
The drafting package provides the drafting layer an engineering design package needs: compute planar geometry, build a drawing from it, and emit that drawing as a DXF file a CAD program or a CNC machine will accept, as a solid for a slicer, as LaTeX for a report, or onto paper at a stated scale. It is organised as four namespaces whose dependencies point downward only — +geom for planar geometry, which knows nothing of file formats or drawings; +dxf for AutoCAD R12 ASCII DXF in both directions; +stl for binary STL from a stack of planar sections; and +draw for the drawing model and the backends that render it. All geometry is in millimetres.
The centre of the package is draw.Drawing, a value class carrying lines, polylines with per-vertex bulges, arcs, circles, ellipses, text, points, hatches, blocks and inserts on named layers, with line types and colours. Dimensions are stored semantically — the measured points, an offset and a direction — and are turned into lines, ticks and text by whichever backend renders them, so a dimension states what it measures rather than a number that can fall out of step with the geometry. Linear, angular, diameter and radius dimensions are supported, along with centre marks, leaders, an ISO A-series title block, and a coordinate table for a profile that cannot be dimensioned.
Every backend consumes one lowered entity list produced by draw.Drawing.entities, so plot, print, tikz and dxf.write cannot disagree about what a drawing contains, and no backend can silently fail to know an entity type. draw.fromentities raises an entity list back into a drawing, blocks and all, with dimensions returning as dimensions that measure their geometry again — so a DXF is a round trip rather than a one-way door, and the ordinary workflow of opening an existing drawing, adding to it and writing it back is possible. draw.Drawing.print puts a drawing on a named sheet at a stated scale, so a distance measured on the paper times the scale denominator is the distance in the model.
A dimension is written as a true DIMENSION entity with a DIMSTYLE record and its picture in an anonymous block, so a CAD application receives a dimension it can edit rather than six loose lines. What R12 cannot carry is recorded rather than hidden: a hatch is generated as explicit fill lines and loses nothing, while an ellipse is sampled to a closed polyline and is reported as a loss.
This release is thirty-one public functions across the four namespaces plus the draw.Drawing class, 814 built-in self-tests, and 67 %!demo blocks — nearly all of which end in a plot, so the documentation shows what a function does rather than only describing it.
Documentation is at https://pr0m1th3as.github.io/drafting/, and ROADMAP.md sets out what is planned and what is deliberately out of scope.