Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ebb29a8
-adeed initial changes
jeebeez Jan 14, 2026
626a7e1
-untested modelviewer changes
jeebeez Jan 15, 2026
0f248a1
- finally preserving colors
jeebeez Jan 21, 2026
79f8ab1
CAD changese
jeebeez Jan 29, 2026
d7cf4a0
GLTF changes
jeebeez Jan 30, 2026
3a5520a
Add assembly animation playback engine and fix simulation bugs
jeebeez Feb 5, 2026
d400175
UI overhaul phases 1-3: minimal topbar, home screen, upload modal
jeebeez Feb 5, 2026
b008940
Phase 5: Replace fixed LeftPanel with floating collapsible sidebar
jeebeez Feb 5, 2026
d94e84b
Phase 6: Redesign editor top bar with editable name and dropdown menu
jeebeez Feb 5, 2026
df2b7e4
Phase 9: Clean up obsolete routes and delete unused Sidebar
jeebeez Feb 5, 2026
740aadb
Phase 7: Export modal with share links, video, and PDF export
jeebeez Feb 5, 2026
104f345
Phase 8: Settings drawer with tools, torque, and associations
jeebeez Feb 5, 2026
b6b669c
Fix animation system and infinite re-render loops in xeokit viewer
jeebeez Feb 6, 2026
aced394
Fix folder icon logic and bidirectional part highlighting
jeebeez Feb 6, 2026
3ce1a94
Auto-expand tree folders when descendant is selected
jeebeez Feb 6, 2026
ce852f9
Improve assembly sequencing and motion planning
jeebeez Feb 6, 2026
7162c51
feat: collision-safe assembly planner with DFM diagnostics
jeebeez Feb 6, 2026
036b673
perf: 105x faster simulation via swept AABB pre-filtering
jeebeez Feb 6, 2026
ffa81c8
fix: compute assembly paths against all parts to prevent clipping
jeebeez Feb 6, 2026
7fd4639
- contact graph changes
jeebeez Feb 9, 2026
b84d126
- fixed the size bug for bigger parts
jeebeez Feb 12, 2026
e9fd665
Delete as1_pe_203.stp
jeebeez Feb 12, 2026
50d1f82
- viewer ui improvements
jeebeez Feb 12, 2026
fe88935
-remove old changes to the erp
jeebeez Feb 12, 2026
7f435fe
- fixed icons and some cleanup
jeebeez Feb 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.vscode
node_modules
.turbo
*.log
Expand Down Expand Up @@ -34,4 +35,15 @@ packages/database/supabase/seed.sql
.vercel
.env*.local

.react-router
.react-router

# OpenCode
.opencode/sessions/
.opencode/logs/

# Rust
**/target/
**/*.rs.bk
**/pkg/

packages/cad-engine
12 changes: 12 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ Rules for updating/writing to the cache:
- ALWAYS update the cache after a commit.
- NEVER update the cache about staged/uncommitted code.
- NEVER rebuild the database to test changes. Wait for the user to do that.


## Workflow Rules

- ALWAYS check in with me before making any major changes.
- Ask clarifying questions if uncertain - never make assumptions.
- Make small, incremental changes - never large sweeping changes.
- Always update CHANGELOG.md when making changes.
- Always write tests for new code.
- Always run tests before committing.
- Never commit directly to main - always create a new branch.
- Always create a PR for changes and ask for review before merging.
3 changes: 3 additions & 0 deletions apps/assembly/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.env*
!.env.example
6 changes: 6 additions & 0 deletions apps/assembly/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.env
.env.local
build
.turbo
.react-router
31 changes: 31 additions & 0 deletions apps/assembly/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM node:20 AS deps
WORKDIR /repo
# Install specific npm version
RUN npm install -g npm@10.8.2
# Copy root manifests for workspaces
COPY package.json package-lock.json turbo.json ./
# Copy only what we need to install and build
COPY apps ./apps
COPY packages ./packages
# Install all workspaces (dev deps are needed to build)
RUN npm install --legacy-peer-deps

FROM deps AS build
# Build only Assembly and its deps
RUN npx turbo run build --filter=./apps/assembly

FROM node:20
WORKDIR /repo
# Install specific npm version
RUN npm install -g npm@10.8.2
ENV NODE_ENV=production
ENV PORT=3002
# Install curl for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# Production needs built app, node_modules, and packages (for workspace deps)
COPY --from=deps /repo/node_modules ./node_modules
COPY --from=deps /repo/packages ./packages
COPY --from=build /repo/apps/assembly ./apps/assembly
EXPOSE 3002
WORKDIR /repo/apps/assembly
CMD ["npm","run","start"]
115 changes: 115 additions & 0 deletions apps/assembly/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Assembly Work Instructions

Automatic generation of assembly/disassembly work instructions from CAD files. Upload a STEP file, get an animated step-by-step assembly plan with collision-validated motion paths.

## How It Works

