Skip to main content

Crate dxf

Crate dxf 

Source

Modules§

mtext

Structs§

Block
a block: its name, base point, flags (70: 1 anonymous, 2 attributes, 4 xref, 8 xref overlay, 16 external, 32 resolved, 64 referenced), entities
BlockRecord
a block record of the table
BlockRef
what draws through an anonymous block: DIMENSION (and its kinds ARC_DIMENSION, LARGE_RADIAL_DIMENSION) and ACAD_TABLE (2: the block; 10 its insertion point for a table)
Common
what every entity has
Dash
an element of a linetype: a dash (positive), a gap (negative) or a dot (0); a shape or text of a complex linetype is kept as a flag (74) and its text
DimStyle
a dimension style (what a LEADER’s arrow needs)
Document
a whole file
Entity
an entity: what all have, and its kind’s geometry
Hatch
HATCH
Header
the header’s variables this reader uses
Insert
INSERT (also MINSERT’s array) with its ATTRIBs
Layer
a layer of the table
Leader
LEADER: its vertices (WCS), an arrowhead (71), a spline path (72), the dimension style (3)
Limits
the bounds a file must stay in (Limits::DEFAULT; raise them for large files you trust more)
LinetypeDef
a linetype of the table
MText
MTEXT
Mesh
POLYLINE as a polyface mesh (70 bit 64: faces of up to four vertices, an edge invisible where its index is negative) or a polygon mesh (70 bit 16: m by n vertices, closed in m or n)
Name
a name of the file (a layer, linetype, text style, block, an entity’s kind): an index into Names; names that differ only in the case of ASCII letters are one (AutoCAD’s rule)
Names
the names of a file, in the order they were first seen (Name(0) is the layer “0”)
Path
a hatch’s boundary path: its flags (92: 1 external, 2 polyline, 4 derived, 8 textbox, 16 outermost) and edges
PatternLine
a line family of a hatch pattern as the file stores it, already scaled and turned: angle (53, degrees), a base point (43, 44), the offset to the next line (45, 46) and dashes (49: positive on, negative off, 0 a dot)
Polyline
LWPOLYLINE, and POLYLINE with its VERTEXes (2D and 3D; meshes are Kind::Mesh)
Quad
SOLID, TRACE (the outline 10, 11, 13, 12 in OCS) and 3DFACE (10, 11, 12, 13 in WCS; 70: invisible edges)
Special
a run of a TEXT after its %% codes: the text and how it is decorated
Spline
SPLINE (and the spline of a HELIX): degree, knots, control points with weights, fit points
Stats
what was read
StyleDef
a text style of the table
Substitute
a font’s stand-in
Tables
the tables
Text
TEXT, ATTRIB and ATTDEF
Vertex
a vertex of a polyline: its point (OCS for 2D polylines, WCS for 3D), the bulge of the segment that starts here (the tangent of a quarter of its arc’s angle, positive: counter-clockwise), the widths at its start and end
Wipeout
WIPEOUT (and IMAGE’s frame, read alike): insertion point, the u and v vectors of a pixel, the size in pixels, the clip boundary in pixel coordinates (71: 1 a rectangle of two corners, 2 a polygon)

Enums§

Color
an entity’s colour (62, 420): by layer, by block, an index of AutoCAD’s palette (1 to 255; aci_rgb) or a true colour 0xRRGGBB (420 wins over 62)
Edge
an edge of a hatch’s boundary path (angles in degrees, as the file has them)
Error
what went wrong; the text says where
Family
a family of the fonts in the repository
Kind
an entity’s geometry
Linetype
an entity’s linetype (6): by layer (also when absent), by block, or a linetype of the table (“CONTINUOUS” is one)
Lineweight
a lineweight (370): by layer, by block, the drawing’s default ($LWDEFAULT), or hundredths of a millimetre
Transparency
a transparency (440): by layer, by block, or an alpha (255: opaque, 0: invisible)
Where
where an entity marker was

Constants§

SAMPLE
the sample whose advance sets the width factor of a substitute

Traits§

Sink
what a streaming read hands out, in the file’s order: the header (also an empty one, before anything else), the tables (once, when the TABLES section ends, or empty before the first block or entity), each block when its ENDBLK is read, each entity of ENTITIES (paper space too: Common::paper)

Functions§

aci_rgb
AutoCAD’s colour index (ACI) as 0xRRGGBB: 1 red, 2 yellow, 3 green, 4 cyan, 5 blue, 6 magenta, 7 white (black on a light background: the caller decides), 8 and 9 greys, 10 to 249 24 hues of 15 degrees, each in five brightnesses (255, 204, 153, 127, 76) and each of those mixed half with white of that brightness, 250 to 255 greys; 0 and 256 (by block, by layer) are white
decode_unicode_escapes
\U+XXXX (four or five hex digits) as the character it names; \M+NXXXX as the double byte XXXX of the East Asian page N (mbcs). Everything else stays (also “\”: TEXT has no escapes; MTEXT is parsed by mtext::parse)
font_substitute
the stand-in of a style’s font file (3) or TrueType family (its XDATA), compared without case and path: TrueType names by their family, everything else (“.shx”, no extension, unknown) as an SHX font
is_binary
whether bytes begin like a binary DXF
load
a whole file in memory into a Document (every entity kept: Limits::kept_entities and kept_points bound them)
read
a file read piece by piece: source fills a buffer and says how many bytes it put there (0: the end); the sink gets what was read in the file’s order. Only the tables and the blocks are kept (Limits bound them); the entities of ENTITIES go to the sink one by one
specials
TEXT’s %% codes: %%c the diameter sign (U+2205), %%d the degree sign, %%p plus-minus, %%nnn the character of that code (Windows-1252 above 127), %%% a percent sign; %%u, %%o and %%k switch underline, overline and strike-through on and off (the runs they start). Unknown codes stay as they are

Type Aliases§

P3
a point (x, y, z)
Result