# Node & Socket Reference ## Node Sockets | Socket ID | Type | Underlying Data Structure | Purpose | |-----------|------|---------------------------|---------| | `SLICESOCK_Object` | `bpy.types.Object` | Blender RNA Object | Reference to a Blender Object | | `SLICESOCK_Float` | `float` | Python float | Numeric value | | `SLICESOCK_Int` | `int` | Python int | Integer value | | `SLICESOCK_String` | `str` | Python string | Text/Path value | | `SLICESOCK_Vector` | `tuple` | Python tuple (3) | XYZ or Euler rotation value | | `SLICESOCK_Mesh` | `SlicingObject` | NumPy NDArray (Triangles) | Internal mesh data (Transformed/Scaled) | | `SLICESOCK_Paths` | `SlicePaths` (list) | List of paths (N, 3) + groups | Generic toolpaths or slice boundaries | | `SLICESOCK_Gcode` | `str` | Multi-line string | Generated G-code text | | `SLICESOCK_Settings` | `dict[str, str]` | Python dictionary | Mapping of configuration fields to values | | `SLICESOCK_SettingsRo` | `dict[str, str]` | Python dictionary | Read-only merged configuration overrides | ## Detailed Data Types ### SlicingObject (`SLICESOCK_Mesh`) The `SlicingObject` class wraps a high-performance NumPy representation of a Blender mesh. - **`.mesh`**: A NumPy `ndarray` of type `float64` with shape `(N, 3, 3)`. - `N`: Number of triangles. - `[i, 0:3, :]`: The three vertices of the $i$-th triangle. - **Coordinates**: Transformed to world space and scaled by the Blender scene unit scale (multiplied by 1000 for mm-standard G-code). ### SlicePaths (`SLICESOCK_Paths`) A custom list subclass `SlicePaths(list[np.ndarray])` containing toolpaths. - **Content**: Each `np.ndarray` has shape `(N, 3)`. - **Groups**: Maintains a `.groups` list of integers mapping each path to a layer or logical group. - **Extra Attributes**: Maintains an `.extra_attributes` dictionary mapping G-code prefixes (e.g., `S`, `M`) to lists of NumPy arrays, enabling per-segment custom parameters. - **Z-Awareness**: Coordinates are stored as 3D `(X, Y, Z)` to maintain the correct layer height. - **Topology**: Generated and cleaned using `pyclipper`. ### Gcode (`SLICESOCK_Gcode`) A standard Python string containing formatted G-code. - **Format**: `G0` for travels, `G1` for extrusions. - **Extrusion**: Calculated as absolute `E` values based on Euclidean distance and a configurable `EXTRUSION_RATE`. - **Metadata**: Includes `;OFFSET_X=` and `;OFFSET_Y=` comments to allow reconstruction of original coordinates. ## Nodes All nodes are found in the **Add (Shift+A)** menu under the **SliceNodes** category. ### Data & Input - **Object**: Blender object picker. - **Float**: Single float input. - **Integer**: Single integer input. - **String**: Single string/path input. - **Settings**: Read-only/write configuration settings dictionary. - **Wipe Tower**: Configures the Wipe Tower printbed position (`wipe_tower_position`) passed to 3MF metadata (`Prusa_Slicer_wipe_tower_information.xml`) without injecting into profile INI settings. - **Position X**: X coordinate of the wipe tower on the printbed. - **Position Y**: Y coordinate of the wipe tower on the printbed. - **Offset Object**: Configures the object placement transform offset (`offset_object`) applied to `` inside 3MF model build data (`3D/3dmodel.model`) without injecting into profile INI settings. - **Offset X**: X translation offset for the build item. - **Offset Y**: Y translation offset for the build item. - **Offset Z**: Z translation offset for the build item. - **Printer Intrinsics**: Configures bed size, extrusion/travel rates, retraction distance & feedrate, and Z-lift. - **Gcode Block**: Manual text area for entering raw G-code. ### Geometry Processing - **Get Mesh**: Converts a Blender Object into internal `SlicingObject` format. - **Transform Geometry**: Moves, rotates, and scales a `SlicingCollection` or `SlicingGroup` relative to the origin. - **Mesh**: Input mesh data. - **Translation**: 3D vector specifying the translation offset. - **Rotation**: 3D vector/Euler rotation values. - **Scale**: 3D vector specifying scaling factors along the X, Y, and Z axes (defaults to `1.0, 1.0, 1.0`). - **Drop Geometry**: Moves a `SlicingCollection` or `SlicingGroup` along Z so that its minimum Z sits at the specified value. - **Mesh**: Input mesh data. - **Z**: Target minimum Z coordinate (defaults to `0.0`). - **Get Paths**: Extracts existing edges from a mesh as paths. - **Extrusion Multiplier Attribute**: Mesh attribute to use for per-segment extrusion rates. - **Feedrate Attribute**: Mesh attribute to use for per-segment feedrates. - **Extra Attributes**: Dictionary mapping mesh attribute names to custom G-code prefixes (e.g., `opening_size` -> `S`). - **Path Offset**: Offsets `SlicePaths` by a 3D vector. - **Rotate Path**: Rotates `SlicePaths` around the Z-axis. - **Angle**: Rotation angle in degrees. - **Center**: Optional center of rotation. If not provided, it defaults to the midpoint of the first layer. - **Slice Shells**: Slices a `SlicingObject` into 2D `SlicePaths` at a given layer height. Automatically aligns path seams to the sharpest concave angle (inner corner) of each layer. Supports rotation for slicing at an angle. - **Buffer Shells**: Offsets/buffers 2D `SlicePaths`. Supports rotated offsetting and multiple miter types. - **Buffer Curve**: Buffers open/closed curves using Shapely, allowing open path offsetting. - **Cap Style**: Style of the curve ends (Round, Flat, Square). - **Join Style**: Style of corner joins (Round, Mitre, Bevel). - **Single Sided**: Buffers only on one side of the curve if enabled. - **Distance**: The buffer distance. - **Rotation**: Optional Euler rotation for non-planar offsetting. - **Offset Curve**: Offsets/shifts open/closed curves by a distance using Shapely, producing parallel curves. - **Join Style**: Style of corner joins (Round, Mitre, Bevel). - **Distance**: The offset distance (positive for left side, negative for right side). - **Rotation**: Optional Euler rotation for non-planar offsetting. - **Infill**: Generates a cross-hatch grid or parallel lines clipped by boundary paths. - **Infill Type**: Switch between **Grid** (cross-hatch) and **Rectilinear** (alternating parallel lines). - **Density**: Distance between lines in units. - **Infill Rotation**: Base rotation of the infill pattern. - **Layer Rotation**: Rotation of the entire slice to align infill with specific planes. - **Get Infill Mask**: Computes the intersection of all closed paths in each group (layer) using Shapely. - **Overhang Mask**: Computes the accumulated overhang mask for each layer, propagating support requirements from top to bottom. - **Boolean Paths**: Performs 2D boolean operations (`UNION`, `INTERSECTION`, `DIFFERENCE`, `XOR`) on multiple slice sets. - **Arrange Slicing Group**: Arranges the slicing collections in a slicing group on the build plate using the `libnest2d` bin-packing library. It nests their 2D bounding boxes to prevent collisions. - **Method**: Switch between **NFP** (No-Fit Polygon placer + First-Fit selection), **Bottom-Left** (Bottom-Left placer + First-Fit selection), and **DJD Heuristic** (No-Fit Polygon placer + Dyckhoff's heuristic). - **Allow Rotations**: Toggle whether to allow rotating objects (by 90-degree steps) during nesting. - **Bed X / Y**: The build plate dimensions in mm. - **Spacing**: The minimum distance between arranged objects in mm. ### Utility & Joiners - **Join Mesh**: Merges multiple `SlicingObject` instances into one. - **Join Paths**: Combines multiple `SlicePaths`. Supports Sequential or Interleaved modes. - **Join Gcode**: Concatenates multiple G-code strings. - **Join Settings**: Sequentially merges multiple override dictionaries. Later inputs overwrite earlier ones for matching keys. - **Integer Math**: Simple integer operations (Add, Multiply, etc.). ### Action & I/O - **Paths to Gcode**: Converts `SlicePaths` into G-code blocks. - **Header**: Toggles the generation of standard NodeSlicer G-code headers and units setup. - **Load Gcode**: Reads a G-code file from disk. - **Gcode to File**: Writes G-code string to a file on disk. - **Automatic Binary Conversion**: If the G-code contains the comment `; binary_gcode = 1`, the node automatically converts the output to Prusa's binary G-code format (`.bgcode`) using MeatPack encoding and Heatshrink compression. - **Baserow Submit**: Sends G-code and metadata to a Baserow database. - **Host**: Baserow host URL. - **Token File**: Path to a file containing the Baserow API token. - **Table ID**: The ID of the target Baserow table. - **Record ID**: Optional ID of an existing record to update. - **Gcode Field**: The name of the attachment field in Baserow. - **Airtable Submit**: Sends G-code and metadata to an Airtable base. - **PAT File**: Path to a file containing the Airtable Personal Access Token (PAT). - **Base ID**: The ID of the target Airtable base. - **Table ID**: The ID or name of the target Airtable table. - **Record ID**: Optional ID of an existing record to update. - **Gcode Field**: The name of the attachment field in Airtable. - **PrusaSlicer Slice**: Exports the current mesh and configuration to a 3MF file and calls PrusaSlicer to generate G-code. - **Executable**: Path to the PrusaSlicer executable. - **Object**: The Blender object to slice. - **Config**: PrusaSlicer configuration (from the **PrusaSlicer Config** node). - **Gcode**: Output socket providing the generated G-code string. - **Gcode to Text Block**: Creates a new Blender text block containing the G-code and opens it in any active text editors. - **Gcode to Preview Mesh**: Decodes G-code and creates a Blender mesh ("Debug" object) for visualization. - **PrusaSlicer Preview**: Launches PrusaSlicer's built-in G-code viewer to visualize a G-code string. - **Executable**: Path to the PrusaSlicer executable (default: `flatpak run com.prusa3d.PrusaSlicer`). - **Gcode**: Input socket for the G-code string to preview. - **Test**: Triggers evaluation for debugging purposes.