screw (thread) around a cone

classic Classic list List threaded Threaded
13 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
oda
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

oda
In reply to this post by Ronaldo
Hi,
I'm still studying ... waiting to understand your code (but I've almost succeeded).
In the meantime, I have found a much less beautiful but more comprehensible way and more of the neophytes' reach to do my cone. I post it just for the beginning person in our community:


linear_extrude(height=60,twist=825, scale=0)
square(50,center=true);


Obviously, it is only a didactic example!

Thank you again for your help!
Oda

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

Re: screw (thread) around a cone

Ronaldo
As I said, there are many solutions to your problem. Direct application of linear_extrude is the worst of them except in very specific cases (for example: http://forum.openscad.org/linear-extrude-thickness-td21345.html#a21346). The solutions with polyhedron are fast (although not so fast as with linear_extrude) and may be general but it is more technical. If you are not acquainted with polyhedron, you may use a library that encloses its use like sweep.scad. And if your thread profile is convex (as usually they are) you can apply a non-polyhedron slower approach like http://forum.openscad.org/Mirror-rotations-and-sweep-td21256.html . Anyway the computation of the thread path is inevitable in the sweep approach.
 

2017-05-05 9:22 GMT-03:00 oda <[hidden email]>:
Hi,
I'm still studying ... waiting to understand your code (but I've almost
succeeded).
In the meantime, I have found a much less beautiful but more comprehensible
way and more of the neophytes' reach to do my cone. I post it just for the
beginning person in our community:


linear_extrude(height=60,twist=825, scale=0)
square(50,center=true);


Obviously, it is only a didactic example!

Thank you again for your help!
Oda





--
View this message in context: http://forum.openscad.org/screw-thread-around-a-cone-tp20965p21409.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

caterpillar
This post was updated on .
In reply to this post by oda
How about using my helix_extrude module?

https://github.com/JustinSDK/dotSCAD/blob/master/docs/lib-helix_extrude.md

include <helix.scad>;
include <rotate_p.scad>;
include <cross_sections.scad>;
include <polysections.scad>;
include <helix_extrude.scad>;

r1 = 40;
r2 = 20;
levels = 5;
level_dist = 10;

shape_pts = [
        [0, -2], [0, 2],
        [1, 2], [1, 0],
        [9, 0], [9, 2],
        [10, 2], [10, -2]
];

helix_extrude(shape_pts,
        radius = [r1, r2],
        levels = levels,
        level_dist = level_dist,
        vt_dir = "SPI_UP"
);

%cylinder(h = levels * level_dist, r1 = r1, r2 = r2);


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

Re: screw (thread) around a cone

Ronaldo
Interesting approach. It sweeps convex eventually holed  2D shapes. However, as it breaks the sweep in so many small triangular prisms, I would expect an even longer render time.

2017-05-06 9:44 GMT-03:00 caterpillar <[hidden email]>:
How about using my *helix_extrude* module?

https://github.com/JustinSDK/dotSCAD/blob/master/docs/lib-helix_extrude.md

include <helix.scad>;
include <rotate_p.scad>;
include <cross_sections.scad>;
include <polysections.scad>;
include <helix_extrude.scad>;

r1 = 40;
r2 = 20;
levels = 5;
level_dist = 10;

shape_pts = [
        [0, -2], [0, 2],
        [1, 2], [1, 0],
        [9, 0], [9, 2],
        [10, 2], [10, -2]
];

helix_extrude(shape_pts,
        radius = [r1, r2],
        levels = levels,
        level_dist = level_dist,
        vt_dir = "SPI_UP",
        triangles = [
                [0, 1, 2],
                [0, 2, 3],
                [0, 3, 4],
                [0, 4, 7],
                [4, 5, 6],
                [4, 6, 7]
        ]
);

%cylinder(h = levels * level_dist, r1 = r1, r2 = r2);

<http://forum.openscad.org/file/n21419/lib-helix_extrude-2.jpg>




-----
http://openhome.cc
--
View this message in context: http://forum.openscad.org/screw-thread-around-a-cone-tp20965p21419.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: screw (thread) around a cone

caterpillar
This post was updated on .
In my computer, it takes about 1 minute to render this simple example.

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

Re: screw (thread) around a cone

caterpillar
In reply to this post by Ronaldo
Thanks for Ronaldo's reminder. I finally improved the extrusion performance of solid or hollow shapes. It takes short time even you render the horn below.

include <circle_path.scad>;
include <rotate_p.scad>;
include <golden_spiral.scad>;
include <cross_sections.scad>;
include <polysections.scad>;
include <golden_spiral_extrude.scad>;

$fn = 12;

shape_pts = concat(
    circle_path(radius = 3),
    circle_path(radius = 2)
);

golden_spiral_extrude(
    shape_pts,
    from = 5,
    to = 10,
    point_distance = 1,
    scale = 10,
    triangles = "HOLLOW"
);



I still reserve the triangles parameter for users who want to define a more complex shape.
Loading...