mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-09-03 12:22:46 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ec891c8013 | ||
|
c7811f21e0 | ||
|
782deccf6b | ||
|
69da4c1c23 | ||
|
0a00f244e4 | ||
|
76ea28e88e | ||
|
44cf9e910b | ||
|
0261362794 | ||
|
b21b7b9de0 |
@@ -5511,8 +5511,10 @@ a square cornered part fits in the hole then circles are placed in the corners m
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true)``` | Rectangle with cylinders at the corners |
|
||||
| ```dogbone_square(size, r = cnc_bit_r, center = true)``` | Square with circles at the corners |
|
||||
| ```dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true, x_offset, y_offset)``` | Rectangle with cylinders at the corners |
|
||||
| ```dogbone_rectangle_x(size, r = cnc_bit_r, center = true, xy_center = true)``` | Rectangle with cylinders at the corners, offset in the x direction |
|
||||
| ```dogbone_rectangle_y(size, r = cnc_bit_r, center = true, xy_center = true)``` | Rectangle with cylinders at the corners, offset in the y direction |
|
||||
| ```dogbone_square(size, r = cnc_bit_r, center = true, x_offset, y_offset)``` | Square with circles at the corners, with optional offsets |
|
||||
|
||||

|
||||
|
||||
@@ -6098,6 +6100,7 @@ Global constants, functions and modules. This file is used directly or indirectl
|
||||
| ```ellipse(xr, yr)``` | Draw an ellipse |
|
||||
| ```extrude_if(h, center = true)``` | Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D |
|
||||
| ```hflip(flip=true)``` | Invert children by doing a 180° flip around the Y axis |
|
||||
| ```render_if(render = true, convexity = 2)``` | Renders an object if ```render``` is true, otherwise leaves it unrendered |
|
||||
| ```right_triangle(width, height, h, center = true)``` | A right angled triangle with the 90° corner at the origin. 3D when ```h``` is nonzero, otherwise 2D |
|
||||
| ```semi_circle(r, d = undef)``` | A semi circle in the positive Y domain |
|
||||
| ```translate_z(z)``` | Shortcut for Z only translations |
|
||||
|
@@ -26,6 +26,12 @@ module dogbones() {
|
||||
#translate([15, 0])
|
||||
dogbone_rectangle([10, 20, 5], center = false);
|
||||
|
||||
#translate([30, 0])
|
||||
dogbone_rectangle_x([10, 20, 5], center = false);
|
||||
|
||||
#translate([45, 0])
|
||||
dogbone_rectangle_y([10, 20, 5], center = false);
|
||||
|
||||
sq = 3;
|
||||
translate([-5 + sq / 2 + eps, -10 + sq / 2 + eps])
|
||||
%cube([sq, sq, 1], center = true);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 55 KiB |
@@ -52,6 +52,13 @@ function slice(list, start = 0, end = undef) = let( //! Slice a list or string w
|
||||
) is_string(list) ? slice_str(list, start, end) : [for(i = [start : 1 : end - 1]) list[i]];
|
||||
|
||||
|
||||
module render_if(render = true, convexity = 2) //! Renders an object if ```render``` is true, otherwise leaves it unrendered
|
||||
if (render)
|
||||
render(convexity = convexity)
|
||||
children();
|
||||
else
|
||||
children();
|
||||
|
||||
module extrude_if(h, center = true) //! Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D
|
||||
if(h)
|
||||
linear_extrude(h, center = center, convexity = 2) // 3D
|
||||
|
@@ -23,24 +23,36 @@
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
|
||||
module dogbone_square(size, r = cnc_bit_r, center = true) //! Square with circles at the corners
|
||||
module dogbone_square(size, r = cnc_bit_r, center = true, x_offset, y_offset) //! Square with circles at the corners, with optional offsets
|
||||
{
|
||||
x_offset = is_undef(x_offset) ? r / sqrt(2) : x_offset;
|
||||
y_offset = is_undef(y_offset) ? r / sqrt(2) : y_offset;
|
||||
|
||||
union() {
|
||||
square(size, center = center);
|
||||
|
||||
if(r > 0) {
|
||||
origin = center ? [0, 0] : size / 2;
|
||||
offset = r / sqrt(2);
|
||||
|
||||
for(x = [-1, 1], y = [-1, 1])
|
||||
translate(origin + [x * (size.x / 2 - offset), y * (size.y / 2 - offset)])
|
||||
translate(origin + [x * (size.x / 2 - x_offset), y * (size.y / 2 - y_offset)])
|
||||
drill(r, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true) //! Rectangle with cylinders at the corners
|
||||
module dogbone_rectangle(size, r = cnc_bit_r, center = true, xy_center = true, x_offset, y_offset) //! Rectangle with cylinders at the corners
|
||||
{
|
||||
extrude_if(h = size.z, center = center)
|
||||
dogbone_square([size.x, size.y], r, xy_center);
|
||||
dogbone_square([size.x, size.y], r, xy_center, x_offset, y_offset);
|
||||
}
|
||||
|
||||
module dogbone_rectangle_x(size, r = cnc_bit_r, center = true, xy_center = true) //! Rectangle with cylinders at the corners, offset in the x direction
|
||||
{
|
||||
dogbone_rectangle(size = size, r = r, center = center, x_offset = 0, y_offset = r);
|
||||
}
|
||||
|
||||
module dogbone_rectangle_y(size, r = cnc_bit_r, center = true, xy_center = true) //! Rectangle with cylinders at the corners, offset in the y direction
|
||||
{
|
||||
dogbone_rectangle(size = size, r = r, center = center, x_offset = r, y_offset = 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user