76 lines
4.2 KiB
Markdown
76 lines
4.2 KiB
Markdown
# 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 |
|
|
|
|
## 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.
|
|
- **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.
|
|
- **Rotation**: Input for Euler rotation vectors.
|
|
- **Printer Intrinsics**: Configures bed size and extrusion rates.
|
|
- **Gcode Block**: Manual text area for entering raw G-code.
|
|
|
|
### Geometry Processing
|
|
- **Get Mesh**: Converts a Blender Object into internal `SlicingObject` format.
|
|
- **Get Paths**: Extracts existing edges from a mesh as paths.
|
|
- **Slice Shells**: Slices a `SlicingObject` into 2D `SlicePaths` at a given layer height.
|
|
- **Buffer Shells**: Offsets/buffers 2D `SlicePaths`. Supports rotated offsetting and multiple miter types.
|
|
- **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.
|
|
- **Boolean Paths**: Performs 2D boolean operations (`UNION`, `INTERSECTION`, `DIFFERENCE`, `XOR`) on multiple slice sets.
|
|
|
|
### 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.
|
|
- **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.
|
|
- **Gcode to Text Block**: Creates a new Blender text block containing the G-code and opens it in any active text editors.
|
|
- **Gcode to Mesh**: Decodes G-code and creates a Blender mesh ("Debug" object) for visualization.
|
|
- **Test**: Triggers evaluation for debugging purposes.
|