translation

This commit is contained in:
Nicolas Predella 2026-07-30 14:51:57 +03:00
parent 46582f82d6
commit 4b75ecb803
5 changed files with 23 additions and 13 deletions

View file

@ -512,8 +512,21 @@ class SLICENODE_DropGeometry(SliceNode):
self.add_input("SLICESOCK_Mesh", "Mesh") self.add_input("SLICESOCK_Mesh", "Mesh")
self.add_input("SLICESOCK_Float", "Z") self.add_input("SLICESOCK_Float", "Z")
self.add_output("SLICESOCK_Mesh", "Mesh") self.add_output("SLICESOCK_Mesh", "Mesh")
self.add_output("SLICESOCK_VectorRo", "Translation")
def evaluate_output(self, socket_name: str, **_kwargs) -> SlicingCollection | SlicingGroup | None: def evaluate_output(self, socket_name: str, **_kwargs) -> SlicingCollection | SlicingGroup | tuple[float, float, float] | None:
if socket_name == "Translation":
mesh_data: SlicingCollection | SlicingGroup | None = self.resolve("Mesh")
if not mesh_data:
return None
z = self.resolve('Z')
if z is None:
z = 0.0
assert mesh_data.min_z is not None
min_z = round(mesh_data.min_z, 6)
offset_z = float(z - min_z)
return (0.0, 0.0, offset_z)
if socket_name != "Mesh": if socket_name != "Mesh":
return None return None

View file

@ -342,6 +342,7 @@ class SLICENODE_Infill(SliceNode):
items=[ items=[
('GRID', "Grid", "Cross-hatch grid"), ('GRID', "Grid", "Cross-hatch grid"),
('RECTILINEAR', "Rectilinear", "Alternating parallel lines"), ('RECTILINEAR', "Rectilinear", "Alternating parallel lines"),
('LINES', "Lines", "Parallel lines in one direction"),
], ],
default='GRID', default='GRID',
update=notify_tree_changed update=notify_tree_changed

View file

@ -314,17 +314,9 @@ class SLICENODE_GcodeToMesh(ExecSliceNode):
if not base_mesh_name: if not base_mesh_name:
base_mesh_name = "GcodePreview" base_mesh_name = "GcodePreview"
# Filter out empty inputs but keep structure to index properly for i, gcode in enumerate(gcodes):
valid_gcodes = [g for g in gcodes if g] if not gcode: continue
if not valid_gcodes:
if base_mesh_name in bpy.data.objects:
obj = bpy.data.objects[base_mesh_name]
if obj.type == 'MESH':
obj.data.clear_geometry()
return 'empty'
for i, gcode in enumerate(valid_gcodes):
mesh_name = base_mesh_name if i == 0 else f"{base_mesh_name}_{i+1}" mesh_name = base_mesh_name if i == 0 else f"{base_mesh_name}_{i+1}"
try: try:
self._process_gcode(gcode, mesh_name, operator) self._process_gcode(gcode, mesh_name, operator)

View file

@ -1495,6 +1495,8 @@ def infill_slice(slice_paths: 'SlicePaths', density: float, rotation_deg: float
current_grid_paths = vertical_lines + horizontal_lines current_grid_paths = vertical_lines + horizontal_lines
elif infill_type == 'RECTILINEAR': elif infill_type == 'RECTILINEAR':
current_grid_paths = vertical_lines if layer_idx % 2 == 0 else horizontal_lines current_grid_paths = vertical_lines if layer_idx % 2 == 0 else horizontal_lines
elif infill_type == 'LINES':
current_grid_paths = vertical_lines
else: else:
current_grid_paths = [] current_grid_paths = []

View file

@ -68,9 +68,11 @@ All nodes are found in the **Add (Shift+A)** menu under the **SliceNodes** categ
- **Translation**: 3D vector specifying the translation offset. - **Translation**: 3D vector specifying the translation offset.
- **Rotation**: 3D vector/Euler rotation values. - **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`). - **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. - **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. - **Mesh**: Input mesh data.
- **Z**: Target minimum Z coordinate (defaults to `0.0`). - **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.
- **Get Paths**: Extracts existing edges from a mesh as paths. - **Get Paths**: Extracts existing edges from a mesh as paths.
- **Extrusion Multiplier Attribute**: Mesh attribute to use for per-segment extrusion rates. - **Extrusion Multiplier Attribute**: Mesh attribute to use for per-segment extrusion rates.
- **Feedrate Attribute**: Mesh attribute to use for per-segment feedrates. - **Feedrate Attribute**: Mesh attribute to use for per-segment feedrates.
@ -92,7 +94,7 @@ All nodes are found in the **Add (Shift+A)** menu under the **SliceNodes** categ
- **Distance**: The offset distance (positive for left side, negative for right side). - **Distance**: The offset distance (positive for left side, negative for right side).
- **Rotation**: Optional Euler rotation for non-planar offsetting. - **Rotation**: Optional Euler rotation for non-planar offsetting.
- **Infill**: Generates a cross-hatch grid or parallel lines clipped by boundary paths. - **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). - **Infill Type**: Switch between **Grid** (cross-hatch), **Rectilinear** (alternating parallel lines), and **Lines** (parallel lines in one direction).
- **Density**: Distance between lines in units. - **Density**: Distance between lines in units.
- **Infill Rotation**: Base rotation of the infill pattern. - **Infill Rotation**: Base rotation of the infill pattern.
- **Layer Rotation**: Rotation of the entire slice to align infill with specific planes. - **Layer Rotation**: Rotation of the entire slice to align infill with specific planes.