include include use use use use use // Parameters top_part = false; lens_focal_length = 50; //mm 75 lens_diameter = 52; //mm added 2mm of tolerance lens_holder_edge_thickness = 2; //mm lens_thickness = 4.5; //mm lens_holder_thickness = 2; //mm lens_holder_outwards_radius = 3; //mm camera_inner_dimensions = [100,100,50]; //mm external_width = 3; //mm image_plane_width = 0.8; // mm // This equation can come in handy OA*f/(OA+f)=OA' object_distances = [100,102.632,105.556,108.824,112.5,116.667,121.429,126.923,133.333,140.909,150,161.111,175,192.857,216.667,235.185,258.333,288.095,327.778,383.333,466.667,605.556,883.333,1716.67,"∞"]; // mm [300,325,350,375,400,450,500,600,750,1000,1500,3000,"∞"] text_top_padding = 1; // mm text_offset_coeff = -3.7; // -1.9 index_offset = true; // false text_size = 3.3; // mm 2.6 text_angle = 180; // deg text_font = "JetBrainsMono:style=Bold Italic"; //"JetBrainsMono:style=Bold"; jp_font = "NotoSansJP:style=Bold"; camera_name = "立方体"; spec_text_size = 5; spec_text_padding = 5; // 15 part_connection_depth = 2; part_connection_thickness = 0.5; part_connection_thickness_tolerance = 0.05; cyl_resolution = 200; txt_resolution = 80; crn_resolution = 60; corner_rounding = 2; // System // Camera box camera_box_dimensions = [camera_inner_dimensions.x+external_width*2,camera_inner_dimensions.y+external_width*2,camera_inner_dimensions.z+external_width]; // Lens holder lens_holder_cyl_height = lens_thickness+lens_holder_thickness*2; lens_holder_external_cyl_height = (lens_holder_cyl_height-external_width)/2; // Image plane text side_image_plane_text_count = ceil(len(object_distances)/2); // Connection part_connection_thickness_post_tolerance_adjustment = part_connection_thickness+(top_part?1:-1)*part_connection_thickness_tolerance; // Modules function image_plane_calc(object_distance,focal_length)= (object_distance == "∞")? focal_length : -object_distance*focal_length/(focal_length-object_distance); module image_plane_transform(object_distance,focal_length) { // mm if(object_distance == "∞"){ translate([focal_length,0,0]) children(); } else{ OA_prime = -object_distance*focal_length/(focal_length-object_distance); translate([OA_prime,0,0]) children(); } } function image_plane_text_dist_from_top (object_distance,focal_length,index) = -text_top_padding+(index_offset ? text_offset_coeff*(side_image_plane_text_count-index-1) : text_offset_coeff*image_plane_calc(object_distance,focal_length)-text_offset_coeff*focal_length); module image_plane_text_transform(object_distance,focal_length,index){ fixed_index = index%side_image_plane_text_count; has_looped = fixed_index