Better way of creating a curved slope?

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

Better way of creating a curved slope?

slippyr4
I need to make what I can best describe as a curved slope. I can’t describe it well, but if you would care to run the following you would see.

// r1 = inner radius, r2 = outer radius, h1 = start height, h2 = end height, a = sweep angle
module curve_slope(r1, r2, h1, h2, a)
{
    h_increment = (h2-h1)/a;
    step=1;

    union()
    {
        for (i = [0:step:a])
        {
            rotate([0,0,i])
            rotate_extrude(angle=step)
            translate([r1,0,0])
            square([r2-r1,h1 + h_increment * i]);
        }
    }
   
}


curve_slope(45,60,0,20,90);



This does approximate exactly what I want, but it ends up being very inefficient in terms of polygon count, and is essentially a staircase rather than a smooth surface. If you choose a step value to create a smooth slope then the polygon count shoots up and rendering is really slow.

Is there a better way?


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

Re: Better way of creating a curved slope?

JordanBrown
Build a polyhedron.

Others may have cleverer ways built on top of sweep functions - I don't know, I've never used them - but here's an example from first principles.  It's set up for the Customizer, so that's an easy way to play with the parameters. 



// Curved Ramp

// Angular distance of ramp
a = 90;
// Inside radius
r1 = 45;
// Outside radius
r2 = 60;
// Height at start
h1 = 0;
// Height at end
h2 = 20;
// Number of steps
n = 100;   // [2:10000]

curved_slope(r1, r2, h1, h2, a, n);

module curved_slope(r1, r2, h1, h2, a, n) {
    assert(r1 > 0);
    assert(r2 > r1);
    assert(h1 >= 0);
    assert(h2 >= 0);
    assert(h1 > 0 || h2 > 0);
    assert(a > 0);
    assert(a < 360);    // Likely badness if start touches end
    assert(n > 1);
    
    // All of the indexes of the steps
    indexes = [0:n-1];
    // The fraction represented by each step
    ticks = [ for (i=indexes) i/(n-1) ];
    // The angle for each step
    angles = [ for (i=ticks) i*a ];
    // The height at each step
    heights = [ for (i=ticks) h1 + (h2-h1)*i ];
    // The inner and outter 2D points at each step
    inner = [ for (i = indexes) torect2([r1, angles[i]]) ];
    outer = [ for (i = indexes) torect2([r2, angles[i]]) ];
    // The outlines of the final shape
    inner_bottom = [ for (i = indexes) [ inner[i].x, inner[i].y, 0 ] ];
    inner_top = [ for (i = indexes) [ inner[i].x, inner[i].y, heights[i] ] ];
    outer_bottom = [ for (i = indexes) [ outer[i].x, outer[i].y, 0 ] ];
    outer_top = [ for (i = indexes) [ outer[i].x, outer[i].y, heights[i] ] ];

    // Now we build the actual polyhedron data

    // All of the points
    points = concat(inner_bottom, inner_top, outer_bottom, outer_top);

    // The base point indexes of each segment
    ib = n*0;   // inside bottom
    it = n*1;   // inside top
    ob = n*2;   // outside bottom
    ot = n*3;   // outside top

    // Connect those points all up into triangles, except the ends are quads.
    faces = concat(
        // bottom
        [ for (i = indexes) if (i != 0) [ ib + i, ob + i-1, ob + i ] ],
        [ for (i = indexes) if (i != 0) [ ib + i, ib + i-1, ob + i-1 ] ],
        // inside
        [ for (i = indexes) if (i != 0) [ ib + i, it + i, it + i-1 ] ],
        [ for (i = indexes) if (i != 0) [ ib + i, it + i-1, ib + i-1 ] ],
        // outside
        [ for (i = indexes) if (i != 0) [ ob + i, ot + i-1, ot + i ] ],
        [ for (i = indexes) if (i != 0) [ ob + i, ob + i-1, ot + i-1 ] ],
        // top
        [ for (i = indexes) if (i != 0) [ it + i, ot + i, ot + i-1 ] ],
        [ for (i = indexes) if (i != 0) [ it + i, ot + i-1, it + i-1 ] ],
        // h1 end
        [ if (h1 > 0) [ ib+0, it+0, ot+0, ob+0 ] ],
        // h2 end
        [ if (h2 > 0) [ ib+n-1, ob+n-1, ot+n-1, it+n-1 ] ]
    );

