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 hand-drawn step path shows as Custom path with Reset, which restores the planner's path

aashu234b1bf7910b
diff --git a/apps/erp/app/modules/production/AGENTS.md b/apps/erp/app/modules/production/AGENTS.md
index 9e4c3dfb88..dd4d97cffe 100644
--- a/apps/erp/app/modules/production/AGENTS.md
+++ b/apps/erp/app/modules/production/AGENTS.md
@@ -72,7 +72,7 @@ pnpm --filter @carbon/erp test
| `productionQuantity` | Output: type (Production/Scrap/Rework), quantity, scrapReason |
| `jobOperationBatch` | Operation batch header (`BAT` sequence): process, work center, location, status (`Planned` = pre-floor, `Active` displayed "Released"). Members are `jobOperation` rows via nullable `jobOperationBatchId`. A Released batch's coalesced schedule slot is a `capacityReservation` row tagged `jobOperationBatchId` (spared by per-job regen deletes; visible in every snapshot regardless of the anchor job's status; deleted by a `jobOperationBatch` status trigger when the batch completes or is unreleased — the sparing rules make that trigger the only retirement path; dissolve self-heals via the FK's column-list SET NULL + the anchor job's next regen) |
| `procedure` / `procedureStep` / `procedureParameter` | Versioned work instructions |
-| `assemblyInstruction` / `assemblyInstructionStep` | 3D model-based assembly instructions (Draft/Published/Archived); steps carry `componentNodeIds` + `motion`/`camera` JSON for the viewer, `hiddenComponentNodeIds` (parts hidden on THAT step only — tooling/fixtures/installed parts in the way; never the step's own `componentNodeIds`, stripped by a DB trigger on every write; applied by the shared player in the ERP editor and MES playback, authored only in the ERP), a `buildWave` INTEGER (the step's longest-path level in the planner's precedence DAG — steps sharing a wave have no ordering constraint and can be built in parallel by different people/stations; NULL for cycle-affected or hand-authored steps; informational, `sortOrder` still governs playback), and `warnings.needsSupport` (a part in the step tips once placed — center of mass outside the support polygon of the parts below it — likely needs a fixture or a second hand; shown as a hand icon with a tooltip in the step list) AND the typed-step fields mirrored from `jobOperationStep` (`type` `procedureStepType`, tiptap `description` with derived `instructionText`, `required`, UoM/min/max, `listValues`) for eventual copy into job operations. `motion`/`camera` are authored directly in the 3D viewer (drag the red waypoint path → relative `linear`/`L` motion, or `waypoints` once a waypoint is turned with the rotation rings; "Set view" captures the camera pose; a sub-assembly header's `motion` is the finished unit's own joining path, edited from the using step's Playback box — or the header's own panel when nothing uses it — and saved through the same motion route with the header id), autosaved via `updateAssemblyStepMotion` / the `steps/motion/$stepId` route — separate from the step form's `upsertAssemblyInstructionStep` (which rewrites `title`/typed fields). There is no numeric motion editor. **Step camera is a discriminated union**: a manual `{position,target,fov}` pose (applied verbatim), OR a planner hint `{source:"plan",direction}` — a mesh-precise view DIRECTION the Rust planner bakes per step (`crates/planner/src/view.rs` `best_view_direction`: sight lines against the real triangles of everything installed earlier, so it sees a hollow enclosure's open top where the viewer's AABB scoring can't). The viewer applies the hint with LIVE framing — target, standing distance, frustum fit at the real viewport aspect (`fitFraming`, `@carbon/viewer`). `null` = fully live AABB framing (fallback for hand-edited steps / old plans). Generated steps carry the plan hint (the TS-side camera bake was removed); re-motion refreshes it but never clobbers a manual pose. Playback visibility is presence-based (`@carbon/viewer` `visualForComponent`): a component exists on the canvas only once its step has run; components no step installs render like future-step ones (hidden during playback, future-components toggle while paused). Visibility has TWO independent axes — `futureMode` (not built yet) and `installedMode` (already built — `solid` default, so the historical rendering is unchanged; `ghost`/`hidden` let an operator see past an assembly that buries the active step's parts) — but the toolbar does NOT expose them as axes. It offers three NAMED views (`ASSEMBLY_VIEWS` / `VIEW_MODES` in `visibility.ts`): **Build** (installed solid — the historical default), **Focus** (installed ghosted, so you see past what is already fitted but keep its shape) and **Full** (everything solid). An "Isolate" view (installed hidden) was dropped: per-step `hiddenComponentNodeIds` cover removing the clutter an author chooses. The future side is hidden in all but Full: a step you are working is never helped by parts that are not on the bench yet. The same control renders in ERP and MES; nine combinations behind two icon triplets was the design that got rejected for being unreadable on a shop floor. The camera's AABB view-direction scoring honours both via `occluderWeight` — geometry the operator cannot see is never treated as an obstacle, or hiding it would clear the pixels while the framing still dodged it. AABB fallback motions for `"none"`-motion steps consider only PRIOR-step components as obstacles and fade in when no collision-free path exists or when the component interpenetrates a present component (mated parts — sliders on rails, fasteners in bores — never get fabricated paths; the planner is the only authority for those) |
+| `assemblyInstruction` / `assemblyInstructionStep` | 3D model-based assembly instructions (Draft/Published/Archived); steps carry `componentNodeIds` + `motion`/`camera` JSON for the viewer, `hiddenComponentNodeIds` (parts hidden on THAT step only — tooling/fixtures/installed parts in the way; never the step's own `componentNodeIds`, stripped by a DB trigger on every write; applied by the shared player in the ERP editor and MES playback, authored only in the ERP), a `buildWave` INTEGER (the step's longest-path level in the planner's precedence DAG — steps sharing a wave have no ordering constraint and can be built in parallel by different people/stations; NULL for cycle-affected or hand-authored steps; informational, `sortOrder` still governs playback), and `warnings.needsSupport` (a part in the step tips once placed — center of mass outside the support polygon of the parts below it — likely needs a fixture or a second hand; shown as a hand icon with a tooltip in the step list), and `warnings.plannedMotion` (the motion the step had before the author first drew a path in the editor — its presence marks the path as hand-drawn ("Custom path"), overrides `flagged`, and is what Reset restores; `updateAssemblyStepMotion` writes it on the first edit, a re-plan clears it by rewriting `warnings`) AND the typed-step fields mirrored from `jobOperationStep` (`type` `procedureStepType`, tiptap `description` with derived `instructionText`, `required`, UoM/min/max, `listValues`) for eventual copy into job operations. `motion`/`camera` are authored directly in the 3D viewer (drag the red waypoint path → relative `linear`/`L` motion, or `waypoints` once a waypoint is turned with the rotation rings; "Set view" captures the camera pose; a sub-assembly header's `motion` is the finished unit's own joining path, edited from the using step's Playback box — or the header's own panel when nothing uses it — and saved through the same motion route with the header id), autosaved via `updateAssemblyStepMotion` / the `steps/motion/$stepId` route — separate from the step form's `upsertAssemblyInstructionStep` (which rewrites `title`/typed fields). There is no numeric motion editor. **Step camera is a discriminated union**: a manual `{position,target,fov}` pose (applied verbatim), OR a planner hint `{source:"plan",direction}` — a mesh-precise view DIRECTION the Rust planner bakes per step (`crates/planner/src/view.rs` `best_view_direction`: sight lines against the real triangles of everything installed earlier, so it sees a hollow enclosure's open top where the viewer's AABB scoring can't). The viewer applies the hint with LIVE framing — target, standing distance, frustum fit at the real viewport aspect (`fitFraming`, `@carbon/viewer`). `null` = fully live AABB framing (fallback for hand-edited steps / old plans). Generated steps carry the plan hint (the TS-side camera bake was removed); re-motion refreshes it but never clobbers a manual pose. Playback visibility is presence-based (`@carbon/viewer` `visualForComponent`): a component exists on the canvas only once its step has run; components no step installs render like future-step ones (hidden during playback, future-components toggle while paused). Visibility has TWO independent axes — `futureMode` (not built yet) and `installedMode` (already built — `solid` default, so the historical rendering is unchanged; `ghost`/`hidden` let an operator see past an assembly that buries the active step's parts) — but the toolbar does NOT expose them as axes. It offers three NAMED views (`ASSEMBLY_VIEWS` / `VIEW_MODES` in `visibility.ts`): **Build** (installed solid — the historical default), **Focus** (installed ghosted, so you see past what is already fitted but keep its shape) and **Full** (everything solid). An "Isolate" view (installed hidden) was dropped: per-step `hiddenComponentNodeIds` cover removing the clutter an author chooses. The future side is hidden in all but Full: a step you are working is never helped by parts that are not on the bench yet. The same control renders in ERP and MES; nine combinations behind two icon triplets was the design that got rejected for being unreadable on a shop floor. The camera's AABB view-direction scoring honours both via `occluderWeight` — geometry the operator cannot see is never treated as an obstacle, or hiding it would clear the pixels while the framing still dodged it. AABB fallback motions for `"none"`-motion steps consider only PRIOR-step components as obstacles and fade in when no collision-free path exists or when the component interpenetrates a present component (mated parts — sliders on rails, fasteners in bores — never get fabricated paths; the planner is the only authority for those) |
| `assemblyInstructionStepMaterial` | BOM parts consumed at a step (`stepId` → `itemId` + optional quantity; stored by itemId so links survive make-method re-versioning; picker limited to the item's make-method BOM; UNIQUE `(stepId, itemId)`). Auto-populated from `assemblyComponentMapping` via `syncAssemblyStepMaterialsFromMappings` — additive only (manual quantities/deletions survive), triggered on step generation, component add, mapping create, and "Match BOM" |
| `assemblyInstructionStepSlide` | Per-step reference slides (image XOR 3D model via `modelUploadId`, caption, `size`, `annotations` JSONB pins), mirroring `methodOperationStepSlide`; authored in the step editor's Details tab and copied to `jobOperationStepSlide` by the BOP sync / get-method. The former `assemblyInstructionStepRequirement` / `assemblyStandardNote` tables (fixtures/consumables/notes/media) were dropped — a step definition is parts + tools + slides |
| `assemblyInstructionStepTool` | Tools used at a step (`stepId` → `itemId` of a tool-type item + `quantity`, UNIQUE `(stepId, itemId)`) — `itemId` is the same target `jobOperationTool.toolId` references, so the BOP sync maps rows 1:1 |
diff --git a/apps/erp/app/modules/production/production.models.ts b/apps/erp/app/modules/production/production.models.ts
index 8d2c614648..3864c8701d 100644
--- a/apps/erp/app/modules/production/production.models.ts
+++ b/apps/erp/app/modules/production/production.models.ts
@@ -1407,9 +1407,33 @@ export const stepPlanWarningsSchema = z.object({
* the support polygon of the parts below it) — likely needs a fixture or a
* second hand. Diagnostic only; never blocks generation or playback.
*/
- needsSupport: z.boolean().optional()
+ needsSupport: z.boolean().optional(),
+ /**
+ * The motion the step had before the author first drew a path (the
+ * planner's, or `none`). Present = the path is hand-drawn, which also
+ * overrides `flagged`; Reset puts it back. A re-plan rewrites `warnings`,
+ * so it clears this together with the drawn path it replaces.
+ */
+ plannedMotion: z.unknown().optional()
});
+/**
+ * The step's motion was drawn by hand in the path editor (see `plannedMotion`).
+ * The planner stores `none` on a flagged step, so a flagged step that moves was
+ * drawn too — paths drawn before `plannedMotion` existed carry no marker.
+ */
+export function hasCustomMotion(warnings: unknown, motion: unknown): boolean {
+ const parsed = stepPlanWarningsSchema.safeParse(warnings).data;
+ if (parsed?.plannedMotion !== undefined) return true;
+ return (
+ parsed?.flagged === true &&
+ typeof motion === "object" &&
+ motion !== null &&
+ "type" in motion &&
+ motion.type !== "none"
+ );
+}
+
const jsonField = <T extends z.ZodTypeAny>(schema: T) =>
z.preprocess((raw) => {
if (typeof raw !== "string") return raw;
@@ -1582,6 +1606,8 @@ export const assemblyInstructionStepNewValidator = assemblyInstructionStepFields
*/
export const assemblyInstructionStepMotionValidator = z.object({
motion: jsonField(motionSchema.optional()),
+ // Put back the motion the step had before the author first drew a path.
+ reset: zfd.checkbox(),
camera: jsonField(cameraSchema.nullable().optional())
});
diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.ts
index 469f2f6618..5c08fe7e04 100644
--- a/apps/erp/app/modules/production/production.service.ts
+++ b/apps/erp/app/modules/production/production.service.ts
@@ -100,6 +100,7 @@ import {
cameraSchema,
fastenerSchema,
getAssemblyModelState,
+ hasCustomMotion,
isJobLocked,
isJobOrderStatusHidden,
JOB_LOCKED_STATUSES,
@@ -7881,13 +7882,51 @@ export async function updateAssemblyStepMotion(
id: string;
motion?: z.infer<typeof motionSchema>;
camera?: z.infer<typeof cameraSchema> | null;
+ /** Put back the motion the step had before its path was first drawn. */
+ reset?: boolean;
updatedBy: string;
}
) {
+ let motionPatch: { motion?: Json; warnings?: Json | null } = {};
+ if (data.reset || data.motion !== undefined) {
+ const current = await client
+ .from("assemblyInstructionStep")
+ .select("motion, warnings")
+ .eq("id", data.id)
+ .single();
+ if (current.error) return { data: null, error: current.error };
+ // The first hand-drawn edit keeps the planner's motion in
+ // `warnings.plannedMotion`; Reset restores it and drops the marker.
+ const warnings =
+ current.data.warnings &&
+ typeof current.data.warnings === "object" &&
+ !Array.isArray(current.data.warnings)
+ ? (current.data.warnings as Record<string, Json | undefined>)
+ : {};
+ const { plannedMotion, ...rest } = warnings;
+ if (data.reset) {
+ motionPatch = {
+ motion: plannedMotion ?? { type: "none" },
+ warnings: Object.keys(rest).length > 0 ? (rest as Json) : null
+ };
+ } else {
+ motionPatch = {
+ motion: data.motion as Json,
+ ...(plannedMotion === undefined
+ ? {
+ warnings: {
+ ...rest,
+ plannedMotion: current.data.motion
+ } as Json
+ }
+ : {})
+ };
+ }
+ }
return client
.from("assemblyInstructionStep")
.update({
- ...(data.motion !== undefined ? { motion: data.motion as Json } : {}),
+ ...motionPatch,
...(data.camera !== undefined
? { camera: data.camera as Json | null }
: {}),
@@ -10462,8 +10501,11 @@ export function toViewerStep(step: AssemblyInstructionStepRow): AssemblyStep {
camera: camera.success ? camera.data : null,
fastener: fastener.success ? fastener.data : null,
durationSeconds: step.durationSeconds,
+ // A hand-drawn path overrides the planner's "no clear path" flag.
flagged:
- planWarnings.success && planWarnings.data.flagged === true
+ planWarnings.success &&
+ planWarnings.data.flagged === true &&
+ !hasCustomMotion(step.warnings, step.motion)
? true
: undefined
};
diff --git a/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx b/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx
index 263ced9247..e286489211 100644
--- a/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionProperties.tsx
@@ -69,6 +69,7 @@ import { path } from "~/utils/path";
import {
assemblyInstructionStepValidator,
fastenerSchema,
+ hasCustomMotion,
stepPlanWarningsSchema
} from "../../production.models";
import type { FlattenedBomMaterial } from "../../production.service";
@@ -116,8 +117,8 @@ type AssemblyInstructionPropertiesProps = {
/** Opens the editor on a step's motion, or on a sub-assembly it carries in */
onEditMotion: (stepId: string, unitHeaderId?: string) => void;
onStopEditMotion: () => void;
- /** Clears a sub-assembly's path back to the automatic glide */
- onResetUnitMotion: (headerId: string) => void;
+ /** Puts back the motion a step or sub-assembly had before its path was drawn */
+ onResetMotion: (stepId: string) => void;
onSetCamera: (stepId: string) => void;
onClearCamera: (stepId: string) => void;
/** Every step of the instruction, in play order — numbering and sub-assemblies */
@@ -147,7 +148,7 @@ const AssemblyInstructionProperties = ({
editingUnitId,
onEditMotion,
onStopEditMotion,
- onResetUnitMotion,
+ onResetMotion,
onSetCamera,
onClearCamera,
viewerSteps,
@@ -198,7 +199,7 @@ const AssemblyInstructionProperties = ({
describeStep(toStepDescriptor(step), graphIndex, units))) ||
t`Untitled step`;
const planFlag = useMemo(
- () => (step ? getPlanFlag(step.warnings, graphIndex) : null),
+ () => (step ? getPlanFlag(step, graphIndex) : null),
[step, graphIndex]
);
@@ -285,7 +286,7 @@ const AssemblyInstructionProperties = ({
editingUnitId={editingUnitId}
onEditMotion={onEditMotion}
onStopEditMotion={onStopEditMotion}
- onResetUnitMotion={onResetUnitMotion}
+ onResetMotion={onResetMotion}
/>
) : step ? (
<Tabs defaultValue="details" className="w-full px-4 pb-2 pt-3">
@@ -326,7 +327,7 @@ const AssemblyInstructionProperties = ({
editingUnitId={editingUnitId}
onEditMotion={onEditMotion}
onStopEditMotion={onStopEditMotion}
- onResetUnitMotion={onResetUnitMotion}
+ onResetMotion={onResetMotion}
onSetCamera={onSetCamera}
onClearCamera={onClearCamera}
viewerSteps={viewerSteps}
@@ -388,11 +389,18 @@ const AssemblyInstructionProperties = ({
* fades them in at the seated pose; a manual motion overrides the flag.
*/
function getPlanFlag(
- warnings: unknown,
+ step: Pick<AssemblyInstructionStepRow, "warnings" | "motion">,
graphIndex: AssemblyGraphIndex | null
): { blockers: string[] } | null {
- const parsed = stepPlanWarningsSchema.safeParse(warnings);
- if (!parsed.success || parsed.data.flagged !== true) return null;
+ const parsed = stepPlanWarningsSchema.safeParse(step.warnings);
+ // A hand-drawn path overrides the planner's flag.
+ if (
+ !parsed.success ||
+ parsed.data.flagged !== true ||
+ hasCustomMotion(step.warnings, step.motion)
+ ) {
+ return null;
+ }
const blockers = (parsed.data.blockedBy ?? [])
.map((nodeId) => graphIndex?.nodesById.get(nodeId)?.name)
.filter((name): name is string => Boolean(name));
@@ -451,7 +459,7 @@ function StepForm({
editingUnitId,
onEditMotion,
onStopEditMotion,
- onResetUnitMotion,
+ onResetMotion,
onSetCamera,
onClearCamera,
viewerSteps,
@@ -477,7 +485,7 @@ function StepForm({
editingUnitId: string | null;
onEditMotion: (stepId: string, unitHeaderId?: string) => void;
onStopEditMotion: () => void;
- onResetUnitMotion: (headerId: string) => void;
+ onResetMotion: (stepId: string) => void;
onSetCamera: (stepId: string) => void;
onClearCamera: (stepId: string) => void;
viewerSteps: AssemblyStep[];
@@ -537,9 +545,10 @@ function StepForm({
}, [componentNodeIds, step.fastener, graphIndex, units]);
const planFlag = useMemo(
- () => getPlanFlag(step.warnings, graphIndex),
- [step.warnings, graphIndex]
+ () => getPlanFlag(step, graphIndex),
+ [step, graphIndex]
);
+ const customMotion = hasCustomMotion(step.warnings, step.motion);
const carriedIn = useMemo(
() =>
@@ -681,13 +690,15 @@ function StepForm({
</LabelWithHelp>
}
value={
- planFlag ? (
+ isEditingMotion ? (
+ <Trans>Drag the red waypoints in the viewer</Trans>
+ ) : customMotion ? (
+ <Trans>Custom path</Trans>
+ ) : planFlag ? (
<span className="inline-flex items-center gap-1">
<LuTriangleAlert className="size-3.5 shrink-0 text-amber-500" />
<Trans>No clear path</Trans>
</span>
- ) : isEditingMotion ? (
- <Trans>Drag the red waypoints in the viewer</Trans>
) : componentNodeIds.length === 0 ? (
<Trans>Add components first</Trans>
) : (
@@ -696,20 +707,33 @@ function StepForm({
}
>
{!isDisabled && (
- <Button
- variant={isEditingMotion ? "primary" : "secondary"}
- size="sm"
- isDisabled={componentNodeIds.length === 0}
- onClick={() =>
- isEditingMotion ? onStopEditMotion() : onEditMotion(step.id)
- }
- >
- {isEditingMotion ? (
- <Trans>Done Editing Path</Trans>
- ) : (
- <Trans>Edit Path</Trans>
+ <HStack spacing={1} className="shrink-0">
+ {customMotion && !isEditingMotion && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => onResetMotion(step.id)}
+ >
+ <Trans>Reset</Trans>
+ </Button>
)}
- </Button>
+ <Button
+ variant={isEditingMotion ? "primary" : "secondary"}
+ size="sm"
+ isDisabled={componentNodeIds.length === 0}
+ onClick={() =>
+ isEditingMotion
+ ? onStopEditMotion()
+ : onEditMotion(step.id)
+ }
+ >
+ {isEditingMotion ? (
+ <Trans>Done Editing Path</Trans>
+ ) : (
+ <Trans>Edit Path</Trans>
+ )}
+ </Button>
+ </HStack>
)}
</PlaybackRow>
{carriedIn.map((header) => (
@@ -721,7 +745,7 @@ function StepForm({
isDisabled={isDisabled}
onEdit={() => onEditMotion(step.id, header.id)}
onStopEdit={onStopEditMotion}
- onReset={() => onResetUnitMotion(header.id)}
+ onReset={() => onResetMotion(header.id)}
/>
))}
<PlaybackRow
diff --git a/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx b/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx
index 3a3e526dfc..67b7801aa4 100644
--- a/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx
+++ b/apps/erp/app/modules/production/ui/Assemblies/AssemblyStepList.tsx
@@ -81,6 +81,7 @@ import { usePermissions } from "~/hooks";
import { path } from "~/utils/path";
import {
assemblyStepStatuses,
+ hasCustomMotion,
stepPlanWarningsSchema
} from "../../production.models";
import type { AssemblyInstructionStepRow } from "../../types";
@@ -1001,8 +1002,10 @@ function StepRow({
const stepType = step.type ?? "Task";
const needsSupport = (step.warnings as { needsSupport?: boolean } | null)
?.needsSupport;
+ // A hand-drawn path overrides the planner's flag.
const flagged =
- stepPlanWarningsSchema.safeParse(step.warnings).data?.flagged === true;
+ stepPlanWarningsSchema.safeParse(step.warnings).data?.flagged === true &&
+ !hasCustomMotion(step.warnings, step.motion);
const isMember = info.headerId !== null;
const displayTitle = title || t`Untitled step`;
diff --git a/apps/erp/app/modules/production/ui/Assemblies/AssemblySubAssemblyProperties.tsx b/apps/erp/app/modules/production/ui/Assemblies/AssemblySubAssemblyProperties.tsx
index 85f3688b9f..cf35375318 100644
--- a/apps/erp/app/modules/production/ui/Assemblies/AssemblySubAssemblyProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Assemblies/AssemblySubAssemblyProperties.tsx
@@ -47,7 +47,7 @@ type AssemblySubAssemblyPropertiesProps = {
editingUnitId: string | null;
onEditMotion: (stepId: string, unitHeaderId?: string) => void;
onStopEditMotion: () => void;
- onResetUnitMotion: (headerId: string) => void;
+ onResetMotion: (stepId: string) => void;
};
/**
@@ -68,7 +68,7 @@ export default function AssemblySubAssemblyProperties({
editingUnitId,
onEditMotion,
onStopEditMotion,
- onResetUnitMotion
+ onResetMotion
}: AssemblySubAssemblyPropertiesProps) {
const { id: instructionId } = useParams();
if (!instructionId) throw new Error("Could not find id");
@@ -302,7 +302,7 @@ export default function AssemblySubAssemblyProperties({
isDisabled={isDisabled}
onEdit={() => onEditMotion(step.id, step.id)}
onStopEdit={onStopEditMotion}
- onReset={() => onResetUnitMotion(step.id)}
+ onReset={() => onResetMotion(step.id)}
/>
)}
{!usedIn && (
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
index 34858c50b1..ec20e6e7dc 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
@@ -799,7 +799,7 @@
{"name":"production_updateAssemblyInstructionStepStatus","classification":"WRITE","paramCount":2,"schema":"9291eed55a4a","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateAssemblyStepComponents","classification":"WRITE","paramCount":2,"schema":"d7ea6b1800f7","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateAssemblyStepHiddenComponents","classification":"WRITE","paramCount":3,"schema":"3ac4e88c4df0","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
- {"name":"production_updateAssemblyStepMotion","classification":"WRITE","paramCount":3,"schema":"9a6ccd4d78c9","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
+ {"name":"production_updateAssemblyStepMotion","classification":"WRITE","paramCount":4,"schema":"6c3d7338c096","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateAssemblySubAssembly","classification":"WRITE","paramCount":4,"schema":"0f0cbf9e32e1","response":"none","injectAuth":"companyId+updatedBy+userId","permission":"production:update","paginates":false},
{"name":"production_updateJob","classification":"WRITE","paramCount":22,"schema":"fc37d97579b2","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
{"name":"production_updateJobBatchNumber","classification":"WRITE","paramCount":2,"schema":"a4c2a31bb8a6","response":"f7a40899c090","injectAuth":"companyId+updatedBy","permission":"production:update","paginates":false},
diff --git a/apps/erp/app/routes/x+/assembly+/$id.steps.motion.$stepId.tsx b/apps/erp/app/routes/x+/assembly+/$id.steps.motion.$stepId.tsx
index 719ee932a7..8b1b438620 100644
--- a/apps/erp/app/routes/x+/assembly+/$id.steps.motion.$stepId.tsx
+++ b/apps/erp/app/routes/x+/assembly+/$id.steps.motion.$stepId.tsx
@@ -48,6 +48,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
id: stepId,
motion: validation.data.motion,
camera: validation.data.camera,
+ reset: validation.data.reset,
updatedBy: userId
});
logAssemblyStep("motion.updateResult", {
diff --git a/apps/erp/app/routes/x+/assembly+/$id.tsx b/apps/erp/app/routes/x+/assembly+/$id.tsx
index 4f55aaac50..c5ceee8db9 100644
--- a/apps/erp/app/routes/x+/assembly+/$id.tsx
+++ b/apps/erp/app/routes/x+/assembly+/$id.tsx
@@ -630,8 +630,12 @@ export default function AssemblyInstructionRoute() {
const saveTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
const saveMotion = useCallback(
- (stepId: string, body: { motion?: Motion; camera?: CameraPose | null }) => {
+ (
+ stepId: string,
+ body: { motion?: Motion; camera?: CameraPose | null; reset?: boolean }
+ ) => {
const formData = new FormData();
+ if (body.reset) formData.set("reset", "on");
if (body.motion !== undefined) {
formData.set("motion", JSON.stringify(body.motion));
}
@@ -677,8 +681,8 @@ export default function AssemblyInstructionRoute() {
[saveMotion, editingUnitId]
);
- const onResetUnitMotion = useCallback(
- (headerId: string) => saveMotion(headerId, { motion: { type: "none" } }),
+ const onResetMotion = useCallback(
+ (stepId: string) => saveMotion(stepId, { reset: true }),
[saveMotion]
);
@@ -882,7 +886,7 @@ export default function AssemblyInstructionRoute() {
editingUnitId={isEditingSelected ? editingUnitId : null}
onEditMotion={onEditMotion}
onStopEditMotion={onStopEditMotion}
- onResetUnitMotion={onResetUnitMotion}
+ onResetMotion={onResetMotion}
onSetCamera={onSetCamera}
onClearCamera={onClearCamera}
stepMaterials={selectedStepMaterials}
diff --git a/docs/content/docs/reference/assembly-instructions.mdx b/docs/content/docs/reference/assembly-instructions.mdx
index edf9b7f3c4..8e5927576d 100644
--- a/docs/content/docs/reference/assembly-instructions.mdx
+++ b/docs/content/docs/reference/assembly-instructions.mdx
@@ -63,7 +63,7 @@ To expose obstructed work, select the eye on a row in the **Components** tab. Th
The **Playback** box sets how the step plays:
<FieldTable>
- <Field name="Motion">"Automatic" uses the path the planner found. **"Edit Path"** shows the path as red waypoints in the 3D view: drag one to reshape it, double-click the path to add one, and press Delete to remove the selected one. A see-through copy of the parts shows the selected waypoint's pose. Switch the viewer's **Move / Rotate** control to **Rotate** to get rotation rings on the selected waypoint: drag a ring to turn the part at that point (it snaps every 15°), so a part can be flipped on its way in. Switch back to **Move** to drag waypoints again. "No clear path" means the planner found none; hover the header note to see which parts block it.</Field>
+ <Field name="Motion">"Automatic" uses the path the planner found; "Custom path" means you drew it, and **"Reset"** puts the planner's path back. A drawn path also replaces "No clear path". **"Edit Path"** shows the path as red waypoints in the 3D view: drag one to reshape it, double-click the path to add one, and press Delete to remove the selected one. A see-through copy of the parts shows the selected waypoint's pose. Switch the viewer's **Move / Rotate** control to **Rotate** to get rotation rings on the selected waypoint: drag a ring to turn the part at that point (it snaps every 15°), so a part can be flipped on its way in. Switch back to **Move** to drag waypoints again. "No clear path" means the planner found none; hover the header note to see which parts block it.</Field>
<Field name="Camera">"Automatic" frames the step's parts on its own. **"Use Current View"** saves the angle you are looking from; **"Clear"** goes back to automatic.</Field>
<Field name="Sub-assembly path">One row per sub-assembly the step fits. "Automatic" slides the finished unit in from beside the build. **"Edit Path"** draws the path the whole unit travels, with the same waypoints and rotation rings; **"Reset"** goes back to automatic.</Field>
</FieldTable>