1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-19 04:51:26 +02:00
This commit is contained in:
Justin Lin
2022-03-30 09:39:11 +08:00
parent 3e1044787f
commit ba5b184d16
13 changed files with 55 additions and 52 deletions

View File

@@ -57,9 +57,9 @@ Puts children along the given path. If there's only one child, it will put the c
angles = [for(p_a = pts_angles) p_a[1]];
along_with(points, angles)
rotate([90, 0, 0])
linear_extrude(1, center = true)
text("A", valign = "center", halign = "center");
rotate([90, 0, 0])
linear_extrude(1, center = true)
text("A", valign = "center", halign = "center");
![along_with](images/lib3x-along_with-3.JPG)
@@ -69,20 +69,20 @@ Puts children along the given path. If there's only one child, it will put the c
module scales() {
module one_scale() {
rotate([0, 60, 0])
linear_extrude(1, center = true)
scale([2, 1])
circle(1.25, $fn = 24);
linear_extrude(1, center = true)
scale([2, 1])
circle(1.25, $fn = 24);
}
for(a = [0:30:330]) {
rotate(a)
translate([5, 0, 0])
one_scale();
rotate(a + 15)
translate([5, 0, 1.75])
one_scale();
}
translate([5, 0, 0])
one_scale();
rotate(a + 15)
translate([5, 0, 1.75])
one_scale();
}
}
t_step = 0.01;

View File

@@ -34,7 +34,8 @@ Once you have the size of the containing cube, you can use it as the `size` argu
*cube(size = [x, y, z]);
bend(size = [x, y, z], angle = 270)
linear_extrude(z) text("A");
linear_extrude(z)
text("A");
![bend](images/lib3x-bend-2.JPG)
@@ -47,8 +48,8 @@ The arc shape is smoother if the `frags` value is larger.
z = 1;
bend(size = [x, y, z], angle = 270, frags = 360)
linear_extrude(z)
text("A");
linear_extrude(z)
text("A");
![bend](images/lib3x-bend-3.JPG)

View File

@@ -21,9 +21,9 @@ Sometimes you need all points on the path of a circle. Here's the function. Its
step_angle = 360 / leng;
for(i = [0:leng - 1]) {
translate(points[i])
rotate([90, 0, 90 + i * step_angle])
linear_extrude(1, center = true)
text("A", valign = "center", halign = "center");
rotate([90, 0, 90 + i * step_angle])
linear_extrude(1, center = true)
text("A", valign = "center", halign = "center");
}
![circle_path](images/lib3x-circle_path-1.JPG)

View File

@@ -34,7 +34,9 @@ Extrudes a 2D object along the path of an ellipse from 0 to 180 degrees. The sem
ellipse_extrude(semi_minor_axis)
text("♥", size = 40, valign = "center", halign = "center");
mirror([0, 0, 1]) ellipse_extrude(semi_minor_axis)
mirror([0, 0, 1])
ellipse_extrude(semi_minor_axis)
text("♥", size = 40, valign = "center", halign = "center");
![ellipse_extrude](images/lib3x-ellipse_extrude-3.JPG)

View File

@@ -38,9 +38,9 @@ It returns a vector of `[[x, y], angle]`.
for(pt_angle = pts_angles) {
translate(pt_angle[0])
rotate([90, 0, pt_angle[1]])
linear_extrude(1, center = true)
text("A", valign = "center", halign = "center");
rotate([90, 0, pt_angle[1]])
linear_extrude(1, center = true)
text("A", valign = "center", halign = "center");
}
![golden_spiral](images/lib3x-golden_spiral-2.JPG)

View File

