discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Cut-Away on part design Using Difference - Assistance needed

G
GCDoubleD
Fri, Feb 16, 2018 11:19 PM

Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD
to create things for myself. I'm trying to create and print a replacement
switch housing for my older laptop. I have the part mostly made with the
exception of a cutaway section on the top. I've tried various iterations of
the difference operation, but thus far I've not achieved what I'm looking
for.

Can anyone offer any suggestion on a way to achieve this cut out area or
something similar? I will include a pic of what I'm trying to do (not mine)
and paste my code so far. My cutout wont be as deep or course.

This pic shows the cutaway I'm trying to achieve
http://forum.openscad.org/file/t2166/cutaway.jpg

This pic is my part that I want to apply the cutaway to.
http://forum.openscad.org/file/t2166/mypart.jpg

My Code:

//Gateway Switch Housing

$fn = 50;

//Top Section
translate( [0,0,27.5])
union() difference() {
cylinder( d = 20.0, h = 19 );
cylinder( d = 17.00, h = 19);
}

//Mid Section
translate([0,0,15])
difference() {
cylinder(h=12.7, r1=13, r2=10);
cylinder(h=12.7, r1=12, r2=8.5);
}

//Lower Section
difference() {
cylinder (d=26, h=15);
cylinder (d=24, h=15);
}

// Lower End cap
translate([0,0,1.5])
difference() {
cylinder(d=24, h=3);
cylinder(d=16, h=3);
}

Thanks Gene aka GCDOubleD

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

Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD to create things for myself. I'm trying to create and print a replacement switch housing for my older laptop. I have the part mostly made with the exception of a cutaway section on the top. I've tried various iterations of the difference operation, but thus far I've not achieved what I'm looking for. Can anyone offer any suggestion on a way to achieve this cut out area or something similar? I will include a pic of what I'm trying to do (not mine) and paste my code so far. My cutout wont be as deep or course. This pic shows the cutaway I'm trying to achieve <http://forum.openscad.org/file/t2166/cutaway.jpg> This pic is my part that I want to apply the cutaway to. <http://forum.openscad.org/file/t2166/mypart.jpg> My Code: //Gateway Switch Housing $fn = 50; //Top Section translate( [0,0,27.5]) union() difference() { cylinder( d = 20.0, h = 19 ); cylinder( d = 17.00, h = 19); } //Mid Section translate([0,0,15]) difference() { cylinder(h=12.7, r1=13, r2=10); cylinder(h=12.7, r1=12, r2=8.5); } //Lower Section difference() { cylinder (d=26, h=15); cylinder (d=24, h=15); } // Lower End cap translate([0,0,1.5]) difference() { cylinder(d=24, h=3); cylinder(d=16, h=3); } Thanks Gene aka GCDOubleD -- Sent from: http://forum.openscad.org/
JA
Jess Askey
Sat, Feb 17, 2018 12:46 AM

I'm not in a place to include compliable code right now but I think you just want to do something like this.. (in the spirit of a fast pseudo response)

difference() {
yourObject;
translate([x,y,z]) union() {
cylinderWithBigDiameter;
sphereWithBigDiameterTranslatedDownToTheBottomOfTheCylinder;
};
}

Use x,y,z to move the cutaway object around to get the correct cutaway.

-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of GCDoubleD
Sent: Friday, February 16, 2018 4:19 PM
To: discuss@lists.openscad.org
Subject: [OpenSCAD] Cut-Away on part design Using Difference - Assistance needed

Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD to create things for myself. I'm trying to create and print a replacement switch housing for my older laptop. I have the part mostly made with the exception of a cutaway section on the top. I've tried various iterations of the difference operation, but thus far I've not achieved what I'm looking for.

Can anyone offer any suggestion on a way to achieve this cut out area or something similar? I will include a pic of what I'm trying to do (not mine) and paste my code so far. My cutout wont be as deep or course.

