Quantcast

screw (thread) around a cone

classic Classic list List threaded Threaded
7 messages Options
oda
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

screw (thread) around a cone

oda
This post has NOT been accepted by the mailing list yet.
Hi,
I would like to run a rope around a cone and to make it easy the thing I want to create a thread (screw) around the cone.
(i'd like do make a screw cone)
How can I do that?
Thank you in advance,
oda
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

MichaelAtOz
Administrator
oda wrote
Hi,
I would like to run a rope around a cone and to make it easy the thing I want to create a thread (screw) around the cone.
(i'd like do make a screw cone)
How can I do that?
Thank you in advance,
oda
Quoted as this post didn't make the list.
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
oda
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

oda
I'm very sorry.
I do not understand i'm asking something about openscad.
however .... SORRY!
Oda
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

MichaelAtOz
Administrator
oda wrote
I'm very sorry.
I do not understand i'm asking something about openscad.
however .... SORRY!
Oda
I'm sorry, you have nothing to be sorry about.
Your first post was before you subscribed to the mailing list.
So nobody on the list got your post.
So I replied, quoting your original post, which would send it to the mailing list for everyone to see.
Hopefully someone will have a suggestion for the cone screw.

So don't worry, we are friendly here.
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
oda
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

oda

Thank you!

I didn't understand .-P

Oda


On 03/21/17 09:48, MichaelAtOz [via OpenSCAD] wrote:
oda wrote
I'm very sorry.
I do not understand i'm asking something about openscad.
however .... SORRY!
Oda
I'm sorry, you have nothing to be sorry about.
Your first post was before you subscribed to the mailing list.
So nobody on the list got your post.
So I replied, quoting your original post, which would send it to the mailing list for everyone to see.
Hopefully someone will have a suggestion for the cone screw.

So don't worry, we are friendly here.
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!



If you reply to this email, your message will be added to the discussion below:
http://forum.openscad.org/screw-thread-around-a-cone-tp20965p20974.html
To unsubscribe from screw (thread) around a cone, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

Ronaldo
In reply to this post by oda
oda wrote
(i'd like do make a screw cone)
How can I do that?
There are many different solutions to get that model. I usually prefer to use polyhedron primitive by computing the surfaces points and facets which renders quite faster. The hard point of that way is, besides to compute the points, you will have to generate the facet combinatoric. To facilitate that generation task it is recommended to use some robust library like the Parkinbot's sweep.scad. My example here is autonomous and include 2 functions and a module to build the polyhedron instead of sweep.scad.
r = 100; // cone base radius
h = 250; // cone height
n = 20;  // # spiral points per turn
k = 8;   // # removed thread apex points
tw = 5;  // # screw twists

// screw teeth 2D profile
shape = 20*[[0,1],[0,-1],[0.7,-0.5],[0.7,0.5]];
// cone
cylinder(r1=r+0.001,r2=0.001,h=h,$fn=n);
// screw
build_screw(shape,r,h,tw,n);

module build_screw(shape,r,h,tw,n) {
    scrw = screw(shape,r,h,tw,tw*n);
    msh  = mesh2polyhedron(scrw);
    fac1 = polygon2polyhedron(scrw[0],true);
    fac2 = polygon2polyhedron(scrw[len(scrw)-1]);
    make_polyhedron([msh,fac1,fac2], convexity = 10);
}

// screw surface mesh
function screw(shp,r,h,tw,n) =
    [for(i=[0:n-k]) let(ang=360*i/n)
     [for(j=[0:len(shp)])
         let(p = [shp[j%len(shp)][0],0,shp[j%len(shp)][1]])
         tr(p,ang,r,h,tw)] ];
// map 3D point p to cone spiral at angle 0<= ang <=360
function tr(p,ang,r,h,tw) =
    let( a=tw*ang, b=atan2(r,h) )
    rotZ(tw*ang)*rotY(b)*p +
    [ r*(1-ang/360)*cos(tw*ang),
      r*(1-ang/360)*sin(tw*ang),
      h*ang/360 ] ;

function rotZ(a) =
    [[ cos(a), -sin(a), 0],
     [ sin(a),  cos(a), 0],
     [ 0,       0,      1] ];
function rotY(a) =
    [[ cos(a), 0, -sin(a)],
     [ 0,      1, 0      ],
     [ sin(a), 0, cos(a) ] ];

// unify all polyhedron data of list polys
// in one polyhedron call
// polys[i] has the format [points, faces]
module make_polyhedron(polys, convexity = 10) {
    vertlist = [for(p=polys, pt=p[0]) pt]; // collect all verts from polyhedra
    vertlen  = [for(p=polys) p[0] ];
    acclen   = acc_len(vertlen);
    facets   = [ for(i=[0:len(polys)-1], f=polys[i][1] ) [ for(v=f) acclen[i]+v ] ];

    polyhedron(
        points = vertlist,
        faces  = facets,
        convexity = convexity
    );
    function _accum_sum(l, offs=0, res=[]) =
        len(res) == len(l) ?
            res :
            _accum_sum(l, offs+l[len(res)], concat(res, [ offs+l[len(res)] ] ));

    function acc_len( f ) =
        concat([0], _accum_sum([ for(fi=f) len(fi) ]));
}

// generates polyhedron data for a mesh,
// a rectangular matrix of 3D points
function mesh2polyhedron(mesh, rev =false) =
    let( n = len(mesh) != 0 ? len(mesh) : 0,
         m = n==0 ? 0 : len(mesh[0]) != 0 ? len(mesh[0]) : 0 ,
         l = n*m)
    l > 0 ?
        let( range    = rev  ? [len(mesh)-1: -1: 0] : [0:len(mesh)-1],
             vertices = l == 0 ? [] : [ for(i=range) for(pt=mesh[i]) pt ],    
             tris = concat(  [ for(i=[0:n-2],j=[0:m-2]) [ i*m+j, i*m+j+1, (i+1)*m+j ] ] ,
                         [ for(i=[0:n-2],j=[0:m-2]) [ i*m+j+1, (i+1)*m+j+1, (i+1)*m+j ] ] ) )
        [ vertices, tris ]:
        [] ;

// generates polyhedron data for a closed polygonal face
function polygon2polyhedron(polygon, rev =false) =
     let( vertices  = polygon,
          range     = rev  ? [len(polygon)-1: -1: 0] : [0:len(polygon)-1],
          facets    = [[for(i=range) i ]] )
    [ vertices, facets ];


The math of the spiral along a cone is in function tr(). The function screw() generates a mesh of points for the screw surface based on a given thread profile. The module build_screw() produces the polyhedron by calling the last 3 auxiliary functions and module. The cone itself is generated by a simple cylinder.

The profile of the screw thread is defined by the variable shape, a list of 2D points ( [x,y] ). In this example, the profile is a parallelogram but many other simple polygons may be used here. To lay the profile upon the cone surface it must have a vertical edge x=0 and all points should have y>=0.
oda
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

oda
I find it wonderful that code and mathematics can create complex models, but I find it more wonderful still find people on the other side of the world to spend their time to help other people: thank you for your help.
I will study your code as soon as possible.
Oda
Loading...