Rectangle with one curved edge

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

Rectangle with one curved edge

John Tucker

I've embarrassed myself by asking stupid things on this list before;

I hope this isn't another. I'm trying to make a bit of a fiddly part.

It's to be a positive of an existing jaw which will later be a negative

(differenced) insert for a fit-over part.

 

The cross section is basically a rectangle with one side slightly

convex and the corners are slightly radiused. I had my first

printing (SLS) made without the convex face and the fit was

unacceptable. My question is: Is it possible to make an

intersection of an arc of a circle and a rectangle made by hulling

circles ?

 

Here's one of my attempts:

CX=9.525; // Cross section

CR=1; // Corner (fillet) Radius

X=CX-CR; // Cen to Cen of Circles

H=CX-9; // Cord height

R=(pow(CX,2)+(4*pow(H,2)))/(8*H);

$fn=64;

 

echo("radius= ",R);

 

module jawx(){

hull(){

translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical

translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt

translate([-X/2,X/2])circle(CR);

translate([-X/2,-X/2])circle(CR);

}

}

 

intersection(){ //

% linear_extrude(height=12) circle(r=R); // Extrude the disc

translate([2*X-(.5*H),0,0])

# linear_extrude(height=12) jawx(); // Extrude rect jaw x-section

}

 

I'm still using that crufty OpenSCAD version 2012.05.26 on Debian

3.2.86-1 i686 GNU/Linux.

 

TIA for any clues.


_______________________________________________
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: Rectangle with one curved edge

MichaelAtOz
Administrator
Something like this:

intersection(){ //
    linear_extrude(height=12)
        circle(r=R); // Extrude the disc
    translate([2*X-(.5*H),-CX/2,0])
        cube([CX,CX,12]);
}
translate([2*X-(.5*H),0,0])
    linear_extrude(height=12)
    jawx(); // Extrude rect jaw x-section


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!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rectangle with one curved edge

Ronaldo
In reply to this post by John Tucker
Don't be embarrassed. Even those who don't act makes mistakes.

Hull() doesn't help here.

To get a rectangle with rounded edges, intersect circles:

$fn = 120;
module arc_square(sx,sy,Rx,Ry) render()
intersection(){
    translate([-Rx+sx/2,0]) circle(Rx);
    translate([ Rx-sx/2,0]) circle(Rx);
    translate([0,-Ry+sy/2]) circle(Ry);
    translate([0, Ry-sy/2]) circle(Ry);
}   


To round vertices, use offset:

offset(r) square([a,b], center=true);



To get both, a little math is needed:

a = 30; // rectangle width
b = 20; // rectangle height
e = 2;  // rect. side bulge

Rx = e/2 + b*b/e/8;
Ry = e/2 + a*a/e/8; echo(Rx, Ry);
r = 3;
color("blue")
offset(r)
arc_square(a+2*e-2*r,b+2*e-2*r,Rx,Ry);
# translate([0,0,2]) square([a,b],center=true); // just to compare

/*
Using Pythagoras
R^2 = (R-e)^2 + (a/2)^2
0 = -2*e*R + e^2 + (a/2)^2
R = e/2 + (a/2)^2 / e / 2
*/


Now just linear_extrude() this polygon.

BTW, to make a cylinder you don't need linear_extrude().


2017-04-05 21:57 GMT-03:00 John Tucker <[hidden email]>:

I've embarrassed myself by asking stupid things on this list before;

I hope this isn't another. I'm trying to make a bit of a fiddly part.

It's to be a positive of an existing jaw which will later be a negative

(differenced) insert for a fit-over part.

 

The cross section is basically a rectangle with one side slightly

convex and the corners are slightly radiused. I had my first

printing (SLS) made without the convex face and the fit was

unacceptable. My question is: Is it possible to make an

intersection of an arc of a circle and a rectangle made by hulling

circles ?

 

Here's one of my attempts:

CX=9.525; // Cross section

