@ifc-lite/create 1.14.5 → 1.15.1
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/ifc-creator-math.d.ts +23 -0
- package/dist/ifc-creator-math.d.ts.map +1 -0
- package/dist/ifc-creator-math.js +50 -0
- package/dist/ifc-creator-math.js.map +1 -0
- package/dist/ifc-creator.d.ts +63 -1
- package/dist/ifc-creator.d.ts.map +1 -1
- package/dist/ifc-creator.js +222 -41
- package/dist/ifc-creator.js.map +1 -1
- package/dist/in-store/_emit-helpers.d.ts +52 -0
- package/dist/in-store/_emit-helpers.d.ts.map +1 -0
- package/dist/in-store/_emit-helpers.js +147 -0
- package/dist/in-store/_emit-helpers.js.map +1 -0
- package/dist/in-store/anchor.d.ts +29 -0
- package/dist/in-store/anchor.d.ts.map +1 -0
- package/dist/in-store/anchor.js +5 -0
- package/dist/in-store/anchor.js.map +1 -0
- package/dist/in-store/auto-space-detect.d.ts +68 -0
- package/dist/in-store/auto-space-detect.d.ts.map +1 -0
- package/dist/in-store/auto-space-detect.js +393 -0
- package/dist/in-store/auto-space-detect.js.map +1 -0
- package/dist/in-store/beam.d.ts +25 -0
- package/dist/in-store/beam.d.ts.map +1 -0
- package/dist/in-store/beam.js +119 -0
- package/dist/in-store/beam.js.map +1 -0
- package/dist/in-store/column.d.ts +42 -0
- package/dist/in-store/column.d.ts.map +1 -0
- package/dist/in-store/column.js +108 -0
- package/dist/in-store/column.js.map +1 -0
- package/dist/in-store/door.d.ts +44 -0
- package/dist/in-store/door.d.ts.map +1 -0
- package/dist/in-store/door.js +68 -0
- package/dist/in-store/door.js.map +1 -0
- package/dist/in-store/duplicate.d.ts +100 -0
- package/dist/in-store/duplicate.d.ts.map +1 -0
- package/dist/in-store/duplicate.js +122 -0
- package/dist/in-store/duplicate.js.map +1 -0
- package/dist/in-store/extract-walls.d.ts +80 -0
- package/dist/in-store/extract-walls.d.ts.map +1 -0
- package/dist/in-store/extract-walls.js +522 -0
- package/dist/in-store/extract-walls.js.map +1 -0
- package/dist/in-store/generate-spaces.d.ts +71 -0
- package/dist/in-store/generate-spaces.d.ts.map +1 -0
- package/dist/in-store/generate-spaces.js +76 -0
- package/dist/in-store/generate-spaces.js.map +1 -0
- package/dist/in-store/member.d.ts +32 -0
- package/dist/in-store/member.d.ts.map +1 -0
- package/dist/in-store/member.js +35 -0
- package/dist/in-store/member.js.map +1 -0
- package/dist/in-store/plate.d.ts +43 -0
- package/dist/in-store/plate.d.ts.map +1 -0
- package/dist/in-store/plate.js +33 -0
- package/dist/in-store/plate.js.map +1 -0
- package/dist/in-store/resolve-anchor.d.ts +12 -0
- package/dist/in-store/resolve-anchor.d.ts.map +1 -0
- package/dist/in-store/resolve-anchor.js +125 -0
- package/dist/in-store/resolve-anchor.js.map +1 -0
- package/dist/in-store/resolve-source.d.ts +19 -0
- package/dist/in-store/resolve-source.d.ts.map +1 -0
- package/dist/in-store/resolve-source.js +203 -0
- package/dist/in-store/resolve-source.js.map +1 -0
- package/dist/in-store/roof.d.ts +43 -0
- package/dist/in-store/roof.d.ts.map +1 -0
- package/dist/in-store/roof.js +33 -0
- package/dist/in-store/roof.js.map +1 -0
- package/dist/in-store/slab.d.ts +44 -0
- package/dist/in-store/slab.d.ts.map +1 -0
- package/dist/in-store/slab.js +142 -0
- package/dist/in-store/slab.js.map +1 -0
- package/dist/in-store/space.d.ts +43 -0
- package/dist/in-store/space.d.ts.map +1 -0
- package/dist/in-store/space.js +71 -0
- package/dist/in-store/space.js.map +1 -0
- package/dist/in-store/wall.d.ts +27 -0
- package/dist/in-store/wall.d.ts.map +1 -0
- package/dist/in-store/wall.js +121 -0
- package/dist/in-store/wall.js.map +1 -0
- package/dist/in-store/window.d.ts +36 -0
- package/dist/in-store/window.d.ts.map +1 -0
- package/dist/in-store/window.js +57 -0
- package/dist/in-store/window.js.map +1 -0
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -6
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure utility functions and constants used by IfcCreator.
|
|
3
|
+
* These have zero coupling to class state — they take inputs and return outputs.
|
|
4
|
+
*/
|
|
5
|
+
import type { Point3D } from './types.js';
|
|
6
|
+
/** Escape a string for STEP format */
|
|
7
|
+
export declare function esc(str: string): string;
|
|
8
|
+
/** Format a STEP line: #ID=TYPE(args); */
|
|
9
|
+
export declare function stepLine(id: number, type: string, args: string): string;
|
|
10
|
+
/** Serialize a number in STEP format (always with decimal point, no exponent notation) */
|
|
11
|
+
export declare function num(v: number): string;
|
|
12
|
+
/** Vector length */
|
|
13
|
+
export declare function vecLen(v: Point3D): number;
|
|
14
|
+
/**
|
|
15
|
+
* IFC types that do NOT follow the IfcElement attribute layout (no Tag/PredefinedType).
|
|
16
|
+
* addElement/addAxisElement skip Tag+PredefinedType for these types.
|
|
17
|
+
*/
|
|
18
|
+
export declare const NON_ELEMENT_TYPES: Set<string>;
|
|
19
|
+
/** Normalize vector — throws on zero-length (indicates geometry bug like Start === End) */
|
|
20
|
+
export declare function vecNorm(v: Point3D): Point3D;
|
|
21
|
+
/** Cross product */
|
|
22
|
+
export declare function vecCross(a: Point3D, b: Point3D): Point3D;
|
|
23
|
+
//# sourceMappingURL=ifc-creator-math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifc-creator-math.d.ts","sourceRoot":"","sources":["../src/ifc-creator-math.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAM1C,sCAAsC;AACtC,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,0FAA0F;AAC1F,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKrC;AAED,oBAAoB;AACpB,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAEzC;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,aAG5B,CAAC;AAEH,2FAA2F;AAC3F,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAI3C;AAED,oBAAoB;AACpB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAMxD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// Internal helpers
|
|
6
|
+
// ============================================================================
|
|
7
|
+
/** Escape a string for STEP format */
|
|
8
|
+
export function esc(str) {
|
|
9
|
+
return str.replace(/\\/g, '\\\\').replace(/'/g, "''");
|
|
10
|
+
}
|
|
11
|
+
/** Format a STEP line: #ID=TYPE(args); */
|
|
12
|
+
export function stepLine(id, type, args) {
|
|
13
|
+
return `#${id}=${type}(${args});`;
|
|
14
|
+
}
|
|
15
|
+
/** Serialize a number in STEP format (always with decimal point, no exponent notation) */
|
|
16
|
+
export function num(v) {
|
|
17
|
+
// Exponent notation (e.g. 1e-7) is not valid STEP — use fixed decimal
|
|
18
|
+
const s = v.toString();
|
|
19
|
+
if (s.includes('e') || s.includes('E'))
|
|
20
|
+
return v.toFixed(10).replace(/0+$/, '0');
|
|
21
|
+
return s.includes('.') ? s : s + '.';
|
|
22
|
+
}
|
|
23
|
+
/** Vector length */
|
|
24
|
+
export function vecLen(v) {
|
|
25
|
+
return Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* IFC types that do NOT follow the IfcElement attribute layout (no Tag/PredefinedType).
|
|
29
|
+
* addElement/addAxisElement skip Tag+PredefinedType for these types.
|
|
30
|
+
*/
|
|
31
|
+
export const NON_ELEMENT_TYPES = new Set([
|
|
32
|
+
'IFCBUILDING', 'IFCSITE', 'IFCBUILDINGSTOREY', 'IFCPROJECT',
|
|
33
|
+
'IFCSPACE', 'IFCZONE', 'IFCSYSTEM', 'IFCGROUP',
|
|
34
|
+
]);
|
|
35
|
+
/** Normalize vector — throws on zero-length (indicates geometry bug like Start === End) */
|
|
36
|
+
export function vecNorm(v) {
|
|
37
|
+
const len = vecLen(v);
|
|
38
|
+
if (len === 0)
|
|
39
|
+
throw new Error('Cannot normalize zero-length vector (check that Start and End are not identical)');
|
|
40
|
+
return [v[0] / len, v[1] / len, v[2] / len];
|
|
41
|
+
}
|
|
42
|
+
/** Cross product */
|
|
43
|
+
export function vecCross(a, b) {
|
|
44
|
+
return [
|
|
45
|
+
a[1] * b[2] - a[2] * b[1],
|
|
46
|
+
a[2] * b[0] - a[0] * b[2],
|
|
47
|
+
a[0] * b[1] - a[1] * b[0],
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ifc-creator-math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifc-creator-math.js","sourceRoot":"","sources":["../src/ifc-creator-math.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAS/D,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,sCAAsC;AACtC,MAAM,UAAU,GAAG,CAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,QAA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AC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,oBAAoB;AACpB,MAAM,UAAU,QAAQ,CAAC,CAAU,EAAE,CAAU;IAC7C,OAAO;QACL,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAC1B,CAAC;AACJ,CAAC"}
|
package/dist/ifc-creator.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* All values in metres unless LengthUnit is overridden.
|
|
15
15
|
*/
|
|
16
|
-
import type { Point3D, Point2D, Placement3D, ElementAttributes, ProfileDef, GenericElementParams, AxisElementParams, WallParams, SlabParams, ColumnParams, BeamParams, StairParams, RoofParams, GableRoofParams, WallDoorParams, WallWindowParams, DoorParams, WindowParams, RampParams, RailingParams, PlateParams, MemberParams, FootingParams, PileParams, SpaceParams, CurtainWallParams, FurnishingParams, ProxyParams, ProjectParams, StoreyParams, PropertySetDef, QuantitySetDef, MaterialDef, CreateResult } from './types.js';
|
|
16
|
+
import type { Point3D, Point2D, Placement3D, ElementAttributes, ProfileDef, GenericElementParams, AxisElementParams, WallParams, SlabParams, ColumnParams, BeamParams, StairParams, RoofParams, GableRoofParams, WallDoorParams, WallWindowParams, DoorParams, WindowParams, RampParams, RailingParams, PlateParams, MemberParams, FootingParams, PileParams, SpaceParams, CurtainWallParams, FurnishingParams, ProxyParams, ProjectParams, StoreyParams, PropertySetDef, QuantitySetDef, MaterialDef, WorkScheduleParams, WorkPlanParams, TaskParams, SequenceParams, CreateResult } from './types.js';
|
|
17
17
|
export declare class IfcCreator {
|
|
18
18
|
private nextId;
|
|
19
19
|
private lines;
|
|
@@ -254,6 +254,68 @@ export declare class IfcCreator {
|
|
|
254
254
|
* Layered material: `{ Name: 'Wall Assembly', Layers: [{ Name: 'Concrete', Thickness: 0.2 }, …] }`
|
|
255
255
|
*/
|
|
256
256
|
addIfcMaterial(elementId: number, def: MaterialDef): void;
|
|
257
|
+
/**
|
|
258
|
+
* Create an IfcWorkSchedule. Returns its expressId for assigning tasks
|
|
259
|
+
* via `assignTasksToWorkSchedule(scheduleId, taskIds)`.
|
|
260
|
+
*/
|
|
261
|
+
addIfcWorkSchedule(params: WorkScheduleParams): number;
|
|
262
|
+
/**
|
|
263
|
+
* Create an IfcWorkPlan — a container that groups multiple IfcWorkSchedules.
|
|
264
|
+
* Attach schedules to the plan with `assignSchedulesToWorkPlan(planId, scheduleIds)`.
|
|
265
|
+
*/
|
|
266
|
+
addIfcWorkPlan(params: WorkPlanParams): number;
|
|
267
|
+
/**
|
|
268
|
+
* Create an IfcTask. If any Schedule/Actual/Early/Late time field, IsCritical,
|
|
269
|
+
* or Completion attribute is present, an IfcTaskTime is created and linked.
|
|
270
|
+
* Returns the task expressId.
|
|
271
|
+
*/
|
|
272
|
+
addIfcTask(params: TaskParams): number;
|
|
273
|
+
/**
|
|
274
|
+
* Build an IfcTaskTime from the task params (internal helper — prefer
|
|
275
|
+
* setting the time fields on the task itself via `addIfcTask`).
|
|
276
|
+
*/
|
|
277
|
+
private addIfcTaskTime;
|
|
278
|
+
/**
|
|
279
|
+
* Create an IfcRelSequence between two tasks. The predecessor is `RelatingProcess`
|
|
280
|
+
* and the successor is `RelatedProcess`. SequenceType defaults to FINISH_START.
|
|
281
|
+
*/
|
|
282
|
+
addIfcRelSequence(predecessorTaskId: number, successorTaskId: number, params?: SequenceParams): number;
|
|
283
|
+
/**
|
|
284
|
+
* Emit an IfcRelAssignsToControl — binds any IfcObjectDefinition (typically
|
|
285
|
+
* IfcTasks or sub-schedules) to an IfcControl (IfcWorkSchedule / IfcWorkPlan).
|
|
286
|
+
* Returns the relationship expressId.
|
|
287
|
+
*/
|
|
288
|
+
addIfcRelAssignsToControl(relatingControlId: number, relatedObjectIds: number[]): number;
|
|
289
|
+
/**
|
|
290
|
+
* Ergonomic alias — assign tasks (or sub-schedules) to a work schedule.
|
|
291
|
+
* Delegates to {@link addIfcRelAssignsToControl}.
|
|
292
|
+
*/
|
|
293
|
+
assignTasksToWorkSchedule(scheduleId: number, taskIds: number[]): number;
|
|
294
|
+
/**
|
|
295
|
+
* Ergonomic alias — attach sub-schedules to an IfcWorkPlan. Delegates to
|
|
296
|
+
* {@link addIfcRelAssignsToControl}.
|
|
297
|
+
*/
|
|
298
|
+
assignSchedulesToWorkPlan(planId: number, scheduleIds: number[]): number;
|
|
299
|
+
/**
|
|
300
|
+
* Emit an IfcRelAssignsToProcess — binds products (walls, slabs, ...) to an
|
|
301
|
+
* IfcProcess (usually an IfcTask). These drive the Gantt 4D animation.
|
|
302
|
+
* Returns the relationship expressId.
|
|
303
|
+
*/
|
|
304
|
+
addIfcRelAssignsToProcess(relatingProcessId: number, relatedObjectIds: number[]): number;
|
|
305
|
+
/** Ergonomic alias — delegates to {@link addIfcRelAssignsToProcess}. */
|
|
306
|
+
assignProductsToTask(taskId: number, productIds: number[]): number;
|
|
307
|
+
/**
|
|
308
|
+
* Emit an IfcRelNests — nests children under a parent object (used for WBS
|
|
309
|
+
* task hierarchies here). Returns the relationship expressId.
|
|
310
|
+
*/
|
|
311
|
+
addIfcRelNests(relatingObjectId: number, relatedObjectIds: number[]): number;
|
|
312
|
+
/** Ergonomic alias — delegates to {@link addIfcRelNests}. */
|
|
313
|
+
nestTasks(parentTaskId: number, childTaskIds: number[]): number;
|
|
314
|
+
/**
|
|
315
|
+
* Internal — emit an IfcWorkSchedule or IfcWorkPlan (identical attribute
|
|
316
|
+
* layout). Separate helpers are exposed publicly for ergonomics.
|
|
317
|
+
*/
|
|
318
|
+
private buildWorkControl;
|
|
257
319
|
/** Generate the complete IFC STEP file. May only be called once. */
|
|
258
320
|
toIfc(): CreateResult;
|
|
259
321
|
private buildHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ifc-creator.d.ts","sourceRoot":"","sources":["../src/ifc-creator.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,OAAO,EAAE,OAAO,EAAE,WAAW,EAC7B,iBAAiB,EAAE,UAAU,EAC7B,oBAAoB,EAAE,iBAAiB,EACvC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAC1F,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EACrF,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EACpD,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,EAC7D,aAAa,EAA8B,YAAY,EACvD,cAAc,EAAe,cAAc,EAC3C,WAAW,
|
|
1
|
+
{"version":3,"file":"ifc-creator.d.ts","sourceRoot":"","sources":["../src/ifc-creator.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,OAAO,EAAE,OAAO,EAAE,WAAW,EAC7B,iBAAiB,EAAE,UAAU,EAC7B,oBAAoB,EAAE,iBAAiB,EACvC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAC1F,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EACrF,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EACpD,WAAW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25 @@
|
|
|
1
1
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { esc, stepLine, num, vecLen, vecNorm, vecCross, NON_ELEMENT_TYPES, } from './ifc-creator-math.js';
|
|
4
5
|
// ============================================================================
|
|
5
|
-
//
|
|
6
|
+
// STEP attribute helpers (scheduling — optional strings / enums / numbers)
|
|
6
7
|
// ============================================================================
|
|
7
|
-
/**
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
/** Emit an optional STEP string: `'value'` when present, `$` otherwise. */
|
|
9
|
+
function optStr(v) {
|
|
10
|
+
return v === undefined || v === null || v === '' ? '$' : `'${esc(v)}'`;
|
|
10
11
|
}
|
|
11
|
-
/**
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
/** Emit an optional STEP enum: `.VALUE.` when present, `$` otherwise. */
|
|
13
|
+
function optEnum(v) {
|
|
14
|
+
return v === undefined || v === null || v === '' ? '$' : `.${v}.`;
|
|
14
15
|
}
|
|
15
|
-
/**
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
const s = v.toString();
|
|
19
|
-
if (s.includes('e') || s.includes('E'))
|
|
20
|
-
return v.toFixed(10).replace(/0+$/, '0');
|
|
21
|
-
return s.includes('.') ? s : s + '.';
|
|
16
|
+
/** Emit an optional STEP boolean: `.T.`/`.F.`/`$`. */
|
|
17
|
+
function optBool(v) {
|
|
18
|
+
return v === undefined || v === null ? '$' : v ? '.T.' : '.F.';
|
|
22
19
|
}
|
|
23
|
-
/**
|
|
24
|
-
function
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* IFC types that do NOT follow the IfcElement attribute layout (no Tag/PredefinedType).
|
|
29
|
-
* addElement/addAxisElement skip Tag+PredefinedType for these types.
|
|
30
|
-
*/
|
|
31
|
-
const NON_ELEMENT_TYPES = new Set([
|
|
32
|
-
'IFCBUILDING', 'IFCSITE', 'IFCBUILDINGSTOREY', 'IFCPROJECT',
|
|
33
|
-
'IFCSPACE', 'IFCZONE', 'IFCSYSTEM', 'IFCGROUP',
|
|
34
|
-
]);
|
|
35
|
-
/** Normalize vector — throws on zero-length (indicates geometry bug like Start === End) */
|
|
36
|
-
function vecNorm(v) {
|
|
37
|
-
const len = vecLen(v);
|
|
38
|
-
if (len === 0)
|
|
39
|
-
throw new Error('Cannot normalize zero-length vector (check that Start and End are not identical)');
|
|
40
|
-
return [v[0] / len, v[1] / len, v[2] / len];
|
|
41
|
-
}
|
|
42
|
-
/** Cross product */
|
|
43
|
-
function vecCross(a, b) {
|
|
44
|
-
return [
|
|
45
|
-
a[1] * b[2] - a[2] * b[1],
|
|
46
|
-
a[2] * b[0] - a[0] * b[2],
|
|
47
|
-
a[0] * b[1] - a[1] * b[0],
|
|
48
|
-
];
|
|
20
|
+
/** Emit an optional STEP real number; `$` when absent. */
|
|
21
|
+
function optReal(v) {
|
|
22
|
+
return v === undefined || v === null || !Number.isFinite(v) ? '$' : num(v);
|
|
49
23
|
}
|
|
50
24
|
// ============================================================================
|
|
51
25
|
// IfcCreator
|
|
@@ -134,7 +108,7 @@ export class IfcCreator {
|
|
|
134
108
|
const storeyPlacementId = this.addLocalPlacement(this.worldPlacementId, {
|
|
135
109
|
Location: [0, 0, params.Elevation],
|
|
136
110
|
});
|
|
137
|
-
this.line(id, 'IFCBUILDINGSTOREY', `'${globalId}',#${this.ownerHistoryId},'${esc(name)}',${desc}
|
|
111
|
+
this.line(id, 'IFCBUILDINGSTOREY', `'${globalId}',#${this.ownerHistoryId},'${esc(name)}',${desc},$,#${storeyPlacementId},$,$,.ELEMENT.,${elevation}`);
|
|
138
112
|
this.storeyIds.push(id);
|
|
139
113
|
this.storeyElements.set(id, []);
|
|
140
114
|
this.storeyPlacements.set(id, storeyPlacementId);
|
|
@@ -1163,6 +1137,213 @@ export class IfcCreator {
|
|
|
1163
1137
|
this.elementMaterials.set(elementId, materialRefId);
|
|
1164
1138
|
}
|
|
1165
1139
|
// ============================================================================
|
|
1140
|
+
// Public API — Scheduling / 4D (IfcWorkSchedule, IfcTask, IfcRelSequence)
|
|
1141
|
+
// ============================================================================
|
|
1142
|
+
/**
|
|
1143
|
+
* Create an IfcWorkSchedule. Returns its expressId for assigning tasks
|
|
1144
|
+
* via `assignTasksToWorkSchedule(scheduleId, taskIds)`.
|
|
1145
|
+
*/
|
|
1146
|
+
addIfcWorkSchedule(params) {
|
|
1147
|
+
return this.buildWorkControl('IFCWORKSCHEDULE', params);
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Create an IfcWorkPlan — a container that groups multiple IfcWorkSchedules.
|
|
1151
|
+
* Attach schedules to the plan with `assignSchedulesToWorkPlan(planId, scheduleIds)`.
|
|
1152
|
+
*/
|
|
1153
|
+
addIfcWorkPlan(params) {
|
|
1154
|
+
return this.buildWorkControl('IFCWORKPLAN', params);
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Create an IfcTask. If any Schedule/Actual/Early/Late time field, IsCritical,
|
|
1158
|
+
* or Completion attribute is present, an IfcTaskTime is created and linked.
|
|
1159
|
+
* Returns the task expressId.
|
|
1160
|
+
*/
|
|
1161
|
+
addIfcTask(params) {
|
|
1162
|
+
const hasTaskTime = params.ScheduleStart !== undefined ||
|
|
1163
|
+
params.ScheduleFinish !== undefined ||
|
|
1164
|
+
params.ScheduleDuration !== undefined ||
|
|
1165
|
+
params.ActualStart !== undefined ||
|
|
1166
|
+
params.ActualFinish !== undefined ||
|
|
1167
|
+
params.ActualDuration !== undefined ||
|
|
1168
|
+
params.EarlyStart !== undefined ||
|
|
1169
|
+
params.EarlyFinish !== undefined ||
|
|
1170
|
+
params.LateStart !== undefined ||
|
|
1171
|
+
params.LateFinish !== undefined ||
|
|
1172
|
+
params.FreeFloat !== undefined ||
|
|
1173
|
+
params.TotalFloat !== undefined ||
|
|
1174
|
+
params.RemainingTime !== undefined ||
|
|
1175
|
+
params.StatusTime !== undefined ||
|
|
1176
|
+
params.IsCritical !== undefined ||
|
|
1177
|
+
params.DurationType !== undefined ||
|
|
1178
|
+
params.Completion !== undefined;
|
|
1179
|
+
const taskTimeId = hasTaskTime ? this.addIfcTaskTime(params) : 0;
|
|
1180
|
+
const taskId = this.id();
|
|
1181
|
+
const globalId = this.newGlobalId();
|
|
1182
|
+
const name = params.Name;
|
|
1183
|
+
const desc = optStr(params.Description);
|
|
1184
|
+
const objType = optStr(params.ObjectType);
|
|
1185
|
+
const ident = optStr(params.Identification);
|
|
1186
|
+
const longDesc = optStr(params.LongDescription);
|
|
1187
|
+
const status = optStr(params.Status);
|
|
1188
|
+
const workMethod = optStr(params.WorkMethod);
|
|
1189
|
+
const isMile = params.IsMilestone === true ? '.T.' : '.F.';
|
|
1190
|
+
const priority = params.Priority !== undefined ? String(params.Priority | 0) : '$';
|
|
1191
|
+
const taskTimeRef = taskTimeId > 0 ? `#${taskTimeId}` : '$';
|
|
1192
|
+
const predef = optEnum(params.PredefinedType);
|
|
1193
|
+
this.line(taskId, 'IFCTASK', `'${globalId}',#${this.ownerHistoryId},'${esc(name)}',${desc},${objType},${ident},${longDesc},${status},${workMethod},${isMile},${priority},${taskTimeRef},${predef}`);
|
|
1194
|
+
this.entities.push({ expressId: taskId, type: 'IfcTask', Name: name });
|
|
1195
|
+
return taskId;
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Build an IfcTaskTime from the task params (internal helper — prefer
|
|
1199
|
+
* setting the time fields on the task itself via `addIfcTask`).
|
|
1200
|
+
*/
|
|
1201
|
+
addIfcTaskTime(params) {
|
|
1202
|
+
const ttId = this.id();
|
|
1203
|
+
// [0] Name, [1] DataOrigin, [2] UserDefinedDataOrigin,
|
|
1204
|
+
// [3] DurationType, [4] ScheduleDuration, [5] ScheduleStart, [6] ScheduleFinish,
|
|
1205
|
+
// [7..10] Early/Late Start/Finish, [11] FreeFloat, [12] TotalFloat,
|
|
1206
|
+
// [13] IsCritical, [14] StatusTime,
|
|
1207
|
+
// [15] ActualDuration, [16] ActualStart, [17] ActualFinish,
|
|
1208
|
+
// [18] RemainingTime, [19] Completion
|
|
1209
|
+
const attrs = [
|
|
1210
|
+
'$', // Name
|
|
1211
|
+
'$', // DataOrigin
|
|
1212
|
+
'$', // UserDefinedDataOrigin
|
|
1213
|
+
optEnum(params.DurationType), // DurationType
|
|
1214
|
+
optStr(params.ScheduleDuration), // ScheduleDuration
|
|
1215
|
+
optStr(params.ScheduleStart), // ScheduleStart
|
|
1216
|
+
optStr(params.ScheduleFinish), // ScheduleFinish
|
|
1217
|
+
optStr(params.EarlyStart), // EarlyStart
|
|
1218
|
+
optStr(params.EarlyFinish), // EarlyFinish
|
|
1219
|
+
optStr(params.LateStart), // LateStart
|
|
1220
|
+
optStr(params.LateFinish), // LateFinish
|
|
1221
|
+
optStr(params.FreeFloat), // FreeFloat
|
|
1222
|
+
optStr(params.TotalFloat), // TotalFloat
|
|
1223
|
+
optBool(params.IsCritical), // IsCritical
|
|
1224
|
+
optStr(params.StatusTime), // StatusTime
|
|
1225
|
+
optStr(params.ActualDuration), // ActualDuration
|
|
1226
|
+
optStr(params.ActualStart), // ActualStart
|
|
1227
|
+
optStr(params.ActualFinish), // ActualFinish
|
|
1228
|
+
optStr(params.RemainingTime), // RemainingTime
|
|
1229
|
+
optReal(params.Completion), // Completion
|
|
1230
|
+
];
|
|
1231
|
+
this.line(ttId, 'IFCTASKTIME', attrs.join(','));
|
|
1232
|
+
return ttId;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Create an IfcRelSequence between two tasks. The predecessor is `RelatingProcess`
|
|
1236
|
+
* and the successor is `RelatedProcess`. SequenceType defaults to FINISH_START.
|
|
1237
|
+
*/
|
|
1238
|
+
addIfcRelSequence(predecessorTaskId, successorTaskId, params = {}) {
|
|
1239
|
+
const relId = this.id();
|
|
1240
|
+
const globalId = this.newGlobalId();
|
|
1241
|
+
const seqType = optEnum(params.SequenceType ?? 'FINISH_START');
|
|
1242
|
+
const userDef = optStr(params.UserDefinedSequenceType);
|
|
1243
|
+
let lagRef = '$';
|
|
1244
|
+
if (params.TimeLag !== undefined) {
|
|
1245
|
+
const lagId = this.id();
|
|
1246
|
+
// IfcLagTime = IfcSchedulingTime(Name, DataOrigin, UDDataOrigin) +
|
|
1247
|
+
// LagValue (IfcTimeOrRatioSelect) + DurationType
|
|
1248
|
+
const lagValue = `IFCDURATION('${esc(params.TimeLag)}')`;
|
|
1249
|
+
const durType = optEnum(params.LagDurationType ?? 'WORKTIME');
|
|
1250
|
+
this.line(lagId, 'IFCLAGTIME', `$,$,$,${lagValue},${durType}`);
|
|
1251
|
+
lagRef = `#${lagId}`;
|
|
1252
|
+
}
|
|
1253
|
+
this.line(relId, 'IFCRELSEQUENCE', `'${globalId}',#${this.ownerHistoryId},$,$,#${predecessorTaskId},#${successorTaskId},${lagRef},${seqType},${userDef}`);
|
|
1254
|
+
return relId;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Emit an IfcRelAssignsToControl — binds any IfcObjectDefinition (typically
|
|
1258
|
+
* IfcTasks or sub-schedules) to an IfcControl (IfcWorkSchedule / IfcWorkPlan).
|
|
1259
|
+
* Returns the relationship expressId.
|
|
1260
|
+
*/
|
|
1261
|
+
addIfcRelAssignsToControl(relatingControlId, relatedObjectIds) {
|
|
1262
|
+
if (relatedObjectIds.length === 0)
|
|
1263
|
+
throw new Error('addIfcRelAssignsToControl: relatedObjectIds is empty');
|
|
1264
|
+
const relId = this.id();
|
|
1265
|
+
const globalId = this.newGlobalId();
|
|
1266
|
+
const refs = relatedObjectIds.map(id => `#${id}`).join(',');
|
|
1267
|
+
this.line(relId, 'IFCRELASSIGNSTOCONTROL', `'${globalId}',#${this.ownerHistoryId},$,$,(${refs}),$,#${relatingControlId}`);
|
|
1268
|
+
return relId;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Ergonomic alias — assign tasks (or sub-schedules) to a work schedule.
|
|
1272
|
+
* Delegates to {@link addIfcRelAssignsToControl}.
|
|
1273
|
+
*/
|
|
1274
|
+
assignTasksToWorkSchedule(scheduleId, taskIds) {
|
|
1275
|
+
return this.addIfcRelAssignsToControl(scheduleId, taskIds);
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Ergonomic alias — attach sub-schedules to an IfcWorkPlan. Delegates to
|
|
1279
|
+
* {@link addIfcRelAssignsToControl}.
|
|
1280
|
+
*/
|
|
1281
|
+
assignSchedulesToWorkPlan(planId, scheduleIds) {
|
|
1282
|
+
return this.addIfcRelAssignsToControl(planId, scheduleIds);
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Emit an IfcRelAssignsToProcess — binds products (walls, slabs, ...) to an
|
|
1286
|
+
* IfcProcess (usually an IfcTask). These drive the Gantt 4D animation.
|
|
1287
|
+
* Returns the relationship expressId.
|
|
1288
|
+
*/
|
|
1289
|
+
addIfcRelAssignsToProcess(relatingProcessId, relatedObjectIds) {
|
|
1290
|
+
if (relatedObjectIds.length === 0)
|
|
1291
|
+
throw new Error('addIfcRelAssignsToProcess: relatedObjectIds is empty');
|
|
1292
|
+
const relId = this.id();
|
|
1293
|
+
const globalId = this.newGlobalId();
|
|
1294
|
+
const refs = relatedObjectIds.map(id => `#${id}`).join(',');
|
|
1295
|
+
this.line(relId, 'IFCRELASSIGNSTOPROCESS', `'${globalId}',#${this.ownerHistoryId},$,$,(${refs}),$,#${relatingProcessId},$`);
|
|
1296
|
+
return relId;
|
|
1297
|
+
}
|
|
1298
|
+
/** Ergonomic alias — delegates to {@link addIfcRelAssignsToProcess}. */
|
|
1299
|
+
assignProductsToTask(taskId, productIds) {
|
|
1300
|
+
return this.addIfcRelAssignsToProcess(taskId, productIds);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Emit an IfcRelNests — nests children under a parent object (used for WBS
|
|
1304
|
+
* task hierarchies here). Returns the relationship expressId.
|
|
1305
|
+
*/
|
|
1306
|
+
addIfcRelNests(relatingObjectId, relatedObjectIds) {
|
|
1307
|
+
if (relatedObjectIds.length === 0)
|
|
1308
|
+
throw new Error('addIfcRelNests: relatedObjectIds is empty');
|
|
1309
|
+
const relId = this.id();
|
|
1310
|
+
const globalId = this.newGlobalId();
|
|
1311
|
+
const refs = relatedObjectIds.map(id => `#${id}`).join(',');
|
|
1312
|
+
this.line(relId, 'IFCRELNESTS', `'${globalId}',#${this.ownerHistoryId},$,$,#${relatingObjectId},(${refs})`);
|
|
1313
|
+
return relId;
|
|
1314
|
+
}
|
|
1315
|
+
/** Ergonomic alias — delegates to {@link addIfcRelNests}. */
|
|
1316
|
+
nestTasks(parentTaskId, childTaskIds) {
|
|
1317
|
+
return this.addIfcRelNests(parentTaskId, childTaskIds);
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Internal — emit an IfcWorkSchedule or IfcWorkPlan (identical attribute
|
|
1321
|
+
* layout). Separate helpers are exposed publicly for ergonomics.
|
|
1322
|
+
*/
|
|
1323
|
+
buildWorkControl(entity, params) {
|
|
1324
|
+
const id = this.id();
|
|
1325
|
+
const globalId = this.newGlobalId();
|
|
1326
|
+
const name = params.Name;
|
|
1327
|
+
const desc = optStr(params.Description);
|
|
1328
|
+
const objType = '$';
|
|
1329
|
+
const ident = optStr(params.Identification);
|
|
1330
|
+
const creationDate = params.CreationDate ?? new Date().toISOString().slice(0, 19);
|
|
1331
|
+
const purpose = optStr(params.Purpose);
|
|
1332
|
+
const duration = optStr(params.Duration);
|
|
1333
|
+
const totalFloat = optStr(params.TotalFloat);
|
|
1334
|
+
const startTime = params.StartTime;
|
|
1335
|
+
const finishTime = optStr(params.FinishTime);
|
|
1336
|
+
const predef = optEnum(params.PredefinedType);
|
|
1337
|
+
// IFC4 IfcWorkSchedule / IfcWorkPlan (same SUPERTYPE layout via IfcWorkControl):
|
|
1338
|
+
// [0] GlobalId, [1] OwnerHistory, [2] Name, [3] Description, [4] ObjectType,
|
|
1339
|
+
// [5] Identification, [6] CreationDate, [7] Creators, [8] Purpose,
|
|
1340
|
+
// [9] Duration, [10] TotalFloat, [11] StartTime, [12] FinishTime, [13] PredefinedType
|
|
1341
|
+
this.line(id, entity, `'${globalId}',#${this.ownerHistoryId},'${esc(name)}',${desc},${objType},${ident},'${esc(creationDate)}',$,${purpose},${duration},${totalFloat},'${esc(startTime)}',${finishTime},${predef}`);
|
|
1342
|
+
const kind = entity === 'IFCWORKSCHEDULE' ? 'IfcWorkSchedule' : 'IfcWorkPlan';
|
|
1343
|
+
this.entities.push({ expressId: id, type: kind, Name: name });
|
|
1344
|
+
return id;
|
|
1345
|
+
}
|
|
1346
|
+
// ============================================================================
|
|
1166
1347
|
// Public API — Export
|
|
1167
1348
|
// ============================================================================
|
|
1168
1349
|
/** Generate the complete IFC STEP file. May only be called once. */
|