how to make a screw thread

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

how to make a screw thread

yassir-Mdf
Hi everyone,

I'm currently working on some 3D-Objects that can be mounted on a PCB Chip.
So there is one component that has some sort of screw thread on it. How can
I achieve it? Is there more than one way to do it?

Thanks again God Bless



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

OpenSCAD mailing list-2
Consider one of the many OpenSCAD thread libraries on Thingiverse and other locations. One can specify metric or Imperial threads, inside or outside, lead-in and lead-out and other features.

Unless you like complex coding, the library route beats the ground-up method any day.

On Friday, October 16, 2020, 9:49:43 AM EDT, yassir-Mdf <[hidden email]> wrote:


Hi everyone,

I'm currently working on some 3D-Objects that can be mounted on a PCB Chip.
So there is one component that has some sort of screw thread on it. How can
I achieve it? Is there more than one way to do it?

Thanks again God Bless



--

_______________________________________________
OpenSCAD mailing list

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

AKADAP
If you want a more generic spiral extrude, see this:
https://www.thingiverse.com/thing:1958354
There are a few others on Thingiverse with different features, but this one
is mine.

Unfortunately, there is no way to do this cleanly in OpenSCAD, and until
someone implements it directly in OpenSCAD, or OpenSCAD gives access to the
lists of points of an object, all of these things can at best be
approximations.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

nophead
Not sure why threads are any more approximations than anything in OpenSCAD. I.e. there are no true curves, all straight line approximations, but you can have as many facets as you want to make them look smooth. See https://github.com/nophead/NopSCADlib#Thread

image.png

On Fri, 16 Oct 2020 at 18:17, AKADAP <[hidden email]> wrote:
If you want a more generic spiral extrude, see this:
https://www.thingiverse.com/thing:1958354
There are a few others on Thingiverse with different features, but this one
is mine.

Unfortunately, there is no way to do this cleanly in OpenSCAD, and until
someone implements it directly in OpenSCAD, or OpenSCAD gives access to the
lists of points of an object, all of these things can at best be
approximations.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
rew
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

rew
On Fri, Oct 16, 2020 at 06:44:54PM +0100, nop head wrote:
> Not sure why threads are any more approximations than anything in OpenSCAD.
> I.e. there are no true curves, all straight line approximations, but you
> can have as many facets as you want to make them look smooth. See

In 1985 in my "computer graphics" class Prof Blinn suggested to use
3rd degree splines for everything. These are "approximations" just
like the straight linesegments, but match so much better with what you
actually want that you can suffice with WAY less segments for curved
objects that the added complexity is worth it. Best case you convert
to (straight) segments at the last possible moment e.g. by giving the
3D printer not straight segments to print but a 3rd degree polynomial
to follow....

As an example: A circle needs to be chopped up into 4 segments that
form a pretty good approximation to a circle that you can't tell the
difference.

The thing is: Would it be possible to calculate the intersection line
between two curved surfaces? So for example when I have a sphere at
the origin radius 3 and a sphere at 5,0,0 radius 3, these intersect on
a circle. To calculate the intersection or difference between these
two spheres we'll need that circle at x=2.5 as the boundary. The math
is going to be difficult....

it's not going to happen, I know, but I can always dream..... :-)

        Roger.

--
** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

nophead
I had to solve the circle intersection problem only the other day to make a cable chain bend correctly. The end of each link lies on the intersection of the bend arc and the arc the link makes revolving around its hinge joint. I looked for the solution online and it suggested solving the simultaneous quadratic circle equations.  I came up with my own method instead which used the cosine rule and seems a lot easier. https://github.com/nophead/NopSCADlib/blob/master/utils/maths.scad#L150. Only 2D in one plane at the moment.
  

On Sun, 18 Oct 2020 at 12:31, Rogier Wolff <[hidden email]> wrote:
On Fri, Oct 16, 2020 at 06:44:54PM +0100, nop head wrote:
> Not sure why threads are any more approximations than anything in OpenSCAD.
> I.e. there are no true curves, all straight line approximations, but you
> can have as many facets as you want to make them look smooth. See

In 1985 in my "computer graphics" class Prof Blinn suggested to use
3rd degree splines for everything. These are "approximations" just
like the straight linesegments, but match so much better with what you
actually want that you can suffice with WAY less segments for curved
objects that the added complexity is worth it. Best case you convert
to (straight) segments at the last possible moment e.g. by giving the
3D printer not straight segments to print but a 3rd degree polynomial
to follow....

As an example: A circle needs to be chopped up into 4 segments that
form a pretty good approximation to a circle that you can't tell the
difference.

The thing is: Would it be possible to calculate the intersection line
between two curved surfaces? So for example when I have a sphere at
the origin radius 3 and a sphere at 5,0,0 radius 3, these intersect on
a circle. To calculate the intersection or difference between these
two spheres we'll need that circle at x=2.5 as the boundary. The math
is going to be difficult....

it's not going to happen, I know, but I can always dream..... :-)

        Roger.

--
** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
rew
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

rew
On Sun, Oct 18, 2020 at 12:48:47PM +0100, nop head wrote:
> I had to solve the circle intersection problem only the other day to make a
> cable chain bend correctly. The end of each link lies on the intersection
> of the bend arc and the arc the link makes revolving around its hinge
> joint. I looked for the solution online and it suggested solving the
> simultaneous quadratic circle equations.  I came up with my own method
> instead which used the cosine rule and seems a lot easier.
> https://github.com/nophead/NopSCADlib/blob/master/utils/maths.scad#L150.
> Only 2D in one plane at the moment.

Yeah, getting the intersection between spheres, circles, arcs is
doable. But what I was talking about is to support 3rd degree splines
as a primitive in openscad. Then when I say I want a sphere, openscad
would approximate that with 8 patches of a 3rd degree spline. Then
when those intersect with another object, e.g. another sphere or a
cylinder, then openscad would have to intersect those splines because
by that time the knowledge that this used to be a sphere is gone.

Just like nowadays the sphere is approximated with a bunch of
triangles. This makes finding the intersections between objects
simple: To find the intersection line between two objects, you just
intersect the planes of each triangle, and when the intersection line
falls within the triangles, you've found an intersection line.

x=1.8;
intersection () {
  translate ([-x,0,0]) sphere (3);
  translate ([5-x,0,0]) sphere (4);
}

Note that here the line lying on the edge of the object oscilates
between positive X and negative X. Think of how much more accurate
this shape would've been if we'd used splines.

        Roger.

> On Sun, 18 Oct 2020 at 12:31, Rogier Wolff <[hidden email]> wrote:
>
> > On Fri, Oct 16, 2020 at 06:44:54PM +0100, nop head wrote:
> > > Not sure why threads are any more approximations than anything in
> > OpenSCAD.
> > > I.e. there are no true curves, all straight line approximations, but you
> > > can have as many facets as you want to make them look smooth. See
> >
> > In 1985 in my "computer graphics" class Prof Blinn suggested to use
> > 3rd degree splines for everything. These are "approximations" just
> > like the straight linesegments, but match so much better with what you
> > actually want that you can suffice with WAY less segments for curved
> > objects that the added complexity is worth it. Best case you convert
> > to (straight) segments at the last possible moment e.g. by giving the
> > 3D printer not straight segments to print but a 3rd degree polynomial
> > to follow....
> >
> > As an example: A circle needs to be chopped up into 4 segments that
> > form a pretty good approximation to a circle that you can't tell the
> > difference.
> >
> > The thing is: Would it be possible to calculate the intersection line
> > between two curved surfaces? So for example when I have a sphere at
> > the origin radius 3 and a sphere at 5,0,0 radius 3, these intersect on
> > a circle. To calculate the intersection or difference between these
> > two spheres we'll need that circle at x=2.5 as the boundary. The math
> > is going to be difficult....
> >
> > it's not going to happen, I know, but I can always dream..... :-)
> >
> >         Roger.
> >
> > --
> > ** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110
> > **
> > **    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
> > f equals m times a. When your f is steady, and your m is going down
> > your a is going up.  -- Chris Hadfield about flying up the space shuttle.
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >

> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


--
** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

adrianv
In reply to this post by rew
Doug Moen's CURV program uses curved representations instead of segments.  

https://github.com/curv3d/curv


rew wrote

> On Fri, Oct 16, 2020 at 06:44:54PM +0100, nop head wrote:
>> Not sure why threads are any more approximations than anything in
>> OpenSCAD.
>> I.e. there are no true curves, all straight line approximations, but you
>> can have as many facets as you want to make them look smooth. See
>
> In 1985 in my "computer graphics" class Prof Blinn suggested to use
> 3rd degree splines for everything. These are "approximations" just
> like the straight linesegments, but match so much better with what you
> actually want that you can suffice with WAY less segments for curved
> objects that the added complexity is worth it. Best case you convert
> to (straight) segments at the last possible moment e.g. by giving the
> 3D printer not straight segments to print but a 3rd degree polynomial
> to follow....





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

doug.moen
In reply to this post by rew
On Sun, Oct 18, 2020, at 7:31 AM, Rogier Wolff wrote:

> In 1985 in my "computer graphics" class Prof Blinn suggested to use
> 3rd degree splines for everything. These are "approximations" just
> like the straight linesegments, but match so much better with what you
> actually want that you can suffice with WAY less segments for curved
> objects that the added complexity is worth it. Best case you convert
> to (straight) segments at the last possible moment e.g. by giving the
> 3D printer not straight segments to print but a 3rd degree polynomial
> to follow....
>
> As an example: A circle needs to be chopped up into 4 segments that
> form a pretty good approximation to a circle that you can't tell the
> difference.
>
> The thing is: Would it be possible to calculate the intersection line
> between two curved surfaces?

My understanding is that you can compute boolean operations on 3D spline boundary representations of 3D objects. There are CAD programs that do this. It's computationally complex and expensive (just as booleans on triangle meshes are in OpenSCAD), and furthermore, the results are approximate. My sense is that exact booleans on 3rd degree polynomials require at least higher order polynomials in the general case. Also, I've read that the computations are numerically unstable, so in practice you aren't guaranteed to get a valid result.

I think FreeCAD supports boolean operations, and you can script it in Python. FreeCAD also supports triangle meshes. So maybe that's an option, if you really want to work with splines.

If you want mathematically exact boolean operations on curved surfaces, you can achieve this using volume representations, instead of boundary representations (signed distance fields or SDFs). You can represent a wide range of algebraic curves exactly, and you have exact booleans that are also fast and mathematically trivial.

If you want to try 3D modelling with SDFs, there is my Curv project (github.com/curv3d/curv) and Matt Keeter's libfive (github.com/libfive/libfive).

If you want to 3D print a model with curved surfaces, the best option is to use a top tier slicer program, which means you first have to convert your curves into a triangle mesh, whether you are using OpenSCAD, FreeCAD (splines) or Curv (SDF). Rogier wants to "convert to straight segments at the last possible moment", and working with SDF representations gets you close to this ideal, because you can do a lot more work using exact representations (exact curved primitives, exact booleans, transforms, etc) before you finally must convert to an approximate representation. There are a few programs that generate GCODE directly from an SDF representation, but I haven't tried any of them.

Doug Moen

 > it's not going to happen, I know, but I can always dream..... :-)

>
> Roger.
>
> --
> ** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 **
> **    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
> f equals m times a. When your f is steady, and your m is going down
> your a is going up.  -- Chris Hadfield about flying up the space shuttle.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

yassir-Mdf
In reply to this post by yassir-Mdf
thanks a lot, guys



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: how to make a screw thread

JordanBrown
Find a library.

OpenSCAD bundles MCAD, and it has screws.
https://github.com/openscad/MCAD/blob/master/screw.scad

BOSL2 also has screws.
https://github.com/revarbat/BOSL2/wiki/screws.scad

There's also a number of Google hits.
https://www.google.com/search?q=openscad+screw


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org