This pic shows the cutaway I'm trying to achieve http://forum.openscad.org/file/t2166/cutaway.jpg

This pic is my part that I want to apply the cutaway to.
http://forum.openscad.org/file/t2166/mypart.jpg

My Code:

//Gateway Switch Housing

$fn = 50;

//Top Section
translate( [0,0,27.5])
union() difference() {
cylinder( d = 20.0, h = 19 );
cylinder( d = 17.00, h = 19);
}

//Mid Section
translate([0,0,15])
difference() {
cylinder(h=12.7, r1=13, r2=10);
cylinder(h=12.7, r1=12, r2=8.5);
}

//Lower Section
difference() {
cylinder (d=26, h=15);
cylinder (d=24, h=15);
}

// Lower End cap
translate([0,0,1.5])
difference() {
cylinder(d=24, h=3);
cylinder(d=16, h=3);
}

Thanks Gene aka GCDOubleD

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


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

I'm not in a place to include compliable code right now but I think you just want to do something like this.. (in the spirit of a fast pseudo response) difference() { yourObject; translate([x,y,z]) union() { cylinderWithBigDiameter; sphereWithBigDiameterTranslatedDownToTheBottomOfTheCylinder; }; } Use x,y,z to move the cutaway object around to get the correct cutaway. -----Original Message----- From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of GCDoubleD Sent: Friday, February 16, 2018 4:19 PM To: discuss@lists.openscad.org Subject: [OpenSCAD] Cut-Away on part design Using Difference - Assistance needed Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD to create things for myself. I'm trying to create and print a replacement switch housing for my older laptop. I have the part mostly made with the exception of a cutaway section on the top. I've tried various iterations of the difference operation, but thus far I've not achieved what I'm looking for. Can anyone offer any suggestion on a way to achieve this cut out area or something similar? I will include a pic of what I'm trying to do (not mine) and paste my code so far. My cutout wont be as deep or course. This pic shows the cutaway I'm trying to achieve <http://forum.openscad.org/file/t2166/cutaway.jpg> This pic is my part that I want to apply the cutaway to. <http://forum.openscad.org/file/t2166/mypart.jpg> My Code: //Gateway Switch Housing $fn = 50; //Top Section translate( [0,0,27.5]) union() difference() { cylinder( d = 20.0, h = 19 ); cylinder( d = 17.00, h = 19); } //Mid Section translate([0,0,15]) difference() { cylinder(h=12.7, r1=13, r2=10); cylinder(h=12.7, r1=12, r2=8.5); } //Lower Section difference() { cylinder (d=26, h=15); cylinder (d=24, h=15); } // Lower End cap translate([0,0,1.5]) difference() { cylinder(d=24, h=3); cylinder(d=16, h=3); } Thanks Gene aka GCDOubleD -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
F
fred_dot_u
Sat, Feb 17, 2018 12:47 AM

If you don't mind a brute force approach, it would appear that one could
construct a cylinder whose axis resides parallel to Y, with an attached cube
going skyward in Z:

http://forum.openscad.org/file/t824/cylinder_cut_test.png

If the radius of the cylinder doesn't reach to the edge of your cylinder,
you could create and add another cube heading Y-ward, then subtract that
module from your main build.

Somewhat OT: When I select the More, Raw it says "doesn't work" but it did.

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

If you don't mind a brute force approach, it would appear that one could construct a cylinder whose axis resides parallel to Y, with an attached cube going skyward in Z: <http://forum.openscad.org/file/t824/cylinder_cut_test.png> If the radius of the cylinder doesn't reach to the edge of your cylinder, you could create and add another cube heading Y-ward, then subtract that module from your main build. Somewhat OT: When I select the More, Raw it says "doesn't work" but it did. -- Sent from: http://forum.openscad.org/
JS
Jim Stoll
Sat, Feb 17, 2018 1:21 AM

