@mlightcad/data-model 1.7.34 → 1.7.36

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.
Files changed (39) hide show
  1. package/dist/data-model.cjs +6 -6
  2. package/dist/data-model.js +3174 -2708
  3. package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
  4. package/lib/converter/AcDbDxfConverter.js +20 -9
  5. package/lib/converter/AcDbDxfConverter.js.map +1 -1
  6. package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -1
  7. package/lib/converter/AcDbEntitiyConverter.js +3 -7
  8. package/lib/converter/AcDbEntitiyConverter.js.map +1 -1
  9. package/lib/database/AcDbDatabase.d.ts +127 -11
  10. package/lib/database/AcDbDatabase.d.ts.map +1 -1
  11. package/lib/database/AcDbDatabase.js +200 -18
  12. package/lib/database/AcDbDatabase.js.map +1 -1
  13. package/lib/database/AcDbSysVarManager.d.ts +1 -0
  14. package/lib/database/AcDbSysVarManager.d.ts.map +1 -1
  15. package/lib/database/AcDbSysVarManager.js +126 -15
  16. package/lib/database/AcDbSysVarManager.js.map +1 -1
  17. package/lib/database/AcDbSystemVariables.d.ts +25 -9
  18. package/lib/database/AcDbSystemVariables.d.ts.map +1 -1
  19. package/lib/database/AcDbSystemVariables.js +24 -8
  20. package/lib/database/AcDbSystemVariables.js.map +1 -1
  21. package/lib/misc/AcDbConstants.d.ts +26 -0
  22. package/lib/misc/AcDbConstants.d.ts.map +1 -1
  23. package/lib/misc/AcDbConstants.js +9 -0
  24. package/lib/misc/AcDbConstants.js.map +1 -1
  25. package/lib/misc/AcDbFormatter.d.ts +215 -0
  26. package/lib/misc/AcDbFormatter.d.ts.map +1 -0
  27. package/lib/misc/AcDbFormatter.js +863 -0
  28. package/lib/misc/AcDbFormatter.js.map +1 -0
  29. package/lib/misc/AcDbLinearUnits.d.ts +21 -0
  30. package/lib/misc/AcDbLinearUnits.d.ts.map +1 -0
  31. package/lib/misc/AcDbLinearUnits.js +22 -0
  32. package/lib/misc/AcDbLinearUnits.js.map +1 -0
  33. package/lib/misc/index.d.ts +2 -0
  34. package/lib/misc/index.d.ts.map +1 -1
  35. package/lib/misc/index.js +2 -0
  36. package/lib/misc/index.js.map +1 -1
  37. package/lib/misc/pat/AcDbPatSvgRenderer.d.ts.map +1 -1
  38. package/lib/misc/pat/AcDbPatSvgRenderer.js.map +1 -1
  39. package/package.json +4 -4
