Skip to content

Commit f8749b5

Browse files
authored
Merge pull request #9 from pks5/examples
examples, scad101
2 parents 62ce4ef + d45c68a commit f8749b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+968
-205
lines changed

bin/create-previews.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ IMAGE_WIDTH_FULL=$((IMAGE_WIDTH + 2 * IMAGE_BORDER))
2323
IMAGE_HEIGHT_FULL=$((IMAGE_HEIGHT + 2 * IMAGE_BORDER))
2424

2525
#declare -a arr=("$DIR_SETS" "$DIR_EXAMPLES")
26-
declare -a arr=("$DIR_DOCS")
26+
#declare -a arr=("$DIR_DOCS")
27+
declare -a arr=("$DIR_CORNER")
2728

2829
echo
2930
echo Creating preview images ...

docs/basic-shapes/cube-cylinder.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Cube and Cylinder combined
25
// The Cube is 10mm wide
36
// The Cylinder has a diameter of 10mm

docs/basic-shapes/cube-cylinder.webp

-248 Bytes
Binary file not shown.

docs/basic-shapes/cube-sphere.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// The Cube is 10mm wide
25
// The Sphere has a diameter of 12mm
36
// That's why you can only see parts of the Sphere

docs/basic-shapes/cube-sphere.webp

756 Bytes
Binary file not shown.

docs/basic-shapes/cylinder.scad

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// We can create a Cylinder in a similar way
1+
// Define the number of fragments for round shapes
2+
// The higher the number, the smoother the rounding
3+
$fn = 32;
4+
5+
// Let's create a cylinder
26
// All units are given in millimeters
37
// Cylinder with 10mm diameter and 15mm height
48
cylinder(d = 10, h = 15, center = true);

docs/basic-shapes/cylinder.webp

628 Bytes
Binary file not shown.

docs/basic-shapes/sphere.scad

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Let's make fragment number dynamic
2+
// Lower for preview, higher for rendering
3+
$fn = $preview ? 32 : 64;
4+
15
// Let's create a Sphere with 6mm radius
26
// Radius is half the diameter
37
// The diameter is therefore 12mm

docs/basic-shapes/sphere.webp

908 Bytes
Binary file not shown.

docs/custom-bricks/sign.scad

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//Include the MachineBlocks library
2+
use <../../lib/block.scad>;
3+
4+
//Grid Size X-direction
5+
gridX = 8;
6+
//Grid Size Y-direction
7+
gridY = 2;
8+
//Length of a 1x1 LEGO brick
9+
gridSizeXY = 8.0;
10+
//Height of a LEGO plate
11+
gridSizeZ = 3.2;
12+
//Number of layers
13+
baseLayers = 1;
14+
//Draw Knobs
15+
knobs = false;
16+
17+
//Adjustment of the height (mm)
18+
baseHeightAdjustment = 0.0;
19+
//Adjustment of each side (mm)
20+
baseSideAdjustment = -0.1;
21+
//Diameter of the knobs (mm)
22+
knobSize = 5.0;
23+
//Thickness of the walls (mm)
24+
wallThickness = 1.5;
25+
//Diameter of the Z-Tubes (mm)
26+
tubeZSize = 6.4;
27+
28+
logHeight = 48;
29+
logRadius = 4;
30+
31+
block(
32+
grid = [gridX, gridY],
33+
gridSizeXY = gridSizeXY,
34+
gridSizeZ = gridSizeZ,
35+
baseLayers = baseLayers,
36+
knobs = knobs,
37+
baseHeightAdjustment = baseHeightAdjustment,
38+
baseSideAdjustment = baseSideAdjustment,
39+
knobSize = knobSize,
40+
wallThickness = wallThickness,
41+
tubeZSize = tubeZSize
42+
);
43+
44+
translate([3.5 * gridSizeXY, 0, baseLayers * gridSizeZ + 0.5 * logHeight])
45+
cylinder(r = logRadius, h = logHeight, center = true, $fn = $preview ? 32 : 64);
46+
47+
translate([-3.5 * gridSizeXY, 0, baseLayers * gridSizeZ + 0.5 * logHeight])
48+
cylinder(r = logRadius, h = logHeight, center = true, $fn = $preview ? 32 : 64);
49+
50+
51+
translate([0, 0, baseLayers * gridSizeZ + logHeight - 0.5 * gridY * gridSizeXY])
52+
rotate([90, 0, 0])
53+
block(
54+
grid = [gridX, gridY],
55+
gridSizeXY = gridSizeXY,
56+
gridSizeZ = gridSizeZ,
57+
baseLayers = baseLayers,
58+
knobs = knobs,
59+
baseCutoutType = "none",
60+
alignBottom = false,
61+
text = "Welcome",
62+
textSide = 5,
63+
textSize = 8,
64+
textDepth = 2,
65+
baseHeightAdjustment = baseHeightAdjustment,
66+
baseSideAdjustment = baseSideAdjustment,
67+
knobSize = knobSize,
68+
wallThickness = wallThickness,
69+
tubeZSize = tubeZSize
70+
);

docs/custom-bricks/sign.webp

35.2 KB
Binary file not shown.

