61 lines
3.3 KiB
Markdown
61 lines
3.3 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_Mesh` | `SlicingObject` | NumPy NDArray (Triangles) | Internal mesh data (Transformed/Scaled) |
|
|
| `SLICESOCK_Paths` | `list[np.ndarray]` | List of paths (N, 3) | 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, 4, 3)`.
|
|
- `N`: Number of triangles.
|
|
- `[i, 0:3, :]`: The three vertices of the $i$-th triangle.
|
|
- `[i, 3, :]`: The face normal 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).
|
|
|
|
### Paths (`SLICESOCK_Paths`)
|
|
A `list[np.ndarray]` (each `(N, 3)`) containing toolpaths or slice results.
|
|
- **Content**: Can be open or closed segments. When generated from `Slice Shells`, they are guaranteed to be closed loops forming valid manifold boundaries.
|
|
- **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`.
|
|
|
|
## Nodes
|
|
|
|
### Input Nodes
|
|
- `SLICENODE_InputFloat`: Single float input.
|
|
- `SLICENODE_InputInt`: Single integer input.
|
|
- `SLICENODE_InputString`: Single string/path input.
|
|
- `SLICENODE_InputObject`: Blender object picker.
|
|
- `SLICENODE_GcodeBlock`: Manual text area for entering raw G-code.
|
|
|
|
### Processing Nodes
|
|
- `SLICENODE_GetMesh`: Converts a Blender Object into internal `SlicingObject` format.
|
|
- `SLICENODE_SliceShells`: Slices a `SlicingObject` into 2D `Paths` at a given layer height.
|
|
- `SLICENODE_BufferShells`: Offsets/buffers 2D `Paths` using a "Distance" parameter. Buffers each Z-layer independently to maintain 3D structure and uses winding rules to correctly handle nested holes.
|
|
- `SLICENODE_GridInfill`: Generates a grid of lines clipped by boundary paths.
|
|
- `SLICENODE_PathsToGcode`: Converts `Paths` into G-code blocks.
|
|
|
|
### Joiner Nodes (Variable Inputs)
|
|
- `SLICENODE_JoinMesh`: Merges multiple `SlicingObject` instances into one.
|
|
- `SLICENODE_JoinPaths`: Merges multiple paths.
|
|
- `SLICENODE_JoinGcode`: Concatenates multiple G-code strings with newline separators.
|
|
|
|
### Action Nodes (Executable)
|
|
- `SLICENODE_GcodeToFile`: Writes G-code string to a file on disk.
|
|
- `SLICENODE_GcodeToMesh`: Decodes G-code and creates a Blender mesh (Edges) for visualization/debugging.
|
|
- `SLICENODE_LoadGcode`: Reads a G-code file from disk into a string.
|
|
- `SLICENODE_Test`: Triggers evaluation for debugging purposes.
|