From 555f1a9ab3136ccc3027d6231006f4a6e99a3f38 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Wed, 29 Jan 2020 01:31:05 -0800 Subject: [PATCH] Bugfix for stroke() with scalar width. --- shapes2d.scad | 10 +++++----- version.scad | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shapes2d.scad b/shapes2d.scad index a16700d..d6e2122 100644 --- a/shapes2d.scad +++ b/shapes2d.scad @@ -97,10 +97,13 @@ module stroke( [] ) * linewidth; - assert(is_path(path)); assert(is_bool(closed)); + assert(is_path(path)); + path = closed? concat(path,[path[0]]) : path; + assert(is_list(path) && is_vector(path[0]) && len(path[0])==2, "path must be a 2D list of points."); + assert(is_num(width) || (is_vector(width) && len(width)==len(path))); - width = is_list(width)? width : [for (x=path) width]; + width = is_num(width)? [for (x=path) width] : width; endcap1 = first_defined([endcap1, endcaps, "round"]); endcap2 = first_defined([endcap2, endcaps, "round"]); @@ -125,9 +128,6 @@ module stroke( endcap_shape1 = _endcap_shape(endcap1, select(width,0), endcap_width1, endcap_length1, endcap_extent1); endcap_shape2 = _endcap_shape(endcap2, select(width,-1), endcap_width2, endcap_length2, endcap_extent2); - path = closed? concat(path,[path[0]]) : path; - assert(is_list(path) && is_vector(path[0]) && len(path[0])==2, "path must be a 2D list of points."); - segments = pair(path); trim1 = select(width,0) * first_defined([ diff --git a/version.scad b/version.scad index 0b132d7..10eb732 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,100]; +BOSL_VERSION = [2,0,101]; // Section: BOSL Library Version Functions