discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

BOSL2 rounding edges of rect_tube

BR
Bob Roos
Mon, Dec 26, 2022 3:15 PM

Hi Adrian,

THANK YOU  Good point about the include.  Thank you for the example it works perfectly for me.  I see why you say T/4 because I only made the outer width +T instead of +2*T.  There wasn't enough wall thickness to allow T/2 rounding.
I will study your example and dig into the meaning and use of the new to me parameters.
 
Bob

Monday, December 26, 2022, 9:14:47 AM, you wrote:

I suggest posting fully valid code for users who may not realize that you're using BOSL2 or know what that means.  Omitting the include may be confusing to some. 

Yes, the natural way to make a box in OpenSCAD is to make the outside and subtract the inside.  However, your rounding as shown is too big to be applied to the top edge on both sides.  If you're satisfied with decreasing the rounding and using a rounding of T/4 everywhere, then doing it like this is reasonable:

include<BOSL2/std.scad>

$fn=32;
T=1.8;
W=53.5;
L=70;
diff()
  cuboid(size=[W,L,2T], rounding=T/4)
    tag("remove")up(T/2+.01)cuboid([W-T,L-T,1
T],rounding=-T/4,edges=TOP);

If you're planning to 3d print this you may want to use the teardrop option to the outer cuboid, because circular roundings are often problematic without support. 

Note to Jay:  BOSL2's cuboid() can round individual edges, but also can round by groupings, so edges=TOP rounds all the top edges without the need to enumerate them individually.  You can also do edges=TOP, except=RIGHT to round 3 of the top edges.  In additional, cuboid can accept negative values for the roundings on the top and bottom, which then causes it to produce roundings that flare out.  That negative rounding is needed to address Bob's problem. 

Getting back to the problem at hand, if you really want the larger rounding on the outside, then I'd suggest taking a look at either rounded_prism() or offset_sweep() from rounding.scad.   I basically wrote offset_sweep for the purpose of making rounded boxes, and there are several examples showing how to use it.  You can make the outside vertical rounding anything you want and make the box thickness follow that rounding.  See the examples in the wiki.   It may be a little simpler to use rounded_prism, but it only makes continuous curvature roundings, so you won't be specifying them by radius.  Note that for either of these options, you still make the outside and subtract the inside, it's just that offset_sweep and rounded_prism can make a shape with different roundings on different edges with graceful corners where the roundings meet. 

The last approach you could use for this case would be to use the rounding masks in masks3d---you'd make the outside vertical edges unrounded and then apply the masks to them---but I think you'll get less pleasing corners compared to the other options.  And to me it seems more complicated than the other solutions.   

On Mon, Dec 26, 2022 at 3:32 AM Bob Roos roosbob@wybatap.com wrote:

Hello Discuss,

T=1.8;
W=53.5;
L=70;
union(){
        translate([0,-17,-T/2])rect_tube(size=[W,L],wall=T/2,h=2*T,rounding=T/2);
        translate([0,-17,0])cube([W-T,L-T,T],center=true);
}

I want to round the 8 horizontal top edges and the 4 outside horizontal bottom edges in addition to the already rounded side corners.
The union is there for the convenience of eliminating the generation using *

I thought about using cuboid with rounding and differencing out the top part with negative rounding on the top of the difference cuboid

Is there an easier way?  I am trying to learn how to think "OpenSCAD"

-- 
have Fun,
 Bob                           mailto:roosbob@wybatap.com

