mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Added get_anchor()
This commit is contained in:
parent
f838e8a1e2
commit
2f8787dac5
2 changed files with 22 additions and 1 deletions
21
common.scad
21
common.scad
|
@ -138,6 +138,27 @@ function all_defined(v,recursive=false) = max([for (x=v) is_undef(x)||(recursive
|
|||
// Section: Argument Helpers
|
||||
|
||||
|
||||
// Function: get_anchor()
|
||||
// Usage:
|
||||
// get_anchor(anchor,center,[uncentered],[dflt]);
|
||||
// Description:
|
||||
// Calculated the correct anchor from `anchor` and `center`. In order:
|
||||
// - If `center` is not `undef` and `center` evaluates as true, then `CENTER` (`[0,0,0]`) is returned.
|
||||
// - Otherwise, if `center` is not `undef` and `center` evaluates as false, then the value of `uncentered` is returned.
|
||||
// - Otherwise, if `anchor` is not `undef`, then the value of `anchor` is returned.
|
||||
// - Otherwise, the value of `dflt` is returned.
|
||||
// This ordering ensures that `center` will override `anchor`.
|
||||
// Arguments:
|
||||
// anchor = The anchor name or vector.
|
||||
// center = If not `undef`, this overrides the value of `anchor`.
|
||||
// uncentered = The value to return if `center` is not `undef` and evaluates as false. Default: ALLNEG
|
||||
// dflt = The default value to return if both `anchor` and `center` are `undef`. Default: `CENTER`
|
||||
function get_anchor(anchor,center,uncentered=BOT,dflt=CENTER) =
|
||||
!is_undef(center)? (center? CENTER : uncentered) :
|
||||
!is_undef(anchor)? anchor :
|
||||
dflt;
|
||||
|
||||
|
||||
// Function: get_radius()
|
||||
// Usage:
|
||||
// get_radius([r1], [r2], [r], [d1], [d2], [d], [dflt]);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,131];
|
||||
BOSL_VERSION = [2,0,132];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue