mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-09-09 06:31:32 +02:00
Added male screw threads.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
//! Threaded pillars. Each end can be male or female.
|
||||
//
|
||||
include <../core.scad>
|
||||
use <../utils/thread.scad>
|
||||
|
||||
function pillar_name(type) = type[1]; //! Name of part
|
||||
function pillar_thread(type) = type[2]; //! Thread diameter
|
||||
@@ -41,30 +42,43 @@ module pillar(type) { //! Draw specified pillar
|
||||
sex = str(sex(pillar_bot_thread(type)),"/", sex(pillar_top_thread(type)));
|
||||
height = pillar_height(type);
|
||||
thread_d = pillar_thread(type);
|
||||
bot_thread_l = pillar_bot_thread(type);
|
||||
top_thread_l = pillar_top_thread(type);
|
||||
thread_colour = pillar_i_colour(type) * (show_threads ? 0.7 : 1);
|
||||
|
||||
vitamin(str("pillar(", type[0], "): Pillar ", pillar_name(type), " ", sex, " M", thread_d, "x", height));
|
||||
|
||||
color(thread_colour) {
|
||||
if(bot_thread_l > 0)
|
||||
translate_z(-bot_thread_l + eps)
|
||||
if(show_threads)
|
||||
male_metric_thread(thread_d, metric_coarse_pitch(thread_d), bot_thread_l, false, false);
|
||||
else
|
||||
cylinder(h = bot_thread_l, d = thread_d);
|
||||
|
||||
if(top_thread_l > 0)
|
||||
translate_z(height + top_thread_l - eps)
|
||||
if(show_threads)
|
||||
vflip()
|
||||
male_metric_thread(thread_d, metric_coarse_pitch(thread_d), top_thread_l, false, false);
|
||||
else
|
||||
cylinder(h = top_thread_l, d = thread_d);
|
||||
}
|
||||
|
||||
color(pillar_i_colour(type)) {
|
||||
if(pillar_bot_thread(type) > 0)
|
||||
translate_z(-pillar_bot_thread(type))
|
||||
cylinder(h = pillar_bot_thread(type) + eps, d = pillar_thread(type));
|
||||
|
||||
if(pillar_top_thread(type) > 0)
|
||||
translate_z(height - eps)
|
||||
cylinder(h = pillar_top_thread(type) + eps, d = pillar_thread(type));
|
||||
|
||||
linear_extrude(height = height)
|
||||
difference() {
|
||||
circle(d = pillar_id(type), $fn = fn(pillar_ifn(type)));
|
||||
circle(d = pillar_thread(type));
|
||||
circle(d = thread_d);
|
||||
}
|
||||
|
||||
top = height + min(pillar_top_thread(type), 0);
|
||||
bot = -min(pillar_bot_thread(type), 0);
|
||||
top = height + min(top_thread_l, 0);
|
||||
bot = -min(bot_thread_l, 0);
|
||||
|
||||
translate_z(bot)
|
||||
cylinder(h = top - bot, d = pillar_thread(type) + eps);
|
||||
cylinder(h = top - bot, d = thread_d + eps);
|
||||
}
|
||||
|
||||
if(pillar_od(type) > pillar_id(type))
|
||||
color(pillar_o_colour(type)) linear_extrude(height = height)
|
||||
difference() {
|
||||
|
Reference in New Issue
Block a user