    // And build the final shape.
    polyhedron(points=points, faces=faces);
}
    
// Given a [rho, theta], transform to an [x,y].
function torect2(p) = [
    p[0] * cos(p[1]),
    p[0] * sin(p[1])
];


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

Re: Better way of creating a curved slope?

slippyr4


> On 26 Feb 2021, at 16:22, Jordan Brown <[hidden email]> wrote:
>
> Build a polyhedron.
>

Thank you. That solution looks absolutely perfect, it’s orders of magnitude more efficient than mine.
I think I must have somewhat ignored polyhedron() when I first learned openscad so despite it being right there, never really contemplated it’s utility until now.




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

Re: Better way of creating a curved slope?

adrianv
In reply to this post by JordanBrown
I say it's silly to go to that much work every time you want to use polyhedron.  The problem with polyhedron is that you have got to do all this book keeping.  And it's easy to botch it, sometimes in subtle ways which make your result invalid.  To me it makes much more sense to use general purpose polyhedron making routines like skin() and sweep() functions.    Here's the simplest change on the original code to make the shape using skin() from BOSL2 which just links together a series of polygons and does all the polyhedron book keeping for you.  

https://github.com/revarbat/BOSL2/wiki

include <BOSL2/std.scad>
include <BOSL2/skin.scad>
 
// r1 = inner radius, r2 = outer radius, h1 = start height, h2 = end height, a = sweep angle
module curve_slope(r1, r2, h1, h2, a)
{
    h_increment = (h2-h1)/a;
    step=1;
    profiles = [for (i = [0:step:a])
                   rot(i,p=[[r1,0,0],
                            [r2,0,0],
                            [r2,0,h_increment*i],
                            [r1,0,h_increment*i]])
    ];
    skin(profiles, slices=0);   // slices=0 means insert no extra slices between given polygons
}

curve_slope(45,60,0,20,90);




Maybe it's a quirk of mine, but I dislike long skinny triangles in my models.  They give a kind of corrugated look to models and I think you end up needing more of them to get a good looking model than with proper equlateralish triangles.  So here's an adjustment the subdivides the top:

// r1 = inner radius, r2 = outer radius, h1 = start height, h2 = end height, a = sweep angle
module curve_slope(r1, r2, h1, h2, a)
{
    h_increment = (h2-h1)/a;
    step=1;
    profiles = [for (i = [0:step:a])
                   rot(i,p=[[r1,0,0],
                            [r2,0,0],
                            each lerp([r2,0,h_increment*i],[r1,0,h_increment*i],
                                      [for(j=[0:1:5]) j/5])
                           ])
    ];
    skin(profiles, slices=0);
}






JordanBrown wrote
Build a polyhedron.

Others may have cleverer ways built on top of sweep functions - I don't
know, I've never used them - but here's an example from first
principles.  It's set up for the Customizer, so that's an easy way to
play with the parameters. 


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
Reply | Threaded
Open this post in threaded view
|

Re: Better way of creating a curved slope?

JordanBrown
On 2/26/2021 1:55 PM, adrianv wrote:
I say it's silly to go to that much work every time you want to use polyhedron.  The problem with polyhedron is that you have got to do all this book keeping.  And it's easy to botch it, sometimes in subtle ways which make your result invalid.  To me it makes much more sense to use general purpose polyhedron making routines like skin() and sweep() functions.

No argument.  I've done so very little with such shapes that it's easier, or at least not much harder, for me to do it from first principles than to learn how to use a library that will do it easier.  This one really is a pretty simple shape.

And because I've done it so infrequently - I might have designed fewer than ten polyhedra, ever - it was kind of fun.  (My major project has 11K lines of OpenSCAD, and *zero* polyhedra.  It originally had one, but I found a simpler way and got rid of it.)

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

Re: Better way of creating a curved slope?

JordanBrown
In reply to this post by JordanBrown
Fun tidbit:  If you disable some of the asserts in my module, you can do things like have negative heights, negative radii, and so on.  If you turn on View/Thrown Together, you can see that these tend to result in some or all of the figure being inside out.

https://www.imdb.com/title/tt0177789/quotes?item=qt0424466
https://www.youtube.com/watch?v=_wMD0ZCh2Sc

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

Re: Better way of creating a curved slope?

Parkinbot
In reply to this post by slippyr4
With all that advanced stuff, we shouldn't forget that there is a simple solution with native means for this specific problem:

