mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-27 09:10:02 -05:00
Tweaks to thread.
Better thread crest detection. No longer shrtens thread by eps (to avoid z fight) if all one colour. Comment about left hand threads.
This commit is contained in:
parent
9f4ed2b915
commit
bc919529d3
@ -5546,6 +5546,8 @@ specify a chamfer angle.
|
|||||||
Threads are by default solid, so the male version is wrapped around a cylinder and the female inside a tube. This can be suppressed to just get the helix, for
|
Threads are by default solid, so the male version is wrapped around a cylinder and the female inside a tube. This can be suppressed to just get the helix, for
|
||||||
example to make a printed pot with a screw top lid.
|
example to make a printed pot with a screw top lid.
|
||||||
|
|
||||||
|
A left hand thread can be made by using mirror([0,1]).
|
||||||
|
|
||||||
Threads with a typical 60 degree angle appear too bright with OpenSCAD's primitive lighting model as they face towards the lights more than the top and sides of
|
Threads with a typical 60 degree angle appear too bright with OpenSCAD's primitive lighting model as they face towards the lights more than the top and sides of
|
||||||
a cylinder. To get around this a colour can be passed to thread that is used to colour the cylinder and then toned down to colour the helix.
|
a cylinder. To get around this a colour can be passed to thread that is used to colour the cylinder and then toned down to colour the helix.
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 219 KiB |
@ -26,6 +26,8 @@
|
|||||||
//! Threads are by default solid, so the male version is wrapped around a cylinder and the female inside a tube. This can be suppressed to just get the helix, for
|
//! Threads are by default solid, so the male version is wrapped around a cylinder and the female inside a tube. This can be suppressed to just get the helix, for
|
||||||
//! example to make a printed pot with a screw top lid.
|
//! example to make a printed pot with a screw top lid.
|
||||||
//!
|
//!
|
||||||
|
//! A left hand thread can be made by using mirror([0,1]).
|
||||||
|
//!
|
||||||
//! Threads with a typical 60 degree angle appear too bright with OpenSCAD's primitive lighting model as they face towards the lights more than the top and sides of
|
//! Threads with a typical 60 degree angle appear too bright with OpenSCAD's primitive lighting model as they face towards the lights more than the top and sides of
|
||||||
//! a cylinder. To get around this a colour can be passed to thread that is used to colour the cylinder and then toned down to colour the helix.
|
//! a cylinder. To get around this a colour can be passed to thread that is used to colour the cylinder and then toned down to colour the helix.
|
||||||
//!
|
//!
|
||||||
@ -61,10 +63,12 @@ module thread(dia, pitch, length, profile, center = true, top = -1, bot = -1, st
|
|||||||
// Extract some properties from the profile, perhaps they should be stored in it.
|
// Extract some properties from the profile, perhaps they should be stored in it.
|
||||||
//
|
//
|
||||||
h = max([for(p = sprofile) p.y]);
|
h = max([for(p = sprofile) p.y]);
|
||||||
maxx = max([for(p = sprofile) p.x]);
|
xs = [for(p = sprofile) p.x];
|
||||||
minx = min([for(p = sprofile) p.x]);
|
maxx = max(xs);
|
||||||
crest_xmax = max([for(p = sprofile) if(p.x != maxx) p.x]);
|
minx = min(xs);
|
||||||
crest_xmin = min([for(p = sprofile) if(p.x != minx) p.x]);
|
crest_xs = [for(p = sprofile) if(p.y == h) p.x];
|
||||||
|
crest_xmax = max(crest_xs);
|
||||||
|
crest_xmin = min(crest_xs);
|
||||||
//
|
//
|
||||||
// If the ends don't taper we need an extra half turn past the ends to be cropped horizontally.
|
// If the ends don't taper we need an extra half turn past the ends to be cropped horizontally.
|
||||||
//
|
//
|
||||||
@ -129,11 +133,13 @@ module thread(dia, pitch, length, profile, center = true, top = -1, bot = -1, st
|
|||||||
render() intersection() {
|
render() intersection() {
|
||||||
polyhedron(points, ends_faces);
|
polyhedron(points, ends_faces);
|
||||||
|
|
||||||
len = length - 2 * eps;
|
shorten = !is_undef(colour);
|
||||||
|
len = shorten ? length - 2 * eps : length;
|
||||||
|
offset = shorten ? eps : 0;
|
||||||
rotate_extrude()
|
rotate_extrude()
|
||||||
if(female) {
|
if(female) {
|
||||||
difference() {
|
difference() {
|
||||||
translate([0, eps])
|
translate([0, offset])
|
||||||
square([r + h + overlap, len]);
|
square([r + h + overlap, len]);
|
||||||
|
|
||||||
if(top_chamfer_h)
|
if(top_chamfer_h)
|
||||||
@ -146,7 +152,7 @@ module thread(dia, pitch, length, profile, center = true, top = -1, bot = -1, st
|
|||||||
else
|
else
|
||||||
difference() {
|
difference() {
|
||||||
hull() {
|
hull() {
|
||||||
translate([0, eps])
|
translate([0, offset])
|
||||||
square([r, len]);
|
square([r, len]);
|
||||||
|
|
||||||
translate([0, bot_chamfer_h])
|
translate([0, bot_chamfer_h])
|
||||||
|
Loading…
Reference in New Issue
Block a user