@@ -16,7 +16,7 @@ The 2D polygon should center at the origin and you have to determine the side le
dimension = 100;
render() stereographic_extrude(shadow_side_leng = dimension)
stereographic_extrude(shadow_side_leng = dimension, convexity = 10)
text(
"M", size = dimension,
valign = "center", halign = "center"

View File

@@ -16,11 +16,11 @@ Generate 8x8 voxel points of printable ASCII characters (codes 32dec to 126dec).
for(i = [0:94]) {
translate([8 * (i % 10), -8 * floor(i / 10), 0])
for(p = vx_ascii(chr(i + 32))) {
translate(p)
linear_extrude(1, scale = 0.8)
square(1);
}
for(p = vx_ascii(chr(i + 32))) {
translate(p)
linear_extrude(1, scale = 0.8)
square(1);
}
}
![vx_ascii](images/lib3x-vx_ascii-1.JPG)
@@ -31,10 +31,10 @@ Generate 8x8 voxel points of printable ASCII characters (codes 32dec to 126dec).
for(i = [0:len(t) - 1]) {
translate([i * 8, 0])
for(pt = vx_ascii(t[i], invert = true)) {
translate(pt)
sphere(0.5, $fn = 24);
}
for(pt = vx_ascii(t[i], invert = true)) {
translate(pt)
sphere(0.5, $fn = 24);
}
}
![vx_ascii](images/lib3x-vx_ascii-2.JPG)

View File

@@ -24,8 +24,8 @@ Returns points that can be used to draw a voxel-style circle.
for(pt = vx_circle(10, filled = true)) {
translate(pt)
linear_extrude(1, scale = 0.5)
square(1, center = true);
linear_extrude(1, scale = 0.5)
square(1, center = true);
}
![vx_circle](images/lib3x-vx_circle-2.JPG)

View File

@@ -20,10 +20,10 @@ Given a list of points that form a closed area, `vx_contour` returns the contour
linear_extrude(2)
for(i = [0:len(t) - 1]) {
translate([i * 8, 0])
for(pt = vx_ascii(t[i])) {
translate(pt)
square(1, center = true);
}
for(pt = vx_ascii(t[i])) {
translate(pt)
square(1, center = true);
}
}
color("black")

View File

@@ -25,7 +25,7 @@ Draws a voxel-by-voxel curve from control points. The curve is drawn only from t
for(pt = vx_curve(pts)) {
translate(pt)
cube(1);
cube(1);
}
#for(pt = pts) {

View File

@@ -60,9 +60,9 @@ Given a list of numbers (0 ~ 255) that represent a gray image. This function tra
g = 1 - dot[1] / 255;
h = dot[1] / 85;
color([g, g, g])
translate(dot[0])
linear_extrude(h)
square(1);
translate(dot[0])
linear_extrude(h)
square(1);
}
![vx_gray](images/lib3x-vx_gray-1.JPG)

View File

@@ -21,15 +21,15 @@ Returns points that can be used to draw a voxel-style polygon.
for(pt = vx_polygon(pentagram)) {
translate(pt)
linear_extrude(1, scale = 0.5)
square(1, center = true);
linear_extrude(1, scale = 0.5)
square(1, center = true);
}
translate([30, 0])
for(pt = vx_polygon(pentagram, filled = true)) {
translate(pt)
linear_extrude(1, scale = 0.5)
square(1, center = true);
linear_extrude(1, scale = 0.5)
square(1, center = true);
}
![vx_polygon](images/lib3x-vx_polygon-1.JPG)

View File

@@ -20,8 +20,8 @@ Given a list of points. `vx_polyline` returns points that can be used to draw a
for(pt = vx_polyline([each pentagram, pentagram[0]])) {
translate(pt)
linear_extrude(1, scale = 0.5)
square(1, center = true);
linear_extrude(1, scale = 0.5)
square(1, center = true);
}
![vx_polyline](images/lib3x-vx_polyline-1.JPG)
@@ -42,10 +42,10 @@ Given a list of points. `vx_polyline` returns points that can be used to draw a
for(a = [0:30:330]) {
rotate(a)
for(pt = vx_polyline(points)) {
translate(pt)
cube(1, center = true);
}
for(pt = vx_polyline(points)) {
translate(pt)
cube(1, center = true);
}
}
![vx_polyline](images/lib3x-vx_polyline-2.JPG)