This might give you a little more flexibility on the radius of the 'corners' of the cutout. Just something to play with:
$fn=24;
rad = 10;ht = 40;wall = 1;corner_rad = 4;corner_ht = 10;
difference() {    cylinder(r=rad, h=ht);    cylinder(r=rad-wall, h=ht+.004);    translate([corner_rad, 0, corner_ht + corner_rad])        minkowski() {            cube([rad, 2rad, ht]);            rotate([90, 0, 0]) cylinder(r=corner_rad, h=2rad);        }}

On Friday, February 16, 2018, 6:20:10 PM EST, GCDoubleD <gcdoubled@gmail.com> wrote:  

Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD
to create things for myself. I'm trying to create and print a replacement
switch housing for my older laptop. I have the part mostly made with the
exception of a cutaway section on the top. I've tried various iterations of
the difference operation, but thus far I've not achieved what I'm looking
for.

Can anyone offer any suggestion on a way to achieve this cut out area or
something similar? I will include a pic of what I'm trying to do (not mine)
and paste my code so far. My cutout wont be as deep or course.

This pic shows the cutaway I'm trying to achieve
http://forum.openscad.org/file/t2166/cutaway.jpg

This pic is my part that I want to apply the cutaway to.
http://forum.openscad.org/file/t2166/mypart.jpg

My Code:

//Gateway Switch Housing

$fn = 50;

  //Top Section
translate( [0,0,27.5])
    union() difference() {
                cylinder( d = 20.0, h = 19 );
                cylinder( d = 17.00, h = 19);
    }
     
       
       
//Mid Section
translate([0,0,15])
    difference() {
        cylinder(h=12.7, r1=13, r2=10);
        cylinder(h=12.7, r1=12, r2=8.5);
    }
   

//Lower Section   
    difference() {
        cylinder (d=26, h=15);
        cylinder (d=24, h=15);
    }
 
   
             
// Lower End cap
translate([0,0,1.5])
      difference() {
          cylinder(d=24, h=3);
          cylinder(d=16, h=3);
    }

Thanks Gene aka GCDOubleD

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


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

This might give you a little more flexibility on the radius of the 'corners' of the cutout. Just something to play with: $fn=24; rad = 10;ht = 40;wall = 1;corner_rad = 4;corner_ht = 10; difference() {    cylinder(r=rad, h=ht);    cylinder(r=rad-wall, h=ht+.004);    translate([corner_rad, 0, corner_ht + corner_rad])        minkowski() {            cube([rad, 2*rad, ht]);            rotate([90, 0, 0]) cylinder(r=corner_rad, h=2*rad);        }} On Friday, February 16, 2018, 6:20:10 PM EST, GCDoubleD <gcdoubled@gmail.com> wrote: Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD to create things for myself. I'm trying to create and print a replacement switch housing for my older laptop. I have the part mostly made with the exception of a cutaway section on the top. I've tried various iterations of the difference operation, but thus far I've not achieved what I'm looking for. Can anyone offer any suggestion on a way to achieve this cut out area or something similar? I will include a pic of what I'm trying to do (not mine) and paste my code so far. My cutout wont be as deep or course. This pic shows the cutaway I'm trying to achieve <http://forum.openscad.org/file/t2166/cutaway.jpg> This pic is my part that I want to apply the cutaway to. <http://forum.openscad.org/file/t2166/mypart.jpg> My Code: //Gateway Switch Housing $fn = 50;   //Top Section translate( [0,0,27.5])     union() difference() {                 cylinder( d = 20.0, h = 19 );                 cylinder( d = 17.00, h = 19);     }                       //Mid Section translate([0,0,15])     difference() {         cylinder(h=12.7, r1=13, r2=10);         cylinder(h=12.7, r1=12, r2=8.5);     }     //Lower Section        difference() {         cylinder (d=26, h=15);         cylinder (d=24, h=15);     }                     // Lower End cap translate([0,0,1.5])       difference() {           cylinder(d=24, h=3);           cylinder(d=16, h=3);     } Thanks Gene aka GCDOubleD -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
HL
Hans L
Sat, Feb 17, 2018 4:17 PM

