I'll build a comprehensive PCB Gerber viewer application. Let me start by creating the specification document.
Now let me create the application. I'll start with the main App component and then build out the supporting modules.
Now let me create the 2D viewer component:
Now let me create the 3D viewer component:
I need to install the Three.js dependencies first:
Now let me create the LayerPanel component:
Now let me create the PropertiesPanel:
Now let me create the main App component:
Now let me update the index.html with a proper title:
Let me build the project to check for any errors:
The project builds successfully! Let me add a demo board feature so users can test the viewer immediately:
Now let me update App.tsx to add a demo board button:
Let me build the project again:
The project builds successfully. Let me verify all the files are in place:
I've successfully built a comprehensive PCB Gerber Viewer application. Here's a summary of what was created:
Features Implemented
Core Functionality
- Gerber File Upload: Drag-and-drop or browse to upload Gerber files (.gbr, .gerber, .gtl, .gbl, .gts, .gbs, .gto, .gbo, .drl, .txt)
- RS-274X Parser: Custom parser supporting circles, rectangles, lines, Obround, and polygon apertures
- Auto Layer Detection: Automatically identifies layer types from filenames
2D Viewer
- Pan (click and drag) and zoom (mouse wheel)
- Per-layer visibility toggles
- Color customization per layer
- Grid overlay with major/minor lines
- Coordinates display on hover
3D Viewer
- Extruded board visualization with copper traces
- Orbital camera controls (rotate, pan, zoom)
- Solder mask rendering
- Drill hole visualization
- Contact shadows
Net Connectivity Analysis
- Click any pad or trace to select it
- Automatic flood-fill to find all electrically connected elements
- Highlight entire nets in green
- Properties panel shows connected pad count
Layer Management
- Visibility toggle per layer
- Color picker with preset palette
- Lock layers to prevent changes
- Layer type badges (Copper, Silkscreen, Mask, Drill, etc.)
Demo Board
- Built-in demo board with a simple 8-pin IC circuit
- Includes traces, pads, vias, and mounting holes
- Perfect for testing without uploading files
Keyboard Shortcuts
- F: Fit to view
- G: Toggle grid
- V: Switch 2D/3D view
- Escape: Clear selection
The application uses a professional dark theme optimized for hardware engineers, with a three-panel layout featuring layer controls, main canvas, and properties panel.
Files built: SPEC.md, src/types.ts, src/gerberParser.ts, src/connectivity.ts, src/Viewer2D.tsx, src/Viewer3D.tsx, src/LayerPanel.tsx, src/PropertiesPanel.tsx, src/App.tsx, index.html, src/demoData.ts