// My OpenSCAD Design // License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) // You are free to share and adapt this design as long as you provide attribution. $fn = 20; // Define the main module for creating the object module create_object(height, n_holes, hole_rad, hole_sep, string_width, string_length, a, b, c, alpha=0.95, beta=0.95) { // Calculate the starting point of the holes to be inside the bar edges hole_spacing = 2 * hole_rad + hole_sep; // Calculate bar length and width bar_length = (n_holes-1) * hole_spacing ; bar_width = 2 * (hole_rad + hole_sep) * beta; // Function to create a bar with holes at a specified offset module create_bar_with_holes() { difference() { // Create the bar hull() { cylinder(h = height, d = bar_width); translate([bar_length, b, c]) cylinder(h = height, d = bar_width); } // Create holes in the bar // la razón por la que divido la altura de ce entre 2 es porque si no no se ven bien los agujeros for (i = [0 : n_holes-1 ]) { dx = i * hole_spacing; translate([dx, b, c + height / 2]) { cylinder(h = height * 1.5, r = hole_rad, center = true); } } // End of holes } // End of difference } // End of module // First bar with holes create_bar_with_holes(); //no entiendo por qué tengo más espacio dónde empiezan los agujeros que donde acaban. // String section between bars translate([bar_length + hole_rad, b - string_width / 2, c]) { cube([string_length, string_width, height]); } // Second bar with holes, positioned after the string translate([string_length + bar_length + hole_rad * 2, 0, 0]){ create_bar_with_holes(); } } // Call the create_object module with parameters create_object(4.9, 4, 2.6, 2, 1, 45, 0, 0, 0);