Hi Adrian, THANK YOU  Good point about the include.  Thank you for the example it works perfectly for me.  I see why you say T/4 because I only made the outer width +T instead of +2*T.  There wasn't enough wall thickness to allow T/2 rounding. I will study your example and dig into the meaning and use of the new to me parameters.   Bob Monday, December 26, 2022, 9:14:47 AM, you wrote: > I suggest posting fully valid code for users who may not realize that you're using BOSL2 or know what that means.  Omitting the include may be confusing to some.  > Yes, the natural way to make a box in OpenSCAD is to make the outside and subtract the inside.  However, your rounding as shown is too big to be applied to the top edge on both sides.  If you're satisfied with decreasing the rounding and using a rounding of T/4 everywhere, then doing it like this is reasonable: > include<BOSL2/std.scad> > $fn=32; > T=1.8; > W=53.5; > L=70; > diff() >   cuboid(size=[W,L,2*T], rounding=T/4) >     tag("remove")up(T/2+.01)cuboid([W-T,L-T,1*T],rounding=-T/4,edges=TOP); > If you're planning to 3d print this you may want to use the teardrop option to the outer cuboid, because circular roundings are often problematic without support.  > Note to Jay:  BOSL2's cuboid() can round individual edges, but also can round by groupings, so edges=TOP rounds all the top edges without the need to enumerate them individually.  You can also do edges=TOP, except=RIGHT to round 3 of the top edges.  In additional, cuboid can accept negative values for the roundings on the top and bottom, which then causes it to produce roundings that flare out.  That negative rounding is needed to address Bob's problem.  > Getting back to the problem at hand, if you really want the larger rounding on the outside, then I'd suggest taking a look at either rounded_prism() or offset_sweep() from rounding.scad.   I basically wrote offset_sweep for the purpose of making rounded boxes, and there are several examples showing how to use it.  You can make the outside vertical rounding anything you want and make the box thickness follow that rounding.  See the examples in the wiki.   It may be a little simpler to use rounded_prism, but it only makes continuous curvature roundings, so you won't be specifying them by radius.  Note that for either of these options, you still make the outside and subtract the inside, it's just that offset_sweep and rounded_prism can make a shape with different roundings on different edges with graceful corners where the roundings meet.  > The last approach you could use for this case would be to use the rounding masks in masks3d---you'd make the outside vertical edges unrounded and then apply the masks to them---but I think you'll get less pleasing corners compared to the other options.  And to me it seems more complicated than the other solutions.    > On Mon, Dec 26, 2022 at 3:32 AM Bob Roos <roosbob@wybatap.com> wrote: >> Hello Discuss, >> T=1.8; >> W=53.5; >> L=70; >> union(){ >>         translate([0,-17,-T/2])rect_tube(size=[W,L],wall=T/2,h=2*T,rounding=T/2); >>         translate([0,-17,0])cube([W-T,L-T,T],center=true); >> } >> I want to round the 8 horizontal top edges and the 4 outside horizontal bottom edges in addition to the already rounded side corners. >> The union is there for the convenience of eliminating the generation using * >> I thought about using cuboid with rounding and differencing out the top part with negative rounding on the top of the difference cuboid >> Is there an easier way?  I am trying to learn how to think "OpenSCAD" --  have Fun,  Bob                           mailto:roosbob@wybatap.com
BC
Bob Carter
Mon, Dec 26, 2022 4:46 PM

Just type "Ubuntu unlock files" into YouTube and follow the guidelines to open a terminal, su to root, and change that files permissions to 777

On 26 Dec 2022, at 13:27, Bob Roos roosbob@wybatap.com wrote:

Hi Jay,

It could have the "hidden" attribute set.  I don't speak your OS so can't offer any advice on checking the attribute.  Also notice the little LOCK icon.  It may be considered some kind of a system file and so prevented from an ordinary user's access.  You need super posers.....

Bob Roos

Monday, December 26, 2022, 7:25:22 AM, you wrote:
i have a redundant file "Connectors.scad.gAoowr" in the same folder as "Connectors.scad"

i am unable to delete it as it says it dose not exist

it is likely something to do with when i crashed openscad last week while working with "Connectors.scad" creating a circular reference by mistake, any ideas how i can get rid of it

screenshot attached

<996473276.png>

--
have Fun,
Bob                          mailto:roosbob@wybatap.com mailto:roosbob@wybatap.com_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org

