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