```
STEP file upload
|
v
[step-parser-occ] ── Python + OpenCascade ── extracts assembly tree + GLB mesh
|
v
[assembly-simulate] ── Rust (parry3d) ── finds disassembly sequence + animation paths
|
v
[project editor] ── React + xeokit ── 3D viewer with animated work instructions
```

### 1. Parsing (`step-parser-occ` job)

- Reads STEP AP203/AP214 files using OpenCascade (via `cadquery`)
- Builds an assembly tree: assemblies contain sub-assemblies and parts
- Tessellates each part into triangle meshes and exports a single GLB file
- Stores the assembly tree (JSON) and GLB (S3) in the project record

### 2. Simulation (`assembly-simulate` job)

The Rust simulator at `packages/cad-rust/` finds how to take the assembly apart, then reverses it into assembly order. It runs a 10-step pipeline:

1. **Contact graph** -- sweep-and-prune broad phase + parry3d narrow phase to find which parts touch
2. **Classification** -- labels parts as structural, fastener, panel, or standard based on geometry
3. **Dependency graph** -- fasteners go after their neighbors, structural parts go before panels
4. **Blocking matrix** -- swept-AABB pre-filter to check which parts block which in 6 axis directions
5. **Disassembly loop** -- iteratively removes unblocked parts, evaluating collision-free removal paths
6. **Path evaluation** -- discrete CCD sampling with binary search refinement to find exact clearance distance
7. **Reversal** -- flips disassembly order into assembly order
8. **Identical groups** -- merges repeated parts into groups (e.g. "8x M6 bolt")
9. **Subassemblies** -- detects sub-assemblies that can be pre-assembled offline
10. **Animation keyframes** -- generates time-stamped 4x4 transform keyframes for each step

Each step includes: part IDs, direction, travel distance, duration, and animation keyframes.

### 3. Viewer (`apps/assembly/app/components/Viewer/`)

- **XeokitCanvas** -- loads the GLB model into a xeokit 3D scene
- **useAnimationPlayback** -- interpolates keyframes and applies positional offsets to animate parts
- **useXeokit** -- manages the xeokit viewer lifecycle, highlighting, and camera

## Project Structure

```
apps/assembly/
app/
routes/x+/
_index.tsx # Dashboard -- project list, upload STEP
projects.$id.edit # Editor -- work instruction editing + 3D viewer
projects.$id.prep # Prep view
projects.new # New project wizard
settings.* # Tool library, torque specs, associations
components/
Viewer/ # xeokit 3D viewer + animation engine
WorkInstructions/ # Step editor, panels, export modal
Home/ # Dashboard cards

packages/cad-rust/
cad-common/ # Shared types (AssemblyNode, AssemblyStep, etc.)
cad-simulator/ # Assembly-by-disassembly solver (parry3d collision)
cad-server/ # Axum HTTP server (/health, /parse, /simulate)
cad-parser/ # Rust STEP parser (truck-stepio, limited)
cad-wasm/ # WASM build for browser-side use

packages/jobs/trigger/
step-parser-occ.ts # Trigger.dev job: STEP → assembly tree + GLB
assembly-simulate.ts # Trigger.dev job: tree + GLB → simulation result
```

## Running Locally

### Frontend

```bash
cd apps/assembly
pnpm dev # starts React Router dev server
```

### Rust CAD Server

```bash
cd packages/cad-rust
cargo build --release
./target/release/cad-server # listens on :8080
```

The `assembly-simulate` job calls `CAD_SERVER_URL` (default `http://localhost:8080`).

### Running Simulation Jobs

Jobs run via [Trigger.dev](https://trigger.dev). With the dev CLI running (`npx trigger dev`), uploading a STEP file triggers the parse job, which auto-chains to the simulation job.

To re-run simulation on an existing project, use the "Re-run Simulation" button in the project editor.

## Key Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `CAD_SERVER_URL` | `http://localhost:8080` | Rust simulation server URL |
| `PORT` | `8080` | Port for the Rust CAD server |

## Tests

```bash
cd packages/cad-rust
cargo test # runs 31 tests (simulator, parser, common)
```
22 changes: 22 additions & 0 deletions apps/assembly/app/components/Home/NewProjectCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { BsPlus } from "react-icons/bs";

interface NewProjectCardProps {
onClick: () => void;
}

export function NewProjectCard({ onClick }: NewProjectCardProps) {
return (
<button
type="button"
onClick={onClick}
className="group flex flex-col items-center justify-center h-full min-h-[200px] rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-primary/50 hover:bg-primary/5 transition-all cursor-pointer"
>
<div className="w-12 h-12 rounded-full bg-muted group-hover:bg-primary/10 flex items-center justify-center transition-colors mb-3">
<BsPlus className="w-6 h-6 text-muted-foreground group-hover:text-primary transition-colors" />
</div>
<span className="text-sm font-medium text-muted-foreground group-hover:text-primary transition-colors">
New Project
</span>
</button>
);
}
Loading