@mlightcad/data-model 1.1.6 → 1.1.7

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.
@@ -27,6 +27,19 @@ export declare class AcDbBlockTable extends AcDbSymbolTable<AcDbBlockTableRecord
27
27
  * ```
28
28
  */
29
29
  constructor(db: AcDbDatabase);
30
+ /**
31
+ * Adds a block table record and indexes it by a regularized name key.
32
+ *
33
+ * - For model space: indexed under `*MODEL_SPACE`.
34
+ * - For paper space: indexed under `*PAPER_SPACE` plus the original name suffix after the prefix.
35
+ * - For other blocks: indexed under the record's `name` as-is.
36
+ *
37
+ * Note: Only the internal index key is regularized; the record's `name` is not mutated.
38
+ *
39
+ * @param record - The record to add to the table
40
+ *
41
+ */
42
+ add(record: AcDbBlockTableRecord): void;
30
43
  /**
31
44
  * Gets the MODEL_SPACE block table record.
32
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AcDbBlockTable.d.ts","sourceRoot":"","sources":["../../src/database/AcDbBlockTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAe,SAAQ,eAAe,CAAC,oBAAoB,CAAC;IACvE;;;;;;;;;OASG;gBACS,EAAE,EAAE,YAAY;IAI5B;;;;;;;;;;;;;;OAcG;IACH,IAAI,UAAU,IAAI,oBAAoB,CAQrC;CACF"}
1
+ {"version":3,"file":"AcDbBlockTable.d.ts","sourceRoot":"","sources":["../../src/database/AcDbBlockTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAe,SAAQ,eAAe,CAAC,oBAAoB,CAAC;IACvE;;;;;;;;;OASG;gBACS,EAAE,EAAE,YAAY;IAI5B;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,MAAM,EAAE,oBAAoB;IAchC;;;;;;;;;;;;;;OAcG;IACH,IAAI,UAAU,IAAI,oBAAoB,CAQrC;CACF"}
@@ -44,6 +44,32 @@ var AcDbBlockTable = /** @class */ (function (_super) {
44
44
  function AcDbBlockTable(db) {
45
45
  return _super.call(this, db) || this;
46
46
  }
47
+ /**
48
+ * Adds a block table record and indexes it by a regularized name key.
49
+ *
50
+ * - For model space: indexed under `*MODEL_SPACE`.
51
+ * - For paper space: indexed under `*PAPER_SPACE` plus the original name suffix after the prefix.
52
+ * - For other blocks: indexed under the record's `name` as-is.
53
+ *
54
+ * Note: Only the internal index key is regularized; the record's `name` is not mutated.
55
+ *
56
+ * @param record - The record to add to the table
57
+ *
58
+ */
59
+ AcDbBlockTable.prototype.add = function (record) {
60
+ record.database = this.database;
61
+ var regularizedName = record.name;
62
+ if (record.isModelSapce) {
63
+ regularizedName = AcDbBlockTableRecord.MODEL_SPACE_NAME;
64
+ }
65
+ else if (record.isPaperSapce) {
66
+ var prefix = AcDbBlockTableRecord.PAPER_SPACE_NAME_PREFIX;
67
+ var suffix = record.name.substring(prefix.length);
68
+ regularizedName = prefix + suffix;
69
+ }
70
+ this._recordsByName.set(regularizedName, record);
71
+ this._recordsById.set(record.objectId, record);
72
+ };
47
73
  Object.defineProperty(AcDbBlockTable.prototype, "modelSpace", {
48
74
  /**
49
75
  * Gets the MODEL_SPACE block table record.
@@ -1 +1 @@
1
- {"version":3,"file":"AcDbBlockTable.js","sourceRoot":"","sources":["../../src/database/AcDbBlockTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAA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AM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YAC/B,IAAM,MAAM,GAAG,oBAAoB,CAAC,uBAAuB,CAAA;YAC3D,IAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;YACnD,eAAe,GAAG,MAAM,GAAG,MAAM,CAAA;QACnC,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;QAChD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAChD,CAAC;IAiBD,sBAAI,sCAAU;QAfd;;;;;;;;;;;;;;WAcG;aACH;YACE,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;YAClE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,UAAU,GAAG,IAAI,oBAAoB,EAAE,CAAA;gBACvC,UAAU,CAAC,IAAI,GAAG,oBAAoB,CAAC,gBAAgB,CAAA;gBACvD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YACtB,CAAC;YACD,OAAO,UAAU,CAAA;QACnB,CAAC;;;OAAA;IACH,qBAAC;AAAD,CAAC,AAjED,CAAoC,eAAe,GAiElD"}
@@ -7,8 +7,8 @@ import { AcDbSymbolTableRecord } from './AcDbSymbolTableRecord';
7
7
  *
8
8
  * Block table records (BTRs) are used to organize and group entities together.
9
9
  * There are two special BTRs that are always present in every database:
10
- * - *Model_Space: Contains entities in model space
11
- * - *Paper_Space: Contains entities in paper space
10
+ * - *MODEL_SPACE: Contains entities in model space
11
+ * - *PAPER_SPACE: Contains entities in paper space
12
12
  *
13
13
  * Each block table record has an origin point and can contain multiple entities.
14
14
  *
@@ -21,8 +21,8 @@ import { AcDbSymbolTableRecord } from './AcDbSymbolTableRecord';
21
21
  *
22
22
  * Block table records (BTRs) are used to organize and group entities together.
23
23
  * There are two special BTRs that are always present in every database:
24
- * - *Model_Space: Contains entities in model space
25
- * - *Paper_Space: Contains entities in paper space
24
+ * - *MODEL_SPACE: Contains entities in model space
25
+ * - *PAPER_SPACE: Contains entities in paper space
26
26
  *
27
27
  * Each block table record has an origin point and can contain multiple entities.
28
28
  *
@@ -180,9 +180,9 @@ var AcDbBlockTableRecord = /** @class */ (function (_super) {
180
180
  return this._entities.get(id);
181
181
  };
182
182
  /** Name constant for model space block table record */
183
- AcDbBlockTableRecord.MODEL_SPACE_NAME = '*Model_Space';
183
+ AcDbBlockTableRecord.MODEL_SPACE_NAME = '*MODEL_SPACE';
184
184
  /** Name prefix for paper space block table records */
185
- AcDbBlockTableRecord.PAPER_SPACE_NAME_PREFIX = '*Paper_Space';
185
+ AcDbBlockTableRecord.PAPER_SPACE_NAME_PREFIX = '*PAPER_SPACE';
186
186
  return AcDbBlockTableRecord;
187
187
  }(AcDbSymbolTableRecord));
188
188
  export { AcDbBlockTableRecord };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/data-model",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {