mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-09-04 04:35:29 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5d42b2e1ab | ||
|
2fe815d1bd | ||
|
5c577cccd0 | ||
|
1dbfafd366 | ||
|
68b3dfb098 | ||
|
25dceee20a |
@@ -474,8 +474,8 @@ PCB cameras.
|
|||||||
### Modules
|
### Modules
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| ```camera(type)``` | Draw specified PCB camera |
|
| ```camera(type, show_lens = true)``` | Draw specified PCB camera |
|
||||||
| ```camera_lens(type, offset = 0)``` | Draw the lens stack, with optional offset for making a clearance hole |
|
| ```camera_lens(type, offset = 0, show_lens = true)``` | Draw the lens stack, with optional offset for making a clearance hole |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -6057,11 +6057,11 @@ Global constants, functions and modules. This file is used directly or indirectl
|
|||||||
| ```circle4n(r, d = undef)``` | Circle with multiple of 4 vertices |
|
| ```circle4n(r, d = undef)``` | Circle with multiple of 4 vertices |
|
||||||
| ```ellipse(xr, yr)``` | Draw an ellipse |
|
| ```ellipse(xr, yr)``` | Draw an ellipse |
|
||||||
| ```extrude_if(h, center = true)``` | Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D |
|
| ```extrude_if(h, center = true)``` | Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D |
|
||||||
| ```hflip()``` | Invert children by doing a 180° flip around the Y axis |
|
| ```hflip(flip=true)``` | Invert children by doing a 180° flip around the Y axis |
|
||||||
| ```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 |
|
| ```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 |
|
| ```semi_circle(r, d = undef)``` | A semi circle in the positive Y domain |
|
||||||
| ```translate_z(z)``` | Shortcut for Z only translations |
|
| ```translate_z(z)``` | Shortcut for Z only translations |
|
||||||
| ```vflip()``` | Invert children by doing a 180° flip around the X axis |
|
| ```vflip(flip=true)``` | Invert children by doing a 180° flip around the X axis |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ module belt_test() {
|
|||||||
screw = find_screw(hs_cs_cap, pulley_bore(pulley));
|
screw = find_screw(hs_cs_cap, pulley_bore(pulley));
|
||||||
insert = screw_insert(screw);
|
insert = screw_insert(screw);
|
||||||
|
|
||||||
rotate([0, flip ? 180 : 0, 0]) {
|
hflip(flip) {
|
||||||
pulley_assembly(pulley);
|
pulley_assembly(pulley);
|
||||||
translate_z(pulley_height(pulley) + pulley_offset(pulley) + screw_head_depth(screw, pulley_bore(pulley)))
|
translate_z(pulley_height(pulley) + pulley_offset(pulley) + screw_head_depth(screw, pulley_bore(pulley)))
|
||||||
screw(screw, 20);
|
screw(screw, 20);
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 106 KiB |
@@ -39,8 +39,8 @@ function r2sides4n(r) = floor((r2sides(r) + 3) / 4) * 4;
|
|||||||
function limit(x, min, max) = max(min(x, max), min); //! Force x in range min <= x <= max
|
function limit(x, min, max) = max(min(x, max), min); //! Force x in range min <= x <= max
|
||||||
|
|
||||||
module translate_z(z) translate([0, 0, z]) children(); //! Shortcut for Z only translations
|
module translate_z(z) translate([0, 0, z]) children(); //! Shortcut for Z only translations
|
||||||
module vflip() rotate([180, 0, 0]) children(); //! Invert children by doing a 180° flip around the X axis
|
module vflip(flip=true) rotate([flip ? 180 : 0, 0, 0]) children(); //! Invert children by doing a 180° flip around the X axis
|
||||||
module hflip() rotate([0, 180, 0]) children(); //! Invert children by doing a 180° flip around the Y axis
|
module hflip(flip=true) rotate([0, flip ? 180: 0, 0]) children(); //! Invert children by doing a 180° flip around the Y axis
|
||||||
module ellipse(xr, yr) scale([1, yr / xr]) circle4n(xr); //! Draw an ellipse
|
module ellipse(xr, yr) scale([1, yr / xr]) circle4n(xr); //! Draw an ellipse
|
||||||
|
|
||||||
function slice_str(str, start, end, s ="") = start >= end ? s : slice_str(str, start + 1, end, str(s, str[start])); // Helper for slice()
|
function slice_str(str, start, end, s ="") = start >= end ? s : slice_str(str, start + 1, end, str(s, str[start])); // Helper for slice()
|
||||||
|
@@ -29,7 +29,7 @@ function camera_lens(type) = type[4]; //! Stack of lens parts, can be r
|
|||||||
function camera_connector_pos(type) = type[5]; //! The flex connector block for the camera itself's position
|
function camera_connector_pos(type) = type[5]; //! The flex connector block for the camera itself's position
|
||||||
function camera_connector_size(type)= type[6]; //! The flex connector block for the camera itself's size
|
function camera_connector_size(type)= type[6]; //! The flex connector block for the camera itself's size
|
||||||
|
|
||||||
module camera_lens(type, offset = 0) //! Draw the lens stack, with optional offset for making a clearance hole
|
module camera_lens(type, offset = 0, show_lens = true) //! Draw the lens stack, with optional offset for making a clearance hole
|
||||||
color(grey(20))
|
color(grey(20))
|
||||||
translate(camera_lens_offset(type))
|
translate(camera_lens_offset(type))
|
||||||
for(p = camera_lens(type)) {
|
for(p = camera_lens(type)) {
|
||||||
@@ -39,24 +39,25 @@ module camera_lens(type, offset = 0) //! Draw the lens stack, with optional offs
|
|||||||
if(size.x)
|
if(size.x)
|
||||||
rounded_rectangle(size + [2 * offset, 2 * offset, round_to_layer(offset)], r, center = false);
|
rounded_rectangle(size + [2 * offset, 2 * offset, round_to_layer(offset)], r, center = false);
|
||||||
else
|
else
|
||||||
translate_z(size.y)
|
if (show_lens)
|
||||||
rotate_extrude()
|
translate_z(size.y)
|
||||||
difference() {
|
rotate_extrude()
|
||||||
square([r, size.z + round_to_layer(offset)]);
|
difference() {
|
||||||
|
square([r, size.z + round_to_layer(offset)]);
|
||||||
|
|
||||||
if(app)
|
if(app)
|
||||||
translate([0, size.z])
|
translate([0, size.z])
|
||||||
hull() {
|
hull() {
|
||||||
translate([0, -eps])
|
translate([0, -eps])
|
||||||
square([app.y, eps * 2]);
|
square([app.y, eps * 2]);
|
||||||
|
|
||||||
translate([0, -app.z])
|
translate([0, -app.z])
|
||||||
square([app.x, app.z]);
|
square([app.x, app.z]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module camera(type) { //! Draw specified PCB camera
|
module camera(type, show_lens = true) { //! Draw specified PCB camera
|
||||||
vitamin(str("camera(", type[0], "): ", type[1]));
|
vitamin(str("camera(", type[0], "): ", type[1]));
|
||||||
pcb = camera_pcb(type);
|
pcb = camera_pcb(type);
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ module camera(type) { //! Draw specified PCB camera
|
|||||||
pcb(pcb);
|
pcb(pcb);
|
||||||
|
|
||||||
translate_z(pcb_thickness(pcb)) {
|
translate_z(pcb_thickness(pcb)) {
|
||||||
camera_lens(type);
|
camera_lens(type, show_lens = show_lens);
|
||||||
|
|
||||||
conn = camera_connector_size(type);
|
conn = camera_connector_size(type);
|
||||||
if(conn) {
|
if(conn) {
|
||||||
|
Reference in New Issue
Block a user