discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

been quiet on here

RW
Raymond West
Wed, Jun 22, 2022 1:34 PM

Here's a simple paper tray.  I often cut up scrap A4 paper for
notes/shopping lists etc. The following code produces a tray to keep it
tidy. Make the dimensions a bit bigger than your cut/torn sheets.

// note box
// internal dimensions (clearance for A7 paper =11080, A6= 153110
length = 80;
width = 110;
height = 25;  // total height (external)
thick = 1.8;
gap = 20; //gap at corner
rad = 20; // corner radius

// set rad = 0, gap = -thick, for solid corners

$fn=80;

module box(){
    difference(){
      linear_extrude(height){
          difference(){
             offset(thick)
                square([length,width]);
                square([length,width]);
translate([length-gap,-2thick])square(gap+(2thick));
                     }
                            }
      translate([length-gap,0,height])
      rotate([90,0,0]) rounder(2rad);
      translate([length,gap,height])
      rotate([0,90,0]) rounder(2
rad);
               }
}

module rounder(v){
   d=v;
     translate([-d/2,-d/2,-d/2])
       difference(){
          cube(d);
            cylinder (h=d,d=d);
            translate([d,0])cylinder (h=d,d=d);
            translate([d,d])cylinder (h=d,d=d);
            translate([0,d])cylinder (h=d,d=d);
                   }
}

difference(){  // base
     linear_extrude(thick)offset(thick)square([length,width]);
        translate([length+thick,-thick])rounder(2*rad);
}
box();

// fin

Here's a simple paper tray.  I often cut up scrap A4 paper for notes/shopping lists etc. The following code produces a tray to keep it tidy. Make the dimensions a bit bigger than your cut/torn sheets. // note box // internal dimensions (clearance for A7 paper =110*80, A6= 153*110 length = 80; width = 110; height = 25;  // total height (external) thick = 1.8; gap = 20; //gap at corner rad = 20; // corner radius // set rad = 0, gap = -thick, for solid corners $fn=80; module box(){     difference(){       linear_extrude(height){           difference(){              offset(thick)                 square([length,width]);                 square([length,width]); translate([length-gap,-2*thick])square(gap+(2*thick));                      }                             }       translate([length-gap,0,height])       rotate([90,0,0]) rounder(2*rad);       translate([length,gap,height])       rotate([0,90,0]) rounder(2*rad);                } } module rounder(v){    d=v;      translate([-d/2,-d/2,-d/2])        difference(){           cube(d);             cylinder (h=d,d=d);             translate([d,0])cylinder (h=d,d=d);             translate([d,d])cylinder (h=d,d=d);             translate([0,d])cylinder (h=d,d=d);                    } } difference(){  // base      linear_extrude(thick)offset(thick)square([length,width]);         translate([length+thick,-thick])rounder(2*rad); } box(); // fin
Z
zipang@tethys.re
Wed, Jun 22, 2022 5:45 PM

Great ! Nice small and efficient code.

Great ! Nice small and efficient code.
LM
Leonard Martin Struttmann
Wed, Jun 22, 2022 6:26 PM

It's interesting to see how other people think and approach 3D design.

Here's my take on the same model.  Obviously, our minds take different
routes to the same destination.

include <LMS/AssemblyStandard.scad>

// internal dimensions (clearance for A7 paper =11080, A6= 153110
length = 80;
width = 110;
height = 25;  // total height (external)
thick = 1.8;
gap = 20; //gap at corner
rad = 20; // corner radius

$fn=80;

module roundedCutout()
{
difference()
{
cube( [ 2rad, 2rad, height ] );

translate( [ 0, 0, -E ] )
cylinder( h=height+2*E, r=rad );

}
}

module box()
{
difference()
{
cube( [ length+2thick, width+2thick, height ] );

translate( [ thick, thick, thick ] )
cube( [ length, width, height ] );

translate( [ length-rad, -E, thick ] )
cube( [ rad+2*thick+E, rad+E, height ] );

translate( [ length-rad+2*thick, rad, 0-E ] )
rotate( [ 0, 0, -90 ] )
roundedCutout();

translate( [ length-2*rad, 0.5*rad, height-rad ] )
rotate( [ 90, 0, 0 ] )
roundedCutout();

translate( [ 2*height+length-2*rad, 2*rad, height-rad ] )
rotate( [ 90, 0, -90 ] )
roundedCutout();

}
}

box();

On Wed, Jun 22, 2022 at 12:45 PM zipang@tethys.re wrote:

Great ! Nice small and efficient code.


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