It helps to simplify things down to 2D whenever possible.  If you look
at the example of the result you want, you can imagine looking at it
straight from the side which then would look like basically a rectange
with a circle on the end have been removed from the object.  So you
can draw the rectangle and circle, linear_extrude that, position it,
and subtract it:

//Gateway Switch Housing

$fn = 50;

module rounded_cutout(r, w, l) {
rotate([90,0]) translate([0,0,-(w+2)/2])
linear_extrude(w+2)
translate([-r,r]) union() {
square([r,l-r]);
circle(r=r);
}
}

//Top Section
translate( [0,0,27.5])
difference() {
cylinder( d = 20.0, h = 19 );
cylinder( d = 17.00, h = 19);
rounded_cutout(10, 20, 40);
}

//Mid Section
translate([0,0,15])
difference() {
cylinder(h=12.7, r1=13, r2=10);
cylinder(h=12.7, r1=12, r2=8.5);
}

//Lower Section
difference() {
cylinder (d=26, h=15);
cylinder (d=24, h=15);
}

// Lower End cap
translate([0,0,1.5])
difference() {
cylinder(d=24, h=3);
cylinder(d=16, h=3);
}

Hans

On Fri, Feb 16, 2018 at 5:19 PM, GCDoubleD gcdoubled@gmail.com wrote:

Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD
to create things for myself. I'm trying to create and print a replacement
switch housing for my older laptop. I have the part mostly made with the
exception of a cutaway section on the top. I've tried various iterations of
the difference operation, but thus far I've not achieved what I'm looking
for.

Can anyone offer any suggestion on a way to achieve this cut out area or
something similar? I will include a pic of what I'm trying to do (not mine)
and paste my code so far. My cutout wont be as deep or course.

This pic shows the cutaway I'm trying to achieve
http://forum.openscad.org/file/t2166/cutaway.jpg

This pic is my part that I want to apply the cutaway to.
http://forum.openscad.org/file/t2166/mypart.jpg

My Code:

//Gateway Switch Housing

$fn = 50;

//Top Section
translate( [0,0,27.5])
union() difference() {
cylinder( d = 20.0, h = 19 );
cylinder( d = 17.00, h = 19);
}

//Mid Section
translate([0,0,15])
difference() {
cylinder(h=12.7, r1=13, r2=10);
cylinder(h=12.7, r1=12, r2=8.5);
}

//Lower Section
difference() {
cylinder (d=26, h=15);
cylinder (d=24, h=15);
}

// Lower End cap
translate([0,0,1.5])
difference() {
cylinder(d=24, h=3);
cylinder(d=16, h=3);
}

Thanks Gene aka GCDOubleD

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


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

It helps to simplify things down to 2D whenever possible. If you look at the example of the result you want, you can imagine looking at it straight from the side which then would look like basically a rectange with a circle on the end have been removed from the object. So you can draw the rectangle and circle, linear_extrude that, position it, and subtract it: //Gateway Switch Housing $fn = 50; module rounded_cutout(r, w, l) { rotate([90,0]) translate([0,0,-(w+2)/2]) linear_extrude(w+2) translate([-r,r]) union() { square([r,l-r]); circle(r=r); } } //Top Section translate( [0,0,27.5]) difference() { cylinder( d = 20.0, h = 19 ); cylinder( d = 17.00, h = 19); rounded_cutout(10, 20, 40); } //Mid Section translate([0,0,15]) difference() { cylinder(h=12.7, r1=13, r2=10); cylinder(h=12.7, r1=12, r2=8.5); } //Lower Section difference() { cylinder (d=26, h=15); cylinder (d=24, h=15); } // Lower End cap translate([0,0,1.5]) difference() { cylinder(d=24, h=3); cylinder(d=16, h=3); } Hans On Fri, Feb 16, 2018 at 5:19 PM, GCDoubleD <gcdoubled@gmail.com> wrote: > Hello, Thanks for adding me to the group. I'm a new, casual user of OpenSCAD > to create things for myself. I'm trying to create and print a replacement > switch housing for my older laptop. I have the part mostly made with the > exception of a cutaway section on the top. I've tried various iterations of > the difference operation, but thus far I've not achieved what I'm looking > for. > > Can anyone offer any suggestion on a way to achieve this cut out area or > something similar? I will include a pic of what I'm trying to do (not mine) > and paste my code so far. My cutout wont be as deep or course. > > This pic shows the cutaway I'm trying to achieve > <http://forum.openscad.org/file/t2166/cutaway.jpg> > > This pic is my part that I want to apply the cutaway to. > <http://forum.openscad.org/file/t2166/mypart.jpg> > > My Code: > > //Gateway Switch Housing > > $fn = 50; > > //Top Section > translate( [0,0,27.5]) > union() difference() { > cylinder( d = 20.0, h = 19 ); > cylinder( d = 17.00, h = 19); > } > > > > //Mid Section > translate([0,0,15]) > difference() { > cylinder(h=12.7, r1=13, r2=10); > cylinder(h=12.7, r1=12, r2=8.5); > } > > > > //Lower Section > difference() { > cylinder (d=26, h=15); > cylinder (d=24, h=15); > } > > > > // Lower End cap > translate([0,0,1.5]) > difference() { > cylinder(d=24, h=3); > cylinder(d=16, h=3); > } > > Thanks Gene aka GCDOubleD > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
G
GCDoubleD
Sun, Feb 18, 2018 3:48 AM

Hello, I wanted to thank everyone for their quick replies and great ideas.
With your help, I was able come up with a completed design. All that's left
to do now is to print it!

Here's the outcome.

http://forum.openscad.org/file/t2166/Part_Final.jpg

http://forum.openscad.org/file/t2166/Part_Final2.jpg

And the finished code in case anyone is interested.

//Gateway Switch Housing

$fn = 90;

//Top Section
rad = 10;
ht = 33;
wall = 1.5;
corner_rad = 4;
corner_ht = 10;

translate([0,0,27.5])
difference() {
cylinder(r=rad, h=ht);
cylinder(r=rad-wall, h=ht+.004);
translate([corner_rad, 0, corner_ht + corner_rad+2])
minkowski() {
cube([rad, 2rad, ht]);
rotate([90, 0, 0]) cylinder(r=corner_rad,
h=3
rad);
}
}

//Mounting Flange
rotate([0,0,30]) translate([-13,-13,28])
difference(){
union() hull() {translate([9,9,0]) cylinder(r=4);
cylinder(r=4);}
translate ([9.5,9.5,0])  cylinder(r=5);
translate ([.4,.4,0])  cylinder(r=1);
}

//Mid Section
translate([0,0,15])
difference() {cylinder(h=12.7, r1=13, r2=10); cylinder(h=12.7, r1=12,
r2=8.5);}

//Lower Section
difference() {cylinder (d=26, h=15); cylinder (d=24, h=15);}

// Lower End cap
translate([0,0,1.5])
difference() {cylinder(d=24, h=3); cylinder(d=16, h=3);}

Thanks for your help!

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

