so i started writing simple code for designing the cup charger
$fn = 64;
// all by mm
difference()
{
x();
tube(100,3);
}
module x()
{
translate([0,0,-10])
color([0.25,0.25,0.25]) cylinder (h=10,r=100);
rotate([0,0,90])
translate([-(100-12.5),5,0]) roundedRect([25,3,0.2],2);
rotate([0,0,90])
translate([-(100-12.5),-5,0]) roundedRect([25,3,0.2],2);
}
module tube(size, radius)
{
rotate_extrude()
{
translate([size,0,0])
circle(r = radius);
}
}
module roundedRect(size, radius)
{
x = size[0];
y = size[1];
z = size[2];
linear_extrude(height=z)
hull()
{
// place 4 circles in the corners, with the given radius
translate([(-x/2)+(radius/2), (-y/2)+(radius/2), 0])
circle(r=radius);
translate([(x/2)-(radius/2), (-y/2)+(radius/2), 0])
circle(r=radius);
translate([(-x/2)+(radius/2), (y/2)-(radius/2), 0])
circle(r=radius);
translate([(x/2)-(radius/2), (y/2)-(radius/2), 0])
circle(r=radius);
}
}
the final result is:

Note:
however, using sphere to cut the cylinder is not what intended ..
it should be fillet design so in order to achieve that ..
i researched online for openscad fillet found this link but didnt try it yet: