discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

Odd shapes with domes

JW
Joe Weinpert
Sat, Jan 8, 2022 8:48 PM

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with
vertical sides an add a rounded top to it.

What is the best way to add a solid dome top to an odd shaped solid object? For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.
RW
Raymond West
Sat, Jan 8, 2022 9:17 PM

use hull -

//odd shape
module shape(){
    linear_extrude(20,convexity =10){
        polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
        }}

    $fn=80;
        hull(){
          shape();
          translate([0,6,20]) sphere(10); //locate maybe by trial and error
        }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid
object?

For example: take a kidney or a heart shaped solid object with
vertical sides an add a rounded top to it.


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

use hull - //odd shape module shape(){     linear_extrude(20,convexity =10){         polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);         }}     $fn=80;         hull(){           shape();           translate([0,6,20]) sphere(10); //locate maybe by trial and error         } On 08/01/2022 20:48, Joe Weinpert wrote: > > What is the best way to add a solid dome top to an odd shaped solid > object? > > For example: take a kidney or a heart shaped solid object with > vertical sides an add a rounded top to it. > > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
AM
Adrian Mariano
Sat, Jan 8, 2022 9:19 PM

What exactly does "rounded top" mean?  There are some ugly hacks
involving a massive union of offset or scaled parts forming a
stairstep model.  I think the best way to do this is to construct
your shape as a polyhedron with the desired rounded top.  To do this
easily, you can make your shape as a point list and then use a
library.  For example:

include <BOSL2/std.scad>
include <BOSL2/rounding.scad>

shape = supershape(step=2,m1=2, n1=1, n2=4, n3=8);
offset_sweep(shape, top = os_circle(r=1), height=2);

tlist = [ident(4),
for(i=[0:15]) let(z=i/15) up(1+z)scale(sqrt(1-(z.99)^2))
];

right(3)
sweep(shape, tlist);

The first method shown here (offset_sweep) makes a circular rounded
top.  But weird shapes don't have well behaved circular rounded tops.
That is, you get creases and degenerate behavior.  So you might need
to think about what you mean, exactly, when asking for a rounded top.
If you scale instead of offsetting you'll get something with a
rounded top that varies in its curvature and amount of rounding, but
avoids degeneracy.  And it probably involves more experimentation with
parameters to get the curve you want for the top.  But maybe that's
what you want?  That's the second version.  Both can be seen here:

On Sat, Jan 8, 2022 at 3:48 PM Joe Weinpert joe.weinpert@gmail.com wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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

What exactly does "rounded top" mean? There are some ugly hacks involving a massive union of offset or scaled parts forming a stairstep model. I think the best way to do this is to construct your shape as a polyhedron with the desired rounded top. To do this easily, you can make your shape as a point list and then use a library. For example: include <BOSL2/std.scad> include <BOSL2/rounding.scad> shape = supershape(step=2,m1=2, n1=1, n2=4, n3=8); offset_sweep(shape, top = os_circle(r=1), height=2); tlist = [ident(4), for(i=[0:15]) let(z=i/15) up(1+z)*scale(sqrt(1-(z*.99)^2)) ]; right(3) sweep(shape, tlist); The first method shown here (offset_sweep) makes a circular rounded top. But weird shapes don't have well behaved circular rounded tops. That is, you get creases and degenerate behavior. So you might need to think about what you mean, exactly, when asking for a rounded top. If you scale instead of offsetting you'll get something with a rounded top that varies in its curvature and amount of rounding, but avoids degeneracy. And it probably involves more experimentation with parameters to get the curve you want for the top. But maybe that's what you want? That's the second version. Both can be seen here: On Sat, Jan 8, 2022 at 3:48 PM Joe Weinpert <joe.weinpert@gmail.com> wrote: > > > What is the best way to add a solid dome top to an odd shaped solid object? > > For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
AM
Adrian Mariano
Sat, Jan 8, 2022 9:24 PM

Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:

use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


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

Both of his proposed shapes, a heart, and a kidney, are concave. So hull() is not going to do the job at all. On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: > > use hull - > > //odd shape > module shape(){ > linear_extrude(20,convexity =10){ > polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); > }} > > $fn=80; > hull(){ > shape(); > translate([0,6,20]) sphere(10); //locate maybe by trial and error > } > > On 08/01/2022 20:48, Joe Weinpert wrote: > > > What is the best way to add a solid dome top to an odd shaped solid object? > > For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. > > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
RW
Raymond West
Sat, Jan 8, 2022 10:09 PM

Well, you can always split it on the inclusion, and fiddle it until it
looks the way you want.

//odd shape
module shape(){  //with inclusion
    linear_extrude(20,convexity =10){
        polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

        }}

 module shape2(){
          shape();
          translate([5,6,20]) sphere(6); //locate maybe by trial and error
      }

  module part1(){
      intersection(){
        translate ([-20,5,0])
        cube(50);
        shape2();
       }
    }
  module part2(){
        difference(){
            shape2();
            part1();
        }
    }

    $fn=80;
       hull() part2();
       hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:

Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:

use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


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


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

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. //odd shape module shape(){  //with inclusion     linear_extrude(20,convexity =10){         polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);         }}  module shape2(){           shape();           translate([5,6,20]) sphere(6); //locate maybe by trial and error       }   module part1(){       intersection(){         translate ([-20,5,0])         cube(50);         shape2();        }     }   module part2(){         difference(){             shape2();             part1();         }     }     $fn=80;        hull() part2();        hull() part1(); On 08/01/2022 21:24, Adrian Mariano wrote: > Both of his proposed shapes, a heart, and a kidney, are concave. So > hull() is not going to do the job at all. > > On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: >> use hull - >> >> //odd shape >> module shape(){ >> linear_extrude(20,convexity =10){ >> polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); >> }} >> >> $fn=80; >> hull(){ >> shape(); >> translate([0,6,20]) sphere(10); //locate maybe by trial and error >> } >> >> On 08/01/2022 20:48, Joe Weinpert wrote: >> >> >> What is the best way to add a solid dome top to an odd shaped solid object? >> >> For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. >> >> >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
MM
Michael McCool
Sat, Jan 8, 2022 10:22 PM

Let’s assume the outline we want to use is in fact a 2D contour.  The “right” way to do this is probably to generate a series of offsets, then “skin” between each one.

The offset part is easy, there is an “offset” function.  For skinning the two curves, “hull” will not do the right thing if there are concavities.  The scale parameter to linear offset will also not do the right thing.  A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad

Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule).  There are also two variants of offset that might give different results.

(From: Michael McCool)

On Jan 8, 2022, at 18:09, Raymond West raywest@raywest.com wrote:

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want.

//odd shape
module shape(){  //with inclusion
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

     }}

module shape2(){
shape();
translate([5,6,20]) sphere(6); //locate maybe by trial and error
}

module part1(){
intersection(){
translate ([-20,5,0])
cube(50);
shape2();
}
}
module part2(){
difference(){
shape2();
part1();
}
}

 $fn=80;
    hull() part2();
    hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:
Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:
use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


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


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


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

Let’s assume the outline we want to use is in fact a 2D contour. The “right” way to do this is probably to generate a series of offsets, then “skin” between each one. The offset part is easy, there is an “offset” function. For skinning the two curves, “hull” will not do the right thing if there are concavities. The scale parameter to linear offset will also not do the right thing. A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule). There are also two variants of offset that might give different results. (From: Michael McCool) > On Jan 8, 2022, at 18:09, Raymond West <raywest@raywest.com> wrote: > > Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. > > //odd shape > module shape(){ //with inclusion > linear_extrude(20,convexity =10){ > polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]); > > }} > > module shape2(){ > shape(); > translate([5,6,20]) sphere(6); //locate maybe by trial and error > } > > module part1(){ > intersection(){ > translate ([-20,5,0]) > cube(50); > shape2(); > } > } > module part2(){ > difference(){ > shape2(); > part1(); > } > } > > $fn=80; > hull() part2(); > hull() part1(); > >> On 08/01/2022 21:24, Adrian Mariano wrote: >> Both of his proposed shapes, a heart, and a kidney, are concave. So >> hull() is not going to do the job at all. >> >>> On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: >>> use hull - >>> >>> //odd shape >>> module shape(){ >>> linear_extrude(20,convexity =10){ >>> polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); >>> }} >>> >>> $fn=80; >>> hull(){ >>> shape(); >>> translate([0,6,20]) sphere(10); //locate maybe by trial and error >>> } >>> >>>> On 08/01/2022 20:48, Joe Weinpert wrote: >>> >>> >>> What is the best way to add a solid dome top to an odd shaped solid object? >>> >>> For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. >>> >>> >>> >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
MM
Michael McCool
Sat, Jan 8, 2022 10:23 PM

Sorry, I meant “the scale parameter to linear extrude will not do the right thing”.

(From: Michael McCool)

On Jan 8, 2022, at 18:22, Michael McCool michael.d.mccool@gmail.com wrote:

Let’s assume the outline we want to use is in fact a 2D contour.  The “right” way to do this is probably to generate a series of offsets, then “skin” between each one.

The offset part is easy, there is an “offset” function.  For skinning the two curves, “hull” will not do the right thing if there are concavities.  The scale parameter to linear offset will also not do the right thing.  A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad

Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule).  There are also two variants of offset that might give different results.

(From: Michael McCool)

On Jan 8, 2022, at 18:09, Raymond West raywest@raywest.com wrote:

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want.

//odd shape
module shape(){  //with inclusion
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

     }}

module shape2(){
shape();
translate([5,6,20]) sphere(6); //locate maybe by trial and error
}

module part1(){
intersection(){
translate ([-20,5,0])
cube(50);
shape2();
}
}
module part2(){
difference(){
shape2();
part1();
}
}

 $fn=80;
    hull() part2();
    hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:
Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:
use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


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


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


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

Sorry, I meant “the scale parameter to linear extrude will not do the right thing”. (From: Michael McCool) > On Jan 8, 2022, at 18:22, Michael McCool <michael.d.mccool@gmail.com> wrote: > > Let’s assume the outline we want to use is in fact a 2D contour. The “right” way to do this is probably to generate a series of offsets, then “skin” between each one. > > The offset part is easy, there is an “offset” function. For skinning the two curves, “hull” will not do the right thing if there are concavities. The scale parameter to linear offset will also not do the right thing. A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad > > Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule). There are also two variants of offset that might give different results. > > (From: Michael McCool) > >>> On Jan 8, 2022, at 18:09, Raymond West <raywest@raywest.com> wrote: >>> >> Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. >> >> //odd shape >> module shape(){ //with inclusion >> linear_extrude(20,convexity =10){ >> polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]); >> >> }} >> >> module shape2(){ >> shape(); >> translate([5,6,20]) sphere(6); //locate maybe by trial and error >> } >> >> module part1(){ >> intersection(){ >> translate ([-20,5,0]) >> cube(50); >> shape2(); >> } >> } >> module part2(){ >> difference(){ >> shape2(); >> part1(); >> } >> } >> >> $fn=80; >> hull() part2(); >> hull() part1(); >> >>> On 08/01/2022 21:24, Adrian Mariano wrote: >>> Both of his proposed shapes, a heart, and a kidney, are concave. So >>> hull() is not going to do the job at all. >>> >>>> On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: >>>> use hull - >>>> >>>> //odd shape >>>> module shape(){ >>>> linear_extrude(20,convexity =10){ >>>> polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); >>>> }} >>>> >>>> $fn=80; >>>> hull(){ >>>> shape(); >>>> translate([0,6,20]) sphere(10); //locate maybe by trial and error >>>> } >>>> >>>>> On 08/01/2022 20:48, Joe Weinpert wrote: >>>> >>>> >>>> What is the best way to add a solid dome top to an odd shaped solid object? >>>> >>>> For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org
AM
Adrian Mariano
Sun, Jan 9, 2022 12:21 AM

The example I posted does what you said, using BOSL2 to perform the
offsets and linking the layers together, which is better done with
offset_sweep, because it is smart about how it connects adjacent
layers.  You'll probably get an inferior result with skin, and it will
be more work, since you'll have to compute the layers yourself.

But note that we don't know what "the right thing" is without more
information from the original poster.  Perhaps scaled layers are
preferred---they avoid degeneracies in the layers that are likely to
arise with offset. If you use offset you'll have edges appear, so the
"rounded top" will have corners.  The smoother top resulting from
scale operations might be "best" in the eyes of the original poster.

On Sat, Jan 8, 2022 at 5:22 PM Michael McCool
michael.d.mccool@gmail.com wrote:

Let’s assume the outline we want to use is in fact a 2D contour.  The “right” way to do this is probably to generate a series of offsets, then “skin” between each one.

The offset part is easy, there is an “offset” function.  For skinning the two curves, “hull” will not do the right thing if there are concavities.  The scale parameter to linear offset will also not do the right thing.  A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad

Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule).  There are also two variants of offset that might give different results.

(From: Michael McCool)

On Jan 8, 2022, at 18:09, Raymond West raywest@raywest.com wrote:

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want.

//odd shape
module shape(){  //with inclusion
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

     }}