CR=1; // Corner (fillet) Radius

X=CX-CR; // Cen to Cen of Circles

H=CX-9; // Cord height

R=(pow(CX,2)+(4*pow(H,2)))/(8*H);

$fn=64;

 

echo("radius= ",R);

 

module jawx(){

hull(){

translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical

translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt

translate([-X/2,X/2])circle(CR);

translate([-X/2,-X/2])circle(CR);

}

}

 

intersection(){ //

% linear_extrude(height=12) circle(r=R); // Extrude the disc

translate([2*X-(.5*H),0,0])

# linear_extrude(height=12) jawx(); // Extrude rect jaw x-section

}

 

I'm still using that crufty OpenSCAD version 2012.05.26 on Debian

3.2.86-1 i686 GNU/Linux.

 

TIA for any clues.


_______________________________________________
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: Rectangle with one curved edge

frankv
Minkowski() is a good way to radius corners.

On 6/04/2017 14:59, "Ronaldo Persiano" <[hidden email]> wrote:
Don't be embarrassed. Even those who don't act makes mistakes.

Hull() doesn't help here.

To get a rectangle with rounded edges, intersect circles:

$fn = 120;
module arc_square(sx,sy,Rx,Ry) render()
intersection(){
    translate([-Rx+sx/2,0]) circle(Rx);
    translate([ Rx-sx/2,0]) circle(Rx);
    translate([0,-Ry+sy/2]) circle(Ry);
    translate([0, Ry-sy/2]) circle(Ry);
}   


To round vertices, use offset:

offset(r) square([a,b], center=true);



To get both, a little math is needed:

a = 30; // rectangle width
b = 20; // rectangle height
e = 2;  // rect. side bulge

Rx = e/2 + b*b/e/8;
Ry = e/2 + a*a/e/8; echo(Rx, Ry);
r = 3;
color("blue")
offset(r)
arc_square(a+2*e-2*r,b+2*e-2*r,Rx,Ry);
# translate([0,0,2]) square([a,b],center=true); // just to compare

/*
Using Pythagoras
R^2 = (R-e)^2 + (a/2)^2
0 = -2*e*R + e^2 + (a/2)^2
R = e/2 + (a/2)^2 / e / 2
*/


Now just linear_extrude() this polygon.

BTW, to make a cylinder you don't need linear_extrude().


2017-04-05 21:57 GMT-03:00 John Tucker <[hidden email]>:

I've embarrassed myself by asking stupid things on this list before;

I hope this isn't another. I'm trying to make a bit of a fiddly part.

It's to be a positive of an existing jaw which will later be a negative

(differenced) insert for a fit-over part.

 

The cross section is basically a rectangle with one side slightly

convex and the corners are slightly radiused. I had my first

printing (SLS) made without the convex face and the fit was

unacceptable. My question is: Is it possible to make an

intersection of an arc of a circle and a rectangle made by hulling

circles ?

 

Here's one of my attempts:

CX=9.525; // Cross section

CR=1; // Corner (fillet) Radius

X=CX-CR; // Cen to Cen of Circles

H=CX-9; // Cord height

R=(pow(CX,2)+(4*pow(H,2)))/(8*H);

$fn=64;

 

echo("radius= ",R);

 

module jawx(){

hull(){

translate([X/2-(1.15*H),X/2])circle(CR); // 1.15 empirical

translate([X/2-(1.15*H),-X/2])circle(CR);// to approx tang pt

translate([-X/2,X/2])circle(CR);

translate([-X/2,-X/2])circle(CR);

}

}

 

intersection(){ //

% linear_extrude(height=12) circle(r=R); // Extrude the disc

translate([2*X-(.5*H),0,0])

# linear_extrude(height=12) jawx(); // Extrude rect jaw x-section

}

 

I'm still using that crufty OpenSCAD version 2012.05.26 on Debian

3.2.86-1 i686 GNU/Linux.

 

