nodeslicer/doc/NODES.md
2026-10-14 17:59:21 +03:00

23 KiB

Node & Socket Reference

Node Sockets

Socket ID Type Underlying Data Structure Purpose
NodeSocketObject bpy.types.Object Blender RNA Object Reference to a Blender Object
NodeSocketFloat float Python float Numeric value
NodeSocketInt int Python int Integer value
NodeSocketString str Python string Text, G-code, file/folder path value
NodeSocketVector tuple Python tuple (3) XYZ vector value
NodeSocketRotation tuple Python tuple (3) Euler rotation value
NodeSocketGeometry Geometry Geometry Data Generic geometry reference
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_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.

List Processing Semantics

NodeSlicer supports generalized list processing across geometry, path, G-code, and math nodes:

  • Main Input & Secondary Inputs: Nodes define a "main" primary input (e.g., Mesh, Geometry, Paths, Gcode). When the main input receives a list, the node evaluates element-wise and outputs a corresponding list.
  • Index-per-index Matching: Secondary input sockets (such as translation vectors, rotations, scale vectors, drop Z coordinates, cutting meshes, rename templates, and parameters) also accept lists. When supplied with a list, secondary inputs are matched index-per-index with the main input list.
  • Broadcasting: If a secondary input receives a single value (or a list of length 1), that value is automatically broadcast across all elements of the main input list.
  • Length Constraint: It is mandatory that secondary input lists have either the exact same length as the main input list, or length 1. If lengths mismatch (M \ne N and M \ne 1), or if a single main input receives a multi-item secondary list, a ValueError is raised with a descriptive error message.
  • Consistent Socket Appearance: Sockets representing lists display Blender's LIST shape, while single-value sockets display CIRCLE. Sockets adapt dynamically based on upstream connections (e.g. connecting a list output to Mesh dynamically converts Mesh input and downstream outputs to LIST), and dedicated list sockets (such as Layers output on the Layers node, Layers input on Slice Shells (Layers), and list joiner outputs) consistently maintain LIST shape across link creations, deletions, and tree updates.

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.
  • Collection Objects: Selects a Blender collection and dynamically exposes its mesh objects as output sockets, sorted alphabetically.
  • Settings: Read-only/write configuration settings dictionary.
  • Printer: Printer name picker.
  • Printer List: List of configured printers.
  • Printer Intrinsics: Configures bed size, extrusion/travel rates, retraction distance & feedrate, and Z-lift.
  • Layers: Generates an ordered list of slicing heights (floats) bounded by the maximum build height.
    • First Layer Height: Float value specifying the initial slicing height (defaults to 0.2 mm).
    • Layer Height: Float value specifying the interval between successive layers (defaults to 0.2 mm).
    • Total Height: Float value specifying the maximum build height to bound layer generation (defaults to 250.0 mm).
    • Layers: Output socket delivering the list of layer Z heights [first_layer, first_layer + layer_height, ...].

