# NodeSlicer Technical Overview NodeSlicer is a Blender extension designed for high-performance mesh slicing and G-code generation. It provides a node-based interface that abstracts away the complexity of 3D-to-2D geometry conversion, offering a pipeline for 3D printing workflows. ## Core Principles 1. **Fast Slicing**: Bypasses the Blender CPU-bound Boolean modifiers by using vectorized plane-triangle intersection via NumPy. 2. **Robust Geometry**: Leverages Shapely (built on GEOS) for all 2D operations, ensuring topological correctness in offset/buffering and boundary extraction. 3. **Extensibility**: A custom Node Tree architecture allows for easy creation of new nodes for custom toolpath strategies or post-processing. 4. **Blender Integration**: Deeply integrated into Blender's UI while maintaining a decoupled geometry engine for maximum performance. ## System Architecture ```mermaid graph TD UI[Blender Node Editor] --> Eval[Node Evaluation Engine] Eval --> Capture[Mesh Capture - infra/blender_mesh_capture] Capture --> Slice[Slicing Logic - core/slice] Slice --> Gcode[G-code Generation - core/slice] Gcode --> Export[File Export] ``` ## Data Lifecycle - **Mesh Data**: Extracted from Blender as `(N, 4, 3)` NumPy arrays representing triangles and face normals. - **2D Contours (Slices)**: Stored as a list of closed paths (NumPy arrays). Coordinates include Z-height. Topology (shells/holes) is managed via Pyclipper using the Even-Odd fill rule. - **Toolpaths (Paths)**: Stored as a list of open or closed paths (NumPy arrays). These represent the actual motion lines of the 3D printer. - **G-code**: Formatted strings that include travel moves (`G0`), extrusions (`G1`), and metadata (layer change comments). ## Important Files - `__init__.py`: Node tree and evaluation engine definition. - `core/slice.py`: Slicing and G-code generation algorithms. - `infra/blender_mesh_capture.py`: High-performance mesh extraction from Blender. - `registry.py`: Central registration of Blender classes.