MatrixFlow is a fully parametric, airflow-optimized generator for creating adapters between pipes, hoses, and HVAC ducts of different shapes and sizes.
Connecting distinct airflow systems (e.g., a 110mm rigid PVC pipe to a 125mm flexible hose) often requires complex offsets. Standard adapters are straight, and flexible hoses can kink if forced into tight S-bends.
Most 3D printed adapters use simple "hull" or "loft" operations. When these bend sharply, the internal cross-section narrows (ovalizes), choking the airflow.
This script uses a custom Matrix-based Sweep Engine to generate geometry:
- It calculates a cubic bezier curve between the start and end points.
- It generates 4x4 Transformation Matrices for every slice, ensuring the shape is always perpendicular to the airflow.
- It calculates proper Up-Vector Interpolation to prevent rectangular ducts from twisting or collapsing during complex compound turns.
- Universal Shape Morphing: Seamlessly transitions between:
- Circle ↔ Circle (Reducers/Expanders)
- Rectangle ↔ Rectangle (HVAC)
- Circle ↔ Rectangle (Square-to-Round)
- Complex Geometry: Handles independent X, Y, and Z offsets plus independent exit angles (Pitch and Yaw).
- 3D Printing Optimized:
- Constant wall thickness.
- "Slip-over" vs "Standard" (Insert) fit modes.
- No support material needed for most angles (<45°).
- Download and install OpenSCAD.
Note
For fastest rendering, use the latest Development Snapshot (2026.02+). The "Manifold" backend is enabled by default in Preferences > Advanced > 3D Rendering.
- Open
MatrixFlow_adapter.scad - Open the Customizer panel (
Window -> Customizer) - Adjust parameters to fit your needs
- Press F6 to Render, then F7 to export as STL
| Parameter | Description |
|---|---|
| Transition Height | The vertical distance between the two ends. |
| Smoothness | Resolution of the curve. Use 20 for preview, 60+ for printing. |
| Top/Bottom Shape | Select Circle or Rectangle. |
| Fit Mode | Standard = adapter goes INSIDE the pipe. Slip Over = adapter goes OVER the pipe. |
| Offsets (X/Y) | Physical displacement of the top opening relative to the bottom. |
| Exit Angles | Rotates the top opening to align with angled pipes. |
I originally found a customizable adapter online that looked promising, but I was pissed that it was closed-source. Basic parametric utilities like this should be open and accessible to everyone.
So, I decided to build my own version from scratch—completely open-source, mathematically superior, and free for the community to use and improve.
You can twist it too much!
While the MatrixFlow engine is robust, physics still applies. If you input extreme offsets or aggressive angles over a very short distance, the geometry may become self-intersecting or "kinked." The model will do its absolute best to calculate a nice, smooth transition from one end to the other, but keep your transitions reasonable for the best airflow results.
This project is licensed under the MIT License - feel free to use, modify, and distribute.