mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
fixes for change in cylinder chamfer angle
This commit is contained in:
parent
88b5c90273
commit
dd5f41a20e
2 changed files with 17 additions and 3 deletions
18
masks3d.scad
18
masks3d.scad
|
@ -98,7 +98,7 @@ module chamfer_corner_mask(chamfer=1, anchor=CENTER, spin=0, orient=UP) {
|
||||||
// chamfer = Size of the edge chamfered, inset from edge.
|
// chamfer = Size of the edge chamfered, inset from edge.
|
||||||
// ---
|
// ---
|
||||||
// d = Diameter of cylinder to chamfer. Use instead of r.
|
// d = Diameter of cylinder to chamfer. Use instead of r.
|
||||||
// ang = Angle of chamfer in degrees from vertical. (Default: 45)
|
// ang = Angle of chamfer in degrees from the horizontal. (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)
|
// 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)
|
||||||
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
|
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
|
||||||
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
|
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
|
||||||
|
@ -113,12 +113,26 @@ module chamfer_corner_mask(chamfer=1, anchor=CENTER, spin=0, orient=UP) {
|
||||||
// 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);
|
||||||
// }
|
// }
|
||||||
|
// Example: Changing the chamfer angle
|
||||||
|
// difference() {
|
||||||
|
// cylinder(r=50, h=100, center=true);
|
||||||
|
// up(50) #chamfer_cylinder_mask(r=50, chamfer=10, ang=70);
|
||||||
|
// }
|
||||||
|
// Example:
|
||||||
|
// difference() {
|
||||||
|
// cylinder(r=50, h=100, center=true);
|
||||||
|
// up(50) chamfer_cylinder_mask(r=50, chamfer=10, ang=70);
|
||||||
|
// }
|
||||||
// Example: Masking by Attachment
|
// Example: Masking by Attachment
|
||||||
|
// diff()
|
||||||
|
// cyl(d=100,h=40)
|
||||||
|
// attach([TOP,BOT])
|
||||||
|
// tag("remove")chamfer_cylinder_mask(d=100, chamfer=10);
|
||||||
function chamfer_cylinder_mask(r, chamfer, d, ang=45, from_end=false, anchor=CENTER, spin=0, orient=UP) = no_function("chamfer_cylinder_mask");
|
function chamfer_cylinder_mask(r, chamfer, d, ang=45, from_end=false, anchor=CENTER, spin=0, orient=UP) = no_function("chamfer_cylinder_mask");
|
||||||
module chamfer_cylinder_mask(r, chamfer, d, ang=45, from_end=false, anchor=CENTER, spin=0, orient=UP)
|
module chamfer_cylinder_mask(r, chamfer, d, ang=45, from_end=false, anchor=CENTER, spin=0, orient=UP)
|
||||||
{
|
{
|
||||||
r = get_radius(r=r, d=d, dflt=1);
|
r = get_radius(r=r, d=d, dflt=1);
|
||||||
ch = from_end? chamfer : opp_ang_to_adj(chamfer,ang);
|
ch = from_end? chamfer : opp_ang_to_adj(chamfer,90-ang);
|
||||||
attachable(anchor,spin,orient, r=r, l=ch*2) {
|
attachable(anchor,spin,orient, r=r, l=ch*2) {
|
||||||
difference() {
|
difference() {
|
||||||
cyl(r=r+chamfer, l=ch*2, anchor=CENTER);
|
cyl(r=r+chamfer, l=ch*2, anchor=CENTER);
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ module _nutshape(nutwidth, h, shape, bevel1, bevel2)
|
||||||
fn = quantup(segs(r=nutwidth/2),shape=="hex"?6:4);
|
fn = quantup(segs(r=nutwidth/2),shape=="hex"?6:4);
|
||||||
d = shape=="hex" ? 2*nutwidth/sqrt(3) : sqrt(2)*nutwidth;
|
d = shape=="hex" ? 2*nutwidth/sqrt(3) : sqrt(2)*nutwidth;
|
||||||
chamfsize = (d-nutwidth)/2/bevel_d;
|
chamfsize = (d-nutwidth)/2/bevel_d;
|
||||||
cyl(d=d*.99,h=h+.01,realign=true,circum=true,$fn=fn,chamfer1=bevel1?chamfsize:0,chamfer2=bevel2?chamfsize:0,chamfang=90-30);
|
cyl(d=d*.99,h=h+.01,realign=true,circum=true,$fn=fn,chamfer1=bevel1?chamfsize:0,chamfer2=bevel2?chamfsize:0,chamfang=30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue