discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

How can I make a phase on a cube just on on side

A
ats3788
Fri, May 3, 2019 7:51 AM

Hello
How can I make a phase on a cube just on on side ?
minkowski() is a powerful function but with no control on witch border you
like to have a phase.

--
Sent from: http://forum.openscad.org/

Hello How can I make a phase on a cube just on on side ? minkowski() is a powerful function but with no control on witch border you like to have a phase. -- Sent from: http://forum.openscad.org/
S
shadowwynd
Fri, May 3, 2019 10:27 AM

You can't use minkowski()  this way.  By definition, it is impossible to get
an accurate "cube" with only one side rounded.

I normally use hull() to get a rounded "cubish" thing.  See the code and
example below.


// Cube with rounded face

dim = [100, 50, 40];

corner_r = 10;
grain = 1;

// Top edges and corners rounded, but spills onto the sides
hull()
{
// Define lower side of cube
translate ([0, 0, 0]) cube (grain);
translate ([dim.x - grain, 0, 0]) cube (grain);
translate ([dim.x - grain, dim.y-grain, 0]) cube (grain);
translate ([0, dim.y-grain, 0]) cube (grain);

// Rounded face
translate ([0+corner_r, 0+corner_r, dim.z-corner_r]) sphere (r=corner_r);
translate ([dim.x-corner_r, 0+corner_r, dim.z-corner_r]) sphere

(r=corner_r);
translate ([dim.x-corner_r, dim.y-corner_r, dim.z-corner_r]) sphere
(r=corner_r);
translate ([0+corner_r, dim.y-corner_r, dim.z-corner_r]) sphere
(r=corner_r);

}

// Create a rounded cube, but a flat bottom
translate ([-dim.x-10, 0, 0])
{
hull()
{
// Define lower side of cube
linear_extrude(1)
{

		translate ([0+corner_r, 0+corner_r, 0]) circle (r=corner_r);
		translate ([dim.x-corner_r, 0+corner_r, 0]) circle (r=corner_r);
		translate ([dim.x-corner_r, dim.y-corner_r, 0]) circle (r=corner_r);
		translate ([0+corner_r, dim.y-corner_r, 0]) circle (r=corner_r);
	}

	// Rounded top face
	translate ([0+corner_r, 0+corner_r, dim.z-corner_r]) sphere (r=corner_r);
	translate ([dim.x-corner_r, 0+corner_r, dim.z-corner_r]) sphere

(r=corner_r);
translate ([dim.x-corner_r, dim.y-corner_r, dim.z-corner_r]) sphere
(r=corner_r);
translate ([0+corner_r, dim.y-corner_r, dim.z-corner_r]) sphere
(r=corner_r);

}

}


http://forum.openscad.org/file/t486/roundedCube.png

--
Sent from: http://forum.openscad.org/

You can't use minkowski() this way. By definition, it is impossible to get an accurate "cube" with only one side rounded. I normally use hull() to get a rounded "cubish" thing. See the code and example below. ---------------------- // Cube with rounded face dim = [100, 50, 40]; corner_r = 10; grain = 1; // Top edges and corners rounded, but spills onto the sides hull() { // Define lower side of cube translate ([0, 0, 0]) cube (grain); translate ([dim.x - grain, 0, 0]) cube (grain); translate ([dim.x - grain, dim.y-grain, 0]) cube (grain); translate ([0, dim.y-grain, 0]) cube (grain); // Rounded face translate ([0+corner_r, 0+corner_r, dim.z-corner_r]) sphere (r=corner_r); translate ([dim.x-corner_r, 0+corner_r, dim.z-corner_r]) sphere (r=corner_r); translate ([dim.x-corner_r, dim.y-corner_r, dim.z-corner_r]) sphere (r=corner_r); translate ([0+corner_r, dim.y-corner_r, dim.z-corner_r]) sphere (r=corner_r); } // Create a rounded cube, but a flat bottom translate ([-dim.x-10, 0, 0]) { hull() { // Define lower side of cube linear_extrude(1) { translate ([0+corner_r, 0+corner_r, 0]) circle (r=corner_r); translate ([dim.x-corner_r, 0+corner_r, 0]) circle (r=corner_r); translate ([dim.x-corner_r, dim.y-corner_r, 0]) circle (r=corner_r); translate ([0+corner_r, dim.y-corner_r, 0]) circle (r=corner_r); } // Rounded top face translate ([0+corner_r, 0+corner_r, dim.z-corner_r]) sphere (r=corner_r); translate ([dim.x-corner_r, 0+corner_r, dim.z-corner_r]) sphere (r=corner_r); translate ([dim.x-corner_r, dim.y-corner_r, dim.z-corner_r]) sphere (r=corner_r); translate ([0+corner_r, dim.y-corner_r, dim.z-corner_r]) sphere (r=corner_r); } } ------------------ <http://forum.openscad.org/file/t486/roundedCube.png> -- Sent from: http://forum.openscad.org/
A
ats3788
Fri, May 3, 2019 12:08 PM

Thank you very much
I don't understand in the Moment how that works but I try !!!

--
Sent from: http://forum.openscad.org/

Thank you very much I don't understand in the Moment how that works but I try !!! -- Sent from: http://forum.openscad.org/
ER
Ezra Reynolds
Fri, May 3, 2019 12:16 PM

Hull works by wrapping smaller shapes as if with plastic wrap for food.

For a cube, this means putting eight shapes (One for each corner).

On May 3, 2019, at 8:08 AM, ats3788 ats3788@gmail.com wrote:

Thank you very much
I don't understand in the Moment how that works but I try !!!

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Hull works by wrapping smaller shapes as if with plastic wrap for food. For a cube, this means putting eight shapes (One for each corner). > On May 3, 2019, at 8:08 AM, ats3788 <ats3788@gmail.com> wrote: > > Thank you very much > I don't understand in the Moment how that works but I try !!! > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
A
adrianv
Fri, May 3, 2019 3:42 PM

If you're willing to use a library I suggest this solution with the Belfry
OpenSCAD Library available at
https://github.com/revarbat/BOSL which will let you round any edges you want
on a cube.

include<lib/BOSL/shapes.scad>
include<lib/BOSL/constants.scad>

$fn=36;
cuboid([10,10,10], fillet=2, edges=EDGES_TOP);  // just top edges rounded
right(15)cuboid([10,10,10], fillet=2, edges=EDGES_ALL-EDGES_BOTTOM);  //
all but the bottom
right(30)cuboid([10,10,10], fillet=2, edges=EDGE_RT_FT);  // just one edge

http://forum.openscad.org/file/t2477/roundedcube.png

--
Sent from: http://forum.openscad.org/

If you're willing to use a library I suggest this solution with the Belfry OpenSCAD Library available at https://github.com/revarbat/BOSL which will let you round any edges you want on a cube. include<lib/BOSL/shapes.scad> include<lib/BOSL/constants.scad> $fn=36; cuboid([10,10,10], fillet=2, edges=EDGES_TOP); // just top edges rounded right(15)cuboid([10,10,10], fillet=2, edges=EDGES_ALL-EDGES_BOTTOM); // all but the bottom right(30)cuboid([10,10,10], fillet=2, edges=EDGE_RT_FT); // just one edge <http://forum.openscad.org/file/t2477/roundedcube.png> -- Sent from: http://forum.openscad.org/
A
ats3788
Fri, May 3, 2019 4:25 PM

Tank you thank you that is awesome !!!!!!

--
Sent from: http://forum.openscad.org/

Tank you thank you that is awesome !!!!!! -- Sent from: http://forum.openscad.org/