It's interesting to see how other people think and approach 3D design. Here's my take on the same model. Obviously, our minds take different routes to the same destination. include <LMS/AssemblyStandard.scad> // internal dimensions (clearance for A7 paper =110*80, A6= 153*110 length = 80; width = 110; height = 25; // total height (external) thick = 1.8; gap = 20; //gap at corner rad = 20; // corner radius $fn=80; module roundedCutout() { difference() { cube( [ 2*rad, 2*rad, height ] ); translate( [ 0, 0, -E ] ) cylinder( h=height+2*E, r=rad ); } } module box() { difference() { cube( [ length+2*thick, width+2*thick, height ] ); translate( [ thick, thick, thick ] ) cube( [ length, width, height ] ); translate( [ length-rad, -E, thick ] ) cube( [ rad+2*thick+E, rad+E, height ] ); translate( [ length-rad+2*thick, rad, 0-E ] ) rotate( [ 0, 0, -90 ] ) roundedCutout(); translate( [ length-2*rad, 0.5*rad, height-rad ] ) rotate( [ 90, 0, 0 ] ) roundedCutout(); translate( [ 2*height+length-2*rad, 2*rad, height-rad ] ) rotate( [ 90, 0, -90 ] ) roundedCutout(); } } box(); On Wed, Jun 22, 2022 at 12:45 PM <zipang@tethys.re> wrote: > Great ! Nice small and efficient code. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
LM
Leonard Martin Struttmann
Wed, Jun 22, 2022 6:29 PM

Oh, and I forgot:

E  = 0.2;  //  Defined in the included file

On Wed, Jun 22, 2022 at 1:26 PM Leonard Martin Struttmann <
lenstruttmann@gmail.com> wrote:

It's interesting to see how other people think and approach 3D design.

Here's my take on the same model.  Obviously, our minds take different
routes to the same destination.

include <LMS/AssemblyStandard.scad>

// internal dimensions (clearance for A7 paper =11080, A6= 153110
length = 80;
width = 110;
height = 25;  // total height (external)
thick = 1.8;
gap = 20; //gap at corner
rad = 20; // corner radius

$fn=80;

module roundedCutout()
{
difference()
{
cube( [ 2rad, 2rad, height ] );

 translate( [ 0, 0, -E ] )
 cylinder( h=height+2*E, r=rad );

}
}

module box()
{
difference()
{
cube( [ length+2thick, width+2thick, height ] );

 translate( [ thick, thick, thick ] )
 cube( [ length, width, height ] );

 translate( [ length-rad, -E, thick ] )
 cube( [ rad+2*thick+E, rad+E, height ] );

 translate( [ length-rad+2*thick, rad, 0-E ] )
 rotate( [ 0, 0, -90 ] )
 roundedCutout();

 translate( [ length-2*rad, 0.5*rad, height-rad ] )
 rotate( [ 90, 0, 0 ] )
 roundedCutout();

 translate( [ 2*height+length-2*rad, 2*rad, height-rad ] )
 rotate( [ 90, 0, -90 ] )
 roundedCutout();

}
}

box();

On Wed, Jun 22, 2022 at 12:45 PM zipang@tethys.re wrote:

Great ! Nice small and efficient code.


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

Oh, and I forgot: E = 0.2; // Defined in the included file On Wed, Jun 22, 2022 at 1:26 PM Leonard Martin Struttmann < lenstruttmann@gmail.com> wrote: > It's interesting to see how other people think and approach 3D design. > > Here's my take on the same model. Obviously, our minds take different > routes to the same destination. > > include <LMS/AssemblyStandard.scad> > > // internal dimensions (clearance for A7 paper =110*80, A6= 153*110 > length = 80; > width = 110; > height = 25; // total height (external) > thick = 1.8; > gap = 20; //gap at corner > rad = 20; // corner radius > > $fn=80; > > module roundedCutout() > { > difference() > { > cube( [ 2*rad, 2*rad, height ] ); > > translate( [ 0, 0, -E ] ) > cylinder( h=height+2*E, r=rad ); > } > } > > module box() > { > difference() > { > cube( [ length+2*thick, width+2*thick, height ] ); > > translate( [ thick, thick, thick ] ) > cube( [ length, width, height ] ); > > translate( [ length-rad, -E, thick ] ) > cube( [ rad+2*thick+E, rad+E, height ] ); > > translate( [ length-rad+2*thick, rad, 0-E ] ) > rotate( [ 0, 0, -90 ] ) > roundedCutout(); > > translate( [ length-2*rad, 0.5*rad, height-rad ] ) > rotate( [ 90, 0, 0 ] ) > roundedCutout(); > > translate( [ 2*height+length-2*rad, 2*rad, height-rad ] ) > rotate( [ 90, 0, -90 ] ) > roundedCutout(); > } > } > > box(); > > > On Wed, Jun 22, 2022 at 12:45 PM <zipang@tethys.re> wrote: > >> Great ! Nice small and efficient code. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >
BR
Bob Roos
Wed, Jun 22, 2022 7:54 PM

Hi Leonard,

