@ifc-lite/drawing-2d 1.19.0 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dxf/aci-colors.d.ts +13 -0
- package/dist/dxf/aci-colors.d.ts.map +1 -1
- package/dist/dxf/aci-colors.js +68 -0
- package/dist/dxf/aci-colors.js.map +1 -1
- package/dist/dxf/writer.d.ts +111 -0
- package/dist/dxf/writer.d.ts.map +1 -0
- package/dist/dxf/writer.js +338 -0
- package/dist/dxf/writer.js.map +1 -0
- package/dist/dxf-exporter.d.ts +66 -0
- package/dist/dxf-exporter.d.ts.map +1 -0
- package/dist/dxf-exporter.js +137 -0
- package/dist/dxf-exporter.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/dxf/aci-colors.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export declare function rgbIntToCss(rgb: number): string;
|
|
2
2
|
/** Resolve an ACI colour number (1-255) to a CSS hex colour. */
|
|
3
3
|
export declare function aciToCss(index: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a CSS colour (`#rrggbb`/`#rgb` hex, or an `rgb(...)`/`rgba(...)`
|
|
6
|
+
* function — the only formats {@link parseCssColor} handles; bare colour
|
|
7
|
+
* keywords are NOT parsed and take the ACI-7 fallback) to the nearest
|
|
8
|
+
* AutoCAD Color Index (1-255), for the DXF writer
|
|
9
|
+
* (issue #1861): DXF LAYER/entity colour is always an ACI, so an exported
|
|
10
|
+
* layer's CSS style colour needs a reverse lookup against the same table
|
|
11
|
+
* {@link aciToCss} reads forward. Ties break toward the lowest index (the
|
|
12
|
+
* classic 1-9 entries sort first, so a primary hue prefers its named ACI
|
|
13
|
+
* over a near-identical generated band entry). Unparseable input falls back
|
|
14
|
+
* to ACI 7 (black/white — the classic "on paper" colour).
|
|
15
|
+
*/
|
|
16
|
+
export declare function cssToAci(css: string): number;
|
|
4
17
|
//# sourceMappingURL=aci-colors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aci-colors.d.ts","sourceRoot":"","sources":["../../src/dxf/aci-colors.ts"],"names":[],"mappings":"AA+DA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI9C"}
|
|
1
|
+
{"version":3,"file":"aci-colors.d.ts","sourceRoot":"","sources":["../../src/dxf/aci-colors.ts"],"names":[],"mappings":"AA+DA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAqB5C"}
|
package/dist/dxf/aci-colors.js
CHANGED
|
@@ -71,4 +71,72 @@ export function aciToCss(index) {
|
|
|
71
71
|
return '#000000';
|
|
72
72
|
return rgbIntToCss(ACI_TABLE[i]);
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Resolve a CSS colour (`#rrggbb`/`#rgb` hex, or an `rgb(...)`/`rgba(...)`
|
|
76
|
+
* function — the only formats {@link parseCssColor} handles; bare colour
|
|
77
|
+
* keywords are NOT parsed and take the ACI-7 fallback) to the nearest
|
|
78
|
+
* AutoCAD Color Index (1-255), for the DXF writer
|
|
79
|
+
* (issue #1861): DXF LAYER/entity colour is always an ACI, so an exported
|
|
80
|
+
* layer's CSS style colour needs a reverse lookup against the same table
|
|
81
|
+
* {@link aciToCss} reads forward. Ties break toward the lowest index (the
|
|
82
|
+
* classic 1-9 entries sort first, so a primary hue prefers its named ACI
|
|
83
|
+
* over a near-identical generated band entry). Unparseable input falls back
|
|
84
|
+
* to ACI 7 (black/white — the classic "on paper" colour).
|
|
85
|
+
*/
|
|
86
|
+
export function cssToAci(css) {
|
|
87
|
+
const rgb = parseCssColor(css);
|
|
88
|
+
if (rgb === null)
|
|
89
|
+
return 7;
|
|
90
|
+
const r = (rgb >> 16) & 0xff;
|
|
91
|
+
const g = (rgb >> 8) & 0xff;
|
|
92
|
+
const b = rgb & 0xff;
|
|
93
|
+
let best = 7;
|
|
94
|
+
let bestDist = Infinity;
|
|
95
|
+
for (let i = 1; i <= 255; i++) {
|
|
96
|
+
const c = ACI_TABLE[i];
|
|
97
|
+
const dr = r - ((c >> 16) & 0xff);
|
|
98
|
+
const dg = g - ((c >> 8) & 0xff);
|
|
99
|
+
const db = b - (c & 0xff);
|
|
100
|
+
const dist = dr * dr + dg * dg + db * db;
|
|
101
|
+
if (dist < bestDist) {
|
|
102
|
+
bestDist = dist;
|
|
103
|
+
best = i;
|
|
104
|
+
if (dist === 0)
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return best;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Parse `#rgb`, `#rrggbb`, `rgb(r,g,b)`, or `rgba(r,g,b,a)` into a 24-bit
|
|
112
|
+
* integer; null on failure. The function form is fully anchored (closing
|
|
113
|
+
* paren required, nothing before/after) and arity-checked — `rgb(...)` takes
|
|
114
|
+
* exactly three components and `rgba(...)` exactly four — so malformed
|
|
115
|
+
* strings (`rgb(1,2,3`, `rgb(1,2,3)junk`, `rgba(1,2,3)`) fall back to the
|
|
116
|
+
* caller's ACI-7 default instead of silently half-parsing (PR #1871 review).
|
|
117
|
+
*/
|
|
118
|
+
function parseCssColor(css) {
|
|
119
|
+
const s = css.trim();
|
|
120
|
+
const hex3 = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(s);
|
|
121
|
+
if (hex3) {
|
|
122
|
+
const r = parseInt(hex3[1] + hex3[1], 16);
|
|
123
|
+
const g = parseInt(hex3[2] + hex3[2], 16);
|
|
124
|
+
const b = parseInt(hex3[3] + hex3[3], 16);
|
|
125
|
+
return (r << 16) | (g << 8) | b;
|
|
126
|
+
}
|
|
127
|
+
const hex6 = /^#([0-9a-f]{6})$/i.exec(s);
|
|
128
|
+
if (hex6)
|
|
129
|
+
return parseInt(hex6[1], 16);
|
|
130
|
+
const rgbFn = /^(rgb|rgba)\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*\.?\d+)\s*)?\)$/i.exec(s);
|
|
131
|
+
if (rgbFn) {
|
|
132
|
+
const hasAlpha = rgbFn[5] !== undefined;
|
|
133
|
+
if ((rgbFn[1].length === 3) === hasAlpha)
|
|
134
|
+
return null; // rgb: 3 args; rgba: 4 args
|
|
135
|
+
const r = Math.min(255, parseInt(rgbFn[2], 10));
|
|
136
|
+
const g = Math.min(255, parseInt(rgbFn[3], 10));
|
|
137
|
+
const b = Math.min(255, parseInt(rgbFn[4], 10));
|
|
138
|
+
return (r << 16) | (g << 8) | b;
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
74
142
|
//# sourceMappingURL=aci-colors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aci-colors.js","sourceRoot":"","sources":["../../src/dxf/aci-colors.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;GAWG;AAEH,SAAS,WAAW,CAAC,MAAc,EAAE,CAAS,EAAE,CAAS;IACvD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CA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,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Point2D } from '../types.js';
|
|
2
|
+
/** Line style resolved to a DXF linetype. `dashed` maps to the `DASHED` LTYPE. */
|
|
3
|
+
export type DxfLinetype = 'CONTINUOUS' | 'DASHED';
|
|
4
|
+
/** Horizontal text justification (subset of DXF group 72). */
|
|
5
|
+
export type DxfTextHAlign = 'left' | 'center' | 'right';
|
|
6
|
+
/** Vertical text justification (subset of DXF group 73). */
|
|
7
|
+
export type DxfTextVAlign = 'baseline' | 'bottom' | 'middle' | 'top';
|
|
8
|
+
/**
|
|
9
|
+
* Sanitize a free-text label into a valid DXF R12 LAYER name: every
|
|
10
|
+
* character outside the R12 symbol-name set (`A-Z a-z 0-9 $ - _` — spaces,
|
|
11
|
+
* unicode and punctuation included) becomes `_`, runs of `_` produced by
|
|
12
|
+
* adjacent replacements are collapsed, the result is made non-empty, and
|
|
13
|
+
* truncated to the R12 31-character symbol-name limit.
|
|
14
|
+
*
|
|
15
|
+
* Distinct inputs can collide after this mapping (`Wände`/`Wønde` →
|
|
16
|
+
* `W_nde`); {@link DxfWriter.layer} disambiguates with a numeric suffix so
|
|
17
|
+
* two source layers never silently merge.
|
|
18
|
+
*/
|
|
19
|
+
export declare function sanitizeDxfLayerName(name: string): string;
|
|
20
|
+
export interface DxfWriterOptions {
|
|
21
|
+
/**
|
|
22
|
+
* `999` comment written at the very top of the file, before the HEADER
|
|
23
|
+
* section (valid DXF in every version; the conventional place to state
|
|
24
|
+
* metadata a reader should show a human but never needs to parse — here,
|
|
25
|
+
* the unit R12 can't declare via `$INSUNITS`). Defaults to a generic
|
|
26
|
+
* "units: metres" note; pass a longer string (e.g. including the
|
|
27
|
+
* `IfcProjectedCRS` name) for a georeferenced export.
|
|
28
|
+
*/
|
|
29
|
+
headerComment?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Accumulates DXF entities and layer definitions, then assembles the full
|
|
33
|
+
* ASCII DXF R12 (AC1009) document text. One writer instance == one DXF
|
|
34
|
+
* file; layers are registered on first use (`addPolyline`/`addLine`/
|
|
35
|
+
* `addText`) via a CSS colour, resolved to the nearest ACI with
|
|
36
|
+
* {@link cssToAci}.
|
|
37
|
+
*/
|
|
38
|
+
export declare class DxfWriter {
|
|
39
|
+
private readonly layers;
|
|
40
|
+
/** Raw (pre-sanitization) name → assigned safe name, for stable reuse + collision disambiguation. */
|
|
41
|
+
private readonly layerNameBySource;
|
|
42
|
+
private readonly entities;
|
|
43
|
+
private readonly headerComment;
|
|
44
|
+
private minX;
|
|
45
|
+
private minY;
|
|
46
|
+
private maxX;
|
|
47
|
+
private maxY;
|
|
48
|
+
/** One warning per document for non-finite input coordinates — see extend(). */
|
|
49
|
+
private warnedNonFinite;
|
|
50
|
+
constructor(options?: DxfWriterOptions);
|
|
51
|
+
private extend;
|
|
52
|
+
/**
|
|
53
|
+
* Register (or reuse) a layer. Returns the sanitized layer name to pass to
|
|
54
|
+
* `addPolyline`/`addLine`/`addText`. Re-registering the same source name
|
|
55
|
+
* with a different colour/linetype is a no-op (first registration wins) —
|
|
56
|
+
* callers should derive one style per logical layer. DIFFERENT source
|
|
57
|
+
* names whose sanitized forms collide (`Wände`/`Wønde` → `W_nde`) get a
|
|
58
|
+
* numeric suffix (`W_nde`, `W_nde_2`, …) instead of silently merging onto
|
|
59
|
+
* one layer.
|
|
60
|
+
*/
|
|
61
|
+
layer(name: string, cssColor: string, linetype?: DxfLinetype): string;
|
|
62
|
+
/** `62\n<aci>\n` when an entity overrides its layer's colour, else ''. */
|
|
63
|
+
private colorOverrideGroup;
|
|
64
|
+
/**
|
|
65
|
+
* Add a closed or open polyline (tessellated arcs/circles are pre-sampled
|
|
66
|
+
* by the caller), written as classic `POLYLINE` + `VERTEX`* + `SEQEND` —
|
|
67
|
+
* `LWPOLYLINE` does not exist before R14. `colorOverride` (CSS colour)
|
|
68
|
+
* emits a per-entity ACI (group 62) on the POLYLINE header instead of
|
|
69
|
+
* inheriting the layer colour — used when several IFC types share one
|
|
70
|
+
* category layer but render with distinct colours in the source drawing
|
|
71
|
+
* (matching the SVG exporter's per-entity fill/stroke).
|
|
72
|
+
*/
|
|
73
|
+
addPolyline(points: readonly Point2D[], layer: string, closed: boolean, colorOverride?: string): void;
|
|
74
|
+
/** Add a single straight segment. `colorOverride`: see {@link addPolyline}. */
|
|
75
|
+
addLine(start: Point2D, end: Point2D, layer: string, colorOverride?: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Add single-line text. Multiline callers (annotations/MTEXT) should split
|
|
78
|
+
* on `\n` and call this once per line, offsetting `position` themselves
|
|
79
|
+
* (matching the SVG exporter's tspan stacking) — DXF `TEXT` group 1 is a
|
|
80
|
+
* single line. `colorOverride`: see {@link addPolyline}.
|
|
81
|
+
*/
|
|
82
|
+
addText(position: Point2D, text: string, height: number, layer: string, options?: {
|
|
83
|
+
rotationDeg?: number;
|
|
84
|
+
hAlign?: DxfTextHAlign;
|
|
85
|
+
vAlign?: DxfTextVAlign;
|
|
86
|
+
colorOverride?: string;
|
|
87
|
+
}): void;
|
|
88
|
+
/** True once at least one finite point has been written (controls $EXTMIN/$EXTMAX). */
|
|
89
|
+
private hasExtents;
|
|
90
|
+
private buildHeader;
|
|
91
|
+
private buildLtypeTable;
|
|
92
|
+
/**
|
|
93
|
+
* STYLE table with the single `STANDARD` text style. Every TEXT entity
|
|
94
|
+
* this writer emits carries no group 7 and therefore implicitly
|
|
95
|
+
* references STANDARD; defining it keeps strict R12 readers from having
|
|
96
|
+
* to invent it. (Fixed-height 0, width factor 1, `txt` font — the
|
|
97
|
+
* classic defaults.)
|
|
98
|
+
*/
|
|
99
|
+
private buildStyleTable;
|
|
100
|
+
private buildLayerTable;
|
|
101
|
+
private buildTables;
|
|
102
|
+
private buildEntities;
|
|
103
|
+
/**
|
|
104
|
+
* Assemble the full ASCII DXF R12 document: a leading `999` comment
|
|
105
|
+
* (units — see class docs), then HEADER + TABLES + ENTITIES + EOF. No
|
|
106
|
+
* BLOCKS/OBJECTS sections and no BLOCK_RECORD table — R12 doesn't require
|
|
107
|
+
* them (unlike R13+, where their absence would make the file invalid).
|
|
108
|
+
*/
|
|
109
|
+
toString(): string;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/dxf/writer.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,kFAAkF;AAClF,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,QAAQ,CAAC;AAElD,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACxD,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AA4CrE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKzD;AAyBD,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAC5D,qGAAqG;IACrG,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6B;IAC/D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,IAAI,CAAY;IACxB,OAA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|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* ASCII DXF writer (issue #1861): the counterpart to `parser.ts` (DXF
|
|
6
|
+
* import, #1782). Produces DXF R12 (AC1009) text — HEADER, TABLES (LTYPE,
|
|
7
|
+
* STYLE, LAYER), ENTITIES — from generic entities (POLYLINE/VERTEX/SEQEND,
|
|
8
|
+
* LINE, TEXT) with a layer name and colour, so any CAD/BIM tool that reads
|
|
9
|
+
* plain ASCII DXF can open the result.
|
|
10
|
+
*
|
|
11
|
+
* R12 is deliberate, not a placeholder: entity handles (group 5) and
|
|
12
|
+
* subclass markers (group 100, e.g. `AcDbEntity`/`AcDbPolyline`) are
|
|
13
|
+
* MANDATORY from R13 onward, and a genuinely valid R2000+ file additionally
|
|
14
|
+
* needs a BLOCK_RECORD table, `*Model_Space`/`*Paper_Space` BLOCKS, and an
|
|
15
|
+
* OBJECTS section with the root dictionary — none of which this writer
|
|
16
|
+
* produces. Declaring a later `$ACADVER` while omitting all of that would
|
|
17
|
+
* make the file reject or force-repair in strict readers (AutoCAD,
|
|
18
|
+
* ODA/Teigha-based BIM tools). R12 requires none of it and is the universal
|
|
19
|
+
* interop baseline every DXF-capable tool still reads; a full R2000+
|
|
20
|
+
* skeleton (handles, subclass markers, BLOCK_RECORD, paper space, OBJECTS)
|
|
21
|
+
* is a possible follow-up, not this writer's job.
|
|
22
|
+
*
|
|
23
|
+
* Consequences of the R12 target:
|
|
24
|
+
* - No `$INSUNITS` header variable (introduced in R14) — the exported
|
|
25
|
+
* unit (always metres) is instead stated in a `999` comment at the very
|
|
26
|
+
* top of the file (valid in every DXF version, ignored by every reader).
|
|
27
|
+
* - `LWPOLYLINE` doesn't exist until R14 either; polylines are written as
|
|
28
|
+
* classic `POLYLINE` + `VERTEX`* + `SEQEND`.
|
|
29
|
+
* - No group 5 (handle) or group 100 (subclass marker) anywhere in this
|
|
30
|
+
* file — `writer.test.ts` asserts that invariant so a future edit can't
|
|
31
|
+
* reintroduce a half-upgraded, invalid hybrid. The same goes for LTYPE
|
|
32
|
+
* group 74 (complex-linetype element type, R13+): R12 linetype patterns
|
|
33
|
+
* are plain `49` dash lengths only.
|
|
34
|
+
* - Symbol (layer) names follow the R12 rules: at most 31 characters from
|
|
35
|
+
* `A-Z a-z 0-9 $ - _` — see {@link sanitizeDxfLayerName}. Distinct
|
|
36
|
+
* source names that collide after sanitizing get a numeric suffix so
|
|
37
|
+
* they never silently merge into one layer.
|
|
38
|
+
* - TABLES carries LTYPE, STYLE (the `STANDARD` text style every TEXT
|
|
39
|
+
* entity implicitly references), and LAYER. VPORT/VIEW/UCS/APPID/
|
|
40
|
+
* DIMSTYLE are optional in R12 (readers create defaults) and are
|
|
41
|
+
* omitted.
|
|
42
|
+
*
|
|
43
|
+
* Coordinates are written verbatim in the caller's unit (drawing metres);
|
|
44
|
+
* see `dxf-exporter.ts` for how the viewer maps its render-frame
|
|
45
|
+
* coordinates into true world/map metres before they reach this writer.
|
|
46
|
+
*/
|
|
47
|
+
import { cssToAci } from './aci-colors.js';
|
|
48
|
+
const H_ALIGN_CODE = { left: 0, center: 1, right: 2 };
|
|
49
|
+
const V_ALIGN_CODE = { baseline: 0, bottom: 1, middle: 2, top: 3 };
|
|
50
|
+
/** Default `999` comment prepended to the file (states units — R12 has no `$INSUNITS`). */
|
|
51
|
+
const DEFAULT_HEADER_COMMENT = 'ifc-lite section export - units: metres';
|
|
52
|
+
/**
|
|
53
|
+
* R12 symbol (table-entry) names allow only letters, digits, `$`, `-` and
|
|
54
|
+
* `_` — anything else (unicode, spaces, punctuation) must be replaced.
|
|
55
|
+
* Later DXF versions relax this, but this writer targets R12 (see module
|
|
56
|
+
* docs), so it enforces the strict R12 set.
|
|
57
|
+
*/
|
|
58
|
+
const INVALID_LAYER_CHARS = /[^A-Za-z0-9$_-]/g;
|
|
59
|
+
/** R12 symbol names are limited to 31 characters (255 is an R2000+ limit). */
|
|
60
|
+
const MAX_LAYER_NAME_LENGTH = 31;
|
|
61
|
+
/**
|
|
62
|
+
* True for an ASCII control character (C0 range or DEL) — these are never
|
|
63
|
+
* legal inside a DXF layer name or TEXT string. Written as a codepoint
|
|
64
|
+
* comparison rather than a control-character regex literal (`\x00`-`\x1f`)
|
|
65
|
+
* so the disallowed bytes never appear as raw source text.
|
|
66
|
+
*/
|
|
67
|
+
function isControlCharCode(code) {
|
|
68
|
+
return code <= 31 || code === 127;
|
|
69
|
+
}
|
|
70
|
+
function stripControlChars(text, replacement) {
|
|
71
|
+
let out = '';
|
|
72
|
+
for (const ch of text) {
|
|
73
|
+
out += isControlCharCode(ch.codePointAt(0) ?? 0) ? replacement : ch;
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Sanitize a free-text label into a valid DXF R12 LAYER name: every
|
|
79
|
+
* character outside the R12 symbol-name set (`A-Z a-z 0-9 $ - _` — spaces,
|
|
80
|
+
* unicode and punctuation included) becomes `_`, runs of `_` produced by
|
|
81
|
+
* adjacent replacements are collapsed, the result is made non-empty, and
|
|
82
|
+
* truncated to the R12 31-character symbol-name limit.
|
|
83
|
+
*
|
|
84
|
+
* Distinct inputs can collide after this mapping (`Wände`/`Wønde` →
|
|
85
|
+
* `W_nde`); {@link DxfWriter.layer} disambiguates with a numeric suffix so
|
|
86
|
+
* two source layers never silently merge.
|
|
87
|
+
*/
|
|
88
|
+
export function sanitizeDxfLayerName(name) {
|
|
89
|
+
const stripped = name.replace(INVALID_LAYER_CHARS, '_').replace(/_{2,}/g, '_');
|
|
90
|
+
const trimmed = stripped.replace(/^_+|_+$/g, '') || stripped;
|
|
91
|
+
const safe = trimmed.length > 0 ? trimmed : 'LAYER';
|
|
92
|
+
return safe.slice(0, MAX_LAYER_NAME_LENGTH);
|
|
93
|
+
}
|
|
94
|
+
/** Sanitize a single line of DXF TEXT content: strip control characters (no raw newlines). */
|
|
95
|
+
function sanitizeDxfText(text) {
|
|
96
|
+
return stripControlChars(text, ' ');
|
|
97
|
+
}
|
|
98
|
+
/** Sanitize a `999` comment line: no raw newlines/control characters. */
|
|
99
|
+
function sanitizeDxfComment(text) {
|
|
100
|
+
return stripControlChars(text, ' ');
|
|
101
|
+
}
|
|
102
|
+
function fmt(n) {
|
|
103
|
+
// Non-finite input stays deterministic ('0.0'); the condition is surfaced
|
|
104
|
+
// to the caller via DxfWriter.extend()'s once-per-document console.warn.
|
|
105
|
+
if (!Number.isFinite(n))
|
|
106
|
+
return '0.0';
|
|
107
|
+
// Fixed precision keeps output deterministic (stable for golden/round-trip
|
|
108
|
+
// tests) while giving sub-micrometre resolution at metre scale.
|
|
109
|
+
return n.toFixed(6);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Accumulates DXF entities and layer definitions, then assembles the full
|
|
113
|
+
* ASCII DXF R12 (AC1009) document text. One writer instance == one DXF
|
|
114
|
+
* file; layers are registered on first use (`addPolyline`/`addLine`/
|
|
115
|
+
* `addText`) via a CSS colour, resolved to the nearest ACI with
|
|
116
|
+
* {@link cssToAci}.
|
|
117
|
+
*/
|
|
118
|
+
export class DxfWriter {
|
|
119
|
+
layers = new Map();
|
|
120
|
+
/** Raw (pre-sanitization) name → assigned safe name, for stable reuse + collision disambiguation. */
|
|
121
|
+
layerNameBySource = new Map();
|
|
122
|
+
entities = [];
|
|
123
|
+
headerComment;
|
|
124
|
+
minX = Infinity;
|
|
125
|
+
minY = Infinity;
|
|
126
|
+
maxX = -Infinity;
|
|
127
|
+
maxY = -Infinity;
|
|
128
|
+
/** One warning per document for non-finite input coordinates — see extend(). */
|
|
129
|
+
warnedNonFinite = false;
|
|
130
|
+
constructor(options = {}) {
|
|
131
|
+
this.headerComment = sanitizeDxfComment(options.headerComment ?? DEFAULT_HEADER_COMMENT);
|
|
132
|
+
}
|
|
133
|
+
extend(p) {
|
|
134
|
+
if (!Number.isFinite(p.x) || !Number.isFinite(p.y)) {
|
|
135
|
+
// A bad upstream coordinate (e.g. a pathological georeference scale)
|
|
136
|
+
// would otherwise vanish silently: NaN fails every comparison below, so
|
|
137
|
+
// it never extends $EXTMIN/$EXTMAX, and fmt() writes it as a
|
|
138
|
+
// deterministic 0.0. Keep both behaviours (the file stays valid and
|
|
139
|
+
// reproducible) but surface the problem — once per document, not per
|
|
140
|
+
// vertex, so a fully-degenerate polyline can't spam the console.
|
|
141
|
+
if (!this.warnedNonFinite) {
|
|
142
|
+
this.warnedNonFinite = true;
|
|
143
|
+
console.warn(`[DxfWriter] non-finite coordinate (${p.x}, ${p.y}) — written as 0.0 and excluded from $EXTMIN/$EXTMAX (further occurrences in this document are not logged)`);
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (p.x < this.minX)
|
|
148
|
+
this.minX = p.x;
|
|
149
|
+
if (p.x > this.maxX)
|
|
150
|
+
this.maxX = p.x;
|
|
151
|
+
if (p.y < this.minY)
|
|
152
|
+
this.minY = p.y;
|
|
153
|
+
if (p.y > this.maxY)
|
|
154
|
+
this.maxY = p.y;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Register (or reuse) a layer. Returns the sanitized layer name to pass to
|
|
158
|
+
* `addPolyline`/`addLine`/`addText`. Re-registering the same source name
|
|
159
|
+
* with a different colour/linetype is a no-op (first registration wins) —
|
|
160
|
+
* callers should derive one style per logical layer. DIFFERENT source
|
|
161
|
+
* names whose sanitized forms collide (`Wände`/`Wønde` → `W_nde`) get a
|
|
162
|
+
* numeric suffix (`W_nde`, `W_nde_2`, …) instead of silently merging onto
|
|
163
|
+
* one layer.
|
|
164
|
+
*/
|
|
165
|
+
layer(name, cssColor, linetype = 'CONTINUOUS') {
|
|
166
|
+
const assigned = this.layerNameBySource.get(name);
|
|
167
|
+
if (assigned !== undefined)
|
|
168
|
+
return assigned;
|
|
169
|
+
const base = sanitizeDxfLayerName(name);
|
|
170
|
+
let safe = base;
|
|
171
|
+
for (let n = 2; this.layers.has(safe); n++) {
|
|
172
|
+
const suffix = `_${n}`;
|
|
173
|
+
safe = base.slice(0, MAX_LAYER_NAME_LENGTH - suffix.length) + suffix;
|
|
174
|
+
}
|
|
175
|
+
this.layers.set(safe, { name: safe, aci: cssToAci(cssColor), linetype });
|
|
176
|
+
this.layerNameBySource.set(name, safe);
|
|
177
|
+
return safe;
|
|
178
|
+
}
|
|
179
|
+
/** `62\n<aci>\n` when an entity overrides its layer's colour, else ''. */
|
|
180
|
+
colorOverrideGroup(cssColor) {
|
|
181
|
+
return cssColor !== undefined ? '62\n' + cssToAci(cssColor) + '\n' : '';
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Add a closed or open polyline (tessellated arcs/circles are pre-sampled
|
|
185
|
+
* by the caller), written as classic `POLYLINE` + `VERTEX`* + `SEQEND` —
|
|
186
|
+
* `LWPOLYLINE` does not exist before R14. `colorOverride` (CSS colour)
|
|
187
|
+
* emits a per-entity ACI (group 62) on the POLYLINE header instead of
|
|
188
|
+
* inheriting the layer colour — used when several IFC types share one
|
|
189
|
+
* category layer but render with distinct colours in the source drawing
|
|
190
|
+
* (matching the SVG exporter's per-entity fill/stroke).
|
|
191
|
+
*/
|
|
192
|
+
addPolyline(points, layer, closed, colorOverride) {
|
|
193
|
+
if (points.length < 2)
|
|
194
|
+
return;
|
|
195
|
+
for (const p of points)
|
|
196
|
+
this.extend(p);
|
|
197
|
+
const pts = points.slice();
|
|
198
|
+
const colorGroup = this.colorOverrideGroup(colorOverride);
|
|
199
|
+
this.entities.push(() => {
|
|
200
|
+
// The 10/20/30 "dummy point" (always 0) is part of the R12 POLYLINE
|
|
201
|
+
// entity — the real coordinates live on the VERTEX chain.
|
|
202
|
+
let s = '0\nPOLYLINE\n8\n' + layer + '\n' + colorGroup +
|
|
203
|
+
'66\n1\n10\n0.0\n20\n0.0\n30\n0.0\n70\n' + (closed ? 1 : 0) + '\n';
|
|
204
|
+
for (const p of pts) {
|
|
205
|
+
s += '0\nVERTEX\n8\n' + layer + '\n10\n' + fmt(p.x) + '\n20\n' + fmt(p.y) + '\n30\n0.0\n';
|
|
206
|
+
}
|
|
207
|
+
s += '0\nSEQEND\n8\n' + layer + '\n';
|
|
208
|
+
return s;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/** Add a single straight segment. `colorOverride`: see {@link addPolyline}. */
|
|
212
|
+
addLine(start, end, layer, colorOverride) {
|
|
213
|
+
this.extend(start);
|
|
214
|
+
this.extend(end);
|
|
215
|
+
const colorGroup = this.colorOverrideGroup(colorOverride);
|
|
216
|
+
this.entities.push(() => '0\nLINE\n8\n' + layer + '\n' + colorGroup +
|
|
217
|
+
'10\n' + fmt(start.x) + '\n20\n' + fmt(start.y) + '\n30\n0.0\n' +
|
|
218
|
+
'11\n' + fmt(end.x) + '\n21\n' + fmt(end.y) + '\n31\n0.0\n');
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Add single-line text. Multiline callers (annotations/MTEXT) should split
|
|
222
|
+
* on `\n` and call this once per line, offsetting `position` themselves
|
|
223
|
+
* (matching the SVG exporter's tspan stacking) — DXF `TEXT` group 1 is a
|
|
224
|
+
* single line. `colorOverride`: see {@link addPolyline}.
|
|
225
|
+
*/
|
|
226
|
+
addText(position, text, height, layer, options = {}) {
|
|
227
|
+
const clean = sanitizeDxfText(text);
|
|
228
|
+
// `height <= 0` alone lets NaN/Infinity through (both compare false), and
|
|
229
|
+
// `fmt` would then write them as the deterministic '0.0' fallback — i.e. a
|
|
230
|
+
// zero-height, invisible TEXT entity, exactly what the guard exists to
|
|
231
|
+
// skip. Reject non-finite heights outright instead.
|
|
232
|
+
if (!clean.trim() || !Number.isFinite(height) || height <= 0)
|
|
233
|
+
return;
|
|
234
|
+
this.extend(position);
|
|
235
|
+
const rotationDeg = options.rotationDeg ?? 0;
|
|
236
|
+
const hAlign = options.hAlign ?? 'left';
|
|
237
|
+
const vAlign = options.vAlign ?? 'baseline';
|
|
238
|
+
const hCode = H_ALIGN_CODE[hAlign];
|
|
239
|
+
const vCode = V_ALIGN_CODE[vAlign];
|
|
240
|
+
const needsAlignPoint = hCode !== 0 || vCode !== 0;
|
|
241
|
+
const colorGroup = this.colorOverrideGroup(options.colorOverride);
|
|
242
|
+
this.entities.push(() => {
|
|
243
|
+
let s = '0\nTEXT\n8\n' + layer + '\n' + colorGroup +
|
|
244
|
+
'10\n' + fmt(position.x) + '\n20\n' + fmt(position.y) + '\n30\n0.0\n' +
|
|
245
|
+
'40\n' + fmt(height) + '\n1\n' + clean + '\n' +
|
|
246
|
+
'50\n' + fmt(rotationDeg) + '\n' +
|
|
247
|
+
'72\n' + hCode + '\n' +
|
|
248
|
+
'73\n' + vCode + '\n';
|
|
249
|
+
if (needsAlignPoint) {
|
|
250
|
+
s += '11\n' + fmt(position.x) + '\n21\n' + fmt(position.y) + '\n31\n0.0\n';
|
|
251
|
+
}
|
|
252
|
+
return s;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/** True once at least one finite point has been written (controls $EXTMIN/$EXTMAX). */
|
|
256
|
+
hasExtents() {
|
|
257
|
+
return Number.isFinite(this.minX) && Number.isFinite(this.maxX);
|
|
258
|
+
}
|
|
259
|
+
buildHeader() {
|
|
260
|
+
const [minX, minY, maxX, maxY] = this.hasExtents()
|
|
261
|
+
? [this.minX, this.minY, this.maxX, this.maxY]
|
|
262
|
+
: [0, 0, 0, 0];
|
|
263
|
+
// R12 (AC1009): no $INSUNITS (introduced R14) — see the `999` comment
|
|
264
|
+
// this.toString() prepends ahead of this section instead.
|
|
265
|
+
return ('0\nSECTION\n2\nHEADER\n' +
|
|
266
|
+
'9\n$ACADVER\n1\nAC1009\n' +
|
|
267
|
+
'9\n$EXTMIN\n10\n' + fmt(minX) + '\n20\n' + fmt(minY) + '\n30\n0.0\n' +
|
|
268
|
+
'9\n$EXTMAX\n10\n' + fmt(maxX) + '\n20\n' + fmt(maxY) + '\n30\n0.0\n' +
|
|
269
|
+
'0\nENDSEC\n');
|
|
270
|
+
}
|
|
271
|
+
buildLtypeTable() {
|
|
272
|
+
let s = '0\nTABLE\n2\nLTYPE\n70\n2\n';
|
|
273
|
+
s += '0\nLTYPE\n2\nCONTINUOUS\n70\n0\n3\nSolid line\n72\n65\n73\n0\n40\n0.0\n';
|
|
274
|
+
// Dash 0.2, gap 0.1 (metres) — a reasonable default at typical drawing
|
|
275
|
+
// scale. R12 pattern elements are plain `49` lengths; group 74
|
|
276
|
+
// (complex-linetype element type) is an R13+ construct and must NOT
|
|
277
|
+
// appear here.
|
|
278
|
+
s +=
|
|
279
|
+
'0\nLTYPE\n2\nDASHED\n70\n0\n3\nDashed line\n72\n65\n73\n2\n40\n0.3\n' +
|
|
280
|
+
'49\n0.2\n49\n-0.1\n';
|
|
281
|
+
s += '0\nENDTAB\n';
|
|
282
|
+
return s;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* STYLE table with the single `STANDARD` text style. Every TEXT entity
|
|
286
|
+
* this writer emits carries no group 7 and therefore implicitly
|
|
287
|
+
* references STANDARD; defining it keeps strict R12 readers from having
|
|
288
|
+
* to invent it. (Fixed-height 0, width factor 1, `txt` font — the
|
|
289
|
+
* classic defaults.)
|
|
290
|
+
*/
|
|
291
|
+
buildStyleTable() {
|
|
292
|
+
return ('0\nTABLE\n2\nSTYLE\n70\n1\n' +
|
|
293
|
+
'0\nSTYLE\n2\nSTANDARD\n70\n0\n40\n0.0\n41\n1.0\n50\n0.0\n71\n0\n42\n0.2\n3\ntxt\n4\n\n' +
|
|
294
|
+
'0\nENDTAB\n');
|
|
295
|
+
}
|
|
296
|
+
buildLayerTable() {
|
|
297
|
+
let s = '0\nTABLE\n2\nLAYER\n70\n' + this.layers.size + '\n';
|
|
298
|
+
for (const l of this.layers.values()) {
|
|
299
|
+
s += '0\nLAYER\n2\n' + l.name + '\n70\n0\n62\n' + l.aci + '\n6\n' + l.linetype + '\n';
|
|
300
|
+
}
|
|
301
|
+
s += '0\nENDTAB\n';
|
|
302
|
+
return s;
|
|
303
|
+
}
|
|
304
|
+
buildTables() {
|
|
305
|
+
// LTYPE before LAYER (layers reference linetypes by name); STYLE for
|
|
306
|
+
// the implicit STANDARD text style. VPORT/VIEW/UCS/APPID/DIMSTYLE are
|
|
307
|
+
// optional in R12 — readers supply defaults — and are omitted.
|
|
308
|
+
return ('0\nSECTION\n2\nTABLES\n' +
|
|
309
|
+
this.buildLtypeTable() +
|
|
310
|
+
this.buildStyleTable() +
|
|
311
|
+
this.buildLayerTable() +
|
|
312
|
+
'0\nENDSEC\n');
|
|
313
|
+
}
|
|
314
|
+
buildEntities() {
|
|
315
|
+
let s = '0\nSECTION\n2\nENTITIES\n';
|
|
316
|
+
for (const write of this.entities)
|
|
317
|
+
s += write();
|
|
318
|
+
s += '0\nENDSEC\n';
|
|
319
|
+
return s;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Assemble the full ASCII DXF R12 document: a leading `999` comment
|
|
323
|
+
* (units — see class docs), then HEADER + TABLES + ENTITIES + EOF. No
|
|
324
|
+
* BLOCKS/OBJECTS sections and no BLOCK_RECORD table — R12 doesn't require
|
|
325
|
+
* them (unlike R13+, where their absence would make the file invalid).
|
|
326
|
+
*/
|
|
327
|
+
toString() {
|
|
328
|
+
// Any point written through addPolyline/addLine/addText must land on a
|
|
329
|
+
// registered layer, so ensure at least the "0" default layer exists for
|
|
330
|
+
// callers that add geometry before their first `layer()` call.
|
|
331
|
+
if (!this.layers.has('0')) {
|
|
332
|
+
this.layers.set('0', { name: '0', aci: 7, linetype: 'CONTINUOUS' });
|
|
333
|
+
}
|
|
334
|
+
return ('999\n' + this.headerComment + '\n' +
|
|
335
|
+
this.buildHeader() + this.buildTables() + this.buildEntities() + '0\nEOF\n');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,UAAU,CAC5E,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DXF Exporter - Export 2D drawings to ASCII DXF (issue #1861)
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `svg-exporter.ts`'s input contract (a `Drawing2D` plus reference
|
|
5
|
+
* underlays) so the two exporters read the same generated-drawing model and
|
|
6
|
+
* cannot drift: same polylines/edges, same hatch-boundary polygons, same
|
|
7
|
+
* per-style layer/colour derivation.
|
|
8
|
+
*
|
|
9
|
+
* Unlike SVG, DXF has no "paper" concept — coordinates are written verbatim
|
|
10
|
+
* in the drawing's own unit (metres) with no scale/padding transform. A
|
|
11
|
+
* `Drawing2D` generated without a render-frame shift (the package-level
|
|
12
|
+
* contract; see `svg-exporter.ts`'s underlay caveat) therefore round-trips
|
|
13
|
+
* through this exporter unchanged. Callers that need real-world or
|
|
14
|
+
* map-projected output (the viewer's georeferenced plan-section export)
|
|
15
|
+
* supply `coordinateTransform`, applied to every point — drawing and
|
|
16
|
+
* underlay alike — right before it reaches the writer.
|
|
17
|
+
*
|
|
18
|
+
* Output targets DXF R12 (AC1009) — see `dxf/writer.ts`'s module docs for
|
|
19
|
+
* why (handles/subclass markers are mandatory from R13 on; R12 needs
|
|
20
|
+
* neither and is the universal interop baseline). There is accordingly no
|
|
21
|
+
* `$INSUNITS` header variable; the unit (always metres) is stated in a
|
|
22
|
+
* `999` comment at the top of the file instead, optionally naming the
|
|
23
|
+
* `IfcProjectedCRS` via `metadataComment`.
|
|
24
|
+
*/
|
|
25
|
+
import type { Drawing2D, Point2D } from './types.js';
|
|
26
|
+
import { type DxfPlacement, type DxfUnderlay } from './dxf/types.js';
|
|
27
|
+
export interface DXFExportOptions {
|
|
28
|
+
/** Include lines whose `visibility === 'hidden'` (default true, matching SVG). */
|
|
29
|
+
showHiddenLines?: boolean;
|
|
30
|
+
/** Include cut-polygon boundaries (hatch regions, represented as closed POLYLINE boundaries — see module docs). Default true. */
|
|
31
|
+
showHatching?: boolean;
|
|
32
|
+
/** DXF reference underlays composited alongside the drawing (issue #1782 parity). */
|
|
33
|
+
underlays?: DXFUnderlayOptions[];
|
|
34
|
+
/**
|
|
35
|
+
* Applied to every emitted point (drawing geometry and underlays alike)
|
|
36
|
+
* as the very last step before it reaches the writer. Identity by
|
|
37
|
+
* default. The viewer uses this to re-derive true world/map coordinates
|
|
38
|
+
* for a plan-view export — see `apps/viewer/src/hooks/dxfExportGeoref.ts`.
|
|
39
|
+
*/
|
|
40
|
+
coordinateTransform?: (p: Point2D) => Point2D;
|
|
41
|
+
/**
|
|
42
|
+
* `999` comment written at the top of the file (R12 has no `$INSUNITS`
|
|
43
|
+
* to state the unit instead — see `dxf/writer.ts`). Defaults to a
|
|
44
|
+
* generic "units: metres" note; pass one naming the `IfcProjectedCRS`
|
|
45
|
+
* for a georeferenced export.
|
|
46
|
+
*/
|
|
47
|
+
metadataComment?: string;
|
|
48
|
+
}
|
|
49
|
+
/** One DXF reference underlay to embed (mirrors `SVGUnderlayOptions`). */
|
|
50
|
+
export interface DXFUnderlayOptions {
|
|
51
|
+
underlay: DxfUnderlay;
|
|
52
|
+
/** Placement in drawing space; identity when omitted. */
|
|
53
|
+
placement?: DxfPlacement;
|
|
54
|
+
/** Per-layer visibility override; falls back to the DXF layer's own state. */
|
|
55
|
+
layerVisibility?: Record<string, boolean>;
|
|
56
|
+
}
|
|
57
|
+
/** Builds a DXF document from a `Drawing2D`, mirroring `SVGExporter`. */
|
|
58
|
+
export declare class DXFExporter {
|
|
59
|
+
export(drawing: Drawing2D, options?: DXFExportOptions): string;
|
|
60
|
+
private writeLine;
|
|
61
|
+
private writePolygonBoundary;
|
|
62
|
+
private writeUnderlay;
|
|
63
|
+
}
|
|
64
|
+
/** Export a `Drawing2D` to an ASCII DXF string. */
|
|
65
|
+
export declare function exportToDXF(drawing: Drawing2D, options?: DXFExportOptions): string;
|
|
66
|
+
//# sourceMappingURL=dxf-exporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dxf-exporter.d.ts","sourceRoot":"","sources":["../src/dxf-exporter.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAA6C,OAAO,EAAE,MAAM,YAAY,CAAC;AAGhG,OAAO,EAAyB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG5F,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iIAAiI;IACjI,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qFAAqF;IACrF,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACjC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAC9C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,WAAW,CAAC;IACtB,yDAAyD;IACzD,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAaD,yEAAyE;AACzE,qBAAa,WAAW;IACtB,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IA2ClE,OAAO,CAAC,SAAS;IAwBjB,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,aAAa;CA+DtB;AAED,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAElF"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { getLineStyle, getHatchPattern } from './styles.js';
|
|
5
|
+
import { applyDxfPlacement } from './dxf/convert.js';
|
|
6
|
+
import { DEFAULT_DXF_PLACEMENT } from './dxf/types.js';
|
|
7
|
+
import { DxfWriter } from './dxf/writer.js';
|
|
8
|
+
const CATEGORY_LAYER = {
|
|
9
|
+
cut: 'IFC-CUT',
|
|
10
|
+
projection: 'IFC-PROJECTION',
|
|
11
|
+
hidden: 'IFC-HIDDEN',
|
|
12
|
+
silhouette: 'IFC-SILHOUETTE',
|
|
13
|
+
crease: 'IFC-CREASE',
|
|
14
|
+
boundary: 'IFC-BOUNDARY',
|
|
15
|
+
annotation: 'IFC-ANNOTATION',
|
|
16
|
+
};
|
|
17
|
+
const FILL_LAYER = 'IFC-FILL';
|
|
18
|
+
/** Builds a DXF document from a `Drawing2D`, mirroring `SVGExporter`. */
|
|
19
|
+
export class DXFExporter {
|
|
20
|
+
export(drawing, options = {}) {
|
|
21
|
+
const { showHiddenLines = true, showHatching = true, underlays = [], coordinateTransform = (p) => p, metadataComment, } = options;
|
|
22
|
+
const writer = new DxfWriter({ headerComment: metadataComment });
|
|
23
|
+
const map = (p) => coordinateTransform(p);
|
|
24
|
+
// Layer per line category, DASHED linetype for the hidden layer only —
|
|
25
|
+
// matches how SVGExporter groups its <g> layers. Lines whose
|
|
26
|
+
// `visibility` is 'hidden' are routed onto the hidden layer regardless
|
|
27
|
+
// of category — see writeLine.
|
|
28
|
+
const categoryLayers = new Map();
|
|
29
|
+
for (const [category, name] of Object.entries(CATEGORY_LAYER)) {
|
|
30
|
+
const linetype = category === 'hidden' ? 'DASHED' : 'CONTINUOUS';
|
|
31
|
+
categoryLayers.set(category, writer.layer(name, getLineStyle(category).color, linetype));
|
|
32
|
+
}
|
|
33
|
+
const fillLayer = writer.layer(FILL_LAYER, '#666666');
|
|
34
|
+
// Hatching first (bottom-most, like SVGExporter's hatching layer).
|
|
35
|
+
if (showHatching) {
|
|
36
|
+
for (const polygon of drawing.cutPolygons) {
|
|
37
|
+
this.writePolygonBoundary(writer, polygon, fillLayer, map);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Underlays beneath the drawing lines (SVGExporter renders them first too).
|
|
41
|
+
for (const underlayOptions of underlays) {
|
|
42
|
+
this.writeUnderlay(writer, underlayOptions, map);
|
|
43
|
+
}
|
|
44
|
+
for (const line of drawing.lines) {
|
|
45
|
+
if (!showHiddenLines && line.visibility === 'hidden')
|
|
46
|
+
continue;
|
|
47
|
+
this.writeLine(writer, line, categoryLayers, map);
|
|
48
|
+
}
|
|
49
|
+
return writer.toString();
|
|
50
|
+
}
|
|
51
|
+
writeLine(writer, line, categoryLayers, map) {
|
|
52
|
+
// Visibility wins over category (PR #1871 review, P2): hidden-line
|
|
53
|
+
// removal / construction projection can mark e.g. a `projection` line
|
|
54
|
+
// `visibility: 'hidden'`. Mapping by category alone would land it on the
|
|
55
|
+
// CONTINUOUS `IFC-PROJECTION` layer and occluded/overhead edges would
|
|
56
|
+
// read as solid in CAD. Mirror `exportToSVG`'s hidden-lines grouping
|
|
57
|
+
// (and the viewer canvas's dashed override): every `visibility ===
|
|
58
|
+
// 'hidden'` line joins the DASHED `IFC-HIDDEN` layer with the hidden
|
|
59
|
+
// line style. No new layer/LTYPE names — `IFC-HIDDEN` and `DASHED` are
|
|
60
|
+
// already declared in TABLES, so the output stays R12-legal.
|
|
61
|
+
const styleCategory = line.visibility === 'hidden' ? 'hidden' : line.category;
|
|
62
|
+
const layer = categoryLayers.get(styleCategory);
|
|
63
|
+
if (!layer)
|
|
64
|
+
return;
|
|
65
|
+
const style = getLineStyle(styleCategory, line.ifcType);
|
|
66
|
+
const start = map(line.line.start);
|
|
67
|
+
const end = map(line.line.end);
|
|
68
|
+
writer.addLine(start, end, layer, style.color);
|
|
69
|
+
}
|
|
70
|
+
writePolygonBoundary(writer, polygon, layer, map) {
|
|
71
|
+
const pattern = getHatchPattern(polygon.ifcType);
|
|
72
|
+
if (pattern.type === 'none')
|
|
73
|
+
return;
|
|
74
|
+
const outer = polygon.polygon.outer.map(map);
|
|
75
|
+
writer.addPolyline(outer, layer, true, pattern.strokeColor);
|
|
76
|
+
for (const hole of polygon.polygon.holes) {
|
|
77
|
+
writer.addPolyline(hole.map(map), layer, true, pattern.strokeColor);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
writeUnderlay(writer, options, map) {
|
|
81
|
+
const { underlay, placement = DEFAULT_DXF_PLACEMENT, layerVisibility = {} } = options;
|
|
82
|
+
// Underlay points are already in world plan coordinates (metres, +Y
|
|
83
|
+
// north) — the same convention DXF itself uses, so (unlike SVG, which
|
|
84
|
+
// is +Y down) no sign flip is needed before the placement transform.
|
|
85
|
+
const mapPoint = (p) => map(applyDxfPlacement(p, placement));
|
|
86
|
+
const underlayPrefix = `DXF_${underlay.name}`;
|
|
87
|
+
for (const dxfLayer of underlay.layers) {
|
|
88
|
+
const visible = layerVisibility[dxfLayer.name] ?? dxfLayer.visible;
|
|
89
|
+
if (!visible)
|
|
90
|
+
continue;
|
|
91
|
+
const layer = writer.layer(`${underlayPrefix}_${dxfLayer.name}`, dxfLayer.color);
|
|
92
|
+
for (const fill of dxfLayer.fills) {
|
|
93
|
+
const outer = fill.polygon.outer.map(mapPoint);
|
|
94
|
+
writer.addPolyline(outer, layer, true, fill.color);
|
|
95
|
+
for (const hole of fill.polygon.holes) {
|
|
96
|
+
writer.addPolyline(hole.map(mapPoint), layer, true, fill.color);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
for (const path of dxfLayer.paths) {
|
|
100
|
+
if (path.points.length < 2)
|
|
101
|
+
continue;
|
|
102
|
+
writer.addPolyline(path.points.map(mapPoint), layer, path.closed, path.color);
|
|
103
|
+
}
|
|
104
|
+
for (const text of dxfLayer.texts) {
|
|
105
|
+
if (!text.text.trim())
|
|
106
|
+
continue;
|
|
107
|
+
const anchor = mapPoint(text.position);
|
|
108
|
+
const tip = mapPoint({ x: text.position.x + text.dirX, y: text.position.y + text.dirY });
|
|
109
|
+
const angle = (Math.atan2(tip.y - anchor.y, tip.x - anchor.x) * 180) / Math.PI;
|
|
110
|
+
// Placement scales the geometry through mapPoint; the glyph height
|
|
111
|
+
// must follow or labels detach from their linework (same rule as
|
|
112
|
+
// SVGExporter's underlay text).
|
|
113
|
+
const height = text.height * placement.scale;
|
|
114
|
+
const lines = text.text.split('\n');
|
|
115
|
+
for (let i = 0; i < lines.length; i++) {
|
|
116
|
+
// Stack subsequent lines by offsetting in LOCAL space, then map:
|
|
117
|
+
// the stacking direction must rotate with the text when
|
|
118
|
+
// placement.rotationDeg is non-zero or coordinateTransform itself
|
|
119
|
+
// rotates (georeferenced rotated grid) — exactly like
|
|
120
|
+
// SVGExporter's rotate() wrapper around its tspan stack. An
|
|
121
|
+
// output-space `anchor.y - offset` would shift lines straight
|
|
122
|
+
// down regardless of the text's actual direction (PR #1871
|
|
123
|
+
// review).
|
|
124
|
+
const lineAnchor = i === 0
|
|
125
|
+
? anchor
|
|
126
|
+
: mapPoint({ x: text.position.x, y: text.position.y - i * text.height * 1.3 });
|
|
127
|
+
writer.addText(lineAnchor, lines[i], height, layer, { rotationDeg: angle, hAlign: text.align, vAlign: text.valign, colorOverride: text.color });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** Export a `Drawing2D` to an ASCII DXF string. */
|
|
134
|
+
export function exportToDXF(drawing, options) {
|
|
135
|
+
return new DXFExporter().export(drawing, options);
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=dxf-exporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dxf-exporter.js","sourceRoot":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AAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;oBACjF,MAAM,CAAC,OAAO,CACZ,UAAU,EACV,KAAK,CAAC,CAAC,CAAC,EACR,MAAM,EACN,KAAK,EACL,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,KAAK,EAAE,CAC3F,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,mDAAmD;AACnD,MAAM,UAAU,WAAW,CAAC,OAAkB,EAAE,OAA0B;IACxE,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -32,10 +32,12 @@ export { HatchGenerator } from './hatch-generator.js';
|
|
|
32
32
|
export type { HatchLine, HatchResult, CustomHatchSettings } from './hatch-generator.js';
|
|
33
33
|
export { SVGExporter, exportToSVG } from './svg-exporter.js';
|
|
34
34
|
export type { SVGExportOptions } from './svg-exporter.js';
|
|
35
|
+
export { DXFExporter, exportToDXF } from './dxf-exporter.js';
|
|
36
|
+
export type { DXFExportOptions, DXFUnderlayOptions } from './dxf-exporter.js';
|
|
35
37
|
export { GPUSectionCutter, isGPUComputeAvailable } from './gpu-section-cutter.js';
|
|
36
38
|
export { Drawing2DGenerator, createSectionConfig, generateFloorPlan, generateSection, } from './drawing-generator.js';
|
|
37
39
|
export type { GeneratorOptions, GeneratorProgress } from './drawing-generator.js';
|
|
38
|
-
export { EPSILON, vec3, vec3Add, vec3Sub, vec3Scale, vec3Dot, vec3Cross, vec3Length, vec3Normalize, vec3Lerp, vec3Equals, vec3Distance, point2D, point2DAdd, point2DSub, point2DScale, point2DDot, point2DLength, point2DDistance, point2DLerp, point2DEquals, point2DNormalize, point2DCross, lineLength, lineMidpoint, lineDirection, linesCollinear, projectPointOnLine, boundsEmpty, boundsExtendPoint, boundsExtendLine, boundsCenter, boundsSize, boundsValid, signedDistanceToPlane, getAxisNormal, getProjectionAxes, projectTo2D, polygonSignedArea, isCounterClockwise, reversePolygon, ensureCCW, ensureCW, } from './math.js';
|
|
40
|
+
export { EPSILON, vec3, vec3Add, vec3Sub, vec3Scale, vec3Dot, vec3Cross, vec3Length, vec3Normalize, vec3Lerp, vec3Equals, vec3Distance, point2D, point2DAdd, point2DSub, point2DScale, point2DDot, point2DLength, point2DDistance, point2DLerp, point2DEquals, point2DNormalize, point2DCross, lineLength, lineMidpoint, lineDirection, linesCollinear, projectPointOnLine, boundsEmpty, boundsExtendPoint, boundsExtendLine, boundsCenter, boundsSize, boundsValid, signedDistanceToPlane, getAxisNormal, getProjectionAxes, projectTo2D, projectTo2DBasis, polygonSignedArea, isCounterClockwise, reversePolygon, ensureCCW, ensureCW, } from './math.js';
|
|
39
41
|
export { OpeningRelationshipBuilder, OpeningFilter, buildOpeningRelationships, getOpeningsForHost, getFillingElement, isOpeningElement, isDoorOrWindow, } from './openings/index.js';
|
|
40
42
|
export type { OpeningInfo, OpeningRelationships, VoidRelationship, FillRelationship, DoorOperationType, WindowPartitioningType, EntityMetadata, DrawingContext, } from './types.js';
|
|
41
43
|
export { DoorSymbolGenerator, WindowSymbolGenerator, SymbolRenderer, generateDoorSymbol, generateWindowSymbol, generateStairArrow, } from './symbols/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAMH,YAAY,EAEV,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,QAAQ,EAGR,WAAW,EACX,k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BAAoB,EACpB,iBAAiB,EACjB,QAAQ,EACR,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,GACb,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAEL,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EAGnB,aAAa,EACb,WAAW,EACX,eAAe,EAGf,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EAGrB,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,EAGzB,uBAAuB,EACvB,yBAAyB,EAGzB,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAEV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EAGnB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EAGZ,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACb,gBAAgB,EAGhB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAGhB,cAAc,EACd,YAAY,EACZ,oBAAoB,EAGpB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,GACX,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,14 @@ export { HatchGenerator } from './hatch-generator.js';
|
|
|
54
54
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
55
55
|
export { SVGExporter, exportToSVG } from './svg-exporter.js';
|
|
56
56
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
57
|
+
// DXF EXPORT (issue #1861)
|
|
58
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
59
|
+
// Only the exporter facade is public. The low-level writer internals
|
|
60
|
+
// (DxfWriter, sanitizeDxfLayerName, cssToAci, the linetype/justification
|
|
61
|
+
// types) stay package-private: no external consumer exists, and an unused
|
|
62
|
+
// public export is permanent semver liability (PR #1871 review).
|
|
63
|
+
export { DXFExporter, exportToDXF } from './dxf-exporter.js';
|
|
64
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
57
65
|
// GPU ACCELERATION
|
|
58
66
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
59
67
|
export { GPUSectionCutter, isGPUComputeAvailable } from './gpu-section-cutter.js';
|
|
@@ -76,7 +84,7 @@ lineLength, lineMidpoint, lineDirection, linesCollinear, projectPointOnLine,
|
|
|
76
84
|
// Bounds operations
|
|
77
85
|
boundsEmpty, boundsExtendPoint, boundsExtendLine, boundsCenter, boundsSize, boundsValid,
|
|
78
86
|
// Plane operations
|
|
79
|
-
signedDistanceToPlane, getAxisNormal, getProjectionAxes, projectTo2D,
|
|
87
|
+
signedDistanceToPlane, getAxisNormal, getProjectionAxes, projectTo2D, projectTo2DBasis,
|
|
80
88
|
// Polygon operations
|
|
81
89
|
polygonSignedArea, isCounterClockwise, reversePolygon, ensureCCW, ensureCW, } from './math.js';
|
|
82
90
|
// ═══════════════════════════════════════════════════════════════════════════
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA+D/D,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnF,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGxE,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEt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EACpB,qBAAqB;AAErB,YAAY;AACZ,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB;AAEzB,kBAAkB;AAClB,uBAAuB,EACvB,yBAAyB;AAEzB,kBAAkB;AAClB,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/drawing-2d",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "2D architectural drawing generation from IFC models - section cuts, floor plans, and elevations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ifc-lite/geometry": "^3.
|
|
16
|
+
"@ifc-lite/geometry": "^3.5.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@webgpu/types": "^0.1.71",
|