module shape2(){
shape();
translate([5,6,20]) sphere(6); //locate maybe by trial and error
}

module part1(){
intersection(){
translate ([-20,5,0])
cube(50);
shape2();
}
}
module part2(){
difference(){
shape2();
part1();
}
}

 $fn=80;
    hull() part2();
    hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:

Both of his proposed shapes, a heart, and a kidney, are concave.  So

hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:

use hull -

//odd shape

module shape(){

 linear_extrude(20,convexity =10){

     polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);

     }}


 $fn=80;

     hull(){

       shape();

       translate([0,6,20]) sphere(10); //locate maybe by trial and error

     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


OpenSCAD mailing list

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


OpenSCAD mailing list

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


OpenSCAD mailing list

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


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


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

The example I posted does what you said, using BOSL2 to perform the offsets and linking the layers together, which is better done with offset_sweep, because it is smart about how it connects adjacent layers. You'll probably get an inferior result with skin, and it will be more work, since you'll have to compute the layers yourself. But note that we don't know what "the right thing" is without more information from the original poster. Perhaps scaled layers are preferred---they avoid degeneracies in the layers that are likely to arise with offset. If you use offset you'll have edges appear, so the "rounded top" will have corners. The smoother top resulting from scale operations might be "best" in the eyes of the original poster. On Sat, Jan 8, 2022 at 5:22 PM Michael McCool <michael.d.mccool@gmail.com> wrote: > > Let’s assume the outline we want to use is in fact a 2D contour. The “right” way to do this is probably to generate a series of offsets, then “skin” between each one. > > The offset part is easy, there is an “offset” function. For skinning the two curves, “hull” will not do the right thing if there are concavities. The scale parameter to linear offset will also not do the right thing. A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad > > Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule). There are also two variants of offset that might give different results. > > (From: Michael McCool) > > On Jan 8, 2022, at 18:09, Raymond West <raywest@raywest.com> wrote: > > Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. > > //odd shape > module shape(){ //with inclusion > linear_extrude(20,convexity =10){ > polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]); > > }} > > module shape2(){ > shape(); > translate([5,6,20]) sphere(6); //locate maybe by trial and error > } > > module part1(){ > intersection(){ > translate ([-20,5,0]) > cube(50); > shape2(); > } > } > module part2(){ > difference(){ > shape2(); > part1(); > } > } > > $fn=80; > hull() part2(); > hull() part1(); > > On 08/01/2022 21:24, Adrian Mariano wrote: > > Both of his proposed shapes, a heart, and a kidney, are concave. So > > hull() is not going to do the job at all. > > > On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: > > use hull - > > > //odd shape > > module shape(){ > > linear_extrude(20,convexity =10){ > > polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); > > }} > > > $fn=80; > > hull(){ > > shape(); > > translate([0,6,20]) sphere(10); //locate maybe by trial and error > > } > > > On 08/01/2022 20:48, Joe Weinpert wrote: > > > > What is the best way to add a solid dome top to an odd shaped solid object? > > > For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. > > > > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 12:36 AM

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.

Can anyone suggest the logic of offset for a closed 2d complex shape. I am struggling to figure out. Main challenge comes when the offset values become larger.
AM
Adrian Mariano
Sun, Jan 9, 2022 6:10 AM

Doing offset is very difficult.  You can take a look at BOSL2 and also
dotSCAD which both have implementations.  The BOSL2 algorithm can
fail under various circumstances.  I don't know how robust the dotSCAD
method is.  There is a more robust algorithm that relies on reliable
bolean operations.  See "Polygon Offsetting by Computing Winding
Numbers" by Chen and McMains.
A disadvantage of this method, however, is that it becomes impossible
to maintain the
relationship between points in the original and points in the offset,
which are needed for connecting the layers to make the polyhedron.

On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.


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

Doing offset is very difficult. You can take a look at BOSL2 and also dotSCAD which both have implementations. The BOSL2 algorithm can fail under various circumstances. I don't know how robust the dotSCAD method is. There is a more robust algorithm that relies on reliable bolean operations. See "Polygon Offsetting by Computing Winding Numbers" by Chen and McMains. A disadvantage of this method, however, is that it becomes impossible to maintain the relationship between points in the original and points in the offset, which are needed for connecting the layers to make the polyhedron. On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > > Can anyone suggest the logic of offset for a closed 2d complex shape. > > I am struggling to figure out. > > Main challenge comes when the offset values become larger. > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org