Why are the 2 F5 renderings so different?  This one show up with a solid object with no "holes" and the previous version has "holes" depending on how it is oriented.
 
Also the interior is green but on the first it is all yellow.
 
Sorry but I don't have a way to show images at the moment.
 
Bob Roos

Wednesday, June 22, 2022, 2:26:41 PM, you wrote:

It's interesting to see how other people think and approach 3D design.

Here's my take on the same model.  Obviously, our minds take different routes to the same destination

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

Hi Leonard, Why are the 2 F5 renderings so different?  This one show up with a solid object with no "holes" and the previous version has "holes" depending on how it is oriented.   Also the interior is green but on the first it is all yellow.   Sorry but I don't have a way to show images at the moment.   Bob Roos Wednesday, June 22, 2022, 2:26:41 PM, you wrote: > It's interesting to see how other people think and approach 3D design. > Here's my take on the same model.  Obviously, our minds take different routes to the same destination --  have Fun,  Bob                           mailto:roosbob@wybatap.com
LM
Leonard Martin Struttmann
Wed, Jun 22, 2022 8:56 PM
  1. As for the "holes" that show up in the preview, I do not know.  It may
    have something to do with the way that Raymond created his cut outs.  Try
    View -> Thrown Together to see all of the shapes used to create the cut
    outs.

  2. As for the color, Raymond's box is all yellow since he created it with a
    single linear_extrude.  Mine shows green since my box is created by
    subtracting one box from another bigger box.

There are many people here on the list who are much smarter than me and who
can probably explain these things better.  :-)

On Wed, Jun 22, 2022 at 2:54 PM Bob Roos roosbob@wybatap.com wrote:

Hi Leonard,

Why are the 2 F5 renderings so different?  This one show up with a solid
object with no "holes" and the previous version has "holes" depending on
how it is oriented.

Also the interior is green but on the first it is all yellow.

Sorry but I don't have a way to show images at the moment.

Bob Roos

Wednesday, June 22, 2022, 2:26:41 PM, you wrote:

It's interesting to see how other people think and approach 3D design.

Here's my take on the same model.  Obviously, our minds take different
routes to the same destination

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


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

1. As for the "holes" that show up in the preview, I do not know. It may have something to do with the way that Raymond created his cut outs. Try View -> Thrown Together to see all of the shapes used to create the cut outs. 2. As for the color, Raymond's box is all yellow since he created it with a single linear_extrude. Mine shows green since my box is created by subtracting one box from another bigger box. There are many people here on the list who are much smarter than me and who can probably explain these things better. :-) On Wed, Jun 22, 2022 at 2:54 PM Bob Roos <roosbob@wybatap.com> wrote: > Hi Leonard, > > > Why are the 2 F5 renderings so different? This one show up with a solid > object with no "holes" and the previous version has "holes" depending on > how it is oriented. > > > > Also the interior is green but on the first it is all yellow. > > > > Sorry but I don't have a way to show images at the moment. > > > > Bob Roos > > > Wednesday, June 22, 2022, 2:26:41 PM, you wrote: > > It's interesting to see how other people think and approach 3D design. > > Here's my take on the same model. Obviously, our minds take different > routes to the same destination > > > -- > have Fun, > Bob mailto:roosbob@wybatap.com > <roosbob@wybatap.com> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Wed, Jun 22, 2022 9:48 PM

On 6/22/2022 12:54 PM, Bob Roos wrote:

Why are the 2 F5 renderings so different?  This one show up with a
solid object with no "holes" and the previous version has "holes"
depending on how it is oriented.