Geometry Processing

  • Get Mesh: Converts a Blender Object into internal SlicingObject format.
  • Rename Mesh: Overrides the internal metadata name of a SlicingObject, SlicingCollection, or SlicingGroup. Supports {AttributeName} attribute placeholders (e.g., Rebar-L{Rebar Length}M) that evaluate to index zero of the target attribute for each object, as well as {Name} to include the item's previous name (e.g., {Name}_T{Thickness}mm).
    • Geometry: Input geometry data.
    • Name: String input socket or property for the new name template.
  • Transform Geometry: Moves, rotates, and scales geometry (SlicingObject, SlicingCollection, SlicingGroup, or SlicePaths) relative to the origin.
    • Geometry: Input geometry 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).
  • Get Transforms: Extracts the accumulated translation, rotation (Euler radians), and scale from input geometry (SlicingObject, SlicingCollection, SlicingGroup, or SlicePaths).
    • Geometry: Generic geometry input socket (accepts SLICESOCK_Mesh, SLICESOCK_Paths, or SLICESOCK_Geometry).
    • Translation: 3D vector output socket containing translation offset (X, Y, Z).
    • Rotation: Euler rotation output socket containing rotation (rx, ry, rz) in radians.
    • Scale: 3D vector output socket containing scale factors (sx, sy, sz).
  • Drop Geometry: Moves a SlicingCollection or SlicingGroup along Z so that its minimum Z sits at the specified value. Outputs both the dropped geometry and the translation vector.
    • Mesh: Input mesh data.
    • Z: Target minimum Z coordinate (defaults to 0.0).
    • Mesh: Output dropped mesh data.
    • Translation: Output translation vector (X, Y, Z) applied to the geometry.
  • Separate Mesh: Splits a SlicingCollection into two collections (Selection and Inverted) by comparing a specified mesh attribute against a target value with comparison operators (==, !=, >, <, >=, <=).
  • Separate Mesh by Range: Splits a SlicingCollection into multiple output sockets across an integer range (Start to End), matching a specified integer attribute. Objects in each output socket are renamed with a zero-indexed padded suffix (f"{base_mesh_name}{i:0{num_digits}d}" where num_digits = max(2, len(str(total_parts)))).
  • 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.
  • 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).
  • Slice Shells: Slices a SlicingObject into 2D SlicePaths at a given layer height. Automatically aligns path seams to the back (+Y) of each layer. Supports rotation for slicing at an angle.
    • Ignore Holes: Boolean option to omit interior hole perimeters and generate only the outer shell boundaries.
  • Slice Shells (Layers): Slices a SlicingObject into 2D SlicePaths using an explicit list of layer heights rather than fixed layer intervals. This ensures multiple objects sliced separately align precisely at identical layer elevations. Automatically filters layers within the mesh's Z-bounds, aligns seams to the back (+Y), and supports rotation for slicing at an angle.
    • Mesh: Input mesh data (SlicingObject, SlicingCollection, SlicingGroup, or lists).
    • Layers: List of float numbers representing the slicing Z heights (e.g. from the Layers node).
    • Rotation: 3D vector/Euler rotation values.
    • Ignore Holes: Boolean option to omit interior hole perimeters and generate only outer shell boundaries.
  • Seam Placement: Repositions the starting vertex (seam) of closed slice paths (including outer contours and interior holes) to the intersection points between the slice paths and a guide/seam mesh. If there is no intersection for a given path, its seam remains unchanged. Agnostic to mesh input type (SlicingObject, SlicingCollection, SlicingGroup, or lists).
    • Mesh: Input cutting mesh socket.
    • Seam Staggering: Float input socket specifying a distance in millimeters to shift seams along the perimeter alternating layer-by-layer (+stagger on even layers, -stagger on odd layers) to avoid vertical seam alignment weak spots. Can also be used standalone without a cutting mesh.
    • Mode: Strategy for choosing intersection when multiple intersections occur (Closest to Seam, First Intersection, or Mesh Centroid).
    • Acquire Transforms: Checkbox to automatically apply upstream transformation metadata from SlicePaths (such as from Transform Geometry or Drop Geometry) to the cutting mesh so that the cutting geometry aligns with the paths as in the viewport.
  • Buffer Shells: Offsets/buffers 2D SlicePaths. Supports rotated offsetting and multiple miter types.
  • Buffer Shells Multiple: Offsets 2D SlicePaths with multiple buffer passes.
    • Outputs:
      • Paths: Interleaved collection of all buffered shell passes.
      • Outermost Path: The outermost generated shell path.
      • Innermost Path: The innermost generated shell path.
  • 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.
  • 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.
  • Simplify Paths: Simplifies SlicePaths geometry using the Douglas-Peucker algorithm.
  • Infill: Generates a cross-hatch grid or parallel lines clipped by boundary paths.
    • Infill Type: Switch between Grid (cross-hatch), Rectilinear (alternating parallel lines), and Lines (parallel lines in one direction).
    • 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.
  • Overhang Mask: Computes the accumulated overhang mask for each layer, propagating support requirements from top to bottom.
  • Path Operations: Multi-input joiner node performing composite geometric, boolean, and interleaving operations on SlicePaths.
    • Operations:
      • Zip paths: Interleaves paths from all inputs layer by layer.
      • Extend paths: Appends paths sequentially.
      • Maximum coverage: Computes the union of all input paths across each layer.
      • Minimum coverage: Computes the intersection of all input paths per layer, preserving single-path/input layers.
      • Intersection: Computes the standard boolean intersection of all input paths across each layer.
      • Subtract: Subtracts subsequent inputs from the first input.
      • Exclusive or: Computes symmetric difference across all inputs.
    • Connect along boundary: Boolean option to connect clipped open segments along the boundary of the clipping polygon.
    • Acquire Transforms: Checkbox to automatically apply upstream transformation metadata from the primary input (SlicePaths) to subsequent input paths so that they align as in the viewport.
  • Math: Float math operations.
  • Integer Math: Simple integer operations (Add, Multiply, etc.).

