mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-04 03:09:45 +00:00
Added chamfer_hole_mask()
This commit is contained in:
parent
96847ba535
commit
deb6116e49
1 changed files with 36 additions and 6 deletions
42
masks.scad
42
masks.scad
|
@ -216,25 +216,55 @@ module chamfer_hole_mask(r=1.0, d=undef, chamfer=0.25)
|
||||||
// Create a mask that can be used to bevel/chamfer the end of a cylinder.
|
// Create a mask that can be used to bevel/chamfer the end of a cylinder.
|
||||||
// Difference it from the cylinder to be chamferred. The center of the mask object
|
// Difference it from the cylinder to be chamferred. The center of the mask object
|
||||||
// should align exactly with the center of the end of the cylinder to be chamferred.
|
// should align exactly with the center of the end of the cylinder to be chamferred.
|
||||||
// r = radius of hole to chamfer.
|
// r = Radius of cylinder to chamfer.
|
||||||
// d = Diameter of hole to chamfer. Use instead of r.
|
// d = Diameter of cylinder to chamfer. Use instead of r.
|
||||||
// chamfer = size of the edge chamferred. (Default: 0.25)
|
// chamfer = Size of the edge chamferred, inset from edge. (Default: 0.25)
|
||||||
|
// ang = Angle of chamfer in degrees from vertical. (Default: 45)
|
||||||
|
// from_end = If true, chamfer size is measured from end of cylinder. If false, chamfer is measured outset from the radius of the cylinder. (Default: false)
|
||||||
// Example:
|
// Example:
|
||||||
// $fa=2; $fs=2;
|
// $fa=2; $fs=2;
|
||||||
// difference() {
|
// difference() {
|
||||||
// cylinder(r=50, h=100, center=true);
|
// cylinder(r=50, h=100, center=true);
|
||||||
// up(50) chamfer_cylinder_mask(r=50, chamfer=10);
|
// up(50) chamfer_cylinder_mask(r=50, chamfer=10);
|
||||||
// }
|
// }
|
||||||
module chamfer_cylinder_mask(r=1.0, d=undef, chamfer=0.25)
|
module chamfer_cylinder_mask(r=1.0, d=undef, chamfer=0.25, ang=45, from_end=false)
|
||||||
{
|
{
|
||||||
|
h = chamfer * (from_end? 1 : tan(90-ang));
|
||||||
r = d==undef? r : d/2;
|
r = d==undef? r : d/2;
|
||||||
|
r2 = r - chamfer * (from_end? tan(ang) : 1);
|
||||||
difference() {
|
difference() {
|
||||||
cube([2*r+1, 2*r+1, 2*chamfer], center=true);
|
cube([2*r+1, 2*r+1, 2*h], center=true);
|
||||||
down(chamfer+0.01) cylinder(r1=r, r2=r-chamfer, h=chamfer, center=false);
|
down(h+0.01) cylinder(r1=r, r2=r2, h=h+0.01, center=false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Create a mask that can be used to bevel/chamfer the end of a cylindrical hole.
|
||||||
|
// Difference it from the hole to be chamferred. The center of the mask object
|
||||||
|
// should align exactly with the center of the end of the hole to be chamferred.
|
||||||
|
// r = Radius of hole to chamfer.
|
||||||
|
// d = Diameter of hole to chamfer. Use instead of r.
|
||||||
|
// chamfer = Size of the chamfer. (Default: 0.25)
|
||||||
|
// ang = Angle of chamfer in degrees from vertical. (Default: 45)
|
||||||
|
// from_end = If true, chamfer size is measured from end of hole. If false, chamfer is measured outset from the radius of the hole. (Default: false)
|
||||||
|
// Example:
|
||||||
|
// $fa=2; $fs=2;
|
||||||
|
// difference() {
|
||||||
|
// cube(100, center=true);
|
||||||
|
// cylinder(d=50, h=100.1, center=true);
|
||||||
|
// up(50) chamfer_hole_mask(d=50, chamfer=10);
|
||||||
|
// }
|
||||||
|
module chamfer_hole_mask(r=1.0, d=undef, chamfer=0.25, ang=45, from_end=false)
|
||||||
|
{
|
||||||
|
h = chamfer * (from_end? 1 : tan(90-ang));
|
||||||
|
r = d==undef? r : d/2;
|
||||||
|
r2 = r + chamfer * (from_end? tan(ang) : 1);
|
||||||
|
down(h-0.01) cylinder(r1=r, r2=r2, h=h, center=false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Creates a shape that can be used to fillet a vertical 90 degree edge.
|
// Creates a shape that can be used to fillet a vertical 90 degree edge.
|
||||||
// Difference it from the object to be filletted. The center of the mask
|
// Difference it from the object to be filletted. The center of the mask
|
||||||
// object should align exactly with the edge to be filletted.
|
// object should align exactly with the edge to be filletted.
|
||||||
|
|
Loading…
Reference in a new issue