Classic convexity artifacts.

  linear_extrude(height, convexity=2){

fixes it, though I usually set it to 10 or so to be safe.  (There's
basically no cost for a model this simple.  You have to have a very
complex model before there starts to be a real cost.)

Also the interior is green but on the first it is all yellow.

Spaces on the sides of a subtracted-away object default to green.

On 6/22/2022 12:54 PM, Bob Roos wrote: > > Why are the 2 F5 renderings so different?  This one show up with a > solid object with no "holes" and the previous version has "holes" > depending on how it is oriented. > Classic convexity artifacts. linear_extrude(height, convexity=2){ fixes it, though I usually set it to 10 or so to be safe.  (There's basically no cost for a model this simple.  You have to have a very complex model before there starts to be a real cost.) > Also the interior is green but on the first it is all yellow. > Spaces on the sides of a subtracted-away object default to green.
JB
Jordan Brown
Wed, Jun 22, 2022 10:05 PM

On 6/22/2022 2:48 PM, Jordan Brown wrote:

Classic convexity artifacts.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Extrude_parameters_for_all_extrusion_modes
(Also applies to import, polyhedron, and a few others.)

Consider this simplified version of the key part of the model:

length = 80;
width = 110;
thick = 1.8;
gap = 20; //gap at corner

difference(){
    offset(thick)
        square([length,width]);
    square([length,width]);
    translate([length-gap,-2*thick])
        square(gap+(2*thick));
}

color("red")  translate([-20,0,0]) rotate(45)cube([170,2,2]);

Note that the red line crosses the figure twice.

If we linear extrude that figure without specifying convexity, and
difference away a little bit, we get this artifact-y view:

Basically, any sight line where the number of crossings is greater than
the specified convexity gets displayed wrong.

Here's another simple example to play with.

difference() {
linear_extrude(height=10) {
square(10);
translate([5,5]) square(10);
}
cube(1);
}

(Also shows classic Z-fighting artifacts around the 1x1x1 cube
subtracted at the origin.)

On 6/22/2022 2:48 PM, Jordan Brown wrote: > Classic convexity artifacts. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#Extrude_parameters_for_all_extrusion_modes (Also applies to import, polyhedron, and a few others.) Consider this simplified version of the key part of the model: length = 80; width = 110; thick = 1.8; gap = 20; //gap at corner difference(){ offset(thick) square([length,width]); square([length,width]); translate([length-gap,-2*thick]) square(gap+(2*thick)); } color("red") translate([-20,0,0]) rotate(45)cube([170,2,2]); Note that the red line crosses the figure twice. If we linear extrude that figure without specifying convexity, and difference away a little bit, we get this artifact-y view: Basically, any sight line where the number of crossings is greater than the specified convexity gets displayed wrong. Here's another simple example to play with. difference() { linear_extrude(height=10) { square(10); translate([5,5]) square(10); } cube(1); } (Also shows classic Z-fighting artifacts around the 1x1x1 cube subtracted at the origin.)
RW
Raymond West
Wed, Jun 22, 2022 10:14 PM

On 22/06/2022 19:26, Leonard Martin Struttmann wrote:

It's interesting to see how other people think and approach 3D design.

generally, I take one cube from another to make a box, but offset is
simple to round corners. I originally had the gap as a relationship to
the width and length, but found it better to control it manually, so to
speak, as often it needs to be about an inch or so, whatever size box.
Also the corner and edge radius sort of relates to height and gap, so
again, manual selection, with the advantage you can have a solid corner,
if needed. Openscad is great for simple mechanical designs. Of course,
with the correct/incorrect values, you can sort of blow it up. Too much
to think about if wanting to validate the values, it is simpler to see
what it looks like.

Thanks for the comments.

On 22/06/2022 19:26, Leonard Martin Struttmann wrote: > It's interesting to see how other people think and approach 3D design. generally, I take one cube from another to make a box, but offset is simple to round corners. I originally had the gap as a relationship to the width and length, but found it better to control it manually, so to speak, as often it needs to be about an inch or so, whatever size box. Also the corner and edge radius sort of relates to height and gap, so again, manual selection, with the advantage you can have a solid corner, if needed. Openscad is great for simple mechanical designs. Of course, with the correct/incorrect values, you can sort of blow it up. Too much to think about if wanting to validate the values, it is simpler to see what it looks like. Thanks for the comments.
NH
nop head
Wed, Jun 22, 2022 10:20 PM

I would compose a box from linear extrudes of 2D differences rather than do
a 3D difference as it is much faster.

On Wed, 22 Jun 2022 at 23:14, Raymond West raywest@raywest.com wrote:

On 22/06/2022 19:26, Leonard Martin Struttmann wrote:

It's interesting to see how other people think and approach 3D design.

generally, I take one cube from another to make a box, but offset is
simple to round corners. I originally had the gap as a relationship to
the width and length, but found it better to control it manually, so to
speak, as often it needs to be about an inch or so, whatever size box.
Also the corner and edge radius sort of relates to height and gap, so
again, manual selection, with the advantage you can have a solid corner,
if needed. Openscad is great for simple mechanical designs. Of course,
with the correct/incorrect values, you can sort of blow it up. Too much
to think about if wanting to validate the values, it is simpler to see
what it looks like.

Thanks for the comments.


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

I would compose a box from linear extrudes of 2D differences rather than do a 3D difference as it is much faster. On Wed, 22 Jun 2022 at 23:14, Raymond West <raywest@raywest.com> wrote: > > On 22/06/2022 19:26, Leonard Martin Struttmann wrote: > > It's interesting to see how other people think and approach 3D design. > > generally, I take one cube from another to make a box, but offset is > simple to round corners. I originally had the gap as a relationship to > the width and length, but found it better to control it manually, so to > speak, as often it needs to be about an inch or so, whatever size box. > Also the corner and edge radius sort of relates to height and gap, so > again, manual selection, with the advantage you can have a solid corner, > if needed. Openscad is great for simple mechanical designs. Of course, > with the correct/incorrect values, you can sort of blow it up. Too much > to think about if wanting to validate the values, it is simpler to see > what it looks like. > > Thanks for the comments. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >