mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-12-07 19:32:06 +00:00
Compare commits
5 commits
12ae36441f
...
6e7842457c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e7842457c | ||
|
|
266792b2a4 | ||
|
|
87fefef1b9 | ||
|
|
bb6325384a | ||
|
|
2ea6e2a4dd |
3 changed files with 70 additions and 2 deletions
|
|
@ -32,7 +32,12 @@ The BOSL2 library is an enormous library that provides many different kinds of c
|
|||
You can find the full BOSL2 library documentation at: https://github.com/BelfrySCAD/BOSL2/wiki
|
||||
|
||||
|
||||
## Installation
|
||||
## Automated Install/Update with Git
|
||||
|
||||
`curl -sSL https://raw.githubusercontent.com/BelfrySCAD/BOSL2/refs/heads/master/get_bosl2.sh | bash`
|
||||
|
||||
|
||||
## Manual Installation
|
||||
|
||||
1. Download the .zip or .tar.gz release file for this library. Currently you should be able to find this at https://github.com/BelfrySCAD/BOSL2/archive/refs/heads/master.zip
|
||||
2. Unpack it. Make sure that you unpack the whole file structure. Some zipfile unpackers call this option "Use folder names". It should create either a `BOSL-v2.0` or `BOSL2-master` directory with the library files within it. You should see "examples", "scripts", "tests", and other subdirectories.
|
||||
|
|
|
|||
62
get_bosl2.sh
Normal file
62
get_bosl2.sh
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
repo_url="https://github.com/BelfrySCAD/BOSL2.git"
|
||||
lib_target_dirname="BOSL2"
|
||||
|
||||
# determine lib dir
|
||||
if command -v openscad &> /dev/null 2>&1; then
|
||||
libdir="$(openscad --info 2>/dev/null | grep "OpenSCAD library path:" -A1 | tail -n1 | xargs)"
|
||||
if [ -z "$libdir" ]; then
|
||||
echo "ABORT: Could not determine OpenSCAD library path from 'openscad --info'"
|
||||
exit 1
|
||||
fi
|
||||
echo "OpenSCAD library path determined from 'openscad --info': $libdir"
|
||||
if [ ! -d "$libdir" ]; then
|
||||
echo "ABORT: Library folder does not exist."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -x "$libdir" ] || [ ! -w "$libdir" ]; then
|
||||
echo "ABORT: Library folder is not accessible (write+execute)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Could not find 'openscad' command. Guessing library path based on OS."
|
||||
|
||||
uname_out="$(uname -s)"
|
||||
case "${uname_out}" in
|
||||
Linux*) machine="Linux";;
|
||||
Darwin*) machine="Mac";;
|
||||
*) machine="UNKNOWN:${uname_out}"
|
||||
esac
|
||||
|
||||
if [ "$machine" == "Mac" ]; then
|
||||
libdir="$HOME/Documents/OpenSCAD/libraries"
|
||||
elif [ "$machine" == "Linux" ]; then
|
||||
libdir="$HOME/.local/share/OpenSCAD/libraries"
|
||||
else
|
||||
echo "WARNING: running on an unknown system: ${machine}."
|
||||
libdir="$HOME/.local/share/OpenSCAD/libraries"
|
||||
fi
|
||||
|
||||
if [ ! -d "$libdir" ]; then
|
||||
echo "ABORT: Assumed OpenSCAD library folder '$libdir' does not exist"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command -v git &> /dev/null 2>&1; then
|
||||
echo "ABORT: Git is missing. Please install git."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# clone or update
|
||||
if [ -d "$libdir/$lib_target_dirname" ]; then
|
||||
echo "Updating BOSL2 library in $libdir/$lib_target_dirname"
|
||||
git -C "$libdir/$lib_target_dirname" pull
|
||||
else
|
||||
echo "New installation into $libdir/$lib_target_dirname"
|
||||
git clone "$repo_url" "$libdir/$lib_target_dirname"
|
||||
fi
|
||||
|
|
@ -1118,6 +1118,7 @@ function offset_stroke(path, width=1, rounded=true, start, end, check_valid=true
|
|||
atype="hull", anchor="origin", spin, cp="centroid") =
|
||||
let(path = force_path(path))
|
||||
assert(is_path(path,2),"path is not a 2d path")
|
||||
assert(is_vector(width,2) || is_finite(width), "width must be a scalar or a 2-vector")
|
||||
let(
|
||||
closedok = !closed || (is_undef(start) && is_undef(end)),
|
||||
start = default(start,"flat"),
|
||||
|
|
@ -1236,7 +1237,7 @@ function _stroke_end(width,left, right, spec) =
|
|||
normal_dir = unit(normal_seg[1]-normal_seg[0]),
|
||||
width_dir = sign(width[0]-width[1])
|
||||
)
|
||||
type == "round"? [arc(points=[right[0],normal_pt,left[0]],n=1+ceil(segs(width/2)/2)),1,1] :
|
||||
type == "round"? [arc(points=[right[0],normal_pt,left[0]],n=1+ceil(segs((width[1]-width[0])/2)/2)),1,1] :
|
||||
type == "pointed"? [[normal_pt],0,0] :
|
||||
type == "shifted_point"? (
|
||||
let(shiftedcenter = center + width_dir * parallel_dir * struct_val(spec, "loc"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue