CAD/CAM Integration (Hackathon Demo)
Simulating ML-driven design automation for water treatment equipment
Overview
This documentation shows how Edubotx ML models can drive CAD/CAM design parameters through simulation. We simulate:
- Sensor data → ML predictions → Design parameters
- 2D/3D visualization of generated designs
- G-code simulation for manufacturing preview
No real hardware required - everything runs in Next.js!
Documentation Index
| # | Document | What It Covers | Time |
|---|---|---|---|
| 01 | Quick Start | Setup in 10 minutes | 10 min |
| 02 | Sensor Simulation | Simulate water quality sensors | 30 min |
| 03 | Design Generator | ML → CAD parameters | 45 min |
| 04 | Visualization | 2D/3D preview with Three.js | 45 min |
| 05 | G-code Simulator | CNC toolpath preview | 30 min |
| 06 | Demo Page | Complete integration page | 60 min |
Total implementation time: ~3.5 hours
Architecture (Simplified)
┌─────────────────────────────────────────────────────────────┐
│ HACKATHON DEMO FLOW │
│ │
│ [Simulated Sensors] ──▶ [ML API] ──▶ [Design Parameters] │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ generateParams() /api/predict calculateDesign() │
│ │ │ │ │
│ └────────────────────┴────────────────┘ │
│ │ │
│ ▼ │
│ [Visualization] │
│ - 2D SVG Preview │
│ - 3D Three.js Model │
│ - G-code Animation │
└─────────────────────────────────────────────────────────────┘
Tech Stack (Simple)
| Component | Library | Why |
|---|---|---|
| Frontend | Next.js 14 | Already using |
| 3D Rendering | Three.js / react-three-fiber | Easy 3D |
| 2D Drawing | SVG (built-in) | No extra deps |
| Charts | Recharts | Already using |
| State | React useState | Simple |
No Docker, Redis, or complex infra needed!
What We're Simulating
1. Sensors → ML
Water Quality Sensor (simulated)
├── pH: 6.5 - 8.5
├── BOD: 100 - 400 mg/L
├── COD: 200 - 800 mg/L
├── TSS: 50 - 300 mg/L
└── Flow Rate: 50 - 200 m³/hr
│
▼
ML Prediction API
│
▼
Treatment Requirements
├── Tank Volume: X m³
├── Aeration: Y kg O₂/hr
└── Filter Area: Z m²
2. ML → Design Parameters
ML Output CAD Parameters
─────────────────────────────────────────────
Flow Rate: 100 m³/hr → Tank Diameter: 2.5m
BOD Level: High → Aeration Slots: 8
TSS Level: Medium → Filter Layers: 3
Retention: 6 hrs → Tank Height: 4m
3. Design → Visualization
CAD Parameters Visual Output
─────────────────────────────────────────────
Tank Diameter: 2.5m → [3D Cylinder Model]
Inlet Size: 150mm → [Pipe Connection]
Outlet Size: 150mm → [Pipe Connection]
Baffles: 4 → [Internal Plates]
Quick Install
# Install only what's needed
npm install three @react-three/fiber @react-three/drei
# That's it! No other dependencies needed
File Structure (New)
src/
├── app/(core)/cad-cam-demo/
│ ├── page.tsx # Main demo page
│ ├── components/
│ │ ├── SensorSimulator.tsx
│ │ ├── DesignPreview.tsx
│ │ ├── Tank3DModel.tsx
│ │ ├── GCodeViewer.tsx
│ │ └── ParameterPanel.tsx
│ └── utils/
│ ├── design-calculator.ts
│ ├── gcode-generator.ts
│ └── types.ts
└── lib/cad/
├── simulator.ts # Sensor simulation
└── design-engine.ts # ML → Design conversion
Next: 01-QUICK-START.md
Start the 10-minute setup guide →