├── 1_3D-Shapes ├── Big-Projects │ ├── OpenSCAD_Figure1-30.scad │ ├── OpenSCAD_Figure1-31.scad │ ├── OpenSCAD_Figure1-32.scad │ └── screenshots │ │ ├── OpenSCAD_Figure1-30.png │ │ ├── OpenSCAD_Figure1-31.png │ │ └── OpenSCAD_Figure1-32.png ├── Design-Time │ ├── OpenSCAD_Figure1-29a.scad │ ├── OpenSCAD_Figure1-29b.scad │ ├── OpenSCAD_Figure1-29c.scad │ ├── OpenSCAD_Figure1-29d.scad │ ├── OpenSCAD_Figure1-29e.scad │ ├── OpenSCAD_Figure1-29f.scad │ └── screenshots │ │ ├── OpenSCAD_Figure1-29a.png │ │ ├── OpenSCAD_Figure1-29b.png │ │ ├── OpenSCAD_Figure1-29c.png │ │ ├── OpenSCAD_Figure1-29d.png │ │ ├── OpenSCAD_Figure1-29e.png │ │ └── OpenSCAD_Figure1-29f.png ├── Examples │ ├── OpenSCAD_Figure1-10.scad │ ├── OpenSCAD_Figure1-11.scad │ ├── OpenSCAD_Figure1-12.scad │ ├── OpenSCAD_Figure1-13.scad │ ├── OpenSCAD_Figure1-14.scad │ ├── OpenSCAD_Figure1-15.scad │ ├── OpenSCAD_Figure1-17.scad │ ├── OpenSCAD_Figure1-18.scad │ ├── OpenSCAD_Figure1-19.scad │ ├── OpenSCAD_Figure1-20.scad │ ├── OpenSCAD_Figure1-21.scad │ ├── OpenSCAD_Figure1-22.scad │ ├── OpenSCAD_Figure1-23.scad │ ├── OpenSCAD_Figure1-24.scad │ ├── OpenSCAD_Figure1-25.scad │ ├── OpenSCAD_Figure1-26.scad │ ├── OpenSCAD_Figure1-3.scad │ ├── OpenSCAD_Figure1-4.scad │ ├── OpenSCAD_Figure1-5.scad │ ├── OpenSCAD_Figure1-6.scad │ ├── OpenSCAD_Figure1-7.scad │ ├── OpenSCAD_Figure1-8.scad │ ├── OpenSCAD_Figure1-9.scad │ └── screenshots │ │ ├── OpenSCAD_Figure1-10.png │ │ ├── OpenSCAD_Figure1-11.png │ │ ├── OpenSCAD_Figure1-12.png │ │ ├── OpenSCAD_Figure1-13.png │ │ ├── OpenSCAD_Figure1-14.png │ │ ├── OpenSCAD_Figure1-15.png │ │ ├── OpenSCAD_Figure1-17.png │ │ ├── OpenSCAD_Figure1-18.png │ │ ├── OpenSCAD_Figure1-19.png │ │ ├── OpenSCAD_Figure1-20.png │ │ ├── OpenSCAD_Figure1-21.png │ │ ├── OpenSCAD_Figure1-22.png │ │ ├── OpenSCAD_Figure1-23.png │ │ ├── OpenSCAD_Figure1-24.png │ │ ├── OpenSCAD_Figure1-25.png │ │ ├── OpenSCAD_Figure1-26.png │ │ ├── OpenSCAD_Figure1-3.png │ │ ├── OpenSCAD_Figure1-4.png │ │ ├── OpenSCAD_Figure1-5.png │ │ ├── OpenSCAD_Figure1-6.png │ │ ├── OpenSCAD_Figure1-7.png │ │ ├── OpenSCAD_Figure1-8.png │ │ └── OpenSCAD_Figure1-9.png └── Figures │ ├── OpenSCAD_Figure1-1-2.scad │ ├── OpenSCAD_Figure1-27-28.scad │ └── figures │ ├── OpenSCAD_Figure1-1.png │ ├── OpenSCAD_Figure1-16.svg │ ├── OpenSCAD_Figure1-2.png │ ├── OpenSCAD_Figure1-27.png │ └── OpenSCAD_Figure1-28.png ├── 2_More-Ways-To-Transform-Shapes ├── Big-Projects │ ├── OpenSCAD_Figure2-15.scad │ ├── OpenSCAD_Figure2-16.scad │ └── screenshots │ │ ├── OpenSCAD_Figure2-15.png │ │ └── OpenSCAD_Figure2-16.png ├── Design-Time │ ├── OpenSCAD_Figure2-14a.scad │ ├── OpenSCAD_Figure2-14b.scad │ ├── OpenSCAD_Figure2-14c.scad │ ├── OpenSCAD_Figure2-14d.scad │ ├── OpenSCAD_Figure2-14e.scad │ ├── OpenSCAD_Figure2-14f.scad │ └── screenshots │ │ ├── OpenSCAD_Figure2-14a.png │ │ ├── OpenSCAD_Figure2-14b.png │ │ ├── OpenSCAD_Figure2-14c.png │ │ ├── OpenSCAD_Figure2-14d.png │ │ ├── OpenSCAD_Figure2-14e.png │ │ └── OpenSCAD_Figure2-14f.png └── Examples │ ├── OpenSCAD_Figure2-1.scad │ ├── OpenSCAD_Figure2-10.scad │ ├── OpenSCAD_Figure2-11.scad │ ├── OpenSCAD_Figure2-12.scad │ ├── OpenSCAD_Figure2-13.scad │ ├── OpenSCAD_Figure2-2.scad │ ├── OpenSCAD_Figure2-3.scad │ ├── OpenSCAD_Figure2-4.scad │ ├── OpenSCAD_Figure2-5.scad │ ├── OpenSCAD_Figure2-6.scad │ ├── OpenSCAD_Figure2-7.scad │ ├── OpenSCAD_Figure2-8.scad │ ├── OpenSCAD_Figure2-9.scad │ └── screenshots │ ├── OpenSCAD_Figure2-1.png │ ├── OpenSCAD_Figure2-10.png │ ├── OpenSCAD_Figure2-11.png │ ├── OpenSCAD_Figure2-12.png │ ├── OpenSCAD_Figure2-13.png │ ├── OpenSCAD_Figure2-2.png │ ├── OpenSCAD_Figure2-3.png │ ├── OpenSCAD_Figure2-4.png │ ├── OpenSCAD_Figure2-5.png │ ├── OpenSCAD_Figure2-6.png │ ├── OpenSCAD_Figure2-7.png │ ├── OpenSCAD_Figure2-8.png │ └── OpenSCAD_Figure2-9.png ├── 3_2D-Shapes ├── Big-Projects │ ├── OpenSCAD_Figure3-23.scad │ ├── OpenSCAD_Figure3-24.scad │ ├── OpenSCAD_Figure3-25.scad │ └── screenshots │ │ ├── OpenSCAD_Figure3-23.png │ │ ├── OpenSCAD_Figure3-24.png │ │ └── OpenSCAD_Figure3-25.png ├── Design-Time │ ├── OpenSCAD_Figure3-22a.scad │ ├── OpenSCAD_Figure3-22b.scad │ ├── OpenSCAD_Figure3-22c.scad │ ├── OpenSCAD_Figure3-22d.scad │ ├── OpenSCAD_Figure3-22e.scad │ ├── OpenSCAD_Figure3-22f.scad │ └── screenshots │ │ ├── OpenSCAD_Figure3-22a.png │ │ ├── OpenSCAD_Figure3-22b.png │ │ ├── OpenSCAD_Figure3-22c.png │ │ ├── OpenSCAD_Figure3-22d.png │ │ ├── OpenSCAD_Figure3-22e.png │ │ └── OpenSCAD_Figure3-22f.png └── Examples │ ├── OpenSCAD_Figure3-1.scad │ ├── OpenSCAD_Figure3-10.scad │ ├── OpenSCAD_Figure3-11.scad │ ├── OpenSCAD_Figure3-12.scad │ ├── OpenSCAD_Figure3-13.scad │ ├── OpenSCAD_Figure3-14.scad │ ├── OpenSCAD_Figure3-15.scad │ ├── OpenSCAD_Figure3-16.scad │ ├── OpenSCAD_Figure3-17.scad │ ├── OpenSCAD_Figure3-18.scad │ ├── OpenSCAD_Figure3-19.scad │ ├── OpenSCAD_Figure3-2.scad │ ├── OpenSCAD_Figure3-20.scad │ ├── OpenSCAD_Figure3-21.scad │ ├── OpenSCAD_Figure3-4.scad │ ├── OpenSCAD_Figure3-5.scad │ ├── OpenSCAD_Figure3-6.scad │ ├── OpenSCAD_Figure3-7.scad │ ├── OpenSCAD_Figure3-8.scad │ ├── OpenSCAD_Figure3-9.scad │ ├── circle.svg │ ├── drawing.dxf │ └── screenshots │ ├── OpenSCAD_Figure3-1.png │ ├── OpenSCAD_Figure3-10.png │ ├── OpenSCAD_Figure3-11.png │ ├── OpenSCAD_Figure3-12.png │ ├── OpenSCAD_Figure3-13.png │ ├── OpenSCAD_Figure3-14.png │ ├── OpenSCAD_Figure3-15.png │ ├── OpenSCAD_Figure3-16.png │ ├── OpenSCAD_Figure3-17.png │ ├── OpenSCAD_Figure3-18.png │ ├── OpenSCAD_Figure3-19.png │ ├── OpenSCAD_Figure3-2.png │ ├── OpenSCAD_Figure3-20.png │ ├── OpenSCAD_Figure3-21.png │ ├── OpenSCAD_Figure3-4.png │ ├── OpenSCAD_Figure3-5.png │ ├── OpenSCAD_Figure3-6.png │ ├── OpenSCAD_Figure3-7.png │ ├── OpenSCAD_Figure3-8.png │ └── OpenSCAD_Figure3-9.png ├── 4_Using-Loops-And-Variables ├── Big-Projects │ ├── OpenSCAD_Figure4-13.scad │ ├── OpenSCAD_Figure4-14.scad │ ├── OpenSCAD_Figure4-15.scad │ └── screenshots │ │ ├── OpenSCAD_Figure4-13.png │ │ ├── OpenSCAD_Figure4-14.png │ │ └── OpenSCAD_Figure4-15.png ├── Design-Time │ ├── OpenSCAD_Figure4-12a.scad │ ├── OpenSCAD_Figure4-12b.scad │ ├── OpenSCAD_Figure4-12c.scad │ ├── OpenSCAD_Figure4-12d.scad │ ├── OpenSCAD_Figure4-12e.scad │ ├── OpenSCAD_Figure4-12f.scad │ └── screenshots │ │ ├── OpenSCAD_Figure4-12a.png │ │ ├── OpenSCAD_Figure4-12b.png │ │ ├── OpenSCAD_Figure4-12c.png │ │ ├── OpenSCAD_Figure4-12d.png │ │ ├── OpenSCAD_Figure4-12e.png │ │ └── OpenSCAD_Figure4-12f.png ├── Examples │ ├── OpenSCAD_Figure4-1.scad │ ├── OpenSCAD_Figure4-10.scad │ ├── OpenSCAD_Figure4-11.scad │ ├── OpenSCAD_Figure4-2.scad │ ├── OpenSCAD_Figure4-2b.scad │ ├── OpenSCAD_Figure4-3.scad │ ├── OpenSCAD_Figure4-6.scad │ ├── OpenSCAD_Figure4-8.scad │ ├── OpenSCAD_Figure4-9.scad │ └── screenshots │ │ ├── OpenSCAD_Figure4-1.png │ │ ├── OpenSCAD_Figure4-10.png │ │ ├── OpenSCAD_Figure4-11.png │ │ ├── OpenSCAD_Figure4-2.png │ │ ├── OpenSCAD_Figure4-2b.png │ │ ├── OpenSCAD_Figure4-3.png │ │ ├── OpenSCAD_Figure4-6.png │ │ ├── OpenSCAD_Figure4-8.png │ │ └── OpenSCAD_Figure4-9.png └── Figures │ ├── OpenSCAD_Figure4-4.scad │ ├── OpenSCAD_Figure4-5.scad │ ├── OpenSCAD_Figure4-7.scad │ └── figures │ ├── OpenSCAD_Figure4-4.png │ ├── OpenSCAD_Figure4-5.png │ └── OpenSCAD_Figure4-7.png ├── 5_Modules ├── Big-Projects │ ├── OpenSCAD_Figure5-10.scad │ ├── OpenSCAD_Figure5-11.scad │ └── screenshots │ │ ├── OpenSCAD_Figure5-10.png │ │ └── OpenSCAD_Figure5-11.png ├── Design-Time │ ├── OpenSCAD_Figure5-9a.scad │ ├── OpenSCAD_Figure5-9b.scad │ ├── OpenSCAD_Figure5-9c.scad │ ├── OpenSCAD_Figure5-9d.scad │ ├── OpenSCAD_Figure5-9e.scad │ ├── OpenSCAD_Figure5-9f.scad │ └── screenshots │ │ ├── OpenSCAD_Figure5-9a.png │ │ ├── OpenSCAD_Figure5-9b.png │ │ ├── OpenSCAD_Figure5-9c.png │ │ ├── OpenSCAD_Figure5-9d.png │ │ ├── OpenSCAD_Figure5-9e.png │ │ └── OpenSCAD_Figure5-9f.png └── Examples │ ├── LEGO-standin.scad │ ├── LEGObrick.scad │ ├── OpenSCAD_Figure5-1.scad │ ├── OpenSCAD_Figure5-2.scad │ ├── OpenSCAD_Figure5-3.scad │ ├── OpenSCAD_Figure5-5.scad │ ├── OpenSCAD_Figure5-6.scad │ ├── OpenSCAD_Figure5-7.scad │ ├── OpenSCAD_Figure5-8.scad │ └── screenshots │ ├── LEGObrick.png │ ├── OpenSCAD_Figure5-1.png │ ├── OpenSCAD_Figure5-2.png │ ├── OpenSCAD_Figure5-3.png │ ├── OpenSCAD_Figure5-5.png │ ├── OpenSCAD_Figure5-6.png │ ├── OpenSCAD_Figure5-7.png │ └── OpenSCAD_Figure5-8.png ├── 6_Dynamic-Designs-With-If-Statements ├── Big-Projects │ ├── OpenSCAD_Figure6-7.scad │ ├── OpenSCAD_Figure6-8.scad │ ├── OpenSCAD_Figure6-9.scad │ └── screenshots │ │ ├── OpenSCAD_Figure6-7.png │ │ ├── OpenSCAD_Figure6-8.png │ │ └── OpenSCAD_Figure6-9.png ├── Design-Time │ ├── OpenSCAD_Figure6-6a.scad │ ├── OpenSCAD_Figure6-6b.scad │ ├── OpenSCAD_Figure6-6c.scad │ ├── OpenSCAD_Figure6-6d.scad │ ├── OpenSCAD_Figure6-6e.scad │ ├── OpenSCAD_Figure6-6f.scad │ └── screenshots │ │ ├── OpenSCAD_Figure6-6a.png │ │ ├── OpenSCAD_Figure6-6b.png │ │ ├── OpenSCAD_Figure6-6c.png │ │ ├── OpenSCAD_Figure6-6d.png │ │ ├── OpenSCAD_Figure6-6e.png │ │ └── OpenSCAD_Figure6-6f.png └── Examples │ ├── OpenSCAD_Figure6-1.scad │ ├── OpenSCAD_Figure6-2.scad │ ├── OpenSCAD_Figure6-3.scad │ ├── OpenSCAD_Figure6-4.scad │ ├── OpenSCAD_Figure6-5.scad │ ├── screenshots │ ├── OpenSCAD_Figure6-1.png │ ├── OpenSCAD_Figure6-2.png │ ├── OpenSCAD_Figure6-3.png │ ├── OpenSCAD_Figure6-4.png │ ├── OpenSCAD_Figure6-5.png │ └── skyscraper.png │ └── skyscraper.scad ├── 7_Designing-Big-Projects └── Examples │ ├── OpenSCAD_Figure7-10.scad │ ├── OpenSCAD_Figure7-11.scad │ ├── OpenSCAD_Figure7-12.scad │ ├── OpenSCAD_Figure7-13.scad │ ├── OpenSCAD_Figure7-14.scad │ ├── OpenSCAD_Figure7-15.scad │ ├── OpenSCAD_Figure7-6.scad │ ├── OpenSCAD_Figure7-7.scad │ ├── OpenSCAD_Figure7-8.scad │ ├── OpenSCAD_Figure7-9.scad │ ├── pisa-tower │ ├── v1 │ │ ├── bottom.scad │ │ ├── middle.scad │ │ ├── top.scad │ │ └── tower.scad │ ├── v2 │ │ ├── bottom.scad │ │ ├── middle.scad │ │ ├── top.scad │ │ └── tower.scad │ ├── v3 │ │ ├── bottom.scad │ │ ├── column.scad │ │ ├── middle.scad │ │ ├── top.scad │ │ └── tower.scad │ ├── v4 │ │ ├── bottom.scad │ │ ├── column.scad │ │ ├── middle.scad │ │ ├── top.scad │ │ └── tower.scad │ └── v5 │ │ ├── bottom.scad │ │ ├── column.scad │ │ ├── middle.scad │ │ ├── top.scad │ │ └── tower.scad │ └── screenshots │ ├── OpenSCAD_Figure7-10.png │ ├── OpenSCAD_Figure7-11.png │ ├── OpenSCAD_Figure7-12.png │ ├── OpenSCAD_Figure7-13.png │ ├── OpenSCAD_Figure7-14.png │ ├── OpenSCAD_Figure7-15.png │ ├── OpenSCAD_Figure7-6.png │ ├── OpenSCAD_Figure7-7.png │ ├── OpenSCAD_Figure7-8.png │ └── OpenSCAD_Figure7-9.png ├── AppendixB_OpenSCAD-Visual-Reference ├── OpenSCAD_2D-primitives-circle.scad ├── OpenSCAD_2D-primitives-pentagon.scad ├── OpenSCAD_2D-primitives-polygon.scad ├── OpenSCAD_2D-primitives-square-centered.scad ├── OpenSCAD_2D-primitives-square.scad ├── OpenSCAD_2D-primitives-text.scad ├── OpenSCAD_3D-primitives-centered-smooth-truncated-cone.scad ├── OpenSCAD_3D-primitives-cone.scad ├── OpenSCAD_3D-primitives-cube-centered.scad ├── OpenSCAD_3D-primitives-cube.scad ├── OpenSCAD_3D-primitives-cylinder.scad ├── OpenSCAD_3D-primitives-hexagonal-prism.scad ├── OpenSCAD_3D-primitives-sphere-smooth.scad ├── OpenSCAD_3D-primitives-sphere.scad ├── OpenSCAD_Combining-shapes-difference-multiple.scad ├── OpenSCAD_Combining-shapes-difference.scad ├── OpenSCAD_Combining-shapes-hull.scad ├── OpenSCAD_Combining-shapes-intersection.scad ├── OpenSCAD_Combining-shapes-minkowski.scad ├── OpenSCAD_Combining-shapes-union.scad ├── OpenSCAD_Loops-nested.scad ├── OpenSCAD_Loops-single-multiple-characteristics.scad ├── OpenSCAD_Loops-single.scad ├── OpenSCAD_Transformations-linear-extrude.scad ├── OpenSCAD_Transformations-mirror.scad ├── OpenSCAD_Transformations-resize.scad ├── OpenSCAD_Transformations-rotate-extrude.scad ├── OpenSCAD_Transformations-rotate.scad ├── OpenSCAD_Transformations-translate.scad └── screenshots │ ├── OpenSCAD_2D-primitives-circle.png │ ├── OpenSCAD_2D-primitives-pentagon.png │ ├── OpenSCAD_2D-primitives-polygon.png │ ├── OpenSCAD_2D-primitives-square-centered.png │ ├── OpenSCAD_2D-primitives-square.png │ ├── OpenSCAD_2D-primitives-text.png │ ├── OpenSCAD_3D-primitives-centered-smooth-truncated-cone.png │ ├── OpenSCAD_3D-primitives-cone.png │ ├── OpenSCAD_3D-primitives-cube-centered.png │ ├── OpenSCAD_3D-primitives-cube.png │ ├── OpenSCAD_3D-primitives-cylinder.png │ ├── OpenSCAD_3D-primitives-hexagonal-prism.png │ ├── OpenSCAD_3D-primitives-sphere-smooth.png │ ├── OpenSCAD_3D-primitives-sphere.png │ ├── OpenSCAD_Combining-shapes-difference-multiple.png │ ├── OpenSCAD_Combining-shapes-difference.png │ ├── OpenSCAD_Combining-shapes-hull.png │ ├── OpenSCAD_Combining-shapes-intersection.png │ ├── OpenSCAD_Combining-shapes-minkowski.png │ ├── OpenSCAD_Combining-shapes-union.png │ ├── OpenSCAD_Loops-nested.png │ ├── OpenSCAD_Loops-single-multiple-characteristics.png │ ├── OpenSCAD_Loops-single.png │ ├── OpenSCAD_Transformations-linear-extrude.png │ ├── OpenSCAD_Transformations-mirror.png │ ├── OpenSCAD_Transformations-resize.png │ ├── OpenSCAD_Transformations-rotate-extrude.png │ ├── OpenSCAD_Transformations-rotate.png │ └── OpenSCAD_Transformations-translate.png └── README.md /1_3D-Shapes/Big-Projects/OpenSCAD_Figure1-30.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Calibration Pyramid 2 | 3 | // level 4 4 | translate([0, 0, 30]) cube(10); 5 | 6 | // level 3 7 | translate([0, 0, 20]) cube([10, 20, 10]); 8 | translate([10, 0, 20]) cube(10); 9 | 10 | // level 2 11 | translate([0, 0, 10]) cube([20, 20, 10]); 12 | translate([20, 0, 10]) cube(10); 13 | translate([0, 20, 10]) cube(10); 14 | 15 | // level 1 16 | cube([30, 20, 10]); 17 | translate([0, 20, 0]) cube([20, 10, 10]); 18 | translate([30, 0, 0]) cube(10); 19 | translate([0, 30, 0]) cube(10); -------------------------------------------------------------------------------- /1_3D-Shapes/Big-Projects/OpenSCAD_Figure1-31.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Smiley Face 2 | 3 | // face 4 | difference() { 5 | cylinder(h=5, r1=40, r2=40); 6 | 7 | translate([15, 10, -1]) cylinder(h=7, r1=10, r2=10); 8 | translate([-15, 10, -1]) cylinder(h=7, r1=10, r2=10); 9 | 10 | // mouth 11 | difference() { 12 | translate([0, -5, -1]) cylinder(h=7, r1=30, r2=30); 13 | translate([0, 13, -2]) cylinder(h=9, r1=40, r2=40); 14 | } 15 | } 16 | 17 | // eyes 18 | translate([15, 2, 0]) cylinder(h=5, r1=5, r2=5); 19 | translate([-15, 2, 0]) cylinder(h=5, r1=5, r2=5); 20 | 21 | // loop 22 | translate([0, 40, 0]) difference() { 23 | cylinder(h=5, r1=8, r2=8); 24 | translate([0, 0, -1]) cylinder(h=7, r1=4, r2=4); 25 | } 26 | -------------------------------------------------------------------------------- /1_3D-Shapes/Big-Projects/OpenSCAD_Figure1-32.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Hole and Pin Test 2 | 3 | // Pins 4 | union() { 5 | cube([50, 30, 5]); 6 | translate([10, 15, 0]) cylinder(h=10, r1=5, r2=5); 7 | translate([35, 15, 0]) cylinder(h=10, r1=10, r2=10); 8 | } 9 | 10 | // Holes 11 | translate([0, 40, 0]) difference() { 12 | cube([50, 30, 5]); 13 | translate([10, 15, -1]) cylinder(h=10, r1=6, r2=6); 14 | translate([35, 15, -1]) cylinder(h=10, r1=11, r2=11); 15 | } 16 | -------------------------------------------------------------------------------- /1_3D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure1-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure1-30.png -------------------------------------------------------------------------------- /1_3D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure1-31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure1-31.png -------------------------------------------------------------------------------- /1_3D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure1-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure1-32.png -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/OpenSCAD_Figure1-29a.scad: -------------------------------------------------------------------------------- 1 | //3D Shapes- Design Time: Mouse 2 | 3 | $fn = 40; 4 | 5 | cylinder(h=2, r1=4, r2=4); 6 | translate([12, 0, 0]) cylinder(h=2, r1=4, r2=4); 7 | translate([6, 8, 0]) cylinder(h=2, r1=8, r2=8); 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/OpenSCAD_Figure1-29b.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Design Time: Yo Yo 2 | 3 | cylinder(h=10, r1=0, r2=10); 4 | cylinder(h=10, r1=10, r2=0); 5 | 6 | -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/OpenSCAD_Figure1-29c.scad: -------------------------------------------------------------------------------- 1 | //3D Shapes- Design Time: Top 2 | 3 | $fn = 30; 4 | 5 | intersection() { 6 | translate([0, 0, -5]) sphere(15); 7 | cylinder(h=10, r1=0, r2=10); 8 | } 9 | translate([0, 0, 8]) cylinder(h=5, r1=2, r2=2); 10 | 11 | -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/OpenSCAD_Figure1-29d.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Design Time: Top 2 | 3 | $fn = 100; 4 | 5 | translate([0, 0, 15]) sphere(15); 6 | cylinder(h=10, r1=10, r2=0); 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/OpenSCAD_Figure1-29e.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Design Time: Halfpipe 2 | 3 | difference() { 4 | translate([-25, 0, 0]) cube([50, 30, 50]); 5 | translate([0, 0, -1]) cylinder(h=60, r1=20, r2=20); 6 | } 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/OpenSCAD_Figure1-29f.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Design Time: Ice Cream Cone 2 | 3 | difference() { 4 | cylinder(h=40, r1=0, r2=10); 5 | translate([0, 0, 4]) cylinder(h=38, r1=0, r2=9); 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29a.png -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29b.png -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29c.png -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29d.png -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29e.png -------------------------------------------------------------------------------- /1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Design-Time/screenshots/OpenSCAD_Figure1-29f.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-10.scad: -------------------------------------------------------------------------------- 1 | translate([-10, 20, 0]) cube([20, 10, 10]); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-11.scad: -------------------------------------------------------------------------------- 1 | %cube([20, 10, 10]); 2 | translate([-10, 20, 0]) cube([20, 10, 10]); 3 | $fn=32; 4 | color("Red") translate([-10, 0, 0]) rotate([0,90,0]) { 5 | translate([0,0,1]) cylinder(h=9, r=0.1); 6 | cylinder(h=1, r1=0, r2=0.3); 7 | } 8 | color("Green") translate([-10, 20, 0]) rotate([90,0,0]) { 9 | translate([0,0,1]) cylinder(h=19, r=0.1); 10 | cylinder(h=1, r1=0, r2=0.3); 11 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-12.scad: -------------------------------------------------------------------------------- 1 | translate([-10, 10, 0]) cube([20, 10, 10]); 2 | translate([20, 0, 0]) sphere(5); 3 | translate([0, 0, -10]) cylinder(h=30, r1=2, r2=2); 4 | -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-13.scad: -------------------------------------------------------------------------------- 1 | translate([-10, 10, 0]) cube([20, 10, 10], center=true); 2 | translate([20, 0, 0]) sphere(5); 3 | translate([0, 0, -10]) cylinder(h=30, r1=2, r2=2, center=true); 4 | -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-14.scad: -------------------------------------------------------------------------------- 1 | cylinder(h=20, r1=2, r2=2, $fn=10); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-15.scad: -------------------------------------------------------------------------------- 1 | cylinder(h=20, r1=2, r2=2, $fn=50); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-17.scad: -------------------------------------------------------------------------------- 1 | difference(){ 2 | cube([10, 10, 10]); 3 | sphere(5); 4 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-18.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | sphere(5); 3 | cube([10, 10, 10]); 4 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-19.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | cube([10, 10, 10]); 3 | #sphere(5); 4 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-20.scad: -------------------------------------------------------------------------------- 1 | difference(){ 2 | cube([10, 10, 10]); 3 | 4 | translate([0,2.5,2.5]) cube([10, 5, 5]); 5 | translate([2.5,2.5,0]) cube([5, 5, 10]); 6 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-21.scad: -------------------------------------------------------------------------------- 1 | difference(){ 2 | cube([10, 10, 10]); 3 | 4 | #translate([-1,2.5,2.5]) cube([12, 5, 5]); 5 | #translate([2.5,2.5,-1]) cube([5, 5, 12]); 6 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-22.scad: -------------------------------------------------------------------------------- 1 | difference(){ 2 | cube([10, 10, 10]); 3 | 4 | translate([-1,2.5,2.5]) cube([12, 5, 5]); 5 | translate([2.5,2.5,-1]) cube([5, 5, 12]); 6 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-23.scad: -------------------------------------------------------------------------------- 1 | intersection() { 2 | cube([10, 10, 10]); 3 | sphere(5); 4 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-24.scad: -------------------------------------------------------------------------------- 1 | union() { 2 | cube([10, 10, 10]); 3 | sphere(5); 4 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-25.scad: -------------------------------------------------------------------------------- 1 | difference(){ 2 | union(){ 3 | cube([10, 10, 10]); 4 | cylinder(r=2, h=10); 5 | } 6 | sphere(5); 7 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-26.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | cube([10, 10, 10]); 3 | cylinder(r=2, h=10); 4 | sphere(5); 5 | } -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-3.scad: -------------------------------------------------------------------------------- 1 | sphere(10); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-4.scad: -------------------------------------------------------------------------------- 1 | cylinder(h=20, r1=5, r2=5); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-5.scad: -------------------------------------------------------------------------------- 1 | cylinder(h=20, r1=5, r2=3); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-6.scad: -------------------------------------------------------------------------------- 1 | cylinder(h=20, r1=0, r2=5); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-7.scad: -------------------------------------------------------------------------------- 1 | import("3DBenchy.stl"); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-8.scad: -------------------------------------------------------------------------------- 1 | cube([20, 10, 10]); 2 | sphere(5); 3 | cylinder(h=30, r1=2, r2=2); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/OpenSCAD_Figure1-9.scad: -------------------------------------------------------------------------------- 1 | cube([5, 10, 20], center=true); -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-10.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-11.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-12.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-13.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-14.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-15.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-17.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-18.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-19.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-20.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-21.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-22.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-23.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-24.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-25.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-26.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-3.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-4.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-5.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-6.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-7.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-8.png -------------------------------------------------------------------------------- /1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Examples/screenshots/OpenSCAD_Figure1-9.png -------------------------------------------------------------------------------- /1_3D-Shapes/Figures/OpenSCAD_Figure1-1-2.scad: -------------------------------------------------------------------------------- 1 | cube([5, 10, 20]); -------------------------------------------------------------------------------- /1_3D-Shapes/Figures/OpenSCAD_Figure1-27-28.scad: -------------------------------------------------------------------------------- 1 | // 3D Shapes- Design Time: Halfpipe 2 | 3 | difference() { 4 | translate([-25, 0, 0]) cube([50, 30, 50]); 5 | translate([0, 0, -1]) cylinder(h=60, r1=20, r2=20); 6 | } 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-1.png -------------------------------------------------------------------------------- /1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-16.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 27 | 30 | 32 | 34 | 42 | 50 | 54 | 55 | union 65 | 66 | 69 | 73 | 81 | 89 | intersection 99 | 100 | 102 | 105 | 113 | 121 | 125 | 126 | difference 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-2.png -------------------------------------------------------------------------------- /1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-27.png -------------------------------------------------------------------------------- /1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/1_3D-Shapes/Figures/figures/OpenSCAD_Figure1-28.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Big-Projects/OpenSCAD_Figure2-15.scad: -------------------------------------------------------------------------------- 1 | //Game Dice 2 | 3 | $fn = 50; 4 | cube_size = 10; 5 | sphere_size = 2; 6 | height = 6; 7 | 8 | difference() { 9 | // main structure 10 | minkowski() { 11 | cube(cube_size, center=true); 12 | sphere(sphere_size); 13 | } 14 | 15 | // 1 16 | translate([0, 0, height]) cylinder(h=2, r1=1, r2=1); // center 17 | 18 | // 6 19 | rotate([0, 180, 0]) { 20 | translate([height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // lower right 21 | translate([height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // lower left 22 | translate([-height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // upper right 23 | translate([-height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // upper left 24 | translate([0, height/2, height]) cylinder(h=3, r1=1, r2=1); // center right 25 | translate([0, -height/2, height]) cylinder(h=3, r1=1, r2=1); // center left 26 | } 27 | 28 | // 2 29 | rotate([90, 90, 0]) { 30 | translate([height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // lower right 31 | translate([-height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // upper left 32 | } 33 | 34 | // 5 35 | rotate([-90, 90, 0]) { 36 | translate([0, 0, height]) cylinder(h=2, r1=1, r2=1); // center 37 | translate([height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // lower right 38 | translate([height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // lower left 39 | translate([-height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // upper right 40 | translate([-height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // upper left 41 | } 42 | 43 | // 3 44 | rotate([0, -90, 0]) { 45 | translate([0, 0, height]) cylinder(h=2, r1=1, r2=1); // center 46 | translate([height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // lower left 47 | translate([-height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // upper right 48 | } 49 | 50 | // 4 51 | rotate([0, 90, 0]) { 52 | translate([height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // lower right 53 | translate([height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // lower left 54 | translate([-height/2, height/2, height]) cylinder(h=3, r1=1, r2=1); // upper right 55 | translate([-height/2, -height/2, height]) cylinder(h=3, r1=1, r2=1); // upper left 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Big-Projects/OpenSCAD_Figure2-16.scad: -------------------------------------------------------------------------------- 1 | // Transforming Shapes - Desktop Organizer 2 | 3 | $fn = 50; 4 | 5 | height = 20; 6 | width = 10; 7 | 8 | // pen holder 9 | difference() { 10 | cube([width, width, height]); 11 | translate([1, 1, 1]) cube([width-2, width-2, height]); 12 | translate([width, width, width/4]) sphere(width/2); 13 | } 14 | // tray 15 | difference() { 16 | cube([width*2, width*1.5, 4]); 17 | translate([1, 1, 1]) cube([width*2 - 2, width*1.5 - 2, 5]); 18 | } 19 | 20 | mirror([0, 1, 0]) { 21 | // pencil holder 22 | difference() { 23 | cube([width, width, height]); 24 | translate([1, 1, 1]) cube([width-2, width-2, height]); 25 | translate([width, width, width/4]) sphere(width/2); 26 | } 27 | // tray 28 | difference() { 29 | cube([width*2, width*1.5, 4]); 30 | translate([1, 1, 1]) cube([width*2 - 2, width*1.5 - 2, 5]); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Big-Projects/screenshots/OpenSCAD_Figure2-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Big-Projects/screenshots/OpenSCAD_Figure2-15.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Big-Projects/screenshots/OpenSCAD_Figure2-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Big-Projects/screenshots/OpenSCAD_Figure2-16.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/OpenSCAD_Figure2-14a.scad: -------------------------------------------------------------------------------- 1 | //Transforming Shapes - Design Time: Heart 2 | 3 | $fn = 50; 4 | 5 | hull() { 6 | cylinder(h=1, r1=1, r2=1); 7 | translate([7, 3, 0]) cylinder(h=1, r1=4, r2=4); 8 | } 9 | mirror([0, 1, 0]) hull() { 10 | cylinder(h=1, r1=1, r2=1); 11 | translate([7, 3, 0]) cylinder(h=1, r1=4, r2=4); 12 | } 13 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/OpenSCAD_Figure2-14b.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | sphere(d=100); 3 | 4 | cylinder(d=50, h=125, center1=true, r2=true); 5 | #rotate([90, 0, 0]) cylinder(r1=25, r2=25, h=125, center=true); 6 | rotate([0, 90, 0]) cylinder(r1=25, r2=25, h=125, center=true); 7 | } 8 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/OpenSCAD_Figure2-14c.scad: -------------------------------------------------------------------------------- 1 | // Transforming Shapes - Design Time: Guitar Pick 2 | 3 | $fn = 50; 4 | 5 | hull() { 6 | cylinder(h=1, r1=1, r2=1); 7 | translate([7, 0, 0]) cylinder(h=1, r1=5, r2=5); 8 | } 9 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/OpenSCAD_Figure2-14d.scad: -------------------------------------------------------------------------------- 1 | // Transforming Shapes - Design Time: Snowman 2 | 3 | $fn = 50; 4 | 5 | sphere(10); 6 | translate([0, 0, 10]) sphere(8); 7 | translate([0, 0, 18]) sphere(6); 8 | translate([0, 0, 23]) cylinder(h=2, r1=4, r2=4); 9 | translate([0, 0, 25]) cylinder(h=5, r1=3, r2=3); 10 | translate([5, 0, 18]) rotate([0, 90, 0]) cylinder(h=5, r1=2, r2=0); 11 | translate([5, -2, 20]) sphere(1); 12 | translate([5, 2, 20]) sphere(1); 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/OpenSCAD_Figure2-14e.scad: -------------------------------------------------------------------------------- 1 | // Transforming Shapes - Design Time: Modern Table 2 | 3 | $fn = 50; 4 | 5 | scale([3, 1.5, 1]) cylinder(h=2, r1=10, r2=10); // table top 6 | 7 | translate([-15, -10, -13]) rotate([-10, 20, 0]) cylinder(h=15, r1=1, r2=1); // left legs 8 | translate([-15, 10, -13]) rotate([10, 20, 0]) cylinder(h=15, r1=1, r2=1); 9 | 10 | translate([15, -10, -13]) rotate([-10, -20, 0]) cylinder(h=15, r1=1, r2=1); // right legs 11 | translate([15, 10,-13]) rotate([10, -20, 0]) cylinder(h=15, r1=1, r2=1); 12 | 13 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/OpenSCAD_Figure2-14f.scad: -------------------------------------------------------------------------------- 1 | // Transforming Shapes - Design Time: Top Hat 2 | 3 | $fn = 50; 4 | 5 | difference() { 6 | union() { 7 | // brim 8 | minkowski() { 9 | sphere(1); 10 | cylinder(h=1, r1=12, r2=12); 11 | } 12 | // stack 13 | minkowski() { 14 | sphere(1); 15 | hull() { 16 | cylinder(h=3, r1=7, r2=7); 17 | translate([0, 0, 15]) cylinder(h=2, r1=9, r2=9); 18 | } 19 | } 20 | } // union 21 | 22 | // hole 23 | translate([0, 0, -2]) cylinder(h=18, r1=8, r2=8); 24 | } 25 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14a.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14b.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14c.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14d.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14e.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Design-Time/screenshots/OpenSCAD_Figure2-14f.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-1.scad: -------------------------------------------------------------------------------- 1 | rotate([90, 0, 0]) cube([30, 20, 10]); 2 | %cube([30, 20, 10]); 3 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-10.scad: -------------------------------------------------------------------------------- 1 | hull() { 2 | translate([10, 0, 0]) sphere(8); 3 | translate([-10, 0, 0]) cube([4, 4, 4], center=true); 4 | } -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-11.scad: -------------------------------------------------------------------------------- 1 | $fn=50; 2 | minkowski() { 3 | cylinder(h=15, r1=5, r2=5); 4 | sphere(4); 5 | } -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-12.scad: -------------------------------------------------------------------------------- 1 | translate([5, 0, 0]) rotate([90, 0, 0]) cylinder(h=10, r1=4, r2=4); 2 | translate([5, 0, 0]) rotate([0, 90, 0]) cylinder(h=10, r1=4, r2=4); 3 | translate([5, 0, 0]) rotate([0, 0, 90]) cylinder(h=10, r1=4, r2=4); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-13.scad: -------------------------------------------------------------------------------- 1 | rotate([90, 0, 0]) translate([5, 0, 0]) cylinder(h=10, r1=4, r2=4); 2 | rotate([0, 90, 0]) translate([5, 0, 0]) cylinder(h=10, r1=4, r2=4); 3 | rotate([0, 0, 90]) translate([5, 0, 0]) cylinder(h=10, r1=4, r2=4); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-2.scad: -------------------------------------------------------------------------------- 1 | rotate([0, 180, 0]) cube([30, 20, 10]); 2 | %cube([30, 20, 10]); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-3.scad: -------------------------------------------------------------------------------- 1 | rotate([-90, 0, -90]) cube([30, 20, 10]); 2 | %cube([30, 20, 10]); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-4.scad: -------------------------------------------------------------------------------- 1 | %cube([30, 20, 10]); 2 | rotate([-90, 0, 0]) rotate([0, 0, -90]) cube([30, 20, 10]); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-5.scad: -------------------------------------------------------------------------------- 1 | mirror([10, 0, 0]) translate([0,10,0]) 2 | rotate([0,90,0]) 3 | cylinder(h=10, r1=5, r2=2); 4 | %translate([0,10,0]) 5 | rotate([0,90,0]) 6 | cylinder(h=10, r1=5, r2=2); 7 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-6.scad: -------------------------------------------------------------------------------- 1 | mirror([10, 0, 0]) translate([0,10,0]) rotate([0,90,0]) cylinder(h=10, r1=5, r2=2); 2 | %translate([0,10,0]) rotate([0,90,0]) cylinder(h=10, r1=5, r2=2); 3 | 4 | color("green") rotate([0,90,0]) { 5 | cylinder(h=8, r1=0.2, r2=0.2); 6 | translate([0, 0, 8]) cylinder(h=2, r1=0.5, r2=0); 7 | } 8 | 9 | color("LightBlue", 0.3) rotate([0, -90, 0]) translate([0,7.5,0]) cube([30, 30, 0.1], center=true); 10 | 11 | -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-7.scad: -------------------------------------------------------------------------------- 1 | mirror([0, 0, 10]) cylinder(h=10, r1=2, r2=5); 2 | %cylinder(h=10, r1=2, r2=5); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-8.scad: -------------------------------------------------------------------------------- 1 | resize([10, 10, 20]) sphere(1, $fn=100); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/OpenSCAD_Figure2-9.scad: -------------------------------------------------------------------------------- 1 | resize([10, 5, 20]) cylinder(h=5, r1=5, r2=5); -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-1.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-10.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-11.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-12.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-13.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-2.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-3.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-4.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-5.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-6.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-7.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-8.png -------------------------------------------------------------------------------- /2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/2_More-Ways-To-Transform-Shapes/Examples/screenshots/OpenSCAD_Figure2-9.png -------------------------------------------------------------------------------- /3_2D-Shapes/Big-Projects/OpenSCAD_Figure3-23.scad: -------------------------------------------------------------------------------- 1 | $fn = 50; 2 | cube_size = 10; 3 | sphere_size = 2; 4 | height = 6; 5 | 6 | module ActionDice() { 7 | difference() { 8 | // main structure 9 | minkowski() { 10 | cube(cube_size, center=true); 11 | sphere(sphere_size); 12 | } 13 | 14 | // Run 15 | rotate([0,0, 135]) translate([-height+1, -height/4, height]) linear_extrude(height=2, convexity=5) text("Run", size=3.5); // center 16 | 17 | 18 | // Walk 19 | rotate([-90, 90, 0]) { 20 | rotate([0,0, 45]) translate([-height+1, -height/4, height]) linear_extrude(height=2, convexity=5) text("Walk", size=3.5); // center 21 | } 22 | 23 | // Fly 24 | rotate([0, -90, 0]) { 25 | rotate([0,0, -45])translate([-height+3, -height/4, height]) linear_extrude(height=2, convexity=5) text("Fly", size=3.5); // center 26 | } 27 | // Jump 28 | rotate([0, -90, 90]) { 29 | rotate([0,0, -45])translate([-height, -height/4, height-1]) linear_extrude(height=2, convexity=5) text("Jump", size=3.5); // center 30 | } 31 | // Spin 32 | rotate([90, -90, 90]) { 33 | rotate([0,0, -45])translate([-height+1, -height/4, height]) linear_extrude(height=2, convexity=5) text("Spin", size=3.5); // center 34 | } 35 | 36 | // Roll 37 | rotate([0,180, 90]) { 38 | rotate([0,0, -45])translate([-height+2, -height/4, height]) linear_extrude(height=2, convexity=5) text("Roll", size=3.5); // center 39 | } 40 | 41 | } 42 | } 43 | 44 | module AnimalDice() { 45 | difference() { 46 | // main structure 47 | minkowski() { 48 | cube(cube_size, center=true); 49 | sphere(sphere_size); 50 | } 51 | 52 | // Rat 53 | rotate([0,0, 180])translate([-height+1, -height/4, height]) linear_extrude(height=2, convexity=5) text("Rat", size=4); // center 54 | 55 | 56 | // Dragon 57 | rotate([-90, 90, 0]) { 58 | rotate([0,0, 45]) translate([-height-1, -height/4, height]) linear_extrude(height=2, convexity=5) text("Dragon", size=3); // center 59 | } 60 | 61 | // Alligator 62 | rotate([0, -90, 0]) { 63 | rotate([0,0, -45])translate([-height-1, -height/4+.5, height]) linear_extrude(height=2, convexity=5) text("Alligator", size=3); // center 64 | } 65 | 66 | } 67 | } 68 | 69 | module DecisionDice() { 70 | difference() { 71 | // main structure 72 | minkowski() { 73 | cube(cube_size, center=true); 74 | sphere(sphere_size); 75 | } 76 | 77 | // Yes 78 | translate([-height+1, -height/4, height]) linear_extrude(height=2, convexity=5) text("Yes", size=4); // center 79 | 80 | // Yes 81 | rotate([0, 180, 0]) { 82 | translate([-height+1, -height/4, height]) linear_extrude(height=2, convexity=5) text("Yes", size=4); // center 83 | } 84 | 85 | // No 86 | rotate([90, 90, 0]) { 87 | translate([-height+2, -height/4, height]) linear_extrude(height=2, convexity=5) text("No", size=4); // center 88 | } 89 | 90 | // No 91 | rotate([-90, 90, 0]) { 92 | translate([-height+2, -height/4, height]) linear_extrude(height=2, convexity=5) text("No", size=4); // center 93 | } 94 | 95 | // Maybe 96 | rotate([0, -90, 0]) { 97 | rotate([0,0, -45])translate([-height, -height/4, height]) linear_extrude(height=2, convexity=5) text("Maybe", size=3); // center 98 | } 99 | 100 | // Maybe 101 | rotate([0, 90, 0]) { 102 | rotate([0,0, 45])translate([-height, -height/4, height]) linear_extrude(height=2, convexity=5) text("Maybe", size=3); // center 103 | } 104 | } 105 | } 106 | 107 | module TimeDice() 108 | { 109 | difference() { 110 | // main structure 111 | minkowski() { 112 | cube(cube_size, center=true); 113 | sphere(sphere_size); 114 | } 115 | 116 | // Today 117 | rotate([0,0, 180])translate([-height+.5, -height/4, height]) linear_extrude(height=2, convexity=5) text("Today", size=3); // center 118 | 119 | 120 | // Yesterday 121 | rotate([-90, 90, 0]) { 122 | rotate([0,0, 45]) translate([-height, -height/4, height]) linear_extrude(height=2, convexity=5) text("Yesterday", size=2); // center 123 | } 124 | 125 | // Tomorrow 126 | rotate([0, -90, 0]) { 127 | rotate([0,0, -45])translate([-height, -height/4, height]) linear_extrude(height=2, convexity=5) text("Tomorrow", size=2); // center 128 | } 129 | 130 | } 131 | } 132 | 133 | translate([-10,11,0]) rotate([+28,-45,-135]) ActionDice(); 134 | translate([11,11,0]) rotate([+17,22,-230]) AnimalDice(); 135 | translate([-11,-11,0]) rotate([+43,+40,110]) DecisionDice(); 136 | translate([11,-11,0]) rotate([+57,+27,181]) TimeDice(); 137 | -------------------------------------------------------------------------------- /3_2D-Shapes/Big-Projects/OpenSCAD_Figure3-24.scad: -------------------------------------------------------------------------------- 1 | $fn=100; 2 | 3 | length = 100; 4 | width= 75; 5 | height = 50; 6 | thickness = 5; 7 | corner_roundness = 2; 8 | 9 | //Box 10 | difference(){ 11 | minkowski(){ 12 | linear_extrude(height=height) square([length, width]); 13 | sphere(corner_roundness); 14 | } 15 | translate([0,0,thickness]) linear_extrude(height=height) offset(-4) square([length, width]); 16 | } 17 | 18 | //Lid 19 | translate([0, width*1.5,0]) 20 | difference(){ 21 | union(){ 22 | minkowski(){ 23 | linear_extrude(height=thickness) square([length, width]); 24 | sphere(corner_roundness); 25 | } 26 | linear_extrude(height=2*thickness) offset(-4) square([length-2, width-2]); 27 | } 28 | 29 | union(){ 30 | translate([.1*length,.3*width,3*thickness])rotate([180,0,0])linear_extrude(height=4*thickness, convexity=5) text("Storytelling"); 31 | translate([.1*length,.5*width,3*thickness])rotate([180,0,0])linear_extrude(height=4*thickness, convexity=5) text("Dice"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /3_2D-Shapes/Big-Projects/OpenSCAD_Figure3-25.scad: -------------------------------------------------------------------------------- 1 | //Base 2 | $fa=1; 3 | $fs=0.5; 4 | base_radius = 30; 5 | message = "1st Place"; 6 | 7 | //Trophy 8 | rotate_extrude() 9 | union(){ 10 | 11 | //Stem 12 | difference(){ 13 | square([.3*base_radius, .5*base_radius]); 14 | translate([.25*base_radius, .25*base_radius]) circle(.2*base_radius); 15 | } 16 | translate([0, -.2*base_radius]) square([.4*base_radius, .2*base_radius]); 17 | 18 | translate([.3*base_radius,.5*base_radius]) circle(.01*base_radius); 19 | translate([.3*base_radius,0]) circle(.01*base_radius); 20 | translate([.3*base_radius,.05*base_radius]) circle(.01*base_radius); 21 | 22 | //Cup 23 | intersection(){ 24 | translate([0,2.4*base_radius]) scale([1.25, 4]) 25 | difference(){ 26 | circle(.5*base_radius); 27 | circle(.45*base_radius); 28 | } 29 | square([base_radius, 1.5*base_radius]);//keep the lower-right quadrant of the ellipse 30 | } 31 | } 32 | 33 | //Base 34 | minkowski(){ 35 | union(){ 36 | translate([0,0,-.35*base_radius])cube([base_radius,base_radius, .3*base_radius], center=true); 37 | translate([0,0,-.65*base_radius]) rotate([0,0,45])cylinder(h=4, r1=1.1*base_radius, r2=.9*base_radius, $fn=4); 38 | } 39 | sphere(1); 40 | } 41 | translate([-.4*base_radius, -.5*base_radius,-.4*base_radius]) rotate([90,0,0])linear_extrude(height=3) text(message, size =4); 42 | -------------------------------------------------------------------------------- /3_2D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure3-23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure3-23.png -------------------------------------------------------------------------------- /3_2D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure3-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure3-24.png -------------------------------------------------------------------------------- /3_2D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure3-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Big-Projects/screenshots/OpenSCAD_Figure3-25.png -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/OpenSCAD_Figure3-22a.scad: -------------------------------------------------------------------------------- 1 | linear_extrude(height = 10, scale=[2,5], $fn=100) 2 | difference(){ 3 | circle(5, $fn=100); 4 | circle(4.5, $fn=100); 5 | } 6 | cylinder(height=2, r1=6, r2=6, $fn=100); -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/OpenSCAD_Figure3-22b.scad: -------------------------------------------------------------------------------- 1 | difference(){ 2 | square([10, 5]); 3 | translate([3, 0]) square([2, 3]); 4 | } 5 | polygon([ [-1, 5], [5, 8] ,[ 11, 5] ]); 6 | translate( [8,6]) square([1, 2]); 7 | -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/OpenSCAD_Figure3-22c.scad: -------------------------------------------------------------------------------- 1 | translate([60,5,8])rotate([0,180,0])linear_extrude(height = 6 ) text("good job!"); 2 | cube([65, 20, 3]); -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/OpenSCAD_Figure3-22d.scad: -------------------------------------------------------------------------------- 1 | 2 | rotate_extrude($fn=100) polygon([ [0,20], [.5, 14], [2, 13.5], [3, 13], [2, 12], [2, 11.5], [5, 10], [5, 9], [6,9],[6,8], [7,7.5], [5, 7], [5, 6], [6, 5], [1.5,3], [1,3], [ 1,-20], [0, -20 ]]); 3 | -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/OpenSCAD_Figure3-22e.scad: -------------------------------------------------------------------------------- 1 | text("have", font="Chalkboard"); 2 | translate([0, -10])text("a", font="Chalkboard"); 3 | translate([0, -20])text("nice", font="Chalkboard"); 4 | translate([0, -30])text("day!", font="Chalkboard"); 5 | -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/OpenSCAD_Figure3-22f.scad: -------------------------------------------------------------------------------- 1 | polygon( [ [2, 1], [3,4], [1,6], [4,6], [5,9], [6,6],[9,6],[7,4],[8,1],[5,3] ] ); -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22a.png -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22b.png -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22c.png -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22d.png -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22e.png -------------------------------------------------------------------------------- /3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Design-Time/screenshots/OpenSCAD_Figure3-22f.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-1.scad: -------------------------------------------------------------------------------- 1 | circle(20); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-10.scad: -------------------------------------------------------------------------------- 1 | text(str(123), size=20); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-11.scad: -------------------------------------------------------------------------------- 1 | rotate(30) { 2 | difference() { 3 | square([120, 40]); 4 | translate([20, 20]) circle(15); 5 | translate([60, 20]) circle(15); 6 | translate([100, 20]) circle(15); 7 | } 8 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-12.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | square([5, 5]); 3 | circle(5, $fn=50); 4 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-13.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | circle(5, $fn=50); 3 | square([5, 5]); 4 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-14.scad: -------------------------------------------------------------------------------- 1 | linear_extrude(5) text("A"); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-15.scad: -------------------------------------------------------------------------------- 1 | linear_extrude(100, twist=30, slices=25, scale=1/3) { 2 | square(100, center=true); 3 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-16.scad: -------------------------------------------------------------------------------- 1 | rotate_extrude() { 2 | translate([100, 0]) circle(40); 3 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-17.scad: -------------------------------------------------------------------------------- 1 | rotate_extrude(angle=135) { 2 | translate([100, 0]) circle(40); 3 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-18.scad: -------------------------------------------------------------------------------- 1 | offset(-2) { 2 | union() { 3 | square([100, 30], center=true); 4 | square([30, 100], center=true); 5 | } 6 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-19.scad: -------------------------------------------------------------------------------- 1 | linear_extrude(30) { 2 | difference() { 3 | union() { 4 | square([100, 30], center=true); 5 | square([30, 100], center=true); 6 | } 7 | offset(-2) { 8 | square([100, 30], center=true); 9 | square([30, 100], center=true); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-2.scad: -------------------------------------------------------------------------------- 1 | circle(20); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-20.scad: -------------------------------------------------------------------------------- 1 | import("drawing.dxf"); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-21.scad: -------------------------------------------------------------------------------- 1 | linear_extrude(height=500, scale=3) import("drawing.dxf"); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-4.scad: -------------------------------------------------------------------------------- 1 | square([25, 10]); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-5.scad: -------------------------------------------------------------------------------- 1 | polygon([ [0, 0], [10, 0], [10, 10] ]); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-6.scad: -------------------------------------------------------------------------------- 1 | polygon([ 2 | [ 0, 0], [20, 0], 3 | [20, 5], [ 5, 5], 4 | [ 5, 10], [20, 10], 5 | [20, 15], [ 0, 15] 6 | ]); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-7.scad: -------------------------------------------------------------------------------- 1 | text("Hello, OpenSCAD", size=10); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-8.scad: -------------------------------------------------------------------------------- 1 | text("Hello, OpenSCAD", font="Courier"); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/OpenSCAD_Figure3-9.scad: -------------------------------------------------------------------------------- 1 | text("♛", font="Arial Unicode MS"); -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/circle.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 27 | 29 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-1.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-10.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-11.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-12.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-13.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-14.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-15.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-16.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-17.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-18.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-19.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-2.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-20.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-21.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-4.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-5.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-6.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-7.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-8.png -------------------------------------------------------------------------------- /3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/3_2D-Shapes/Examples/screenshots/OpenSCAD_Figure3-9.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Big-Projects/OpenSCAD_Figure4-13.scad: -------------------------------------------------------------------------------- 1 | 2 | difference(){ 3 | 4 | union(){ 5 | cube([90,190,5]); 6 | 7 | for(thickness = [0.1: 0.2: 3]){ 8 | translate([10, thickness*60, 1]) cube([20, thickness, 6]); 9 | translate([40, thickness*60, 1]) linear_extrude(height = 6) text(str(thickness, " mm"), size = 4, halign="center", valign="center"); 10 | } 11 | 12 | }//union 13 | 14 | union(){ 15 | for(thickness = [0.1: 0.2: 3]){ 16 | translate([50, thickness*60, 2]) cube([20, thickness, 6]); 17 | } 18 | 19 | translate([80, 100, -5]) rotate([0,0,90]) linear_extrude(height = 20, convexity=4) text( "Detail Test", size = 12, halign="center", valign="center"); 20 | 21 | } 22 | }//difference 23 | 24 | 25 | -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Big-Projects/OpenSCAD_Figure4-14.scad: -------------------------------------------------------------------------------- 1 | $fn=100; 2 | 3 | //base 4 | cube([200, 60, 10 ], center=true); 5 | 6 | //poles 7 | for(x=[-60:60:60]){ 8 | translate([x,0,5])cylinder(h=70, r1=4, r2=4); 9 | } 10 | 11 | for(d=[7:-1:2]){ 12 | 13 | translate([-60,0,10+(7-d)*10]) 14 | difference(){ 15 | cylinder(h=10, r1=d*4, r2=d*4, center=true); 16 | cylinder(h=12, r1=5, r2=5, center=true); 17 | } 18 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Big-Projects/OpenSCAD_Figure4-15.scad: -------------------------------------------------------------------------------- 1 | $fn=100; 2 | 3 | //base 4 | difference(){ 5 | cube([184, 184, 10], center=true); 6 | for(y=[-90:60:90]){ 7 | translate([0,y,6]) cube([200, 4, 6], center=true); 8 | } 9 | for(x=[-90:60:90]){ 10 | translate([x,0,6]) cube([4, 200, 6], center=true); 11 | } 12 | } 13 | 14 | //poles 15 | for(y=[-60:60:60]){ 16 | for(x=[-60:60:60]){ 17 | translate([x,y,5]) cylinder(h=20, r1=5, r2=5); 18 | } 19 | } 20 | 21 | for(n=[0:1:4]){ 22 | translate([-143, 41-55*n, 0 ]) { 23 | difference(){ 24 | union() { 25 | rotate(45) cube([55,18,15], center=true); 26 | rotate(-45) cube([55,18,15], center=true); 27 | } 28 | cylinder(h=30, r1=7, r2=7, center=true); 29 | } 30 | } 31 | } 32 | for(n=[0:1:3]){ 33 | translate([-198, 41-55*n, 0 ]) { 34 | difference(){ 35 | cylinder(h=15, r=25, center=true); 36 | cylinder(h=30, r=7, center=true); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Big-Projects/screenshots/OpenSCAD_Figure4-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Big-Projects/screenshots/OpenSCAD_Figure4-13.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Big-Projects/screenshots/OpenSCAD_Figure4-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Big-Projects/screenshots/OpenSCAD_Figure4-14.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Big-Projects/screenshots/OpenSCAD_Figure4-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Big-Projects/screenshots/OpenSCAD_Figure4-15.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/OpenSCAD_Figure4-12a.scad: -------------------------------------------------------------------------------- 1 | 2 | for(s=[3,4,5,6,7,8,9,10]){ 3 | translate([(s-3)*10+3,0,0])cylinder(h=3, r=4, $fn=s); 4 | } 5 | -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/OpenSCAD_Figure4-12b.scad: -------------------------------------------------------------------------------- 1 | for(i=[1:1:10]){ 2 | 3 | translate([0,0,i*10]) cube([i*20, i*20, 10], center=true); 4 | 5 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/OpenSCAD_Figure4-12c.scad: -------------------------------------------------------------------------------- 1 | for(s = [45:45:360]){ 2 | rotate([s,0,0]) translate ([30,0,0]) cylinder(h=4, r=4); 3 | } 4 | 5 | for(s = [45:45:360]){ 6 | rotate([s,0,0]) translate ([-30,10,0]) cylinder(h=4, r=4); 7 | } 8 | 9 | for(s = [45:45:360]){ 10 | rotate([s,90,0]) translate ([0,0,10]) cylinder(h=4, r=4); 11 | } 12 | 13 | for(s = [45:45:360]){ 14 | rotate([s,0,0]) translate ([50,0,10]) rotate([0,90,0]) cylinder(h=4, r=4); 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/OpenSCAD_Figure4-12d.scad: -------------------------------------------------------------------------------- 1 | 2 | 3 | $fn = 100; //smooth curves 4 | 5 | cylinder(h=4, r=50); 6 | 7 | for(s1 = [1:1:4]){ 8 | for(s2 = [-360:15:360]){ 9 | rotate([0,0,s2]) translate([s1*10,0,15]) sphere(s1*3); 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/OpenSCAD_Figure4-12e.scad: -------------------------------------------------------------------------------- 1 | 2 | difference() { 3 | cylinder(r=100, h=10, center=true); 4 | translate([0,0,8]) cylinder(r=90, h=10, center=true); 5 | for(angle=[0:10:350]) { 6 | rotate(angle) translate([106,0,0]) cylinder(r=10, h=12, center=true); 7 | } 8 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/OpenSCAD_Figure4-12f.scad: -------------------------------------------------------------------------------- 1 | 2 | for(s1=[0:90:270]){ 3 | rotate([0,0,s1]) translate([0, -110, 0]) 4 | for(s2=[0:5:100]){ 5 | translate([0,s2,s2]) cube([20,5,5], center=true); 6 | } 7 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12a.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12b.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12c.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12d.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12e.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Design-Time/screenshots/OpenSCAD_Figure4-12f.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-1.scad: -------------------------------------------------------------------------------- 1 | cube([5, 10, 20]); 2 | 3 | //sphere(5); 4 | 5 | /* 6 | cylinder(h=5, r1=10, r2=10); 7 | cube([50, 50, 50]); 8 | */ -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-10.scad: -------------------------------------------------------------------------------- 1 | num_rows = 10; 2 | num_cols = 6; 3 | 4 | building_width = num_cols*5; 5 | building_height = num_rows*6; 6 | 7 | difference() { 8 | cube([building_width, 10, building_height]); 9 | 10 | for (z = [1:1:num_rows]) { 11 | for (x = [0:1:num_cols-1]) { 12 | x_pos = x*5+1; 13 | z_pos = z*5; 14 | translate([x_pos, -1, z_pos]) cube([3, 3, 4]); 15 | } //x loop 16 | } //z loop 17 | } //difference -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-11.scad: -------------------------------------------------------------------------------- 1 | for (r = [0:15:255]) { 2 | for (g = [0:15:255]) { 3 | for (b = [0:15:255]) { 4 | translate([r, g, b]) color([r/255, g/255, b/255]) cube(5); 5 | } //b loop 6 | } //g loop 7 | } //r loop -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-2.scad: -------------------------------------------------------------------------------- 1 | translate([10, 30, 0]) cylinder(h=4, r1=4, r2=4); 2 | translate([20, 30, 0]) cylinder(h=4, r1=4, r2=4); 3 | translate([30, 30, 0]) cylinder(h=4, r1=4, r2=4); 4 | translate([40, 30, 0]) cylinder(h=4, r1=4, r2=4); 5 | translate([50, 30, 0]) cylinder(h=4, r1=4, r2=4); 6 | translate([60, 30, 0]) cylinder(h=4, r1=4, r2=4); 7 | translate([70, 30, 0]) cylinder(h=4, r1=4, r2=4); 8 | translate([80, 30, 0]) cylinder(h=4, r1=4, r2=4); 9 | translate([90, 30, 0]) cylinder(h=4, r1=4, r2=4); 10 | translate([100, 30, 0]) cylinder(h=4, r1=4, r2=4); -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-2b.scad: -------------------------------------------------------------------------------- 1 | for (x_position = [10:10:100]) { 2 | translate([x_position, 30, 0]) cylinder(h=4, r1=4, r2=4); 3 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-3.scad: -------------------------------------------------------------------------------- 1 | for (angle=[0:45:315]) { 2 | rotate([0, 0, angle]) translate([10, 0, 0]) cylinder(h=5, r1=2, r2=0); 3 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-6.scad: -------------------------------------------------------------------------------- 1 | for (faces=[3:1:15]) { 2 | $fn = faces; 3 | x_position = faces*10; 4 | translate([x_position, 0, 0]) sphere(r=5); 5 | echo("faces:", faces, "x-position:", x_position); 6 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-8.scad: -------------------------------------------------------------------------------- 1 | for (x=[1:1:10]) { 2 | height = x*x; 3 | x_position = 5*x; 4 | translate([x_position, 0, 0]) cylinder(h=height, r1=2, r2=2); 5 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/OpenSCAD_Figure4-9.scad: -------------------------------------------------------------------------------- 1 | for (y_pos = [10:10:50]) { 2 | for (x_pos = [10:10:100]) { 3 | translate([x_pos, y_pos, 0]) cylinder(h=4, r1=4, r2=4); 4 | echo("x:", x_pos, "y:", y_pos); 5 | } //x_pos loop 6 | } //y_pos loop -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-1.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-10.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-11.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-2.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-2b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-2b.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-3.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-6.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-8.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Examples/screenshots/OpenSCAD_Figure4-9.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Figures/OpenSCAD_Figure4-4.scad: -------------------------------------------------------------------------------- 1 | for (x_position = [10:10:100]) { 2 | translate([x_position, 30, 0]) cylinder(h=4, r1=4, r2=4); 3 | echo("x:", x_position); //a good way to check your mental math 4 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Figures/OpenSCAD_Figure4-5.scad: -------------------------------------------------------------------------------- 1 | value1 = 10; 2 | value2 = 3; 3 | 4 | sum = value1 + value2; 5 | difference = value1 - value2; 6 | product = value1 * value2; 7 | quotient = value1 / value2; 8 | remainder = value1 % value2; 9 | 10 | echo("Addition:", sum); 11 | echo("Subtraction:", difference); 12 | echo("Multiplication:", product); 13 | echo("Division:", quotient); 14 | echo("Modulo:", remainder); -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Figures/OpenSCAD_Figure4-7.scad: -------------------------------------------------------------------------------- 1 | for (faces=[3:1:15]) { 2 | $fn = faces; 3 | x_position = faces*10; 4 | translate([x_position, 0, 0]) sphere(r=5); 5 | echo("faces:", faces, "x-position:", x_position); 6 | } -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Figures/figures/OpenSCAD_Figure4-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Figures/figures/OpenSCAD_Figure4-4.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Figures/figures/OpenSCAD_Figure4-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Figures/figures/OpenSCAD_Figure4-5.png -------------------------------------------------------------------------------- /4_Using-Loops-And-Variables/Figures/figures/OpenSCAD_Figure4-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/4_Using-Loops-And-Variables/Figures/figures/OpenSCAD_Figure4-7.png -------------------------------------------------------------------------------- /5_Modules/Big-Projects/OpenSCAD_Figure5-10.scad: -------------------------------------------------------------------------------- 1 | building(20, 30, 60, 5, 4, true); 2 | translate([0,40,0]) building(30, 20, 50, 2, 3, true); 3 | translate([0,70,0]) building(50, 40, 80, 10, 4, true); 4 | 5 | module building(b_width, b_length, b_height, window_cols, window_rows, doors){ 6 | windows(b_width/2, b_length, b_height,window_cols, window_rows ); 7 | mirror([1,0,0]) windows(b_width/2, b_length, b_height, window_cols, window_rows); 8 | }//building 9 | 10 | module windows(b_width, b_length, b_height, window_cols, window_rows){ 11 | 12 | w_length = b_length/(2*window_cols+1); 13 | w_height = b_height/(2*window_rows+1); 14 | 15 | difference(){ 16 | cube([b_width, b_length, b_height]); 17 | 18 | for(z=[w_height:2*w_height:b_height-w_height]){ 19 | for(y=[ w_length : 2* w_length : b_length-w_length]){ 20 | translate([b_width-1,y,z]) cube([2, w_length , w_height]); 21 | } 22 | }//windows 23 | }//difference 24 | }//facade -------------------------------------------------------------------------------- /5_Modules/Big-Projects/OpenSCAD_Figure5-11.scad: -------------------------------------------------------------------------------- 1 | translate([20,-20,0]) Bend_Lego(3); 2 | translate([20,0,0]) Bend_Lego(4); 3 | translate([20,20,0]) Bend_Lego(5); 4 | 5 | translate([40,-20,0]) Wall_Lego(3); 6 | translate([40,0,0]) Wall_Lego(4); 7 | translate([40,20,0]) Wall_Lego(5); 8 | 9 | translate([60,-16,0]) rotate([90,0,0]) Double_Sided_Lego(3); 10 | translate([60,4,0]) rotate([90,0,0]) Double_Sided_Lego(4); 11 | translate([60,24,0]) rotate([90,0,0]) Double_Sided_Lego(5); 12 | 13 | 14 | module Lego(DotsPerRow){ 15 | 16 | DotEnd=2+(DotsPerRow-1)*3; 17 | length=DotEnd+2; 18 | 19 | cube ([length,7,4]); 20 | for(Xposition=[2: 3: DotEnd]){ 21 | translate ([Xposition,2,0]) cylinder(h=5, r=1, $fn=20); 22 | translate ([Xposition,5,0]) cylinder(h=5, r=1, $fn=20); 23 | } 24 | } 25 | 26 | 27 | module Bend_Lego(DotsPerRow){ 28 | DotEnd=2+(DotsPerRow-1)*3; 29 | length=DotEnd+2; 30 | 31 | Lego(DotsPerRow); 32 | translate([length,0,0]) rotate([0,0,90]) Lego(DotsPerRow); 33 | } 34 | 35 | module Wall_Lego(DotsPerRow){ 36 | 37 | DotEnd=2+(DotsPerRow-1)*3; 38 | length=DotEnd+2; 39 | 40 | Lego(DotsPerRow); 41 | 42 | rotate([90,0,0])Lego(DotsPerRow); 43 | } 44 | module Double_Sided_Lego(DotsPerRow){ 45 | Lego(DotsPerRow); 46 | translate([0,7,4])rotate([-180,0,0])Lego(DotsPerRow); 47 | } -------------------------------------------------------------------------------- /5_Modules/Big-Projects/screenshots/OpenSCAD_Figure5-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Big-Projects/screenshots/OpenSCAD_Figure5-10.png -------------------------------------------------------------------------------- /5_Modules/Big-Projects/screenshots/OpenSCAD_Figure5-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Big-Projects/screenshots/OpenSCAD_Figure5-11.png -------------------------------------------------------------------------------- /5_Modules/Design-Time/OpenSCAD_Figure5-9a.scad: -------------------------------------------------------------------------------- 1 | module Ring(hole_diameter, thickness, height){ 2 | $fn=64; 3 | difference(){ 4 | cylinder(h=height, d=hole_diameter+thickness, center=true); 5 | cylinder(h=height+1, d=hole_diameter, center=true); 6 | } 7 | } 8 | 9 | Ring(26, 4, 4); -------------------------------------------------------------------------------- /5_Modules/Design-Time/OpenSCAD_Figure5-9b.scad: -------------------------------------------------------------------------------- 1 | // Diameter of each of the towers 2 | diameter = 80; // [30:5:100] 3 | // Height of the first tower 4 | height1 = 30; // [30:10:200] 5 | // Height of the second tower 6 | height2 = 50; // [30:10:200] 7 | // Height of the third tower 8 | height3 = 100; // [30:10:200] 9 | 10 | PencilHolder(height1, height2, height3); 11 | 12 | module Container(height) { 13 | $fn=64; 14 | difference() { 15 | cylinder(h=height, d=diameter); 16 | translate([0, 0, 2]) cylinder(h=height, d=diameter-4); 17 | } 18 | } 19 | 20 | module PencilHolder(height1 = 100, height2 = 50, height3 = 30) { 21 | Container(height1); 22 | translate([diameter-1,0,0]) Container(height2); 23 | translate([(diameter-1)/2,(diameter-1)*sin(60),0]) Container(height3); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /5_Modules/Design-Time/OpenSCAD_Figure5-9c.scad: -------------------------------------------------------------------------------- 1 | // Symbol to use 2 | letter = "A"; 3 | // Diameter of the pencil 4 | diameter = 10; // [5:1:15] 5 | 6 | $fn=32; 7 | 8 | PenCap(letter, diameter); 9 | 10 | module PenCap(letter="A", diameter=8) { 11 | difference() { 12 | cylinder(h=30, d=diameter+2); 13 | translate([0,0,-2]) cylinder(h=30, d=diameter); 14 | } 15 | translate([-9,1.5,28]) rotate([90,0,0]) { 16 | translate([9,9,0]) cylinder(h=3, d=20); 17 | color("Blue") translate([9,4,1]) { 18 | linear_extrude(3) text(letter, size=13, halign="center"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /5_Modules/Design-Time/OpenSCAD_Figure5-9d.scad: -------------------------------------------------------------------------------- 1 | module Keychain(name, length, width, height) { 2 | 3 | linear_extrude(height=height) 4 | translate([length/2, width/2]) 5 | resize([length, width]) 6 | text(name,font="Chalkboard", halign="center", valign="center"); 7 | 8 | difference() { 9 | union() { 10 | translate([-width/2,0,0]) cube([1.5*length,width,.5*height]); 11 | translate([-width/2,width/2,0]) cylinder(d=width, h=.5*height); 12 | } 13 | translate([-width/2,width/2,0]) cylinder(h=height+1, d=width/2, center=true); 14 | } 15 | } 16 | 17 | Keychain("name tag", 40,20,4); 18 | -------------------------------------------------------------------------------- /5_Modules/Design-Time/OpenSCAD_Figure5-9e.scad: -------------------------------------------------------------------------------- 1 | width = 8; 2 | holeSize = 2; 3 | thickness = 3; 4 | 5 | module RawHook(width, height, thickness) { 6 | translate([0,0,-width/2]) linear_extrude(width, convexity=2) { 7 | difference() { 8 | union() { 9 | square([thickness, height]); 10 | square([thickness+4+2, 5]); 11 | } 12 | translate([thickness,3]) square([4,10]); 13 | } 14 | } 15 | } 16 | 17 | module Hole(holeSize) { 18 | translate([1,0,0]) rotate([0,90,180]) { 19 | $fn=32; 20 | cylinder(h=8, d=holeSize); 21 | cylinder(h=tan(89.9/2)*holeSize*2, d1=holeSize*2, d2=0); 22 | } 23 | } 24 | 25 | module Hook(width=8, holeSize=2, thickness=3) { 26 | height = width * 3; 27 | difference() { 28 | RawHook(width, height, thickness); 29 | translate([thickness,height*3/4,0]) Hole(holeSize); 30 | translate([thickness,height*1/2,0]) Hole(holeSize); 31 | } 32 | } 33 | 34 | 35 | rotate([90,0,-90]) Hook(width, holeSize, thickness); 36 | 37 | -------------------------------------------------------------------------------- /5_Modules/Design-Time/OpenSCAD_Figure5-9f.scad: -------------------------------------------------------------------------------- 1 | // Inside length of the box 2 | innerLength=200; // [10:10:400] 3 | // Inside width of the box 4 | innerWidth=150; // [10:10:200] 5 | // Inside height of the box 6 | innerHeight=80; // [30:10:200] 7 | // Wall thickness 8 | wallThickness=5; // [1,2,3,4,5] 9 | 10 | Box(innerLength, innerWidth, innerHeight); 11 | 12 | module Box(innerLength, innerWidth, innerHeight) { 13 | difference() { 14 | cube([innerLength + 2*wallThickness, 15 | innerWidth + 2*wallThickness, 16 | innerHeight]); 17 | translate([wallThickness, wallThickness, wallThickness]) cube([innerLength, innerWidth, innerHeight]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9a.png -------------------------------------------------------------------------------- /5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9b.png -------------------------------------------------------------------------------- /5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9c.png -------------------------------------------------------------------------------- /5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9d.png -------------------------------------------------------------------------------- /5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9e.png -------------------------------------------------------------------------------- /5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Design-Time/screenshots/OpenSCAD_Figure5-9f.png -------------------------------------------------------------------------------- /5_Modules/Examples/LEGO-standin.scad: -------------------------------------------------------------------------------- 1 | LEGObrick(); 2 | 3 | module LEGObrick(studs_per_row=3) { 4 | cube([23.9, 16, 9.5]); 5 | } 6 | 7 | -------------------------------------------------------------------------------- /5_Modules/Examples/LEGObrick.scad: -------------------------------------------------------------------------------- 1 | LEGObrick(); 2 | 3 | module LEGObrick(studs_per_row=4) { 4 | $fn=30; 5 | 6 | width = studs_per_row * 8; 7 | 8 | cube([width-0.1, 16, 9.5]); 9 | 10 | for (x_position=[4 : 8 : width-4]) { 11 | translate([x_position, 4, 1.7]) cylinder(h=9.6, d=4.8); 12 | translate([x_position, 12, 1.7]) cylinder(h=9.6, d=4.8); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /5_Modules/Examples/OpenSCAD_Figure5-1.scad: -------------------------------------------------------------------------------- 1 | linear_extrude(30) { 2 | difference() { 3 | union() { 4 | square([100, 30], center=true); 5 | square([30, 100], center=true); 6 | } 7 | offset(-2) { 8 | square([100, 30], center=true); 9 | square([30, 100], center=true); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /5_Modules/Examples/OpenSCAD_Figure5-2.scad: -------------------------------------------------------------------------------- 1 | module cross(width=30, length=100) { 2 | square([length, width], center=true); 3 | square([width, length], center=true); 4 | } 5 | 6 | linear_extrude(30) { 7 | difference() { 8 | cross(40, 80); 9 | offset(-2) cross(40, 80); 10 | } 11 | } 12 | 13 | translate([100,0,0])linear_extrude(30) { 14 | difference() { 15 | cross(10, 80); 16 | offset(-2) cross(10, 80); 17 | } 18 | } 19 | 20 | translate([100,100,0])linear_extrude(30) { 21 | difference() { 22 | cross(30, 50); 23 | offset(-2) cross(30, 50); 24 | } 25 | } 26 | 27 | translate([0,100,0])linear_extrude(30) { 28 | difference() { 29 | cross(100, 80); 30 | offset(-2) cross(100, 80); 31 | } 32 | } -------------------------------------------------------------------------------- /5_Modules/Examples/OpenSCAD_Figure5-3.scad: -------------------------------------------------------------------------------- 1 | module LEGO(studs_per_row=4) { 2 | $fn=30; 3 | 4 | length = studs_per_row * 8; 5 | 6 | cube([length, 16, 9.6]); 7 | 8 | for (x_position=[4 : 8 : length-4]) { 9 | translate([x_position, 4, 1.7]) cylinder(h=9.6, d=4.8); 10 | translate([x_position, 12, 1.7]) cylinder(h=9.6, d=4.8); 11 | } 12 | } 13 | 14 | LEGO(4); 15 | 16 | 17 | -------------------------------------------------------------------------------- /5_Modules/Examples/OpenSCAD_Figure5-5.scad: -------------------------------------------------------------------------------- 1 | use 2 | 3 | for (n=[0:1:5]) 4 | translate([0,20*n,0]) LEGObrick(n+1); 5 | 6 | -------------------------------------------------------------------------------- /5_Modules/Examples/OpenSCAD_Figure5-6.scad: -------------------------------------------------------------------------------- 1 | LEGObrick(); 2 | 3 | module LEGObrick(studs_per_row=3) { 4 | cube([24, 16, 9.6]); 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /5_Modules/Examples/OpenSCAD_Figure5-7.scad: -------------------------------------------------------------------------------- 1 | use 2 | 3 | for (Xposition = [0: 24: 100]) { 4 | translate ([Xposition, 2, 0]) LEGObrick(); 5 | } 6 | 7 | for (Xposition = [16: 24: 100]) { 8 | translate ([Xposition, 2, 9.6]) LEGObrick(); 9 | } 10 | 11 | for (Xposition = [0: 24: 100]){ 12 | translate ([Xposition, 2, 2*9.6]) LEGObrick(); 13 | } 14 | 15 | for (Xposition = [16: 24: 100]) { 16 | translate ([Xposition, 2, 3*9.6]) LEGObrick(); 17 | } 18 | -------------------------------------------------------------------------------- /5_Modules/Examples/OpenSCAD_Figure5-8.scad: -------------------------------------------------------------------------------- 1 | use ; 2 | 3 | for (Xposition = [0: 24: 100]) { 4 | translate ([Xposition, 2, 0]) LEGObrick(3); 5 | } 6 | 7 | for (Xposition = [16: 24: 100]) { 8 | translate ([Xposition, 2, 9.6]) LEGObrick(3); 9 | } 10 | 11 | for (Xposition = [0: 24: 100]){ 12 | translate ([Xposition, 2, 2*9.6]) LEGObrick(3); 13 | } 14 | 15 | for (Xposition = [16: 24: 100]) { 16 | translate ([Xposition, 2, 3*9.6]) LEGObrick(3); 17 | } 18 | -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/LEGObrick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/LEGObrick.png -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/OpenSCAD_Figure5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/OpenSCAD_Figure5-1.png -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/OpenSCAD_Figure5-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/OpenSCAD_Figure5-2.png -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/OpenSCAD_Figure5-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/OpenSCAD_Figure5-3.png -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/OpenSCAD_Figure5-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/OpenSCAD_Figure5-5.png -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/OpenSCAD_Figure5-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/OpenSCAD_Figure5-6.png -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/OpenSCAD_Figure5-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/OpenSCAD_Figure5-7.png -------------------------------------------------------------------------------- /5_Modules/Examples/screenshots/OpenSCAD_Figure5-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/5_Modules/Examples/screenshots/OpenSCAD_Figure5-8.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Big-Projects/OpenSCAD_Figure6-7.scad: -------------------------------------------------------------------------------- 1 | $fn=100; 2 | 3 | for(x=[0:10:100]){ 4 | for(y=[0:10:100]){ 5 | type = rands(0,1,1)[0]; 6 | h = rands(3,20,1)[0]; 7 | w = rands(1,8,1)[0]; 8 | if (type < .4){ 9 | translate([x,y,0]) bush(h/4); 10 | } 11 | else if (type <.8) translate([x,y,0]) fir_tree(h,w); 12 | } 13 | } 14 | 15 | translate([-5,-5,-2]) cube([110, 110, 2]); 16 | 17 | module fir_tree(height, width){ 18 | trunk_height= height*.3; 19 | translate([0,0,height/2+trunk_height])cylinder(h=height, r1=width/2, r2 = 0, center=true); 20 | translate([0,0,trunk_height/2]) cylinder(h=trunk_height, r1=width/5, r2=width/5, center=true); 21 | } 22 | 23 | module bush(radius){ 24 | trunk_height= radius*.3; 25 | translate([0,0,1.2*radius])sphere(radius); 26 | translate([0,0,trunk_height/2]) cylinder(h=trunk_height, r1=radius/3, r2=radius/3, center=true); 27 | } -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Big-Projects/OpenSCAD_Figure6-8.scad: -------------------------------------------------------------------------------- 1 | $fn = 100; 2 | 3 | difference() { 4 | union() { 5 | cylinder(h=19, r=100); 6 | 7 | translate([83, 0, 1]) hour(12, 20); 8 | translate([-83, 0, 1]) hour(6, 20); 9 | translate([0, -83, 1]) hour(3, 20); 10 | translate([0, 83, 1]) hour(9, 20); 11 | 12 | for (time = [1:1:12]) { 13 | 14 | if (time%3 != 0) { 15 | if (time>=4 && time<=8) { 16 | rotate([0, 0, 360 - 30*time]) 17 | translate([77, 0, 1]) 18 | rotate([0, 0, 180]) 19 | hour(time, 12); 20 | } else { 21 | rotate([0, 0, 360 - 30*time]) translate([77, 0, 1]) hour(time, 12); 22 | rotate([0, 0, 360 - 30*time]) translate([60, 0, 18]) sphere(5); 23 | } 24 | } 25 | else{ 26 | rotate([0, 0, 360 - 30*time]) translate([60, 0, 18]) sphere(3); 27 | } 28 | 29 | rotate([0, 0, 30*time - 15]) translate([40, 0, 12]) cube([50, 2, 19], center=true); 30 | } 31 | } //union 32 | 33 | 34 | translate([0,0,-2]) cylinder(h=25, d=15); 35 | } 36 | 37 | module hour(number, point_size) { 38 | rotate([0, 0, -90]) 39 | linear_extrude(height = 22) 40 | text(str(number), font="Osaka", size = point_size, halign="center", valign="center"); 41 | } 42 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Big-Projects/OpenSCAD_Figure6-9.scad: -------------------------------------------------------------------------------- 1 | use <../Examples/skyscraper.scad> 2 | 3 | for(x=[0:1:4]){ 4 | translate([x*225,0,0]) union(){ 5 | street(75, 500, true); 6 | translate([0,500+75,0]) street(75, 500, false); 7 | } 8 | } 9 | 10 | module street(road_width, road_length, intersection){ 11 | block(floor(rands(4,10,1)[0]), road_width, road_length); 12 | translate([road_width*2, 0,0]) block(floor(rands(4,10,1)[0]), road_width, road_length); 13 | translate([-.5*road_width,0,0]) cube([road_width*3, road_length, 5]); 14 | if(intersection==true) 15 | translate([-.5*75,500,0])cube([225, 75, 5]); 16 | } 17 | 18 | module block(num_buildings, curb_width, block_length){ 19 | b_length = block_length/num_buildings; 20 | for(n=[0:1:num_buildings-1]){ 21 | translate([0,n*b_length,4]) 22 | skyscraper(floor( rands(10,curb_width*.8,1)[0]), floor( rands(30,b_length,1)[0]), floor( rands(60,200,1)[0]), floor( rands(2,4,1)[0]), floor( rands(3,6,1)[0])); 23 | } 24 | 25 | translate([-curb_width/2,0,5]) cube([curb_width, num_buildings*b_length, 5]); 26 | } 27 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Big-Projects/screenshots/OpenSCAD_Figure6-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Big-Projects/screenshots/OpenSCAD_Figure6-7.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Big-Projects/screenshots/OpenSCAD_Figure6-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Big-Projects/screenshots/OpenSCAD_Figure6-8.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Big-Projects/screenshots/OpenSCAD_Figure6-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Big-Projects/screenshots/OpenSCAD_Figure6-9.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/OpenSCAD_Figure6-6a.scad: -------------------------------------------------------------------------------- 1 | 2 | for(i=[0:1:10]){ 3 | if(i%2==0) 4 | translate([i*10,0,0]) rotate([0,-180,0]) cylinder(h=10, r1=5, r2=0); 5 | else 6 | translate([i*10,0,0]) cylinder(h=10, r1=5, r2=0); 7 | } -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/OpenSCAD_Figure6-6b.scad: -------------------------------------------------------------------------------- 1 | b_height=40; 2 | b_width=120; 3 | b_length=50; 4 | mortar=10; 5 | 6 | for ( z = [0: 1: 10]){ 7 | for ( x = [0: 1: 8]){ 8 | if(z%2==0){ 9 | translate ([x*(b_width+mortar),0,z*(b_height+mortar)]) 10 | cube([b_width, b_length, b_height]); 11 | } 12 | else{ 13 | translate ([x*(b_width+mortar)-.5*b_width,0,z*(b_height+mortar)]) 14 | cube([b_width, b_length, b_height]); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/OpenSCAD_Figure6-6c.scad: -------------------------------------------------------------------------------- 1 | for(angle=[0:20:360]){ 2 | difference(){ 3 | if(angle%30==0){ 4 | rotate([0,angle,0])translate([40,0,0])sphere(5, $fn=100); 5 | }else{ 6 | rotate([0,angle,0])translate([40,0,0])sphere(3, $fn=100); 7 | } 8 | } 9 | }//angle -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/OpenSCAD_Figure6-6d.scad: -------------------------------------------------------------------------------- 1 | for(x=[0:1:16]){ 2 | for(y=[0:1:16]){ 3 | if(x<4 && y%2==0) 4 | translate([x*10,y*10,0]) cylinder(h=10, r1=3, r2=3); 5 | else if(x>4 && y%4 == 0) 6 | translate([x*10,y*10,0]) cylinder(h=10, r1=2, r2=2); 7 | else 8 | translate([x*10,y*10,0]) cylinder(h=10, r1=5, r2=5); 9 | } 10 | } -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/OpenSCAD_Figure6-6e.scad: -------------------------------------------------------------------------------- 1 | module Hole_Lego(DotsPerRow){ 2 | 3 | DotEnd=2+(DotsPerRow-1)*3; 4 | length=DotEnd+2; 5 | 6 | difference(){ 7 | union(){ 8 | cube ([length,length,4]); 9 | for(Xposition=[2: 3: DotEnd]){ 10 | for(Yposition=[2: 3: DotEnd]){ 11 | translate ([Xposition,Yposition,0]) cylinder(h=5, r=1, $fn=16); 12 | } 13 | } 14 | } 15 | 16 | if(DotsPerRow>2) 17 | translate([length/2,length/2,2])cube([length-7,length-7,7], center=true); 18 | } 19 | } 20 | 21 | for(size=[1:1:4]){ 22 | translate([(size)*(1.5*size),0,0]) Hole_Lego(size); 23 | } 24 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/OpenSCAD_Figure6-6f.scad: -------------------------------------------------------------------------------- 1 | use <../Examples/skyscraper.scad> 2 | 3 | street(100, 75, 500); 4 | 5 | 6 | module street(r_width, curb_width, s_length){ 7 | 8 | num_buildings = floor(rands(5,10,1)[0]); 9 | translate([curb_width/2,0,5]) 10 | block(num_buildings, s_length/(num_buildings), curb_width); 11 | 12 | difference(){ 13 | cube([r_width+2*curb_width, s_length, 10]); 14 | translate([curb_width,0,6]) cube([r_width, s_length, 5]); 15 | } 16 | 17 | num_buildings2 = floor(rands(5,10,1)[0]); 18 | translate([curb_width+r_width+curb_width/2,0,5]) 19 | block(num_buildings, s_length/(num_buildings), curb_width); 20 | } 21 | 22 | module block(num_buildings, b_length, curb_width){ 23 | for(n=[0:1:num_buildings-1]){ 24 | translate([0,n*b_length,0]) 25 | skyscraper(floor( rands(10,curb_width-20,1)[0]), floor( rands(30,b_length,1)[0]), floor( rands(60,200,1)[0]), floor( rands(2,6,1)[0]), floor( rands(3,10,1)[0])); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6a.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6b.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6c.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6d.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6e.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Design-Time/screenshots/OpenSCAD_Figure6-6f.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/OpenSCAD_Figure6-1.scad: -------------------------------------------------------------------------------- 1 | num_rows = 10; 2 | num_col = 6; 3 | 4 | building_width = num_col * 5; 5 | building_height = num_rows * 6; 6 | 7 | difference() { 8 | cube([building_width, 10, building_height]); 9 | 10 | for (z = [1:1:num_rows]) { 11 | for (x = [0:1:num_col-1]) { 12 | if (z == 1) { 13 | translate([x*5+1, -1, -1]) cube([3, 3, 8]); // door 14 | } 15 | else { 16 | translate([x*5+1, -1, z*5]) cube([3, 3, 4]); // window 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/OpenSCAD_Figure6-2.scad: -------------------------------------------------------------------------------- 1 | ruler(5); 2 | 3 | module ruler(inches) { 4 | gap_size = 1; // 1 unit per quarter inch 5 | total_marks = 4 * inches; // inch, half-inch, quarter-inch 6 | 7 | width = gap_size * total_marks; 8 | length = 4 * gap_size; 9 | height = 0.5 * gap_size; 10 | 11 | mark_width = 0.25 * gap_size; 12 | mark_height = 1.5 * height; 13 | 14 | // main ruler body 15 | difference() { 16 | cube([width, length, height]); 17 | translate([width-gap_size, length-gap_size, -0.5]) 18 | cylinder(h=height+1, r=0.15*length, $fn=20); 19 | } 20 | 21 | // tick marks 22 | for(t = [1:1:total_marks-1]) { 23 | mark_x = gap_size * t - 0.5 * mark_width; 24 | 25 | if (t%4 == 0) { // inch marks and number labels 26 | translate([gap_size * t, 0.65 * length, 0]) 27 | linear_extrude(mark_height) 28 | text(str(t/4), size=gap_size, halign="center"); 29 | translate([mark_x, 0, 0]) 30 | cube([mark_width, 0.5 * length, mark_height]); 31 | } 32 | else if (t%2 == 0) { // half-inch marks 33 | translate([mark_x, 0, 0]) 34 | cube([0.75 * mark_width, 0.25 * length, mark_height]); 35 | } 36 | else { // quarter-inch marks 37 | translate([mark_x, 0, 0]) 38 | cube([0.5 * mark_width, 0.125 * length, mark_height]); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/OpenSCAD_Figure6-3.scad: -------------------------------------------------------------------------------- 1 | $fn = 100; 2 | mode = "print"; // or "design" 3 | 4 | cube([200, 60, 10], center=true); 5 | 6 | for (x = [-60:60:60]) { 7 | translate([x, 0, 5]) cylinder(h=70, r=4); 8 | } 9 | 10 | if (mode == "design") { 11 | for (d = [2:1:7]) { 12 | translate([-60, 0, 10 + (7-d)*10]) disc(d*4, 5); 13 | } 14 | } 15 | else if (mode == "print") { 16 | for (d = [2:1:7]) { 17 | if (d > 4) { 18 | translate([60*d - 350, 60, 0]) disc(d*4, 5); 19 | } 20 | else { 21 | translate([60*d - 200, 100, 0]) disc(d*4, 5); 22 | } 23 | } 24 | } 25 | 26 | module disc(disc_radius, hole_radius) { 27 | difference() { 28 | cylinder(h=10, r=disc_radius, center=true); 29 | cylinder(h=11, r=hole_radius, center=true); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/OpenSCAD_Figure6-4.scad: -------------------------------------------------------------------------------- 1 | num_rows = 10; 2 | num_col = 6; 3 | 4 | building_width = num_col * 5; 5 | building_height = num_rows * 6; 6 | 7 | difference() { 8 | cube([building_width, 10, building_height]); 9 | 10 | for (z = [1:1:num_rows]) { 11 | for (x = [0:1:num_col-1]) { 12 | if (z == 1) { 13 | translate([x*5 + 1, -1, -1]) cube([3, 3, 8]); 14 | } 15 | else { 16 | translate([x*5 + 1, -1, z*5]) cube([3, 3, 4]); 17 | } 18 | } 19 | } 20 | } 21 | 22 | draw_tower = rands(0, 1, 1); 23 | 24 | if (draw_tower[0] < 0.5) { 25 | translate([building_width/6, 5, building_height]) 26 | watertower(building_width/4); 27 | } 28 | 29 | module watertower(width) { 30 | $fn = 20; 31 | cylinder(h=5, r=width/2); 32 | translate([0, 0, 5]) cylinder(h=5, r1=width/2, r2=0); 33 | } 34 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/OpenSCAD_Figure6-5.scad: -------------------------------------------------------------------------------- 1 | use 2 | 3 | num_buildings = 5; 4 | 5 | width_list = rands(10, 30, num_buildings); 6 | length_list = rands(20, 30, num_buildings); 7 | height_list = rands(20, 100, num_buildings); 8 | 9 | window_row_list = rands(2.5, 10.49, num_buildings); 10 | window_col_list = rands(2.5, 10.49, num_buildings); 11 | 12 | watertower_list = rands(0, 1, num_buildings); 13 | 14 | for (n=[0:1:num_buildings-1]) { 15 | width = width_list[n]; 16 | length = length_list[n]; 17 | height = height_list[n]; 18 | 19 | window_rows = round(window_row_list[n]); 20 | window_cols = round(window_col_list[n]); 21 | 22 | watertower = round(watertower_list[n]); 23 | 24 | translate([0, n*30, 0]) { 25 | skyscraper(width, length, height, window_rows, window_cols, watertower); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-1.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-2.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-3.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-4.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Examples/screenshots/OpenSCAD_Figure6-5.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/screenshots/skyscraper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/6_Dynamic-Designs-With-If-Statements/Examples/screenshots/skyscraper.png -------------------------------------------------------------------------------- /6_Dynamic-Designs-With-If-Statements/Examples/skyscraper.scad: -------------------------------------------------------------------------------- 1 | skyscraper(20, 30, 60, 5, 4, 1); 2 | 3 | module skyscraper(b_width, b_length, b_height, window_cols, window_rows, watertower) { 4 | windows(b_width/2, b_length, b_height, window_cols, window_rows); 5 | mirror([1,0,0]) windows(b_width/2, b_length, b_height, window_cols, window_rows); 6 | 7 | if (watertower) { 8 | translate([b_width/6, 5, b_height]) watertower(b_width/4); 9 | } 10 | } // skyscraper 11 | 12 | module windows(b_width, b_length, b_height, window_cols, window_rows) { 13 | 14 | w_length = b_length/(2*window_cols+1); 15 | w_height = b_height/(2*window_rows+1); 16 | 17 | difference() { 18 | cube([b_width, b_length, b_height]); 19 | 20 | for (z = [0:1:window_rows-1]) { 21 | for (x = [0:1:window_cols-1]) { 22 | if (z == 0) { 23 | translate([b_width-1, (2*x+1)*w_length, 0]) cube([2, w_length , w_height*2]); 24 | } 25 | else { 26 | translate([b_width-1, (2*x+1)*w_length, (2*z+1)*w_height]) cube([2, w_length , w_height]); 27 | } 28 | } 29 | } // windows 30 | } // difference 31 | } // facade 32 | 33 | module watertower(width) { 34 | $fn = 20; 35 | cylinder(h=5, r1=width/2, r2=width/2); 36 | translate([0, 0, 5]) cylinder(h=5, r1=width/2, r2=0); 37 | } 38 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-10.scad: -------------------------------------------------------------------------------- 1 | include 2 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-11.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v3 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("grey") 22 | bottom_section(tower_width, bottom_height); 23 | color("lightgrey") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-12.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v4 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("grey") 22 | bottom_section(tower_width, bottom_height); 23 | color("lightgrey") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-13.scad: -------------------------------------------------------------------------------- 1 | include 2 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-14.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v5 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("grey") 22 | bottom_section(tower_width, bottom_height); 23 | color("lightgrey") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-15.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v5 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=100; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("white") 22 | bottom_section(tower_width, bottom_height); 23 | color("white") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-6.scad: -------------------------------------------------------------------------------- 1 | // tower.scad v1 2 | use 3 | use 4 | use 5 | 6 | tower_height = 100; 7 | tower_width = 0.3 * tower_height; 8 | bottom_height = 0.2 * tower_height; 9 | middle_height = 0.65 * tower_height; 10 | top_height = 0.15 * tower_height; 11 | 12 | base_width = 2 * tower_width; 13 | base_height = 0.1 * tower_width; 14 | 15 | lean_angle = 4; 16 | 17 | $fn = 20; 18 | 19 | rotate([lean_angle, 0, 0]) { 20 | color("grey") { 21 | bottom_section(tower_width, bottom_height); 22 | } 23 | color("lightgrey") { 24 | translate([0, 0, bottom_height]) 25 | middle_section(tower_width, middle_height); 26 | } 27 | color("white") { 28 | translate([0, 0, bottom_height + middle_height]) 29 | top_section(tower_width, top_height); 30 | } 31 | } 32 | 33 | color("lightgreen") { 34 | cube([base_width, base_width, base_height], center=true); 35 | } 36 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-7.scad: -------------------------------------------------------------------------------- 1 | // tower.scad v2 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height = 100; 8 | tower_width = 0.3 * tower_height; 9 | bottom_height = 0.2 * tower_height; 10 | middle_height = 0.65 * tower_height; 11 | top_height = 0.15 * tower_height; 12 | 13 | base_width = 2 * tower_width; 14 | base_height = 0.1 * tower_width; 15 | 16 | lean_angle = 4; 17 | 18 | $fn = 20; 19 | 20 | rotate([lean_angle, 0, 0]) { 21 | color("grey") { 22 | bottom_section(tower_width, bottom_height); 23 | } 24 | color("lightgrey") { 25 | translate([0, 0, bottom_height]) middle_section(tower_width, middle_height); 26 | } 27 | color("white") { 28 | translate([0, 0, bottom_height + middle_height]) top_section(tower_width, top_height); 29 | } 30 | } 31 | 32 | color("lightgreen") { 33 | cube([base_width, base_width, base_height], center=true); 34 | } 35 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-8.scad: -------------------------------------------------------------------------------- 1 | include 2 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/OpenSCAD_Figure7-9.scad: -------------------------------------------------------------------------------- 1 | include 2 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v1/bottom.scad: -------------------------------------------------------------------------------- 1 | //bottom.scad 2 | 3 | module bottom_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v1/middle.scad: -------------------------------------------------------------------------------- 1 | //middle.scad 2 | 3 | module middle_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v1/top.scad: -------------------------------------------------------------------------------- 1 | //top.scad 2 | 3 | module top_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v1/tower.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v1 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("white") 22 | bottom_section(tower_width, bottom_height); 23 | color("white") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v2/bottom.scad: -------------------------------------------------------------------------------- 1 | //bottom.scad v2 2 | 3 | module bottom_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v2/middle.scad: -------------------------------------------------------------------------------- 1 | //middle.scad v2 2 | 3 | color("white") level(50, 25); 4 | 5 | module middle_section(width, height){ 6 | level_height=height/6; 7 | level_radius=0.5*width; 8 | 9 | for(h=[0:1:5]){ 10 | floor_offset=h*level_height; 11 | 12 | translate([0,0,floor_offset]) 13 | level(level_radius, level_height); 14 | } 15 | } 16 | 17 | module level(level_radius, level_height){ 18 | lip_height= 0.1*level_height; 19 | inner_radius= 0.7*level_radius; 20 | overhang_height= 0.3*level_height; 21 | overhang_radius= 0.95*level_radius; 22 | 23 | //lip 24 | translate([0,0,level_height-lip_height]) 25 | cylinder(h=lip_height, r1=level_radius, r2=level_radius); 26 | 27 | //overhang 28 | translate([0,0,0.60*level_height]) 29 | cylinder(h=overhang_height,r1=overhang_radius, r2=overhang_radius); 30 | 31 | //inner structure 32 | cylinder(h=level_height, r1=inner_radius, r2=inner_radius); 33 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v2/top.scad: -------------------------------------------------------------------------------- 1 | //top.scad v2 2 | 3 | module top_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v2/tower.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v2 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("grey") 22 | bottom_section(tower_width, bottom_height); 23 | color("lightgrey") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v3/bottom.scad: -------------------------------------------------------------------------------- 1 | //bottom.scad v3 2 | 3 | module bottom_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v3/column.scad: -------------------------------------------------------------------------------- 1 | //column.scad v3 2 | 3 | color("white") column(100, 20); 4 | 5 | module column(height, width){ 6 | radius = 0.5*width; 7 | 8 | translate([-radius, -radius,0.95*height]) 9 | cube([2*radius,2*radius,.05*height]); 10 | cylinder(h=height, r1=radius, r2=radius); 11 | translate([-radius, -radius,0]) 12 | cube([2*radius,2*radius,.05*height]); 13 | } 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v3/middle.scad: -------------------------------------------------------------------------------- 1 | //middle.scad v3 2 | use 3 | 4 | color("white") level(50, 25); 5 | 6 | module middle_section(width, height){ 7 | level_height=height/6; 8 | level_radius=0.5*width; 9 | 10 | for(h=[0:1:5]){ 11 | floor_offset=h*level_height; 12 | 13 | translate([0,0,floor_offset]) 14 | level(level_radius, level_height); 15 | } 16 | } 17 | 18 | 19 | module level(level_radius, level_height){ 20 | lip_height= 0.1*level_height; 21 | inner_radius= 0.7*level_radius; 22 | overhang_height= 0.3*level_height; 23 | overhang_radius= 0.95*level_radius; 24 | 25 | num_cols=24; 26 | angle_size= 360/num_cols; 27 | 28 | col_height= 0.65*level_height; 29 | col_width= 0.2*col_height; 30 | 31 | arch_depth= 2*(level_radius-inner_radius); 32 | 33 | //lip 34 | translate([0,0,level_height-lip_height]) 35 | cylinder(h=lip_height, r1=level_radius, r2=level_radius); 36 | 37 | 38 | translate([0,0,0.65*level_height]) 39 | difference(){ 40 | //overhang 41 | cylinder(h=overhang_height,r1=overhang_radius, r2=overhang_radius); 42 | 43 | //arches 44 | for(angle=[angle_size/2:angle_size:360]){ 45 | rotate([0,0,angle]) 46 | translate([inner_radius,0,0]) 47 | rotate([0,90,0]) 48 | cylinder(h=arch_depth, r1=col_width,r2=col_width, center=true); 49 | } 50 | } 51 | 52 | //inner structure 53 | cylinder(h=level_height, r1=inner_radius, r2=inner_radius); 54 | 55 | //columns 56 | for(angle=[0:angle_size:360]){ 57 | rotate([0,0,angle]) 58 | translate([overhang_radius-0.5*col_width,0,0]) 59 | column(col_height, col_width); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v3/top.scad: -------------------------------------------------------------------------------- 1 | //top.scad v3 2 | 3 | module top_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v3/tower.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v3 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("grey") 22 | bottom_section(tower_width, bottom_height); 23 | color("lightgrey") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v4/bottom.scad: -------------------------------------------------------------------------------- 1 | //bottom.scad v4 2 | 3 | module bottom_section(width, height){ 4 | radius=0.5*width; 5 | cylinder(h=height, r1=radius, r2=radius); 6 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v4/column.scad: -------------------------------------------------------------------------------- 1 | //column.scad v4 2 | 3 | color("white") column(100, 20); 4 | 5 | module column(height, width){ 6 | radius = 0.5*width; 7 | 8 | translate([-radius, -radius,0.95*height]) 9 | cube([2*radius,2*radius,.05*height]); 10 | cylinder(h=height, r1=radius, r2=radius); 11 | translate([-radius, -radius,0]) 12 | cube([2*radius,2*radius,.05*height]); 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v4/middle.scad: -------------------------------------------------------------------------------- 1 | //middle.scad v4 2 | use 3 | 4 | 5 | module middle_section(width, height){ 6 | level_height=height/6; 7 | level_radius=0.5*width; 8 | 9 | for(h=[0:1:5]){ 10 | floor_offset=h*level_height; 11 | 12 | translate([0,0,floor_offset]) 13 | level(level_radius, level_height); 14 | } 15 | } 16 | 17 | 18 | module level(level_radius, level_height){ 19 | lip_height= 0.1*level_height; 20 | inner_radius= 0.7*level_radius; 21 | overhang_height= 0.3*level_height; 22 | overhang_radius= 0.95*level_radius; 23 | 24 | num_cols=24; 25 | angle_size= 360/num_cols; 26 | 27 | col_height= 0.65*level_height; 28 | col_width= 0.2*col_height; 29 | 30 | arch_depth= 2*(level_radius-inner_radius); 31 | 32 | //lip 33 | translate([0,0,level_height-lip_height]) 34 | cylinder(h=lip_height, r1=level_radius, r2=level_radius); 35 | 36 | 37 | translate([0,0,0.65*level_height]) 38 | difference(){ 39 | //overhang 40 | cylinder(h=overhang_height,r1=overhang_radius, r2=overhang_radius); 41 | 42 | //arches 43 | for(angle=[angle_size/2:angle_size:360]){ 44 | rotate([0,0,angle]) 45 | translate([inner_radius,0,0]) 46 | rotate([0,90,0]) 47 | cylinder(h=arch_depth, r1=col_width,r2=col_width, center=true); 48 | } 49 | } 50 | 51 | //inner structure 52 | cylinder(h=level_height, r1=inner_radius, r2=inner_radius); 53 | 54 | //columns 55 | for(angle=[0:angle_size:360]){ 56 | rotate([0,0,angle]) 57 | translate([overhang_radius-0.5*col_width,0,0]) 58 | column(col_height, col_width); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v4/top.scad: -------------------------------------------------------------------------------- 1 | //top.scad v4 2 | 3 | color("white") top_section(50, 30); 4 | 5 | 6 | module top_section(width, height){ 7 | radius= 0.4*width; 8 | col_width= 2; 9 | num_cols= 15; 10 | angle_width= 360/num_cols; 11 | archway_angle= 3*angle_width; 12 | 13 | //lip 14 | translate([0,0,.9*height]) 15 | cylinder(h=0.1*height, r1=1.1*radius, r2=1.1*radius); 16 | 17 | 18 | difference(){ 19 | cylinder(h=height, r1=radius, r2=radius); 20 | 21 | cylinder(h=2*height+1, r1=.75*radius, r2=.75*radius, center=true); 22 | for(angle=[0:angle_width:360]){ 23 | if(angle%archway_angle==0){ 24 | rotate([0,0,angle]) 25 | translate([radius-2,0,.25*height]) 26 | archway(.6*height, .35*height, .5*radius); 27 | }else if (angle%archway_angle==24){ 28 | rotate([0,0,angle+.5*angle_width]) 29 | translate([radius-2,0,.6*height]) 30 | archway(.25*height, .15*height, .5*radius); 31 | } 32 | } 33 | } 34 | 35 | translate([0,0,height]) 36 | fence(15, 3, radius,1); 37 | fence(20, 3, width/2, 1); 38 | } 39 | 40 | module fence(num_posts, fence_height, fence_radius, post_width){ 41 | angle_size= 360/num_posts; 42 | ring_height= 0.5; 43 | post_height= fence_height-ring_height; 44 | 45 | translate([0,0,post_height]) 46 | ring(fence_radius-post_width, fence_radius, ring_height); 47 | translate([0,0,post_height/2]) 48 | ring(fence_radius-post_width, fence_radius, ring_height); 49 | 50 | for(angle=[0:angle_size:360]){ 51 | rotate([0,0,angle]) 52 | translate([fence_radius-post_width/2,0,0]) 53 | cylinder(h=post_height, r1=post_width/2, r2=post_width/2); 54 | } 55 | } 56 | 57 | module ring(inner_radius, outer_radius, height){ 58 | difference(){ 59 | cylinder(h=height, r1=outer_radius, r2=outer_radius); 60 | translate([0,0,1]) 61 | cylinder(h=height+2, r1=inner_radius, r2=inner_radius, center=true); 62 | } 63 | } 64 | 65 | module archway(height, width, depth){ 66 | radius = width/2; 67 | 68 | rotate([90,0,-90]) 69 | union(){ 70 | translate([0,(height-radius)/2,-depth/2]) 71 | cylinder(h=depth, r1=radius,r2=radius); 72 | cube([width, height-radius, depth], center=true); 73 | } 74 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v4/tower.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v4 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("grey") 22 | bottom_section(tower_width, bottom_height); 23 | color("lightgrey") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v5/bottom.scad: -------------------------------------------------------------------------------- 1 | //bottom.scad v5 2 | 3 | use 4 | 5 | module bottom_section(width, height){ 6 | radius= 0.5*width; 7 | 8 | lip_height= 0.05*height; 9 | arches_height= 0.2*height; 10 | 11 | num_cols= 14; 12 | angle_size= 360/num_cols; 13 | col_height= height - arches_height; 14 | col_radius= 0.1*col_height; 15 | 16 | //lip 17 | translate([0,0,height-lip_height]) 18 | cylinder(h=lip_height, r1=1.05*radius,r2= 1.05*radius); 19 | 20 | //inner structure 21 | cylinder(h=height, r1=0.9*radius, r2=0.9*radius); 22 | 23 | 24 | //columns 25 | for(angle=[0:angle_size:360]){ 26 | rotate([0,0,angle]) 27 | translate([radius-col_radius/2,0,0]) 28 | column(col_height, col_radius); 29 | } 30 | 31 | //arches 32 | translate([0,0,col_height]) 33 | difference(){ 34 | cylinder(h=arches_height,r1=radius, r2=radius); 35 | 36 | for(angle=[angle_size/2:angle_size:360]){ 37 | rotate([0,0,angle]) 38 | translate([radius,0,0.2*col_radius]) 39 | rotate([0,90,0]) 40 | cylinder(h=0.2*height, r1=col_radius,r2=col_radius, center=true); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v5/column.scad: -------------------------------------------------------------------------------- 1 | //column.scad v5 2 | 3 | color("white") column(100, 20); 4 | 5 | module column(height, width){ 6 | radius = 0.5*width; 7 | 8 | translate([-radius, -radius,0.95*height]) 9 | cube([2*radius,2*radius,.05*height]); 10 | cylinder(h=height, r1=radius, r2=radius); 11 | translate([-radius, -radius,0]) 12 | cube([2*radius,2*radius,.05*height]); 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v5/middle.scad: -------------------------------------------------------------------------------- 1 | //middle.scad v5 2 | use 3 | 4 | 5 | module middle_section(width, height){ 6 | level_height=height/6; 7 | level_radius=0.5*width; 8 | 9 | for(h=[0:1:5]){ 10 | floor_offset=h*level_height; 11 | 12 | translate([0,0,floor_offset]) 13 | level(level_radius, level_height); 14 | } 15 | } 16 | 17 | 18 | module level(level_radius, level_height){ 19 | lip_height= 0.1*level_height; 20 | inner_radius= 0.7*level_radius; 21 | overhang_height= 0.3*level_height; 22 | overhang_radius= 0.95*level_radius; 23 | 24 | num_cols=24; 25 | angle_size= 360/num_cols; 26 | 27 | col_height= 0.65*level_height; 28 | col_width= 0.2*col_height; 29 | 30 | arch_depth= 2*(level_radius-inner_radius); 31 | 32 | //lip 33 | translate([0,0,level_height-lip_height]) 34 | cylinder(h=lip_height, r1=level_radius, r2=level_radius); 35 | 36 | 37 | translate([0,0,0.65*level_height]) 38 | difference(){ 39 | //overhang 40 | cylinder(h=overhang_height,r1=overhang_radius, r2=overhang_radius); 41 | 42 | //arches 43 | for(angle=[angle_size/2:angle_size:360]){ 44 | rotate([0,0,angle]) 45 | translate([inner_radius,0,0]) 46 | rotate([0,90,0]) 47 | cylinder(h=arch_depth, r1=col_width,r2=col_width, center=true); 48 | } 49 | } 50 | 51 | //inner structure 52 | cylinder(h=level_height, r1=inner_radius, r2=inner_radius); 53 | 54 | //columns 55 | for(angle=[0:angle_size:360]){ 56 | rotate([0,0,angle]) 57 | translate([overhang_radius-0.5*col_width,0,0]) 58 | column(col_height, col_width); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v5/top.scad: -------------------------------------------------------------------------------- 1 | //top.scad v5 2 | 3 | 4 | 5 | module top_section(width, height){ 6 | radius= 0.4*width; 7 | col_width= 2; 8 | num_cols= 15; 9 | angle_width= 360/num_cols; 10 | archway_angle= 3*angle_width; 11 | 12 | //lip 13 | translate([0,0,0.9*height]) 14 | cylinder(h=0.1*height, r1=1.1*radius, r2=1.1*radius); 15 | 16 | 17 | difference(){ 18 | cylinder(h=height, r1=radius, r2=radius); 19 | 20 | cylinder(h=2*height+1, r1=.75*radius, r2=.75*radius, center=true); 21 | for(angle=[0:angle_width:360]){ 22 | if(angle%archway_angle==0){ 23 | rotate([0,0,angle]) 24 | translate([radius-2,0,.25*height]) 25 | archway(.6*height, .35*height, .5*radius); 26 | }else if (angle%archway_angle==24){ 27 | rotate([0,0,angle+.5*angle_width]) 28 | translate([radius-2,0,.6*height]) 29 | archway(.25*height, .15*height, .5*radius); 30 | } 31 | } 32 | } 33 | 34 | translate([0,0,height]) 35 | fence(15, 3, radius,1); 36 | fence(20, 3, width/2, 1); 37 | } 38 | 39 | module fence(num_posts, fence_height, fence_radius, post_width){ 40 | angle_size= 360/num_posts; 41 | ring_height= 0.5; 42 | post_height= fence_height-ring_height; 43 | 44 | translate([0,0,post_height]) 45 | ring(fence_radius-post_width, fence_radius, ring_height); 46 | translate([0,0,post_height/2]) 47 | ring(fence_radius-post_width, fence_radius, ring_height); 48 | 49 | for(angle=[0:angle_size:360]){ 50 | rotate([0,0,angle]) 51 | translate([fence_radius-post_width/2,0,0]) 52 | cylinder(h=post_height, r1=post_width/2, r2=post_width/2); 53 | } 54 | } 55 | 56 | module ring(inner_radius, outer_radius, height){ 57 | difference(){ 58 | cylinder(h=height, r1=outer_radius, r2=outer_radius); 59 | translate([0,0,1]) 60 | cylinder(h=height+2, r1=inner_radius, r2=inner_radius, center=true); 61 | } 62 | } 63 | 64 | module archway(height, width, depth){ 65 | radius = width/2; 66 | 67 | rotate([90,0,-90]) 68 | union(){ 69 | translate([0,(height-radius)/2,-depth/2]) 70 | cylinder(h=depth, r1=radius,r2=radius); 71 | cube([width, height-radius, depth], center=true); 72 | } 73 | } -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/pisa-tower/v5/tower.scad: -------------------------------------------------------------------------------- 1 | //tower.scad v5 2 | 3 | use 4 | use 5 | use 6 | 7 | tower_height= 100; 8 | tower_width= 0.3*tower_height; 9 | bottom_height= 0.2*tower_height; 10 | middle_height= 0.65*tower_height; 11 | top_height= 0.15*tower_height; 12 | 13 | base_width= 2*tower_width; 14 | base_height= 0.1*tower_width; 15 | 16 | lean_angle= 4; 17 | 18 | $fn=20; 19 | 20 | rotate([lean_angle,0,0]){ 21 | color("grey") 22 | bottom_section(tower_width, bottom_height); 23 | color("lightgrey") 24 | translate([0,0,0.2*tower_height]) 25 | middle_section(tower_width, middle_height); 26 | color("white") 27 | translate([0,0,0.85*tower_height]) 28 | top_section(tower_width,top_height); 29 | } 30 | 31 | color("lightgreen") 32 | cube([base_width,base_width,base_height], center=true); -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-10.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-11.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-12.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-13.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-14.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-15.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-6.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-7.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-8.png -------------------------------------------------------------------------------- /7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/7_Designing-Big-Projects/Examples/screenshots/OpenSCAD_Figure7-9.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_2D-primitives-circle.scad: -------------------------------------------------------------------------------- 1 | circle(10);//circle -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_2D-primitives-pentagon.scad: -------------------------------------------------------------------------------- 1 | circle(10, $fn=5);//pentagon -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_2D-primitives-polygon.scad: -------------------------------------------------------------------------------- 1 | polygon([[0,0],[10,0],[10,10],[5,10]]);//polygon -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_2D-primitives-square-centered.scad: -------------------------------------------------------------------------------- 1 | square([30,20], center=true);//centered square -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_2D-primitives-square.scad: -------------------------------------------------------------------------------- 1 | square([30,20]);//square -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_2D-primitives-text.scad: -------------------------------------------------------------------------------- 1 | text("hello", font="Sans", size=20); 2 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-centered-smooth-truncated-cone.scad: -------------------------------------------------------------------------------- 1 | cylinder(h=10, r1=3, r2=5, $fn=100, center=true); -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-cone.scad: -------------------------------------------------------------------------------- 1 | cylinder(h = 20, r1=5, r2=0);//cone 2 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-cube-centered.scad: -------------------------------------------------------------------------------- 1 | cube([30,20,10], center=true);//cuboids 2 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-cube.scad: -------------------------------------------------------------------------------- 1 | cube([30,20,10]);//cuboids 2 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-cylinder.scad: -------------------------------------------------------------------------------- 1 | cylinder(h = 20, r=5);//cylinder 2 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-hexagonal-prism.scad: -------------------------------------------------------------------------------- 1 | cylinder(h = 5, r=5, $fn=6); -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-sphere-smooth.scad: -------------------------------------------------------------------------------- 1 | sphere(10, $fn=100);//smooth sphere 2 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_3D-primitives-sphere.scad: -------------------------------------------------------------------------------- 1 | sphere(10);//sphere 2 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Combining-shapes-difference-multiple.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | sphere(10); 3 | render() { 4 | cube([15,15,15]); 5 | cylinder(h=15, r=5); 6 | } 7 | %color([0.5,0.5,1], alpha=0.3) render() { 8 | cube([15,15,15]); 9 | cylinder(h=15, r=5); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Combining-shapes-difference.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | sphere(10); 3 | translate([0,-15,0]) cube([15,30,15]); 4 | %color([0.5,0.5,1], alpha=0.3) translate([0,-15,0]) cube([15,30,15]); 5 | } 6 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Combining-shapes-hull.scad: -------------------------------------------------------------------------------- 1 | hull(){ 2 | sphere(10); 3 | cylinder(h=20, r=5); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Combining-shapes-intersection.scad: -------------------------------------------------------------------------------- 1 | intersection() { 2 | cube([10,10,10]); 3 | cylinder(h=15, r=5); 4 | } 5 | 6 | %color([0.5,0.5,1], alpha=0.3) { 7 | cube([10,10,10]); 8 | cylinder(h=15, r=5); 9 | } 10 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Combining-shapes-minkowski.scad: -------------------------------------------------------------------------------- 1 | minkowski(){ 2 | sphere(10, $fn=50); 3 | cylinder(h=20, r=5); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Combining-shapes-union.scad: -------------------------------------------------------------------------------- 1 | difference() { 2 | union() { 3 | sphere(10); 4 | cylinder(h=30, r=5, center=true); 5 | } 6 | cube([10, 30, 10], center=true); 7 | } 8 | %color([0.5,0.5,1], alpha=0.3) cube([10,30,10], center=true); 9 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Loops-nested.scad: -------------------------------------------------------------------------------- 1 | for(z=[0:15:45]){ 2 | for(x=[0:10:40]){ 3 | translate([x,0,z])cube([5,5,10]); 4 | } 5 | } -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Loops-single-multiple-characteristics.scad: -------------------------------------------------------------------------------- 1 | for(x=[0:1:4]){ 2 | translate([x*10,0,0])cube([5,5,x*5+5]); 3 | } -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Loops-single.scad: -------------------------------------------------------------------------------- 1 | for(x=[0:10:40]){ 2 | translate([x,0,0])cube([5,5,10]); 3 | } -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Transformations-linear-extrude.scad: -------------------------------------------------------------------------------- 1 | linear_extrude(height=10) polygon([[0,0],[10,0],[10,10],[5,10]]);//extruded polygon -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Transformations-mirror.scad: -------------------------------------------------------------------------------- 1 | mirror([1,0,0]) translate([5,0,0]) cylinder(h=1, r=5, $fn=5); 2 | %color([0.5,0.5,1], alpha=0.3) translate([5,0,0]) cylinder(h=1, r=5, $fn=5); 3 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Transformations-resize.scad: -------------------------------------------------------------------------------- 1 | resize([15, 20, 4]) sphere(r=5, $fn=32); 2 | %color([0.5,0.5,1], alpha=0.3) sphere(r=5, $fn=32); 3 | 4 | -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Transformations-rotate-extrude.scad: -------------------------------------------------------------------------------- 1 | rotate_extrude(angle=180) translate([10, 0]) circle(5); -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Transformations-rotate.scad: -------------------------------------------------------------------------------- 1 | rotate([0,0,60])cube([30,20,10]); 2 | %color([0.5,0.5,1], alpha=0.3) cube([30,20,9.99]); -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/OpenSCAD_Transformations-translate.scad: -------------------------------------------------------------------------------- 1 | translate([5,10,0]) cube([5,3,1]); 2 | %color([0.5,0.5,1], alpha=0.3) cube([5,3,1]); -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-circle.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-pentagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-pentagon.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-polygon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-polygon.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-square-centered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-square-centered.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-square.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_2D-primitives-text.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-centered-smooth-truncated-cone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-centered-smooth-truncated-cone.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cone.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cube-centered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cube-centered.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cube.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cylinder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-cylinder.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-hexagonal-prism.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-hexagonal-prism.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-sphere-smooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-sphere-smooth.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_3D-primitives-sphere.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-difference-multiple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-difference-multiple.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-difference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-difference.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-hull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-hull.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-intersection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-intersection.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-minkowski.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-minkowski.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-union.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Combining-shapes-union.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Loops-nested.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Loops-nested.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Loops-single-multiple-characteristics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Loops-single-multiple-characteristics.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Loops-single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Loops-single.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-linear-extrude.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-linear-extrude.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-mirror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-mirror.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-resize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-resize.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-rotate-extrude.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-rotate-extrude.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-rotate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-rotate.png -------------------------------------------------------------------------------- /AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-translate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingWithOpenSCAD/CodeSolutions/bf924904c6a7d0b916b98251394cc5a483875254/AppendixB_OpenSCAD-Visual-Reference/screenshots/OpenSCAD_Transformations-translate.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeSolutions 2 | [OpenSCAD](https://openscad.org/) code solutions to examples and excerises included in [Programming with OpenSCAD: A Beginner's Guide to Coding 3D-Printable Objects]( https://programmingwithopenscad.github.io) 3 | --------------------------------------------------------------------------------