mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Changed make_path_valid to check_and_fix_path
This commit is contained in:
parent
20eae2b5d2
commit
3719378f49
2 changed files with 7 additions and 3 deletions
|
@ -702,13 +702,17 @@ function is_region(x) = is_list(x) && is_path(x.x);
|
||||||
// Closes all paths within a given region.
|
// Closes all paths within a given region.
|
||||||
function close_region(region, eps=EPSILON) = [for (path=region) close_path(path, eps=eps)];
|
function close_region(region, eps=EPSILON) = [for (path=region) close_path(path, eps=eps)];
|
||||||
|
|
||||||
// Function: make_path_valid()
|
// Function: check_and_fix_path()
|
||||||
// Usage:
|
// Usage:
|
||||||
// make_path_valid(path, [valid_dim], [closed])
|
// make_path_valid(path, [valid_dim], [closed])
|
||||||
// Description:
|
// Description:
|
||||||
// Checks that the input is a path. If it is a region with one component, converts it to a path.
|
// Checks that the input is a path. If it is a region with one component, converts it to a path.
|
||||||
// valid_dim specfies the allowed dimension of the points in the path.
|
// valid_dim specfies the allowed dimension of the points in the path.
|
||||||
// If the path is closed, removed duplicate endpoint if present.
|
// If the path is closed, removed duplicate endpoint if present.
|
||||||
|
// Arguments:
|
||||||
|
// path = path to process
|
||||||
|
// valid_dim = list of allowed dimensions for the points in the path, e.g. [2,3] to require 2 or 3 dimensional input. If left undefined do not perform this check. Default: undef
|
||||||
|
// closed = set to true if the path is closed, which enables a check for endpoint duplication
|
||||||
function make_path_valid(path,valid_dim=undef,closed=false) =
|
function make_path_valid(path,valid_dim=undef,closed=false) =
|
||||||
let( path = is_region(path) ?
|
let( path = is_region(path) ?
|
||||||
assert(len(path)==1,"Region supplied as path does not have exactly one component")
|
assert(len(path)==1,"Region supplied as path does not have exactly one component")
|
||||||
|
|
|
@ -589,7 +589,7 @@ module rounded_sweep(path, height, top=[], bottom=[], offset="round", r=0, steps
|
||||||
["points", []],
|
["points", []],
|
||||||
];
|
];
|
||||||
|
|
||||||
path = make_path_valid(path, [2], closed=true);
|
path = check_and_fix_path(path, [2], closed=true);
|
||||||
|
|
||||||
top = struct_set(argspec, top, grow=false);
|
top = struct_set(argspec, top, grow=false);
|
||||||
bottom = struct_set(argspec, bottom, grow=false);
|
bottom = struct_set(argspec, bottom, grow=false);
|
||||||
|
|
Loading…
Reference in a new issue