PDF Exporter

  • Assign PDF Properties: Assigns line width (mm) and line color PDF export properties to geometry (SlicingObject, SlicingCollection, SlicingGroup, or SlicePaths).
    • Geometry: Generic geometry input socket (accepts SLICESOCK_Mesh, SLICESOCK_Paths, or SLICESOCK_Geometry).
    • Line Width: Input socket / float property for line width in mm.
    • Line Color: Color property for stroke color.
  • Assign PDF Object Properties: Assigns custom settings/properties to geometry (SlicingObject, SlicingCollection, SlicingGroup, or SlicePaths) for rendering in PDF properties tables and object callout labels.
    • Geometry: Generic geometry input socket (accepts SLICESOCK_Mesh, SLICESOCK_Paths, or SLICESOCK_Geometry).
    • Settings: Input socket accepting configuration settings or property items.
  • Mesh to PDF: Generates a 1:1 true-scale 2D top-view (+Z orthographic) vector PDF from a SlicingGroup or SlicingCollection with a custom grid and background color. Subpanel menus are collapsed by default.
    • Template: File naming template string for exported PDF files when saving to a folder (default: {object_name}-{size_x_mm}x{size_y_mm}-{today_date_iso}.pdf). Supports placeholders {object_name}, {size_x_mm}, {size_y_mm} (the whole PDF page dimensions in mm), {today_date_iso} (current ISO date YYYY-MM-DD), and custom object attributes.
    • Technical Drawing Header: Collapsible menu containing string inputs for technical drawing info (Company, Part Name, Drawing No., Author, Revision, Material, Tolerance). If Part Name is left empty, it automatically defaults to the name of the first object being rendered. Automatically computes ISO date and scale length (1:1). Renders an ISO/DIN technical drawing header table on the bottom-right of the drawing.
    • Geometry: Input socket accepting a single geometry (SlicingGroup, SlicingCollection, or SlicingObject). Join multiple geometries using Join Geometry nodes.
    • SlicePaths: Input socket accepting SlicePaths (reserved for path rendering).
    • Folder: Target folder or PDF file path on disk.
    • Settings: Input socket accepting configuration settings or attribute names to render as <name>: <value> next to each object.
    • Wireframe: Checkbox to render all projected 3D wireframe edges.
    • Boundary (1 Face): Checkbox to render open mesh boundary edges owned by only 1 face.
    • Contour: Checkbox to render outer boundary silhouette contour.
    • Crease Angle: Checkbox to render crease lines above specified dihedral angle.
    • Bounding Box: Checkbox to render the 2D bounding box rectangle of each SlicingObject.
    • BBox Color: Color picker for the bounding box rectangle lines (default blue).
    • Show Name: Checkbox to render the object name to the right of the rightmost vertex of each SlicingObject.
    • Holes: Checkbox to render circular bore/hole diameter callouts (Ø) with ISO 129-1 compliant markings.
    • Arcs: Checkbox to render arc cutouts and corner fillet radius callouts (R) with ISO 129-1 compliant markings.
    • Chamfers: Checkbox to render bevel/chamfer callouts (C) with ISO 129-1 compliant markings.
    • Step Features: Checkbox to render interior step/notch feature segment length callouts with ISO 129-1 compliant markings.
    • Font Size (pt): Font size in PostScript points for all text labels and measurement callouts. Set to 0 for automatic sizing (equal to minor grid spacing).
    • Margin (mm): Margin around the geometry grid in mm.
    • Background: Color picker for the canvas background.
    • Wireframe: Color picker for the wireframe lines and grid.