docs/custom-bricks/simple-tree.scad

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//Include the MachineBlocks library
2+
use <../../lib/block.scad>;
3+
4+
//Grid Size X-direction
5+
gridX = 6;
6+
//Grid Size Y-direction
7+
gridY = 6;
8+
//Length of a 1x1 LEGO brick
9+
gridSizeXY = 8.0;
10+
//Height of a LEGO plate
11+
gridSizeZ = 3.2;
12+
//Number of layers
13+
baseLayers = 1;
14+
//Draw Knobs
15+
knobs = [true, [1, 1, gridX - 2, gridY - 2, true]];
16+
17+
//Adjustment of the height (mm)
18+
baseHeightAdjustment = 0.0;
19+
//Adjustment of each side (mm)
20+
baseSideAdjustment = -0.1;
21+
//Diameter of the knobs (mm)
22+
knobSize = 5.0;
23+
//Thickness of the walls (mm)
24+
wallThickness = 1.5;
25+
//Diameter of the Z-Tubes (mm)
26+
tubeZSize = 6.4;
27+
28+
logHeight = 30;
29+
logRadius = 8;
30+
treeRadius = 32;
31+
32+
block(
33+
grid = [gridX, gridY],
34+
gridSizeXY = gridSizeXY,
35+
gridSizeZ = gridSizeZ,
36+
baseLayers = baseLayers,
37+
knobs = knobs,
38+
baseHeightAdjustment = baseHeightAdjustment,
39+
baseSideAdjustment = baseSideAdjustment,
40+
knobSize = knobSize,
41+
wallThickness = wallThickness,
42+
tubeZSize = tubeZSize
43+
);
44+
45+
translate([0, 0, baseLayers * gridSizeZ + 0.5 * logHeight])
46+
cylinder(r = logRadius, h = logHeight, center = true, $fn = $preview ? 32 : 64);
47+
48+
translate([0, 0, baseLayers * gridSizeZ + logHeight + 0.95*treeRadius])
49+
sphere(r = treeRadius, $fn = $preview ? 32 : 64);

docs/custom-bricks/simple-tree.webp

31.6 KB
Binary file not shown.

docs/operations/difference-multiple.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the cube (all directions)
25
cubSiz = 10;
36

556 Bytes
Binary file not shown.

docs/operations/difference-order.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the cube (all directions)
25
cubSiz = 10;
36

docs/operations/difference-order.webp

-120 Bytes
Binary file not shown.

docs/operations/difference.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the cube (all directions)
25
cubSiz = 10;
36

docs/operations/difference.webp

-18 Bytes
Binary file not shown.

docs/operations/intersection.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the cube (all directions)
25
cubSiz = 10;
36

docs/operations/intersection.webp

556 Bytes
Binary file not shown.

docs/operations/union.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the cube (all directions)
25
cubSiz = 10;
36

docs/operations/union.webp

-2 Bytes
Binary file not shown.

docs/rotations/rotate-multiple.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/rotations/rotate-multiple.webp

290 Bytes
Binary file not shown.

docs/rotations/rotate-nested.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/rotations/rotate-nested.webp

-62 Bytes
Binary file not shown.

docs/rotations/rotate-x.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/rotations/rotate-x.webp

-326 Bytes
Binary file not shown.

docs/rotations/rotate-y.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/rotations/rotate-y.webp

576 Bytes
Binary file not shown.

docs/rotations/rotate-z.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/rotations/rotate-z.webp

40 Bytes
Binary file not shown.

docs/translations/translate-multiple.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

964 Bytes
Binary file not shown.

docs/translations/translate-nested.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

680 Bytes
Binary file not shown.

docs/translations/translate-x.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/translations/translate-x.webp

528 Bytes
Binary file not shown.

docs/translations/translate-y.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/translations/translate-y.webp

74 Bytes
Binary file not shown.

docs/translations/translate-z.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Size of the Cube (all directions)
25
cuSize = 10;
36

docs/translations/translate-z.webp

226 Bytes
Binary file not shown.

docs/variables/cube-cylinder.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Name variables so you know what they are for!
25

36
// Size of the Cube in the X-direction (width)

docs/variables/cube-cylinder.webp

-248 Bytes
Binary file not shown.

docs/variables/cube-sphere.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Create your own naming convention!
25
// You are the one who has to keep an eye on things
36

docs/variables/cube-sphere.webp

756 Bytes
Binary file not shown.

docs/variables/cylinder.scad

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Variable names can be abbreviated!
1+
// Variables starting with $ are special
2+
// You cannot rename it
3+
$fn = $preview ? 32 : 64;
4+
5+
// Other variables can be abbreviated!
26

37
// The diameter of the Cylinder
48
dia = 10;

docs/variables/cylinder.webp

628 Bytes
Binary file not shown.

docs/variables/sphere.scad

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Set fragment number for roundings
2+
$fn = $preview ? 32 : 64;
3+
14
// Variable names can be written out in full!
25

36
// The radius of the Sphere

docs/variables/sphere.webp

908 Bytes
Binary file not shown.

examples/corner/cross-3x3-1.scad

-58
This file was deleted.

examples/corner/cross-3x3-1.webp

-27.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)