# Module Reference This file provides a mapping of modules to their primary responsibilities and key symbols. ## Root - `__init__.py`: - **Entry Point**: Extension registration (`register`, `unregister`). - **Node Tree**: `SLICETREE_NodeTree` class. - **Sockets**: Definitions for all `SLICESOCK_*` classes. - **Nodes**: Definitions for all `SLICENODE_*` classes. - **Evaluation Engine**: - `resolve_input()`: Recursively evaluates linked sockets. - `_resolve_output()`: Computes node outputs with a caching system (`_EvalCache`) to avoid redundant calculations. - `_follow_reroute()`: Handles Blender's Reroute nodes during evaluation. - `registry.py`: - **Auto-Registration**: Utility to track classes decorated with `@register_class`. - `blender_manifest.toml`: - Metadata for the Blender Extension platform. - `pyproject.toml`: - Standard Python project configuration. ## `/core` (Geometry & Slicing) - `slice.py`: - `slice_at_range()`: Top-level slicing function that iterates through Z-heights using `manifold3d` for guaranteed watertight solid slicing (resolving coplanar and floating-point degeneracies) with a fallback to `trimesh` multiplane slicing for open sheets (supports `ignore_holes` option). - `_slice_single_mesh()`: Mesh slicer implementing `manifold3d` solid slicing and `trimesh` multiplane intersection with micro-epsilon perturbation at boundary faces. - `align_path_seam_sharpest()`: High-performance vectorized heuristic that positions the start vertex (seam) of closed polygon loops at the sharpest concave angle (inner corner), with fallback to sharpest angle overall. - `SlicePaths.align_seams()`: Method on `SlicePaths` to align path seams to sharpest concave angles while preserving per-vertex attributes and metadata. - `Pather`: Class that converts toolpaths into G-code strings. Supports per-segment extrusion rates, feedrates, and custom extra attributes. - `segments_to_slice()`: Utility to convert raw intersection segments into continuous paths (closed polygons are processed via Pyclipper, supports `ignore_holes`, open paths remain open). - `link_segments()`: Logic for joining loose segments into continuous paths. - `buffer_slice()`: Offset utility using PyclipperOffset. Supports rotated offsetting. - `infill_slice()`: Generates rotated grid or rectilinear infill patterns, ensuring layer-to-layer consistency. - `boolean_slice()`: Performs 2D boolean operations (Union, Intersection, Subtract, XOR) on slice sets with hole support. - `path_operations_slice()`: Unified dispatcher for multi-input path operations (`ZIP`, `EXTEND`, `MAX_COVERAGE`, `MIN_COVERAGE`, `SUBTRACT`, `XOR`). - `minimum_coverage_slice()`: Computes layer-by-layer intersection across multiple inputs while preserving single-path/input layers. - `maximum_coverage_slice()`: Computes layer-by-layer union across multiple inputs. - `geometry.py`: - Geometry utility functions. ## `/core/pdf_exporter` (PDF Export & Technical Marking Engine) - `sa2_measures.py`: - `render_sa2_measures_pdf()`: ISO 129-1 technical marking engine. - `extract_slicing_object_features()`: Feature detection for circular bores (Ø), arcs (R), chamfers (C), and steps. - `writer.py`: - `export_mesh_to_pdf`: Class for building scalable 1:1 vector PDF files. Uses a modular element architecture with element subclasses (`PDFElement`, `PDFLegendElement`, `PDFHeaderTableElement`, `PDFGridElement`, `PDFGeometryElement`, `PDFBoundingBoxElement`, `PDFSA2MeasuresElement`, `PDFObjectLabelsElement`, `PDFBackgroundElement`). - `format_pdf_filename_template`: Formats file naming templates with placeholders for object names, whole PDF dimensions in mm (`{size_x_mm}`, `{size_y_mm}`), and ISO dates (`{today_date_iso}`). ## `/infra` (Blender Integration) - `blender_mesh_capture.py`: - `PdfProperties`: Dataclass holding PDF line width and line color attributes for a `SlicingObject`. - `SlicingObject`: Represents a single mesh as a NumPy triangle array. - `capture_mesh_edges()`: Extracts edges from a Blender mesh for path-based workflows. Supports capturing extra per-vertex attributes. - `blender_slice_nodes_generic.py`: - Base classes for NodeSlicer nodes (`SliceNode`) and sockets (`SliceNodeSocket`). - Native Blender socket type mappings (`NodeSocketFloat`, `NodeSocketInt`, `NodeSocketVector`, `NodeSocketRotation`, `NodeSocketString`, `NodeSocketObject`, `NodeSocketGeometry`). - Core evaluation logic (`resolve_input`).