Gcode Processing

  • Paths to Gcode: Converts SlicePaths into G-code blocks.
    • Header: Toggles the generation of standard NodeSlicer G-code headers and units setup.
  • Gcode Block: Manual text area for entering raw G-code.
  • Gcode Regex Replace: Performs regex search and replace on G-code.
  • Assign Metadata: Injects custom metadata comments into G-code.
  • Gcode Helper: Utility helper functions for G-code stream modifications.
  • Load Gcode: Reads a G-code file from disk.

Utility & Joiners

  • Objects to List: Multi-input list joiner that bundles objects into a list[bpy.types.Object] with LIST socket shape. Flattens incoming lists.
  • Meshes to List: Multi-input list joiner that bundles meshes into a list[SlicingCollection] with LIST socket shape. Flattens incoming lists.
  • Paths to List: Multi-input list joiner that bundles toolpaths into a list[SlicePaths] with LIST socket shape. Flattens incoming lists.
  • Flatten Path List: Flattens a list[SlicePaths] into a single SlicePaths.
    • Mode: Choose between Zip (interleaves paths layer by layer across all list items) and Extend (appends paths sequentially from all list items).
    • Paths: Input socket accepting a list of toolpaths (display_shape='LIST').
    • Paths: Output socket delivering the unified single toolpath.
  • Gcodes to List: Multi-input list joiner that bundles G-code strings into a list[str] with LIST socket shape. Flattens incoming lists.
  • Group to List: Decomposes a SlicingGroup into a list[SlicingCollection]. Output socket Collections displays LIST socket shape.
  • List to Group: Converts a list[SlicingCollection] into a single SlicingGroup. Input socket Collections has LIST socket shape, output socket Group outputs a single group.
  • Join Mesh Parts: Merges multiple SlicingObject instances into one SlicingCollection. Flattens incoming lists.
  • Join Mesh Groups: Combines multiple SlicingCollection instances into a SlicingGroup. Flattens incoming lists.
  • Path Operations: Multi-input joiner performing Zip, Extend, Maximum coverage, Minimum coverage, Intersection, Subtract, and XOR operations. The first input can be a list, in which case the operation runs per-element against the same secondary inputs.
  • Join Gcode: Concatenates multiple G-code inputs. If no input is a list, concatenates scalar strings into a single string (CIRCLE). If one or more inputs are lists (which must all be the same length), outputs a list of strings (LIST) where each element at index i is joined with static elements broadcast across all indices.
  • Join Settings: Sequentially merges multiple override dictionaries. Later inputs overwrite earlier ones for matching keys.
  • Join Execution: Synchronizes sequential execution flows.

Action & I/O

  • Gcode to File: Writes G-code string to a file on disk. Accepts an optional Name input (which applies zero-padded digit suffixes when multiple G-codes are supplied, matching the preview mesh logic). If not plugged, uses the object names extracted from G-code metadata.
    • 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.
  • Gcode to Text Block: Creates a new Blender text block containing the G-code and opens it in any active text editors.
  • Start Print: Sends G-code directly to a network printer.
  • 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.
  • Gcode to Preview Mesh: Decodes G-code and creates a Blender mesh ("Debug" object) for visualization.
  • Executor: Executes sub-tree node chains.
    • Auto-refresh: Automatically re-evaluates the connected subtrees whenever scene objects or node tree dependencies change.
    • Log: Calculates and profiles execution performance across all evaluated nodes, outputting a summary table (node_type, execution_count, avg_execution_time, tot_execution_time) into the "Performance" text block in an open text editor.
  • Test: Triggers evaluation for debugging purposes.