Here is a refined, finalized metric thread library for OpenSCAD. It's minimal/simple, and has no external dependencies e.g. no deps. on BOSL/BOSL2. It's optimized for rendering in F5/preview mode. It consists of approx. 400 lines of code which includes extensive comments (without comments probably 300 lines of code). You would use it like this:
diameter = 3.0;
pitch = 0.5;
fine = 2; // Set to one to use default segment granularity.
segments = metric_thread_segments(diameter) * fine;
union() {
length = 4.0;
start = -0.3;
external_metric_thread(diameter, pitch, length, z_start= start,
bottom_lead_in= true, top_lead_in= true,
top_relief= true, fn= segments);
translate([0, 0, start]) {
cylinder(r= metric_thread_minor_radius(diameter, pitch, false),
h= length, center= false, $fn= segments); }
}
union() {
length = 2.8;
start = -1.7;
internal_metric_thread(diameter, pitch, length, z_start= start,
bottom_chamfer= true, top_chamfer= true,
fn= segments);
translate([0, 0, length/2 + start]) {
difference() {
cube([diameter2, diameter2, length], center= true);
cylinder(r= metric_thread_major_radius(diameter, pitch, true),
h= length * 1.125, center= true, $fn= segments);
}
}}
The above would produce something that looks like this:
[threads.png]
The thread library resides here, and it consists of a single file: https://sourceforge.net/p/nl10/code/HEAD/tree/scad/common/metric-threads.scad
I have a little Youtube presentation/introduction of this code: https://www.youtube.com/watch?v=3nc-cSm7oQk
The reason why I'm presenting this is because I am gradually migrating over from OpenSCAD to CadQuery and I want to leave behind some of the most useful stuff I wrote. It will be forgotten about unless I introduce it now.
Thanks and good luck. Happy coding.
Sent with Proton Mail secure email.
Nice. If I already have BOSL2 installed, does your software do
something that BOSL2 does not do? Or MCAD? or ThreadLib?
On 1/26/2024 2:14 PM, neri-engineering via Discuss wrote:
Here is a refined, finalized metric thread library for OpenSCAD. It's
minimal/simple, and has no external dependencies e.g. no deps. on
BOSL/BOSL2. It's optimized for rendering in F5/preview mode. It
consists of approx. 400 lines of code which includes extensive
comments (without comments probably 300 lines of code). You would use
it like this:
diameter = 3.0;
pitch = 0.5;
fine = 2; // Set to one to use default segment granularity.
segments = metric_thread_segments(diameter) * fine;
union() {
length = 4.0;
start = -0.3;
external_metric_thread(diameter, pitch, length, z_start= start,
bottom_lead_in= true, top_lead_in= true,
top_relief= true, fn= segments);
translate([0, 0, start]) {
cylinder(r= metric_thread_minor_radius(diameter, pitch, false),
h= length, center= false, $fn= segments); }
}
union() {
length = 2.8;
start = -1.7;
internal_metric_thread(diameter, pitch, length, z_start= start,
bottom_chamfer= true, top_chamfer= true,
fn= segments);
translate([0, 0, length/2 + start]) {
difference() {
cube([diameter2, diameter2, length], center= true);
cylinder(r= metric_thread_major_radius(diameter, pitch, true),
h= length * 1.125, center= true, $fn= segments);
}
}
}
The above would produce something that looks like this:
threads.png
The thread library resides here, and it consists of a single file:
https://sourceforge.net/p/nl10/code/HEAD/tree/scad/common/metric-threads.scad
I have a little Youtube presentation/introduction of this code:
https://www.youtube.com/watch?v=3nc-cSm7oQk
The reason why I'm presenting this is because I am gradually migrating
over from OpenSCAD to CadQuery and I want to leave behind some of the
most useful stuff I wrote. It will be forgotten about unless I
introduce it now.
Thanks and good luck. Happy coding.
Sent with Proton Mail https://proton.me/ secure email.
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
Probably not. I would guess that BOSL can do much more. I offer it here as a very lightweight option, so that lots of dependencies are not needed when wanting to do something simple.
Sent with Proton Mail secure email.
On Friday, January 26th, 2024 at 1:22 PM, jon via Discuss discuss@lists.openscad.org wrote:
Nice. If I already have BOSL2 installed, does your software do something that BOSL2 does not do? Or MCAD? or ThreadLib?
On 1/26/2024 2:14 PM, neri-engineering via Discuss wrote:
Here is a refined, finalized metric thread library for OpenSCAD. It's minimal/simple, and has no external dependencies e.g. no deps. on BOSL/BOSL2. It's optimized for rendering in F5/preview mode. It consists of approx. 400 lines of code which includes extensive comments (without comments probably 300 lines of code). You would use it like this:
diameter = 3.0;
pitch = 0.5;
fine = 2; // Set to one to use default segment granularity.
segments = metric_thread_segments(diameter) * fine;
union() {
length = 4.0;
start = -0.3;
external_metric_thread(diameter, pitch, length, z_start= start,
bottom_lead_in= true, top_lead_in= true,
top_relief= true, fn= segments);
translate([0, 0, start]) {
cylinder(r= metric_thread_minor_radius(diameter, pitch, false),
h= length, center= false, $fn= segments); }
}
union() {
length = 2.8;
start = -1.7;
internal_metric_thread(diameter, pitch, length, z_start= start,
bottom_chamfer= true, top_chamfer= true,
fn= segments);
translate([0, 0, length/2 + start]) {
difference() {
cube([diameter2, diameter2, length], center= true);
cylinder(r= metric_thread_major_radius(diameter, pitch, true),
h= length * 1.125, center= true, $fn= segments);
}
} }
The above would produce something that looks like this:
[threads.png]
The thread library resides here, and it consists of a single file: https://sourceforge.net/p/nl10/code/HEAD/tree/scad/common/metric-threads.scad
I have a little Youtube presentation/introduction of this code: https://www.youtube.com/watch?v=3nc-cSm7oQk
The reason why I'm presenting this is because I am gradually migrating over from OpenSCAD to CadQuery and I want to leave behind some of the most useful stuff I wrote. It will be forgotten about unless I introduce it now.
Thanks and good luck. Happy coding.
Sent with Proton Mail secure email.
OpenSCAD mailing list
To unsubscribe send an email to
discuss-leave@lists.openscad.org
http://www.avg.com/email-signature Virus-free.www.avg.com#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2
https://www.thingiverse.com/thing:2989174 😉
From: neri-engineering via Discuss discuss@lists.openscad.org
Sent: 26 January 2024 21:14:54
To: OpenSCAD general discussion Mailing-list
Cc: neri-engineering
Subject: [OpenSCAD] Lightweight Metric Thread Library
Here is a refined, finalized metric thread library for OpenSCAD. It's minimal/simple, and has no external dependencies e.g. no deps. on BOSL/BOSL2. It's optimized for rendering in F5/preview mode. It consists of approx. 400 lines of code which includes extensive comments (without comments probably 300 lines of code). You would use it like this:
diameter = 3.0;
pitch = 0.5;
fine = 2; // Set to one to use default segment granularity.
segments = metric_thread_segments(diameter) * fine;
union() {
length = 4.0;
start = -0.3;
external_metric_thread(diameter, pitch, length, z_start= start,
bottom_lead_in= true, top_lead_in= true,
top_relief= true, fn= segments);
translate([0, 0, start]) {
cylinder(r= metric_thread_minor_radius(diameter, pitch, false),
h= length, center= false, $fn= segments); }
}
union() {
length = 2.8;
start = -1.7;
internal_metric_thread(diameter, pitch, length, z_start= start,
bottom_chamfer= true, top_chamfer= true,
fn= segments);
translate([0, 0, length/2 + start]) {
difference() {
cube([diameter2, diameter2, length], center= true);
cylinder(r= metric_thread_major_radius(diameter, pitch, true),
h= length * 1.125, center= true, $fn= segments);
}
}
}
The above would produce something that looks like this:
[threads.png]
The thread library resides here, and it consists of a single file: https://sourceforge.net/p/nl10/code/HEAD/tree/scad/common/metric-threads.scad
I have a little Youtube presentation/introduction of this code: https://www.youtube.com/watch?v=3nc-cSm7oQk
The reason why I'm presenting this is because I am gradually migrating over from OpenSCAD to CadQuery and I want to leave behind some of the most useful stuff I wrote. It will be forgotten about unless I introduce it now.
Thanks and good luck. Happy coding.
Sent with Proton Mailhttps://proton.me/ secure email.