Hello, I wanted to thank everyone for their quick replies and great ideas. With your help, I was able come up with a completed design. All that's left to do now is to print it! Here's the outcome. <http://forum.openscad.org/file/t2166/Part_Final.jpg> <http://forum.openscad.org/file/t2166/Part_Final2.jpg> And the finished code in case anyone is interested. //Gateway Switch Housing $fn = 90; //Top Section rad = 10; ht = 33; wall = 1.5; corner_rad = 4; corner_ht = 10; translate([0,0,27.5]) difference() { cylinder(r=rad, h=ht); cylinder(r=rad-wall, h=ht+.004); translate([corner_rad, 0, corner_ht + corner_rad+2]) minkowski() { cube([rad, 2*rad, ht]); rotate([90, 0, 0]) cylinder(r=corner_rad, h=3*rad); } } //Mounting Flange rotate([0,0,30]) translate([-13,-13,28]) difference(){ union() hull() {translate([9,9,0]) cylinder(r=4); cylinder(r=4);} translate ([9.5,9.5,0]) cylinder(r=5); translate ([.4,.4,0]) cylinder(r=1); } //Mid Section translate([0,0,15]) difference() {cylinder(h=12.7, r1=13, r2=10); cylinder(h=12.7, r1=12, r2=8.5);} //Lower Section difference() {cylinder (d=26, h=15); cylinder (d=24, h=15);} // Lower End cap translate([0,0,1.5]) difference() {cylinder(d=24, h=3); cylinder(d=16, h=3);} Thanks for your help! -- Sent from: http://forum.openscad.org/
T
Troberg
Sun, Feb 18, 2018 7:46 AM

One more thing:

difference() {cylinder(d=24, h=3); cylinder(d=16, h=3);}

You are making both cylinders the same height. That means the the ends of
the hole will be a zero thickness layer, which can cause problems. Instead,
do something like this, to make sure the hole "punches through" properly.

difference() {
cylinder(d=24, h=3);

  translate([0,0,-1])
  cylinder(d=16, h=3+2);

}

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

One more thing: > difference() {cylinder(d=24, h=3); cylinder(d=16, h=3);} You are making both cylinders the same height. That means the the ends of the hole will be a zero thickness layer, which can cause problems. Instead, do something like this, to make sure the hole "punches through" properly. difference() { cylinder(d=24, h=3); translate([0,0,-1]) cylinder(d=16, h=3+2); } -- Sent from: http://forum.openscad.org/
G
GCDoubleD
Sun, Feb 18, 2018 4:46 PM

Thanks for the input,
I will definitely make this small, but important change!  I've seen this in
other sample code and wondered what it's purpose was. It now make perfect
sense.

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

Thanks for the input, I will definitely make this small, but important change! I've seen this in other sample code and wondered what it's purpose was. It now make perfect sense. -- Sent from: http://forum.openscad.org/
J
jim_s
Sun, Feb 18, 2018 5:47 PM

FWIW, I usually use .004 for the punch-through - that distance tends to be
plenty for avoiding coincident faces, but has no real effect on adjacent
geometry, if there is any. As @troberg points out, it should be done on both
ends, so using this approach you cylinder would be extended by .008, and
translated down .004, to end up with .004 on both ends. One approach you'll
sometime see is someone declaring a variable ('e', 'p', whatever), in their
code, for the punch-through value, then using that throughout their code
when diff'ing geometry with coincident faces. (I did this at the top of the
inner cylinder in my original sample, but not the bottom, to avoid an extra
translation that might have confused what I was trying to demonstrate on
your original question...)

Incidentally, I originally wrestled with whether to send you a sample using
minkowski or not, as A) it can be a genuinely expensive operation (ie, can
dramatically increase render time), and B) its often frowned upon (even
derided... :-) by members of the community (in large part because it can be
very inefficient). I ultimately went with the minkowski approach, as it
seemed like it'd be simplest to illustrate a method for what you were trying
to do. Now that you've clearly gotten that, however, I'll show the other,
non-minkowski approach. This is slightly more code, but avoids use of
minkowski, and produces the same end result in less time.

$fn=24;

rad = 10;
ht = 40;
wall = 1;
corner_rad = 4;
corner_ht = 10;

difference() {
cylinder(r=rad, h=ht);
cylinder(r=rad-wall, h=ht+.004);
translate([0, -rad, corner_ht])
difference() {
cube([rad, 2rad, ht]);
corner_cutter(r=corner_rad, h=2
rad);
}
}

module corner_cutter() {
translate([corner_rad, rad, corner_rad])
rotate([90, 0, 0])
difference() {
translate([-corner_rad/2, -corner_rad/2, 0])
cube([corner_rad, corner_rad, 2rad], center=true);
cylinder(r=corner_rad, h=2
rad, center=true);
}
}

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

