use use use use use use //[ -5.34, 2.50, -0.54 ] #translate([ -5.34, 3.50, -0.54 ]) rotate([-1,0,44.5]) import("AnvilScan.stl"); anvil(); //pointer([ -31.33, 8.53, 60.00 ], [0,0,0]); //[ -41.33, 8.53, 60.00 ] //[ -41.33, 8.53, 47.00 ] //[ -21.33, 8.53, 41.00 ] //[ -31.33, 8.53, 60.00 ] //Total height total_h = 64.6; //Basic dimensions of the ribs rib_th = 8; rib_w = 20.6; //Base dimensions //74.8mm x 53.9mm x 7.6mm base_l = 74.8; base_w = 53.9; base_h = 7.6; //Upper plate dimensions //92.9mm x 42.5mm x 6.8mm upper_l = 92.9; upper_w = 42.5; upper_h = 6.8; //Parameters for nose block nose_block_w = 20.7; nose_block_z = 60; nose_block_fr_x = -41; nose_block_fr_z = 47; //Parameters for nose nose_z = nose_block_z - 2; nose_r = 2; nose_transition_x = -68; nose_transition_y = 2; nose_upper_r = 3; nose_lower_r = 5; //Thickness and 2D shape of web sweep web_th = 2; web2D = rectangle_profile(size=[web_th,1]); //Thicker 2D shape for web to difference out excess web2Dplus = rectangle_profile(size=[web_th+1,2]); //2D shape of rib. Flat sides rounded ends rib2D = rounded_rectangle_profile(size=[rib_th,rib_w], r = rib_th/2); //Path of sweep for back rib path_def = [ trajectory(forward = 62, pitch = 90) ]; //Path of sweep for nose rib path2_def = [ trajectory(forward = 25, pitch = -45), trajectory(forward = 25, pitch = -80), trajectory(forward = 20, pitch = 90) ]; //Turn the trajectories into an arrays of transformations //representing the paths sweep_path = quantize_trajectories(path_def, steps=100, loop=false); sweep_path2 = quantize_trajectories(path2_def, steps=100, loop=false); module anvil() { difference() { union() { //******** Base of Anvil ************** translate([0,0,base_h/2]) cube([base_l, base_w, base_h], center = true); //[ 12.56, -6.99, 17.54 ] //********* Upper Plate of Anvil translate([12.8,0,total_h - upper_h/2]) cube([upper_l, upper_w, upper_h], center = true); //********** Nose Block ************ hull_shape([ [ nose_block_fr_x, nose_block_w/2, nose_block_z ], [ nose_block_fr_x, nose_block_w/2-rib_th/4, nose_block_fr_z ], [ -18.33, nose_block_w/2-rib_th/2, 40.00+rib_th/2 ], [ -16.33, nose_block_w/2, 60.00 ]], [0,1,2,0], y_sym = true) { cube(0.01,center=true); sphere(rib_th/4,center=true); sphere(rib_th/2,center=true); } //******** Nose ************* hull_shape([ [ -71, 0, nose_z - nose_r ], [ nose_transition_x, nose_transition_y, nose_z-nose_upper_r], [ nose_block_fr_x+1, nose_block_w/2-nose_upper_r, nose_z-nose_upper_r ], [ nose_transition_x+15, nose_transition_y+1, nose_z-nose_upper_r- 2 ], [ nose_block_fr_x+rib_th/4, nose_block_w/2-rib_th/4, nose_block_fr_z ]], [0,1,1,2,3], y_sym = true) { sphere(nose_r,center=true); sphere(nose_upper_r,center=true); sphere(nose_lower_r,center=true); sphere(rib_th/4,center=true); } //********** Back Rib ********** translate([27,0,5]) rotate([0,-40,0]) sweep(rib2D, sweep_path); translate([-23,0,5]) rotate([0,55,0]) sweep(rib2D, sweep_path2); //******** Web down the middle ****** difference() { hull() { translate([27,0,5]) rotate([0,-40,0]) sweep(web2D, sweep_path); translate([-23,0,5]) rotate([0,55,0]) sweep(web2D, sweep_path2); } hull() { translate([27,0,5]) rotate([0,-40,0]) sweep(web2Dplus, sweep_path); } hull() { translate([-23,0,5]) rotate([0,55,0]) sweep(web2Dplus, sweep_path2); } } } } } /* * This module creates shapes by hulling together shapes at locations passed in the array * hull_array * * The optional array child_num holds indexes to children passed in through the tree * corresponding to each location. That allows one to control the shape used in the * hull at each location. If there is no array children(0) will be used at all points. * * x_sym, y_sym, z_sym are optional parameters to indicate symmetry around the * x axis, y axis and/or z axis respectively. The defaults are false (no symmetry) */ module hull_shape(hull_array, child_num, x_sym = false, y_sym = false, z_sym = false) { hull() { for(i = [0:len(hull_array) -1]) { shp_idx = child_num != undef? len(child_num)>i?child_num[i]:0 :0; translate(hull_array[i]) children(shp_idx); if(x_sym) { translate([-hull_array[i][0], hull_array[i][1], hull_array[i][2]]) children(shp_idx); } if(y_sym) { translate([hull_array[i][0], -hull_array[i][1], hull_array[i][2]]) children(shp_idx); } if(z_sym) { translate([hull_array[i][0], hull_array[i][1], -hull_array[i][2]]) children(shp_idx); } } } } /* * This module creates a pointer to make measurements. The point is a very small * cube with center = false. That puts the corner of the cube at the origin. During * measurement this point will be at $vpt. To make the pointer visible we hull the * small cube with a larger one placed roughly along the line of the center of the small * cube. This puts the body of the pointer in the first quadrant. * * The trans parameter determines where the point is placed. Normally we will pass * $vpt as this parameter. That will allow interactive measurement. The rot parameter * allows us to rotate the body of the pointer for the best angle. For example, * if there is a solid in the first quadrant, the point needs to come from a different * quadrant. */ module pointer(trans = [0,0,0],rot = [0,0,0]) { %translate(trans) rotate(rot) hull() { cube(0.01, center = false); translate([10,10,10]) cube(5); } }