TIA for any clues.


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

Re: Rectangle with one curved edge

MichaelAtOz
Administrator
> one side slightly convex

> using that crufty OpenSCAD version 2012.05.26

Thus no offset()
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!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rectangle with one curved edge

Ronaldo
2017-04-06 0:33 GMT-03:00 MichaelAtOz <[hidden email]>:
> one side slightly convex

> using that crufty OpenSCAD version 2012.05.26

Thus no offset()

Does it have minkowski() ?

module offset(r) {
    very_big = 1e16; // something greater then the children size
    render()
    if(r>0)
        minkowski(){
            children();
            circle(r);
        }
    else
        difference(){
            square(very_big-1,center=true);
            minkowski(){
                difference(){
                    square(very_big,center=true);
                    children();
                }
                circle(-r);
            }
        }
}       
 


_______________________________________________
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: Rectangle with one curved edge

nophead
Ronaldo,
  Why does your offset square example above have slightly curved edges? It should have straight edges and rounded corners and does when I try it.

On 6 April 2017 at 05:22, Ronaldo Persiano <[hidden email]> wrote:
2017-04-06 0:33 GMT-03:00 MichaelAtOz <[hidden email]>:
> one side slightly convex

> using that crufty OpenSCAD version 2012.05.26

Thus no offset()

Does it have minkowski() ?

module offset(r) {
    very_big = 1e16; // something greater then the children size
    render()
    if(r>0)
        minkowski(){
            children();
            circle(r);
        }
    else
        difference(){
            square(very_big-1,center=true);
            minkowski(){
                difference(){
                    square(very_big,center=true);
                    children();
                }
                circle(-r);
            }
        }
}       
 


_______________________________________________
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: Rectangle with one curved edge

John Tucker
In reply to this post by John Tucker

Just got the daily digest ... thanks to all who helped ...

Embarrassment is ok with me, it forces me to go further on my

own instead of looking for easy solutions. I'm in awe of

those of you on this forum that are so willing to help and

divert your attention from more serious things.

 

I'm on digest mode and will have to now work with the

suggestions all of you have contributed. Thanks again to all.

 


_______________________________________________
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: Rectangle with one curved edge

Ronaldo
In reply to this post by nophead
2017-04-06 7:24 GMT-03:00 nop head <[hidden email]>:
Ronaldo,
  Why does your offset square example above have slightly curved edges? It should have straight edges and rounded corners and does when I try it.

 
You are right. The second image is a wrong image. That is what I should have include instead:




I should correct myself in the statement that hull() would not help here. It is possible to do it just with hull, without offset() or minkowski(). But the the math would be a little more complicate and I mention it here for completeness. The solution would be the intersection of the rounded edge rectangle with 4 big triangles with rounded vertices (a hull of 3 circles) well dimensioned and positioned.


_______________________________________________
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: Rectangle with one curved edge

Ronaldo
In reply to this post by John Tucker
John,

One more detail about my solution. The assignment $fn=120; may not be adequate depending on the rectangle sizes you need. A better choice would be:

$fn = 100*max(Rx/sx,Ry/sy);

That assignment should be inside arc_square() just after intersection(){  . A value of $fn=32 might be enough for the circles inside module offset() .


2017-04-06 13:16 GMT-03:00 John Tucker <[hidden email]>:

Just got the daily digest ... thanks to all who helped ...

Embarrassment is ok with me, it forces me to go further on my

own instead of looking for easy solutions. I'm in awe of

those of you on this forum that are so willing to help and

divert your attention from more serious things.

 

I'm on digest mode and will have to now work with the

suggestions all of you have contributed. Thanks again to all.


_______________________________________________
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: Rectangle with one curved edge

cbernhardt
In reply to this post by John Tucker
Do you have access to a CAD program that produces a DXF file?
The simple way would be to draw the profile in cad using your exact dimensions and then import it into OpenSCAD.
Loading...