r1 = 60; 
r2 = 45; 
h = 15; 

$fn=70; 
intersection()
{
  linear_extrude(h, twist=-90, convexity = 5)
  {
    intersection()
    {
      difference()
      {
        circle(r1); 
        circle(r2); 
      }
      square(r1); 
    }
  }
  cube([r1, r1, h]); 
} 


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
Reply | Threaded
Open this post in threaded view
|

Openscad is often almost perfect

mondo
Sometimes, i look at what is possible using openscad, in just a few
lines I can produce something that using some other cad software, would
be tedious, to say the least. And then it can be 3D printed, giving a
'needed' functional item that would be tricky to make in some other way.
This is a feather board, if you are familiar with a table saw or router,
you will know what it is. It is clamped by an 8mm coach bolt, but it is
trivial to resize it to whatever size is required. It prints OK in Petg
(pla may be too brittle), with 4 walls or so, maybe 10% infill. It will
work with far fewer fingers, of course, but it will let you keep all
your fingers!

module arm(){
difference(){
union(){
difference(){
cylinder(15,50,50);
     translate([5,0,0])cylinder(15,40,40);
         translate([-80,0,0])cube(100);
}
translate([-43,0,0]) cylinder (15,12,12); //round end
}
translate([-43,0,0]) cube([9,9,115],true);// 9mm squarehole
}
}

//arm();

module finger(){
     rotate([0,0,-130]){
translate([-1,0,0])cube([2,30 ,15]);  //2mm thick fingers
}
}

//finger();

module fingers(){
for (i=[-90:4:70]){
rotate([0,0,i])translate([0,-48,0])finger();
}
}


$fn=100;

difference(){
union(){
arm();
fingers();
}
translate([35,-21,0])rotate([0,0,30])cube(100); // chop off end

difference(){                    //'flatten' ends
     cylinder (15,200,200);
     cylinder(15,70,70);
}
}


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

Re: Better way of creating a curved slope?

adrianv
In reply to this post by Parkinbot
That's a clever approach that I completely overlooked.  I suppose I tend to forget about the twist parameter for linear_extrude, perhaps in part because it usually produces a bad result with how the shape is triangulated.  But in this case it's OK.

Parkinbot wrote
With all that advanced stuff, we shouldn't forget that there is a simple
solution with native means for this specific problem:






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


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
Reply | Threaded
Open this post in threaded view
|

Re: Openscad is often almost perfect

OpenSCAD mailing list-2
In reply to this post by mondo
That's an interesting construct. I've not seen a radial fingerboard before.
How do you feel about converting it to a parametric version?

On Saturday, February 27, 2021, 10:46:07 AM EST, Ray West <[hidden email]> wrote:


Sometimes, i look at what is possible using openscad, in just a few
lines I can produce something that using some other cad software, would
be tedious, to say the least. And then it can be 3D printed, giving a
'needed' functional item that would be tricky to make in some other way.
This is a feather board, if you are familiar with a table saw or router,
you will know what it is. It is clamped by an 8mm coach bolt, but it is
trivial to resize it to whatever size is required. It prints OK in Petg
(pla may be too brittle), with 4 walls or so, maybe 10% infill. It will
work with far fewer fingers, of course, but it will let you keep all
your fingers!

module arm(){
difference(){
union(){
difference(){
cylinder(15,50,50);
    translate([5,0,0])cylinder(15,40,40);
        translate([-80,0,0])cube(100);
}
translate([-43,0,0]) cylinder (15,12,12); //round end
}
translate([-43,0,0]) cube([9,9,115],true);// 9mm squarehole
}
}

//arm();

module finger(){
    rotate([0,0,-130]){
translate([-1,0,0])cube([2,30 ,15]);  //2mm thick fingers
}
}

//finger();

module fingers(){
for (i=[-90:4:70]){
rotate([0,0,i])translate([0,-48,0])finger();
}
}


$fn=100;

difference(){
union(){
arm();
fingers();
}
translate([35,-21,0])rotate([0,0,30])cube(100); // chop off end

difference(){                    //'flatten' ends
    cylinder (15,200,200);
    cylinder(15,70,70);

}
}


_______________________________________________
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: Openscad is often almost perfect

alexgibson

That’s a really interesting design – but I mostly want to agree and +1 your sentiment.

 

