From e2b02ba6a56408cb2a19258c707b23a63f52e0c5 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Sat, 11 Apr 2020 22:49:50 -0700 Subject: [PATCH] Added face_profile() --- attachments.scad | 20 ++++++++++++++++++++ version.scad | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/attachments.scad b/attachments.scad index 3969801..bbac30e 100644 --- a/attachments.scad +++ b/attachments.scad @@ -885,6 +885,26 @@ module attach(from, to=undef, overlap=undef, norot=false) } +// Module: face_profile() +// Usage: +// face_profile(faces=[], convexity=10, r, d) ... +// Description: +// Given a 2D edge profile, extrudes it into a mask for all edges and corners bounding each given face. +// Arguments: +// faces = Faces to mask edges and corners of. +// r = Radius of corner mask. +// d = Diameter of corner mask. +// convexity = Max number of times a line could intersect the perimeter of the mask shape. Default: 10 +module face_profile(faces=[], r, d, convexity=10) { + faces = is_vector(faces)? [faces] : faces; + assert(all([for (face=faces) is_vector(face) && sum([for (x=face) x!=0? 1 : 0])==1]), "Vector in faces doesn't point at a face."); + r = get_radius(r=r, d=d, dflt=undef); + assert(is_num(r) && r>0); + edge_profile(faces) children(); + corner_profile(faces, convexity=convexity, r=r) children(); +} + + // Module: edge_profile() // Usage: // edge_profile([edges], [except], [convexity]) ... diff --git a/version.scad b/version.scad index 1250949..cdf9087 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,264]; +BOSL_VERSION = [2,0,265]; // Section: BOSL Library Version Functions