my second ever thing.

This commit is contained in:
MrKalzu 2023-01-04 18:00:21 +02:00
parent dacd4c3e9d
commit 39ac859bcf

127
lesson2.scad Normal file
View File

@ -0,0 +1,127 @@
// Parameters
keyhole_out_size = 200;
keyhole_thickness = 100;
keyhole_width = 40;
keyhole_color = false;
// Horseshoe shape
//difference() {
/* union() { */
/* // Main horseshoe shape */
/* translate([0, size/2, 0]) { */
/* rotate([90, 0, 0]) { */
/* cylinder(r=size/2, h=thickness); */
/* } */
/* } */
/* translate([0, -size/4, 0]) { */
/* rotate([90, 0, 0]) { */
/* cylinder(r=size/2, h=thickness); */
/* } */
/* } */
/* translate([size/2, 0, 0]) { */
/* rotate([0, 90, 0]) { */
/* cylinder(r=size/4, h=thickness); */
/* } */
/* } */
/* translate([-size/2, 0, 0]) { */
/* rotate([0, 90, 0]) { */
/* cylinder(r=size/4, h=thickness); */
/* } */
/* } */
/* // Cut out center of horseshoe */
/* translate([0, 0, thickness/2]) { */
/* cylinder(r=size/4, h=thickness*2); */
/* } */
/* } */
//}
module keyhole(withColors=keyhole_color) {
maybe_color=withColors?"red":undef;
color(maybe_color, 1.0) {
union() {
difference() {
difference() {
cylinder(r=keyhole_out_size/2, h=keyhole_thickness);
translate([0, -keyhole_out_size/2, 0]){
cube([150, keyhole_out_size, keyhole_thickness]);
}
}
cylinder(r=keyhole_out_size/2-keyhole_width, h=keyhole_thickness);
}
translate([0, -keyhole_out_size/2, 0]){
cube([keyhole_out_size, keyhole_width, keyhole_thickness]);
}
translate([0, keyhole_out_size/2-keyhole_width, 0]){
cube([keyhole_out_size, keyhole_width, keyhole_thickness]);
}
}
}
}
module outsite_plane() {
difference() {
cube([1000, 1000, 100]);
translate([100, 100, -1]){cube([800, 800, 800]);}
}
}
module caseplate(){
union(){
// Keyholes in low side
translate([-200, 100, 0]){
keyhole();
}
translate([-200, 900, 0]){
keyhole();
}
// Keyholes high side
translate([1200, 100, 100]){
rotate([0, 180, 0]) {keyhole();}
}
translate([1200, 900, 100]){
rotate([0, 180, 0]){keyhole();}
}
outsite_plane();
}
}
module base(){
translate([-800, 0, 0]){
difference(){
// We need to remove smaller cube
//and then puctuate the bottom with sylinder
//and cut the top off in the angle of the plate
cube([770, 1000, 1000]);
translate([100, 100, 100]){
cube([600, 800, 1000]);
}
translate([400, 500, -100]){
cylinder(r=300, h=200);
}
translate([400, -300, 1710]){
rotate([0, 150, 0]){
cube([1200, 1800, 1000]);
}
}
}
}
}
module floor(){
translate([-1400, -700, -20]){
color("grey", 1){
cube([2000,2000,20]);}}
}
translate([0, 0, 800]){
rotate([0, 150, 0]){
caseplate();
}
}
base();
floor();