It’s healthy to want to improve and change things – but there are things OpenSCAD can do and enable that would be far harder than other software, and I am very grateful to the developers for their hard work to make and keep it working!

 

Cheers,

 

Alex Gibson

 

admg consulting

 

edumaker limited

 

·         Project management

·         Operations & Process improvement

·         3D Printing

 

From: Discuss [mailto:[hidden email]] On Behalf Of fred via Discuss
Sent: 27 February 2021 16:18
To: OpenSCAD general discussion
Cc: fred
Subject: Re: [OpenSCAD] Openscad is often almost perfect

 

That's an interesting construct. I've not seen a radial fingerboard before.

How do you feel about converting it to a parametric version?

 

On Saturday, February 27, 2021, 10:46:07 AM EST, Ray West <[hidden email]> wrote:

 

 

Sometimes, i look at what is possible using openscad, in just a few
lines I can produce something that using some other cad software, would
be tedious, to say the least. And then it can be 3D printed, giving a
'needed' functional item that would be tricky to make in some other way.
This is a feather board, if you are familiar with a table saw or router,
you will know what it is. It is clamped by an 8mm coach bolt, but it is
trivial to resize it to whatever size is required. It prints OK in Petg
(pla may be too brittle), with 4 walls or so, maybe 10% infill. It will
work with far fewer fingers, of course, but it will let you keep all
your fingers!

module arm(){
difference(){
union(){
difference(){
cylinder(15,50,50);
    translate([5,0,0])cylinder(15,40,40);
        translate([-80,0,0])cube(100);
}
translate([-43,0,0]) cylinder (15,12,12); //round end
}
translate([-43,0,0]) cube([9,9,115],true);// 9mm squarehole
}
}

//arm();

module finger(){
    rotate([0,0,-130]){
translate([-1,0,0])cube([2,30 ,15]);  //2mm thick fingers
}
}

//finger();

module fingers(){
for (i=[-90:4:70]){
rotate([0,0,i])translate([0,-48,0])finger();
}
}


$fn=100;

difference(){
union(){
arm();
fingers();
}
translate([35,-21,0])rotate([0,0,30])cube(100); // chop off end

difference(){                    //'flatten' ends
    cylinder (15,200,200);
    cylinder(15,70,70);


}
}


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

 

Virus-free. www.avg.com

 


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

Re: Better way of creating a curved slope?

nophead
In reply to this post by adrianv
I think the triangulation for linear extrude with twist has been improved recently by the theHans.

On Sat, 27 Feb 2021 at 16:07, adrianv <[hidden email]> wrote:
That's a clever approach that I completely overlooked.  I suppose I tend to forget about the twist parameter for linear_extrude, perhaps in part because it usually produces a bad result with how the shape is triangulated.  But in this case it's OK.

Parkinbot wrote
With all that advanced stuff, we shouldn't forget that there is a simple
solution with native means for this specific problem:






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


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
|

Re: Better way of creating a curved slope?

adrianv
Is that in a dev version?  Because when I try

intersection(){
  linear_extrude(15, twist=90, convexity=8)
    square(10,center=true);
  translate([50/2,0,0])cube(50,center=true);
}  

I get this pretty terrible result:



Making this model well requires either a lot more horizontal slices (which I find ugly) or resampling the square to have more than four points so that you aren't trying to approximate the curved sides with long triangles.  




nophead wrote
I think the triangulation for linear extrude with twist has been improved
recently by the theHans.

On Sat, 27 Feb 2021 at 16:07, adrianv <[hidden email]> wrote:

> That's a clever approach that I completely overlooked.  I suppose I tend
> to forget about the twist parameter for linear_extrude, perhaps in part
> because it usually produces a bad result with how the shape is
> triangulated.  But in this case it's OK.
>
> Parkinbot wrote
> With all that advanced stuff, we shouldn't forget that there is a simple
> solution with native means for this specific problem:
>
>
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> <http:///user/SendEmail.jtp?type=email&email=Discuss%40.openscad>
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> ------------------------------
> Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/>
> 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


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
Reply | Threaded
Open this post in threaded view
|

Re: Better way of creating a curved slope?

nophead
I think the improvement was just picking the best diagonal to split the quads, so yes, to twist something with few vertices you still need to add some manually to get roughly square quads.

On Sat, 27 Feb 2021 at 18:39, adrianv <[hidden email]> wrote:
Is that in a dev version?  Because when I try

