@mlightcad/libredwg-web 0.7.14 → 0.7.16
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/libredwg-web.js +34 -0
- package/dist/libredwg-web.umd.cjs +34 -0
- package/lib/converter/entityConverter.d.ts +1 -0
- package/lib/converter/entityConverter.js +25 -1
- package/lib/database/entities/index.d.ts +1 -0
- package/lib/database/entities/index.js +1 -0
- package/lib/database/entities/trace.d.ts +34 -0
- package/lib/database/entities/trace.js +2 -0
- package/package.json +1 -1
package/dist/libredwg-web.js
CHANGED
|
@@ -1357,6 +1357,8 @@ class LibreEntityConverter {
|
|
|
1357
1357
|
return this.convertShape(entity_tio, commonAttrs);
|
|
1358
1358
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SOLID) {
|
|
1359
1359
|
return this.convertSolid(entity_tio, commonAttrs);
|
|
1360
|
+
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_TRACE) {
|
|
1361
|
+
return this.convertTrace(entity_tio, commonAttrs);
|
|
1360
1362
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SPLINE) {
|
|
1361
1363
|
return this.convertSpline(entity_tio, commonAttrs);
|
|
1362
1364
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_TABLE) {
|
|
@@ -2988,6 +2990,13 @@ class LibreEntityConverter {
|
|
|
2988
2990
|
extrusionDirection
|
|
2989
2991
|
};
|
|
2990
2992
|
}
|
|
2993
|
+
convertTrace(entity, commonAttrs) {
|
|
2994
|
+
const solid = this.convertSolid(entity, commonAttrs);
|
|
2995
|
+
return {
|
|
2996
|
+
...solid,
|
|
2997
|
+
type: "TRACE"
|
|
2998
|
+
};
|
|
2999
|
+
}
|
|
2991
3000
|
convertSpline(entity, commonAttrs) {
|
|
2992
3001
|
const libredwg = this.libredwg;
|
|
2993
3002
|
const flag = libredwg.dwg_dynapi_entity_data(entity, "splineflags");
|
|
@@ -3199,7 +3208,30 @@ class LibreEntityConverter {
|
|
|
3199
3208
|
const snapAngle = libredwg.dwg_dynapi_entity_data(entity, "SNAPANG");
|
|
3200
3209
|
const viewTwistAngle = libredwg.dwg_dynapi_entity_data(entity, "twist_angle");
|
|
3201
3210
|
const circleZoomPercent = libredwg.dwg_dynapi_entity_data(entity, "circle_zoom");
|
|
3211
|
+
const numFrozenLayers = libredwg.dwg_dynapi_entity_data(
|
|
3212
|
+
entity,
|
|
3213
|
+
"num_frozen_layers"
|
|
3214
|
+
);
|
|
3215
|
+
let frozenLayerIds;
|
|
3216
|
+
if (numFrozenLayers > 0) {
|
|
3217
|
+
const frozenLayersPtr = libredwg.dwg_dynapi_entity_data(
|
|
3218
|
+
entity,
|
|
3219
|
+
"frozen_layers"
|
|
3220
|
+
);
|
|
3221
|
+
if (frozenLayersPtr) {
|
|
3222
|
+
const frozenLayers = libredwg.dwg_ptr_to_object_ref_ptr_array(
|
|
3223
|
+
frozenLayersPtr,
|
|
3224
|
+
numFrozenLayers
|
|
3225
|
+
);
|
|
3226
|
+
frozenLayerIds = frozenLayers.map((ref) => libredwg.dwg_ref_get_id(ref)).filter((id) => !!id);
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3202
3229
|
const statusBitFlags = libredwg.dwg_dynapi_entity_data(entity, "status_flag");
|
|
3230
|
+
const clip_boundary_ref = libredwg.dwg_dynapi_entity_data(
|
|
3231
|
+
entity,
|
|
3232
|
+
"clip_boundary"
|
|
3233
|
+
);
|
|
3234
|
+
const clippingBoundaryId = libredwg.dwg_ref_get_id(clip_boundary_ref);
|
|
3203
3235
|
const sheetName = libredwg.dwg_dynapi_entity_data(entity, "style_sheet");
|
|
3204
3236
|
const renderMode = libredwg.dwg_dynapi_entity_data(entity, "render_mode");
|
|
3205
3237
|
const ucsPerViewport = libredwg.dwg_dynapi_entity_data(entity, "UCSVP");
|
|
@@ -3248,7 +3280,9 @@ class LibreEntityConverter {
|
|
|
3248
3280
|
snapAngle,
|
|
3249
3281
|
viewTwistAngle,
|
|
3250
3282
|
circleZoomPercent,
|
|
3283
|
+
frozenLayerIds,
|
|
3251
3284
|
statusBitFlags,
|
|
3285
|
+
clippingBoundaryId,
|
|
3252
3286
|
sheetName,
|
|
3253
3287
|
renderMode,
|
|
3254
3288
|
ucsPerViewport,
|
|
@@ -1359,6 +1359,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1359
1359
|
return this.convertShape(entity_tio, commonAttrs);
|
|
1360
1360
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SOLID) {
|
|
1361
1361
|
return this.convertSolid(entity_tio, commonAttrs);
|
|
1362
|
+
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_TRACE) {
|
|
1363
|
+
return this.convertTrace(entity_tio, commonAttrs);
|
|
1362
1364
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SPLINE) {
|
|
1363
1365
|
return this.convertSpline(entity_tio, commonAttrs);
|
|
1364
1366
|
} else if (fixedtype == Dwg_Object_Type.DWG_TYPE_TABLE) {
|
|
@@ -2990,6 +2992,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2990
2992
|
extrusionDirection
|
|
2991
2993
|
};
|
|
2992
2994
|
}
|
|
2995
|
+
convertTrace(entity, commonAttrs) {
|
|
2996
|
+
const solid = this.convertSolid(entity, commonAttrs);
|
|
2997
|
+
return {
|
|
2998
|
+
...solid,
|
|
2999
|
+
type: "TRACE"
|
|
3000
|
+
};
|
|
3001
|
+
}
|
|
2993
3002
|
convertSpline(entity, commonAttrs) {
|
|
2994
3003
|
const libredwg = this.libredwg;
|
|
2995
3004
|
const flag = libredwg.dwg_dynapi_entity_data(entity, "splineflags");
|
|
@@ -3201,7 +3210,30 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3201
3210
|
const snapAngle = libredwg.dwg_dynapi_entity_data(entity, "SNAPANG");
|
|
3202
3211
|
const viewTwistAngle = libredwg.dwg_dynapi_entity_data(entity, "twist_angle");
|
|
3203
3212
|
const circleZoomPercent = libredwg.dwg_dynapi_entity_data(entity, "circle_zoom");
|
|
3213
|
+
const numFrozenLayers = libredwg.dwg_dynapi_entity_data(
|
|
3214
|
+
entity,
|
|
3215
|
+
"num_frozen_layers"
|
|
3216
|
+
);
|
|
3217
|
+
let frozenLayerIds;
|
|
3218
|
+
if (numFrozenLayers > 0) {
|
|
3219
|
+
const frozenLayersPtr = libredwg.dwg_dynapi_entity_data(
|
|
3220
|
+
entity,
|
|
3221
|
+
"frozen_layers"
|
|
3222
|
+
);
|
|
3223
|
+
if (frozenLayersPtr) {
|
|
3224
|
+
const frozenLayers = libredwg.dwg_ptr_to_object_ref_ptr_array(
|
|
3225
|
+
frozenLayersPtr,
|
|
3226
|
+
numFrozenLayers
|
|
3227
|
+
);
|
|
3228
|
+
frozenLayerIds = frozenLayers.map((ref) => libredwg.dwg_ref_get_id(ref)).filter((id) => !!id);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3204
3231
|
const statusBitFlags = libredwg.dwg_dynapi_entity_data(entity, "status_flag");
|
|
3232
|
+
const clip_boundary_ref = libredwg.dwg_dynapi_entity_data(
|
|
3233
|
+
entity,
|
|
3234
|
+
"clip_boundary"
|
|
3235
|
+
);
|
|
3236
|
+
const clippingBoundaryId = libredwg.dwg_ref_get_id(clip_boundary_ref);
|
|
3205
3237
|
const sheetName = libredwg.dwg_dynapi_entity_data(entity, "style_sheet");
|
|
3206
3238
|
const renderMode = libredwg.dwg_dynapi_entity_data(entity, "render_mode");
|
|
3207
3239
|
const ucsPerViewport = libredwg.dwg_dynapi_entity_data(entity, "UCSVP");
|
|
@@ -3250,7 +3282,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3250
3282
|
snapAngle,
|
|
3251
3283
|
viewTwistAngle,
|
|
3252
3284
|
circleZoomPercent,
|
|
3285
|
+
frozenLayerIds,
|
|
3253
3286
|
statusBitFlags,
|
|
3287
|
+
clippingBoundaryId,
|
|
3254
3288
|
sheetName,
|
|
3255
3289
|
renderMode,
|
|
3256
3290
|
ucsPerViewport,
|
|
@@ -147,6 +147,9 @@ export class LibreEntityConverter {
|
|
|
147
147
|
else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SOLID) {
|
|
148
148
|
return this.convertSolid(entity_tio, commonAttrs);
|
|
149
149
|
}
|
|
150
|
+
else if (fixedtype == Dwg_Object_Type.DWG_TYPE_TRACE) {
|
|
151
|
+
return this.convertTrace(entity_tio, commonAttrs);
|
|
152
|
+
}
|
|
150
153
|
else if (fixedtype == Dwg_Object_Type.DWG_TYPE_SPLINE) {
|
|
151
154
|
return this.convertSpline(entity_tio, commonAttrs);
|
|
152
155
|
}
|
|
@@ -1607,6 +1610,13 @@ export class LibreEntityConverter {
|
|
|
1607
1610
|
extrusionDirection: extrusionDirection
|
|
1608
1611
|
};
|
|
1609
1612
|
}
|
|
1613
|
+
convertTrace(entity, commonAttrs) {
|
|
1614
|
+
const solid = this.convertSolid(entity, commonAttrs);
|
|
1615
|
+
return {
|
|
1616
|
+
...solid,
|
|
1617
|
+
type: 'TRACE'
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1610
1620
|
convertSpline(entity, commonAttrs) {
|
|
1611
1621
|
const libredwg = this.libredwg;
|
|
1612
1622
|
const flag = libredwg.dwg_dynapi_entity_data(entity, 'splineflags');
|
|
@@ -1803,8 +1813,20 @@ export class LibreEntityConverter {
|
|
|
1803
1813
|
const snapAngle = libredwg.dwg_dynapi_entity_data(entity, 'SNAPANG');
|
|
1804
1814
|
const viewTwistAngle = libredwg.dwg_dynapi_entity_data(entity, 'twist_angle');
|
|
1805
1815
|
const circleZoomPercent = libredwg.dwg_dynapi_entity_data(entity, 'circle_zoom');
|
|
1806
|
-
|
|
1816
|
+
const numFrozenLayers = libredwg.dwg_dynapi_entity_data(entity, 'num_frozen_layers');
|
|
1817
|
+
let frozenLayerIds;
|
|
1818
|
+
if (numFrozenLayers > 0) {
|
|
1819
|
+
const frozenLayersPtr = libredwg.dwg_dynapi_entity_data(entity, 'frozen_layers');
|
|
1820
|
+
if (frozenLayersPtr) {
|
|
1821
|
+
const frozenLayers = libredwg.dwg_ptr_to_object_ref_ptr_array(frozenLayersPtr, numFrozenLayers);
|
|
1822
|
+
frozenLayerIds = frozenLayers
|
|
1823
|
+
.map(ref => libredwg.dwg_ref_get_id(ref))
|
|
1824
|
+
.filter((id) => !!id);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1807
1827
|
const statusBitFlags = libredwg.dwg_dynapi_entity_data(entity, 'status_flag');
|
|
1828
|
+
const clip_boundary_ref = libredwg.dwg_dynapi_entity_data(entity, 'clip_boundary');
|
|
1829
|
+
const clippingBoundaryId = libredwg.dwg_ref_get_id(clip_boundary_ref);
|
|
1808
1830
|
const sheetName = libredwg.dwg_dynapi_entity_data(entity, 'style_sheet');
|
|
1809
1831
|
const renderMode = libredwg.dwg_dynapi_entity_data(entity, 'render_mode');
|
|
1810
1832
|
// TODO: Not sure whether UCSVP in libredwg represents ucsPerViewport
|
|
@@ -1855,7 +1877,9 @@ export class LibreEntityConverter {
|
|
|
1855
1877
|
snapAngle: snapAngle,
|
|
1856
1878
|
viewTwistAngle: viewTwistAngle,
|
|
1857
1879
|
circleZoomPercent: circleZoomPercent,
|
|
1880
|
+
frozenLayerIds,
|
|
1858
1881
|
statusBitFlags: statusBitFlags,
|
|
1882
|
+
clippingBoundaryId,
|
|
1859
1883
|
sheetName: sheetName,
|
|
1860
1884
|
renderMode: renderMode,
|
|
1861
1885
|
ucsPerViewport: ucsPerViewport,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DwgPoint2D, DwgPoint3D } from '../common';
|
|
2
|
+
import { DwgEntity } from './entity';
|
|
3
|
+
export interface DwgTraceEntity extends DwgEntity {
|
|
4
|
+
/**
|
|
5
|
+
* Entity type
|
|
6
|
+
*/
|
|
7
|
+
type: 'TRACE';
|
|
8
|
+
/**
|
|
9
|
+
* Corner1
|
|
10
|
+
*/
|
|
11
|
+
corner1: DwgPoint2D;
|
|
12
|
+
/**
|
|
13
|
+
* Corner2
|
|
14
|
+
*/
|
|
15
|
+
corner2: DwgPoint2D;
|
|
16
|
+
/**
|
|
17
|
+
* Corner3
|
|
18
|
+
*/
|
|
19
|
+
corner3: DwgPoint2D;
|
|
20
|
+
/**
|
|
21
|
+
* Corner4. If only three corners are entered to define the TRACE,
|
|
22
|
+
* then the fourth corner coordinate is the same as the third.
|
|
23
|
+
*/
|
|
24
|
+
corner4?: DwgPoint2D;
|
|
25
|
+
/**
|
|
26
|
+
* Thickness (optional; default = 0)
|
|
27
|
+
*/
|
|
28
|
+
thickness: number;
|
|
29
|
+
/**
|
|
30
|
+
* Extrusion direction (optional; default = 0, 0, 1)
|
|
31
|
+
*/
|
|
32
|
+
extrusionDirection: DwgPoint3D;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=trace.d.ts.map
|
package/package.json
CHANGED