Just type "Ubuntu unlock files" into YouTube and follow the guidelines to open a terminal, su to root, and change that files permissions to 777 > On 26 Dec 2022, at 13:27, Bob Roos <roosbob@wybatap.com> wrote: > > Hi Jay, > > It could have the "hidden" attribute set. I don't speak your OS so can't offer any advice on checking the attribute. Also notice the little LOCK icon. It may be considered some kind of a system file and so prevented from an ordinary user's access. You need super posers..... > > Bob Roos > > Monday, December 26, 2022, 7:25:22 AM, you wrote: > i have a redundant file "Connectors.scad.gAoowr" in the same folder as "Connectors.scad" > > i am unable to delete it as it says it dose not exist > > it is likely something to do with when i crashed openscad last week while working with "Connectors.scad" creating a circular reference by mistake, any ideas how i can get rid of it > > screenshot attached > > <996473276.png> >> > > > -- > have Fun, > Bob mailto:roosbob@wybatap.com <mailto:roosbob@wybatap.com>_______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org>
RW
Raymond West
Mon, Dec 26, 2022 5:06 PM

Hi Bob,

You can also just use Minkowski, no need for much else, but you need  to
make a few calculations, to reduce the 'core size'. Hopefully the
attached script explains the process. I would also extract the radius of
the sphere, not making it dependent on the wall thickness.

From your original info,, It looked more like a shallow tray, so I
included a value for h outside of the calculations, so you may be able
to produce more generic boxes/trays.  Minkowski needs something to 'roll
the sphere around', and as it is 3d printing, then a minimum wall of
0.0001 will give no noticeable error for a box. If the rounding radius
was smaller than half the wall thickness, then that could be dispensed
with. I've shown a section at the bottom of the script.  Often if you
round off edges, without taking care of the inside corners, it generates
a weak point. It's OK, in this case.

 t=1.8;
 w=53.5;
 l=70;
 //h= t*2;  //height
 h=10;

 ///////////////////////////////////////////

 module box(){     // this has square edges
   difference(){
      cube([w,l,h],true);  // os of box?
         translate([0,0,t])
            cube([w-t-t,l-t-t,h],true);
   }
}

//wanted same size with rounded corners of radius t/2
// make new box, t smaller, and inside t bigger since sphere of
// radius t/2 is 'offset over surface'

module box2(){
   difference(){
     cube([w-t,l-t,h-t],true);
       translate([0,0,t/2+0.0001])
         cube([w-t-.0001,l-t-.0001,h],true);  //need to give some thickness
   }
}

module rounded(){
   $fn=90;
     minkowski(){
        box2();
        sphere(r=t/2);
    }
}

intersection(){
union(){
rounded();
translate([w+5,0,0]) // compare with box with square corners
box();
}
translate ([0,0,-20])
cube(100);
}

//(remove the intersection and the box() and translate rounded() to
wherever)

On 26/12/2022 15:15, Bob Roos wrote:

Hi Adrian,

THANK YOU  Good point about the include.  Thank you for the example it
works perfectly for me.  I see why you say T/4 because I only made the
outer width +T instead of +2*T.  There wasn't enough wall thickness to
allow T/2 rounding.

I will study your example and dig into the meaning and use of the new
to me parameters.

Bob

