3mf generation complete

This commit is contained in:
Nicolas Predella 2026-05-15 16:03:22 +03:00
parent 43e565932f
commit 3a856358dc

View file

@ -1078,8 +1078,23 @@ class SLICENODE_PrusaslicerSlice(ExecSliceNode):
slicing_group = SlicingGroup([obj])
# Offset by the bed center
def parse_bed_center(bed_shape_str: str) -> np.ndarray:
try:
points = []
for p in bed_shape_str.split(','):
x, y = map(float, p.split('x'))
points.append((x, y))
points_np = np.array(points)
return (points_np.min(axis=0) + points_np.max(axis=0)) / 2.0
except:
return np.array([125.0, 105.0])
bed_shape = cache.profiles[printer_id].all_conf_dict.get('bed_shape', '0x0,250x0,250x210,0x210')
bed_center = parse_bed_center(bed_shape)
a_z = -slicing_group.min_z
slicing_group.offset()
offset = np.array([bed_center[0], bed_center[1], a_z]) - np.array([slicing_group.center_xy[0], slicing_group.center_xy[1], 0])
slicing_group.offset(offset)
# Generate the ConfigWriter with no overrides
conf_writer = cache.generate_conf_writer(printer_id, filament_ids, print_id, overrides={})