intersection(){
  linear_extrude(15, twist=90, convexity=8)
    square(10,center=true);
  translate([50/2,0,0])cube(50,center=true);
}  

I get this pretty terrible result:



Making this model well requires either a lot more horizontal slices (which I find ugly) or resampling the square to have more than four points so that you aren't trying to approximate the curved sides with long triangles.  




nophead wrote
I think the triangulation for linear extrude with twist has been improved
recently by the theHans.

On Sat, 27 Feb 2021 at 16:07, adrianv <[hidden email]> wrote:

> That's a clever approach that I completely overlooked.  I suppose I tend
> to forget about the twist parameter for linear_extrude, perhaps in part
> because it usually produces a bad result with how the shape is
> triangulated.  But in this case it's OK.
>
> Parkinbot wrote
> With all that advanced stuff, we shouldn't forget that there is a simple
> solution with native means for this specific problem:
>
>
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> <http:///user/SendEmail.jtp?type=email&email=Discuss%40.openscad>
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> ------------------------------
> Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/>
> 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


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
|

Re: Openscad is often almost perfect

mondo
In reply to this post by alexgibson

I guess, I, or anyone, could replace the values with a list of variables. But that sort of defeats my quick and dirty solution for me. The part that would give me the headache, would be calculating the angle and location of the final cube which is used to 'chop off the end' . For the various sizes I've printed this, I manually adjust it as needed. The curved shape acts as a jamming cam, provided there is enough friction between the wood and the plastic. Some commercial versions here https://www.youtube.com/watch?v=jMiwsGaX2f4 (at about 6:50).

On 27/02/2021 16:58, Alex Gibson wrote:

That’s a really interesting design – but I mostly want to agree and +1 your sentiment.

 

It’s healthy to want to improve and change things – but there are things OpenSCAD can do and enable that would be far harder than other software, and I am very grateful to the developers for their hard work to make and keep it working!

 

Cheers,

 

Alex Gibson

 

admg consulting

 

edumaker limited

 

·         Project management

·         Operations & Process improvement

·         3D Printing

 

From: Discuss [[hidden email]] On Behalf Of fred via Discuss
Sent: 27 February 2021 16:18
To: OpenSCAD general discussion
Cc: fred
Subject: Re: [OpenSCAD] Openscad is often almost perfect

 

That's an interesting construct. I've not seen a radial fingerboard before.

How do you feel about converting it to a parametric version?

 

On Saturday, February 27, 2021, 10:46:07 AM EST, Ray West [hidden email] wrote:

 

 

Sometimes, i look at what is possible using openscad, in just a few
lines I can produce something that using some other cad software, would
be tedious, to say the least. And then it can be 3D printed, giving a
'needed' functional item that would be tricky to make in some other way.
This is a feather board, if you are familiar with a table saw or router,
you will know what it is. It is clamped by an 8mm coach bolt, but it is
trivial to resize it to whatever size is required. It prints OK in Petg
(pla may be too brittle), with 4 walls or so, maybe 10% infill. It will
work with far fewer fingers, of course, but it will let you keep all
your fingers!

module arm(){
difference(){
union(){
difference(){
cylinder(15,50,50);
    translate([5,0,0])cylinder(15,40,40);
        translate([-80,0,0])cube(100);
}
translate([-43,0,0]) cylinder (15,12,12); //round end
}
translate([-43,0,0]) cube([9,9,115],true);// 9mm squarehole
}
}

//arm();

module finger(){
    rotate([0,0,-130]){
translate([-1,0,0])cube([2,30 ,15]);  //2mm thick fingers
}
}

//finger();

module fingers(){
for (i=[-90:4:70]){
rotate([0,0,i])translate([0,-48,0])finger();
}
}


$fn=100;

difference(){
union(){
arm();
fingers();
}
translate([35,-21,0])rotate([0,0,30])cube(100); // chop off end

difference(){                    //'flatten' ends
    cylinder (15,200,200);
    cylinder(15,70,70);


}
}


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

 

Virus-free. www.avg.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
|

Re: Better way of creating a curved slope?

adrianv
In reply to this post by nophead
No, the improvement is not the result of flipping the diagonals on the long quads.  The improvement is the result of using square quads instead of very long narrow ones.   I think OpenSCAD does the best it can under the constraint of using long twisted quads.  Long twisted quads are just fundamentally bad.  No matter how you pick the diagonal it's going to give an irregular shape, a poor approximation to the curve you want.  The way to fix it is to subdivide them so they're not long, but more square-like, so you have more facets to approximate the curve.  (Or subdivide them sideways so they are super narrow, which is what people more often do.  I think this requires more facets to achieve the same quality.)

