mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Bugfixes for anchor changes in masks.scad
This commit is contained in:
parent
4f98535141
commit
8b792c9414
2 changed files with 29 additions and 17 deletions
44
masks.scad
44
masks.scad
|
@ -165,11 +165,11 @@ module cylinder_mask(
|
||||||
// Example:
|
// Example:
|
||||||
// difference() {
|
// difference() {
|
||||||
// cube(50);
|
// cube(50);
|
||||||
// #chamfer_mask(l=50, chamfer=10, orient=ORIENT_X, anchor=RIGHT);
|
// #chamfer_mask(l=50, chamfer=10, orient=ORIENT_X, anchor=BOTTOM);
|
||||||
// }
|
// }
|
||||||
module chamfer_mask(l=1, chamfer=1, orient=ORIENT_Z, anchor=CENTER) {
|
module chamfer_mask(l=1, chamfer=1, orient=ORIENT_Z, anchor=CENTER) {
|
||||||
orient_and_anchor([chamfer, chamfer, l], orient, anchor, chain=true) {
|
orient_and_anchor([chamfer*2, chamfer*2, l], orient, anchor, chain=true) {
|
||||||
cylinder(d=chamfer*2, h=l+0.1, center=true, $fn=4);
|
cylinder(r=chamfer, h=l+0.1, center=true, $fn=4);
|
||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,10 +295,10 @@ module chamfer(chamfer=1, size=[1,1,1], edges=EDGES_ALL)
|
||||||
// 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, ang=45, from_end=false, orient=ORIENT_Z)
|
module chamfer_cylinder_mask(r=undef, d=undef, chamfer=0.25, ang=45, from_end=false, orient=ORIENT_Z)
|
||||||
{
|
{
|
||||||
r = get_radius(r=r, d=d, dflt=1);
|
r = get_radius(r=r, d=d, dflt=1);
|
||||||
rot(orient) cylinder_mask(l=chamfer*3, r=r, chamfer2=chamfer, chamfang2=ang, from_end=from_end, ends_only=true, anchor=DOWN) children();
|
rot(orient) cylinder_mask(l=chamfer*3, r=r, chamfer2=chamfer, chamfang2=ang, from_end=from_end, ends_only=true, anchor=TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ module chamfer_hole_mask(r=undef, d=undef, chamfer=0.25, ang=45, from_end=false,
|
||||||
// Example:
|
// Example:
|
||||||
// difference() {
|
// difference() {
|
||||||
// cube(size=100, center=false);
|
// cube(size=100, center=false);
|
||||||
// #rounding_mask(l=100, r=25, orient=ORIENT_Z, anchor=UP);
|
// #rounding_mask(l=100, r=25, orient=ORIENT_Z, anchor=BOTTOM);
|
||||||
// }
|
// }
|
||||||
module rounding_mask(l=undef, r=1.0, orient=ORIENT_Z, anchor=CENTER, h=undef)
|
module rounding_mask(l=undef, r=1.0, orient=ORIENT_Z, anchor=CENTER, h=undef)
|
||||||
{
|
{
|
||||||
|
@ -393,9 +393,15 @@ module rounding_mask(l=undef, r=1.0, orient=ORIENT_Z, anchor=CENTER, h=undef)
|
||||||
// Example:
|
// Example:
|
||||||
// difference() {
|
// difference() {
|
||||||
// cube(size=100, center=false);
|
// cube(size=100, center=false);
|
||||||
// #rounding_mask_x(l=100, r=25, anchor=RIGHT);
|
// #rounding_mask_x(l=100, r=25, anchor=LEFT);
|
||||||
// }
|
// }
|
||||||
module rounding_mask_x(l=1.0, r=1.0, anchor=CENTER) rounding_mask(l=l, r=r, orient=ORIENT_X, anchor=anchor) children();
|
module rounding_mask_x(l=1.0, r=1.0, anchor=CENTER)
|
||||||
|
{
|
||||||
|
orient_and_anchor([l, 2*r, 2*r], ORIENT_Z, anchor, chain=true) {
|
||||||
|
rounding_mask(l=l, r=r, orient=ORIENT_X, anchor=CENTER)
|
||||||
|
children();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Module: rounding_mask_y()
|
// Module: rounding_mask_y()
|
||||||
|
@ -413,9 +419,15 @@ module rounding_mask_x(l=1.0, r=1.0, anchor=CENTER) rounding_mask(l=l, r=r, orie
|
||||||
// Example:
|
// Example:
|
||||||
// difference() {
|
// difference() {
|
||||||
// cube(size=100, center=false);
|
// cube(size=100, center=false);
|
||||||
// right(100) #rounding_mask_y(l=100, r=25, anchor=BACK);
|
// right(100) #rounding_mask_y(l=100, r=25, anchor=FRONT);
|
||||||
// }
|
// }
|
||||||
module rounding_mask_y(l=1.0, r=1.0, anchor=CENTER) rounding_mask(l=l, r=r, orient=ORIENT_Y, anchor=anchor) children();
|
module rounding_mask_y(l=1.0, r=1.0, anchor=CENTER)
|
||||||
|
{
|
||||||
|
orient_and_anchor([2*r, l, 2*r], ORIENT_Z, anchor, chain=true) {
|
||||||
|
rounding_mask(l=l, r=r, orient=ORIENT_Y, anchor=CENTER)
|
||||||
|
children();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Module: rounding_mask_z()
|
// Module: rounding_mask_z()
|
||||||
|
@ -433,7 +445,7 @@ module rounding_mask_y(l=1.0, r=1.0, anchor=CENTER) rounding_mask(l=l, r=r, orie
|
||||||
// Example:
|
// Example:
|
||||||
// difference() {
|
// difference() {
|
||||||
// cube(size=100, center=false);
|
// cube(size=100, center=false);
|
||||||
// #rounding_mask_z(l=100, r=25, anchor=UP);
|
// #rounding_mask_z(l=100, r=25, anchor=BOTTOM);
|
||||||
// }
|
// }
|
||||||
module rounding_mask_z(l=1.0, r=1.0, anchor=CENTER) rounding_mask(l=l, r=r, orient=ORIENT_Z, anchor=anchor) children();
|
module rounding_mask_z(l=1.0, r=1.0, anchor=CENTER) rounding_mask(l=l, r=r, orient=ORIENT_Z, anchor=anchor) children();
|
||||||
|
|
||||||
|
@ -529,7 +541,7 @@ module rounding_angled_edge_mask(h=1.0, r=1.0, ang=90, orient=ORIENT_Z, anchor=C
|
||||||
// ang = Angle between planes that you need to round the corner of.
|
// ang = Angle between planes that you need to round the corner of.
|
||||||
// orient = Orientation of the mask. Use the `ORIENT_` constants from `constants.h`. Default: `ORIENT_Z`.
|
// orient = Orientation of the mask. Use the `ORIENT_` constants from `constants.h`. Default: `ORIENT_Z`.
|
||||||
// anchor = Alignment of the mask. Use the constants from `constants.h`. Default: `CENTER`.
|
// anchor = Alignment of the mask. Use the constants from `constants.h`. Default: `CENTER`.
|
||||||
// Example:
|
// Example(Med):
|
||||||
// ang=60;
|
// ang=60;
|
||||||
// difference() {
|
// difference() {
|
||||||
// angle_pie_mask(ang=ang, h=50, r=200);
|
// angle_pie_mask(ang=ang, h=50, r=200);
|
||||||
|
@ -616,12 +628,12 @@ module rounding_corner_mask(r=1.0, anchor=CENTER)
|
||||||
// }
|
// }
|
||||||
// Example:
|
// Example:
|
||||||
// difference() {
|
// difference() {
|
||||||
// cylinder(r=50, h=100, center=false);
|
// cylinder(r=50, h=50, center=false);
|
||||||
// up(75) rounding_cylinder_mask(r=50, rounding=10);
|
// up(50) rounding_cylinder_mask(r=50, rounding=10);
|
||||||
// }
|
// }
|
||||||
module rounding_cylinder_mask(r=1.0, rounding=0.25)
|
module rounding_cylinder_mask(r=1.0, rounding=0.25)
|
||||||
{
|
{
|
||||||
cylinder_mask(l=rounding*3, r=r, rounding2=rounding, overage=rounding, ends_only=true, anchor=DOWN) children();
|
cylinder_mask(l=rounding*3, r=r, rounding2=rounding, overage=rounding, ends_only=true, anchor=TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -641,7 +653,7 @@ module rounding_cylinder_mask(r=1.0, rounding=0.25)
|
||||||
// overage = The extra thickness of the mask. Default: `0.1`.
|
// overage = The extra thickness of the mask. Default: `0.1`.
|
||||||
// orient = Orientation of the mask. Use the `ORIENT_` constants from `constants.h`. Default: `ORIENT_Z`.
|
// orient = Orientation of the mask. Use the `ORIENT_` constants from `constants.h`. Default: `ORIENT_Z`.
|
||||||
// anchor = Alignment of the mask. Use the constants from `constants.h`. Default: `CENTER`.
|
// anchor = Alignment of the mask. Use the constants from `constants.h`. Default: `CENTER`.
|
||||||
// Example:
|
// Example(Med):
|
||||||
// difference() {
|
// difference() {
|
||||||
// cube([150,150,100], center=true);
|
// cube([150,150,100], center=true);
|
||||||
// cylinder(r=50, h=100.1, center=true);
|
// cylinder(r=50, h=100.1, center=true);
|
||||||
|
|
|
@ -88,7 +88,7 @@ module circle(r=undef, d=undef, anchor=CENTER) {
|
||||||
module cube(size, center=undef, anchor=ALLNEG)
|
module cube(size, center=undef, anchor=ALLNEG)
|
||||||
{
|
{
|
||||||
size = scalar_vec3(size);
|
size = scalar_vec3(size);
|
||||||
orient_and_anchor(size, ORIENT_Z, anchor, center, noncentered=ALLPOS, chain=true) {
|
orient_and_anchor(size, ORIENT_Z, anchor, center, noncentered=ALLNEG, chain=true) {
|
||||||
linear_extrude(height=size.z, convexity=2, center=true) {
|
linear_extrude(height=size.z, convexity=2, center=true) {
|
||||||
square([size.x, size.y], center=true);
|
square([size.x, size.y], center=true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue