# Fluency CAD 2.0 A parametric CAD application built on OpenCASCADE Technology (OCCT) with a modern pygfx-based 3D renderer. ## Features - **OpenCASCADE Geometry Kernel**: Industry-standard BRep geometry with exact precision - **STEP/IGES Import/Export**: Full support for industry-standard CAD file formats - **Parametric Sketching**: 2D sketching with constraint solving using CadQuery - **Boolean Operations**: Union, difference, and intersection - **Fillet & Chamfer**: Apply edge treatments to solid bodies - **Modern Renderer**: WebGPU-based rendering with pygfx (smaller footprint than VTK) ## Architecture ``` fluency/ ├── src/fluency/ │ ├── geometry/ # Geometry abstraction layer │ │ └── base.py # Abstract interfaces │ ├── geometry_occ/ # OpenCASCADE implementation │ │ ├── kernel.py # OCGeometryKernel │ │ └── sketch.py # OCCSketch with constraints │ ├── rendering/ # Rendering abstraction │ │ ├── base.py # Abstract renderer │ │ └── pygfx_renderer.py │ ├── models/ # Data models │ │ └── data_model.py # Project, Component, Sketch, Body │ └── main.py # Application entry point ├── tests/ │ └── test_geometry.py └── pyproject.toml ``` ## Installation ```bash # Create virtual environment python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies pip install -e ".[dev]" ``` ## Dependencies | Package | Purpose | |---------|---------| | cadquery | High-level OpenCASCADE Python bindings | | ocp | Low-level OpenCASCADE Python bindings | | pygfx | WebGPU-based 3D renderer | | wgpu | WebGPU Python bindings | | PySide6 | Qt GUI framework | | numpy | Numerical computing | | scipy | Scientific computing | ## Usage ```bash # Run the application fluency-cad # Or directly python -m fluency.main ``` ## API Example ```python from fluency.geometry_occ.kernel import OCGeometryKernel from fluency.geometry.base import Point2D # Create kernel kernel = OCGeometryKernel() # Create a sketch points = [ Point2D(0, 0), Point2D(10, 0), Point2D(10, 10), Point2D(0, 10), ] polygon = kernel.create_polygon(points) # Extrude to 3D body = kernel.extrude(polygon, height=20.0) # Apply fillet body = kernel.fillet(body, radius=2.0) # Export to STEP kernel.export_step(body, "part.step") # Export to STL kernel.export_stl(body, "part.stl") ``` ## Comparison: Before vs After | Aspect | Before (SDF + VTK) | After (OCC + pygfx) | |--------|-------------------|---------------------| | Geometry Precision | Approximate (mesh) | Exact (BRep) | | Export Formats | STL only | STEP, IGES, STL, BREP | | File Size | Large (mesh) | Small (BRep) | | Fillet/Chamfer | Approximate | Exact | | Dependency Size | ~200MB (VTK) | ~30MB (pygfx) | | Constraint Solver | SolveSpace (separate) | CadQuery (integrated) | ## License MIT License