Files
PerfectCoffee/model_assets/juicer/v1/validate_minex_mechanism.py

862 lines
73 KiB
Python

import bpy
import bmesh
import hashlib
import json
import math
from pathlib import Path
from mathutils import Vector
from mathutils.bvhtree import BVHTree
OUT = Path(__file__).resolve().parent
DOC = OUT.parents[1]/'HOW_ZMUEX_juicer_work.md'
scene = bpy.context.scene
report = json.loads((OUT/'mechanism_validation.json').read_text(encoding='utf-8'))
report['revision_notes'] = [
'The supplied Sketchfab model was inspected in the official viewer from front, oblique and side viewpoints; no source mesh, textures or brand text were extracted',
'The circular front cover and thick drum now share a 208 mm diameter, so the four radial pockets no longer protrude beyond the main circular silhouette',
'The hopper is lengthened and its in-plane angle is changed from -20 to -8 degrees; floor contact, fruit spacing, hood entry and footprint checks are retained',
'Fixed opaque rear side returns support the reference side silhouette while the hood stays transparent at the open front',
'The collection deck is a 3 mm inclined hollow shell, high at the rear and low at the front; it is not a full-depth solid cabinet',
'The fascia bottom is nearly level and the fixed display/start pod has its own real fitting opening in the removable deck',
'Blue-reference exterior review: the residue bin has a covered top with a bounded discharge inlet, not a full-bin opening; its wall tops follow the deck underside',
'Rear lower side covers are graphite and distinct from the residue-bin front and left-front walls; the juice mouth remains open',
'The lower side covers follow the descending collection-deck profile instead of forming a horizontal ledge',
'The solid juice guide descends toward global -X above the front juice bin and uses only two deck-mounted cleats; rear-facing guide brackets are removed',
'Fixed chassis, collection deck, lower side covers, transparent hood and both collectors retain independent Blender exports',
'Disc and pressing carrier retain parallel Y axes, clockwise continuous rotation, a four-pocket/three-head speed ratio and a fixed pressing axis',
'One-piece hemispherical pockets remain centered across the 74 mm drum thickness; the external blade never enters the drum or pocket rims',
'Fruit follows its rotating pocket through the rolling nip; hollow squeezed peels release into the residue collector without auxiliary rails',
'The unsupported twin residue-guide rods and their dedicated backplate supports remain absent',
'LCD states remain Ready, Processing and Stopped; no fault state, counter or branding is introduced',
]
report['sketchfab_reference'] = 'https://sketchfab.com/3d-models/zumex-animation-school-project-b49e8f3bb06a4a4ca71eacb4ed11ba52'
report['sketchfab_reference_usage'] = 'Official-viewer visual reference only; non-downloadable source model was not extracted or imported'
report['saved_file_reopened'] = Path(bpy.data.filepath).name == 'PerfectCoffee_Minex_Mechanism.blend'
report['source_document_matches'] = hashlib.sha256(DOC.read_bytes()).hexdigest() == report['source_sha256']
report['missing_external_assets'] = [im.filepath for im in bpy.data.images if im.source=='FILE' and not im.packed_file and not Path(bpy.path.abspath(im.filepath)).exists()]
report['linked_library_count'] = len(bpy.data.libraries)
scene.frame_set(1)
bpy.context.view_layer.update()
disc = bpy.data.objects['Four_Pocket_Disc_Y_Axis']
male = bpy.data.objects['Three_Ball_Press_Y_Axis']
blade = bpy.data.objects['Fixed_Tangential_Cutting_Blade']
report['disc_thickness_m'] = disc['thickness_m']
report['thick_disc_passed'] = report['disc_thickness_m'] >= 0.070
report['actual_pocket_count'] = len([o for o in bpy.data.objects if o.name.startswith('Hemispherical_Pocket_')])
report['actual_spherical_head_count'] = len([o for o in bpy.data.objects if o.name.startswith('Spherical_Pressing_Head_')])
report['solid_front_cover_present'] = 'Disc_Solid_Front_Cover' in bpy.data.objects
report['vertical_press_parts_absent'] = not any(o.name.startswith('Press_Z_') or o.name.startswith('Press_Sliding_') for o in bpy.data.objects)
report['rotational_relief_grooves_present'] = disc.get('rotational_relief_track_count',0)>0 and all(bpy.data.objects['Hemispherical_Pocket_'+str(i)].get('rotational_relief_grooves',0)>0 for i in range(1,5))
report['press_axis_positions'] = {}
reference_axis = None
report['press_axis_max_deviation_m'] = 0.0
for frame in range(1,361):
scene.frame_set(frame)
bpy.context.view_layer.update()
position = male.matrix_world.translation.copy()
if reference_axis is None:
reference_axis = position.copy()
report['press_axis_max_deviation_m'] = max(report['press_axis_max_deviation_m'],(position-reference_axis).length)
if frame in [1,64,128,172,192,214,236,256,278,360]:
report['press_axis_positions'][str(frame)] = list(position)
report['press_axis_fixed_throughout_animation'] = report['press_axis_max_deviation_m']<0.000001
report['short_neck_heads_present'] = all('Press_Head_Short_Neck_'+str(i) in bpy.data.objects for i in [1,2,3])
report['fixed_blade_has_no_animation'] = blade.animation_data is None
report['filter_mesh_absent'] = not any(o.name.startswith('Filter_') or o.name == 'Juice_Only_Inclined_Filter' for o in bpy.data.objects)
report['solid_juice_guide_present'] = 'Juice_Guide_Solid_Tray_No_Mesh' in bpy.data.objects
report['unverified_residue_guide_parts_absent'] = not any(obj.name.startswith(('Residue_Rotary_Discharge_Guide','Residue_Guide_Backplate_')) for obj in bpy.data.objects)
report['drum_blade_slots_absent'] = not any('Blade_Clearance' in o.name for o in bpy.data.objects)
apron = bpy.data.objects['Sloping_Black_Plastic_Apron']
def apron_top(x):
t = (0.171-x)/0.342
return 0.360-0.062*(0.55*t+0.45*t*t)
def apron_bottom(x):
t = (0.171-x)/0.342
return 0.208+0.006*t
def deck_height(x,y):
front_y = 0.154+0.008*(1-(x/0.171)**2)
t = min(1,max(0,(y+0.108)/(front_y+0.108)))
return (apron_top(x)-0.012)*(1-t)+(apron_bottom(x)+0.001)*t
report['apron_top_profile'] = [[x,apron_top(x)] for x in [0.171,0.0855,0,-0.0855,-0.171]]
report['apron_descends_left_to_right'] = all(a[1]>b[1] for a,b in zip(report['apron_top_profile'],report['apron_top_profile'][1:]))
report['old_v_control_band_removed'] = 'Curved_Black_Control_Band' not in bpy.data.objects
report['lcd_allowed_statuses'] = ['Ready','Processing','Stopped']
report['lcd_has_no_extra_text'] = sorted(obj.data.body for obj in bpy.data.objects if obj.type=='FONT' and not obj.name.startswith('VIDEO_')) == sorted(report['lcd_allowed_statuses'])
report['lcd_state_checks'] = {}
for frame in range(1,361):
scene.frame_set(frame)
bpy.context.view_layer.update()
expected = 'Ready' if frame<28 else 'Processing' if frame<322 else 'Stopped'
visible = [status for status in report['lcd_allowed_statuses'] if not bpy.data.objects['LCD_Status_'+status].hide_render and not bpy.data.objects['LCD_Status_'+status].hide_viewport]
report['lcd_state_checks'][str(frame)] = {'expected':expected,'visible':visible,'passed':visible==[expected]}
report['lcd_state_check_scope'] = 'Every frame from 1 through 360: exactly one status is visible in both the viewport and render'
report['lcd_exactly_one_status_per_frame'] = len(report['lcd_state_checks'])==360 and all(check['passed'] for check in report['lcd_state_checks'].values())
scene.frame_set(1)
bpy.context.view_layer.update()
button = bpy.data.objects['Start_Button_Assembly']
rest_y = button.location.y
scene.frame_set(24)
bpy.context.view_layer.update()
report['button_press_travel_m'] = button.location.y-rest_y
report['button_presses_inward'] = abs(report['button_press_travel_m']+0.0025)<0.000001
scene.frame_set(27)
report['button_returns_after_press'] = abs(button.location.y-rest_y)<0.000001
control_bounds = {}
for name in ['LCD_Bezel','Start_Button_Rim']:
obj = bpy.data.objects[name]
points = [obj.matrix_world@Vector(corner) for corner in obj.bound_box]
bounds = {'x':[min(p.x for p in points),max(p.x for p in points)],'z':[min(p.z for p in points),max(p.z for p in points)]}
bounds['right_half'] = bounds['x'][1]<0
bounds['inside_control_pod_profile'] = all(bounds['z'][0]>apron_bottom(x) and bounds['z'][1]<apron_top(x) for x in bounds['x'])
control_bounds[name] = bounds
report['control_layout_bounds'] = control_bounds
report['controls_on_right_and_fixed_pod'] = all(bounds['right_half'] and bounds['inside_control_pod_profile'] for bounds in control_bounds.values())
def belongs_to(obj, root_name):
current = obj
while current is not None:
if current.name == root_name:
return True
current = current.parent
return False
report['control_pod_parts_fixed'] = all(belongs_to(bpy.data.objects[name], 'Fixed_Control_Pod_Assembly') for name in ['LCD_Bezel','LCD_Screen','LCD_Status_Ready','Start_Button_Rim','Start_Button_Assembly','Fixed_Control_Pod_Housing'])
report['removable_deck_excludes_controls'] = not belongs_to(apron, 'Fixed_Control_Pod_Assembly') and belongs_to(apron, 'Collection_Deck_Assembly') and not belongs_to(bpy.data.objects['LCD_Bezel'], 'Collection_Deck_Assembly')
report['inclined_deck_fascia_profile'] = abs(apron['height_m']-(apron_top(0)-apron_bottom(0)))<0.000001
report['fascia_lower_edge_nearly_level'] = abs(apron_bottom(0.171)-apron_bottom(-0.171))<=0.006001
report['lcd_text_fits_screen'] = all(bpy.data.objects['LCD_Status_'+status].dimensions.x<0.069 and bpy.data.objects['LCD_Status_'+status].dimensions.z<0.015 for status in report['lcd_allowed_statuses'])
report['lcd_front_faces_positive_y'] = all((bpy.data.objects['LCD_Status_'+status].matrix_world.to_quaternion()@Vector((0,0,1))-Vector((0,1,0))).length<0.0001 for status in report['lcd_allowed_statuses'])
report['front_facing_checks'] = {}
for obj in [disc,male,bpy.data.objects['Press_Equilateral_Triangle_Carrier']]:
normal = obj.matrix_world.to_quaternion() @ Vector((1,0,0))
report['front_facing_checks'][obj.name] = {
'face_normal':list(normal),
'expected':[0,1,0],
'error':(normal-Vector((0,1,0))).length,
}
report['front_faces_xoz_passed'] = all(v['error']<0.0001 for v in report['front_facing_checks'].values())
report['blade_minimum_edge_radius_m'] = abs(blade.location.y-blade.dimensions.y/2-disc.location.y)
report['blade_outside_drum'] = report['blade_minimum_edge_radius_m'] > bpy.data.objects['Four_Pocket_Disc_Thick_Body'].dimensions.y/2
report['circular_disc_silhouette'] = abs(bpy.data.objects['Disc_Solid_Front_Cover'].dimensions.y-0.208)<0.0001
report['blade_outside_pocket_rims'] = report['blade_minimum_edge_radius_m'] > 0.103
report['blade_penetration_disabled_by_geometry'] = not blade['penetrates_drum'] and report['blade_outside_pocket_rims']
report['curved_hopper_parts_present'] = all(name in bpy.data.objects for name in ['Curved_Hopper_Continuous_U_Trough','Hopper_Backstop','Fixed_Entrance_Sliding_Ramp','Entrance_Periodic_Gate_Pivot'])
report['flat_l_hopper_removed'] = not any(obj.name.startswith('L_Hopper_') for obj in bpy.data.objects)
report['four_fruit_positions_on_curved_hopper'] = all(name in bpy.data.objects for name in ['Process_Whole_Orange','Hopper_Queued_Orange_1','Hopper_Queued_Orange_2','Hopper_Queued_Orange_3'])
report['separate_half_and_residue_meshes'] = all(name in bpy.data.objects for name in ['Process_Retained_Half_Peel','Process_Blade_Half_Peel','Residue_A_Pressed_Half_Peel_Empty_Peel','Residue_B_Pressed_Half_Peel_Empty_Peel'])
report['visibility_checks'] = {}
assembly_names = ['Process_Whole_Orange','Process_Retained_Half','Process_Blade_Half','Residue_A_Pressed_Half_Peel','Residue_B_Pressed_Half_Peel']
visibility_expectations = {
1:{'Process_Whole_Orange'},
127:{'Process_Whole_Orange'},
128:{'Process_Retained_Half','Process_Blade_Half'},
192:{'Process_Retained_Half','Process_Blade_Half'},
213:{'Process_Retained_Half','Process_Blade_Half'},
214:{'Process_Blade_Half','Residue_A_Pressed_Half_Peel'},
256:{'Process_Blade_Half','Residue_A_Pressed_Half_Peel'},
278:{'Residue_A_Pressed_Half_Peel','Residue_B_Pressed_Half_Peel'},
360:{'Residue_A_Pressed_Half_Peel','Residue_B_Pressed_Half_Peel'},
}
for frame,visible in visibility_expectations.items():
scene.frame_set(frame)
bpy.context.view_layer.update()
unexpected = []
for name in assembly_names:
assembly = bpy.data.objects[name]
should_hide = name not in visible
for child in [assembly,*assembly.children_recursive]:
if child.hide_render != should_hide or child.hide_viewport != should_hide:
unexpected.append(child.name)
report['visibility_checks'][str(frame)] = {'unexpected_objects':unexpected,'passed':not unexpected}
report['recursive_visibility_passed'] = all(v['passed'] for v in report['visibility_checks'].values())
mechanism_color = bpy.data.materials['Mechanism_Light_Blue_Gray_Polymer'].diffuse_color
fruit_color = bpy.data.materials['Orange_Peel_Procedural'].diffuse_color
report['mechanism_fruit_color_distance'] = (Vector(mechanism_color[:3])-Vector(fruit_color[:3])).length
report['mechanism_fruit_colors_differ'] = report['mechanism_fruit_color_distance']>0.4
report['collector_flags'] = {
'juice_no_spout':not bpy.data.objects['Juice_Collection_Box_Contoured']['has_spout'],
'juice_handle_present':bpy.data.objects['Juice_Collection_Box_Contoured']['has_handle'],
'residue_no_juice':not bpy.data.objects['Residue_Collection_Box']['contains_juice'],
}
report['pocket_orientation_checks'] = {}
report['pocket_axial_center_errors_m'] = {}
for frame,index,expected in [(64,1,(0,0,1)),(128,1,(-1,0,0)),(192,1,(0,0,-1)),(256,2,(0,0,-1))]:
scene.frame_set(frame)
bpy.context.view_layer.update()
pocket = bpy.data.objects['Hemispherical_Pocket_'+str(index+1)]
normal = disc.matrix_world.to_quaternion() @ Vector(pocket['radial_opening_local'])
pp = pocket.matrix_world.translation
axial_error = abs(pp.y-disc.matrix_world.translation.y)
report['pocket_axial_center_errors_m'][f'{frame}_pocket_{index}'] = axial_error
report['pocket_orientation_checks'][f'{frame}_pocket_{index}'] = {
'normal':list(normal),
'expected':expected,
'error':(normal-Vector(expected)).length,
'opening_plane_contains_y_axis':abs(normal.y)<0.000001,
}
report['pocket_orientation_passed'] = all(v['error']<0.0001 and v['opening_plane_contains_y_axis'] for v in report['pocket_orientation_checks'].values())
report['pockets_centered_across_drum_thickness'] = all(v<0.000001 for v in report['pocket_axial_center_errors_m'].values())
report['pocket_dimensions'] = {name:{key:bpy.data.objects[name][key] for key in ['inner_radius_m','outer_radius_m','depth_m']} for name in ['Hemispherical_Pocket_1','Hemispherical_Pocket_2','Hemispherical_Pocket_3','Hemispherical_Pocket_4']}
report['hemispherical_pockets_passed'] = all(v['inner_radius_m']>0.030 and v['outer_radius_m']>v['inner_radius_m'] and v['depth_m']==v['outer_radius_m'] for v in report['pocket_dimensions'].values())
scene.frame_set(128)
bpy.context.view_layer.update()
report['disc_top_moves_to_negative_x'] = (disc.matrix_world.to_quaternion() @ Vector((0,0,1))-Vector((-1,0,0))).length < 0.0001
report['disc_rotation_is_clockwise_from_positive_y'] = report['disc_top_moves_to_negative_x'] and disc.rotation_euler.x<0 and abs(disc.rotation_euler.y)<1e-6 and abs(disc.rotation_euler.z)<1e-6
male_angle_at_cut = male.rotation_euler.x
scene.frame_set(145)
report['press_rotation_is_clockwise_from_positive_y'] = male.rotation_euler.x<male_angle_at_cut and abs(male.rotation_euler.y)<1e-6 and abs(male.rotation_euler.z)<1e-6
previous_rotations = None
report['both_mechanisms_clockwise_throughout'] = True
report['rotor_step_ranges_degrees'] = {'disc':[float('inf'),float('-inf')],'press':[float('inf'),float('-inf')]}
report['rotor_zero_speed_frames'] = []
report['rotor_frame_deltas'] = {}
for frame in range(1,361):
scene.frame_set(frame)
rotations = (disc.rotation_euler.x,male.rotation_euler.x)
if previous_rotations is not None:
deltas = tuple(math.degrees(rotations[i]-previous_rotations[i]) for i in range(2))
report['rotor_frame_deltas'][str(frame)] = deltas
if deltas[0]>=-0.00001 or deltas[1]>=-0.00001:
report['both_mechanisms_clockwise_throughout'] = False
report['rotor_zero_speed_frames'].append(frame)
for name,delta in zip(['disc','press'],deltas):
bounds = report['rotor_step_ranges_degrees'][name]
bounds[0] = min(bounds[0],delta)
bounds[1] = max(bounds[1],delta)
previous_rotations = rotations
report['both_rotors_continuous_throughout'] = report['both_mechanisms_clockwise_throughout'] and not report['rotor_zero_speed_frames']
report['press_to_disc_angular_speed_ratio'] = report['rotor_step_ranges_degrees']['press'][0]/report['rotor_step_ranges_degrees']['disc'][0]
report['constant_speed_ratio_passed'] = abs(report['press_to_disc_angular_speed_ratio']-4/3)<0.0001
scene.frame_set(128)
bpy.context.view_layer.update()
pocket_normal = disc.matrix_world.to_quaternion() @ Vector(bpy.data.objects['Hemispherical_Pocket_2']['radial_opening_local'])
blade_tangent = blade.matrix_world.to_quaternion() @ Vector((0,0,1))
blade_plane_normal = blade.matrix_world.to_quaternion() @ Vector((0,1,0))
report['blade_tangent_at_cutting_station'] = abs(blade_tangent.dot(pocket_normal))<0.0001
report['blade_cut_plane_matches_fruit_split'] = (blade_plane_normal-pocket_normal).length<0.0001
fruit_center = bpy.data.objects['Process_Whole_Orange'].matrix_world.translation
disc_center = disc.matrix_world.translation
report['cutting_fruit_radius_m'] = math.hypot(fruit_center.x-disc_center.x,fruit_center.z-disc_center.z)
report['fruit_centered_on_external_cutting_edge'] = abs(report['cutting_fruit_radius_m']-blade['cutting_edge_radius_m'])<0.00001
scene.frame_set(182)
ejector = bpy.data.objects['Blade_Discharge_Spring_Pivot']
report['spring_ejector_moves_in_xoz'] = abs(ejector.rotation_euler.x)>0.1 and (ejector.matrix_world.to_quaternion() @ Vector((1,0,0))-Vector((0,1,0))).length<0.0001
report['fruit_rolling_nip_checks'] = {}
for half_name,pocket_index,frames in [('Process_Retained_Half',2,[176,184,192,200,208]),('Process_Blade_Half',3,[240,248,256,264,270])]:
positions = []
errors = []
orientation_errors = []
scales = []
for frame in frames:
scene.frame_set(frame)
bpy.context.view_layer.update()
half = bpy.data.objects[half_name]
pocket = bpy.data.objects['Hemispherical_Pocket_'+str(pocket_index)]
expected = pocket.matrix_world.translation
positions.append(half.matrix_world.translation.copy())
errors.append((expected-half.matrix_world.translation).length)
inward = disc.matrix_world.to_quaternion() @ -Vector(pocket['radial_opening_local'])
dome = half.matrix_world.to_quaternion() @ Vector((0,0,1))
orientation_errors.append((inward-dome).length)
scales.append(list(half.scale))
report['fruit_rolling_nip_checks'][half_name] = {
'frames':frames,
'pocket_tracking_errors_m':errors,
'dome_orientation_errors':orientation_errors,
'arc_travel_m':(positions[-1]-positions[0]).length,
'root_scales':scales,
}
report['fruit_follows_pocket_through_press'] = all(max(v['pocket_tracking_errors_m'])<0.00001 and max(v['dome_orientation_errors'])<0.0001 and v['arc_travel_m']>0.040 for v in report['fruit_rolling_nip_checks'].values())
report['no_fake_z_squash_or_ram'] = all(abs(scale[2]-1)<0.000001 for v in report['fruit_rolling_nip_checks'].values() for scale in v['root_scales'])
report['pressing_alignment'] = {}
for frame,half_name,pocket_index,ball_index in [(192,'Process_Retained_Half',1,1),(256,'Process_Blade_Half',2,2)]:
scene.frame_set(frame)
bpy.context.view_layer.update()
pocket = bpy.data.objects['Hemispherical_Pocket_'+str(pocket_index+1)]
ball = bpy.data.objects['Spherical_Pressing_Head_'+str(ball_index+1)]
pp = pocket.matrix_world.translation
bp = ball.matrix_world.translation
pocket_normal = disc.matrix_world.to_quaternion() @ Vector(pocket['radial_opening_local'])
ball_normal = (male.matrix_world.to_quaternion() @ Vector((0,ball.location.y,ball.location.z))).normalized()
half = bpy.data.objects[half_name]
dome_normal = half.matrix_world.to_quaternion() @ Vector((0,0,1))
cup = bpy.data.objects[half_name+'_Cut_Flesh'].data.shape_keys.key_blocks['Pressed_Around_Spherical_Head']
report['pressing_alignment'][str(frame)] = {
'pocket_center_m':list(pp),
'ball_center_m':list(bp),
'ball_pocket_center_error_m':(pp-bp).length,
'half_cut_plane_origin_m':list(half.matrix_world.translation),
'ball_half_origin_error_m':(bp-half.matrix_world.translation).length,
'ball_inward_apex_m':list(bp+ball_normal*0.028),
'flesh_cup_apex_m':list(half.matrix_world @ Vector((0,0,0.0289))),
'half_dome_matches_inward_normal':dome_normal.dot(-pocket_normal)>0.999,
'flesh_conforms_to_ball':cup.value>0.999,
'root_scale':list(half.scale),
'disc_step_degrees':report['rotor_frame_deltas'][str(frame)][0],
'press_step_degrees':report['rotor_frame_deltas'][str(frame)][1],
}
report['pressing_alignment_passed'] = all(v['ball_pocket_center_error_m']<0.00001 and v['ball_half_origin_error_m']<0.00001 and v['half_dome_matches_inward_normal'] and v['flesh_conforms_to_ball'] and v['disc_step_degrees']<-0.01 and v['press_step_degrees']<-0.01 for v in report['pressing_alignment'].values())
report['residue_contact_and_motion'] = {}
for name,half_name,ball_name,pocket_name,show_frame,end in [('Residue_A_Pressed_Half_Peel','Process_Retained_Half','Spherical_Pressing_Head_2','Hemispherical_Pocket_2',214,242),('Residue_B_Pressed_Half_Peel','Process_Blade_Half','Spherical_Pressing_Head_3','Hemispherical_Pocket_3',278,306)]:
obj = bpy.data.objects[name]
scene.frame_set(show_frame)
bpy.context.view_layer.update()
actual_at_show = obj.matrix_world.translation.copy()
scene.frame_set(show_frame)
bpy.context.view_layer.update()
expected = bpy.data.objects[pocket_name].matrix_world.translation.copy()
contact_error = (actual_at_show-expected).length
scene.frame_set(show_frame)
bpy.context.view_layer.update()
start_position = obj.matrix_world.translation.copy()
start_rotation = obj.matrix_world.to_quaternion()
scene.frame_set(end)
bpy.context.view_layer.update()
position = obj.matrix_world.translation.copy()
end_rotation = obj.matrix_world.to_quaternion()
ball_position = bpy.data.objects[ball_name].matrix_world.translation
center = bpy.data.objects['Residue_Collection_Box_Slide'].matrix_world @ Vector((0.0625,0.068,0))
report['residue_contact_and_motion'][name] = {
'initial_pressed_half_position_error_m':contact_error,
'actual_at_show':list(actual_at_show),
'expected_at_show':list(expected),
'guided_lateral_travel_m':math.hypot(position.x-start_position.x,position.y-start_position.y),
'release_rotation_change_radians':start_rotation.rotation_difference(end_rotation).angle,
'z_at_release_m':start_position.z,
'z_in_bin_m':position.z,
'falls_downward':position.z<start_position.z,
'distance_from_rotating_ball_at_rest_m':(position-ball_position).length,
'inside_residue_box_world_coordinates':abs(position.x-center.x)<0.085 and abs(position.y-center.y)<0.073 and 0.050<position.z<0.250,
}
report['residue_motion_passed'] = all(v['initial_pressed_half_position_error_m']<0.00001 and abs(v['release_rotation_change_radians'])<0.0001 and v['falls_downward'] and v['distance_from_rotating_ball_at_rest_m']>0.12 and v['inside_residue_box_world_coordinates'] for v in report['residue_contact_and_motion'].values())
scene.frame_set(350)
report['residue_and_box_slide_error_m'] = (bpy.data.objects['Residue_Animation_Slide'].matrix_world.translation-bpy.data.objects['Residue_Collection_Box_Slide'].matrix_world.translation).length
report['collector_slide_synchronized'] = report['residue_and_box_slide_error_m']<0.000001
liquid = bpy.data.objects['Juice_Level_Inside_Collection_Box']
juice_bin = bpy.data.objects['Juice_Collection_Box_Contoured']
report['juice_level_frame_checks'] = {}
for frame in [1,175,176,192,256,322,350,360]:
scene.frame_set(frame)
bpy.context.view_layer.update()
hidden = liquid.hide_render
liquid_points = [liquid.matrix_world@Vector(corner) for corner in liquid.bound_box]
bin_points = [juice_bin.matrix_world@Vector(corner) for corner in juice_bin.bound_box]
contained = all([
min(p.x for p in liquid_points)>=min(p.x for p in bin_points)-0.0001,
max(p.x for p in liquid_points)<=max(p.x for p in bin_points)+0.0001,
min(p.y for p in liquid_points)>=min(p.y for p in bin_points)-0.0001,
max(p.y for p in liquid_points)<=max(p.y for p in bin_points)+0.0001,
min(p.z for p in liquid_points)>=juice_bin['floor_z_m'],
max(p.z for p in liquid_points)<=juice_bin['rim_min_z_m'],
])
report['juice_level_frame_checks'][str(frame)] = {'hidden':hidden,'expected_hidden':frame<176,'contained_when_visible':contained,'passed':hidden==(frame<176) and (hidden or contained)}
report['juice_level_visibility_and_containment_passed'] = all(item['passed'] for item in report['juice_level_frame_checks'].values())
report['non_manifold_edges'] = {}
report['positive_part_volumes_m3'] = {}
for name in ['Sloping_Black_Plastic_Apron','Chamber_Lower_Backplate','Disc_Drive_Shaft','Press_Fixed_Drive_Shaft','Disc_Backplate_Bearing_Mount','Press_Backplate_Bearing_Mount','Blade_Backplate_Support','Blade_Backplate_Mount','Hopper_Support','Hopper_Backplate_Support_Arm','Hopper_Backplate_Mount','Juice_Guide_Deck_Cleat','Juice_Guide_Deck_Cleat.001','Juice_Guide_Outlet_Cantilever','LCD_Bezel','LCD_Screen','Start_Button_Rim','Start_Button','Four_Pocket_Disc_Thick_Body','Fixed_Tangential_Cutting_Blade','Spherical_Pressing_Head_1','Press_Equilateral_Triangle_Carrier','Process_Retained_Half_Peel','Residue_A_Pressed_Half_Peel_Empty_Peel','Curved_Hopper_Continuous_U_Trough','Fixed_Entrance_Sliding_Ramp','Juice_Collection_Box_Contoured','Residue_Collection_Box','Cabinet_Base_Plinth','Collector_Shared_Bay_Sill','Juice_Guide_Solid_Tray_No_Mesh','Transparent_Hood_With_Curved_Sides','Transparent_Hood_Rear_Closure','Chamber_Rear_Wall']+['Hemispherical_Pocket_'+str(i) for i in range(1,5)]+['Pocket_Rim_'+str(i) for i in range(1,5)]+['Fixed_Control_Pod_Housing','Control_Pod_Base_Standard','Control_Pod_Rear_Support','Collection_Deck_Shallow_Rear_Tray','Collection_Deck_Rear_Lip','Chamber_Left_Rear_Return','Chamber_Right_Rear_Return','Lower_Left_Service_Cover','Lower_Right_Service_Cover']:
scene.frame_set(1)
obj = bpy.data.objects[name]
ev = obj.evaluated_get(bpy.context.evaluated_depsgraph_get())
mesh = ev.to_mesh()
bm = bmesh.new()
bm.from_mesh(mesh)
report['non_manifold_edges'][name] = sum(not e.is_manifold for e in bm.edges)
report['positive_part_volumes_m3'][name] = bm.calc_volume(signed=True)
bm.free()
ev.to_mesh_clear()
def tree(obj):
ev = obj.evaluated_get(bpy.context.evaluated_depsgraph_get())
mesh = ev.to_mesh()
result = BVHTree.FromPolygons([ev.matrix_world@v.co for v in mesh.vertices],[list(p.vertices) for p in mesh.polygons])
ev.to_mesh_clear()
return result
scene.frame_set(2)
scene.frame_set(1)
bpy.context.view_layer.update()
report['rear_side_returns'] = {}
for name in ['Chamber_Left_Rear_Return','Chamber_Right_Rear_Return']:
obj = bpy.data.objects[name]
report['rear_side_returns'][name] = {
'fixed':belongs_to(obj,'Fixed_Chassis_Assembly'),
'material':obj.data.materials[0].name,
'opaque':obj.data.materials[0].name != 'Clear_Tritan_Thin_Shell',
}
report['rear_side_returns_fixed_and_opaque'] = all(item['fixed'] and item['opaque'] for item in report['rear_side_returns'].values())
deck_tree = tree(bpy.data.objects['Collection_Deck_Shallow_Rear_Tray'])
report['inclined_deck_surface_checks'] = []
for y in [-0.100,-0.050,0.020,0.100,0.145]:
expected = deck_height(0.163,y)
hit = deck_tree.ray_cast(Vector((0.163,y,0.500)),Vector((0,0,-1)),0.400)[0]
report['inclined_deck_surface_checks'].append({'y_m':y,'expected_z_m':expected,'actual_z_m':None if hit is None else hit.z,'passed':hit is not None and abs(hit.z-expected)<0.0017})
report['inclined_deck_surface_passed'] = all(item['passed'] for item in report['inclined_deck_surface_checks'])
report['collector_opening_checks'] = {}
for name,x,y,expected_open in [('residue_inlet',0.054,0.014,True),('residue_front_cover',0.0625,0.105,False),('residue_rear_cover',0.130,-0.012,False),('juice_mouth',-0.100,0.087,True)]:
hit = deck_tree.ray_cast(Vector((x,y,0.400)),Vector((0,0,-1)),0.300)[0]
is_open = hit is None
report['collector_opening_checks'][name] = {'open':is_open,'expected_open':expected_open,'hit':None if hit is None else list(hit),'passed':is_open==expected_open}
report['collector_openings_passed'] = all(item['passed'] for item in report['collector_opening_checks'].values())
report['residue_inlet_xy_bounds_m'] = {'x':[0.007,0.101],'y':[-0.027,0.055]}
report['residue_entry_xy_m'] = [0.0518,0.0]
report['residue_entry_aligned_with_inlet'] = 0.007<0.0518<0.101 and -0.027<0.0<0.055
guide_tree = tree(bpy.data.objects['Juice_Guide_Solid_Tray_No_Mesh'])
guide_checks = []
for x,expected in [(0.025,0.343926),(-0.100,0.245)]:
hit = guide_tree.ray_cast(Vector((x,0.0675,0.500)),Vector((0,0,-1)),0.400)[0]
guide_checks.append({'global_x_m':x,'expected_z_m':expected,'actual_z_m':None if hit is None else hit.z})
report['juice_guide_flow_checks'] = guide_checks
report['juice_guide_outlet_above_front_bin'] = -0.160 < -0.100 < -0.040 and 0.020 < 0.0675 < 0.154
report['juice_guide_flow_passed'] = all(item['actual_z_m'] is not None and abs(item['actual_z_m']-item['expected_z_m'])<0.002 for item in guide_checks) and report['juice_guide_outlet_above_front_bin']
juice = bpy.data.objects['Juice_Collection_Box_Contoured']
residue = bpy.data.objects['Residue_Collection_Box']
report['collector_reference'] = {'file':'model_assets/reference/juicer/ZMUEX_working_video.mp4','assembly_segment_seconds':[233,249],'left':'Residue','right':'Juice','construction':'Shallow front bins installed after the black collection deck; residue top covered except for its discharge inlet'}
def collector_center(obj):
corners = [obj.matrix_world@Vector(corner) for corner in obj.bound_box]
return sum(corners,Vector((0,0,0)))/len(corners)
report['collector_positions'] = {'residue_center':list(collector_center(residue)),'juice_center':list(collector_center(juice))}
report['left_residue_right_juice'] = collector_center(residue).x>collector_center(juice).x
report['residue_rim_height_range_m'] = residue['rim_max_z_m']-residue['rim_min_z_m']
report['juice_rim_height_range_m'] = juice['rim_max_z_m']-juice['rim_min_z_m']
report['collector_rim_contours_passed'] = report['residue_rim_height_range_m']>0.040 and report['juice_rim_height_range_m']>0.012
report['collector_tapers_passed'] = juice['bottom_scale']<1 and residue['bottom_scale']<1 and juice['bottom_y_scale']==1 and residue['bottom_y_scale']==1
report['custom_collector_base_parts_present'] = all(name in bpy.data.objects for name in ['Cabinet_Base_Plinth','Collector_Shared_Bay_Sill','Chamber_Lower_Backplate','Collection_Deck_Assembly','Lower_Service_Cover_Assembly','Fixed_Control_Pod_Assembly'])
obsolete_names = ['Cabinet_Main_Body','Rear_Service_Panel','Residue_Service_Door','Residue_Door_Pull_Recess','Residue_Door_Pull_Lip','Residue_Guide_Link','Residue_Guide_Riser','Residue_Guide_Base_Link','Residue_Chute_Base']
report['obsolete_lower_parts_absent'] = all(name not in bpy.data.objects for name in obsolete_names) and not any(obj.name.startswith(('Juice_Bay_','Residue_Bay_')) or 'Center_Divider' in obj.name for obj in bpy.data.objects)
juice_tree = tree(juice)
residue_tree = tree(residue)
handle_ray_x = collector_center(juice).x-0.060
handle_hit = juice_tree.ray_cast(Vector((handle_ray_x,0.060,0.128)),Vector((1,0,0)),0.060)[0]
upper_hit = juice_tree.ray_cast(Vector((handle_ray_x,0.060,0.175)),Vector((1,0,0)),0.060)[0]
report['juice_handle_through_cut_passed'] = handle_hit is None and upper_hit is not None
front_pull_hit = residue_tree.ray_cast(Vector((0.0625,0.169,0.165)),Vector((0,-1,0)),0.030)[0]
front_wall_hit = residue_tree.ray_cast(Vector((0.0625,0.169,0.180)),Vector((0,-1,0)),0.030)[0]
report['residue_front_pull_integrated_passed'] = residue['integrated_front_pull'] and front_pull_hit is None and front_wall_hit is not None
report['residue_rear_fit_checks'] = []
for x,y in [(-0.025,-0.0175),(0.030,-0.0175),(0.090,-0.0175),(0.140,-0.0175),(-0.0338,0.030),(0.1588,0.030),(-0.0338,0.100),(0.1588,0.100),(-0.0338,0.120),(0.1588,0.120),(0.0625,0.1535)]:
t = (y+0.018)/0.172
front_t = min(1,max(0,(t-0.82)/0.18))
front_fit = front_t*front_t*(3-2*front_t)
expected = deck_height(x,y)-0.007-0.001*front_fit
hit = residue_tree.ray_cast(Vector((x,y,expected-0.002)),Vector((0,0,1)),0.004)[0]
error = None if hit is None else abs(hit.z-expected)
report['residue_rear_fit_checks'].append({'x_m':x,'y_m':y,'expected_rim_z_m':expected,'actual_rim_z_m':None if hit is None else hit.z,'error_m':error,'passed':error is not None and error<0.0008})
report['residue_rear_fit_passed'] = all(item['passed'] for item in report['residue_rear_fit_checks'])
report['lower_rear_covers_materials'] = {name:bpy.data.objects[name].data.materials[0].name for name in ['Lower_Left_Service_Cover','Lower_Right_Service_Cover']}
report['rear_covers_distinct_from_bins'] = all(mat=='Graphite_Control_And_Frame' for mat in report['lower_rear_covers_materials'].values())
report['collector_exterior_fit'] = {}
for name,obj,expected_x,expected_y,expected_depth in [('juice',juice,(-0.160,-0.042),(0.020,0.154),0.134),('residue',residue,(-0.035,0.160),(-0.018,0.154),0.172)]:
points = [obj.matrix_world@Vector(corner) for corner in obj.bound_box]
xs = [point.x for point in points]
ys = [point.y for point in points]
report['collector_exterior_fit'][name] = {
'x_range_m':[min(xs),max(xs)],'expected_x_m':list(expected_x),
'y_range_m':[min(ys),max(ys)],'expected_y_m':list(expected_y),
'depth_m':max(ys)-min(ys),'expected_depth_m':expected_depth,'floor_z_m':obj['floor_z_m'],
'passed':abs(min(xs)-expected_x[0])<0.0001 and abs(max(xs)-expected_x[1])<0.0001 and abs(min(ys)-expected_y[0])<0.0001 and abs(max(ys)-expected_y[1])<0.0001 and abs((max(ys)-min(ys))-expected_depth)<0.0001,
}
residue_left_x = min((residue.matrix_world@Vector(corner)).x for corner in residue.bound_box)
juice_right_x = max((juice.matrix_world@Vector(corner)).x for corner in juice.bound_box)
report['collector_wall_gap_m'] = residue_left_x-juice_right_x
report['collector_front_bay_clearances_m'] = {name:min((obj.matrix_world@Vector(corner)).y for corner in obj.bound_box)-bpy.data.objects['Chamber_Rear_Wall']['front_y_m'] for name,obj in [('residue',residue),('juice',juice)]}
report['collector_front_bay_clearance_passed'] = all(value>0.080 for value in report['collector_front_bay_clearances_m'].values())
report['service_cover_side_clearances_m'] = {
'residue':bpy.data.objects['Lower_Left_Service_Cover']['inner_face_x_m']-max((residue.matrix_world@Vector(corner)).x for corner in residue.bound_box),
'juice':min((juice.matrix_world@Vector(corner)).x for corner in juice.bound_box)-bpy.data.objects['Lower_Right_Service_Cover']['inner_face_x_m'],
}
report['service_cover_top_fit_checks'] = {}
for name in ['Lower_Left_Service_Cover','Lower_Right_Service_Cover']:
obj = bpy.data.objects[name]
actual = max((obj.matrix_world@Vector(corner)).z for corner in obj.bound_box)
expected = max(deck_height(obj.location.x,-0.133+0.159*i/32)-0.004 for i in range(33))
report['service_cover_top_fit_checks'][name] = {'expected_z_m':expected,'actual_z_m':actual,'passed':abs(actual-expected)<0.0001}
report['deck_rail_cover_side_clearance_m'] = (0.170-0.001)-(0.166+0.002)
report['service_cover_clearance_passed'] = all(abs(value-0.004)<0.0001 for value in report['service_cover_side_clearances_m'].values()) and all(item['passed'] for item in report['service_cover_top_fit_checks'].values()) and abs(report['deck_rail_cover_side_clearance_m']-0.001)<0.0001
sill_tree = tree(bpy.data.objects['Collector_Shared_Bay_Sill'])
report['collector_base_contact_checks'] = {}
for name,obj in [('juice',juice),('residue',residue)]:
center = collector_center(obj)
hit = sill_tree.ray_cast(Vector((center.x,center.y,0.080)),Vector((0,0,-1)),0.060)[0]
report['collector_base_contact_checks'][name] = {'bin_floor_z_m':obj['floor_z_m'],'sill_hit_z_m':None if hit is None else hit.z,'contact':hit is not None and abs(hit.z-obj['floor_z_m'])<0.000001}
report['collectors_sit_on_shared_base'] = all(item['contact'] for item in report['collector_base_contact_checks'].values())
report['shared_lower_bay_passed'] = (
abs(report['collector_wall_gap_m']-0.007)<0.0001
and report['collector_front_bay_clearance_passed'] and report['service_cover_clearance_passed']
and report['custom_collector_base_parts_present'] and report['obsolete_lower_parts_absent']
and report['collectors_sit_on_shared_base']
)
report['collector_shape_checks_passed'] = all([
report['shared_lower_bay_passed'],report['left_residue_right_juice'],
report['collector_rim_contours_passed'],report['collector_tapers_passed'],
report['juice_handle_through_cut_passed'],report['residue_front_pull_integrated_passed'],report['residue_rear_fit_passed'],
all(item['passed'] for item in report['collector_exterior_fit'].values()),
])
hopper = bpy.data.objects['Curved_Hopper_Continuous_U_Trough']
report['hopper_arc_radius_m'] = hopper['arc_radius_m']
report['hopper_inner_width_m'] = hopper['inner_width_m']
report['hopper_depth_m'] = hopper['trough_depth_m']
scene.frame_set(1)
bpy.context.view_layer.update()
evaluated = hopper.evaluated_get(bpy.context.evaluated_depsgraph_get())
evaluated_mesh = evaluated.to_mesh()
world_points = [hopper.matrix_world @ vertex.co for vertex in evaluated_mesh.vertices]
report['hopper_world_bounds_xy'] = {
'x':[min(point.x for point in world_points),max(point.x for point in world_points)],
'y':[min(point.y for point in world_points),max(point.y for point in world_points)],
}
report['hopper_top_overhang_m'] = max(max(abs(point.x)-0.165,point.y-(0.111+0.019*(1-(point.x/0.165)**2)),bpy.data.objects['Transparent_Hood_With_Curved_Sides']['rear_y_m']-point.y) for point in world_points)
report['hopper_top_footprint_passed'] = report['hopper_top_overhang_m']<=0.001
evaluated.to_mesh_clear()
def inlet_center(obj):
return obj.data.vertices[8].co.copy()
report['hopper_outlet_ramp_join_error_m'] = ((hopper.matrix_world @ inlet_center(hopper))-(bpy.data.objects['Fixed_Entrance_Sliding_Ramp'].matrix_world @ inlet_center(bpy.data.objects['Fixed_Entrance_Sliding_Ramp']))).length
report['hopper_outlet_ramp_join_passed'] = report['hopper_outlet_ramp_join_error_m']<0.000001
hood = bpy.data.objects['Transparent_Hood_With_Curved_Sides']
ramp = bpy.data.objects['Fixed_Entrance_Sliding_Ramp']
hood_evaluated = hood.evaluated_get(bpy.context.evaluated_depsgraph_get())
hood_mesh = hood_evaluated.to_mesh()
hood_tree = BVHTree.FromPolygons([vertex.co.copy() for vertex in hood_mesh.vertices],[list(poly.vertices) for poly in hood_mesh.polygons])
hood_inverse = hood.matrix_world.inverted()
rear_panel = bpy.data.objects['Transparent_Hood_Rear_Closure']
rear_evaluated = rear_panel.evaluated_get(bpy.context.evaluated_depsgraph_get())
rear_mesh = rear_evaluated.to_mesh()
rear_panel_tree = BVHTree.FromPolygons([vertex.co.copy() for vertex in rear_mesh.vertices],[list(poly.vertices) for poly in rear_mesh.polygons])
rear_glass_front_y = max((rear_panel.matrix_world@vertex.co).y for vertex in rear_mesh.vertices)
rear_evaluated.to_mesh_clear()
rear_y = hood['rear_y_m']
base = bpy.data.objects['Cabinet_Base_Plinth']
base_rear_y = min((base.matrix_world@Vector(corner)).y for corner in base.bound_box)
report['hood_rear_y_m'] = rear_y
report['hood_rear_extension_m'] = hood['rear_extension_m']
report['hood_rear_alignment_with_base_m'] = rear_y-base_rear_y
report['rear_liner_clearance_m'] = min((bpy.data.objects['Chamber_Rear_Wall'].matrix_world@Vector(corner)).y for corner in bpy.data.objects['Chamber_Rear_Wall'].bound_box)-rear_glass_front_y
report['rear_liner_compact_forward_shift_m'] = bpy.data.objects['Chamber_Rear_Wall']['compact_forward_shift_m']
report['backplate_front_y_m'] = bpy.data.objects['Chamber_Rear_Wall']['front_y_m']
report['backplate_thickness_m'] = bpy.data.objects['Chamber_Rear_Wall']['thickness_m']
report['green_backplate_materials'] = {name:bpy.data.objects[name].data.materials[0].name for name in ['Chamber_Rear_Wall','Chamber_Lower_Backplate']}
report['green_backplate_materials']['ribs'] = sorted({obj.data.materials[0].name for obj in bpy.data.objects if obj.name.startswith('Chamber_Backplate_Rib')})
lower_backplate = bpy.data.objects['Chamber_Lower_Backplate']
report['lower_backplate_base_contact_z_m'] = min((lower_backplate.matrix_world@Vector(corner)).z for corner in lower_backplate.bound_box)
report['green_backplate_checks_passed'] = (
abs(report['backplate_thickness_m']-0.022)<0.000001
and abs(lower_backplate['thickness_m']-0.022)<0.000001
and report['green_backplate_materials']['Chamber_Rear_Wall']=='Backplate_Green'
and report['green_backplate_materials']['Chamber_Lower_Backplate']=='Backplate_Green'
and report['green_backplate_materials']['ribs']==['Backplate_Green_Edge']
and abs(report['lower_backplate_base_contact_z_m']-0.035)<0.000001
and report['obsolete_lower_parts_absent']
)
report['decorative_latches_removed'] = not any(obj.name.startswith('Hood_Latch') for obj in bpy.data.objects)
report['compact_y_shift_m'] = hood['compact_forward_shift_m']
report['base_y_depth_m'] = base.dimensions.y
report['collector_depths_m'] = {'residue':residue.dimensions.y,'juice':juice.dimensions.y}
report['compact_depth_passed'] = abs(report['compact_y_shift_m']-0.040)<0.000001 and abs(report['base_y_depth_m']-0.326)<0.000001 and abs(report['collector_depths_m']['residue']-0.172)<0.000001 and abs(report['collector_depths_m']['juice']-0.134)<0.000001 and abs(rear_y+0.138)<0.000001
report['rear_roof_coverage_checks'] = []
report['rear_closure_coverage_checks'] = []
report['rear_apron_join_checks'] = []
for x in [-0.15,-0.075,0,0.075,0.15]:
expected_top = 0.678-0.039*(abs(x)/0.165)**10
hit,normal,index,distance = hood_tree.ray_cast(Vector((x,rear_y+0.015,expected_top+0.005)),Vector((0,0,-1)),0.010)
report['rear_roof_coverage_checks'].append({'x_m':x,'expected_z_m':expected_top,'actual_z_m':None if hit is None else hit.z})
z = (apron_top(x)+expected_top)/2
hit,normal,index,distance = rear_panel_tree.ray_cast(Vector((x,rear_y+0.005,z)),Vector((0,-1,0)),0.010)
report['rear_closure_coverage_checks'].append({'x_m':x,'sample_z_m':z,'hit_y_m':None if hit is None else hit.y})
expected_bottom = apron_top(x)
hit,normal,index,distance = hood_tree.ray_cast(Vector((x,rear_y+0.015,expected_bottom-0.003)),Vector((0,0,1)),0.006)
passed = hit is not None and abs(hit.z-expected_bottom)<0.001
report['rear_apron_join_checks'].append({'x_m':x,'expected_z_m':expected_bottom,'actual_z_m':None if hit is None else hit.z,'continuous_hood_floor':True,'passed':passed})
report['rear_roof_tolerance_m'] = 0.0016
report['rear_roof_covers_machine_back'] = all(check['actual_z_m'] is not None and abs(check['actual_z_m']-check['expected_z_m'])<=report['rear_roof_tolerance_m'] for check in report['rear_roof_coverage_checks'])
report['rear_transparent_closure_present'] = all(check['hit_y_m'] is not None and abs(check['hit_y_m']-rear_y)<0.001 for check in report['rear_closure_coverage_checks'])
report['rear_apron_join_passed'] = all(check['passed'] for check in report['rear_apron_join_checks'])
report['rear_liner_gap_reduced'] = 0.002<report['rear_liner_clearance_m']<0.006 and abs(report['rear_liner_compact_forward_shift_m']-0.040)<0.000001
report['hood_rear_alignment_passed'] = abs(report['hood_rear_extension_m']-0.018)<0.000001 and abs(report['compact_y_shift_m']-0.040)<0.000001 and abs(report['hood_rear_alignment_with_base_m'])<0.000001
report['rear_liner_roof_clearance_checks'] = []
backplate_tree = tree(bpy.data.objects['Chamber_Rear_Wall'])
def y_bounds(name):
obj = bpy.data.objects[name]
values = [(obj.matrix_world@Vector(corner)).y for corner in obj.bound_box]
return min(values),max(values)
report['backplate_mount_contacts'] = {}
for name in ['Disc_Backplate_Bearing_Mount','Press_Backplate_Bearing_Mount','Blade_Backplate_Mount','Hopper_Backplate_Mount']:
rear,front = y_bounds(name)
gap = rear-report['backplate_front_y_m']
report['backplate_mount_contacts'][name] = {'rear_y_m':rear,'gap_m':gap,'connected':abs(gap)<0.00001}
report['rear_ribs_mount_to_backplate'] = all(len(backplate_tree.overlap(tree(obj)))>0 for obj in bpy.data.objects if obj.name.startswith('Chamber_Backplate_Rib'))
report['bearing_shaft_engagement'] = {}
for shaft,bearing in [('Disc_Drive_Shaft','Disc_Rear_Bearing'),('Press_Fixed_Drive_Shaft','Press_Fixed_Axis_Bearing')]:
shaft_rear,_ = y_bounds(shaft)
bearing_rear,bearing_front = y_bounds(bearing)
report['bearing_shaft_engagement'][shaft] = {'shaft_rear_y_m':shaft_rear,'bearing_y_range_m':[bearing_rear,bearing_front],'engaged':bearing_rear<shaft_rear<bearing_front}
report['support_attachment_pairs'] = {}
for first,second in [
('Blade_Backplate_Support','Blade_Fixed_Mount'),
('Hopper_Backplate_Support_Arm','Hopper_Support'),
('Juice_Guide_Deck_Cleat','Juice_Guide_Outlet_Cantilever'),
('Juice_Guide_Deck_Cleat.001','Juice_Guide_Outlet_Cantilever'),
('Juice_Guide_Deck_Cleat','Collection_Deck_Shallow_Rear_Tray'),
('Juice_Guide_Deck_Cleat.001','Collection_Deck_Shallow_Rear_Tray'),
('Juice_Guide_Outlet_Cantilever','Juice_Guide_Solid_Tray_No_Mesh'),
('Juice_Guide_Outlet_Cantilever','Collection_Deck_Side_Rail_-1'),
]:
overlaps = len(tree(bpy.data.objects[first]).overlap(tree(bpy.data.objects[second])))
report['support_attachment_pairs'][first+' / '+second] = {'overlap_faces':overlaps,'connected':overlaps>0}
report['backplate_connections_passed'] = (
all(item['connected'] for item in report['backplate_mount_contacts'].values())
and report['rear_ribs_mount_to_backplate']
and all(item['engaged'] for item in report['bearing_shaft_engagement'].values())
and all(item['connected'] for item in report['support_attachment_pairs'].values())
and report['decorative_latches_removed'] and report['compact_depth_passed']
)
for x in [-0.15,-0.075,0,0.075,0.15]:
expected = 0.678-0.039*(abs(x)/0.165)**10-0.004
hit,normal,index,distance = backplate_tree.ray_cast(Vector((x,report['backplate_front_y_m']-bpy.data.objects['Chamber_Rear_Wall']['thickness_m']/2,expected-0.002)),Vector((0,0,1)),0.004)
report['rear_liner_roof_clearance_checks'].append({'x_m':x,'expected_z_m':expected,'actual_z_m':None if hit is None else hit.z})
report['rear_liner_roof_profile_tolerance_m'] = 0.0003
report['rear_liner_roof_profile_matches'] = all(check['actual_z_m'] is not None and abs(check['actual_z_m']-check['expected_z_m'])<=report['rear_liner_roof_profile_tolerance_m'] for check in report['rear_liner_roof_clearance_checks'])
contact_trees = {name:tree(bpy.data.objects[name]) for name in ['Chamber_Rear_Wall','Sloping_Black_Plastic_Apron','Chamber_Lower_Backplate','Transparent_Hood_With_Curved_Sides','Transparent_Hood_Rear_Closure']}
contact_pairs = [('Chamber_Rear_Wall','Sloping_Black_Plastic_Apron'),('Chamber_Lower_Backplate','Sloping_Black_Plastic_Apron'),('Chamber_Rear_Wall','Transparent_Hood_With_Curved_Sides'),('Chamber_Rear_Wall','Transparent_Hood_Rear_Closure'),('Chamber_Lower_Backplate','Transparent_Hood_Rear_Closure')]
for name in ['Fixed_Control_Pod_Housing','Control_Pod_Base_Standard','Control_Pod_Rear_Support','Collection_Deck_Shallow_Rear_Tray','Lower_Left_Service_Cover','Lower_Right_Service_Cover','Juice_Collection_Box_Contoured','Residue_Collection_Box']:
contact_trees[name] = tree(bpy.data.objects[name])
contact_pairs += [
('Sloping_Black_Plastic_Apron','Fixed_Control_Pod_Housing'),
('Fixed_Control_Pod_Housing','Juice_Collection_Box_Contoured'),
('Fixed_Control_Pod_Housing','Residue_Collection_Box'),
('Control_Pod_Base_Standard','Juice_Collection_Box_Contoured'),
('Control_Pod_Rear_Support','Juice_Collection_Box_Contoured'),
('Control_Pod_Rear_Support','Transparent_Hood_With_Curved_Sides'),
('Control_Pod_Base_Standard','Collection_Deck_Shallow_Rear_Tray'),
('Lower_Left_Service_Cover','Residue_Collection_Box'),
('Lower_Right_Service_Cover','Juice_Collection_Box_Contoured'),
('Collection_Deck_Shallow_Rear_Tray','Residue_Collection_Box'),
('Collection_Deck_Shallow_Rear_Tray','Juice_Collection_Box_Contoured'),
]
report['housing_contact_pairs'] = {a+' / '+b:len(contact_trees[a].overlap(contact_trees[b])) for a,b in contact_pairs}
report['housing_contact_checks_passed'] = all(count==0 for count in report['housing_contact_pairs'].values())
report['rear_liner_seat_checks'] = []
report['lower_backplate_apron_fit_checks'] = []
report['apron_lower_contour_checks'] = []
report['apron_lower_contour_bevel_tolerance_m'] = 0.0008
for x in [0.010,0.075,0.150,0.170]:
expected_y = 0.154+0.008*(1-(x/0.171)**2)-0.001
expected_z = apron_bottom(x)
hit,normal,index,distance = contact_trees['Sloping_Black_Plastic_Apron'].ray_cast(Vector((x,expected_y,expected_z-0.002)),Vector((0,0,1)),0.004)
report['apron_lower_contour_checks'].append({'x_m':x,'expected_z_m':expected_z,'actual_z_m':None if hit is None else hit.z,'matches':hit is not None and abs(hit.z-expected_z)<0.0008})
report['residue_apron_notch_checks'] = []
for x in [0.0,0.075,0.15]:
z = apron_bottom(x)-0.002
hit = contact_trees['Sloping_Black_Plastic_Apron'].ray_cast(Vector((x,0.0,z)),Vector((0,0,1)),0.004)[0]
report['residue_apron_notch_checks'].append({'x_m':x,'unexpected_hit':None if hit is None else list(hit),'open_front_collection_area':hit is None})
report['apron_lower_contour_matches_support'] = all(check['matches'] for check in report['apron_lower_contour_checks']) and all(check['open_front_collection_area'] for check in report['residue_apron_notch_checks'])
for x in [-0.15,-0.075,0,0.075,0.15]:
expected = apron_top(x)+bpy.data.objects['Chamber_Rear_Wall']['seat_offset_above_apron_m']
hit,normal,index,distance = backplate_tree.ray_cast(Vector((x,report['backplate_front_y_m']-bpy.data.objects['Chamber_Rear_Wall']['thickness_m']/2,expected-0.002)),Vector((0,0,1)),0.004)
report['rear_liner_seat_checks'].append({'x_m':x,'expected_z_m':expected,'actual_z_m':None if hit is None else hit.z})
expected_lower = apron_top(x)-0.0002
hit,normal,index,distance = contact_trees['Chamber_Lower_Backplate'].ray_cast(Vector((x,report['backplate_front_y_m']-0.011,expected_lower-0.002)),Vector((0,0,1)),0.004)
report['lower_backplate_apron_fit_checks'].append({'x_m':x,'expected_z_m':expected_lower,'actual_z_m':None if hit is None else hit.z})
report['rear_liner_seated_without_large_gap'] = all(check['actual_z_m'] is not None and abs(check['actual_z_m']-check['expected_z_m'])<=0.0003 for check in report['rear_liner_seat_checks'])
report['lower_backplate_apron_fit_passed'] = all(check['actual_z_m'] is not None and abs(check['actual_z_m']-check['expected_z_m'])<=0.0003 for check in report['lower_backplate_apron_fit_checks'])
report['assembly_root_parent_checks'] = {name:bpy.data.objects[name].parent == bpy.data.objects['Juicer_User_Spec_Root'] for name in ['Fixed_Chassis_Assembly','Removable_Transparent_Hood_Assembly','Collection_Deck_Assembly','Lower_Service_Cover_Assembly','Juice_Collection_Box_Slide','Residue_Collection_Box_Slide']}
report['backplate_fixed_to_chassis'] = belongs_to(bpy.data.objects['Chamber_Rear_Wall'],'Fixed_Chassis_Assembly') and not belongs_to(bpy.data.objects['Chamber_Rear_Wall'],'Removable_Transparent_Hood_Assembly')
report['juice_guide_follows_deck'] = belongs_to(bpy.data.objects['Juice_Guide_Solid_Tray_No_Mesh'],'Collection_Deck_Assembly')
report['lower_covers_are_independent'] = belongs_to(bpy.data.objects['Lower_Left_Service_Cover'],'Lower_Service_Cover_Assembly') and belongs_to(bpy.data.objects['Lower_Right_Service_Cover'],'Lower_Service_Cover_Assembly')
report['control_support_base_contact_error_m'] = abs(min((bpy.data.objects['Control_Pod_Base_Standard'].matrix_world@Vector(corner)).z for corner in bpy.data.objects['Control_Pod_Base_Standard'].bound_box)-0.035)
report['control_support_connections'] = {
'standard_to_beam_overlap_faces':len(tree(bpy.data.objects['Control_Pod_Base_Standard']).overlap(tree(bpy.data.objects['Control_Pod_Rear_Support']))),
'beam_to_pod_overlap_faces':len(tree(bpy.data.objects['Control_Pod_Rear_Support']).overlap(tree(bpy.data.objects['Fixed_Control_Pod_Housing']))),
'deck_mount_to_rear_lip_overlap_faces':len(tree(bpy.data.objects['Collection_Deck_Rear_Mount']).overlap(tree(bpy.data.objects['Collection_Deck_Rear_Lip']))),
}
report['control_support_connections_passed'] = report['control_support_base_contact_error_m']<0.0001 and all(value>0 for value in report['control_support_connections'].values())
report['assembly_structure_passed'] = all(report['assembly_root_parent_checks'].values()) and all([report['backplate_fixed_to_chassis'],report['juice_guide_follows_deck'],report['lower_covers_are_independent'],report['control_pod_parts_fixed'],report['removable_deck_excludes_controls']])
report['housing_checks_passed'] = all(report[key] for key in ['rear_side_returns_fixed_and_opaque','inclined_deck_surface_passed','collector_openings_passed','residue_entry_aligned_with_inlet','rear_covers_distinct_from_bins','juice_guide_flow_passed','rear_roof_covers_machine_back','rear_transparent_closure_present','rear_apron_join_passed','rear_liner_gap_reduced','green_backplate_checks_passed','rear_ribs_mount_to_backplate','hood_rear_alignment_passed','backplate_connections_passed','rear_liner_roof_profile_matches','housing_contact_checks_passed','rear_liner_seated_without_large_gap','lower_backplate_apron_fit_passed','apron_lower_contour_matches_support','assembly_structure_passed','control_support_connections_passed'])
report['hood_apron_join_checks'] = []
for x in [-0.16,-0.10,0,0.10,0.16]:
y = 0.05
expected = apron_top(x)
hit,normal,index,distance = hood_tree.ray_cast(Vector((x,y,expected-0.003)),Vector((0,0,1)),0.006)
report['hood_apron_join_checks'].append({'x_m':x,'expected_z_m':expected,'actual_z_m':None if hit is None else hit.z})
report['hood_lower_edge_matches_apron'] = all(check['actual_z_m'] is not None and abs(check['actual_z_m']-check['expected_z_m'])<0.001 for check in report['hood_apron_join_checks'])
report['hood_entry_opening_checks'] = []
for i in [5,10,15,20,25,30,35]:
center = hood_inverse @ (ramp.matrix_world @ ramp.data.vertices[8+17*i].co)
hit,normal,index,distance = hood_tree.ray_cast(center+Vector((0,0,0.06)),Vector((0,0,-1)),0.12)
report['hood_entry_opening_checks'].append({'ramp_sample':i,'roof_hit':None if hit is None else list(hit)})
hood_evaluated.to_mesh_clear()
report['hood_entry_opening_passed'] = all(check['roof_hit'] is None for check in report['hood_entry_opening_checks'])
report['hopper_floor_contact_checks'] = {}
report['hopper_fruit_spacing_checks'] = {}
for frame in [1,72]:
scene.frame_set(frame)
bpy.context.view_layer.update()
evaluated = hopper.evaluated_get(bpy.context.evaluated_depsgraph_get())
evaluated_mesh = evaluated.to_mesh()
surface = BVHTree.FromPolygons([vertex.co.copy() for vertex in evaluated_mesh.vertices],[list(poly.vertices) for poly in evaluated_mesh.polygons])
names = ['Process_Whole_Orange','Hopper_Queued_Orange_1','Hopper_Queued_Orange_2','Hopper_Queued_Orange_3'] if frame==1 else ['Hopper_Queued_Orange_1','Hopper_Queued_Orange_2','Hopper_Queued_Orange_3']
centers = []
checks = []
for name in names:
fruit = bpy.data.objects[name]
center = hopper.matrix_world.inverted() @ fruit.matrix_world.translation
centers.append(fruit.matrix_world.translation.copy())
arc_center = hopper['arc_center_local_xy']
radial_error = abs(math.hypot(center.x-arc_center[0],center.y-arc_center[1])-hopper['arc_radius_m'])
fruit_mesh = fruit.children[0]
vertical_radius = fruit_mesh.scale.z*(0.030 if name=='Process_Whole_Orange' else 0.029)
hit,normal,index,distance = surface.ray_cast(center+Vector((0,0,0.002)),Vector((0,0,-1)),0.100)
floor_error = None if hit is None else distance-(vertical_radius+0.002)
checks.append({
'fruit':name,
'arc_radius_error_m':radial_error,
'floor_contact_error_m':floor_error,
'local_center_m':list(center),
})
distances = [(a-b).length for i,a in enumerate(centers) for b in centers[i+1:]]
report['hopper_fruit_spacing_checks'][str(frame)] = {'minimum_center_distance_m':min(distances),'passed':min(distances)>=0.058}
report['hopper_floor_contact_checks'][str(frame)] = checks
evaluated.to_mesh_clear()
report['curved_hopper_checks_passed'] = (
report['curved_hopper_parts_present'] and report['flat_l_hopper_removed']
and report['hopper_top_footprint_passed'] and report['hopper_outlet_ramp_join_passed'] and report['hood_entry_opening_passed']
and all(v['passed'] for v in report['hopper_fruit_spacing_checks'].values())
and all(c['arc_radius_error_m']<0.00001 and c['floor_contact_error_m'] is not None and abs(c['floor_contact_error_m'])<0.0012 for checks in report['hopper_floor_contact_checks'].values() for c in checks)
)
report['ball_disc_surface_intersection_frames'] = []
report['ball_disc_collision_details'] = []
report['seated_fruit_pocket_intersection_frames'] = []
report['blade_pocket_intersection_frames'] = []
report['blade_disc_surface_intersection_frames'] = []
report['ejector_pocket_intersection_frames'] = []
report['ejector_disc_surface_intersection_frames'] = []
report['support_collision_details'] = []
report['collector_rotor_intersection_details'] = []
report['collector_fixed_part_intersection_details'] = []
report['residue_deck_intersection_details'] = []
fixed_collector_obstacles = ['Sloping_Black_Plastic_Apron','Chamber_Rear_Wall','Chamber_Lower_Backplate','Fixed_Control_Pod_Housing','Control_Pod_Base_Standard','Control_Pod_Rear_Support','Lower_Left_Service_Cover','Lower_Right_Service_Cover','Juice_Guide_Solid_Tray_No_Mesh','Juice_Guide_Deck_Cleat','Juice_Guide_Deck_Cleat.001']
fixed_collector_obstacles += [obj.name for obj in bpy.data.objects if obj.type == 'MESH' and obj.name.startswith(('Juice_Guide_Raised_Side','Collection_Deck_'))]
fixed_collector_trees = [(name,tree(bpy.data.objects[name])) for name in fixed_collector_obstacles]
blade_names = ['Fixed_Tangential_Cutting_Blade','Blade_Holder_Crossbar','Blade_Fixed_Mount','Blade_External_Cross_Bracket','Blade_Backplate_Support','Blade_Backplate_Mount'] + [o.name for o in bpy.data.objects if o.name.startswith('Blade_Holder_Side_Cheek') or o.name.startswith('Blade_Mounting_Tang')]
ejector_names = ['Blade_Spring_Discharge_Plate']
report['blade_tangential_contact_details'] = []
report['blade_disc_penetration_details'] = []
report['blade_body_signed_clearance_m'] = report['blade_minimum_edge_radius_m']-max(bpy.data.objects['Four_Pocket_Disc_Thick_Body'].dimensions.y,bpy.data.objects['Four_Pocket_Disc_Thick_Body'].dimensions.z)/2
for frame in sorted(set(range(1,361,2)) | {64,128,148,172,178,184,192,202,214,236,248,256,266,278,322} | set(range(214,223)) | set(range(278,288))):
scene.frame_set(frame)
bpy.context.view_layer.update()
part_names = ['Four_Pocket_Disc_Thick_Body','Disc_Solid_Front_Cover']+['Pocket_Rim_'+str(i) for i in range(1,5)]
drum_parts = [tree(bpy.data.objects[name]) for name in part_names]
pockets = [tree(bpy.data.objects['Hemispherical_Pocket_'+str(i)]) for i in range(1,5)]
ball_names = ['Spherical_Pressing_Head_'+str(i) for i in range(1,4)]
moving_press_names = ball_names+['Press_Head_Short_Neck_'+str(i) for i in range(1,4)]+['Press_Equilateral_Triangle_Carrier']
balls = [tree(bpy.data.objects[name]) for name in moving_press_names]
details = [{'frame':frame,'ball':ball_name,'part':part_name} for ball_name,ball in zip(moving_press_names,balls) for part_name,part in zip(part_names,drum_parts) if part.overlap(ball)]
details += [{'frame':frame,'ball':ball_name,'part':'Hemispherical_Pocket_'+str(i)} for ball_name,ball in zip(moving_press_names,balls) for i,pocket in enumerate(pockets,1) if pocket.overlap(ball)]
report['ball_disc_collision_details'].extend(details)
if details:
report['ball_disc_surface_intersection_frames'].append(frame)
support_names = ['Juice_Guide_Deck_Cleat','Juice_Guide_Deck_Cleat.001','Juice_Guide_Outlet_Cantilever','Hopper_Backplate_Support_Arm','Hopper_Backplate_Mount','Chamber_Left_Rear_Return','Chamber_Right_Rear_Return']
support_parts = [(name,tree(bpy.data.objects[name])) for name in support_names]
for support_name,support in support_parts:
for moving_name,moving in zip(moving_press_names,balls):
if support.overlap(moving):
report['support_collision_details'].append({'frame':frame,'support':support_name,'moving_part':moving_name})
for disc_name,disc_part in zip(part_names,drum_parts):
if support.overlap(disc_part):
report['support_collision_details'].append({'frame':frame,'support':support_name,'moving_part':disc_name})
for pocket_index,pocket in enumerate(pockets,1):
if support.overlap(pocket):
report['support_collision_details'].append({'frame':frame,'support':support_name,'moving_part':'Hemispherical_Pocket_'+str(pocket_index)})
collector_parts = [(name,tree(bpy.data.objects[name])) for name in ['Juice_Collection_Box_Contoured','Juice_Bin_Contoured_Rim','Residue_Collection_Box','Residue_Box_Open_Rim']]
for collector_name,collector in collector_parts:
for fixed_name,fixed in fixed_collector_trees:
if collector.overlap(fixed):
report['collector_fixed_part_intersection_details'].append({'frame':frame,'collector':collector_name,'fixed_part':fixed_name})
for moving_name,moving in zip(moving_press_names,balls):
if collector.overlap(moving):
report['collector_rotor_intersection_details'].append({'frame':frame,'collector':collector_name,'moving_part':moving_name})
for disc_name,disc_part in zip(part_names,drum_parts):
if collector.overlap(disc_part):
report['collector_rotor_intersection_details'].append({'frame':frame,'collector':collector_name,'moving_part':disc_name})
if 214<=frame<=222 or 278<=frame<=287:
peel_name = 'Residue_A_Pressed_Half_Peel_Empty_Peel' if frame<278 else 'Residue_B_Pressed_Half_Peel_Empty_Peel'
intersections = deck_tree.overlap(tree(bpy.data.objects[peel_name]))
if intersections:
report['residue_deck_intersection_details'].append({'frame':frame,'peel':peel_name,'intersections':len(intersections)})
blades = [(name,tree(bpy.data.objects[name])) for name in blade_names]
if any(blade.overlap(pocket) for _,blade in blades for pocket in pockets):
report['blade_pocket_intersection_frames'].append(frame)
contacts = [(blade_name,part_name) for blade_name,blade in blades for part_name,part in zip(part_names,drum_parts) if blade.overlap(part)]
for blade_name,part_name in contacts:
item = {'frame':frame,'blade':blade_name,'disc_part':part_name,'signed_radial_clearance_m':report['blade_body_signed_clearance_m']}
if blade_name=='Fixed_Tangential_Cutting_Blade' and part_name=='Four_Pocket_Disc_Thick_Body' and report['blade_body_signed_clearance_m']>=-0.000001:
report['blade_tangential_contact_details'].append(item)
else:
report['blade_disc_penetration_details'].append(item)
if report['blade_disc_penetration_details'] and report['blade_disc_penetration_details'][-1]['frame']==frame:
report['blade_disc_surface_intersection_frames'].append(frame)
ejectors = [tree(bpy.data.objects[name]) for name in ejector_names]
if any(ejector.overlap(pocket) for ejector in ejectors for pocket in pockets):
report['ejector_pocket_intersection_frames'].append(frame)
if any(ejector.overlap(part) for ejector in ejectors for part in drum_parts):
report['ejector_disc_surface_intersection_frames'].append(frame)
if 64<=frame<=92:
fruit = tree(bpy.data.objects['Process_Whole_Orange_Peel'])
if any(fruit.overlap(pocket) for pocket in pockets):
report['seated_fruit_pocket_intersection_frames'].append({'frame':frame,'fruit':'whole'})
if 148<=frame<214:
fruit = tree(bpy.data.objects['Process_Retained_Half_Peel'])
if any(fruit.overlap(pocket) for pocket in pockets):
report['seated_fruit_pocket_intersection_frames'].append({'frame':frame,'fruit':'retained_half'})
if 192<=frame<278:
fruit = tree(bpy.data.objects['Process_Blade_Half_Peel'])
if any(fruit.overlap(pocket) for pocket in pockets):
report['seated_fruit_pocket_intersection_frames'].append({'frame':frame,'fruit':'blade_half'})
report['residue_deck_clearance_passed'] = not report['residue_deck_intersection_details']
report['geometry_checks_passed'] = all(v==0 for v in report['non_manifold_edges'].values()) and all(v>0 for v in report['positive_part_volumes_m3'].values())
report['control_checks_passed'] = all(report[key] for key in ['apron_descends_left_to_right','old_v_control_band_removed','lcd_has_no_extra_text','lcd_exactly_one_status_per_frame','button_presses_inward','button_returns_after_press','controls_on_right_and_fixed_pod','control_pod_parts_fixed','removable_deck_excludes_controls','inclined_deck_fascia_profile','fascia_lower_edge_nearly_level','lcd_text_fits_screen','lcd_front_faces_positive_y','hood_lower_edge_matches_apron','circular_disc_silhouette'])
report['structure_checks_passed'] = (
report['control_checks_passed'] and report['housing_checks_passed'] and report['collector_shape_checks_passed']
and report['source_document_matches'] and report['thick_disc_passed'] and report['actual_pocket_count']==4
and report['actual_spherical_head_count']==3 and report['solid_front_cover_present'] and report['short_neck_heads_present']
and report['vertical_press_parts_absent'] and report['press_axis_fixed_throughout_animation'] and report['rotational_relief_grooves_present']
and report['fixed_blade_has_no_animation'] and report['filter_mesh_absent'] and report['solid_juice_guide_present'] and report['unverified_residue_guide_parts_absent'] and report['drum_blade_slots_absent']
and report['front_faces_xoz_passed'] and report['blade_outside_drum'] and report['blade_outside_pocket_rims'] and report['blade_penetration_disabled_by_geometry']
and report['pockets_centered_across_drum_thickness'] and report['pocket_orientation_passed'] and report['hemispherical_pockets_passed']
and report['disc_rotation_is_clockwise_from_positive_y'] and report['press_rotation_is_clockwise_from_positive_y'] and report['both_mechanisms_clockwise_throughout'] and report['both_rotors_continuous_throughout'] and report['constant_speed_ratio_passed']
and report['fruit_follows_pocket_through_press'] and report['no_fake_z_squash_or_ram']
and report['blade_tangent_at_cutting_station'] and report['blade_cut_plane_matches_fruit_split'] and report['fruit_centered_on_external_cutting_edge'] and report['spring_ejector_moves_in_xoz']
and report['curved_hopper_checks_passed'] and report['four_fruit_positions_on_curved_hopper']
and report['separate_half_and_residue_meshes'] and report['recursive_visibility_passed'] and report['mechanism_fruit_colors_differ'] and all(report['collector_flags'].values())
and report['pressing_alignment_passed'] and report['residue_motion_passed'] and report['collector_slide_synchronized']
and report['juice_level_visibility_and_containment_passed']
)
report['contact_checks_passed'] = all(not report[key] for key in ['ball_disc_surface_intersection_frames','seated_fruit_pocket_intersection_frames','blade_pocket_intersection_frames','blade_disc_surface_intersection_frames','ejector_pocket_intersection_frames','ejector_disc_surface_intersection_frames','support_collision_details','collector_rotor_intersection_details','collector_fixed_part_intersection_details','residue_deck_intersection_details'])
report['contact_check_scope'] = 'Every frame: both rotor angle increments and fixed press axis. Every second frame plus exact process keyframes: rotors, seated fruit, blade, supports and ejector are checked as before. Both shallow front collectors are checked against the fixed control pod and supports, rear spine, removable deck, juice guide and separate lower side covers during installed and juice slide-out frames. Static contact pairs additionally cover the fascia/control-pod fitting opening, pod/bin clearance, deck/bin clearance and cover/bin clearance. Collector bottoms are checked for shared-sill contact separately. Intentional mounting contacts, measured external blade/drum tangency, and fruit cutting/pressing contact are excluded; this is sampled geometric validation, not a manufacturing physics simulation.'
report['data_checks_passed'] = report['saved_file_reopened'] and not report['missing_external_assets'] and report['linked_library_count']==0
report['passed'] = report['geometry_checks_passed'] and report['structure_checks_passed'] and report['contact_checks_passed'] and report['data_checks_passed']
report['visual_review'] = 'Final stills and rendered video are reviewed separately.'
report['visual_review_passed'] = report.get('visual_review_passed',False)
(OUT/'mechanism_validation.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
keys = ['passed','structure_checks_passed','collector_shape_checks_passed','collector_positions','left_residue_right_juice','collector_wall_gap_m','shared_lower_bay_passed','residue_rim_height_range_m','juice_rim_height_range_m','collector_rim_contours_passed','collector_tapers_passed','custom_collector_base_parts_present','juice_handle_through_cut_passed','collector_opening_fit','collector_rotor_intersection_details','collector_door_intersection_details','control_checks_passed','housing_checks_passed','hood_rear_y_m','hood_rear_extension_m','hood_rear_inset_from_cabinet_m','rear_liner_clearance_m','backplate_thickness_m','green_backplate_materials','green_backplate_checks_passed','rear_liner_compact_forward_shift_m','backplate_front_y_m','decorative_latches_removed','compact_y_shift_m','base_y_depth_m','body_y_depth_m','compact_depth_passed','backplate_mount_contacts','rear_ribs_mount_to_backplate','bearing_shaft_engagement','support_attachment_pairs','backplate_connections_passed','rear_roof_coverage_checks','rear_closure_coverage_checks','rear_apron_join_checks','rear_roof_covers_machine_back','rear_transparent_closure_present','rear_apron_join_passed','rear_liner_gap_reduced','hood_reaches_cabinet_back','rear_liner_roof_clearance_checks','rear_liner_roof_profile_matches','rear_roof_tolerance_m','housing_contact_pairs','housing_contact_checks_passed','rear_liner_seat_checks','rear_liner_seated_without_large_gap','cabinet_apron_fit_checks','cabinet_apron_fit_passed','apron_lower_contour_checks','apron_lower_contour_inside_cabinet','apron_top_profile','apron_descends_left_to_right','old_v_control_band_removed','lcd_has_no_extra_text','lcd_state_checks','lcd_exactly_one_status_per_frame','button_press_travel_m','button_presses_inward','button_returns_after_press','control_layout_bounds','controls_on_right_and_fixed_pod','control_pod_parts_fixed','removable_deck_excludes_controls','assembly_structure_passed','control_support_connections_passed','lcd_text_fits_screen','lcd_front_faces_positive_y','hood_apron_join_checks','hood_lower_edge_matches_apron','geometry_checks_passed','contact_checks_passed','data_checks_passed','front_faces_xoz_passed','filter_mesh_absent','blade_minimum_edge_radius_m','cutting_fruit_radius_m','ball_disc_surface_intersection_frames','ball_disc_collision_details','seated_fruit_pocket_intersection_frames','blade_pocket_intersection_frames','blade_disc_surface_intersection_frames','ejector_pocket_intersection_frames','ejector_disc_surface_intersection_frames','support_collision_details','pocket_axial_center_errors_m','pocket_orientation_checks','pressing_alignment','residue_contact_and_motion','collector_slide_synchronized','recursive_visibility_passed','visibility_checks','both_mechanisms_clockwise_throughout','both_rotors_continuous_throughout','rotor_step_ranges_degrees','rotor_zero_speed_frames','press_to_disc_angular_speed_ratio','fruit_follows_pocket_through_press','no_fake_z_squash_or_ram','fruit_rolling_nip_checks','curved_hopper_checks_passed','flat_l_hopper_removed','hopper_top_overhang_m','hopper_top_footprint_passed','hopper_outlet_ramp_join_error_m','hopper_outlet_ramp_join_passed','hood_entry_opening_passed','hood_entry_opening_checks','hopper_floor_contact_checks','hopper_fruit_spacing_checks','non_manifold_edges']
keys += ['obsolete_lower_parts_absent','collector_exterior_fit','collector_base_contact_checks','collectors_sit_on_shared_base','collector_front_bay_clearances_m','service_cover_side_clearances_m','collector_depths_m','residue_front_pull_integrated_passed','residue_rear_fit_checks','residue_rear_fit_passed','collector_fixed_part_intersection_details','lower_backplate_apron_fit_checks','lower_backplate_apron_fit_passed','apron_lower_contour_matches_support','hood_rear_alignment_passed']
keys += ['residue_deck_clearance_passed','residue_deck_intersection_details','blade_body_signed_clearance_m','blade_tangential_contact_details','blade_disc_penetration_details']
print(json.dumps({k:report[k] for k in keys if k in report},ensure_ascii=False,indent=2),flush=True)
if not report['passed']:
raise RuntimeError('Front-facing external-blade mechanism validation failed')