@code3d/core 0.0.1-alpha.2 → 0.0.1-alpha.3
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/bld/chunks/{chunk-AWYI64EE.js → chunk-BF55AIEQ.js} +3 -3
- package/bld/chunks/{chunk-5E6VXJU2.js → chunk-P5VGKAEM.js} +2 -2
- package/bld/chunks/{chunk-F53RTQPT.js → chunk-RPY2WVCB.js} +59 -12
- package/bld/chunks/chunk-RPY2WVCB.js.map +7 -0
- package/bld/chunks/{chunk-63ZUQWQ2.js → chunk-U5G2VU2I.js} +2 -2
- package/bld/library/index.js +1 -1
- package/bld/library/kernel-cache.d.ts +7 -0
- package/bld/library/kernel-cache.d.ts.map +1 -1
- package/bld/library/replicad.js +2 -2
- package/bld/library/runtime.d.ts +3 -1
- package/bld/library/runtime.d.ts.map +1 -1
- package/bld/library/topology.d.ts.map +1 -1
- package/bld/node/index.js +3 -3
- package/bld/node/replicad.js +4 -4
- package/bld/tooling/index.js +2 -2
- package/package.json +1 -1
- package/src/library/kernel-cache.ts +22 -6
- package/src/library/loft.ts +4 -0
- package/src/library/runtime.ts +15 -2
- package/src/library/topology.ts +24 -0
- package/bld/chunks/chunk-F53RTQPT.js.map +0 -7
- /package/bld/chunks/{chunk-AWYI64EE.js.map → chunk-BF55AIEQ.js.map} +0 -0
- /package/bld/chunks/{chunk-5E6VXJU2.js.map → chunk-P5VGKAEM.js.map} +0 -0
- /package/bld/chunks/{chunk-63ZUQWQ2.js.map → chunk-U5G2VU2I.js.map} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
installOpenCascade
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-U5G2VU2I.js";
|
|
4
4
|
import {
|
|
5
5
|
__name,
|
|
6
6
|
installFontEngine,
|
|
7
7
|
installModelResourceReader,
|
|
8
8
|
installSketchSolver
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RPY2WVCB.js";
|
|
10
10
|
|
|
11
11
|
// packages/core/src/node/index.ts
|
|
12
12
|
import initOpenCascade from "@code3d/opencascade";
|
|
@@ -28,4 +28,4 @@ installSketchSolver(
|
|
|
28
28
|
), "locateFile")
|
|
29
29
|
})
|
|
30
30
|
);
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-BF55AIEQ.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__name,
|
|
3
3
|
castOwnedShape,
|
|
4
4
|
primitiveConstructor
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RPY2WVCB.js";
|
|
6
6
|
|
|
7
7
|
// packages/core/src/library/replicad.ts
|
|
8
8
|
import * as replicadModule from "replicad";
|
|
@@ -27,4 +27,4 @@ export {
|
|
|
27
27
|
replicad,
|
|
28
28
|
definePrimitive
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-P5VGKAEM.js.map
|
|
@@ -381,6 +381,7 @@ function createComputationCache({
|
|
|
381
381
|
let store;
|
|
382
382
|
let persistentHits = 0;
|
|
383
383
|
let persistentWrites = 0;
|
|
384
|
+
let persistenceEncodeMilliseconds = 0;
|
|
384
385
|
let persistenceErrors = 0;
|
|
385
386
|
const persisted = /* @__PURE__ */ new Set();
|
|
386
387
|
const pendingPersistence = /* @__PURE__ */ new Map();
|
|
@@ -507,10 +508,17 @@ function createComputationCache({
|
|
|
507
508
|
__name(acceptKernelOperation2, "acceptKernelOperation");
|
|
508
509
|
function persist(key, value, codec, defer = false) {
|
|
509
510
|
if (!store || persisted.has(key.id)) return;
|
|
510
|
-
const encode = /* @__PURE__ */ __name(() =>
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
511
|
+
const encode = /* @__PURE__ */ __name(() => {
|
|
512
|
+
const started = performance.now();
|
|
513
|
+
try {
|
|
514
|
+
return encodeKernelArtifact(
|
|
515
|
+
key.signature,
|
|
516
|
+
codec ? Uint8Array.from(codec.encoder(value)) : value
|
|
517
|
+
);
|
|
518
|
+
} finally {
|
|
519
|
+
persistenceEncodeMilliseconds += performance.now() - started;
|
|
520
|
+
}
|
|
521
|
+
}, "encode");
|
|
514
522
|
if (defer && currentEvaluation) {
|
|
515
523
|
pendingPersistence.set(key.id, encode);
|
|
516
524
|
return;
|
|
@@ -577,6 +585,7 @@ function createComputationCache({
|
|
|
577
585
|
estimatedJavaScriptBytes = 0;
|
|
578
586
|
persistentHits = 0;
|
|
579
587
|
persistentWrites = 0;
|
|
588
|
+
persistenceEncodeMilliseconds = 0;
|
|
580
589
|
persistenceErrors = 0;
|
|
581
590
|
persisted.clear();
|
|
582
591
|
pendingPersistence.clear();
|
|
@@ -592,14 +601,16 @@ function createComputationCache({
|
|
|
592
601
|
nativeAllocatedBytes: nativeAllocatedBytes(),
|
|
593
602
|
maximumBytes,
|
|
594
603
|
externalBytes,
|
|
604
|
+
pendingPersistenceBytes: store?.pendingWriteBytes ?? 0,
|
|
595
605
|
persistentHits,
|
|
596
606
|
persistentWrites,
|
|
607
|
+
persistenceEncodeMilliseconds,
|
|
597
608
|
persistenceErrors
|
|
598
609
|
};
|
|
599
610
|
}
|
|
600
611
|
__name(kernelOperationCacheStats2, "kernelOperationCacheStats");
|
|
601
612
|
function evictHistoricalEntries() {
|
|
602
|
-
while (historicalEntries.size && nativeAllocatedBytes() + estimatedJavaScriptBytes + externalBytes > maximumBytes) {
|
|
613
|
+
while (historicalEntries.size && nativeAllocatedBytes() + estimatedJavaScriptBytes + externalBytes + (store?.pendingWriteBytes ?? 0) > maximumBytes) {
|
|
603
614
|
const [id, entry] = historicalEntries.entries().next().value;
|
|
604
615
|
historicalEntries.delete(id);
|
|
605
616
|
entries.delete(id);
|
|
@@ -3275,7 +3286,31 @@ function booleanWithTopology(left, right, operation) {
|
|
|
3275
3286
|
let result;
|
|
3276
3287
|
try {
|
|
3277
3288
|
builder.Build();
|
|
3289
|
+
if (!builder.IsDone())
|
|
3290
|
+
throw new Error(
|
|
3291
|
+
`Could not complete the ${operation === "fuse" ? "union" : operation} operation.`
|
|
3292
|
+
);
|
|
3278
3293
|
builder.SimplifyResult(true, true, 1e-3);
|
|
3294
|
+
if (operation === "intersect") {
|
|
3295
|
+
const shape = builder.Shape();
|
|
3296
|
+
try {
|
|
3297
|
+
const solids = new oc.TopExp_Explorer(
|
|
3298
|
+
shape,
|
|
3299
|
+
oc.TopAbs_ShapeEnum.TopAbs_SOLID,
|
|
3300
|
+
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
3301
|
+
);
|
|
3302
|
+
try {
|
|
3303
|
+
if (!solids.More())
|
|
3304
|
+
throw new Error(
|
|
3305
|
+
"The inputs have no common solid volume. Adjust their positions or dimensions so they overlap."
|
|
3306
|
+
);
|
|
3307
|
+
} finally {
|
|
3308
|
+
solids.delete();
|
|
3309
|
+
}
|
|
3310
|
+
} finally {
|
|
3311
|
+
shape.delete();
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3279
3314
|
result = castOwnedShape3D(builder.Shape());
|
|
3280
3315
|
return {
|
|
3281
3316
|
shape: result,
|
|
@@ -3779,6 +3814,10 @@ function loftContoursWithTopology(sections, spine, ruled, holes) {
|
|
|
3779
3814
|
builder.SetMutableInput(false);
|
|
3780
3815
|
for (const wire of wires) builder.AddWire(wire.wrapped);
|
|
3781
3816
|
builder.Build();
|
|
3817
|
+
if (!builder.IsDone())
|
|
3818
|
+
throw new Error(
|
|
3819
|
+
"Could not construct a solid loft through these sections. Adjust their positions, orientations, or profiles."
|
|
3820
|
+
);
|
|
3782
3821
|
}
|
|
3783
3822
|
result = castOwnedShape3D(builder.Shape());
|
|
3784
3823
|
caps[0] = castOwnedShape(builder.FirstShape());
|
|
@@ -21103,13 +21142,14 @@ var SketchFrame = class _SketchFrame extends RelationObject {
|
|
|
21103
21142
|
...this.constraints.flatMap(constraintReferences)
|
|
21104
21143
|
];
|
|
21105
21144
|
}
|
|
21106
|
-
attachOperationTrace(siteId, execution, order, sourceRef) {
|
|
21145
|
+
attachOperationTrace(siteId, execution, order, sourceRef, outputIndex = 0) {
|
|
21107
21146
|
if (!operationTraces.has(this.operation))
|
|
21108
21147
|
operationTraces.set(this.operation, {
|
|
21109
21148
|
siteId,
|
|
21110
21149
|
execution,
|
|
21111
21150
|
order,
|
|
21112
|
-
sourceRef
|
|
21151
|
+
sourceRef,
|
|
21152
|
+
outputIndex
|
|
21113
21153
|
});
|
|
21114
21154
|
}
|
|
21115
21155
|
toSnapshot() {
|
|
@@ -21732,11 +21772,17 @@ var ModelObject = class _ModelObject extends RelationObject {
|
|
|
21732
21772
|
);
|
|
21733
21773
|
}
|
|
21734
21774
|
/** @internal */
|
|
21735
|
-
attachOperationTrace(siteId, execution, order, sourceRef) {
|
|
21775
|
+
attachOperationTrace(siteId, execution, order, sourceRef, outputIndex = 0) {
|
|
21736
21776
|
if (operationTraces.has(this.operation)) {
|
|
21737
21777
|
return;
|
|
21738
21778
|
}
|
|
21739
|
-
operationTraces.set(this.operation, {
|
|
21779
|
+
operationTraces.set(this.operation, {
|
|
21780
|
+
siteId,
|
|
21781
|
+
execution,
|
|
21782
|
+
order,
|
|
21783
|
+
sourceRef,
|
|
21784
|
+
outputIndex
|
|
21785
|
+
});
|
|
21740
21786
|
}
|
|
21741
21787
|
/** @internal */
|
|
21742
21788
|
relatedObjects() {
|
|
@@ -22781,7 +22827,8 @@ function instrumentModelOperation(object, instrumentation) {
|
|
|
22781
22827
|
instrumentation.siteId,
|
|
22782
22828
|
instrumentation.execution,
|
|
22783
22829
|
instrumentation.order,
|
|
22784
|
-
instrumentation.sourceRef
|
|
22830
|
+
instrumentation.sourceRef,
|
|
22831
|
+
instrumentation.outputIndex
|
|
22785
22832
|
);
|
|
22786
22833
|
}
|
|
22787
22834
|
__name(instrumentModelOperation, "instrumentModelOperation");
|
|
@@ -23031,7 +23078,7 @@ function storedOperation(kind, inputs = [], options = {}) {
|
|
|
23031
23078
|
__name(storedOperation, "storedOperation");
|
|
23032
23079
|
function storedOperationId(operation) {
|
|
23033
23080
|
const trace = operationTraces.get(operation);
|
|
23034
|
-
return trace ? `${trace.siteId}:execution:${trace.execution}` : operation.runtimeId;
|
|
23081
|
+
return trace ? `${trace.siteId}:execution:${trace.execution}:output:${trace.outputIndex ?? 0}` : operation.runtimeId;
|
|
23035
23082
|
}
|
|
23036
23083
|
__name(storedOperationId, "storedOperationId");
|
|
23037
23084
|
var shapeLifecycle = {
|
|
@@ -24784,4 +24831,4 @@ export {
|
|
|
24784
24831
|
assertSketchDragConnections,
|
|
24785
24832
|
solveSketchSnapshot
|
|
24786
24833
|
};
|
|
24787
|
-
//# sourceMappingURL=chunk-
|
|
24834
|
+
//# sourceMappingURL=chunk-RPY2WVCB.js.map
|