Monday, December 26, 2022, 9:14:47 AM, you wrote:

 I suggest posting fully valid code for users who may not realize
 that you're using BOSL2 or know what that means. Omitting the
 include may be confusing to some.

 Yes, the natural way to make a box in OpenSCAD is to make the
 outside and subtract the inside.  However, your rounding as shown
 is too big to be applied to the top edge on both sides.  If you're
 satisfied with decreasing the rounding and using a rounding of T/4
 everywhere, then doing it like this is reasonable:

 include<BOSL2/std.scad>

 $fn=32;
 T=1.8;
 W=53.5;
 L=70;
 diff()
   cuboid(size=[W,L,2*T], rounding=T/4)
 tag("remove")up(T/2+.01)cuboid([W-T,L-T,1*T],rounding=-T/4,edges=TOP);

 If you're planning to 3d print this you may want to use the
 teardrop option to the outer cuboid, because circular roundings
 are often problematic without support.

 Note to Jay:  BOSL2's cuboid() can round individual edges, but
 also can round by groupings, so edges=TOP rounds all the top edges
 without the need to enumerate them individually.  You can also do
 edges=TOP, except=RIGHT to round 3 of the top edges.  In
 additional, cuboid can accept negative values for the roundings on
 the top and bottom, which then causes it to produce roundings that
 flare out. That negative rounding is needed to address Bob's problem.

 Getting back to the problem at hand, if you really want the larger
 rounding on the outside, then I'd suggest taking a look at either
 rounded_prism() or offset_sweep() from rounding.scad.   I
 basically wrote offset_sweep for the purpose of making rounded
 boxes, and there are several examples showing how to use it.  You
 can make the outside vertical rounding anything you want and make
 the box thickness follow that rounding.  See the examples in the
 wiki.   It may be a little simpler to use rounded_prism, but it
 only makes continuous curvature roundings, so you won't be
 specifying them by radius.  Note that for either of these options,
 you still make the outside and subtract the inside, it's just that
 offset_sweep and rounded_prism can make a shape with different
 roundings on different edges with graceful corners where the
 roundings meet.

 The last approach you could use for this case would be to use the
 rounding masks in masks3d---you'd make the outside vertical edges
 unrounded and then apply the masks to them---but I think you'll
 get less pleasing corners compared to the other options.  And to
 me it seems more complicated than the other solutions.

 On Mon, Dec 26, 2022 at 3:32 AM Bob Roos <roosbob@wybatap.com> wrote:

     Hello Discuss,

     T=1.8;
     W=53.5;
     L=70;
     union(){
     translate([0,-17,-T/2])rect_tube(size=[W,L],wall=T/2,h=2*T,rounding=T/2);
             translate([0,-17,0])cube([W-T,L-T,T],center=true);
     }

     I want to round the 8 horizontal top edges and the 4 outside
     horizontal bottom edges in addition to the already rounded
     side corners.
     The union is there for the convenience of eliminating the
     generation using *

     I thought about using cuboid with rounding and differencing
     out the top part with negative rounding on the top of the
     difference cuboid

     Is there an easier way?  I am trying to learn how to think
     "OpenSCAD"

     -- 
     Best regards,
      Bob                          mailto:roosbob@wybatap.com
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org

