brepjs-bim 0.24.3 → 0.24.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/README.md
CHANGED
|
@@ -198,3 +198,9 @@ npm run test --workspace=brepjs-bim
|
|
|
198
198
|
Exact Wall quantities measure occupied material across all retained items. Overlapping solids count once. Bounds include every item. Measurement and temporary cleanup failures make these optional measurements unavailable and preserve the borrowed inputs. Cleanup never retries an uncertain native release.
|
|
199
199
|
|
|
200
200
|
The BIM package requires `brepjs >=19.0.5` for native cleanup-error reporting.
|
|
201
|
+
|
|
202
|
+
### Wall quantity failures
|
|
203
|
+
|
|
204
|
+
Wall `NetVolume` measures retained occupied material for both `PARAMETRIC` and `EXACT` geometry. Recipe Walls retain supported area and weight quantities. Exact takeover has no recipe quantity eligibility.
|
|
205
|
+
|
|
206
|
+
If measurement or temporary cleanup fails, serialization omits optional Wall quantities. `toIfcValidated` reports an element-specific `WALL_QUANTITY_OMITTED` warning from that same serialization. `toIfc` still returns a bytes `Result`.
|
package/dist/brepjs-bim.cjs
CHANGED
|
@@ -13092,7 +13092,7 @@ function pushWeightQuantity(w, qtyIds, volumeM3, densityKgM3) {
|
|
|
13092
13092
|
if (densityKgM3 === void 0) return;
|
|
13093
13093
|
qtyIds.push(writeWeightQuantity(w, "GrossWeight", volumeM3, densityKgM3));
|
|
13094
13094
|
}
|
|
13095
|
-
function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, openings, densityKgM3) {
|
|
13095
|
+
function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, openings, netVolumeM3, densityKgM3) {
|
|
13096
13096
|
const lengthM = toIfcLengthM(spec.length);
|
|
13097
13097
|
const widthM = toIfcLengthM(spec.thickness);
|
|
13098
13098
|
const heightM = toIfcLengthM(spec.height);
|
|
@@ -13108,7 +13108,6 @@ function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, opening
|
|
|
13108
13108
|
if (toIfcLengthM(op.offsetFromFloor) < FLOOR_TOUCH_EPSILON_M) sumFloorTouchingFootprintM2 += opWidthM * widthM;
|
|
13109
13109
|
}
|
|
13110
13110
|
const netSideAreaM2 = grossSideAreaM2 - sumOpeningAreaM2;
|
|
13111
|
-
const netVolumeM3 = grossVolumeM3 - sumOpeningAreaM2 * widthM;
|
|
13112
13111
|
const netFootprintM2 = grossFootprintM2 - sumFloorTouchingFootprintM2;
|
|
13113
13112
|
const qtyIds = [
|
|
13114
13113
|
writeQtyLength(w, "Length", lengthM),
|
|
@@ -13124,7 +13123,7 @@ function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, opening
|
|
|
13124
13123
|
pushWeightQuantity(w, qtyIds, netVolumeM3, densityKgM3);
|
|
13125
13124
|
writeRelDefinesByProperties(w, ownerHistoryId, wallExpressId, writeElementQuantity(w, ownerHistoryId, "Qto_WallBaseQuantities", qtyIds));
|
|
13126
13125
|
}
|
|
13127
|
-
function
|
|
13126
|
+
function writeWallBodyQuantities(w, ownerHistoryId, wallExpressId, values) {
|
|
13128
13127
|
writeRelDefinesByProperties(w, ownerHistoryId, wallExpressId, writeElementQuantity(w, ownerHistoryId, "Qto_WallBaseQuantities", [
|
|
13129
13128
|
writeQtyLength(w, "Length", values.lengthM),
|
|
13130
13129
|
writeQtyLength(w, "Width", values.widthM),
|
|
@@ -15188,10 +15187,25 @@ function preflightExactBody(input) {
|
|
|
15188
15187
|
return (0, brepjs.ok)([first.value, ...remainingPrepared]);
|
|
15189
15188
|
}
|
|
15190
15189
|
//#endregion
|
|
15191
|
-
//#region src/serialize/
|
|
15192
|
-
function
|
|
15190
|
+
//#region src/serialize/wallQuantities.ts
|
|
15191
|
+
function deriveWallQuantities(input) {
|
|
15193
15192
|
try {
|
|
15194
|
-
const
|
|
15193
|
+
const items = [];
|
|
15194
|
+
for (const retained of input.solids) {
|
|
15195
|
+
if ((0, brepjs.getKernel)().shapeType(retained.wrapped) !== "compound") {
|
|
15196
|
+
items.push(retained);
|
|
15197
|
+
continue;
|
|
15198
|
+
}
|
|
15199
|
+
const cardinality = singleWrapperChild(retained);
|
|
15200
|
+
if (!cardinality.ok) return cardinality;
|
|
15201
|
+
const children = (0, brepjs.getSolids)(retained);
|
|
15202
|
+
const [child] = children;
|
|
15203
|
+
if (children.length !== 1 || child === void 0 || !(0, brepjs.isValidSolid)(child)) return wallVolumeError(/* @__PURE__ */ new Error("Expected one valid solid in a retained recipe wrapper"));
|
|
15204
|
+
items.push(child);
|
|
15205
|
+
}
|
|
15206
|
+
const [first, ...rest] = items;
|
|
15207
|
+
if (first === void 0) return wallVolumeError(/* @__PURE__ */ new Error("Expected retained Wall material"));
|
|
15208
|
+
const measured = measureProductBodyMaterial([first, ...rest]);
|
|
15195
15209
|
if (!measured.ok) return wallVolumeError(measured.error);
|
|
15196
15210
|
return (0, brepjs.ok)({
|
|
15197
15211
|
lengthM: toIfcLengthM(input.spec.length),
|
|
@@ -15203,8 +15217,24 @@ function deriveExactWallQuantities(input) {
|
|
|
15203
15217
|
return wallVolumeError(cause);
|
|
15204
15218
|
}
|
|
15205
15219
|
}
|
|
15220
|
+
/** Count before cached extraction: a failed later cast cannot strand earlier children. */
|
|
15221
|
+
function singleWrapperChild(retained) {
|
|
15222
|
+
const kernel = (0, brepjs.getKernel)();
|
|
15223
|
+
let count;
|
|
15224
|
+
if (kernel.subShapeCount !== void 0) count = kernel.subShapeCount(retained.wrapped, "solid");
|
|
15225
|
+
else {
|
|
15226
|
+
const rawChildren = kernel.iterShapes(retained.wrapped, "solid");
|
|
15227
|
+
const cleanup = cleanupOwnedResources(rawChildren.map((raw, itemIndex) => ({
|
|
15228
|
+
resource: { [Symbol.dispose]: () => kernel.dispose(raw) },
|
|
15229
|
+
itemIndex
|
|
15230
|
+
})), { operation: "wallQuantityWrapperCount" });
|
|
15231
|
+
if (cleanup.kind === "FAILED") return wallVolumeError({ cleanup });
|
|
15232
|
+
count = rawChildren.length;
|
|
15233
|
+
}
|
|
15234
|
+
return count === 1 ? (0, brepjs.ok)(void 0) : wallVolumeError(/* @__PURE__ */ new Error("Expected one valid solid in a retained recipe wrapper"));
|
|
15235
|
+
}
|
|
15206
15236
|
function wallVolumeError(cause) {
|
|
15207
|
-
return (0, brepjs.err)(ifcError("
|
|
15237
|
+
return (0, brepjs.err)(ifcError("IFC_WALL_QUANTITY_DERIVATION_FAILED", "Failed to derive a positive finite NetVolume for the retained Wall Body", cause));
|
|
15208
15238
|
}
|
|
15209
15239
|
//#endregion
|
|
15210
15240
|
//#region src/serialize/toIfc.ts
|
|
@@ -15235,8 +15265,13 @@ function preflightProductBodies(elements) {
|
|
|
15235
15265
|
return (0, brepjs.ok)(preflighted);
|
|
15236
15266
|
}
|
|
15237
15267
|
async function toIfc(model, meta) {
|
|
15268
|
+
const serialized = await serializeIfc(model, meta);
|
|
15269
|
+
return serialized.ok ? (0, brepjs.ok)(serialized.value.bytes) : serialized;
|
|
15270
|
+
}
|
|
15271
|
+
async function serializeIfc(model, meta) {
|
|
15238
15272
|
try {
|
|
15239
15273
|
var _usingCtx$2 = _usingCtx();
|
|
15274
|
+
const issues = [];
|
|
15240
15275
|
const project = model.getProject();
|
|
15241
15276
|
if (!project) return (0, brepjs.err)(ifcError("NO_PROJECT", "BimModel has no project — call model.init() first"));
|
|
15242
15277
|
if ((model.getBridges().length > 0 || model.getBridgeParts().length > 0 || model.getEarthworksFills().length > 0) && (meta.ifcSchema ?? "IFC4") !== "IFC4X3") return (0, brepjs.err)(ifcError("IFC4X3_REQUIRED", "Bridge, Bridge Part, and Earthworks Fill entities require IFC4X3 serialization"));
|
|
@@ -15354,10 +15389,10 @@ async function toIfc(model, meta) {
|
|
|
15354
15389
|
const wall = preflighted.element;
|
|
15355
15390
|
const containingId = findContainerOf(wall.localId, relationships);
|
|
15356
15391
|
const storeyPlacementId = containingId !== null ? placementMap.get(containingId) ?? null : null;
|
|
15357
|
-
const
|
|
15392
|
+
const bodyQuantities = deriveWallQuantities({
|
|
15358
15393
|
spec: wall.spec,
|
|
15359
|
-
solids:
|
|
15360
|
-
})
|
|
15394
|
+
solids: bodySolids(wall.geometry)
|
|
15395
|
+
});
|
|
15361
15396
|
const { localPlacementId, productDefinitionShapeId } = preflighted.kind === "EXACT" ? writeExactBodyGeometry(w, wall.spec, preflighted.items, geomSubContextId, storeyPlacementId) : writeWallGeometry(w, wall.spec, geomSubContextId, storeyPlacementId);
|
|
15362
15397
|
const wallExpressId = writeWallEntity(w, wall.guid, `Wall ${i + 1}`, ownerHistoryId, localPlacementId, productDefinitionShapeId);
|
|
15363
15398
|
idMap.set(wall.localId, wallExpressId);
|
|
@@ -15365,9 +15400,12 @@ async function toIfc(model, meta) {
|
|
|
15365
15400
|
writeWallCommonPset(w, ownerHistoryId, wallExpressId, wall.spec);
|
|
15366
15401
|
writeManufacturerPset(w, ownerHistoryId, wallExpressId, wall.spec);
|
|
15367
15402
|
if (wall.spec.customProperties !== void 0) writeCustomPsets(w, ownerHistoryId, wallExpressId, wall.spec.customProperties);
|
|
15368
|
-
if (
|
|
15369
|
-
|
|
15370
|
-
|
|
15403
|
+
if (!bodyQuantities.ok) issues.push(issue("warning", "WALL_QUANTITY_OMITTED", "Wall quantities omitted because occupied material volume could not be measured", wall.localId, {
|
|
15404
|
+
guid: wall.guid,
|
|
15405
|
+
cause: bodyQuantities.error
|
|
15406
|
+
}));
|
|
15407
|
+
else if (wall.geometry.kind === "PARAMETRIC") writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, wall.spec, openingsByWall.get(wall.localId) ?? [], bodyQuantities.value.netVolumeM3, densityByElement.get(wall.localId));
|
|
15408
|
+
else writeWallBodyQuantities(w, ownerHistoryId, wallExpressId, bodyQuantities.value);
|
|
15371
15409
|
}
|
|
15372
15410
|
for (const [i, slab] of slabs.entries()) {
|
|
15373
15411
|
const containingId = findContainerOf(slab.localId, relationships);
|
|
@@ -15711,7 +15749,11 @@ async function toIfc(model, meta) {
|
|
|
15711
15749
|
for (const { ref, ids } of classByKey.values()) byClassification.set(ref, ids);
|
|
15712
15750
|
if (byClassification.size > 0) writeClassificationRefs(w, ownerHistoryId, byClassification);
|
|
15713
15751
|
writeTypeLayer(w, ownerHistoryId, model, idMap);
|
|
15714
|
-
|
|
15752
|
+
const saved = w.save();
|
|
15753
|
+
return saved.ok ? (0, brepjs.ok)({
|
|
15754
|
+
bytes: saved.value,
|
|
15755
|
+
issues
|
|
15756
|
+
}) : saved;
|
|
15715
15757
|
} catch (_) {
|
|
15716
15758
|
_usingCtx$2.e = _;
|
|
15717
15759
|
} finally {
|
|
@@ -15831,15 +15873,16 @@ function toOccurrences(elements, predefined) {
|
|
|
15831
15873
|
async function toIfcValidated(model, meta) {
|
|
15832
15874
|
const integrity = checkReferentialIntegrity(model);
|
|
15833
15875
|
if (hasErrors(integrity)) return (0, brepjs.err)(ifcError("INTEGRITY_FAILURE", "Model failed referential integrity check", integrity.issues.filter((i) => i.severity === "error")));
|
|
15834
|
-
const
|
|
15835
|
-
if (!
|
|
15836
|
-
const bytes =
|
|
15876
|
+
const serialized = await serializeIfc(model, meta);
|
|
15877
|
+
if (!serialized.ok) return serialized;
|
|
15878
|
+
const { bytes } = serialized.value;
|
|
15837
15879
|
const geometry = collectGeometryIssues(model);
|
|
15838
15880
|
const schema = await checkSchema(bytes);
|
|
15839
15881
|
const roundTrip = await checkRoundTrip(bytes);
|
|
15840
15882
|
const gherkin = await checkGherkinRules(bytes);
|
|
15841
15883
|
const report = { issues: [
|
|
15842
15884
|
...integrity.issues,
|
|
15885
|
+
...serialized.value.issues,
|
|
15843
15886
|
...geometry.issues,
|
|
15844
15887
|
...schema.issues,
|
|
15845
15888
|
...roundTrip.issues,
|
package/dist/brepjs-bim.js
CHANGED
|
@@ -13069,7 +13069,7 @@ function pushWeightQuantity(w, qtyIds, volumeM3, densityKgM3) {
|
|
|
13069
13069
|
if (densityKgM3 === void 0) return;
|
|
13070
13070
|
qtyIds.push(writeWeightQuantity(w, "GrossWeight", volumeM3, densityKgM3));
|
|
13071
13071
|
}
|
|
13072
|
-
function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, openings, densityKgM3) {
|
|
13072
|
+
function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, openings, netVolumeM3, densityKgM3) {
|
|
13073
13073
|
const lengthM = toIfcLengthM(spec.length);
|
|
13074
13074
|
const widthM = toIfcLengthM(spec.thickness);
|
|
13075
13075
|
const heightM = toIfcLengthM(spec.height);
|
|
@@ -13085,7 +13085,6 @@ function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, opening
|
|
|
13085
13085
|
if (toIfcLengthM(op.offsetFromFloor) < FLOOR_TOUCH_EPSILON_M) sumFloorTouchingFootprintM2 += opWidthM * widthM;
|
|
13086
13086
|
}
|
|
13087
13087
|
const netSideAreaM2 = grossSideAreaM2 - sumOpeningAreaM2;
|
|
13088
|
-
const netVolumeM3 = grossVolumeM3 - sumOpeningAreaM2 * widthM;
|
|
13089
13088
|
const netFootprintM2 = grossFootprintM2 - sumFloorTouchingFootprintM2;
|
|
13090
13089
|
const qtyIds = [
|
|
13091
13090
|
writeQtyLength(w, "Length", lengthM),
|
|
@@ -13101,7 +13100,7 @@ function writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, spec, opening
|
|
|
13101
13100
|
pushWeightQuantity(w, qtyIds, netVolumeM3, densityKgM3);
|
|
13102
13101
|
writeRelDefinesByProperties(w, ownerHistoryId, wallExpressId, writeElementQuantity(w, ownerHistoryId, "Qto_WallBaseQuantities", qtyIds));
|
|
13103
13102
|
}
|
|
13104
|
-
function
|
|
13103
|
+
function writeWallBodyQuantities(w, ownerHistoryId, wallExpressId, values) {
|
|
13105
13104
|
writeRelDefinesByProperties(w, ownerHistoryId, wallExpressId, writeElementQuantity(w, ownerHistoryId, "Qto_WallBaseQuantities", [
|
|
13106
13105
|
writeQtyLength(w, "Length", values.lengthM),
|
|
13107
13106
|
writeQtyLength(w, "Width", values.widthM),
|
|
@@ -15165,10 +15164,25 @@ function preflightExactBody(input) {
|
|
|
15165
15164
|
return ok([first.value, ...remainingPrepared]);
|
|
15166
15165
|
}
|
|
15167
15166
|
//#endregion
|
|
15168
|
-
//#region src/serialize/
|
|
15169
|
-
function
|
|
15167
|
+
//#region src/serialize/wallQuantities.ts
|
|
15168
|
+
function deriveWallQuantities(input) {
|
|
15170
15169
|
try {
|
|
15171
|
-
const
|
|
15170
|
+
const items = [];
|
|
15171
|
+
for (const retained of input.solids) {
|
|
15172
|
+
if (getKernel().shapeType(retained.wrapped) !== "compound") {
|
|
15173
|
+
items.push(retained);
|
|
15174
|
+
continue;
|
|
15175
|
+
}
|
|
15176
|
+
const cardinality = singleWrapperChild(retained);
|
|
15177
|
+
if (!cardinality.ok) return cardinality;
|
|
15178
|
+
const children = getSolids(retained);
|
|
15179
|
+
const [child] = children;
|
|
15180
|
+
if (children.length !== 1 || child === void 0 || !isValidSolid(child)) return wallVolumeError(/* @__PURE__ */ new Error("Expected one valid solid in a retained recipe wrapper"));
|
|
15181
|
+
items.push(child);
|
|
15182
|
+
}
|
|
15183
|
+
const [first, ...rest] = items;
|
|
15184
|
+
if (first === void 0) return wallVolumeError(/* @__PURE__ */ new Error("Expected retained Wall material"));
|
|
15185
|
+
const measured = measureProductBodyMaterial([first, ...rest]);
|
|
15172
15186
|
if (!measured.ok) return wallVolumeError(measured.error);
|
|
15173
15187
|
return ok({
|
|
15174
15188
|
lengthM: toIfcLengthM(input.spec.length),
|
|
@@ -15180,8 +15194,24 @@ function deriveExactWallQuantities(input) {
|
|
|
15180
15194
|
return wallVolumeError(cause);
|
|
15181
15195
|
}
|
|
15182
15196
|
}
|
|
15197
|
+
/** Count before cached extraction: a failed later cast cannot strand earlier children. */
|
|
15198
|
+
function singleWrapperChild(retained) {
|
|
15199
|
+
const kernel = getKernel();
|
|
15200
|
+
let count;
|
|
15201
|
+
if (kernel.subShapeCount !== void 0) count = kernel.subShapeCount(retained.wrapped, "solid");
|
|
15202
|
+
else {
|
|
15203
|
+
const rawChildren = kernel.iterShapes(retained.wrapped, "solid");
|
|
15204
|
+
const cleanup = cleanupOwnedResources(rawChildren.map((raw, itemIndex) => ({
|
|
15205
|
+
resource: { [Symbol.dispose]: () => kernel.dispose(raw) },
|
|
15206
|
+
itemIndex
|
|
15207
|
+
})), { operation: "wallQuantityWrapperCount" });
|
|
15208
|
+
if (cleanup.kind === "FAILED") return wallVolumeError({ cleanup });
|
|
15209
|
+
count = rawChildren.length;
|
|
15210
|
+
}
|
|
15211
|
+
return count === 1 ? ok(void 0) : wallVolumeError(/* @__PURE__ */ new Error("Expected one valid solid in a retained recipe wrapper"));
|
|
15212
|
+
}
|
|
15183
15213
|
function wallVolumeError(cause) {
|
|
15184
|
-
return err(ifcError("
|
|
15214
|
+
return err(ifcError("IFC_WALL_QUANTITY_DERIVATION_FAILED", "Failed to derive a positive finite NetVolume for the retained Wall Body", cause));
|
|
15185
15215
|
}
|
|
15186
15216
|
//#endregion
|
|
15187
15217
|
//#region src/serialize/toIfc.ts
|
|
@@ -15212,8 +15242,13 @@ function preflightProductBodies(elements) {
|
|
|
15212
15242
|
return ok(preflighted);
|
|
15213
15243
|
}
|
|
15214
15244
|
async function toIfc(model, meta) {
|
|
15245
|
+
const serialized = await serializeIfc(model, meta);
|
|
15246
|
+
return serialized.ok ? ok(serialized.value.bytes) : serialized;
|
|
15247
|
+
}
|
|
15248
|
+
async function serializeIfc(model, meta) {
|
|
15215
15249
|
try {
|
|
15216
15250
|
var _usingCtx$2 = _usingCtx();
|
|
15251
|
+
const issues = [];
|
|
15217
15252
|
const project = model.getProject();
|
|
15218
15253
|
if (!project) return err(ifcError("NO_PROJECT", "BimModel has no project — call model.init() first"));
|
|
15219
15254
|
if ((model.getBridges().length > 0 || model.getBridgeParts().length > 0 || model.getEarthworksFills().length > 0) && (meta.ifcSchema ?? "IFC4") !== "IFC4X3") return err(ifcError("IFC4X3_REQUIRED", "Bridge, Bridge Part, and Earthworks Fill entities require IFC4X3 serialization"));
|
|
@@ -15331,10 +15366,10 @@ async function toIfc(model, meta) {
|
|
|
15331
15366
|
const wall = preflighted.element;
|
|
15332
15367
|
const containingId = findContainerOf(wall.localId, relationships);
|
|
15333
15368
|
const storeyPlacementId = containingId !== null ? placementMap.get(containingId) ?? null : null;
|
|
15334
|
-
const
|
|
15369
|
+
const bodyQuantities = deriveWallQuantities({
|
|
15335
15370
|
spec: wall.spec,
|
|
15336
|
-
solids:
|
|
15337
|
-
})
|
|
15371
|
+
solids: bodySolids(wall.geometry)
|
|
15372
|
+
});
|
|
15338
15373
|
const { localPlacementId, productDefinitionShapeId } = preflighted.kind === "EXACT" ? writeExactBodyGeometry(w, wall.spec, preflighted.items, geomSubContextId, storeyPlacementId) : writeWallGeometry(w, wall.spec, geomSubContextId, storeyPlacementId);
|
|
15339
15374
|
const wallExpressId = writeWallEntity(w, wall.guid, `Wall ${i + 1}`, ownerHistoryId, localPlacementId, productDefinitionShapeId);
|
|
15340
15375
|
idMap.set(wall.localId, wallExpressId);
|
|
@@ -15342,9 +15377,12 @@ async function toIfc(model, meta) {
|
|
|
15342
15377
|
writeWallCommonPset(w, ownerHistoryId, wallExpressId, wall.spec);
|
|
15343
15378
|
writeManufacturerPset(w, ownerHistoryId, wallExpressId, wall.spec);
|
|
15344
15379
|
if (wall.spec.customProperties !== void 0) writeCustomPsets(w, ownerHistoryId, wallExpressId, wall.spec.customProperties);
|
|
15345
|
-
if (
|
|
15346
|
-
|
|
15347
|
-
|
|
15380
|
+
if (!bodyQuantities.ok) issues.push(issue("warning", "WALL_QUANTITY_OMITTED", "Wall quantities omitted because occupied material volume could not be measured", wall.localId, {
|
|
15381
|
+
guid: wall.guid,
|
|
15382
|
+
cause: bodyQuantities.error
|
|
15383
|
+
}));
|
|
15384
|
+
else if (wall.geometry.kind === "PARAMETRIC") writeWallBaseQuantities(w, ownerHistoryId, wallExpressId, wall.spec, openingsByWall.get(wall.localId) ?? [], bodyQuantities.value.netVolumeM3, densityByElement.get(wall.localId));
|
|
15385
|
+
else writeWallBodyQuantities(w, ownerHistoryId, wallExpressId, bodyQuantities.value);
|
|
15348
15386
|
}
|
|
15349
15387
|
for (const [i, slab] of slabs.entries()) {
|
|
15350
15388
|
const containingId = findContainerOf(slab.localId, relationships);
|
|
@@ -15688,7 +15726,11 @@ async function toIfc(model, meta) {
|
|
|
15688
15726
|
for (const { ref, ids } of classByKey.values()) byClassification.set(ref, ids);
|
|
15689
15727
|
if (byClassification.size > 0) writeClassificationRefs(w, ownerHistoryId, byClassification);
|
|
15690
15728
|
writeTypeLayer(w, ownerHistoryId, model, idMap);
|
|
15691
|
-
|
|
15729
|
+
const saved = w.save();
|
|
15730
|
+
return saved.ok ? ok({
|
|
15731
|
+
bytes: saved.value,
|
|
15732
|
+
issues
|
|
15733
|
+
}) : saved;
|
|
15692
15734
|
} catch (_) {
|
|
15693
15735
|
_usingCtx$2.e = _;
|
|
15694
15736
|
} finally {
|
|
@@ -15808,15 +15850,16 @@ function toOccurrences(elements, predefined) {
|
|
|
15808
15850
|
async function toIfcValidated(model, meta) {
|
|
15809
15851
|
const integrity = checkReferentialIntegrity(model);
|
|
15810
15852
|
if (hasErrors(integrity)) return err(ifcError("INTEGRITY_FAILURE", "Model failed referential integrity check", integrity.issues.filter((i) => i.severity === "error")));
|
|
15811
|
-
const
|
|
15812
|
-
if (!
|
|
15813
|
-
const bytes =
|
|
15853
|
+
const serialized = await serializeIfc(model, meta);
|
|
15854
|
+
if (!serialized.ok) return serialized;
|
|
15855
|
+
const { bytes } = serialized.value;
|
|
15814
15856
|
const geometry = collectGeometryIssues(model);
|
|
15815
15857
|
const schema = await checkSchema(bytes);
|
|
15816
15858
|
const roundTrip = await checkRoundTrip(bytes);
|
|
15817
15859
|
const gherkin = await checkGherkinRules(bytes);
|
|
15818
15860
|
const report = { issues: [
|
|
15819
15861
|
...integrity.issues,
|
|
15862
|
+
...serialized.value.issues,
|
|
15820
15863
|
...geometry.issues,
|
|
15821
15864
|
...schema.issues,
|
|
15822
15865
|
...roundTrip.issues,
|
|
@@ -44,8 +44,8 @@ export declare function writeCustomPsets(w: IfcWriter, ownerHistoryId: number, e
|
|
|
44
44
|
* so the caller can skip emitting a weight quantity.
|
|
45
45
|
*/
|
|
46
46
|
export declare function resolveDensityKgM3(materialName: string | undefined, explicitDensityKgM3: number | undefined): number | undefined;
|
|
47
|
-
export declare function writeWallBaseQuantities(w: IfcWriter, ownerHistoryId: number, wallExpressId: number, spec: WallSpec, openings: readonly WallOpeningSpec[], densityKgM3?: number): void;
|
|
48
|
-
export declare function
|
|
47
|
+
export declare function writeWallBaseQuantities(w: IfcWriter, ownerHistoryId: number, wallExpressId: number, spec: WallSpec, openings: readonly WallOpeningSpec[], netVolumeM3: number, densityKgM3?: number): void;
|
|
48
|
+
export declare function writeWallBodyQuantities(w: IfcWriter, ownerHistoryId: number, wallExpressId: number, values: {
|
|
49
49
|
readonly lengthM: number;
|
|
50
50
|
readonly widthM: number;
|
|
51
51
|
readonly heightM: number;
|
|
@@ -2,15 +2,15 @@ import { Result, ValidSolid } from 'brepjs';
|
|
|
2
2
|
import { BimError } from '../errors/bimError.js';
|
|
3
3
|
import { WallSpec } from '../specs/wallSpec.js';
|
|
4
4
|
import { NonEmpty } from '../types/productBody.js';
|
|
5
|
-
interface
|
|
5
|
+
interface WallQuantityValues {
|
|
6
6
|
readonly lengthM: number;
|
|
7
7
|
readonly widthM: number;
|
|
8
8
|
readonly heightM: number;
|
|
9
9
|
readonly netVolumeM3: number;
|
|
10
10
|
}
|
|
11
|
-
interface
|
|
11
|
+
interface WallQuantityInput {
|
|
12
12
|
readonly spec: WallSpec;
|
|
13
13
|
readonly solids: NonEmpty<ValidSolid>;
|
|
14
14
|
}
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function deriveWallQuantities(input: WallQuantityInput): Result<WallQuantityValues, BimError>;
|
|
16
16
|
export {};
|