1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-09 08:56:29 +02:00

Added rounded_top_rectangle().

This commit is contained in:
Chris Palmer
2023-02-01 01:27:01 +00:00
parent ff7041c285
commit 3f84912e55
8 changed files with 23 additions and 0 deletions

View File

@@ -6728,6 +6728,7 @@ Cylinder with a rounded end.
|:--- |:--- | |:--- |:--- |
| `rounded_corner(r, h, r2, ir = 0)` | 2D version | | `rounded_corner(r, h, r2, ir = 0)` | 2D version |
| `rounded_cylinder(r, h, r2, ir = 0, angle = 360)` | Rounded cylinder given radius `r`, height `h`, optional internal radius `ir` and optional `angle` | | `rounded_cylinder(r, h, r2, ir = 0, angle = 360)` | Rounded cylinder given radius `r`, height `h`, optional internal radius `ir` and optional `angle` |
| `rounded_top_rectangle(size, r, r2)` | Make a rounded rectangle with a rounded top edge |
![rounded_cylinder](tests/png/rounded_cylinder.png) ![rounded_cylinder](tests/png/rounded_cylinder.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 181 KiB

View File

@@ -27,6 +27,9 @@ module rounded_cylinders() {
translate([30, 10]) translate([30, 10])
rounded_cylinder(10, 20, 3, 5, 270); rounded_cylinder(10, 20, 3, 5, 270);
translate([65, 10])
rounded_top_rectangle([30, 20, 5], 3, 2);
} }
rounded_cylinders(); rounded_cylinders();

View File

@@ -45,3 +45,22 @@ module rounded_cylinder(r, h, r2, ir = 0, angle = 360) //! Rounded cylinder give
rotate_extrude(angle = angle) rotate_extrude(angle = angle)
rounded_corner(r, h, r2, ir); rounded_corner(r, h, r2, ir);
} }
module rounded_top_rectangle(size, r, r2) { //! Make a rounded rectangle with a rounded top edge
hull() {
translate([size.x / 2 - r, size.y / 2 - r])
rounded_cylinder(r = r, h = size.z, r2 = r2, angle = 90);
translate([-size.x / 2 + r, size.y / 2 - r])
rotate(90)
rounded_cylinder(r = r, h = size.z, r2 = r2, angle = 90);
translate([-size.x / 2 + r, -size.y / 2 + r])
rotate(180)
rounded_cylinder(r = r, h = size.z, r2 = r2, angle = 90);
translate([size.x / 2 - r, -size.y / 2 + r])
rotate(270)
rounded_cylinder(r = r, h = size.z, r2 = r2, angle = 90);
}
}