--
have Fun,
 Bob mailto:roosbob@wybatap.com mailto:roosbob@wybatap.com


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Hi Bob, You can also just use Minkowski, no need for much else, but you need  to make a few calculations, to reduce the 'core size'. Hopefully the attached script explains the process. I would also extract the radius of the sphere, not making it dependent on the wall thickness. From your original info,, It looked more like a shallow tray, so I included a value for h outside of the calculations, so you may be able to produce more generic boxes/trays.  Minkowski needs something to 'roll the sphere around', and as it is 3d printing, then a minimum wall of 0.0001 will give no noticeable error for a box. If the rounding radius was smaller than half the wall thickness, then that could be dispensed with. I've shown a section at the bottom of the script.  Often if you round off edges, without taking care of the inside corners, it generates a weak point. It's OK, in this case.  t=1.8;  w=53.5;  l=70;  //h= t*2;  //height  h=10;  ///////////////////////////////////////////  module box(){     // this has square edges    difference(){       cube([w,l,h],true);  // os of box?          translate([0,0,t])             cube([w-t-t,l-t-t,h],true);    } } //wanted same size with rounded corners of radius t/2 // make new box, t smaller, and inside t bigger since sphere of // radius t/2 is 'offset over surface' module box2(){    difference(){      cube([w-t,l-t,h-t],true);        translate([0,0,t/2+0.0001])          cube([w-t-.0001,l-t-.0001,h],true);  //need to give some thickness    } } module rounded(){    $fn=90;      minkowski(){         box2();         sphere(r=t/2);     } } intersection(){ union(){ rounded(); translate([w+5,0,0]) // compare with box with square corners box(); } translate ([0,0,-20]) cube(100); } //(remove the intersection and the box() and translate rounded() to wherever) On 26/12/2022 15:15, Bob Roos wrote: > > Hi Adrian, > > > THANK YOU  Good point about the include.  Thank you for the example it > works perfectly for me.  I see why you say T/4 because I only made the > outer width +T instead of +2*T.  There wasn't enough wall thickness to > allow T/2 rounding. > > I will study your example and dig into the meaning and use of the new > to me parameters. > > Bob > > > Monday, December 26, 2022, 9:14:47 AM, you wrote: > > I suggest posting fully valid code for users who may not realize > that you're using BOSL2 or know what that means. Omitting the > include may be confusing to some. > > Yes, the natural way to make a box in OpenSCAD is to make the > outside and subtract the inside.  However, your rounding as shown > is too big to be applied to the top edge on both sides.  If you're > satisfied with decreasing the rounding and using a rounding of T/4 > everywhere, then doing it like this is reasonable: > > include<BOSL2/std.scad> > > $fn=32; > T=1.8; > W=53.5; > L=70; > diff() >   cuboid(size=[W,L,2*T], rounding=T/4) > tag("remove")up(T/2+.01)cuboid([W-T,L-T,1*T],rounding=-T/4,edges=TOP); > > If you're planning to 3d print this you may want to use the > teardrop option to the outer cuboid, because circular roundings > are often problematic without support. > > Note to Jay:  BOSL2's cuboid() can round individual edges, but > also can round by groupings, so edges=TOP rounds all the top edges > without the need to enumerate them individually.  You can also do > edges=TOP, except=RIGHT to round 3 of the top edges.  In > additional, cuboid can accept negative values for the roundings on > the top and bottom, which then causes it to produce roundings that > flare out. That negative rounding is needed to address Bob's problem. > > Getting back to the problem at hand, if you really want the larger > rounding on the outside, then I'd suggest taking a look at either > rounded_prism() or offset_sweep() from rounding.scad.   I > basically wrote offset_sweep for the purpose of making rounded > boxes, and there are several examples showing how to use it.  You > can make the outside vertical rounding anything you want and make > the box thickness follow that rounding.  See the examples in the > wiki.   It may be a little simpler to use rounded_prism, but it > only makes continuous curvature roundings, so you won't be > specifying them by radius.  Note that for either of these options, > you still make the outside and subtract the inside, it's just that > offset_sweep and rounded_prism can make a shape with different > roundings on different edges with graceful corners where the > roundings meet. > > The last approach you could use for this case would be to use the > rounding masks in masks3d---you'd make the outside vertical edges > unrounded and then apply the masks to them---but I think you'll > get less pleasing corners compared to the other options.  And to > me it seems more complicated than the other solutions. > > On Mon, Dec 26, 2022 at 3:32 AM Bob Roos <roosbob@wybatap.com> wrote: > > Hello Discuss, > > T=1.8; > W=53.5; > L=70; > union(){ > translate([0,-17,-T/2])rect_tube(size=[W,L],wall=T/2,h=2*T,rounding=T/2); >         translate([0,-17,0])cube([W-T,L-T,T],center=true); > } > > I want to round the 8 horizontal top edges and the 4 outside > horizontal bottom edges in addition to the already rounded > side corners. > The union is there for the convenience of eliminating the > generation using * > > I thought about using cuboid with rounding and differencing > out the top part with negative rounding on the top of the > difference cuboid > > Is there an easier way?  I am trying to learn how to think > "OpenSCAD" > > -- > Best regards, >  Bob                          mailto:roosbob@wybatap.com > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > -- > have Fun, >  Bob mailto:roosbob@wybatap.com <mailto:roosbob@wybatap.com> > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org