@code3d/core 0.0.1-alpha.2 → 0.0.1-alpha.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/bld/chunks/{chunk-F53RTQPT.js → chunk-J77FMYFY.js} +67 -12
- package/bld/chunks/chunk-J77FMYFY.js.map +7 -0
- package/bld/chunks/{chunk-63ZUQWQ2.js → chunk-OQLJDJIF.js} +2 -2
- package/bld/chunks/{chunk-5E6VXJU2.js → chunk-PAIFBNU4.js} +2 -2
- package/bld/chunks/{chunk-AWYI64EE.js → chunk-ZMT6EFHL.js} +3 -3
- 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 +5 -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 +27 -2
- package/src/library/topology.ts +24 -0
- package/bld/chunks/chunk-F53RTQPT.js.map +0 -7
- /package/bld/chunks/{chunk-63ZUQWQ2.js.map → chunk-OQLJDJIF.js.map} +0 -0
- /package/bld/chunks/{chunk-5E6VXJU2.js.map → chunk-PAIFBNU4.js.map} +0 -0
- /package/bld/chunks/{chunk-AWYI64EE.js.map → chunk-ZMT6EFHL.js.map} +0 -0
|
@@ -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());
|
|
@@ -20938,6 +20977,12 @@ var RelationObject = class _RelationObject {
|
|
|
20938
20977
|
};
|
|
20939
20978
|
}
|
|
20940
20979
|
constraintSnapshot(constraint, context) {
|
|
20980
|
+
const lastRotation = constraint.rotations.at(-1);
|
|
20981
|
+
const rotationSpatial = lastRotation ? this.constraintSpatial(
|
|
20982
|
+
constraint,
|
|
20983
|
+
{ kind: "rotate", pivot: lastRotation.pivot },
|
|
20984
|
+
context
|
|
20985
|
+
).spatial : void 0;
|
|
20941
20986
|
const source = constraint.source.model ?? this;
|
|
20942
20987
|
const target = constraint.target.model ?? this;
|
|
20943
20988
|
const models = [...context.poses.keys()];
|
|
@@ -20987,6 +21032,7 @@ var RelationObject = class _RelationObject {
|
|
|
20987
21032
|
offsetDirection: 1,
|
|
20988
21033
|
offset: constraint.offset ?? origin,
|
|
20989
21034
|
offsetFrame: toTransform(offsetFrame),
|
|
21035
|
+
rotation: rotationSpatial,
|
|
20990
21036
|
sourceRefs: [...valueTrace(constraint).sourceRefs],
|
|
20991
21037
|
parameters: [...valueTrace(constraint).parameters]
|
|
20992
21038
|
};
|
|
@@ -21068,6 +21114,7 @@ var RelationObject = class _RelationObject {
|
|
|
21068
21114
|
offsetDirection: source === this ? 1 : -1,
|
|
21069
21115
|
offset: constraint.offset ?? origin,
|
|
21070
21116
|
offsetFrame: toTransform(offsetFrame),
|
|
21117
|
+
rotation: rotationSpatial,
|
|
21071
21118
|
sourceRefs: [...valueTrace(constraint).sourceRefs],
|
|
21072
21119
|
parameters: [...valueTrace(constraint).parameters]
|
|
21073
21120
|
};
|
|
@@ -21103,13 +21150,14 @@ var SketchFrame = class _SketchFrame extends RelationObject {
|
|
|
21103
21150
|
...this.constraints.flatMap(constraintReferences)
|
|
21104
21151
|
];
|
|
21105
21152
|
}
|
|
21106
|
-
attachOperationTrace(siteId, execution, order, sourceRef) {
|
|
21153
|
+
attachOperationTrace(siteId, execution, order, sourceRef, outputIndex = 0) {
|
|
21107
21154
|
if (!operationTraces.has(this.operation))
|
|
21108
21155
|
operationTraces.set(this.operation, {
|
|
21109
21156
|
siteId,
|
|
21110
21157
|
execution,
|
|
21111
21158
|
order,
|
|
21112
|
-
sourceRef
|
|
21159
|
+
sourceRef,
|
|
21160
|
+
outputIndex
|
|
21113
21161
|
});
|
|
21114
21162
|
}
|
|
21115
21163
|
toSnapshot() {
|
|
@@ -21732,11 +21780,17 @@ var ModelObject = class _ModelObject extends RelationObject {
|
|
|
21732
21780
|
);
|
|
21733
21781
|
}
|
|
21734
21782
|
/** @internal */
|
|
21735
|
-
attachOperationTrace(siteId, execution, order, sourceRef) {
|
|
21783
|
+
attachOperationTrace(siteId, execution, order, sourceRef, outputIndex = 0) {
|
|
21736
21784
|
if (operationTraces.has(this.operation)) {
|
|
21737
21785
|
return;
|
|
21738
21786
|
}
|
|
21739
|
-
operationTraces.set(this.operation, {
|
|
21787
|
+
operationTraces.set(this.operation, {
|
|
21788
|
+
siteId,
|
|
21789
|
+
execution,
|
|
21790
|
+
order,
|
|
21791
|
+
sourceRef,
|
|
21792
|
+
outputIndex
|
|
21793
|
+
});
|
|
21740
21794
|
}
|
|
21741
21795
|
/** @internal */
|
|
21742
21796
|
relatedObjects() {
|
|
@@ -22781,7 +22835,8 @@ function instrumentModelOperation(object, instrumentation) {
|
|
|
22781
22835
|
instrumentation.siteId,
|
|
22782
22836
|
instrumentation.execution,
|
|
22783
22837
|
instrumentation.order,
|
|
22784
|
-
instrumentation.sourceRef
|
|
22838
|
+
instrumentation.sourceRef,
|
|
22839
|
+
instrumentation.outputIndex
|
|
22785
22840
|
);
|
|
22786
22841
|
}
|
|
22787
22842
|
__name(instrumentModelOperation, "instrumentModelOperation");
|
|
@@ -23031,7 +23086,7 @@ function storedOperation(kind, inputs = [], options = {}) {
|
|
|
23031
23086
|
__name(storedOperation, "storedOperation");
|
|
23032
23087
|
function storedOperationId(operation) {
|
|
23033
23088
|
const trace = operationTraces.get(operation);
|
|
23034
|
-
return trace ? `${trace.siteId}:execution:${trace.execution}` : operation.runtimeId;
|
|
23089
|
+
return trace ? `${trace.siteId}:execution:${trace.execution}:output:${trace.outputIndex ?? 0}` : operation.runtimeId;
|
|
23035
23090
|
}
|
|
23036
23091
|
__name(storedOperationId, "storedOperationId");
|
|
23037
23092
|
var shapeLifecycle = {
|
|
@@ -24784,4 +24839,4 @@ export {
|
|
|
24784
24839
|
assertSketchDragConnections,
|
|
24785
24840
|
solveSketchSnapshot
|
|
24786
24841
|
};
|
|
24787
|
-
//# sourceMappingURL=chunk-
|
|
24842
|
+
//# sourceMappingURL=chunk-J77FMYFY.js.map
|