FWIW, I usually use .004 for the punch-through - that distance tends to be plenty for avoiding coincident faces, but has no real effect on adjacent geometry, if there is any. As @troberg points out, it should be done on both ends, so using this approach you cylinder would be extended by .008, and translated down .004, to end up with .004 on both ends. One approach you'll sometime see is someone declaring a variable ('e', 'p', whatever), in their code, for the punch-through value, then using that throughout their code when diff'ing geometry with coincident faces. (I did this at the top of the inner cylinder in my original sample, but not the bottom, to avoid an extra translation that might have confused what I was trying to demonstrate on your original question...) Incidentally, I originally wrestled with whether to send you a sample using minkowski or not, as A) it can be a genuinely expensive operation (ie, can dramatically increase render time), and B) its often frowned upon (even derided... :-) by members of the community (in large part because it can be very inefficient). I ultimately went with the minkowski approach, as it seemed like it'd be simplest to illustrate a method for what you were trying to do. Now that you've clearly gotten that, however, I'll show the other, non-minkowski approach. This is slightly more code, but avoids use of minkowski, and produces the same end result in less time. $fn=24; rad = 10; ht = 40; wall = 1; corner_rad = 4; corner_ht = 10; difference() { cylinder(r=rad, h=ht); cylinder(r=rad-wall, h=ht+.004); translate([0, -rad, corner_ht]) difference() { cube([rad, 2*rad, ht]); corner_cutter(r=corner_rad, h=2*rad); } } module corner_cutter() { translate([corner_rad, rad, corner_rad]) rotate([90, 0, 0]) difference() { translate([-corner_rad/2, -corner_rad/2, 0]) cube([corner_rad, corner_rad, 2*rad], center=true); cylinder(r=corner_rad, h=2*rad, center=true); } } -- Sent from: http://forum.openscad.org/
J
jim_s
Mon, Feb 19, 2018 4:45 PM

So, I love playing with this kind of stuff - I re-ran the minkowski vs
non-minkowski versions a few times, with a variety of params (same params on
the minkowski and non-minkowski versions each time), to see how dramatic the
rendering times were. I was surprised to find that the minkowski version
actually runs faster, and with fewer vertices, edges and facets generated,
than the non-minkowski approach!

I don't take this to mean that minkowski is always going to be faster (I
have personal experience showing the opposite is often the case, though
usually when I use minkowski, its with a sphere as the adding geometry -
this sample used a cylinder, which takes much less time than a sphere), but
it definitely makes me rethink my initial hesitance to use minkowski, when
the occasion arises. (There is also the possibility that I'm doing things in
a grossly inefficient way in my non-minkowski approach in this example -
more tinkering is clearly needed.)

But, bottom line, my claim that the non-minkowski approach to this
particular example would be faster was incorrect, and I'm a little bit
fascinated by that! :-)

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

So, I love playing with this kind of stuff - I re-ran the minkowski vs non-minkowski versions a few times, with a variety of params (same params on the minkowski and non-minkowski versions each time), to see how dramatic the rendering times were. I was surprised to find that the minkowski version actually runs *faster*, and with fewer vertices, edges and facets generated, than the non-minkowski approach! I don't take this to mean that minkowski is always going to be faster (I have personal experience showing the opposite is often the case, though usually when I use minkowski, its with a sphere as the adding geometry - this sample used a cylinder, which takes much less time than a sphere), but it definitely makes me rethink my initial hesitance to use minkowski, when the occasion arises. (There is also the possibility that I'm doing things in a grossly inefficient way in my non-minkowski approach in this example - more tinkering is clearly needed.) But, bottom line, my claim that the non-minkowski approach to this particular example would be faster was incorrect, and I'm a little bit fascinated by that! :-) -- Sent from: http://forum.openscad.org/