A focused Part-Design style CAD kernel and 2D technical drawing system implemented in Odin.
๐ Week 12.2 Complete - Constraint Editing with Inline Text Widget! ๐
Full parametric CAD workflow with editable constraints and live solver updates!
Current Features:
- โ 2D parametric sketching (lines, circles, arcs)
- โ Constraint solver (12 constraint types with visual feedback)
- โ Constraint editing - Double-click dimensions to edit values inline
- โ 3D extrusion and revolution with parametric updates
- โ Boolean operations (cut/pocket with OCCT - OpenCascade Technology)
- โ Face selection and sketch-on-face workflow
- โ SDL3 GPU rendering (Metal on macOS)
- โ Multi-touch gestures (trackpad support)
- โ Feature tree with dependency tracking
- โ Undo/redo system (50 command history)
- โ Professional UI with toolbar, properties panel, feature tree, and status bar
- โ Text rendering with fontstash (BigShoulders font)
- โ Shaded rendering with Phong lighting
- โ STL export for 3D printing
- โ Hover highlights and closed shape visualization
See Development Plan for complete roadmap and SDL3 GPU Migration Summary for technical details.
- 2D Parametric Sketcher with constraint solving
- 3D Features: Extrude (pad), pocket (cut), revolve, basic fillet/chamfer
- Parametric Feature Tree with replay/regeneration
- B-rep Topology for robust solid modeling
- Technical Drawing: Orthographic views, hidden line removal, dimensions
- File Export: STL, SVG, PDF
- Explicit memory layout, no GC pauses
- Easy C interop for reusing libraries
- Simple syntax for systems programming
- Excellent built-in packages (math, graphics, testing, etc.)
mix_OhCAD/
โโโ src/
โ โโโ main.odin # Main entry point
โ โโโ core/
โ โ โโโ math/ # CAD-specific math utilities
โ โ โโโ geometry/ # 2D/3D geometric primitives
โ โ โโโ topology/ # B-rep data structures
โ โ โโโ kernel/ # CSG/B-rep operations (future)
โ โโโ features/
โ โ โโโ sketch/ # 2D sketching system
โ โ โโโ extrude/ # Extrude feature (future)
โ โ โโโ revolve/ # Revolve feature (future)
โ โ โโโ constraints/ # Constraint solver (future)
โ โโโ io/
โ โ โโโ stl/ # STL import/export
โ โ โโโ svg/ # SVG export (future)
โ โ โโโ step/ # STEP I/O (future)
โ โโโ ui/
โ โโโ viewer/ # 3D OpenGL viewer (future)
โ โโโ drawing/ # Technical drawing (future)
โโโ tests/ # Unit and integration tests
โโโ docs/ # Documentation
โโโ examples/ # Example models (future)
โโโ Makefile # Build system
- Odin Compiler (latest version)
- SDL3 (for GPU-accelerated rendering)
- Metal-capable macOS system (for Metal backend)
- OpenGL 3.3+ (for legacy GLFW version)
# Build SDL3 GPU version (recommended)
make gpu
# Run SDL3 GPU application
make run-gpu
# Build GLFW version (legacy backup)
make
# Run GLFW application
make run
# Run tests
make test
# Clean build artifacts
make clean# SDL3 GPU version (recommended)
odin build src/main_gpu.odin -file -out:bin/ohcad_gpu -debug
# GLFW version (legacy)
odin build src/main.odin -file -out:bin/ohcad -debug
# Run tests
odin test tests -all-packagescd src/ui/viewer/shaders
./build_shaders.sh
# Generates line_shader.metallib (~15KB)See the Development Plan for the complete 16-week MVP roadmap.
Current Week: Week 1 - Project Setup & Core Math
See the High-Level Design for detailed architecture and design decisions.
See Odin Built-in Packages for a catalog of Odin packages we're leveraging.
This is an educational project focused on learning CAD system architecture and Odin programming.
- Follow Odin naming conventions (
snake_casefor functions,PascalCasefor types) - Use
f64for all geometric calculations (CAD precision) - Document complex algorithms and geometric predicates
- Write unit tests for all math and geometry functions
# Run all tests
make test
# Run specific test package
odin test tests/math -all-packagesMIT License - See LICENSE file for details.
- Project setup
- Core math library (57/57 tests passing)
- Geometry primitives (2D/3D)
- B-rep topology (handle-based system)
- Basic 3D viewer (GLFW + OpenGL)
- Sketch data model with coordinate transforms
- Interactive sketch tools (line, circle, select)
- Constraint system (16 constraint types)
- Levenberg-Marquardt constraint solver
- Visual constraint feedback (icons + dimensions)
- Profile detection for extrusion
- Week 9: Extrude/pad feature with parametric updates โ
- Week 9.5: SDL3 GPU migration + multi-touch gestures โ
- Week 9.6: UI framework & toolbar integration โ
- Week 10.5: Boolean operations (cut/pocket)
- Week 11: Revolve feature
- Week 12: STL export & basic fillet
- Orthographic projection
- Hidden line removal
- Dimensioning
- SVG/PDF export
- Boolean robustness
- Advanced fillets
- STEP I/O
- NURBS surfaces
- SolveSpace - Constraint solver reference
- BRL-CAD - CSG concepts
- Open CASCADE - B-rep algorithms
- Odin Documentation - https://odin-lang.org/docs/
Built with โค๏ธ and Odin