mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-10-01 17:36:52 +02:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f97070099e | ||
|
729891b675 | ||
|
4b533cffd2 | ||
|
a40a2190dc | ||
|
6556d14a11 | ||
|
c7d12b20c9 | ||
|
545329b875 | ||
|
760e3a890d | ||
|
bd4f7b155b | ||
|
16c1eeef27 | ||
|
800bb89921 | ||
|
41a0723362 |
@@ -1778,6 +1778,7 @@ Used for limit switches.
|
|||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `microswitch_lower_extent(type)` | How far legs extend downwards |
|
| `microswitch_lower_extent(type)` | How far legs extend downwards |
|
||||||
| `microswitch_right_extent(type)` | How far legs extend right |
|
| `microswitch_right_extent(type)` | How far legs extend right |
|
||||||
|
| `microswitch_size(type)` | Body size |
|
||||||
|
|
||||||
### Modules
|
### Modules
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
@@ -2680,7 +2681,7 @@ Linear rails with carriages.
|
|||||||
| `rail(type, length)` | Draw the specified rail |
|
| `rail(type, length)` | Draw the specified rail |
|
||||||
| `rail_assembly(type, length, pos, carriage_end_colour = grey(20)` | Rail and carriage assembly |
|
| `rail_assembly(type, length, pos, carriage_end_colour = grey(20)` | Rail and carriage assembly |
|
||||||
| `rail_hole_positions(type, length, first = 0, screws = 100, both_ends = true)` | Position children over screw holes |
|
| `rail_hole_positions(type, length, first = 0, screws = 100, both_ends = true)` | Position children over screw holes |
|
||||||
| `rail_screws(type, length, thickness, screws = 100)` | Place screws in the rail |
|
| `rail_screws(type, length, thickness, screws = 100, index_screws = undef)` | Place screws in the rail |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -3775,6 +3776,7 @@ Veroboard with mounting holes, track breaks, removed tracks, solder points and c
|
|||||||
| Function | Description |
|
| Function | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `vero_length(type)` | Length of the board |
|
| `vero_length(type)` | Length of the board |
|
||||||
|
| `vero_size(type)` | Board size |
|
||||||
| `vero_thickness(type)` | Thickness of the substrate |
|
| `vero_thickness(type)` | Thickness of the substrate |
|
||||||
| `vero_track_thickness(type)` | Thickness of the tracks |
|
| `vero_track_thickness(type)` | Thickness of the tracks |
|
||||||
| `vero_track_width(type)` | The width of the tracks |
|
| `vero_track_width(type)` | The width of the tracks |
|
||||||
@@ -5735,7 +5737,8 @@ Cylinder with a rounded end.
|
|||||||
---
|
---
|
||||||
<a name="Rounded_polygon"></a>
|
<a name="Rounded_polygon"></a>
|
||||||
## Rounded_polygon
|
## Rounded_polygon
|
||||||
Draw a polygon with rounded corners. Each element of the vector is the XY coordinate and a radius. Radius can be negative for a concave corner.
|
Draw a polygon with rounded corners. Each element of the vector is the XY coordinate and a radius in clockwise order.
|
||||||
|
Radius can be negative for a concave corner.
|
||||||
|
|
||||||
Because the tangents need to be calculated to find the length these can be calculated separately and re-used when drawing to save calculating them twice.
|
Because the tangents need to be calculated to find the length these can be calculated separately and re-used when drawing to save calculating them twice.
|
||||||
|
|
||||||
@@ -5746,6 +5749,7 @@ Because the tangents need to be calculated to find the length these can be calcu
|
|||||||
### Functions
|
### Functions
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
|
| `circle_tangent(p1, p2)` | Compute the clockwise tangent between two circles represented as [x,y,r] |
|
||||||
| `rounded_polygon_length(points, tangents)` | Calculate the length given the point list and the list of tangents computed by ` rounded_polygon_tangents` |
|
| `rounded_polygon_length(points, tangents)` | Calculate the length given the point list and the list of tangents computed by ` rounded_polygon_tangents` |
|
||||||
| `rounded_polygon_tangents(points)` | Compute the straight sections needed to draw and to compute the lengths |
|
| `rounded_polygon_tangents(points)` | Compute the straight sections needed to draw and to compute the lengths |
|
||||||
|
|
||||||
|
@@ -18,13 +18,14 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
//! Draw a polygon with rounded corners. Each element of the vector is the XY coordinate and a radius. Radius can be negative for a concave corner.
|
//! Draw a polygon with rounded corners. Each element of the vector is the XY coordinate and a radius in clockwise order.
|
||||||
|
//! Radius can be negative for a concave corner.
|
||||||
//!
|
//!
|
||||||
//! Because the tangents need to be calculated to find the length these can be calculated separately and re-used when drawing to save calculating them twice.
|
//! Because the tangents need to be calculated to find the length these can be calculated separately and re-used when drawing to save calculating them twice.
|
||||||
//
|
//
|
||||||
include <../utils/core/core.scad>
|
include <../utils/core/core.scad>
|
||||||
|
|
||||||
function circle_tangent(p1, p2) =
|
function circle_tangent(p1, p2) = //! Compute the clockwise tangent between two circles represented as [x,y,r]
|
||||||
let(
|
let(
|
||||||
r1 = p1[2],
|
r1 = p1[2],
|
||||||
r2 = p2[2],
|
r2 = p2[2],
|
||||||
@@ -32,11 +33,8 @@ function circle_tangent(p1, p2) =
|
|||||||
dy = p2.y - p1.y,
|
dy = p2.y - p1.y,
|
||||||
d = sqrt(dx * dx + dy * dy),
|
d = sqrt(dx * dx + dy * dy),
|
||||||
theta = atan2(dy, dx) + acos((r1 - r2) / d),
|
theta = atan2(dy, dx) + acos((r1 - r2) / d),
|
||||||
xa = p1.x +(cos(theta) * r1),
|
v = [cos(theta), sin(theta)]
|
||||||
ya = p1.y +(sin(theta) * r1),
|
)[ p1 + r1 * v, p2 + r2 * v ];
|
||||||
xb = p2.x +(cos(theta) * r2),
|
|
||||||
yb = p2.y +(sin(theta) * r2)
|
|
||||||
)[ [xa, ya], [xb, yb] ];
|
|
||||||
|
|
||||||
function rounded_polygon_tangents(points) = //! Compute the straight sections needed to draw and to compute the lengths
|
function rounded_polygon_tangents(points) = //! Compute the straight sections needed to draw and to compute the lengths
|
||||||
let(len = len(points))
|
let(len = len(points))
|
||||||
|
@@ -34,14 +34,15 @@ hygrometer_hole_r = 21.3;
|
|||||||
slot_w = 5.5;
|
slot_w = 5.5;
|
||||||
|
|
||||||
module hygrometer_hole(h = 0) { //! Drill the hole for a hygrometer
|
module hygrometer_hole(h = 0) { //! Drill the hole for a hygrometer
|
||||||
|
extrude_if(h)
|
||||||
round(cnc_bit_r) {
|
round(cnc_bit_r) {
|
||||||
intersection() {
|
intersection() {
|
||||||
drill(hygrometer_hole_r, h);
|
drill(hygrometer_hole_r, 0);
|
||||||
|
|
||||||
rotate(30)
|
rotate(30)
|
||||||
square([slot_w + 2 * cnc_bit_r, 100], center = true);
|
square([slot_w + 2 * cnc_bit_r, 100], center = true);
|
||||||
}
|
}
|
||||||
drill((od + 0.2) / 2, h);
|
drill((od + 0.2) / 2, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,6 +41,8 @@ function microswitch_button_clr(type)= type[14]; //! Button colour
|
|||||||
function microswitch_lower_extent(type) = let(leg = microswitch_leg(type)) min([for(pos = microswitch_legs(type)) pos.y - leg.y / 2]); //! How far legs extend downwards
|
function microswitch_lower_extent(type) = let(leg = microswitch_leg(type)) min([for(pos = microswitch_legs(type)) pos.y - leg.y / 2]); //! How far legs extend downwards
|
||||||
function microswitch_right_extent(type) = let(leg = microswitch_leg(type)) max([microswitch_length(type) / 2, for(pos = microswitch_legs(type)) pos.x + leg.x / 2]); //! How far legs extend right
|
function microswitch_right_extent(type) = let(leg = microswitch_leg(type)) max([microswitch_length(type) / 2, for(pos = microswitch_legs(type)) pos.x + leg.x / 2]); //! How far legs extend right
|
||||||
|
|
||||||
|
function microswitch_size(type) = [microswitch_length(type), microswitch_width(type), microswitch_thickness(type)]; //! Body size
|
||||||
|
|
||||||
module microswitch_hole_positions(type) //! Place children at the hole positions
|
module microswitch_hole_positions(type) //! Place children at the hole positions
|
||||||
{
|
{
|
||||||
for(hole = microswitch_holes(type))
|
for(hole = microswitch_holes(type))
|
||||||
|
@@ -64,6 +64,7 @@ module pulley(type) { //! Draw a pulley
|
|||||||
hl = pulley_hub_length(type);
|
hl = pulley_hub_length(type);
|
||||||
w = pulley_width(type);
|
w = pulley_width(type);
|
||||||
r1 = pulley_bore(type) / 2;
|
r1 = pulley_bore(type) / 2;
|
||||||
|
screw_z = pulley_screw_z(type);
|
||||||
|
|
||||||
or = od / 2;
|
or = od / 2;
|
||||||
ir = pulley_ir(type);
|
ir = pulley_ir(type);
|
||||||
@@ -100,16 +101,7 @@ module pulley(type) { //! Draw a pulley
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module screw_holes() {
|
module hub()
|
||||||
if(pulley_screws(type))
|
|
||||||
translate_z(pulley_screw_z(type))
|
|
||||||
for(i = [0 : pulley_screws(type) - 1])
|
|
||||||
rotate([-90, 0, i * -90])
|
|
||||||
cylinder(r = screw_radius(pulley_screw(type)), h = 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
color("silver") {
|
|
||||||
render() difference() {
|
|
||||||
rotate_extrude() translate([r1, 0]) {
|
rotate_extrude() translate([r1, 0]) {
|
||||||
if(hl)
|
if(hl)
|
||||||
square([pulley_hub_dia(type) / 2 - r1, hl]);
|
square([pulley_hub_dia(type) / 2 - r1, hl]);
|
||||||
@@ -118,15 +110,33 @@ module pulley(type) { //! Draw a pulley
|
|||||||
translate([0, z])
|
translate([0, z])
|
||||||
square([pulley_flange_dia(type) / 2 - r1, ft]);
|
square([pulley_flange_dia(type) / 2 - r1, ft]);
|
||||||
}
|
}
|
||||||
if(pulley_screw_z(type) < hl)
|
|
||||||
|
module screw_holes()
|
||||||
|
translate_z(screw_z)
|
||||||
|
for(i = [0 : pulley_screws(type) - 1])
|
||||||
|
rotate([-90, 0, i * -90])
|
||||||
|
cylinder(r = screw_radius(pulley_screw(type)), h = 100);
|
||||||
|
|
||||||
|
color(silver) {
|
||||||
|
if(screw_z && screw_z < hl)
|
||||||
|
render()
|
||||||
|
difference() {
|
||||||
|
hub();
|
||||||
|
|
||||||
screw_holes();
|
screw_holes();
|
||||||
}
|
}
|
||||||
render() difference() { // T5 pulleys have screw through the teeth
|
else
|
||||||
|
hub();
|
||||||
|
|
||||||
|
if(screw_z && screw_z > hl) // T5 pulleys have screw through the teeth
|
||||||
|
render()
|
||||||
|
difference() {
|
||||||
core();
|
core();
|
||||||
|
|
||||||
if(pulley_screw_z(type) > hl)
|
|
||||||
screw_holes();
|
screw_holes();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
core();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -181,19 +181,19 @@ module rail_assembly(type, length, pos, carriage_end_colour = grey(20), carriage
|
|||||||
carriage(rail_carriage(type), type, carriage_end_colour, carriage_wiper_colour);
|
carriage(rail_carriage(type), type, carriage_end_colour, carriage_wiper_colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
module rail_screws(type, length, thickness, screws = 100) { //! Place screws in the rail
|
module rail_screws(type, length, thickness, screws = 100, index_screws = undef) { //! Place screws in the rail
|
||||||
screw = rail_screw(type);
|
screw = rail_screw(type);
|
||||||
end_screw = rail_end_screw(type);
|
end_screw = rail_end_screw(type);
|
||||||
screw_len = screw_longer_than(rail_screw_height(type, screw) + thickness);
|
screw_len = screw_longer_than(rail_screw_height(type, screw) + thickness);
|
||||||
end_screw_len = screw_longer_than(rail_screw_height(type, end_screw) + thickness);
|
end_screw_len = screw_longer_than(rail_screw_height(type, end_screw) + thickness);
|
||||||
|
|
||||||
index_screws = screws > 2 ? 1 : 2;
|
index_screws = is_undef(index_screws) ? screws > 2 ? 1 : 2 : index_screws;
|
||||||
|
|
||||||
translate_z(rail_screw_height(type, end_screw))
|
translate_z(rail_screw_height(type, end_screw))
|
||||||
rail_hole_positions(type, length, 0, index_screws)
|
rail_hole_positions(type, length, 0, index_screws)
|
||||||
screw(end_screw, end_screw_len);
|
screw(end_screw, end_screw_len);
|
||||||
|
|
||||||
translate_z(rail_screw_height(type, screw))
|
translate_z(rail_screw_height(type, screw))
|
||||||
rail_hole_positions(type, length, index_screws)
|
rail_hole_positions(type, length, index_screws, screws - index_screws)
|
||||||
screw(screw, screw_len);
|
screw(screw, screw_len);
|
||||||
}
|
}
|
||||||
|
@@ -41,6 +41,8 @@ function vero_track_width(type) = vero_pitch(type) * 0.8; //! The width of th
|
|||||||
function vero_length(type) = vero_holes(type) * vero_pitch(type); //! Length of the board
|
function vero_length(type) = vero_holes(type) * vero_pitch(type); //! Length of the board
|
||||||
function vero_width(type) = vero_strips(type) * vero_pitch(type); //! Width of the board
|
function vero_width(type) = vero_strips(type) * vero_pitch(type); //! Width of the board
|
||||||
|
|
||||||
|
function vero_size(type) = [vero_length(type), vero_width(type), vero_thickness(type)]; //! Board size
|
||||||
|
|
||||||
module solder_meniscus(type) {
|
module solder_meniscus(type) {
|
||||||
h = 1;
|
h = 1;
|
||||||
r = vero_track_width(type) / 2;
|
r = vero_track_width(type) / 2;
|
||||||
|
Reference in New Issue
Block a user