mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-09 13:06:44 +02:00
catch case where endcaps are too long for path in stroke()
make rect() default to centered
This commit is contained in:
@@ -302,6 +302,7 @@ module stroke(
|
|||||||
translate(path[0]) sphere(d=width[0]);
|
translate(path[0]) sphere(d=width[0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
dummy=assert(trim1<path_length(path)-trim2, "Path is too short for endcap(s). Try a smaller width, or set endcap_length to a smaller value.");
|
||||||
pathcut = _path_cut_points(path, [trim1, path_length(path)-trim2], closed=false);
|
pathcut = _path_cut_points(path, [trim1, path_length(path)-trim2], closed=false);
|
||||||
pathcut_su = _cut_to_seg_u_form(pathcut,path);
|
pathcut_su = _cut_to_seg_u_form(pathcut,path);
|
||||||
path2 = _path_cut_getpaths(path, pathcut, closed=false)[1];
|
path2 = _path_cut_getpaths(path, pathcut, closed=false)[1];
|
||||||
|
@@ -106,7 +106,7 @@ module square(size=1, center, anchor, spin) {
|
|||||||
// move_copies(path) color("blue") circle(d=2,$fn=8);
|
// move_copies(path) color("blue") circle(d=2,$fn=8);
|
||||||
module rect(size=1, center, rounding=0, chamfer=0, anchor, spin=0) {
|
module rect(size=1, center, rounding=0, chamfer=0, anchor, spin=0) {
|
||||||
size = is_num(size)? [size,size] : point2d(size);
|
size = is_num(size)? [size,size] : point2d(size);
|
||||||
anchor = get_anchor(anchor, center, FRONT+LEFT, FRONT+LEFT);
|
anchor = point2d(get_anchor(anchor, center));
|
||||||
if (rounding==0 && chamfer==0) {
|
if (rounding==0 && chamfer==0) {
|
||||||
attachable(anchor,spin, two_d=true, size=size) {
|
attachable(anchor,spin, two_d=true, size=size) {
|
||||||
square(size, center=true);
|
square(size, center=true);
|
||||||
@@ -128,7 +128,7 @@ function rect(size=1, center, rounding=0, chamfer=0, anchor, spin=0) =
|
|||||||
assert(is_num(rounding) || len(rounding)==4)
|
assert(is_num(rounding) || len(rounding)==4)
|
||||||
let(
|
let(
|
||||||
size = is_num(size)? [size,size] : point2d(size),
|
size = is_num(size)? [size,size] : point2d(size),
|
||||||
anchor = point2d(get_anchor(anchor, center, FRONT+LEFT, FRONT+LEFT)),
|
anchor = point2d(get_anchor(anchor, center)),
|
||||||
complex = rounding!=0 || chamfer!=0
|
complex = rounding!=0 || chamfer!=0
|
||||||
)
|
)
|
||||||
(rounding==0 && chamfer==0)? let(
|
(rounding==0 && chamfer==0)? let(
|
||||||
|
Reference in New Issue
Block a user