// Chip capacitor model // 0402 chipLength = 1.05; chipWidth = 0.55; chipHeight = 0.55; contactLength = 0.3; contactThickness = 0.03; module contactCap() { // X- end cap // outer surface translate([(chipLength - contactThickness) / -2, 0, 0]){cube([contactThickness, chipWidth - (2 * contactThickness), chipHeight - (2 * contactThickness)], true);} // bottom surface translate([(chipLength - contactLength) / -2, 0, (chipHeight - contactThickness) / -2]){cube([contactLength - (2 * contactThickness), chipWidth - (2 * contactThickness), contactThickness], true);} // top surface translate([(chipLength - contactLength) / -2, 0, (chipHeight - contactThickness) / 2]){cube([contactLength - (2 * contactThickness), chipWidth - (2 * contactThickness), contactThickness], true);} // Y- surface translate([(chipLength - contactLength) / -2, (chipWidth - contactThickness) / -2, 0]){cube([contactLength - (2 * contactThickness), contactThickness, chipHeight - (2 * contactThickness)], true);} // Y+ surface translate([(chipLength - contactLength) / -2, (chipWidth - contactThickness) / 2, 0]){cube([contactLength - (2 * contactThickness), contactThickness, chipHeight - (2 * contactThickness)], true);} // outer Y- rounding translate([(chipLength - (2 * contactThickness)) / -2, (chipWidth / -2) + contactThickness, 0]){cylinder(chipHeight - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);} // outer Y+ rounding translate([(chipLength - (2 * contactThickness)) / -2, (chipWidth / 2) - contactThickness, 0]){cylinder(chipHeight - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);} // outer Z- rounding translate([(chipLength - (2 * contactThickness)) / -2, 0, (chipHeight / -2) + contactThickness]){rotate([90,0,0]){cylinder(chipWidth - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} // outer Z+ rounding translate([(chipLength - (2 * contactThickness)) / -2, 0, (chipHeight / 2) - contactThickness]){rotate([90,0,0]){cylinder(chipWidth - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} // outer corner balls translate([(chipLength - (2 * contactThickness)) / -2, (chipWidth / -2) + contactThickness, (chipHeight / 2) - contactThickness]){sphere(contactThickness - 0.002);} translate([(chipLength - (2 * contactThickness)) / -2, (chipWidth / -2) + contactThickness, (chipHeight / -2) + contactThickness]){sphere(contactThickness - 0.002);} translate([(chipLength - (2 * contactThickness)) / -2, (chipWidth / 2) - contactThickness, (chipHeight / 2) - contactThickness]){sphere(contactThickness - 0.002);} translate([(chipLength - (2 * contactThickness)) / -2, (chipWidth / 2) - contactThickness, (chipHeight / -2) + contactThickness]){sphere(contactThickness - 0.002);} // longtitudinal roundings translate([(chipLength - contactLength) / -2, (chipWidth / -2) + contactThickness, (chipHeight / 2) - contactThickness]){rotate([0,90,0]){cylinder(contactLength - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} translate([(chipLength - contactLength) / -2, (chipWidth / -2) + contactThickness, (chipHeight / -2) + contactThickness]){rotate([0,90,0]){cylinder(contactLength - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} translate([(chipLength - contactLength) / -2, (chipWidth / 2) - contactThickness, (chipHeight / 2) - contactThickness]){rotate([0,90,0]){cylinder(contactLength - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} translate([(chipLength - contactLength) / -2, (chipWidth / 2) - contactThickness, (chipHeight / -2) + contactThickness]){rotate([0,90,0]){cylinder(contactLength - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} // inner Y- rounding translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, (chipWidth / -2) + contactThickness, 0]){cylinder(chipHeight - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);} // inner Y+ rounding translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, (chipWidth / 2) - contactThickness, 0]){cylinder(chipHeight - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);} // inner Z- rounding translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, 0, (chipHeight / -2) + contactThickness]){rotate([90,0,0]){cylinder(chipWidth - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} // inner Z+ rounding translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, 0, (chipHeight / 2) - contactThickness]){rotate([90,0,0]){cylinder(chipWidth - (2 * contactThickness), contactThickness - 0.001, contactThickness - 0.001, true);}} // outer corner balls translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, (chipWidth / -2) + contactThickness, (chipHeight / 2) - contactThickness]){sphere(contactThickness - 0.002);} translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, (chipWidth / -2) + contactThickness, (chipHeight / -2) + contactThickness]){sphere(contactThickness - 0.002);} translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, (chipWidth / 2) - contactThickness, (chipHeight / 2) - contactThickness]){sphere(contactThickness - 0.002);} translate([(chipLength - (2 * contactLength) + (2 * contactThickness)) / -2, (chipWidth / 2) - contactThickness, (chipHeight / -2) + contactThickness]){sphere(contactThickness - 0.002);} } $fs=0.01; // set minimum circle segment length so circles are round at small scale translate([0, 0, chipHeight / 2]) // move chip up onto the surface { union() // unionize everything so freecad craps itself a bit less { color([0.7, 0.7, 0.7]) // silver end caps { contactCap(); mirror([1,0,0]){contactCap();} } color([0.6, 0.6, 0]) // body { cube([chipLength - (2 * contactLength) + (2 * contactThickness), chipWidth - contactThickness, chipHeight - contactThickness], center = true); } } }