Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
BrepRs
BrepRs is a Rust implementation of a Boundary Representation (BRep) solid modeling library. It provides a comprehensive set of tools for creating, manipulating, and analyzing 3D geometric models with multi-language support and cross-platform compatibility.
License
This project is dual-licensed under your choice of either:
- MIT License - See LICENSE-MIT
- Apache License 2.0 - See LICENSE-APACHE
You may choose to use this software under either license. Both are OSI-approved and compatible with most open source projects.
Features
Core Functionality
- Topological Kernel: Implementation of BRep data structure with support for vertices, edges, wires, faces, shells, solids, compounds, and compsolids
- Modeling Algorithms: Primitive creation, shape construction, boolean operations, fillet/chamfer, and offset operations
- Data Exchange: Support for STL, STEP, and IGES file formats
- Foundation Types: Basic numeric types, string handling, handle and reference counting, exception handling, and memory management
- Internationalization: Multi-language support with hot-reload capability
Language Bindings
- Python: Using PyO3
- C/C++: Using FFI
- Fortran: Using C FFI
- Java: Using JNI
- Node.js: Using NAPI-RS
- PHP: Using ext-php-rs
Technical Highlights
- Rust-Based: Leverages Rust's safety, performance, and concurrency features
- Modular Architecture: Clean, modular design with well-defined interfaces
- Comprehensive Testing: Extensive unit tests for all modules
- Cross-Platform: Supports Linux, macOS, Windows, and WebAssembly
- WebAssembly Support: Can be used in browser applications
Project Structure
/
├── src/ # Source code
│ ├── foundation/ # Foundation types and utilities
│ ├── topology/ # Topological kernel
│ ├── geometry/ # Geometric primitives
│ ├── modeling/ # Modeling algorithms
│ ├── data_exchange/ # File format support
│ ├── i18n/ # Internationalization support
│ │ ├── hot_reload.rs # Hot-reload for translations
│ │ └── mod.rs # I18n module
│ ├── mesh/ # Mesh generation
│ ├── visualization/ # Visualization
│ ├── application/ # Application framework
│ └── lib.rs # Library entry point
├── bindings/ # Language bindings
│ ├── python/ # Python bindings
│ ├── cpp/ # C/C++ bindings
│ ├── fortran/ # Fortran bindings
│ ├── java/ # Java bindings
│ ├── nodejs/ # Node.js bindings
│ ├── php/ # PHP bindings
│ └── README.md # Bindings documentation
├── examples/ # Example code
│ ├── python/ # Python examples
│ ├── cpp/ # C/C++ examples
│ ├── fortran/ # Fortran examples
│ ├── java/ # Java examples
│ ├── nodejs/ # Node.js examples
│ └── php/ # PHP examples
├── translations/ # Translation files
│ ├── en.json # English translations
│ ├── zh-CN.json # Simplified Chinese translations
│ ├── zh-TW.json # Traditional Chinese translations
│ ├── fr.json # French translations
│ ├── de.json # German translations
│ └── ru.json # Russian translations
├── docs/ # Documentation
│ ├── book.toml # mdbook configuration
│ ├── SUMMARY.md # Documentation summary
│ └── src/ # Documentation source files
│ ├── en/ # English documentation
│ ├── zh-CN/ # Simplified Chinese documentation
│ ├── zh-TW/ # Traditional Chinese documentation
│ ├── fr/ # French documentation
│ ├── de/ # German documentation
│ └── ru/ # Russian documentation
├── build-docs.sh # Documentation build script
├── Cargo.toml # Rust project configuration
└── README.md # This file
Getting Started
Prerequisites
- Rust 1.70+ (stable)
- Cargo (Rust package manager)
Installation
Add BrepRs to your Cargo.toml:
[]
= "0.6.1-alpha"
Basic Usage
use *;
use PrimitiveCreator;
use StlWriter;
use ;
Advanced Usage
Boolean Operations
use BooleanOperations;
// Create two shapes
let box_shape = creator.make_box;
let sphere_shape = creator.make_sphere;
// Perform boolean operations
let boolean = new;
let fused_shape = boolean.fuse;
let cut_shape = boolean.cut;
let common_shape = boolean.common;
Fillet and Chamfer
use FilletChamfer;
// Create a box
let box_shape = creator.make_box;
// Create fillet chamfer tool
let fillet_chamfer = new;
// Apply fillet to edges
let filleted_shape = fillet_chamfer.fillet_edges;
// Apply chamfer to edges
let chamfered_shape = fillet_chamfer.chamfer_edges;
Offset Operations
use OffsetOperations;
// Create a face
let face = creator.make_face_from_plane;
// Create offset operations tool
let offset = new;
// Offset the face
let offset_face = offset.offset_face;
// Create a thick solid
let thick_solid = offset.make_thick_solid_from_face;
Data Exchange
use StlReader;
use StepWriter;
use IgesWriter;
// Read STL file
let stl_reader = new;
let shape = stl_reader.read.unwrap;
// Write to STEP file
let step_writer = new;
step_writer.write.unwrap;
// Write to IGES file
let iges_writer = new;
iges_writer.write.unwrap;
Using Language Bindings
Python
# Initialize i18n
# Set language to English
# Create a box
=
=
Node.js
const breprs = require;
// Initialize i18n
breprs.;
// Set language to English
breprs.;
// Translate a message
console.log;
Documentation
BrepRs provides comprehensive documentation in multiple languages:
Building Documentation
# Build documentation
# Serve documentation locally
&&
# Open http://localhost:3000 in your browser
Documentation Languages
- English
- 简体中文 (Simplified Chinese)
- 繁體中文 (Traditional Chinese)
- Français (French)
- Deutsch (German)
- Русский (Russian)
Development Roadmap
- Stage 1: Foundation Types ✅
- Stage 2: Topological Kernel ✅
- Stage 3: Modeling Algorithms ✅
- Stage 4: Data Exchange ✅
- Stage 5: Internationalization ✅
- Stage 6: Language Bindings ✅
- Stage 7: Mesh Generation (in progress)
- Stage 8: Visualization (in progress)
- Stage 9: Application Framework (in progress)
- Stage 10: Optimization (planning)
- Stage 11: Testing and Validation (ongoing)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
-
Clone the repository:
-
Run tests:
-
Build the library:
-
Build language bindings:
# Python # Node.js &&
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with Rust - a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety
- PyO3 for Python bindings
- NAPI-RS for Node.js bindings
- ext-php-rs for PHP bindings
- JNI for Java bindings
- mdbook for documentation
Contact
- Project Link: https://github.com/mikewolfli/BrepRs
- Author: Mike Wolfli