nophead wrote
I think the improvement was just picking the best diagonal to split the
quads, so yes, to twist something with few vertices you still need to add
some manually to get roughly square quads.

On Sat, 27 Feb 2021 at 18:39, adrianv <[hidden email]> wrote:

> Is that in a dev version?  Because when I try
>
> intersection(){
>   linear_extrude(15, twist=90, convexity=8)
>     square(10,center=true);
>   translate([50/2,0,0])cube(50,center=true);
> }
>
> I get this pretty terrible result:
>
>
>
> Making this model well requires either a lot more horizontal slices (which
> I find ugly) or resampling the square to have more than four points so that
> you aren't trying to approximate the curved sides with long triangles.
>
>
>
>
> nophead wrote
> I think the triangulation for linear extrude with twist has been improved
> recently by the theHans.
>
> On Sat, 27 Feb 2021 at 16:07, adrianv <[hidden email]
> <http:///user/SendEmail.jtp?type=email&email=avm4%40>> wrote:
>
> > That's a clever approach that I completely overlooked.  I suppose I tend
> > to forget about the twist parameter for linear_extrude, perhaps in part
> > because it usually produces a bad result with how the shape is
> > triangulated.  But in this case it's OK.
> >
> > Parkinbot wrote
> > With all that advanced stuff, we shouldn't forget that there is a simple
> > solution with native means for this specific problem:
> >
> >
> >
> >
> >
> >
> > --
> > Sent from: http://forum.openscad.org/
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> > <http:///user/SendEmail.jtp?type=email&email=Discuss%40.openscad>
> <http:///user/SendEmail.jtp?type=email&email=Discuss%40.openscad%3E>
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >
> >
> > ------------------------------
> > Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/>
> > at Nabble.com.
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> <http:///user/SendEmail.jtp?type=email&email=Discuss%40.openscad>
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> <http:///user/SendEmail.jtp?type=email&email=Discuss%40.openscad>
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> ------------------------------
> Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/>
> 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


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
Reply | Threaded
Open this post in threaded view
|

Re: Openscad is often almost perfect

OpenSCAD mailing list-2
In reply to this post by mondo
Yeah, that's the thing about parametric modeling. One attempts to keep the assignments relative to each other in an appropriate manner. Replacing the values with assignments isn't going to work well if one does not know the precise purpose of a specific value and/or assignment.

I've done a few models, far simpler than this, in which the assignments broke when I made a single change. It's worthwhile in the long run, for some models, allowing for scaling changes without problems appearing.

I've used hit-or-miss modeling in the past for the quick-and-dirty outputs as well.

On Saturday, February 27, 2021, 2:01:20 PM EST, Ray West <[hidden email]> wrote:


I guess, I, or anyone, could replace the values with a list of variables. But that sort of defeats my quick and dirty solution for me. The part that would give me the headache, would be calculating the angle and location of the final cube which is used to 'chop off the end' . For the various sizes I've printed this, I manually adjust it as needed. The curved shape acts as a jamming cam, provided there is enough friction between the wood and the plastic. Some commercial versions here https://www.youtube.com/watch?v=jMiwsGaX2f4 (at about 6:50).

On 27/02/2021 16:58, Alex Gibson wrote:

That’s a really interesting design – but I mostly want to agree and +1 your sentiment.

 

It’s healthy to want to improve and change things – but there are things OpenSCAD can do and enable that would be far harder than other software, and I am very grateful to the developers for their hard work to make and keep it working!

 

Cheers,

 

Alex Gibson

 

admg consulting

 

edumaker limited

 

·         Project management

·         Operations & Process improvement

·         3D Printing

 

From: Discuss [[hidden email]] On Behalf Of fred via Discuss
Sent: 27 February 2021 16:18
To: OpenSCAD general discussion
Cc: fred
Subject: Re: [OpenSCAD] Openscad is often almost perfect

 

That's an interesting construct. I've not seen a radial fingerboard before.

How do you feel about converting it to a parametric version?

 

On Saturday, February 27, 2021, 10:46:07 AM EST, Ray West [hidden email] wrote:

 

 

