1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-05 06:57:27 +02:00

Added facility to display camera without lens.

This commit is contained in:
Martin Budden
2020-11-21 20:45:39 +00:00
parent 1dbfafd366
commit 5c577cccd0

View File

@@ -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,6 +39,7 @@ 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
if (show_lens)
translate_z(size.y) translate_z(size.y)
rotate_extrude() rotate_extrude()
difference() { difference() {
@@ -56,7 +57,7 @@ module camera_lens(type, offset = 0) //! Draw the lens stack, with optional offs
} }
} }
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) {