mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Bugfix for rounding in cylinder_mask()
This commit is contained in:
parent
4914f43e8f
commit
8da792e0f2
1 changed files with 29 additions and 13 deletions
42
masks.scad
42
masks.scad
|
@ -114,34 +114,50 @@ module cylinder_mask(
|
||||||
vang = atan2(l, r1-r2)/2;
|
vang = atan2(l, r1-r2)/2;
|
||||||
ang1 = first_defined([chamfang1, chamfang, vang]);
|
ang1 = first_defined([chamfang1, chamfang, vang]);
|
||||||
ang2 = first_defined([chamfang2, chamfang, 90-vang]);
|
ang2 = first_defined([chamfang2, chamfang, 90-vang]);
|
||||||
cham1 = first_defined([chamfer1, chamfer, 0]);
|
cham1 = first_defined([chamfer1, chamfer]);
|
||||||
cham2 = first_defined([chamfer2, chamfer, 0]);
|
cham2 = first_defined([chamfer2, chamfer]);
|
||||||
fil1 = first_defined([rounding1, rounding, 0]);
|
fil1 = first_defined([rounding1, rounding]);
|
||||||
fil2 = first_defined([rounding2, rounding, 0]);
|
fil2 = first_defined([rounding2, rounding]);
|
||||||
maxd = max(r1,r2);
|
maxd = max(r1,r2);
|
||||||
if ($children > 0) {
|
if ($children > 0) {
|
||||||
difference() {
|
difference() {
|
||||||
children();
|
children();
|
||||||
cylinder_mask(l=l, r1=sc*r1, r2=sc*r2, chamfer1=cham1, chamfer2=cham2, chamfang1=ang1, chamfang2=ang2, rounding1=fil1, rounding2=fil2, orient=orient, from_end=from_end);
|
cylinder_mask(
|
||||||
|
l=l, r1=sc*r1, r2=sc*r2,
|
||||||
|
chamfer1=cham1, chamfer2=cham2,
|
||||||
|
chamfang1=ang1, chamfang2=ang2,
|
||||||
|
rounding1=fil1, rounding2=fil2,
|
||||||
|
orient=orient, from_end=from_end
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
attachable(anchor,spin,orient, r=r1, l=l) {
|
attachable(anchor,spin,orient, r=r1, l=l) {
|
||||||
difference() {
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
chlen1 = cham1 / (from_end? 1 : tan(ang1));
|
chlen1 = default(cham1,0) / (from_end? 1 : tan(ang1));
|
||||||
chlen2 = cham2 / (from_end? 1 : tan(ang2));
|
chlen2 = default(cham2,0) / (from_end? 1 : tan(ang2));
|
||||||
if (!ends_only) {
|
if (!ends_only) {
|
||||||
cylinder(r=maxd+excess, h=l+2*excess, center=true);
|
cylinder(r=maxd+excess, h=l+2*excess, center=true);
|
||||||
} else {
|
} else {
|
||||||
if (cham2>0) up(l/2-chlen2) cylinder(r=maxd+excess, h=chlen2+excess, center=false);
|
if (is_num(cham2) && cham2>0) up(l/2-chlen2)
|
||||||
if (cham1>0) down(l/2+excess) cylinder(r=maxd+excess, h=chlen1+excess, center=false);
|
cylinder(r=maxd+excess, h=chlen2+excess, center=false);
|
||||||
if (fil2>0) up(l/2-fil2) cylinder(r=maxd+excess, h=fil2+excess, center=false);
|
if (is_num(cham1) && cham1>0)
|
||||||
if (fil1>0) down(l/2+excess) cylinder(r=maxd+excess, h=fil1+excess, center=false);
|
down(l/2+excess) cylinder(r=maxd+excess, h=chlen1+excess, center=false);
|
||||||
|
if (is_num(fil2) && fil2>0)
|
||||||
|
up(l/2-fil2) cylinder(r=maxd+excess, h=fil2+excess, center=false);
|
||||||
|
if (is_num(fil1) && fil1>0)
|
||||||
|
down(l/2+excess) cylinder(r=maxd+excess, h=fil1+excess, center=false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cyl(r1=sc*r1, r2=sc*r2, l=l, chamfer1=cham1, chamfer2=cham2, chamfang1=ang1, chamfang2=ang2, from_end=from_end, rounding1=fil1, rounding2=fil2);
|
cyl(
|
||||||
|
r1=sc*r1, r2=sc*r2, l=l,
|
||||||
|
chamfer1=cham1, chamfer2=cham2,
|
||||||
|
chamfang1=ang1, chamfang2=ang2,
|
||||||
|
from_end=from_end,
|
||||||
|
rounding1=fil1, rounding2=fil2
|
||||||
|
);
|
||||||
}
|
}
|
||||||
nil();
|
children();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue