Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix(assembly): a carried-in sub-assembly no longer fades while it glides; a header stored before its steps lists once

aashu7f7c4ead9703
diff --git a/packages/viewer/src/AssemblyPlayer.tsx b/packages/viewer/src/AssemblyPlayer.tsx
index 4371048349..a7b93d9f93 100644
--- a/packages/viewer/src/AssemblyPlayer.tsx
+++ b/packages/viewer/src/AssemblyPlayer.tsx
@@ -1692,8 +1692,7 @@ function AssemblyScene({
// seated pose instead of popping: planner-flagged steps (no collision-free
// path exists) and any step whose display motion resolved to "none" (no
// stored motion and no collision-free fallback). Only the step's own parts
- // fade: a carried-in unit glides in, and its parts are never in the step's
- // componentNodeIds.
+ // fade: a carried-in unit glides in instead.
useEffect(() => {
const step = steps[activeStepIndex];
// Editing this step: keep its components solid at the seated pose, no fade.
@@ -1707,7 +1706,9 @@ function AssemblyScene({
const overrides = overridesRef.current;
const entries: { mesh: Mesh; fade: Material | Material[] }[] = [];
const materials: Material[] = [];
+ const gliding = new Set(carryIn?.nodeIds);
for (const nodeId of step.componentNodeIds) {
+ if (gliding.has(nodeId)) continue;
nodesById.get(nodeId)?.traverse((object) => {
if (!(object as Mesh).isMesh) return;
const mesh = object as Mesh;
@@ -1734,7 +1735,7 @@ function AssemblyScene({
fadeRef.current = null;
applyVisualsRef.current();
};
- }, [steps, activeStepIndex, nodesById, segments, editMotion]);
+ }, [steps, activeStepIndex, nodesById, segments, editMotion, carryIn]);
useFrame(() => {
const fade = fadeRef.current;
diff --git a/packages/viewer/src/subassembly.test.ts b/packages/viewer/src/subassembly.test.ts
index 79803766e8..c078a345c9 100644
--- a/packages/viewer/src/subassembly.test.ts
+++ b/packages/viewer/src/subassembly.test.ts
@@ -60,6 +60,19 @@ describe("displayOrder", () => {
]);
expect(rows.map((r) => r.stepId)).toEqual(["a", "empty", "b"]);
});
+
+ it("lists a header once when it is stored before its members", () => {
+ const rows = displayOrder([
+ step("unit", [], { isSubAssembly: true }),
+ step("a", ["a"], { parentStepId: "unit" }),
+ step("b", ["b"], { parentStepId: "unit" })
+ ]);
+ expect(rows).toEqual([
+ { stepId: "unit", depth: 0 },
+ { stepId: "a", depth: 1 },
+ { stepId: "b", depth: 1 }
+ ]);
+ });
});
describe("buildSubAssemblyPlan", () => {
diff --git a/packages/viewer/src/subassembly.ts b/packages/viewer/src/subassembly.ts
index 7312b16168..5251e210cb 100644
--- a/packages/viewer/src/subassembly.ts
+++ b/packages/viewer/src/subassembly.ts
@@ -129,8 +129,9 @@ export function displayOrder(
const byId = new Map(steps.map((step) => [step.id, step]));
for (const step of steps) {
if (emitted.has(step.id)) continue;
- const header = step.parentStepId ? byId.get(step.parentStepId) : undefined;
- if (header && isSubAssemblyHeader(header)) {
+ const parent = step.parentStepId ? byId.get(step.parentStepId) : undefined;
+ const header = isSubAssemblyHeader(step) ? step : parent;
+ if (header && isSubAssemblyHeader(header) && !emitted.has(header.id)) {
rows.push({ stepId: header.id, depth: 0 });
emitted.add(header.id);
for (const member of membersOf(steps, header.id)) {