@@ -15,24 +15,26 @@ export var AcDbSystemVariables = {
15
15
  ANGDIR: 'ANGDIR',
16
16
  /** Angular unit display mode, such as decimal degrees or degrees/minutes/seconds. */
17
17
  AUNITS: 'AUNITS',
18
+ /** Number of decimal places (or display precision) for angular values; used together with AUNITS. */
19
+ AUPREC: 'AUPREC',
18
20
  /** Current color applied to newly created entities. */
19
21
  CECOLOR: 'CECOLOR',
20
- /** Current linetype name used when creating new entities. */
21
- CELTYPE: 'CELTYPE',
22
22
  /** Current entity linetype scale multiplier for newly created entities. */
23
23
  CELTSCALE: 'CELTSCALE',
24
+ /** Current linetype name used when creating new entities. */
25
+ CELTYPE: 'CELTYPE',
24
26
  /** Current lineweight applied to newly created entities. */
25
27
  CELWEIGHT: 'CELWEIGHT',
26
28
  /** Current transparency level for newly created entities. */
27
29
  CETRANSPARENCY: 'CETRANSPARENCY',
28
30
  /** Current layer name used when creating new entities. */
29
31
  CLAYER: 'CLAYER',
30
- /** Current multiline style name used when creating new MLINE entities. */
31
- CMLSTYLE: 'CMLSTYLE',
32
- /** Current multiline scale used when creating new MLINE entities. */
33
- CMLSCALE: 'CMLSCALE',
34
32
  /** Current multileader style name used when creating new MLEADER entities. */
35
33
  CMLEADERSTYLE: 'CMLEADERSTYLE',
34
+ /** Current multiline scale used when creating new MLINE entities. */
35
+ CMLSCALE: 'CMLSCALE',
36
+ /** Current multiline style name used when creating new MLINE entities. */
37
+ CMLSTYLE: 'CMLSTYLE',
36
38
  /** UI color theme selector used by the application shell or viewer integration. */
37
39
  COLORTHEME: 'COLORTHEME',
38
40
  /**
@@ -46,10 +48,10 @@ export var AcDbSystemVariables = {
46
48
  EXTMAX: 'EXTMAX',
47
49
  /** Lower-left corner of the model-space drawing extents. */
48
50
  EXTMIN: 'EXTMIN',
49
- /** Controls whether newly created hatches are associative. */
50
- HPASSOC: 'HPASSOC',
51
51
  /** Default angle, in radians, for newly created hatch patterns. */
52
52
  HPANG: 'HPANG',
53
+ /** Controls whether newly created hatches are associative. */
54
+ HPASSOC: 'HPASSOC',
53
55
  /** Default background color for newly created hatch patterns. */
54
56
  HPBACKGROUNDCOLOR: 'HPBACKGROUNDCOLOR',
55
57
  /** Default color for newly created hatches. */
@@ -72,8 +74,17 @@ export var AcDbSystemVariables = {
72
74
  INSUNITS: 'INSUNITS',
73
75
  /** Global linetype scale multiplier for the drawing database. */
74
76
  LTSCALE: 'LTSCALE',
77
+ /** Linear unit display format for coordinates and distances (scientific, decimal, engineering, etc.). */
78
+ LUNITS: 'LUNITS',
79
+ /** Decimal places (or display precision) for linear values; used together with LUNITS. */
80
+ LUPREC: 'LUPREC',
75
81
  /** Flag indicating whether lineweights are displayed in the editor/viewer. */
76
82
  LWDISPLAY: 'LWDISPLAY',
83
+ /**
84
+ * Legacy drawing measurement system: `0` = English (imperial), `1` = metric.
85
+ * Used with unitless **INSUNITS** to choose default unit labeling.
86
+ */
87
+ MEASUREMENT: 'MEASUREMENT',
77
88
  /** Color used for measurement tool overlays (distance, area, arc). */
78
89
  MEASUREMENTCOLOR: 'MEASUREMENTCOLOR',
79
90
  /** Running object snap mode bitmask (OSNAP settings). */
@@ -88,6 +99,11 @@ export var AcDbSystemVariables = {
88
99
  SHORTCUTMENU: 'SHORTCUTMENU',
89
100
  /** Current text style name used when creating new text entities. */
90
101
  TEXTSTYLE: 'TEXTSTYLE',
102
+ /**
103
+ * Controls feet-inch and fractional display delimiters together with **LUNITS**
104
+ * (`0` = report format, `1` = input format).
105
+ */
106
+ UNITMODE: 'UNITMODE',
91
107
  /** Flag indicating whether the drawing background should be rendered as white. */
92
108
  WHITEBKCOLOR: 'WHITEBKCOLOR'
93
109
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AcDbSystemVariables.js","sourceRoot":"","sources":["../../src/database/AcDbSystemVariables.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,wDAAwD;IACxD,OAAO,EAAE,SAAS;IAClB,mFAAmF;IACnF,OAAO,EAAE,SAAS;IAClB,kFAAkF;IAClF,MAAM,EAAE,QAAQ;IAChB,qFAAqF;IACrF,MAAM,EAAE,QAAQ;IAChB,uDAAuD;IACvD,OAAO,EAAE,SAAS;IAClB,6DAA6D;IAC7D,OAAO,EAAE,SAAS;IAClB,2EAA2E;IAC3E,SAAS,EAAE,WAAW;IACtB,4DAA4D;IAC5D,SAAS,EAAE,WAAW;IACtB,6DAA6D;IAC7D,cAAc,EAAE,gBAAgB;IAChC,0DAA0D;IAC1D,MAAM,EAAE,QAAQ;IAChB,0EAA0E;IAC1E,QAAQ,EAAE,UAAU;IACpB,qEAAqE;IACrE,QAAQ,EAAE,UAAU;IACpB,8EAA8E;IAC9E,aAAa,EAAE,eAAe;IAC9B,mFAAmF;IACnF,UAAU,EAAE,YAAY;IACxB;;;OAGG;IACH,OAAO,EAAE,SAAS;IAClB,6DAA6D;IAC7D,SAAS,EAAE,WAAW;IACtB,6DAA6D;IAC7D,MAAM,EAAE,QAAQ;IAChB,4DAA4D;IAC5D,MAAM,EAAE,QAAQ;IAChB,8DAA8D;IAC9D,OAAO,EAAE,SAAS;IAClB,mEAAmE;IACnE,KAAK,EAAE,OAAO;IACd,iEAAiE;IACjE,iBAAiB,EAAE,mBAAmB;IACtC,+CAA+C;IAC/C,OAAO,EAAE,SAAS;IAClB,gEAAgE;IAChE,QAAQ,EAAE,UAAU;IACpB,8EAA8E;IAC9E,iBAAiB,EAAE,mBAAmB;IACtC,yDAAyD;IACzD,OAAO,EAAE,SAAS;IAClB,sEAAsE;IACtE,MAAM,EAAE,QAAQ;IAChB,6DAA6D;IAC7D,OAAO,EAAE,SAAS;IAClB,0FAA0F;IAC1F,UAAU,EAAE,YAAY;IACxB,gEAAgE;IAChE,cAAc,EAAE,gBAAgB;IAChC,sEAAsE;IACtE,QAAQ,EAAE,UAAU;IACpB,iEAAiE;IACjE,OAAO,EAAE,SAAS;IAClB,8EAA8E;IAC9E,SAAS,EAAE,WAAW;IACtB,sEAAsE;IACtE,gBAAgB,EAAE,kBAAkB;IACpC,yDAAyD;IACzD,MAAM,EAAE,QAAQ;IAChB,8EAA8E;IAC9E,MAAM,EAAE,QAAQ;IAChB,iFAAiF;IACjF,MAAM,EAAE,QAAQ;IAChB,8EAA8E;IAC9E,OAAO,EAAE,SAAS;IAClB,yGAAyG;IACzG,YAAY,EAAE,cAAc;IAC5B,oEAAoE;IACpE,SAAS,EAAE,WAAW;IACtB,kFAAkF;IAClF,YAAY,EAAE,cAAc;CACpB,CAAA;AAUV;;;;GAIG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CACtD,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CACnC,CAAA"}
1
+ {"version":3,"file":"AcDbSystemVariables.js","sourceRoot":"","sources":["../../src/database/AcDbSystemVariables.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,wDAAwD;IACxD,OAAO,EAAE,SAAS;IAClB,mFAAmF;IACnF,OAAO,EAAE,SAAS;IAClB,kFAAkF;IAClF,MAAM,EAAE,QAAQ;IAChB,qFAAqF;IACrF,MAAM,EAAE,QAAQ;IAChB,qGAAqG;IACrG,MAAM,EAAE,QAAQ;IAChB,uDAAuD;IACvD,OAAO,EAAE,SAAS;IAClB,2EAA2E;IAC3E,SAAS,EAAE,WAAW;IACtB,6DAA6D;IAC7D,OAAO,EAAE,SAAS;IAClB,4DAA4D;IAC5D,SAAS,EAAE,WAAW;IACtB,6DAA6D;IAC7D,cAAc,E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AC9E,OAAO,EAAE,SAAS;IAClB,yGAAyG;IACzG,YAAY,EAAE,cAAc;IAC5B,oEAAoE;IACpE,SAAS,EAAE,WAAW;IACtB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IACpB,kFAAkF;IAClF,YAAY,EAAE,cAAc;CACpB,CAAA;AAUV;;;;GAIG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CACtD,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CACnC,CAAA"}
@@ -69,4 +69,30 @@ export declare const MLIGHTCAD_APPID = "mlightcad";
69
69
  * Built-in AutoCAD application ID used for standard XData registration.
70
70
  */
71
71
  export declare const ACAD_APPID = "ACAD";
72
+ /**
73
+ * Frozen 2D/3D placeholders when a VPORT table row omits geometry (partial DXF
74
+ * groups, incomplete DWG decode). Used before `AcGePoint2d.copy` / `AcGePoint3d.copy`.
75
+ */
76
+ export declare const VPORT_FALLBACK_CENTER_2D: Readonly<{
77
+ x: 0;
78
+ y: 0;
79
+ }>;
80
+ export declare const VPORT_FALLBACK_LLC: Readonly<{
81
+ x: 0;
82
+ y: 0;
83
+ }>;
84
+ export declare const VPORT_FALLBACK_URC: Readonly<{
85
+ x: 1;
86
+ y: 1;
87
+ }>;
88
+ export declare const VPORT_FALLBACK_VIEW_DIR: Readonly<{
89
+ x: 0;
90
+ y: 0;
91
+ z: 1;
92
+ }>;
93
+ export declare const VPORT_FALLBACK_VIEW_TARGET: Readonly<{
94
+ x: 0;
95
+ y: 0;
96
+ z: 0;
97
+ }>;
72
98
  //# sourceMappingURL=AcDbConstants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AcDbConstants.d.ts","sourceRoot":"","sources":["../../src/misc/AcDbConstants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,eAAe,CAAA;AAE7C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,aAAa,CAAA;AAE5C;;;;;GAKG;AACH,eA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EG;AACH,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C;;GAEG;AACH,eAAO,MAAM,UAAU,SAAS,CAAA;AAEhC;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;EAAgC,CAAA;AACrE,eAAO,MAAM,kBAAkB;;;EAAgC,CAAA;AAC/D,eAAO,MAAM,kBAAkB;;;EAAgC,CAAA;AAC/D,eAAO,MAAM,uBAAuB;;;;EAAsC,CAAA;AAC1E,eAAO,MAAM,0BAA0B;;;;EAAsC,CAAA"}
@@ -69,4 +69,13 @@ export var MLIGHTCAD_APPID = 'mlightcad';
69
69
  * Built-in AutoCAD application ID used for standard XData registration.
70
70
  */
71
71
  export var ACAD_APPID = 'ACAD';
72
+ /**
73
+ * Frozen 2D/3D placeholders when a VPORT table row omits geometry (partial DXF
74
+ * groups, incomplete DWG decode). Used before `AcGePoint2d.copy` / `AcGePoint3d.copy`.
75
+ */
76
+ export var VPORT_FALLBACK_CENTER_2D = Object.freeze({ x: 0, y: 0 });
77
+ export var VPORT_FALLBACK_LLC = Object.freeze({ x: 0, y: 0 });
78
+ export var VPORT_FALLBACK_URC = Object.freeze({ x: 1, y: 1 });
79
+ export var VPORT_FALLBACK_VIEW_DIR = Object.freeze({ x: 0, y: 0, z: 1 });
80
+ export var VPORT_FALLBACK_VIEW_TARGET = Object.freeze({ x: 0, y: 0, z: 0 });
72
81
  //# sourceMappingURL=AcDbConstants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AcDbConstants.js","sourceRoot":"","sources":["../../src/misc/AcDbConstants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAG,YAAY,CAAA;AAE7C;;;;GAIG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAU,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAU,CAAA;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG,UA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2B,GAAG,QAAQ,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,OAAO,GAAG,SAAS,CAAA;AAEhC;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,OAAO,GAAG,SAAS,CAAA;AAEhC;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,WAAW,CAAA;AAE1C;;GAEG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,MAAM,CAAA;AAEhC;;;GAGG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;AACrE,MAAM,CAAC,IAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;AAC/D,MAAM,CAAC,IAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;AAC/D,MAAM,CAAC,IAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;AAC1E,MAAM,CAAC,IAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA"}
@@ -0,0 +1,215 @@
1
+ import { AcGePoint2d, AcGePoint3d } from '@mlightcad/geometry-engine';
2
+ import { AcDbDatabase } from '../database/AcDbDatabase';
3
+ /**
4
+ * Per-call options for {@link AcDbFormatter} methods.
5
+ *
6
+ * These options layer on top of the drawing system variables held by the bound
7
+ * {@link AcDbDatabase}; they do not change the database itself.
8
+ */
9
+ export interface AcDbFormatterOptions {
10
+ /**
11
+ * Whether to append real-world unit suffixes to formatted values.
12
+ *
13
+ * When `true`:
14
+ * - Decimal/scientific/fractional linear values may receive a suffix derived from
15
+ * {@link AcDbDatabase.insunits | INSUNITS} (or {@link AcDbDatabase.measurement | MEASUREMENT}
16
+ * when **INSUNITS** is unitless), for example `12.35 mm` or `10"`.
17
+ * - Angles may receive `°`, `g`, `rad`, or inch marks in DMS/surveyor formats.
18
+ * - Engineering and architectural lengths already embed `'` / `"` in the **LUNITS** pattern;
19
+ * this flag mainly adds the inch quote for those modes when appropriate.
20
+ *
21
+ * When `false` (default), only the numeric pattern dictated by **LUNITS** / **AUNITS** is
22
+ * returned (for example `12.35`, `1'-3 1/2`, `45d30'15"`).
23
+ */
24
+ showUnits?: boolean;
25
+ /**
26
+ * Whether to prefix the formatted value with `~ ` when display precision rounds the input.
27
+ *
28
+ * When `true`, values that are not exactly representable at the current **LUPREC** / **AUPREC**
29
+ * (or fractional denominator for architectural modes) are returned as `~ ${formatted}` — for
30
+ * example `~ 12.35` instead of `12.35` for `12.3456` with two decimal places.
31
+ *
32
+ * When `false` (default), no approximate prefix is added.
33
+ */
34
+ showApproximate?: boolean;
35
+ /**
36
+ * Whether to apply {@link AcDbDatabase.angbase | ANGBASE} and
37
+ * {@link AcDbDatabase.angdir | ANGDIR} before formatting an angle.
38
+ *
39
+ * When `true` (default), the input is treated as an absolute WCS angle (counterclockwise
40
+ * from +X before adjustment), matching status-bar bearing-style display.
41
+ *
42
+ * When `false`, the input radians are formatted directly (after normalization to
43
+ * \([0, 2\pi)\)), for included angles, relative rotations, rubber-band sweep angles,
44
+ * and dynamic-input relative angle values.
45
+ */
46
+ applyAngbaseAngdir?: boolean;
47
+ }
48
+ /**
49
+ * Formats linear distances, point coordinates, and angles for display in the UI,
50
+ * matching AutoCAD drawing-unit behavior as closely as the supported system variables allow.
51
+ *
52
+ * An instance is bound to one {@link AcDbDatabase}. On each call it reads the current values of
53
+ * the relevant header/system variables from that database (not a snapshot taken at construction).
54
+ *
55
+ * ### Linear distances and coordinates
56
+ *
57
+ * | Variable | Role |
58
+ * |----------|------|
59
+ * | **LUNITS** | Display format (scientific, decimal, engineering, …); see {@link AcDbDatabase.lunits} |
60
+ * | **LUPREC** | Precision (decimal places or fractional denominator); see {@link AcDbDatabase.luprec} |
61
+ * | **INSUNITS** | Unit suffix when {@link AcDbFormatterOptions.showUnits} is `true`; see {@link AcDbDatabase.insunits} |
62
+ * | **UNITMODE** | Report vs input delimiters for feet-inch and fractions; see {@link AcDbDatabase.unitmode} |
63
+ * | **MEASUREMENT** | Imperial vs metric suffix when **INSUNITS** is unitless; see {@link AcDbDatabase.measurement} |
64
+ *
65
+ * Engineering (**LUNITS** = 3) and architectural (**LUNITS** = 4) formats treat the numeric
66
+ * value as **inches**, consistent with AutoCAD.
67
+ *
68
+ * ### Angles
69
+ *
70
+ * Input angles are **radians in WCS**. Before formatting, the value is adjusted by
71
+ * {@link AcDbDatabase.angbase | ANGBASE} and {@link AcDbDatabase.angdir | ANGDIR}, then converted
72
+ * per {@link AcDbDatabase.aunits | AUNITS} and {@link AcDbDatabase.auprec | AUPREC}.
73
+ *
74
+ * ### Out of scope
75
+ *
76
+ * Dimension entity text uses per-style **DIM\*** variables (for example **DIMLUNIT**, **DIMDEC**),
77
+ * not this class. **SNAPANG** and UCS settings affect snapping/input, not WCS coordinate strings here.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * database.lunits = AcDbLinearUnits.Decimal;
82
+ * database.luprec = 2;
83
+ *
84
+ * database.formatter.formatLength(12.3456); // "12.35"
85
+ * database.formatter.formatLength(12.3456, { showUnits: true }); // "12.35 mm" (with INSUNITS = mm)
86
+ * database.formatter.formatPoint2d(new AcGePoint2d(1, 2)); // "1, 2"
87
+ * database.formatter.formatAngle(Math.PI / 4, { showUnits: true }); // "45°"
88
+ * ```
89
+ */
90
+ export declare class AcDbFormatter {
91
+ private readonly database;
92
+ /**
93
+ * Creates a formatter that reads unit settings from the given database.
94
+ *
95
+ * @param database - Drawing database whose **LUNITS**, **AUNITS**, and related variables
96
+ * are consulted on every format call.
97
+ */
98
+ constructor(database: AcDbDatabase);
99
+ /**
100
+ * Formats a single linear distance in **drawing units**.
101
+ *
102
+ * The output pattern follows {@link AcDbDatabase.lunits | LUNITS} and
103
+ * {@link AcDbDatabase.luprec | LUPREC}. When {@link AcDbFormatterOptions.showUnits} is `true`,
104
+ * a suffix may be appended based on {@link AcDbDatabase.insunits | INSUNITS} and
105
+ * {@link AcDbDatabase.measurement | MEASUREMENT}.
106
+ *
107
+ * | **LUNITS** | Typical output (no unit suffix) |
108
+ * |-----------:|--------------------------------|
109
+ * | `1` Scientific | `1.23E+02` |
110
+ * | `2` Decimal | `12.35` |
111
+ * | `3` Engineering | `1'-3.5` (value interpreted as inches) |
112
+ * | `4` Architectural | `1'-3 1/2` |
113
+ * | `5` Fractional | `15 1/2` |
114
+ * | `6` Windows desktop | Same as decimal |
115
+ *
116
+ * {@link AcDbDatabase.unitmode | UNITMODE} changes delimiters for engineering, architectural,
117
+ * and fractional modes (for example `1'3-1/2` when **UNITMODE** = 1).
118
+ *
119
+ * @param value - Distance in drawing units (WCS length, not pre-converted to feet or degrees).
120
+ * @param options - Optional display flags; see {@link AcDbFormatterOptions}.
121
+ * @returns Formatted string suitable for status bars, measurement overlays, or tooltips.
122
+ *
123
+ * @remarks
124
+ * Non-finite values (`NaN`, `±Infinity`) are formatted as `"0"`.
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * database.lunits = AcDbLinearUnits.Architectural;
129
+ * database.luprec = 2;
130
+ * formatter.formatLength(15.5); // "1'-3 1/2"
131
+ * ```
132
+ */
133
+ formatLength(value: number, options?: AcDbFormatterOptions): string;
134
+ /**
135
+ * Formats a 2D point as `"x, y"`, formatting each component with {@link formatLength}.
136
+ *
137
+ * Both coordinates use the same {@link AcDbDatabase.lunits | LUNITS} / **LUPREC** rules and the
138
+ * same {@link AcDbFormatterOptions} for the call. The separator is a comma followed by a space
139
+ * (`, `), which matches common Cartesian display in measurement UIs.
140
+ *
141
+ * @param point - Point in drawing units (WCS **x** / **y**).
142
+ * @param options - Optional display flags applied to each coordinate.
143
+ * @returns Formatted coordinate pair, for example `"1.2, 4.6"` or `"1'-0, 2'-6"` depending on **LUNITS**.
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * database.lunits = AcDbLinearUnits.Decimal;
148
+ * database.luprec = 1;
149
+ * formatter.formatPoint2d(new AcGePoint2d(1.23, 4.56)); // "1.2, 4.6"
150
+ * ```
151
+ */
152
+ formatPoint2d(point: AcGePoint2d, options?: AcDbFormatterOptions): string;
153
+ /**
154
+ * Formats a 3D point as `"x, y, z"`, formatting each component with {@link formatLength}.
155
+ *
156
+ * Behavior is the same as {@link formatPoint2d} for **x** and **y**, with **z** appended using
157
+ * the same linear formatting and options.
158
+ *
159
+ * @param point - Point in drawing units (WCS **x** / **y** / **z**).
160
+ * @param options - Optional display flags applied to each coordinate.
161
+ * @returns Formatted coordinate triple, for example `"1.2, 4.6, 7.9"`.
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * formatter.formatPoint3d(new AcGePoint3d(1, 2, 3)); // "1, 2, 3" (with default decimal LUNITS)
166
+ * ```
167
+ */
168
+ formatPoint3d(point: AcGePoint3d, options?: AcDbFormatterOptions): string;
169
+ /**
170
+ * Formats an angle given in **radians** (WCS), for display according to the drawing angle units.
171
+ *
172
+ * Processing order:
173
+ * 1. Subtract {@link AcDbDatabase.angbase | ANGBASE} (zero direction).
174
+ * 2. Negate if {@link AcDbDatabase.angdir | ANGDIR} = 1 (clockwise positive).
175
+ * 3. Normalize to \([0, 2\pi)\) via {@link AcGeMathUtil.normalizeAngle}.
176
+ * 4. Format using {@link AcDbDatabase.aunits | AUNITS} and {@link AcDbDatabase.auprec | AUPREC}.
177
+ *
178
+ * | **AUNITS** | Typical output (no unit suffix) |
179
+ * |-----------:|--------------------------------|
180
+ * | `0` Decimal degrees | `45` or `45.5` |
181
+ * | `1` Degrees/minutes/seconds | `45d30'15"` |
182
+ * | `2` Gradians | `50` |
183
+ * | `3` Radians | `0.785` |
184
+ * | `4` Surveyor's | `N 45d30'15" E` |
185
+ *
186
+ * @param radians - Angle in radians. When {@link AcDbFormatterOptions.applyAngbaseAngdir} is
187
+ * `true` (default), this is an absolute WCS angle (counterclockwise from +X before
188
+ * **ANGBASE** / **ANGDIR** adjustment). When `false`, this is the scalar angle to display.
189
+ * @param options - Optional display flags; when {@link AcDbFormatterOptions.showUnits} is `true`,
190
+ * unit markers such as `°`, `g`, or `rad` may be appended.
191
+ * @returns Formatted angle string.
192
+ *
193
+ * @remarks
194
+ * For included or relative angles, pass {@link AcDbFormatterOptions.applyAngbaseAngdir} = `false`.
195
+ * For arc sweep or dimension overrides, supply the appropriate radians value and flags.
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * database.aunits = AcDbAngleUnits.DecimalDegrees;
200
+ * database.auprec = 0;
201
+ * formatter.formatAngle(Math.PI / 4); // "45"
202
+ * formatter.formatAngle(Math.PI / 4, { showUnits: true }); // "45°"
203
+ * ```
204
+ */
205
+ formatAngle(radians: number, options?: AcDbFormatterOptions): string;
206
+ /**
207
+ * Builds the formatting context from the bound database and call options.
208
+ *
209
+ * @param options - Per-call overrides; omitted fields use database defaults.
210
+ * @returns Snapshot of linear and angular unit settings for one format call.
211
+ * @internal
212
+ */
213
+ private createContext;
214
+ }
215
+ //# sourceMappingURL=AcDbFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcDbFormatter.d.ts","sourceRoot":"","sources":["../../src/misc/AcDbFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,WAAW,EACZ,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AASvD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAAa,aAAa;IAOZ,OAAO,CAAC,QAAQ,CAAC,QAAQ;IANrC;;;;;OAKG;gBAC0B,QAAQ,EAAE,YAAY;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM;IAKnE;;;;;;;;;;;;;;;;;OAiBG;IACH,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM;IAKzE;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM;IAKzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM;IAapE;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;CAatB"}