A comprehensive Rust-based suite of tools for finding optimal chains of spacers and imaging train elements with exact length requirements. Designed for optics and microscopy applications where precise spacer configurations are critical.
SpacerFinder provides three complementary tools that work together to solve complex spacer chain optimization problems:
- Spacer_Finder_CLI - Core command-line algorithm for finding minimal spacer chains
- RigCreator - GUI application for managing required "rig" elements and testing configurations
- SpacerManager - GUI application for managing spacer inventories with duplicate prevention
- Optimal Chain Finding: Finds the shortest possible spacer chains meeting exact length constraints
- Required Elements: Enforces inclusion of mandatory elements in specific orders
- Thread Compatibility: Automatic validation of thread connections (size matching, gender opposition)
- Functional Programming: All tools implemented using functional programming principles
- Cross-Platform GUIs: Modern interfaces built with Slint
- JSON Data Format: Human-readable configuration files
- Duplicate Prevention: Intelligent inventory management
- Rust toolchain (install from rustup.rs)
- For GUI tools: Slint system dependencies (installation guide)
# Clone the repository
git clone https://github.com/ecouter/SpacerFinder.git
cd SpacerFinder
# Build all components
cargo build --release-
Set up your spacer inventory with SpacerManager:
./target/release/spacer_manager
- Add your available spacers
- Save to
spacers.json
-
Define required elements with RigCreator:
./target/release/rig_creator
- Create your "must-have" rig configuration
- Test against your spacer inventory
- Save to
must_have.json
-
Find optimal chains with Spacer_Finder_CLI:
./target/release/spacer_finder spacers.json must_have.json M54M M54F 8.0
SpacerManager → spacers.json → RigCreator → must_have.json → Spacer_Finder_CLI
↓
Chain Results
- Format:
SIZE + GENDER(e.g.,"M54M","M54F") - M: Male thread
- F: Female thread
- Connection requires: same size + opposite gender
[
{
"thread_in": "M54F",
"thread_out": "M54M",
"length": 5.0
}
][
{
"thread_in": "M54F",
"thread_out": "M54M",
"length": 5.0
}
]Purpose: Core algorithm implementation
- Command-line interface for batch processing
- Backtracking search with performance optimizations
- Chain length limited to 10 elements
- Functional programming architecture
Purpose: Required element management and testing
- GUI for creating ordered "rig" configurations
- Integrated chain testing against spacer inventories
- Visual reordering of required elements
- Configuration export for CLI usage
Purpose: Spacer inventory management
- GUI for maintaining spacer collections
- Duplicate detection and prevention
- Clean interface for CRUD operations
- Foundation for the entire workflow
- Language: Rust 2021 edition
- GUI Framework: Slint
- Serialization: Serde with JSON
- Algorithm: Backtracking with pruning
- Architecture: Functional programming
- Platform: Cross-platform (Linux, macOS, Windows)
- Microscopy: Configuring imaging train spacers
- Optics: Building precise optical assemblies
- Engineering: Any application requiring exact-length threaded connections
- Research: Optimizing spacer configurations for experimental setups
We welcome contributions! Please:
- Follow functional programming principles
- Include tests for new functionality
- Update documentation for API changes
- Ensure cross-platform compatibility
# Clone and build
git clone https://github.com/ecouter/SpacerFinder.git
cd SpacerFinder
cargo build
# Run tests
cargo test
# Format code
cargo fmt
# Lint
cargo clippyThis project is under the GPLv3 license.
- Issues: GitHub Issues
- Discussions: GitHub Discussions