About Boxes.py
Boxes.py is an Open Source box generator written in Python. It features both finished parametrized generators as well as a Python API for writing your own.
Sources of documentation
Souce files for boxes.py
The images are from https://www.festi.info/boxes.py
Documentation steps for inclusion of Boxes.py in MightyScape
Since 02.06.2025 we use a git commit ID in our requirements.txt and we use the same commit id to compile and include proper *.inx
files and thumbnails. This way no errors should occure anymore. If we want to upgrade to latest Boxes.py, we need to adjust at 2 places in sync.
#clone project - we need to clone it because MightyScape only installs the required module, but not all generator scripts
cd ~/Downloads/
git clone https://github.com/florianfesti/boxes.git
cd boxes/
#check out the commit we use in our own requirements.txt to match exactly
git checkout 116a5e06792d41370de1680535e016bec26a56e4
#enable venv
python3 -m venv env
. env/bin/activate #activate venv
pip3 install -r requirements.txt
#create target dir for inx files from generator script and generate them
mkdir -p ~/Downloads/boxes/inkscape-export/
~/Downloads/boxes/env/bin/python3 scripts/boxes2inkscape ~/Downloads/boxes/inkscape-export/
#create SVG thumbnails from JPG thumbnails to use them in *.inx
for FILE in ~/Downloads/boxes/static/samples/*-thumb.jpg; do WIDTH=$(identify -format "%w" ${FILE}); HEIGHT=$(identify -format "%h" ${FILE}); BASENAME=$(basename -- "$FILE"); BASE_WO="${BASENAME%.*}"; echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="'$WIDTH'" height="'$HEIGHT'" viewBox="0 0 '$WIDTH' '$HEIGHT'" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"><g id="gimage"><image width="'$WIDTH'" height="'$HEIGHT'" xlink:href="'$BASENAME'" id="image1" /></g></svg>' > ~/Downloads/boxes/static/samples/$BASE_WO.svg; done
#copy final files
cp ~/Downloads/boxes/inkscape-export/*.inx ~/.config/inkscape/extensions/mightyscape-1.2/extensions/fablabchemnitz/boxes.py/
cp ~/Downloads/boxes/static/samples/*-thumb.jpg ~/.config/inkscape/extensions/mightyscape-1.2/extensions/fablabchemnitz/boxes.py/
cp ~/Downloads/boxes/static/samples/*-thumb.svg ~/.config/inkscape/extensions/mightyscape-1.2/extensions/fablabchemnitz/boxes.py/
#adjust some stuff in inx
cd ~/.config/inkscape/extensions/mightyscape-1.2/extensions/fablabchemnitz/
./000_boxes.py.sh
No comments to display
No comments to display