@mlightcad/data-model 1.1.3 → 1.1.4
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/data-model.js +62 -50
- package/dist/data-model.umd.cjs +1 -1
- package/lib/database/AcDbDatabase.d.ts +10 -4
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +36 -29
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/database/AcDbDatabaseConverter.d.ts +3 -3
- package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/data-model.js
CHANGED
|
@@ -3082,17 +3082,17 @@ class J extends Gn {
|
|
|
3082
3082
|
class _a {
|
|
3083
3083
|
/**
|
|
3084
3084
|
* Reads and converts data into an AcDbDatabase.
|
|
3085
|
-
*
|
|
3085
|
+
*
|
|
3086
3086
|
* This method orchestrates the entire conversion process, including
|
|
3087
3087
|
* parsing, processing various components (fonts, linetypes, styles, etc.),
|
|
3088
3088
|
* and building the final database.
|
|
3089
|
-
*
|
|
3089
|
+
*
|
|
3090
3090
|
* @param data - The input data to convert (string or ArrayBuffer)
|
|
3091
3091
|
* @param db - The database to populate with converted data
|
|
3092
3092
|
* @param minimumChunkSize - Minimum chunk size for batch processing
|
|
3093
3093
|
* @param progress - Optional progress callback
|
|
3094
3094
|
* @returns Promise that resolves when conversion is complete
|
|
3095
|
-
*
|
|
3095
|
+
*
|
|
3096
3096
|
* @example
|
|
3097
3097
|
* ```typescript
|
|
3098
3098
|
* const converter = new MyConverter();
|
|
@@ -17309,9 +17309,9 @@ class dh extends Wt {
|
|
|
17309
17309
|
}
|
|
17310
17310
|
/**
|
|
17311
17311
|
* Gets all tables in this drawing database.
|
|
17312
|
-
*
|
|
17312
|
+
*
|
|
17313
17313
|
* @returns Object containing all the symbol tables in the database
|
|
17314
|
-
*
|
|
17314
|
+
*
|
|
17315
17315
|
* @example
|
|
17316
17316
|
* ```typescript
|
|
17317
17317
|
* const tables = database.tables;
|
|
@@ -17324,9 +17324,9 @@ class dh extends Wt {
|
|
|
17324
17324
|
}
|
|
17325
17325
|
/**
|
|
17326
17326
|
* Gets all named object dictionaries in this drawing database.
|
|
17327
|
-
*
|
|
17327
|
+
*
|
|
17328
17328
|
* @returns Object containing all the dictionaries in the database
|
|
17329
|
-
*
|
|
17329
|
+
*
|
|
17330
17330
|
* @example
|
|
17331
17331
|
* ```typescript
|
|
17332
17332
|
* const dictionaries = database.dictionaries;
|
|
@@ -17338,11 +17338,11 @@ class dh extends Wt {
|
|
|
17338
17338
|
}
|
|
17339
17339
|
/**
|
|
17340
17340
|
* Gets the object ID of the AcDbBlockTableRecord of the current space.
|
|
17341
|
-
*
|
|
17341
|
+
*
|
|
17342
17342
|
* The current space can be either model space or paper space.
|
|
17343
|
-
*
|
|
17343
|
+
*
|
|
17344
17344
|
* @returns The object ID of the current space
|
|
17345
|
-
*
|
|
17345
|
+
*
|
|
17346
17346
|
* @example
|
|
17347
17347
|
* ```typescript
|
|
17348
17348
|
* const currentSpaceId = database.currentSpaceId;
|
|
@@ -17353,10 +17353,10 @@ class dh extends Wt {
|
|
|
17353
17353
|
}
|
|
17354
17354
|
/**
|
|
17355
17355
|
* Sets the current space by object ID.
|
|
17356
|
-
*
|
|
17356
|
+
*
|
|
17357
17357
|
* @param value - The object ID of the block table record to set as current space
|
|
17358
17358
|
* @throws {Error} When the specified block table record ID doesn't exist
|
|
17359
|
-
*
|
|
17359
|
+
*
|
|
17360
17360
|
* @example
|
|
17361
17361
|
* ```typescript
|
|
17362
17362
|
* database.currentSpaceId = 'some-block-record-id';
|
|
@@ -17372,11 +17372,11 @@ class dh extends Wt {
|
|
|
17372
17372
|
}
|
|
17373
17373
|
/**
|
|
17374
17374
|
* Gets the angle units for the database.
|
|
17375
|
-
*
|
|
17375
|
+
*
|
|
17376
17376
|
* This is the current AUNITS value for the database.
|
|
17377
|
-
*
|
|
17377
|
+
*
|
|
17378
17378
|
* @returns The angle units value
|
|
17379
|
-
*
|
|
17379
|
+
*
|
|
17380
17380
|
* @example
|
|
17381
17381
|
* ```typescript
|
|
17382
17382
|
* const angleUnits = database.aunits;
|
|
@@ -17387,9 +17387,9 @@ class dh extends Wt {
|
|
|
17387
17387
|
}
|
|
17388
17388
|
/**
|
|
17389
17389
|
* Sets the angle units for the database.
|
|
17390
|
-
*
|
|
17390
|
+
*
|
|
17391
17391
|
* @param value - The new angle units value
|
|
17392
|
-
*
|
|
17392
|
+
*
|
|
17393
17393
|
* @example
|
|
17394
17394
|
* ```typescript
|
|
17395
17395
|
* database.aunits = AcDbAngleUnits.DecimalDegrees;
|
|
@@ -17400,11 +17400,11 @@ class dh extends Wt {
|
|
|
17400
17400
|
}
|
|
17401
17401
|
/**
|
|
17402
17402
|
* Gets the drawing-units value for automatic scaling of blocks, images, or xrefs.
|
|
17403
|
-
*
|
|
17403
|
+
*
|
|
17404
17404
|
* This is the current INSUNITS value for the database.
|
|
17405
|
-
*
|
|
17405
|
+
*
|
|
17406
17406
|
* @returns The insertion units value
|
|
17407
|
-
*
|
|
17407
|
+
*
|
|
17408
17408
|
* @example
|
|
17409
17409
|
* ```typescript
|
|
17410
17410
|
* const insertionUnits = database.insunits;
|
|
@@ -17415,9 +17415,9 @@ class dh extends Wt {
|
|
|
17415
17415
|
}
|
|
17416
17416
|
/**
|
|
17417
17417
|
* Sets the drawing-units value for automatic scaling.
|
|
17418
|
-
*
|
|
17418
|
+
*
|
|
17419
17419
|
* @param value - The new insertion units value
|
|
17420
|
-
*
|
|
17420
|
+
*
|
|
17421
17421
|
* @example
|
|
17422
17422
|
* ```typescript
|
|
17423
17423
|
* database.insunits = AcDbUnitsValue.Millimeters;
|
|
@@ -17428,9 +17428,9 @@ class dh extends Wt {
|
|
|
17428
17428
|
}
|
|
17429
17429
|
/**
|
|
17430
17430
|
* Gets the line type scale factor.
|
|
17431
|
-
*
|
|
17431
|
+
*
|
|
17432
17432
|
* @returns The line type scale factor
|
|
17433
|
-
*
|
|
17433
|
+
*
|
|
17434
17434
|
* @example
|
|
17435
17435
|
* ```typescript
|
|
17436
17436
|
* const lineTypeScale = database.ltscale;
|
|
@@ -17441,9 +17441,9 @@ class dh extends Wt {
|
|
|
17441
17441
|
}
|
|
17442
17442
|
/**
|
|
17443
17443
|
* Sets the line type scale factor.
|
|
17444
|
-
*
|
|
17444
|
+
*
|
|
17445
17445
|
* @param value - The new line type scale factor
|
|
17446
|
-
*
|
|
17446
|
+
*
|
|
17447
17447
|
* @example
|
|
17448
17448
|
* ```typescript
|
|
17449
17449
|
* database.ltscale = 2.0;
|
|
@@ -17454,9 +17454,9 @@ class dh extends Wt {
|
|
|
17454
17454
|
}
|
|
17455
17455
|
/**
|
|
17456
17456
|
* Gets the color of new objects as they are created.
|
|
17457
|
-
*
|
|
17457
|
+
*
|
|
17458
17458
|
* @returns The current entity color
|
|
17459
|
-
*
|
|
17459
|
+
*
|
|
17460
17460
|
* @example
|
|
17461
17461
|
* ```typescript
|
|
17462
17462
|
* const currentColor = database.cecolor;
|
|
@@ -17467,9 +17467,9 @@ class dh extends Wt {
|
|
|
17467
17467
|
}
|
|
17468
17468
|
/**
|
|
17469
17469
|
* Sets the color of new objects as they are created.
|
|
17470
|
-
*
|
|
17470
|
+
*
|
|
17471
17471
|
* @param value - The new current entity color
|
|
17472
|
-
*
|
|
17472
|
+
*
|
|
17473
17473
|
* @example
|
|
17474
17474
|
* ```typescript
|
|
17475
17475
|
* database.cecolor = new AcCmColor(0xFF0000);
|
|
@@ -17532,23 +17532,23 @@ class dh extends Wt {
|
|
|
17532
17532
|
}
|
|
17533
17533
|
/**
|
|
17534
17534
|
* Reads drawing data from a string or ArrayBuffer.
|
|
17535
|
-
*
|
|
17535
|
+
*
|
|
17536
17536
|
* This method parses the provided data and populates the database with
|
|
17537
17537
|
* the resulting entities, tables, and objects. The method supports
|
|
17538
17538
|
* both DXF and DWG file formats.
|
|
17539
|
-
*
|
|
17539
|
+
*
|
|
17540
17540
|
* @param data - The drawing data as a string or ArrayBuffer
|
|
17541
17541
|
* - For DXF files: Pass a string containing the DXF content
|
|
17542
17542
|
* - For DWG files: Pass an ArrayBuffer instance containing the binary DWG data
|
|
17543
17543
|
* @param options - Options for reading the database
|
|
17544
17544
|
* @param fileType - The type of file being read (defaults to DXF)
|
|
17545
|
-
*
|
|
17545
|
+
*
|
|
17546
17546
|
* @example
|
|
17547
17547
|
* ```typescript
|
|
17548
17548
|
* // Reading a DXF file (string)
|
|
17549
17549
|
* const database = new AcDbDatabase();
|
|
17550
17550
|
* await database.read(dxfString, { readOnly: true }, AcDbFileType.DXF);
|
|
17551
|
-
*
|
|
17551
|
+
*
|
|
17552
17552
|
* // Reading a DWG file (ArrayBuffer)
|
|
17553
17553
|
* const database = new AcDbDatabase();
|
|
17554
17554
|
* await database.read(dwgArrayBuffer, { readOnly: true }, AcDbFileType.DWG);
|
|
@@ -17568,7 +17568,8 @@ class dh extends Wt {
|
|
|
17568
17568
|
if (this.events.openProgress.dispatch({
|
|
17569
17569
|
database: this,
|
|
17570
17570
|
percentage: i,
|
|
17571
|
-
stage:
|
|
17571
|
+
stage: "CONVERSION",
|
|
17572
|
+
subStage: a,
|
|
17572
17573
|
stageStatus: o
|
|
17573
17574
|
}), e && e.fontLoader && a == "FONT" && o == "END") {
|
|
17574
17575
|
const l = c || this.tables.textStyleTable.fonts;
|
|
@@ -17586,23 +17587,34 @@ class dh extends Wt {
|
|
|
17586
17587
|
* @param options Input options to read drawing data
|
|
17587
17588
|
*/
|
|
17588
17589
|
async openUri(t, e) {
|
|
17589
|
-
|
|
17590
|
-
|
|
17591
|
-
|
|
17592
|
-
|
|
17593
|
-
|
|
17594
|
-
}
|
|
17595
|
-
|
|
17596
|
-
|
|
17597
|
-
|
|
17598
|
-
|
|
17590
|
+
this.events.openProgress.dispatch({
|
|
17591
|
+
database: this,
|
|
17592
|
+
percentage: 0,
|
|
17593
|
+
stage: "FETCH_FILE",
|
|
17594
|
+
stageStatus: "START"
|
|
17595
|
+
});
|
|
17596
|
+
const s = await fetch(t);
|
|
17597
|
+
if (this.events.openProgress.dispatch({
|
|
17598
|
+
database: this,
|
|
17599
|
+
percentage: 100,
|
|
17600
|
+
stage: "FETCH_FILE",
|
|
17601
|
+
stageStatus: "END"
|
|
17602
|
+
}), !s.ok)
|
|
17603
|
+
throw new Error(`Failed to fetch file '${t}' with HTTP status codee '${s.status}'!`);
|
|
17604
|
+
if (t.toLowerCase().split(".").pop() === "dwg") {
|
|
17605
|
+
const i = await s.arrayBuffer();
|
|
17606
|
+
await this.read(i, e, Ze.DWG);
|
|
17607
|
+
} else {
|
|
17608
|
+
const i = await s.text();
|
|
17609
|
+
await this.read(i, e, Ze.DXF);
|
|
17610
|
+
}
|
|
17599
17611
|
}
|
|
17600
17612
|
/**
|
|
17601
17613
|
* Clears all data from the database.
|
|
17602
|
-
*
|
|
17614
|
+
*
|
|
17603
17615
|
* This method removes all entities, tables, and objects from the database,
|
|
17604
17616
|
* effectively resetting it to an empty state.
|
|
17605
|
-
*
|
|
17617
|
+
*
|
|
17606
17618
|
* @example
|
|
17607
17619
|
* ```typescript
|
|
17608
17620
|
* database.clear();
|
|
@@ -17613,12 +17625,12 @@ class dh extends Wt {
|
|
|
17613
17625
|
}
|
|
17614
17626
|
/**
|
|
17615
17627
|
* Triggers a header system variable changed event.
|
|
17616
|
-
*
|
|
17628
|
+
*
|
|
17617
17629
|
* This method is called internally when header system variables
|
|
17618
17630
|
* are modified to notify listeners of the change.
|
|
17619
|
-
*
|
|
17631
|
+
*
|
|
17620
17632
|
* @param sysVarName - The name of the system variable that changed
|
|
17621
|
-
*
|
|
17633
|
+
*
|
|
17622
17634
|
* @example
|
|
17623
17635
|
* ```typescript
|
|
17624
17636
|
* database.triggerHeaderSysVarChangedEvent('aunits');
|