Sometimes, i look at what is possible using openscad, in just a few
lines I can produce something that using some other cad software, would
be tedious, to say the least. And then it can be 3D printed, giving a
'needed' functional item that would be tricky to make in some other way.
This is a feather board, if you are familiar with a table saw or router,
you will know what it is. It is clamped by an 8mm coach bolt, but it is
trivial to resize it to whatever size is required. It prints OK in Petg
(pla may be too brittle), with 4 walls or so, maybe 10% infill. It will
work with far fewer fingers, of course, but it will let you keep all
your fingers!

module arm(){
difference(){
union(){
difference(){
cylinder(15,50,50);
    translate([5,0,0])cylinder(15,40,40);
        translate([-80,0,0])cube(100);
}
translate([-43,0,0]) cylinder (15,12,12); //round end
}
translate([-43,0,0]) cube([9,9,115],true);// 9mm squarehole
}
}

//arm();

module finger(){
    rotate([0,0,-130]){
translate([-1,0,0])cube([2,30 ,15]);  //2mm thick fingers
}
}

//finger();

module fingers(){
for (i=[-90:4:70]){
rotate([0,0,i])translate([0,-48,0])finger();
}
}


$fn=100;

difference(){
union(){
arm();
fingers();
}
translate([35,-21,0])rotate([0,0,30])cube(100); // chop off end

difference(){                    //'flatten' ends
    cylinder (15,200,200);
    cylinder(15,70,70);


}
}


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

 

Virus-free. www.avg.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

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

Re: Better way of creating a curved slope?

JordanBrown
In reply to this post by adrianv
On 2/27/2021 10:38 AM, adrianv wrote:
Making this model well requires either a lot more horizontal slices (which I find ugly) or resampling the square to have more than four points so that you aren't trying to approximate the curved sides with long triangles.  

I'm not understanding what you're meaning by resampling the square.  I tried changing the square to be a polygon with 11 points on each side, and the result was exactly identical to the original square.  (Which surprises me a little, based on how I think linear_extrude works.)

I agree that this is more attractive, but I'm not immediately seeing how you did it - or at least how you did it with linear_extrude.




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

Re: Better way of creating a curved slope?

nophead
I add the extra vertices to the square with minute offsets because exactly co-linear segments get removed.

module squarish(s, n) {
polygon([
for(i = [0 : n]) [i * s.x / n, s.y + (i % 2) * eps],
for(i = [0 : n]) [s.x - i * s.x / n, (i % 2) * eps],
]);
}

On Sun, 28 Feb 2021 at 00:53, Jordan Brown <[hidden email]> wrote:
On 2/27/2021 10:38 AM, adrianv wrote:
Making this model well requires either a lot more horizontal slices (which I find ugly) or resampling the square to have more than four points so that you aren't trying to approximate the curved sides with long triangles.  

I'm not understanding what you're meaning by resampling the square.  I tried changing the square to be a polygon with 11 points on each side, and the result was exactly identical to the original square.  (Which surprises me a little, based on how I think linear_extrude works.)

I agree that this is more attractive, but I'm not immediately seeing how you did it - or at least how you did it with linear_extrude.



_______________________________________________
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: Better way of creating a curved slope?

adrianv
In reply to this post by JordanBrown
I think you understand what I mean.  The problem is you cannot create a square in OpenSCAD that has vertices along its sides because collinear points are removed. Try making a square where you perturb the resampled vertices a little bit off the square so it doesn't reduce back to an actual square.  Or say a slight bulge on each of the four sides?  I would guess something like that would work.  (I haven't tried it.)  

The point I am getting at is that linear_extrude with twist is fundamentally broken because it doesn't resample the edges this way, or allow you to do it.  To get a model I think is good I had to use other methods.  I created my model in BOSL2 using skin(), which will accept any point list and doesn't "simplify" away the collinear points.  

JordanBrown wrote
On 2/27/2021 10:38 AM, adrianv wrote:
> Making this model well requires either a lot more horizontal slices
> (which I find ugly) or resampling the square to have more than four
> points so that you aren't trying to approximate the curved sides with
> long triangles.  

I'm not understanding what you're meaning by resampling the square.  I
tried changing the square to be a polygon with 11 points on each side,
and the result was exactly identical to the original square.  (Which
surprises me a little, based on how I think linear_extrude works.)

I agree that this is more attractive, but I'm not immediately seeing how
you did it - or at least how you did it with linear_extrude.

>


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


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
12