Nabble has removed Mailing-list integration.
Posts created here DO NOT GET SENT TO THE MAILING LIST.
Mailing-list emails DO NOT GET POSTED TO THE FORUM.
So basically the Forum is now out of date, we are looking into migrating the history.

# Better way of creating a curved slope?

30 messages
12
Open this post in threaded view
|

## Better way of creating a curved slope?

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

## Re: Better way of creating a curved slope?

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

## Re: Better way of creating a curved slope?

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

## Re: Better way of creating a curved slope?

Open this post in threaded view
|

## Re: Better way of creating a curved slope?

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

## Re: Better way of creating a curved slope?

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

## Re: Better way of creating a curved slope?

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

## Openscad is often almost perfect

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

## Re: Better way of creating a curved slope?

Open this post in threaded view
|

## Re: Openscad is often almost perfect

Open this post in threaded view
|

## Re: Openscad is often almost perfect

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

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
Cc: fred

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

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);

}
}

_______________________________________________
[hidden email]

 Virus-free. www.avg.com

_______________________________________________
[hidden email]
Open this post in threaded view
|

## Re: Better way of creating a curved slope?

Open this post in threaded view
|

## Re: Better way of creating a curved slope?

Open this post in threaded view
|

## Re: Better way of creating a curved slope?

Open this post in threaded view
|

## Re: Openscad is often almost perfect

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

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
Cc: fred

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

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);

}
}

_______________________________________________
[hidden email]

 Virus-free. www.avg.com

```_______________________________________________
[hidden email]
```

_______________________________________________
[hidden email]
Open this post in threaded view
|

## Re: Better way of creating a curved slope?

Open this post in threaded view
|

## Re: Openscad is often almost perfect

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

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
Cc: fred

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

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);

}
}

_______________________________________________
[hidden email]

 Virus-free. www.avg.com

```_______________________________________________
[hidden email]
```
_______________________________________________
[hidden email]

_______________________________________________
[hidden email]
Open this post in threaded view
|

## Re: Better way of creating a curved slope?

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

## Re: Better way of creating a curved slope?

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.

_______________________________________________
[hidden email]