Files
PerfectCoffee/model_assets/juicer/build_minex_mechanism.py
T
Yanchen f5d4f6dd41 feat: add juicer mechanism with continuous pressing animation
Add the Minex-inspired juicer model with synchronized rotary pressing, peel discharge, generation scripts, validation reports, previews, and reference materials.

Status: work in progress. The juicer model is not complete yet and still needs further geometric and motion refinements.
2026-11-16 18:55:11 +08:00

1152 lines
52 KiB
Python

import bpy
import bmesh
import math
import json
import hashlib
from pathlib import Path
from mathutils import Vector, Matrix
OUT = Path(__file__).resolve().parent
DOC = OUT.parents[1] / 'HOW_ZMUEX_juicer_work.md'
bpy.ops.wm.read_factory_settings(use_empty=True)
bpy.context.preferences.filepaths.save_version = 0
scene = bpy.context.scene
scene.unit_settings.system = 'METRIC'
scene.unit_settings.length_unit = 'METERS'
scene.unit_settings.scale_length = 1
scene.frame_start = 1
scene.frame_end = 360
scene.render.fps = 24
def collection(name):
coll = bpy.data.collections.new(name)
scene.collection.children.link(coll)
return coll
exterior = collection('01_Exterior_Cabinet_And_Controls')
hood_coll = collection('02_Removable_Transparent_Hood')
hopper_coll = collection('03_L_Hopper_Gate_And_Ramp')
disk_coll = collection('04_Four_Hemispherical_Pocket_Disc')
blade_coll = collection('05_External_Tangential_Blade_And_Spring_Ejector')
press_coll = collection('06_Three_Spherical_Pressing_Heads')
bin_coll = collection('07_Solid_Juice_Guide_And_Separate_Collectors')
fruit_coll = collection('08_Whole_Fruit_Halves_And_Pressed_Residue')
juice_coll = collection('09_Juice_Flow_And_Collection')
studio = collection('STUDIO_Not_Part_Of_Product')
root = bpy.data.objects.new('Juicer_User_Spec_Root', None)
exterior.objects.link(root)
root.empty_display_size = 0.04
root['source_document'] = 'HOW_ZMUEX_juicer_work.md'
root['source_sha256'] = hashlib.sha256(DOC.read_bytes()).hexdigest()
root['mechanism'] = 'Four hemispherical pockets; external tangential blade; three spherical heads on an equilateral triangle'
root['axes'] = 'Disc and three-head pressing unit rotate around parallel Y axes. Circular faces lie in XOZ and face machine front +Y. Both rotate clockwise continuously when viewed from +Y.'
root['revision'] = 'Reference 01:59-02:06: continuous synchronized rotors, fruit carried through the rolling nip, no dwell or upward ram, squeezed hollow peels released after engagement'
root['mechanism_color_palette'] = 'Light blue-gray machinery contrasts with orange fruit and pressed peels'
root['motion_scope'] = 'Slow visualization of the supplied 01:59-02:06 reference; constant four-pocket/three-head angular speed ratio, not manufacturer RPM calibration'
root['reference_video'] = 'model_assets/reference/juicer/ZMUEX_working_video.mp4'
root['reference_segment_seconds'] = [119,126]
root['press_motion'] = 'Disc advances -90/64 degrees per frame; press advances 4/3 times that angle. Neither rotor stops or translates. Each half follows its pocket through the rolling contact arc.'
root['collectors'] = 'Separate open juice box without spout or handle, and a separate residue box'
def empty(name, loc, coll, parent=root):
obj = bpy.data.objects.new(name, None)
coll.objects.link(obj)
obj.parent = parent
obj.location = loc
obj.empty_display_size = 0.014
return obj
def move_to(obj, coll, parent):
for old in list(obj.users_collection):
old.objects.unlink(obj)
coll.objects.link(obj)
if parent is not None:
obj.parent = parent
obj.matrix_parent_inverse = Matrix.Identity(4)
return obj
def material(name, color, metallic=0, roughness=0.4, coat=0):
mat = bpy.data.materials.new(name)
mat.use_nodes = True
mat.diffuse_color = (*color, 1)
shader = mat.node_tree.nodes.get('Principled BSDF')
shader.inputs['Base Color'].default_value = (*color, 1)
shader.inputs['Metallic'].default_value = metallic
shader.inputs['Roughness'].default_value = roughness
shader.inputs['Coat Weight'].default_value = coat
return mat
teal = material('Cabinet_Deep_Teal', (0.010, 0.095, 0.102), 0.1, 0.31, 0.18)
teal_edge = material('Cabinet_Teal_Edge', (0.017, 0.125, 0.13), 0.08, 0.34)
black = material('Black_Rubber', (0.009, 0.013, 0.015), 0, 0.5)
graphite = material('Graphite_Control_And_Frame', (0.019, 0.026, 0.029), 0.08, 0.36)
back_mat = material('Chamber_Backplate', (0.085, 0.106, 0.113), 0.12, 0.43)
hopper_mat = material('Hopper_Matte_Black', (0.009, 0.012, 0.013), 0, 0.58)
hopper_mat.node_tree.nodes.get('Principled BSDF').inputs['Specular IOR Level'].default_value = 0.06
orange = material('Mechanism_Light_Blue_Gray_Polymer', (0.56, 0.65, 0.70), 0, 0.38, 0.04)
orange_dark = material('Mechanism_Recess_Blue_Gray', (0.20, 0.27, 0.32), 0, 0.41)
orange_edge = material('Mechanism_Light_Edge', (0.78, 0.84, 0.87), 0, 0.34)
steel = material('Brushed_Stainless', (0.52, 0.59, 0.62), 0.86, 0.26)
bin_metal = material('Collector_Brushed_Dark_Steel', (0.16, 0.19, 0.21), 0.65, 0.30)
chrome = material('Polished_Steel', (0.72, 0.79, 0.82), 0.94, 0.17)
white = material('Indicator_White', (0.80, 0.90, 0.92), 0, 0.35)
blue = material('LCD_Blue', (0.015, 0.06, 0.60), 0, 0.27)
blue.node_tree.nodes.get('Principled BSDF').inputs['Emission Color'].default_value = (0.01, 0.04, 0.6, 1)
blue.node_tree.nodes.get('Principled BSDF').inputs['Emission Strength'].default_value = 0.65
juice_mat = material('Fresh_Orange_Juice', (0.95, 0.31, 0.008), 0, 0.27)
juice_mat.node_tree.nodes.get('Principled BSDF').inputs['Subsurface Weight'].default_value = 0.05
pith = material('Orange_Pith', (0.96, 0.77, 0.36), 0, 0.49)
flesh = material('Orange_Flesh', (1.0, 0.43, 0.035), 0, 0.36)
flesh.node_tree.nodes.get('Principled BSDF').inputs['Subsurface Weight'].default_value = 0.08
seed_mat = material('Orange_Seeds', (0.93, 0.81, 0.51), 0, 0.4)
peel = material('Orange_Peel_Procedural', (0.8, 0.14, 0.003), 0, 0.47)
nodes = peel.node_tree.nodes
links = peel.node_tree.links
shader = nodes.get('Principled BSDF')
noise = nodes.new('ShaderNodeTexNoise')
noise.inputs['Scale'].default_value = 125
noise.inputs['Detail'].default_value = 3
ramp = nodes.new('ShaderNodeValToRGB')
ramp.color_ramp.elements[0].color = (0.36, 0.027, 0.001, 1)
ramp.color_ramp.elements[1].color = (0.80, 0.14, 0.002, 1)
links.new(noise.outputs['Fac'], ramp.inputs[0])
links.new(ramp.outputs['Color'], shader.inputs['Base Color'])
bump = nodes.new('ShaderNodeBump')
bump.inputs['Strength'].default_value = 0.25
bump.inputs['Distance'].default_value = 0.00045
links.new(noise.outputs['Fac'], bump.inputs['Height'])
links.new(bump.outputs['Normal'], shader.inputs['Normal'])
clear = bpy.data.materials.new('Clear_Tritan_Thin_Shell')
clear.use_nodes = True
clear.diffuse_color = (0.86, 0.93, 0.95, 0.18)
n = clear.node_tree.nodes
n.clear()
out = n.new('ShaderNodeOutputMaterial')
transparent = n.new('ShaderNodeBsdfTransparent')
transparent.inputs[0].default_value = (0.96, 0.985, 1, 1)
glass = n.new('ShaderNodeBsdfGlass')
glass.inputs['Color'].default_value = (0.93, 0.97, 0.985, 1)
glass.inputs['Roughness'].default_value = 0.025
glass.inputs['IOR'].default_value = 1.46
mix = n.new('ShaderNodeMixShader')
mix.inputs[0].default_value = 0.035
links = clear.node_tree.links
links.new(transparent.outputs[0], mix.inputs[1])
links.new(glass.outputs[0], mix.inputs[2])
links.new(mix.outputs[0], out.inputs['Surface'])
def assign(obj, mat):
obj.data.materials.append(mat)
return obj
def bevel(obj, width=0.001, segments=3):
if width:
mod = obj.modifiers.new('Soft_Edges', 'BEVEL')
mod.width = width
mod.segments = segments
if obj.type == 'MESH':
mod = obj.modifiers.new('Weighted_Normals', 'WEIGHTED_NORMAL')
mod.keep_sharp = True
def mesh(name, vertices, faces, mat, coll, parent=root, smooth=True):
data = bpy.data.meshes.new(name + '_Mesh')
data.from_pydata(vertices, [], faces)
data.update()
bm = bmesh.new()
bm.from_mesh(data)
bmesh.ops.recalc_face_normals(bm, faces=list(bm.faces))
if bm.calc_volume(signed=True) < 0:
bmesh.ops.reverse_faces(bm, faces=list(bm.faces))
bm.to_mesh(data)
bm.free()
obj = bpy.data.objects.new(name, data)
coll.objects.link(obj)
obj.parent = parent
assign(obj, mat)
for poly in data.polygons:
poly.use_smooth = smooth
return obj
def box(name, loc, dims, mat, coll, parent=root, edge=0.001, rot=None):
bpy.ops.mesh.primitive_cube_add(size=1, location=loc)
obj = bpy.context.object
obj.name = name
obj.dimensions = dims
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
if rot is not None:
obj.rotation_euler = rot
move_to(obj, coll, parent)
assign(obj, mat)
bevel(obj, edge)
return obj
def cyl(name, loc, radius, depth, mat, coll, parent=root, axis='Z', edge=0.0005, vertices=96):
bpy.ops.mesh.primitive_cylinder_add(vertices=vertices, radius=radius, depth=depth, location=loc)
obj = bpy.context.object
obj.name = name
if axis == 'Y':
obj.rotation_euler.x = math.pi / 2
elif axis == 'X':
obj.rotation_euler.y = math.pi / 2
move_to(obj, coll, parent)
assign(obj, mat)
for poly in obj.data.polygons:
poly.use_smooth = len(poly.vertices) == 4
bevel(obj, edge)
return obj
def sphere(name, loc, radius, mat, coll, parent=root, scale=(1, 1, 1)):
bpy.ops.mesh.primitive_uv_sphere_add(segments=48, ring_count=32, radius=radius, location=loc)
obj = bpy.context.object
obj.name = name
obj.scale = scale
move_to(obj, coll, parent)
assign(obj, mat)
for poly in obj.data.polygons:
poly.use_smooth = True
return obj
def torus(name, loc, major, minor, mat, coll, parent=root, axis='Z'):
bpy.ops.mesh.primitive_torus_add(major_radius=major, minor_radius=minor, major_segments=96, minor_segments=16, location=loc)
obj = bpy.context.object
obj.name = name
if axis == 'Y':
obj.rotation_euler.x = math.pi / 2
move_to(obj, coll, parent)
assign(obj, mat)
for poly in obj.data.polygons:
poly.use_smooth = True
return obj
def lathe(name, profile, loc, mat, coll, parent=root, axis='Z', segments=96):
vertices = []
rings = []
for r, h in profile:
if r < 1e-8:
rings.append([len(vertices)])
vertices.append((0, 0, h))
else:
ring = []
for j in range(segments):
a = math.tau * j / segments
ring.append(len(vertices))
vertices.append((r * math.cos(a), r * math.sin(a), h))
rings.append(ring)
faces = []
for i in range(len(rings)):
first = rings[i]
second = rings[(i + 1) % len(rings)]
for j in range(segments):
k = (j + 1) % segments
if len(first) == 1 and len(second) == 1:
continue
if len(first) == 1:
faces.append((first[0], second[k], second[j]))
elif len(second) == 1:
faces.append((first[j], first[k], second[0]))
else:
faces.append((first[j], first[k], second[k], second[j]))
obj = mesh(name, vertices, faces, mat, coll, parent)
obj.location = loc
if axis == 'Y':
obj.rotation_euler.x = -math.pi / 2
elif axis == '-Y':
obj.rotation_euler.x = math.pi / 2
return obj
def line(name, points, radius, mat, coll, parent=root, closed=False):
data = bpy.data.curves.new(name + '_Curve', 'CURVE')
data.dimensions = '3D'
data.bevel_depth = radius
data.bevel_resolution = 3
data.use_fill_caps = True
spline = data.splines.new('POLY')
spline.points.add(len(points) - 1)
for point, value in zip(spline.points, points):
point.co = (*value, 1)
spline.use_cyclic_u = closed
obj = bpy.data.objects.new(name, data)
coll.objects.link(obj)
obj.parent = parent
assign(obj, mat)
return obj
def rounded_rect(w, h, r, steps=14):
points = []
corners = [(w/2-r, h/2-r, 0), (-w/2+r, h/2-r, math.pi/2), (-w/2+r, -h/2+r, math.pi), (w/2-r, -h/2+r, 3*math.pi/2)]
for cx, cy, start in corners:
for i in range(steps+1):
a = start + math.pi * i / (2*steps)
points.append((cx+r*math.cos(a), cy+r*math.sin(a)))
return points
def loft(name, profiles, mat, coll, parent=root, edge=0.001):
vertices = []
for z, w, d, r, cx, cy in profiles:
vertices.extend((x+cx, y+cy, z) for x, y in rounded_rect(w, d, r))
count = len(vertices)//len(profiles)
faces = []
for ring in range(len(profiles)-1):
for j in range(count):
k = (j+1) % count
faces.append((ring*count+j, ring*count+k, (ring+1)*count+k, (ring+1)*count+j))
faces.append(tuple(reversed(range(count))))
faces.append(tuple((len(profiles)-1)*count+j for j in range(count)))
obj = mesh(name, vertices, faces, mat, coll, parent)
if edge:
bevel(obj, edge)
return obj
def prism_xz(name, outline, y0, y1, mat, coll, parent=root, edge=0.001):
count = len(outline)
vertices = [(x, y0, z) for x,z in outline] + [(x, y1, z) for x,z in outline]
faces = [tuple(range(count)), tuple(reversed(range(count, 2*count)))]
for j in range(count):
k = (j+1) % count
faces.append((j, count+j, count+k, k))
obj = mesh(name, vertices, faces, mat, coll, parent)
if edge:
bevel(obj, edge)
return obj
def boolean(obj, cutter):
if obj.parent is None and cutter.parent is None:
bpy.ops.object.select_all(action='DESELECT')
obj.select_set(True)
cutter.select_set(True)
bpy.context.view_layer.objects.active = obj
bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
bpy.context.view_layer.update()
bpy.context.view_layer.objects.active = obj
mod = obj.modifiers.new('Applied_Construction_Boolean', 'BOOLEAN')
mod.operation = 'DIFFERENCE'
mod.solver = 'MANIFOLD'
mod.object = cutter
bpy.context.view_layer.update()
bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cutter, do_unlink=True)
def union(obj, cutter):
bpy.context.view_layer.update()
bpy.context.view_layer.objects.active = obj
mod = obj.modifiers.new('Applied_Relief_Union', 'BOOLEAN')
mod.operation = 'UNION'
mod.solver = 'MANIFOLD'
mod.object = cutter
bpy.context.view_layer.update()
bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cutter, do_unlink=True)
def text(name, body, loc, size, mat, coll, parent=root):
data = bpy.data.curves.new(name + '_Font', 'FONT')
data.body = body
data.size = size
data.align_x = 'CENTER'
data.align_y = 'CENTER'
obj = bpy.data.objects.new(name, data)
coll.objects.link(obj)
obj.parent = parent
obj.location = loc
obj.rotation_euler = (math.pi/2, 0, math.pi)
assign(obj, mat)
return obj
def key(obj, frame, loc=None, rot=None, scale=None):
if loc is not None:
obj.location = loc
obj.keyframe_insert(data_path='location', frame=frame)
if rot is not None:
obj.rotation_euler = rot
obj.keyframe_insert(data_path='rotation_euler', frame=frame)
if scale is not None:
obj.scale = scale
obj.keyframe_insert(data_path='scale', frame=frame)
body = loft('Cabinet_Main_Body', [
(0.031, 0.318, 0.288, 0.022, 0, -0.024),
(0.046, 0.326, 0.296, 0.024, 0, -0.024),
(0.276, 0.337, 0.310, 0.025, 0, -0.024),
(0.294, 0.341, 0.314, 0.026, 0, -0.024),
], teal, exterior, root, 0.002)
boolean(body, box('TEMP_Interior', (0, -0.024, 0.165), (0.301, 0.262, 0.235), black, exterior, None, 0.008))
boolean(body, box('TEMP_Juice_Box_Recess', (-0.112, 0.138, 0.121), (0.095, 0.194, 0.173), black, exterior, None, 0.008))
boolean(body, box('TEMP_Residue_Door', (0.048, 0.140, 0.147), (0.119, 0.10, 0.194), black, exterior, None, 0.007))
loft('Cabinet_Base_Plinth', [(0.012,0.349,0.366,0.025,0,0.005),(0.035,0.349,0.366,0.025,0,0.005)], graphite, exterior, root, 0.002)
for x in [-0.135,0.135]:
for y in [-0.135,0.130]:
cyl('Rubber_Foot', (x,y,0.008), 0.016, 0.015, black, exterior, root, edge=0.002)
for y in [-0.173]:
box('Rear_Service_Panel', (0,y,0.164), (0.271,0.005,0.187), graphite, exterior, root, 0.009)
for i in range(8):
box('Rear_Vent', (0,y-0.003,0.112+i*0.011), (0.15,0.002,0.003), black, exterior, root, 0.001)
band_outline = [(-0.171,0.350),(-0.12,0.329),(-0.055,0.302),(0.015,0.290),(0.094,0.309),(0.171,0.333),(0.171,0.282),(0.075,0.259),(-0.015,0.249),(-0.092,0.267),(-0.171,0.300)]
prism_xz('Curved_Black_Control_Band', band_outline, 0.141, -0.119, graphite, exterior, root, 0.002)
cyl('Power_Button_Rim', (-0.115,0.146,0.321), 0.010, 0.006, black, exterior, root, 'Y')
cyl('Power_Button', (-0.115,0.150,0.321), 0.0077, 0.004, graphite, exterior, root, 'Y')
line('Power_Symbol', [(-0.115,0.153,0.322),(-0.115,0.153,0.327)], 0.0004, white, exterior, root)
box('LCD_Bezel', (-0.041,0.146,0.283), (0.059,0.007,0.022), black, exterior, root, 0.003)
box('LCD_Screen', (-0.041,0.150,0.283), (0.050,0.001,0.015), blue, exterior, root, 0.001)
text('LCD_Status', '1 ORANGE', (-0.041,0.151,0.283), 0.0058, white, exterior, root)
door_pivot = empty('Residue_Service_Door_Hinge', (-0.012,0.141,0.052), exterior, root)
box('Residue_Service_Door', (0.060,0,0.094), (0.118,0.006,0.188), teal, exterior, door_pivot, 0.007)
box('Residue_Door_Inset', (0.060,0.0035,0.094), (0.095,0.001,0.158), teal_edge, exterior, door_pivot, 0.005)
box('Chamber_Rear_Wall', (0,-0.126,0.506), (0.327,0.014,0.330), back_mat, hood_coll, root, 0.032)
for x in [-0.125,0.125]:
box('Chamber_Backplate_Rib', (x,-0.112,0.510), (0.007,0.012,0.242), graphite, hood_coll, root, 0.002)
controls = [(-0.165,0.348),(-0.127,0.332),(-0.072,0.306),(0,0.289),(0.079,0.305),(0.165,0.330)]
def bottom(x):
for i in range(len(controls)-1):
a,b = controls[i],controls[i+1]
if a[0] <= x <= b[0]:
t = (x-a[0])/(b[0]-a[0])
t = t*t*(3-2*t)
return a[1]*(1-t)+b[1]*t
return controls[-1][1]
nx,nz = 64,18
verts = []
faces = []
for i in range(nx+1):
x = -0.165 + 0.330*i/nx
z0 = bottom(x)
z1 = 0.678-0.039*(abs(x)/0.165)**10
for j in range(nz+1):
t = j/nz
verts.append((x,0.111+0.019*(1-(x/0.165)**2)*math.sin(math.pi*t),z0+(z1-z0)*t))
for i in range(nx):
for j in range(nz):
a = i*(nz+1)+j
faces.append((a,a+nz+1,a+nz+2,a+1))
for side in [0,nx]:
indices = []
for j in range(nz+1):
v = verts[side*(nz+1)+j]
indices.append(len(verts))
verts.append((v[0],-0.120,v[2]))
for j in range(nz):
a = side*(nz+1)+j
faces.append((a,a+1,indices[j+1],indices[j]))
for j in [0,nz]:
indices = []
for i in range(nx+1):
v = verts[i*(nz+1)+j]
indices.append(len(verts))
verts.append((v[0],-0.120,v[2]))
for i in range(nx):
a = i*(nz+1)+j
faces.append((a,a+nz+1,indices[i+1],indices[i]))
hood = mesh('Transparent_Hood_With_Curved_Sides', verts, faces, clear, hood_coll, root)
solid = hood.modifiers.new('Tritan_1_6mm', 'SOLIDIFY')
solid.thickness = 0.0016
solid.offset = 0
for side in [-1,1]:
for z in [0.408,0.586]:
box('Hood_Latch', (side*0.171,0.044,z), (0.012,0.030,0.025), graphite, hood_coll, root, 0.003)
# L-shaped hopper: four positions on the long arm, a short turn and a fixed entrance ramp.
long_floor = box('L_Hopper_Long_Arm_Floor', (0.108,-0.007,0.689), (0.106,0.296,0.008), hopper_mat, hopper_coll, root, 0.012, (math.radians(3),0,0))
for x in [0.054,0.162]:
line('L_Hopper_Long_Raised_Edge', [(x,-0.153,0.713),(x,0.141,0.703)], 0.004, hopper_mat, hopper_coll, root)
box('L_Hopper_Short_Arm_Floor', (0.077,-0.110,0.688), (0.065,0.105,0.008), hopper_mat, hopper_coll, root, 0.010, (0,math.radians(10),0))
for y in [-0.162,-0.058]:
line('L_Hopper_Short_Raised_Edge', [(0.046,y,0.692),(0.110,y,0.703)], 0.0035, hopper_mat, hopper_coll, root)
line('Entrance_Ramp_Side', [(0.011,-0.107,0.686),(-0.028,0.020,0.634)], 0.0035, hopper_mat, hopper_coll, root)
line('Entrance_Ramp_Side', [(0.079,-0.107,0.686),(0.036,0.020,0.634)], 0.0035, hopper_mat, hopper_coll, root)
verts = []
for j in range(25):
t = j/24
center_x = 0.045-0.041*t
for x in [center_x-0.031,center_x+0.031]:
verts.append((x,-0.107+0.127*t,0.681-0.050*t))
faces = [(2*j,2*j+1,2*j+3,2*j+2) for j in range(24)]
ramp = mesh('Fixed_Entrance_Sliding_Ramp', verts, faces, graphite, hopper_coll, root)
solid = ramp.modifiers.new('Ramp_Thickness', 'SOLIDIFY')
solid.thickness = 0.003
box('Hopper_Support', (0.072,-0.053,0.662), (0.083,0.064,0.016), graphite, hopper_coll, root, 0.005)
gate = empty('Entrance_Periodic_Gate_Pivot', (0.045,-0.062,0.665), hopper_coll, root)
box('Entrance_Gate_Paddle', (0,0,-0.012), (0.071,0.004,0.033), orange, hopper_coll, gate, 0.002)
cyl('Entrance_Gate_Pivot_Pin', (0,0,0), 0.004, 0.082, steel, hopper_coll, gate, 'X', 0.0005, 48)
DISC_X, DISC_Y, DISC_Z = 0.045, -0.008, 0.544
MALE_X, MALE_Y, MALE_Z = 0.045, -0.008, 0.416
ORBIT = 0.064
DISC_THICKNESS = 0.074
CUP_X = 0.0
BLADE_RADIUS = 0.104
POCKET_MAX_RADIUS = 0.103
POCKET_ANGLES = [0, math.pi/2, math.pi, 3*math.pi/2]
BALL_ANGLES = [math.radians(90),math.radians(210),math.radians(330)]
def radial_orientation(angle):
return Matrix(((1,0,0),(0,math.sin(angle),math.cos(angle)),(0,-math.cos(angle),math.sin(angle)))).to_euler()
disc = empty('Four_Pocket_Disc_Y_Axis', (DISC_X,DISC_Y,DISC_Z), disk_coll, root)
disc['pocket_count'] = 4
disc['thickness_m'] = DISC_THICKNESS
disc['rotation_direction'] = 'Clockwise when viewed from +Y toward -Y; local negative X rotation transformed to global Y'
disc['pocket_shape'] = 'One-piece hemispherical cavities centered across the drum thickness, with radial openings in global XOZ'
disc['pocket_axial_center_y_m'] = DISC_X+CUP_X
disc['drum_axial_midplane_y_m'] = DISC_X
plate = cyl('Four_Pocket_Disc_Thick_Body', (0,0,0), 0.091, DISC_THICKNESS, orange, disk_coll, None, 'X', 0.0015, 128)
for a in POCKET_ANGLES:
direction = Vector((0,math.cos(a),math.sin(a)))
cutter = cyl('TEMP_Radial_Pocket_Channel', (0,0,0), 0.0375, 0.080, black, disk_coll, None, edge=0, vertices=80)
cutter.rotation_euler = radial_orientation(a)
cutter.location = Vector((CUP_X,0,0))+direction*0.065
boolean(plate,cutter)
move_to(plate, disk_coll, disc)
bevel(plate, 0.0012)
cyl('Disc_Solid_Front_Cover', (0.041,0,0), 0.091, 0.008, orange, disk_coll, disc, 'X', 0.0015, 128)
cyl('Disc_Cover_Centre_Fastener', (0.047,0,0), 0.014, 0.007, orange_dark, disk_coll, disc, 'X', 0.0008)
cyl('Disc_Cover_Centre_Knob', (0.052,0,0), 0.010, 0.006, orange, disk_coll, disc, 'X', 0.001)
box('Disc_Cover_Knob_Grip', (0.056,0,0), (0.003,0.004,0.017), orange_edge, disk_coll, disc, 0.001)
cyl('Disc_Drive_Shaft', (-0.052,0,0), 0.007, 0.150, steel, disk_coll, disc, 'X', 0.0005)
cyl('Disc_Rear_Bearing', (DISC_X-0.105,DISC_Y,DISC_Z), 0.013, 0.022, graphite, disk_coll, root, 'X', 0.001)
pockets = []
for i,a in enumerate(POCKET_ANGLES):
profile = [(0.039,0.032),(0.039,0)]
for j in range(25):
theta = math.pi/2*j/24
profile.append((0.039*math.cos(theta),-0.039*math.sin(theta)))
for j in range(24,-1,-1):
theta = math.pi/2*j/24
profile.append((0.036*math.cos(theta),-0.036*math.sin(theta)))
profile.append((0.036,0.032))
pocket = lathe('Hemispherical_Pocket_'+str(i+1), profile, (0,0,0), orange, disk_coll, None, 'Z', 112)
pocket.parent = disc
pocket.location = (CUP_X,ORBIT*math.cos(a),ORBIT*math.sin(a))
pocket.rotation_euler = radial_orientation(a)
pocket['pocket_index'] = i
pocket['opening_normal'] = 'Radial in global XOZ after front-facing assembly rotation'
pocket['axial_center_offset_from_drum_midplane_m'] = CUP_X
pocket['construction'] = 'One-piece bowl with no blade slot; the cutting blade remains outside all rotating geometry'
pocket['inner_radius_m'] = 0.036
pocket['outer_radius_m'] = 0.039
pocket['depth_m'] = 0.039
pockets.append(pocket)
rim = torus('Pocket_Rim_'+str(i+1), (CUP_X,ORBIT*math.cos(a),ORBIT*math.sin(a)), 0.0375, 0.0012, orange_edge, disk_coll, disc)
rim.rotation_euler = radial_orientation(a)
pocket['radial_opening_local'] = [0,math.cos(a),math.sin(a)]
for radial_mesh in [pocket,rim]:
radial_mesh.data.transform(radial_mesh.rotation_euler.to_matrix().to_4x4())
radial_mesh.rotation_euler = (0,0,0)
plate.data.transform(plate.rotation_euler.to_matrix().to_4x4())
plate.rotation_euler = (0,0,0)
blade = box('Fixed_Tangential_Cutting_Blade', (DISC_X,DISC_Y+BLADE_RADIUS+0.0012,DISC_Z), (0.058,0.0024,0.064), steel, blade_coll, root, 0.00015)
blade['fixed_on_machine'] = True
blade['penetrates_drum'] = False
blade['cutting_edge_radius_m'] = BLADE_RADIUS
blade['cutting_plane'] = 'Radial YOZ plane at the cutting station; vertical edge follows the tangent of the front-projected XOZ disc'
for side in [-1,1]:
box('Blade_Holder_Side_Cheek_'+str(side), (DISC_X+side*0.035,DISC_Y+0.116,DISC_Z), (0.010,0.016,0.074), orange, blade_coll, root, 0.002)
for z in [DISC_Z-0.026,DISC_Z+0.026]:
box('Blade_Mounting_Tang', (DISC_X+side*0.026,DISC_Y+0.112,z), (0.006,0.016,0.006), steel, blade_coll, root, 0.0005)
box('Blade_Holder_Crossbar', (DISC_X,DISC_Y+0.116,DISC_Z-0.038), (0.080,0.016,0.010), orange, blade_coll, root, 0.002)
box('Blade_Fixed_Mount', (DISC_X,DISC_Y+0.115,DISC_Z-0.055), (0.020,0.024,0.045), orange, blade_coll, root, 0.003)
box('Blade_External_Cross_Bracket', (DISC_X-0.0175,DISC_Y+0.124,DISC_Z-0.055), (0.125,0.018,0.018), orange, blade_coll, root, 0.002)
ejector = empty('Blade_Discharge_Spring_Pivot', (DISC_X,DISC_Y+0.128,DISC_Z-0.040), blade_coll, root)
box('Blade_Spring_Discharge_Plate', (0,-0.012,0.020), (0.010,0.020,0.025), chrome, blade_coll, ejector, 0.0006)
cyl('Blade_Ejector_Pivot_Pin', (0,0,0), 0.004, 0.024, steel, blade_coll, ejector, 'X', 0.0005, 48)
line('Blade_Return_Spring', [(DISC_X,DISC_Y+0.128,DISC_Z-0.055),(DISC_X,DISC_Y+0.139,DISC_Z-0.040),(DISC_X,DISC_Y+0.128,DISC_Z-0.025)], 0.0011, steel, blade_coll, root)
male = empty('Three_Ball_Press_Y_Axis', (MALE_X,MALE_Y,MALE_Z), press_coll, root)
male['head_count'] = 3
male['fixed_axis_center'] = True
male['vertical_motion'] = 'None; pressing is produced only by coordinated rotation and pocket engagement'
male['rotation_direction'] = 'Clockwise when viewed from +Y toward -Y; local negative X rotation transformed to global Y, matching the disc'
male['arrangement'] = 'Equilateral triangular carrier in global XOZ with three integrated short-neck spherical heads'
triangle = [(0.0355*math.cos(a),0.0355*math.sin(a)) for a in BALL_ANGLES]
vertices = [(x,y,z) for x in [CUP_X-0.007,CUP_X+0.005] for y,z in triangle]
faces = [(0,1,2),(5,4,3),(0,3,4,1),(1,4,5,2),(2,5,3,0)]
mesh('Press_Equilateral_Triangle_Carrier', vertices, faces, orange, press_coll, male)
balls = []
for i,a in enumerate(BALL_ANGLES):
y,z = ORBIT*math.cos(a),ORBIT*math.sin(a)
ball = sphere('Spherical_Pressing_Head_'+str(i+1), (CUP_X,y,z), 0.028, orange, press_coll, male)
ball['head_index'] = i
balls.append(ball)
neck = cyl('Press_Head_Short_Neck_'+str(i+1), (CUP_X,0.046*math.cos(a),0.046*math.sin(a)), 0.0075, 0.022, orange_dark, press_coll, male, edge=0.001)
neck.rotation_euler = radial_orientation(a)
cyl('Press_Centre_Hub', (CUP_X,0,0), 0.018, 0.014, orange_dark, press_coll, male, 'X', 0.001)
cyl('Press_Fixed_Drive_Shaft', (-0.040,0,0), 0.007, 0.150, steel, press_coll, male, 'X', 0.0005)
cyl('Press_Fixed_Axis_Bearing', (MALE_X-0.080,MALE_Y,MALE_Z), 0.013, 0.018, graphite, press_coll, root, 'X', 0.001)
# Separate open collectors, a solid juice guide and a peel-only bypass.
juice_box = loft('Juice_Collection_Box_No_Spout_No_Handle', [
(0.047,0.086,0.135,0.010,-0.111,0.052),
(0.204,0.086,0.135,0.010,-0.111,0.052),
(0.204,0.074,0.123,0.008,-0.111,0.052),
(0.057,0.072,0.121,0.007,-0.111,0.052),
], bin_metal, bin_coll, root, 0.001)
juice_box['has_spout'] = False
juice_box['has_handle'] = False
residue_box = loft('Residue_Collection_Box', [
(0.047,0.145,0.143,0.011,0.045,0.003),
(0.233,0.145,0.143,0.011,0.045,0.003),
(0.233,0.131,0.129,0.009,0.045,0.003),
(0.058,0.129,0.127,0.008,0.045,0.003),
], bin_metal, bin_coll, root, 0.001)
residue_box['contains_juice'] = False
line('Juice_Box_Open_Rim', [(x-0.111,y+0.052,0.204) for x,y in rounded_rect(0.086,0.135,0.010)], 0.0014, steel, bin_coll, root, True)
line('Residue_Box_Open_Rim', [(x+0.045,y+0.003,0.233) for x,y in rounded_rect(0.145,0.143,0.011)], 0.0014, steel, bin_coll, root, True)
tray = mesh('Juice_Guide_Solid_Tray_No_Mesh', [
(0.035,-0.010,0.348),(0.035,0.100,0.348),
(-0.111,0.100,0.214),(-0.111,-0.010,0.214),
], [(0,1,2,3)], bin_metal, bin_coll, root)
solid = tray.modifiers.new('Solid_Tray_Thickness', 'SOLIDIFY')
solid.thickness = 0.002
solid.offset = 0
bevel(tray,0.0006)
for y in [-0.010,0.100]:
line('Juice_Guide_Raised_Side', [(0.035,y,0.355),(-0.111,y,0.221)], 0.0025, steel, bin_coll, root)
line('Juice_Guide_High_Stop', [(0.035,-0.010,0.355),(0.035,0.100,0.355)], 0.0025, steel, bin_coll, root)
for y in [-0.041,0.041]:
line('Residue_Rotary_Discharge_Guide', [(0.062,y,0.520),(0.069,y,0.405),(0.030,y,0.295),(0.000,y,0.224)], 0.003, orange, bin_coll, root)
box('Residue_Chute_Base', (0.012,0.000,0.267), (0.024,0.090,0.004), orange, bin_coll, root, 0.003, (0,math.radians(-38),0))
juice_level = loft('Juice_Level_Inside_Collection_Box', [
(0.058,0.071,0.120,0.007,-0.111,0.052),
(0.091,0.071,0.120,0.007,-0.111,0.052),
], juice_mat, juice_coll, root, 0)
juice_slide = empty('Juice_Collection_Box_Slide', (0,0,0), bin_coll, root)
residue_slide = empty('Residue_Animation_Slide', (0,0,0), bin_coll, root)
residue_box_slide = empty('Residue_Collection_Box_Slide', (0,0,0), bin_coll, root)
for obj in [juice_box,bpy.data.objects['Juice_Box_Open_Rim'],juice_level]:
obj.parent = juice_slide
for obj in [residue_box,bpy.data.objects['Residue_Box_Open_Rim']]:
obj.parent = residue_box_slide
COLLECTOR_SLIDE = [(1,0),(322,0),(350,0.100),(360,0.100)]
for frame,offset in COLLECTOR_SLIDE:
key(juice_slide,frame,loc=(0,offset,0))
key(residue_box_slide,frame,loc=(offset,0,0))
key(residue_slide,frame,loc=(0,-offset,0))
def smooth01(value):
t = min(1,max(0,value))
return t*t*(3-2*t)
def orange_shell(name, parent, mat):
profile = []
for i in range(33):
a = math.pi/2*i/32
profile.append((max(0.00001,0.031*math.cos(a)),0.031*math.sin(a)))
for i in range(32,-1,-1):
a = math.pi/2*i/32
profile.append((max(0.00001,0.0282*math.cos(a)),0.0282*math.sin(a)))
return lathe(name,profile,(0,0,0),mat,fruit_coll,parent,segments=96)
def flesh_surface(name, parent, mat):
radius = 0.0282
segments = 96
rings = 12
vertices = [(0,0,0.0007)]
for ring in range(1,rings+1):
r = radius*ring/rings
for j in range(segments):
a = math.tau*j/segments
vertices.append((r*math.cos(a),r*math.sin(a),0.0007))
faces = []
for j in range(segments):
faces.append((0,1+(j+1)%segments,1+j))
for ring in range(rings-1):
first = 1+ring*segments
second = first+segments
for j in range(segments):
k = (j+1)%segments
faces.append((first+j,first+k,second+k,second+j))
obj = mesh(name,vertices,faces,mat,fruit_coll,parent)
obj.shape_key_add(name='Basis')
pressed = obj.shape_key_add(name='Pressed_Around_Spherical_Head')
for i,vertex in enumerate(vertices):
x,y,z = vertex
pressed.data[i].co = (x,y,z+math.sqrt(max(0,radius*radius-x*x-y*y)))
solid = obj.modifiers.new('Thin_Flesh_And_Pith_Layer','SOLIDIFY')
solid.thickness = 0.0006
solid.offset = 0
return obj
def half_fruit(name):
assembly = empty(name, (0,0,0), fruit_coll, root)
assembly['local_axes'] = 'Local +Z is the peel dome; cut face looks along local -Z'
assembly['press_deformation'] = 'The cut flesh becomes a concave layer around the entering ball while the peel stays seated in its rotating pocket; no upward ram displacement'
orange_shell(name+'_Peel',assembly,peel)
lathe(name+'_Pith_Ring', [(0.0282,0),(0.031,0),(0.031,0.0013),(0.0282,0.0013)], (0,0,0), pith, fruit_coll, assembly, segments=96)
flesh_surface(name+'_Cut_Flesh',assembly,flesh)
for i in range(10):
a = math.tau*i/10
obj = line(name+'_Segment', [(0.001*math.cos(a),0.001*math.sin(a),0.0015),(0.027*math.cos(a),0.027*math.sin(a),0.0015)], 0.00025, pith, fruit_coll, assembly)
obj['press_detail'] = True
for x,y in [(0.006,0.005),(-0.008,0.003)]:
obj = sphere(name+'_Seed', (x,y,0.0018), 0.0016, seed_mat, fruit_coll, assembly, (0.65,1.1,0.25))
obj['press_detail'] = True
return assembly
def residue(name):
assembly = empty(name, (0,0,0), fruit_coll, residue_slide)
assembly['description'] = 'A hollow squeezed half-orange peel released after the rolling nip, guided into the residue box; never carried by a pressing ball'
orange_shell(name+'_Empty_Peel',assembly,peel)
lathe(name+'_Dry_Pith', [(0.0282,0),(0.031,0),(0.031,0.0013),(0.0282,0.0013)], (0,0,0), pith, fruit_coll, assembly, segments=96)
pressed_flesh = flesh_surface(name+'_Pressed_Inner_Pith',assembly,pith)
pressed_flesh.data.shape_keys.key_blocks['Pressed_Around_Spherical_Head'].value = 1
for i in range(8):
a = math.tau*i/8
sphere(name+'_Pulp_Remnant', (0.021*math.cos(a),0.021*math.sin(a),0.009), 0.0014, flesh, fruit_coll, assembly, (1.1,0.8,0.35))
return assembly
whole = empty('Process_Whole_Orange', (0,0,0), fruit_coll, root)
sphere('Process_Whole_Orange_Peel', (0,0,0), 0.030, peel, fruit_coll, whole, (1,0.98,0.99))
half_a = half_fruit('Process_Retained_Half')
half_b = half_fruit('Process_Blade_Half')
residue_a = residue('Residue_A_Pressed_Half_Peel')
residue_b = residue('Residue_B_Pressed_Half_Peel')
queued = []
for i,y in enumerate([0.086,0.022,-0.042]):
obj = empty('Hopper_Queued_Orange_'+str(i+1), (0,0,0), fruit_coll, root)
sphere('Hopper_Queued_Peel_'+str(i+1), (0,0,0), 0.029, peel, fruit_coll, obj, (1,0.98,0.99))
queued.append((obj,y))
for f,dy in [(1,0),(54,0),(72,-0.064),(360,-0.064)]:
key(obj,f,(0.108,y+dy,0.718-0.035*(y+dy)))
for f,a in [(1,0),(28,0),(38,math.radians(58)),(48,math.radians(58)),(64,0),(360,0)]:
key(gate,f,rot=(a,0,0))
for f,a in [(1,0),(174,0),(182,math.radians(-38)),(188,math.radians(-12)),(196,0),(360,0)]:
key(ejector,f,rot=(a,0,0))
for f,a in [(1,0),(322,0),(348,math.radians(104)),(360,math.radians(104))]:
key(door_pivot,f,rot=(0,0,a))
CUT_FRAME = 128
PRESSES = [
{'half':half_a,'residue':residue_a,'pocket':1,'ball':1,'contact':192,'release':214,'floor':0.066},
{'half':half_b,'residue':residue_b,'pocket':2,'ball':2,'contact':256,'release':278,'floor':0.078},
]
def rotor_angles(frame):
disc_angle = math.radians((64-frame)*90/64)
press_angle = math.radians(120)+disc_angle*4/3
return disc_angle,press_angle
def interpolate(keys, frame):
if frame <= keys[0][0]:
return keys[0][1]
for (a,va),(b,vb) in zip(keys,keys[1:]):
if a <= frame <= b:
t = (frame-a)/(b-a)
t = t*t*(3-2*t)
if isinstance(va,(tuple,list,Vector)):
return Vector(va)+(Vector(vb)-Vector(va))*t
return va+(vb-va)*t
return keys[-1][1]
def rx(angle):
return Matrix.Rotation(angle,3,'X')
def pocket_normal(index, angle):
theta = POCKET_ANGLES[index]+angle
return Vector((0,math.cos(theta),math.sin(theta)))
def pocket_position(index, angle, inward=0):
theta = POCKET_ANGLES[index]+angle
return Vector((DISC_X+CUP_X,DISC_Y,DISC_Z)) + Vector((0,ORBIT*math.cos(theta),ORBIT*math.sin(theta))) - pocket_normal(index,angle)*inward
def fruit_orientation(index, angle):
return radial_orientation(POCKET_ANGLES[index]+angle+math.pi)
def ball_position(index, angle):
theta = BALL_ANGLES[index]+angle
return Vector((MALE_X+CUP_X,MALE_Y,MALE_Z)) + Vector((0,ORBIT*math.cos(theta),ORBIT*math.sin(theta)))
def ball_normal(index, angle):
theta = BALL_ANGLES[index]+angle
return Vector((0,math.cos(theta),math.sin(theta)))
def lerp(a,b,t):
return a+(b-a)*t
def lerp_rot(a,b,t):
return tuple(lerp(a[i],b[i],t) for i in range(3))
def hide_at(obj, frame):
for child in [obj,*obj.children_recursive]:
child.hide_render = True
child.hide_viewport = True
child.keyframe_insert(data_path='hide_render',frame=frame)
child.keyframe_insert(data_path='hide_viewport',frame=frame)
def show_at(obj, frame):
for child in [obj,*obj.children_recursive]:
child.hide_render = False
child.hide_viewport = False
child.keyframe_insert(data_path='hide_render',frame=frame)
child.keyframe_insert(data_path='hide_viewport',frame=frame)
for obj in [half_a,half_b,residue_a,residue_b]:
hide_at(obj,1)
for half in [half_a,half_b]:
show_at(half,CUT_FRAME)
for press in PRESSES:
hide_at(press['half'],press['release'])
show_at(press['residue'],press['release'])
show_at(whole,1)
hide_at(whole,CUT_FRAME)
def apply_press_deformation(assembly,frame,da,ma,pocket_index,ball_index,contact):
amount = 0
if frame >= contact-28:
separation = (pocket_position(pocket_index,da)-ball_position(ball_index,ma)).length
amount = smooth01((0.062-separation)/0.062)
flesh_obj = bpy.data.objects[assembly.name+'_Cut_Flesh']
shape = flesh_obj.data.shape_keys.key_blocks['Pressed_Around_Spherical_Head']
shape.value = amount
shape.keyframe_insert(data_path='value',frame=frame)
detail_scale = max(0.001,1-amount)
for child in assembly.children:
if child.get('press_detail'):
key(child,frame,scale=(detail_scale,detail_scale,detail_scale))
return amount
def released_peel_transform(press,frame):
pocket_index = press['pocket']
release = press['release']
release_da,_ = rotor_angles(release)
p0 = pocket_position(pocket_index,release_da)
rotation = fruit_orientation(pocket_index,release_da)
if frame <= release:
return p0,rotation
next_da,_ = rotor_angles(release+1)
velocity = (pocket_position(pocket_index,next_da)-p0)*24
guide_time = min((frame-release)/24,0.34)
guide_fraction = smooth01(guide_time/0.24)
p = p0+velocity*guide_time
p.x *= 1-guide_fraction
p.z -= 0.5*9.81*guide_time*guide_time
if frame-release > 0.34*24:
fall_time = (frame-release)/24-0.34
p.z += (velocity.z-9.81*0.34)*fall_time-0.5*9.81*fall_time*fall_time
p.z = max(press['floor'],p.z)
return p,rotation
feed_path = [(1,(0.108,-0.106,0.722)),(28,(0.108,-0.106,0.722)),(40,(0.047,-0.106,0.704)),(52,(0.045,-0.028,0.666)),(64,pocket_position(1,0))]
for f in range(1,361):
da,ma = rotor_angles(f)
key(disc,f,rot=(da,0,0))
key(male,f,rot=(ma,0,0))
if f < 64:
pos = Vector(interpolate(feed_path,f))
whole_rotation = (0.08*f,0,0)
elif f < 70:
pos = pocket_position(1,da,inward=lerp(0,-0.040,(f-64)/6))
whole_rotation = fruit_orientation(1,da)
else:
pos = pocket_position(1,da,inward=-0.040)
whole_rotation = fruit_orientation(1,da)
key(whole,f,loc=pos,rot=whole_rotation)
if f < CUT_FRAME:
pa = pos
else:
pa = pocket_position(1,da,inward=lerp(-0.040,0,smooth01((f-CUT_FRAME)/20)))
key(half_a,f,loc=pa,rot=fruit_orientation(1,da))
if f <= 178:
pb = Vector((DISC_X,DISC_Y+BLADE_RADIUS,DISC_Z))
rb = radial_orientation(0)
elif f <= 192:
t = smooth01((f-178)/14)
pb = lerp(Vector((DISC_X,DISC_Y+BLADE_RADIUS,DISC_Z)),pocket_position(2,da),t)
rb = lerp_rot(radial_orientation(0),fruit_orientation(2,da),t)
else:
pb = pocket_position(2,da)
rb = fruit_orientation(2,da)
key(half_b,f,loc=pb,rot=rb)
for press in PRESSES:
apply_press_deformation(press['half'],f,da,ma,press['pocket'],press['ball'],press['contact'])
p,r = released_peel_transform(press,f)
key(press['residue'],f,loc=p,rot=r)
key(juice_level,f,scale=(1,1,max(0.001,min(1,(f-176)/100))))
for modifier in list(plate.modifiers):
plate.modifiers.remove(modifier)
relief_radius = 0.0345
relief_tracks = []
for ball_index in range(3):
ball = bpy.data.objects['Spherical_Pressing_Head_'+str(ball_index+1)]
active = []
for frame in range(1,361):
scene.frame_set(frame)
bpy.context.view_layer.update()
relative = disc.matrix_world.inverted() @ ball.matrix_world.translation
if math.hypot(relative.y,relative.z) < 0.091+relief_radius+0.001:
active.append((frame,relative.copy()))
groups = []
for frame,relative in active:
if not groups or frame > groups[-1][-1][0]+1:
groups.append([])
groups[-1].append((frame,relative))
for group in groups:
target_names = ['Four_Pocket_Disc_Thick_Body']
for pocket_index,angle in enumerate(POCKET_ANGLES):
center = Vector((CUP_X,ORBIT*math.cos(angle),ORBIT*math.sin(angle)))
if any((relative-center).length < 0.039+relief_radius+0.002 for _,relative in group):
target_names.extend(['Hemispherical_Pocket_'+str(pocket_index+1),'Pocket_Rim_'+str(pocket_index+1)])
relief_tracks.append((ball_index,group,target_names))
for track_index,(ball_index,group,target_names) in enumerate(relief_tracks,1):
print(f'RELIEF track={track_index} ball={ball_index+1} frames={group[0][0]}-{group[-1][0]} targets={target_names}',flush=True)
parts = []
for frame,relative in group:
bpy.ops.mesh.primitive_uv_sphere_add(segments=32,ring_count=20,radius=relief_radius,location=relative)
part = bpy.context.object
part.name = 'TEMP_Continuous_Rotor_Relief_Point'
move_to(part,disk_coll,disc)
parts.append(part)
bpy.ops.object.select_all(action='DESELECT')
for part in parts:
part.select_set(True)
bpy.context.view_layer.objects.active = parts[0]
bpy.ops.object.join()
cutter = bpy.context.object
cutter.name = 'TEMP_Continuous_Rotor_Relief_'+str(track_index)
remesh = cutter.modifiers.new('Watertight_Continuous_Relief_Sweep','REMESH')
remesh.mode = 'VOXEL'
remesh.voxel_size = 0.00085
remesh.use_smooth_shade = True
bpy.ops.object.modifier_apply(modifier=remesh.name)
cutter.data.transform(cutter.matrix_basis)
cutter.matrix_basis = Matrix.Identity(4)
for target_name in target_names:
target = bpy.data.objects[target_name]
duplicate = cutter.copy()
duplicate.data = cutter.data.copy()
disk_coll.objects.link(duplicate)
duplicate.parent = disc
duplicate.matrix_basis = cutter.matrix_basis.copy()
boolean(target,duplicate)
target['rotational_relief_grooves'] = target.get('rotational_relief_grooves',0)+1
bpy.data.objects.remove(cutter,do_unlink=True)
disc['rotational_relief_track_count'] = len(relief_tracks)
disc['rotational_relief_radius_m'] = relief_radius
disc['relief_description'] = 'Continuous evaluated ball trajectories; 34.5 mm relief envelopes also clear the short necks; regenerated for the nonstop four-pocket/three-head speed ratio'
bevel(plate,0.0008)
scene.frame_set(1)
for i in range(24):
drop = sphere('Juice_Guide_Droplet_'+str(i), (0,0,0), 0.0017, juice_mat, juice_coll, root, (0.85,0.85,1.65))
first = 172 + (i%12)*2 if i < 12 else 242+(i%12)*2
for f,s,z in [(1,0.001,0.46),(first-1,0.001,0.46),(first,1,0.46),(first+6,1,0.382),(first+11,0.8,0.339),(first+12,0.001,0.336),(360,0.001,0.336)]:
x = DISC_X + 0.014*math.sin(i*2.1)
y = -0.002 + 0.011*math.cos(i*1.3)
key(drop,f,loc=(x,y,z),scale=(s,s,s))
for i in range(8):
drop = sphere('Juice_Box_Droplet_'+str(i), (-0.111,0.032,0.24), 0.0016, juice_mat, juice_coll, root, (1,1,1.3))
start = 190+i*11
for f,s,z in [(1,0.001,0.24),(start-1,0.001,0.24),(start,1,0.255),(start+7,0.8,0.205),(start+8,0.001,0.094),(360,0.001,0.094)]:
key(drop,f,loc=(-0.111,0.032,z),scale=(s,s,s))
for obj in hood_coll.objects:
for f,hidden in [(1,False),(55,False),(56,True),(285,True),(286,False),(360,False)]:
if hidden:
hide_at(obj,f)
else:
show_at(obj,f)
mechanism_frame = empty('Front_Facing_Mechanism_Y_Axes', (0,0,0), exterior, root)
for coll in [hopper_coll,disk_coll,blade_coll,press_coll,fruit_coll,juice_coll]:
for obj in list(coll.objects):
if obj.parent == root:
obj.parent = mechanism_frame
residue_slide.parent = mechanism_frame
mechanism_frame.rotation_euler.z = math.pi/2
mechanism_frame['front_plane'] = 'XOZ'
mechanism_frame['front_normal'] = '+Y'
mechanism_frame['purpose'] = 'Turn all rotating circular faces and the external blade toward the machine front without rotating the cabinet or collectors'
for name,frame in [('FEED / CONTINUOUS ROTORS',28),('POCKET RECEIVES ORANGE',64),('TANGENTIAL CUT',128),('FIRST ROLLING CONTACT',172),('BLADE HALF TO EMPTY POCKET',178),('FIRST DEEPEST ENGAGEMENT',192),('FIRST PEEL RELEASE',214),('SECOND ROLLING CONTACT',236),('SECOND DEEPEST ENGAGEMENT',256),('SECOND PEEL RELEASE',278),('SEPARATE COLLECTORS',322)]:
scene.timeline_markers.new(name,frame=frame)
floor_mat = material('Studio_Backdrop', (0.12,0.15,0.17), 0, 0.73)
box('Studio_Ground', (0,0,-0.010), (200,200,0.01), floor_mat, studio, None, 0)
world = bpy.data.worlds.new('Studio_World')
world.use_nodes = True
world.node_tree.nodes['Background'].inputs['Color'].default_value = (0.29,0.33,0.36,1)
world.node_tree.nodes['Background'].inputs['Strength'].default_value = 0.34
scene.world = world
def aim(obj,target):
obj.rotation_euler = (Vector(target)-obj.location).to_track_quat('-Z','Y').to_euler()
def area(name,loc,power,color,size,target):
data = bpy.data.lights.new(name,'AREA')
data.energy = power
data.color = color
data.shape = 'RECTANGLE'
data.size = size
data.size_y = size*1.2
obj = bpy.data.objects.new(name,data)
studio.objects.link(obj)
obj.location = loc
aim(obj,target)
area('Studio_Key',(-0.70,0.64,1.26),32,(1,0.91,0.82),0.72,(0,0,0.40))
area('Studio_Fill',(0.80,0.36,0.92),28,(0.85,0.92,1),0.60,(0,0,0.43))
area('Studio_Rim',(-0.20,-0.62,1.10),38,(0.91,0.95,1),0.60,(0,0,0.48))
area('Studio_Interior',(0.10,0.35,0.67),2,(1,0.92,0.80),0.18,(0.045,0,0.50))
def camera(name,loc,target,scale):
data = bpy.data.cameras.new(name)
obj = bpy.data.objects.new(name,data)
studio.objects.link(obj)
obj.location = loc
aim(obj,target)
data.type = 'ORTHO'
data.ortho_scale = scale
data.clip_start = 0.002
data.clip_end = 100
return obj
cam_hero = camera('CAM_01_Assembled',(0.95,1.72,0.98),(0,0.01,0.381),0.865)
cam_mechanism = camera('CAM_02_Four_Pocket_And_Blade',(0.58,1.15,0.74),(0.008,-0.005,0.505),0.420)
cam_bins = camera('CAM_03_Separate_Collectors',(0.15,0.30,1.24),(0.0,0.100,0.120),0.425)
cam_side = camera('CAM_04_Structure_Side',(-0.60,0.95,0.70),(0.008,-0.008,0.510),0.380)
cam_x_rotation = camera('CAM_05_Front_XOZ_Rotation_Check',(0.008,1.05,0.55),(0.008,0.008,0.505),0.360)
cam_pocket = camera('CAM_06_Pocket_Thickness_Midplane',(-0.85,0.045,0.63),(-0.055,0.045,0.545),0.260)
cam_press = camera('CAM_07_Pressing_Contact',(-0.50,0.42,0.33),(0.008,0.045,0.465),0.295)
cam_press_side = camera('CAM_08_Continuous_Press_Side',(-0.48,0.24,0.37),(0.008,0.045,0.463),0.270)
scene.camera = cam_hero
scene.render.engine = 'CYCLES'
scene.cycles.samples = 64
scene.cycles.use_denoising = True
scene.cycles.adaptive_threshold = 0.035
scene.cycles.max_bounces = 10
scene.cycles.transmission_bounces = 8
scene.cycles.transparent_max_bounces = 12
scene.render.resolution_x = 1500
scene.render.resolution_y = 1700
scene.render.resolution_percentage = 100
scene.render.image_settings.file_format = 'PNG'
scene.render.image_settings.color_mode = 'RGB'
scene.render.filepath = '//preview_assembled.png'
scene.view_settings.view_transform = 'AgX'
scene.view_settings.look = 'AgX - Medium High Contrast'
for screen in bpy.data.screens:
for area_ in screen.areas:
if area_.type == 'VIEW_3D':
space = area_.spaces.active
space.clip_start = 0.001
space.clip_end = 100
space.region_3d.view_perspective = 'CAMERA'
space.region_3d.view_location = (0,0,0.40)
space.region_3d.view_distance = 1.15
space.region_3d.view_rotation = cam_hero.rotation_euler.to_quaternion()
space.shading.type = 'MATERIAL'
space.shading.use_scene_lights = True
space.shading.use_scene_world = False
space.overlay.show_extras = False
scene.frame_set(1)
bpy.ops.object.select_all(action='DESELECT')
root.select_set(True)
bpy.context.view_layer.objects.active = root
about = bpy.data.texts.new('ABOUT_User_Spec_Mechanism')
about.write('Source of truth: HOW_ZMUEX_juicer_work.md.\n')
about.write('All rotating circular faces lie in global XOZ and face machine front +Y. Disc and press rotate continuously around parallel Y axes, clockwise when viewed from +Y. Fruit follows its pocket through the rolling nip rather than staying at a fixed pressing station or turning with a ball.\n')
about.write('The drum is 74 mm thick along Y. Four one-piece hemispherical cavities are centered across its thickness and open radially in XOZ.\n')
about.write('The external blade and holder lie outside the drum and all pocket rims. The 104 mm cutting-edge position meets fruit at the projected tangent without entering the mechanism; the cutting plane matches the two half-orange separation directions.\n')
about.write('Fruit is lifted slightly outward at the cutting station. The inner half follows the disc; the outer half is transferred from the blade into an empty pocket. The three spherical heads use an equilateral carrier and short radial necks.\n')
about.write('The pressing carrier has a fixed axis and no Z translation. Its rotating balls engage the orange cavities through local spherical relief grooves regenerated from the continuous four-pocket/three-head trajectories.\n')
about.write('Reference: supplied ZMUEX_working_video.mp4, 01:59-02:06. Both rotors turn continuously throughout the animation. Each orange half follows its pocket through the rolling contact arc; the cut flesh forms a concave layer around the ball at deepest engagement. No rotor dwell, upward ram or stationary pressing-station animation remains.\n')
about.write('After the rolling nip, each hollow squeezed peel is released with tangential motion, guided away from the juice path, then falls into the residue box. It is not attached to a pressing ball.\n')
about.write('Whole fruit, halves and residue use recursive visibility keys on every child mesh, so a hidden whole orange cannot remain visible after cutting.\n')
about.write('The L hopper has four long-arm positions, a short turn, a periodic gate and a fixed entrance ramp.\n')
about.write('The juice box has no spout or handle. A solid guide tray replaces the incorrect wire filter. The residue box is separate and contains no juice volume.\n')
about.write('Whole fruit, retained half, blade half and two separate pressed residue meshes are independently modeled.\n')
about.write('All fruit and residue animation is baked into ordinary transform keys. No runtime reparenting or constraints.\n')
about.write('Transparent hood visibility is keyed for the mechanism shot. The residue service door opens for the collector shot.\n')
about.write('The four-pocket/three-head phase relationship is an illustrative interpretation of the supplied description, not a claimed factory RPM or gear ratio.\n')
about.write('No external assets or linked libraries are required.\n')
triangles = 0
for obj in scene.objects:
if obj.type == 'MESH' and not any(coll == studio for coll in obj.users_collection):
ev = obj.evaluated_get(bpy.context.evaluated_depsgraph_get())
data = ev.to_mesh()
data.calc_loop_triangles()
triangles += len(data.loop_triangles)
ev.to_mesh_clear()
report = {
'source_document': 'HOW_ZMUEX_juicer_work.md',
'source_sha256': root['source_sha256'],
'blend': 'PerfectCoffee_Minex_Mechanism.blend',
'frames': [1,360],
'fps': 24,
'pocket_count': 4,
'pocket_axial_center_y_m': DISC_X+CUP_X,
'drum_axial_midplane_y_m': DISC_X,
'pocket_axial_center_error_m': abs(CUP_X),
'spherical_pressing_head_count': 3,
'external_tangential_blade': True,
'blade_clearance_beyond_pocket_rims_m': BLADE_RADIUS-POCKET_MAX_RADIUS,
'filter_mesh_present': False,
'separate_residue_meshes': 2,
'juice_box_has_spout_or_handle': False,
'evaluated_triangles': triangles,
'motion_scope': root['motion_scope'],
'validation_status': 'Structural and rendered checks are run by validate_minex_mechanism.py',
}
(OUT/'mechanism_validation.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
bpy.ops.wm.save_as_mainfile(filepath=str(OUT/'PerfectCoffee_Minex_Mechanism.blend'),compress=True)
print('USER_SPEC_BUILD_COMPLETE '+json.dumps(report),flush=True)