<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Rounding the edge of a hole?</title>
        <description> This is a simplified extract from something I&#039;m designing:


bodyWidth = 25;    
bodyHeight = 15;  
slotWidth = 6; 
slotHeight = 10;

$fn = 50;

module slot()
{
    rotate( [-90, -90, 0] )
    union()
    {
        cylinder(d = slotWidth, h = bodyWidth + 2);
        translate( [0, -slotWidth/2, 0] )
            cube( [bodyHeight - slotHeight, slotWidth, bodyWidth + 2] );
        translate( [bodyHeight - slotHeight, 0, 0] )
            cylinder(d = slotWidth, h = bodyWidth + 2);
    }
}

difference()
{
    cube(bodyWidth);
    translate( [bodyWidth/2, -1, bodyWidth/2] )
        #slot();
}

This results in a cube with an oval hole through it (see attachment)

What I would like to do is to put a nice rounded edge around the hole at both ends.  The trouble is, I don&#039;t know where to start!  I would appreciate it if someone could give me some suggested techniques, helpful hints, etc.  I&#039;m not expecting anyone to actually do the work - just give me a clue about how to do it!

Note - this is something I&#039;ve often wanted to do, but shied away from due to a lack of knowledge.

TIA,
David</description>
        <link>https://reprap.org/forum/read.php?313,859885,859885#msg-859885</link>
        <lastBuildDate>Sat, 07 Mar 2026 10:35:35 -0500</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,892477#msg-892477</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,892477#msg-892477</link>
            <description><![CDATA[ Another approach is to use Torleif Ceder's very handy unionRound() module, available on his github page.<br />
It allows you to join any two arbitrary objects with a radius fillet.<br />
<br />
In this case I join two cylinders using unionRound() and then subtract this from a cube.    Easy to extend for the oval'ed slot case.<br />
<br />
<br />
module unionRound(r, detail = 8) {<br />
        epsilon = 1e-6;<br />
        children(0);<br />
        children(1);<br />
        step = 90 / detail;<br />
      for (i = [0:  detail-1]) {<br />
            {<br />
                x = r - sin(i * step ) * r;<br />
                y = r - cos(i * step ) * r;<br />
                xi = r - sin((i * step + step)  ) * r;<br />
                yi = r - cos((i * step + step)  ) * r;<br />
                color(rands(0, 1, 3, i))<br />
                hull() {<br />
                    intersection() {<br />
                        // shell(epsilon) <br />
                        clad(x) children(0);<br />
                        // shell(epsilon) <br />
                        clad(y) children(1);<br />
                    }<br />
                    intersection() {<br />
                        // shell(epsilon) <br />
                        clad(xi) children(0);<br />
                        // shell(epsilon) <br />
                        clad(yi) children(1);<br />
                    }<br />
                }<br />
            }<br />
        }<br />
    }<br />
    // unionRound helper expand by r<br />
    module clad(r) {<br />
        minkowski() {<br />
            children();<br />
            //        icosphere(r,2);<br />
             isosphere(r,70); <br />
        }<br />
    }<br />
    // unionRound helper<br />
    module shell(r) {<br />
        difference() {<br />
            clad(r) children();<br />
            children();<br />
        }<br />
    }<br />
    /*    <br />
    // The following is a sphere with some equidistant properties.<br />
    // Not strictly necessary<br />
<br />
    Kogan, Jonathan (2017) "A New Computationally Efficient Method for Spacing n Points on a Sphere," Rose-Hulman Undergraduate Mathematics Journal: Vol. 18 : Iss. 2 , Article 5.<br />
    Available at: [<a href="https://scholar.rose-hulman.edu/rhumj/vol18/iss2/5" target="_blank"  rel="nofollow">scholar.rose-hulman.edu</a>] */<br />
    function sphericalcoordinate(x,y)=  [cos(x  )*cos(y  ), sin(x  )*cos(y  ), sin(y  )];<br />
    function NX(n,x)= <br />
    let(toDeg=57.2958,PI=acos(-1)/toDeg,<br />
    start=(-1.+1./(n-1.)),increment=(2.-2./(n-1.))/(n-1.) )<br />
    [ for (j= [0:n-1])let (s=start+j*increment )<br />
    sphericalcoordinate(   s*x*toDeg,  PI/2.* sign(s)*(1.-sqrt(1.-abs(s)))*toDeg)];<br />
    function generatepoints(n)= NX(n,0.1+1.2*n);<br />
    module isosphere(r,detail){<br />
    a= generatepoints(detail);<br />
    scale(r)hull()polyhedron(a,[[for(i=[0:len(a)-1])i]]);<br />
}<br />
<br />
<br />
$fn=60;<br />
<br />
difference()<br />
{<br />
<br />
cube([20,20,10],center=true);<br />
<br />
unionRound(4, detail = 10)<br />
{<br />
  translate([0,0,10])<br />
  cylinder(h=10,d=20,center=true);<br />
  cylinder(h=20,d=5,center=true);<br />
}<br />
<br />
}]]></description>
            <dc:creator>brokencase</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Sat, 08 Apr 2023 21:40:47 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,889225#msg-889225</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,889225#msg-889225</link>
            <description><![CDATA[ As mentioned earlier, I said I would have to try my suggestion. Still not fast but I feel way faster then minkowsky on any day.<br />
<br />
Just a pig to rewrite all these modules in subroutines to be applied in different parts of the design, and again, if you have many it will be slow, but probably faster then minkowsky. Where the previous solution crashed on my pc, this reviewed in about 1 minute.<br />
<br />
$fn=64;<br />
based=40;<br />
baseh=10;<br />
bodyd=20;<br />
bodyh=10;<br />
trans=50;<br />
//calling parts<br />
for(a=[0:1:trans])<br />
translate([a,0,0])pin_base();<br />
hull(){<br />
pin_body();<br />
translate([trans,0,0])pin_body();<br />
}<br />
hull(){<br />
pin_top();<br />
translate([trans,0,0])pin_top();<br />
}<br />
//base<br />
module torus_cut(){<br />
rotate_extrude(angle=360)  translate([based/2, 0, 0])circle(baseh); <br />
}<br />
module pin_base(){<br />
difference(){<br />
cylinder(h=baseh,d=based,center=true);<br />
translate([0,0,baseh/2])torus_cut();<br />
}<br />
}<br />
//body<br />
module pin_body(){<br />
translate([0,0,baseh/2+bodyh/2])cylinder(h=baseh,d=bodyd,center=true);<br />
}<br />
//top<br />
module pin_top(){<br />
translate([0,0,baseh/2+bodyh])sphere(d=bodyd);<br />
}]]></description>
            <dc:creator>3dcase</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 28 Apr 2022 04:55:11 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,889224#msg-889224</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,889224#msg-889224</link>
            <description><![CDATA[ Looks like a nice solution to a serious headache problem in openscad, until I tried creating a pin from a filleted cylinder with rounded tip and flared base. Then in a "for" loop to create a sideways elongated tab from it, to be used in a difference from a cube. This is a very standard locating pin style as used in injection molding machines.<br />
I had to force a quit on openscad after maybe 30 minutes of doing nothing and then it started to affect the rest of the computer.<br />
I take your word for it that it is faster then minkowski (which I avoid like the plague for being too slow to be useful) but IMHO this is still not useful either. My code was only 17 lines long! (which I had not saved before the crash)<br />
I might try something else later, for which I got the idea looking at your solution. Split the pin I try to make in 3 parts, base, center and tip.<br />
base is a large cylinder with a torus taken off it so it creates the bottom flare. center is just a cylinder, top is just a sphere.<br />
Now translate to the length of the tab I need to make, and hull each of the three parts separately. Then put them in a module and use them to difference out from a cube.....need to try this to see if it will be just as slow.<br />
<br />
So I still love Openscad to bits, but until something works better then these solutions my designs will resemble an mine-craft landscape, mostly anyway. Thanks to chamfer.scad though, just takes the sharp edges off this problem a little ;-)]]></description>
            <dc:creator>3dcase</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 28 Apr 2022 03:41:03 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,878739#msg-878739</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,878739#msg-878739</link>
            <description><![CDATA[ Just commented on your Thingiverse design, very useful.  thank you.]]></description>
            <dc:creator>rogercw1</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Wed, 11 Nov 2020 06:35:43 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,867001#msg-867001</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,867001#msg-867001</link>
            <description><![CDATA[ Here's a filleted cylinder tool like enif's, but should run faster:<br />
<pre class="bbcode">
module fillet_cylinder(
 r,      // cylinder radius
 h,      // cylinder height
 b=0,    // bottom chamfer radius (=0 none, &gt;0 outside, &lt;0 inside)
 t=0,    // top chamfer radius (=0 none, &gt;0 outside, &lt;0 inside,
 deg=10  // degrees per rib of fillet
)
 rotate_extrude()
  polygon(concat([[0,h],[0,0]],
   [for(a=[0:deg:90]) [r-b*(sin(a)-1), abs(b)*(1-cos(a))]],       //bottom fillet
   [for(a=[90:-deg:0]) [r-t*(sin(a)-1), h-abs(t)*(1-cos(a))]]));  //top fillet</pre>
<br />
As an easter egg, if you also pass in $fn=4, you'll get a filletted square prism.]]></description>
            <dc:creator>tray</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Mon, 03 Feb 2020 23:45:40 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,860070#msg-860070</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,860070#msg-860070</link>
            <description><![CDATA[ I will do! Thanks for the help.]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Sun, 29 Sep 2019 08:13:54 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,860065#msg-860065</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,860065#msg-860065</link>
            <description><![CDATA[ @David J<br />
<br />
This is perfect - thanks for giving credit :)<br />
<br />
Since I am also quite active on Thingiverse, you could -but only if you like!- underlay the word "<a href="http://www.thingiverse.com/enif" target="_blank"  rel="nofollow">enif</a>" with a link to my thingiverse account, which is www.thingiverse.com/enif .]]></description>
            <dc:creator>enif</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Sun, 29 Sep 2019 06:28:04 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,860064#msg-860064</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,860064#msg-860064</link>
            <description><![CDATA[ Well, enif's code works very nicely - here's what I did with it:<br />
<br />
<a href="https://www.thingiverse.com/thing:3884899" target="_blank"  rel="nofollow">Desk cable organiser</a><br />
<br />
Enif - have a look at what I did with your code, and let me know if you're happy with what I've done.  Also, if you want a more detailed credit in the code and on Thingiverse then please PM me with your details.<br />
<br />
Many thanks to all,<br />
David]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Sun, 29 Sep 2019 04:06:30 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859953#msg-859953</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859953#msg-859953</link>
            <description><![CDATA[ Wow, that's tough to read! :o<br />
Clever though... I think.  I'll have to get studying. :)<br />
<br />
<br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong>enif</strong><br />
Interesting problem... :)<br />
<br />
Here my approach, which is a bit different.  Instead of subtracting cylinders to get the chamfer, I construct the cylinder in slices:<br />
<br />
-- snip for brevity ---<br />
</div></blockquote>]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 15:48:22 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859952#msg-859952</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859952#msg-859952</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>frankvdh</strong><br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong>David J</strong><br />
Right - I tried using minkowski... life is too short... and all of my dimensions were screwed up (as expected); it would be a PITA to make size adjustments to compensate.  So, good idea, but too painful.</div></blockquote>
<br />
Right... I'd forgotten that Minkowski with a sphere moves the surface by the radius of the sphere. For sphere of radius 1, you need to subtract 1 from each of your width and height  variables.</div></blockquote>
<br />
Correct - and it's not a significant problem if you're dealing with the external measurements of a solid.  However, both sides of the holes are also reduced by the radius of the sphere - the calculations just get too complicated.  But really the compilation time is the major issue when you have more than 1 hole in the object.]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 15:43:19 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859947#msg-859947</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859947#msg-859947</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>David J</strong><br />
Right - I tried using minkowski... life is too short... and all of my dimensions were screwed up (as expected); it would be a PITA to make size adjustments to compensate.  So, good idea, but too painful.</div></blockquote>
<br />
Right... I'd forgotten that Minkowski with a sphere moves the surface by the radius of the sphere. For sphere of radius 1, you need to subtract 1 from each of your width and height  variables.]]></description>
            <dc:creator>frankvdh</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 14:58:57 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859940#msg-859940</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859940#msg-859940</link>
            <description><![CDATA[ @Dust<br />
<br />
Thanks! :)]]></description>
            <dc:creator>enif</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 12:53:10 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859939#msg-859939</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859939#msg-859939</link>
            <description><![CDATA[ @enif <br />
<br />
Darn that is a good way to do it!!]]></description>
            <dc:creator>Dust</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 12:34:19 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859937#msg-859937</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859937#msg-859937</link>
            <description><![CDATA[ Interesting problem... :)<br />
<br />
Here my approach, which is a bit different.  Instead of subtracting cylinders to get the chamfer, I construct the cylinder in slices:<br />
<pre class="bbcode">
// chamfercyl - create a cylinder with round chamfered ends
module chamfercyl(
   r,              // cylinder radius
   h,              // cylinder height
   b=0,            // bottom chamfer radius (=0 none, &gt;0 outside, &lt;0 inside)
   t=0,            // top chamfer radius (=0 none, &gt;0 outside, &lt;0 inside)
   offset=[[0,0]], // optional offsets in X and Y to create
                   // convex hulls at slice level
   slices=10,      // number of slices used for chamfering
   eps=0.01,       // tiny overlap of slices
){
    astep=90/slices;
    hull()for(o = offset)
       translate([o[0],o[1],abs(b)-eps])cylinder(r=r,h=h-abs(b)-abs(t)+2*eps);
    if(b)for(a=[0:astep:89.999])hull()for(o = offset)
       translate([o[0],o[1],abs(b)-abs(b)*sin(a+astep)-eps])
          cylinder(r2=r+(1-cos(a))*b,r1=r+(1-cos(a+astep))*b,h=(sin(a+astep)-sin(a))*abs(b)+2*eps);
    if(t)for(a=[0:astep:89.999])hull()for(o = offset)
       translate([o[0],o[1],h-abs(t)+abs(t)*sin(a)-eps])
          cylinder(r1=r+(1-cos(a))*t,r2=r+(1-cos(a+astep))*t,h=(sin(a+astep)-sin(a))*abs(t)+2*eps);
}

// now build David's example, the cube with the chamfered hole (viewed from below to make things easy...)
$fn=36;
difference(){
   translate([-12.5,-12.5,0])cube(25);
   chamfercyl(3,25,3,3,[[-2,0],[2,0]]);
}</pre>
<div id="div_ef9ab7b18b6b3e6a6e751309eca7cfca"
     class="mod_embed_images_extended"
     style="width:533px">

  

    
      
    

    <div id="imagediv_ef9ab7b18b6b3e6a6e751309eca7cfca" class="mod_embed_images_image"
         style="width:533px; height:400px">

    

    <a href="https://reprap.org/forum/file.php?313,file=112796,filename=chamferedcyl-2.png">
        <img src="/forum/thumbcache/b9f/152/795/609/129/002/4f2/fdb/ebf/cfb/a1_800x400.png"
             width="533"
             height="400"
             id="image_ef9ab7b18b6b3e6a6e751309eca7cfca"
             alt=""
             title=""/>
    </a>

    

    </div>

    <div class="mod_embed_images_info " id="info_ef9ab7b18b6b3e6a6e751309eca7cfca"
      style="display:block">
      <a id="link_ef9ab7b18b6b3e6a6e751309eca7cfca" href="https://reprap.org/forum/file.php?313,file=112796,filename=chamferedcyl-2.png"></a>
    </div>

  

 </div>


<script type="text/javascript">
mod_embed_images_loadimage('ef9ab7b18b6b3e6a6e751309eca7cfca', '/forum/thumbcache/b9f/152/795/609/129/002/4f2/fdb/ebf/cfb/a1_800x400.png', 'https://reprap.org/forum/file.php?313,file=112796,filename=chamferedcyl-2.png', 'https://reprap.org/forum/addon.php?313,module=embed_images,check_scaling=1,url=https%3A%2F%2Freprap.org%2Fforum%2Ffile.php%3F313%2Cfile%3D112796%2Cfilename%3Dchamferedcyl-2.png', '', 859937, 800, 400, 'Loading image ...', false);
</script>
<br />
<br />
The module <i>chamfercyl()</i> takes as parameters the radius <i>r</i> and height <i>h</i> of the cylinder and in addition the chamfer radii <i>b</i> for bottom and <i>t</i> for top, where a positive chamfer radius goes to the outside and a negative to the inside of the main cylinder. The <i>slices</i> parameter gives the number of slices for rounding the chamfer. The optional <i>offset</i> array can be used to generate a convex hull at the slice level (cannot be done at the object level because the final object is not convex if outside chamfering is used).  In David's object I use the offsets to make a slot instead of a round hole. Finally, the parameter <i>eps</i> can be used to add a tiny overlap of the slices.<br />
<br />
Here some more simple examples to show the basic working of the module <i>chamfercyl()</i>:<br />
<pre class="bbcode">
translate([-60,0,0])chamfercyl(10,50,0,12);
translate([-30,0,0])chamfercyl(10,50,-3,-6);
translate([0,0,0])chamfercyl(10,50,7,-3);
translate([30,0,0])chamfercyl(10,50,-9,2);
translate([60,0,0])chamfercyl(10,50,4,4);</pre>
gives the following cylinders:<br />
<br />
<div id="div_57380d7877123b113b00aadad03a0068"
     class="mod_embed_images_extended"
     style="width:533px">

  

    
      
    

    <div id="imagediv_57380d7877123b113b00aadad03a0068" class="mod_embed_images_image"
         style="width:533px; height:400px">

    

    <a href="https://reprap.org/forum/file.php?313,file=112795,filename=chamferedcyl-1.png">
        <img src="/forum/thumbcache/9ed/5cf/3b9/e9b/b72/582/181/dd3/87f/716/40_800x400.png"
             width="533"
             height="400"
             id="image_57380d7877123b113b00aadad03a0068"
             alt=""
             title=""/>
    </a>

    

    </div>

    <div class="mod_embed_images_info " id="info_57380d7877123b113b00aadad03a0068"
      style="display:block">
      <a id="link_57380d7877123b113b00aadad03a0068" href="https://reprap.org/forum/file.php?313,file=112795,filename=chamferedcyl-1.png"></a>
    </div>

  

 </div>


<script type="text/javascript">
mod_embed_images_loadimage('57380d7877123b113b00aadad03a0068', '/forum/thumbcache/9ed/5cf/3b9/e9b/b72/582/181/dd3/87f/716/40_800x400.png', 'https://reprap.org/forum/file.php?313,file=112795,filename=chamferedcyl-1.png', 'https://reprap.org/forum/addon.php?313,module=embed_images,check_scaling=1,url=https%3A%2F%2Freprap.org%2Fforum%2Ffile.php%3F313%2Cfile%3D112795%2Cfilename%3Dchamferedcyl-1.png', '', 859937, 800, 400, 'Loading image ...', false);
</script>
<br/>]]></description>
            <dc:creator>enif</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 11:49:15 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859934#msg-859934</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859934#msg-859934</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Dust</strong><br />
My code is freeware!  do with it what you wish, no strings attached.</div></blockquote>
<br />
Thank you!  If I do create a library then you will be credited in the header... :)-D]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 10:36:00 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859919#msg-859919</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859919#msg-859919</link>
            <description><![CDATA[ My code is freeware!  do with it what you wish, no strings attached.]]></description>
            <dc:creator>Dust</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 08:51:33 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859914#msg-859914</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859914#msg-859914</link>
            <description><![CDATA[ Right - I tried using minkowski... life is too short... and all of my dimensions were screwed up (as expected); it would be a PITA to make size adjustments to compensate.  So, good idea, but too painful.<br />
<br />
I've been trying to develop my own idea, and here's how far I've got:<br />
<br />
[attachment 112788 Screenshotat2019-09-2612-50-13.png]<br />
<br />
UPDATE 1: I've just look at the code written by 'Dust' - mine follows a similar technique.  I didn't copy yours, honest!<br />
UPDATE 2: Dust's approach is better than mine...<br />
<br />
Obviously it doesn't yet achieve my original objective, but it's a start.  I won't show the code just yet as it's messy and horrible, but I do plan to make it into a library so I'll put it up here for review when it's in decent shape (and when I'm not too ashamed to show it in public!).<br />
<br />
Cheers,<br />
David]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 08:06:34 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859900#msg-859900</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859900#msg-859900</link>
            <description><![CDATA[ Hmm - I need to study your answers! Especially that code example...<br />
<br />
I hadn't thought about using minkowski when the object has the slots - in the real project I had applied it to the body prior to 'cutting' the slots.  I shall have to try that out.  However it means re-arranging my code as I have included screw holes in the same part as the slots (not a major crisis).<br />
<br />
My other random thought last night was about making the slot itself a better shape - making the cube and two cylinders with 'fat ends' so that a difference with a larger object results in a rounded exit. I suspect that's what the code example is doing, but I'll confirm that later today...<br />
<br />
Thanks for all your help - I'll see how it works out.]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 04:24:15 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859894#msg-859894</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859894#msg-859894</link>
            <description><![CDATA[ If you can live with the outside edges of the cube being rounded, then Minkowski is the answer. However, this is very slow operation. Put <b>minkowski() {... sphere(1); }</b> around your main block.<br />
<br />
<br />
<pre class="bbcode">
minkowski() {
difference() {
    cube(bodyWidth);
    translate( [bodyWidth/2, -1, bodyWidth/2] )
        slot();
}
sphere(1);
}
</pre>]]></description>
            <dc:creator>frankvdh</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 00:52:05 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859893#msg-859893</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859893#msg-859893</link>
            <description><![CDATA[ But if you insist on rounded chamfers. Here is a cylinder for cut out with round chamfer  (I just wrote this) <br />
<br />
<pre class="bbcode">
module Chamfered_Cylinder(CylinderDiameter,CylinderHeight,ChamferRadius,ChamferFacits) {
    difference () {
        union() {
            //Central Cyclinder
            cylinder(d=CylinderDiameter,h=CylinderHeight);
            //Bottom Chamfer cylinder
            translate ([0,0,0]) cylinder(d=CylinderDiameter+ChamferRadius,h=ChamferRadius/2);
            //Top Chamfer cylinder
            translate ([0,0,CylinderHeight-ChamferRadius/2]) cylinder(d=CylinderDiameter+ChamferRadius,h=ChamferRadius/2);
        }

        //Generate Bottom chamfer 
        for (i = [0:1:ChamferFacits-1]) {
            rotate([90,0,i*360/ChamferFacits+90]) translate([CylinderDiameter/2+ChamferRadius/2,ChamferRadius/2,-ChamferRadius/2]) cylinder(d=ChamferRadius, h=ChamferRadius);
        }

        //generate Top chamfer
        for (i = [0:1:ChamferFacits-1]) {
            rotate([90,0,i*360/ChamferFacits+90]) translate([CylinderDiameter/2+ChamferRadius/2,CylinderHeight-ChamferRadius/2,-ChamferRadius/2]) cylinder(d=ChamferRadius, h=ChamferRadius);
        }
    }
}


CylinderDiameter = 15;
CylinderHeight = 40;
ChamferRadius = 5;
ChamferFacits = 50;
//Its best to have the cylinder facits and the Chamfer facits the same value.
$fn=ChamferFacits;  

//Extra cylinder on bottom to appease the scad gods
translate ([0,0,-ChamferRadius]) cylinder(d=CylinderDiameter+ChamferRadius,h=ChamferRadius);
//Extra cylinder on top to appease the scad gods
translate ([0,0,CylinderHeight]) cylinder(d=CylinderDiameter+ChamferRadius,h=ChamferRadius);
//The Cylinder with chamfer
Chamfered_Cylinder(CylinderDiameter,CylinderHeight,ChamferRadius,ChamferFacits);
</pre>]]></description>
            <dc:creator>Dust</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Thu, 26 Sep 2019 00:29:48 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859891#msg-859891</guid>
            <title>Re: Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859891#msg-859891</link>
            <description><![CDATA[ I presume you want this chamfer removed from the cube not the slot. <br />
<br />
That is a rounded chamfer, and is very annoying do in openscad.  (This is one of openscads biggest issues in my view)<br />
<br />
You need to apply the chamfer to each component part, ie two cylinders and the square. <br />
<br />
What I do is a 45 degree chamfer.  Ie create some 90 degree cones at each end and remove how much you want<br />
Do the same on the straight parts with a 45 degree rotated cube.<br />
This is much easier to print, you don't get overhangs over 45 degrees.]]></description>
            <dc:creator>Dust</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Wed, 25 Sep 2019 22:53:55 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?313,859885,859885#msg-859885</guid>
            <title>Rounding the edge of a hole?</title>
            <link>https://reprap.org/forum/read.php?313,859885,859885#msg-859885</link>
            <description><![CDATA[ This is a simplified extract from something I'm designing:<br />
<br />
<pre class="bbcode">
bodyWidth = 25;    
bodyHeight = 15;  
slotWidth = 6; 
slotHeight = 10;

$fn = 50;

module slot()
{
    rotate( [-90, -90, 0] )
    union()
    {
        cylinder(d = slotWidth, h = bodyWidth + 2);
        translate( [0, -slotWidth/2, 0] )
            cube( [bodyHeight - slotHeight, slotWidth, bodyWidth + 2] );
        translate( [bodyHeight - slotHeight, 0, 0] )
            cylinder(d = slotWidth, h = bodyWidth + 2);
    }
}

difference()
{
    cube(bodyWidth);
    translate( [bodyWidth/2, -1, bodyWidth/2] )
        #slot();
}</pre>
<br />
This results in a cube with an oval hole through it (see attachment)<br />
<br />
What I would like to do is to put a nice rounded edge around the hole at both ends.  The trouble is, I don't know where to start!  I would appreciate it if someone could give me some suggested techniques, helpful hints, etc.  I'm not expecting anyone to actually do the work - just give me a clue about how to do it!<br />
<br />
Note - this is something I've often wanted to do, but shied away from due to a lack of knowledge.<br />
<br />
TIA,<br />
David]]></description>
            <dc:creator>David J</dc:creator>
            <category>OpenSCAD</category>
            <pubDate>Wed, 25 Sep 2019 16:58:58 -0400</pubDate>
        </item>
    </channel>
</rss>
