boxespy/scripts/boxes_example.ipynb

154 lines
27 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Boxes.py example\n",
"\n",
"This notebook is an interactive example of a Boxes.py generator. Feel free to play around and see how the result changes.\n",
"\n",
"Check out http://florianfesti.github.io/boxes/html/index.html for documentation."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import SVG, display\n",
"import tempfile, os\n",
"\n",
"import sys\n",
"#sys.path.append('..') # uncomments and adjust if your Boxes.py copy in not in the Python path\n",
"from boxes import *"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"210mm\" version=\"1.1\" viewBox=\"0 9790 170 210\" width=\"170mm\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"surface11\">\n",
"<path d=\"M 150 50.103125 L 0 50.103125 M 0 50.103125 L -3 50.103125 C -3.054688 50.103125 -3.101562 50.060156 -3.101562 50.001562 M -3.101562 50.001562 L -3.101562 50.001562 M -3.101562 50.001562 L -3.101562 37.001562 M -3.101562 37.001562 C -3.101562 36.946875 -3.058594 36.9 -3 36.9 M -3 36.9 L 0 36.9 C -0.0546875 36.9 -0.101562 36.942969 -0.101562 37.001562 M -0.101562 37.001562 L -0.101562 28.001562 C -0.101562 28.05625 -0.0585938 28.103125 0 28.103125 M 0 28.103125 L -3 28.103125 C -3.054688 28.103125 -3.101562 28.060156 -3.101562 28.001562 M -3.101562 28.001562 L -3.101562 22.001562 M -3.101562 22.001562 C -3.101562 21.946875 -3.058594 21.9 -3 21.9 M -3 21.9 L 0 21.9 C -0.0546875 21.9 -0.101562 21.942969 -0.101562 22.001562 M -0.101562 22.001562 L -0.101562 13.001562 C -0.101562 13.05625 -0.0585938 13.103125 0 13.103125 M 0 13.103125 L -3 13.103125 C -3.054688 13.103125 -3.101562 13.060156 -3.101562 13.001562 M -3.101562 13.001562 L -3.101562 0.0015625 M -3.101562 0.0015625 L -3.101562 -5.998438 C -3.101562 -6.053125 -3.058594 -6.1 -3 -6.1 M -3 -6.1 L 0 -6.1 M 0 0.0015625 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-1,-0.000000000000000122,-0.000000000000000122,1,153.851562,9949.045313)\"/>\n",
"<path d=\"M 0 -0.000000000000028422 C 1.867188 -0.000000000000028422 1.867188 -2.796875 0 -2.796875 C -1.863281 -2.796875 -1.863281 -0.000000000000028422 0 -0.000000000000028422 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-0.000000000000000184,-1,-1,0.000000000000000184,142.453125,9959.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,143.351562,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,128.351562,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,113.351562,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,98.351562,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,83.351562,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,68.351562,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,53.351563,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,38.351562,9946.046875)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,23.351562,9946.046875)\"/>\n",
"<path d=\"M -6.101562 150.001562 L -6.101562 0.0015625 M -6.101562 0.0015625 L -6.101562 -2.998438 C -6.101562 -3.053125 -6.058594 -3.1 -6 -3.1 M -6 -3.1 L 0 -3.1 M 0 0.0015625 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-0.000000000000000184,1,1,0.000000000000000184,3.85,9949.046875)\"/>\n",
"<path d=\"M 0.000000000000001776 0 C 1.867188 0 1.867188 -2.796875 0 -2.796875 C -1.863281 -2.796875 -1.863281 0 0.000000000000001776 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-1,0.000000000000000122,0.000000000000000122,1,13.851562,9960.445312)\"/>\n",
"<path d=\"M -3.101563 50.101562 L -3.101563 37.101562 M -3.101563 37.101562 C -3.101563 37.046875 -3.058594 37 -3 37 M -3 37 L -0.000000000000009326 37 C -0.0546875 37 -0.101563 37.042969 -0.101563 37.101562 M -0.101563 37.101562 L -0.101563 28.101562 C -0.101563 28.15625 -0.0585938 28.203125 -0.000000000000007105 28.203125 M -0.000000000000007105 28.203125 L -3 28.203125 C -3.054688 28.203125 -3.101563 28.160156 -3.101563 28.101562 M -3.101563 28.101562 L -3.101563 22.101562 M -3.101563 22.101562 C -3.101563 22.046875 -3.058594 22 -3 22 M -3 22 L -0.000000000000005329 22 C -0.0546875 22 -0.101563 22.042969 -0.101563 22.101562 M -0.101563 22.101562 L -0.101563 13.101562 C -0.101563 13.15625 -0.0585938 13.203125 -0.000000000000003109 13.203125 M -0.000000000000003109 13.203125 L -3 13.203125 C -3.054688 13.203125 -3.101563 13.160156 -3.101563 13.101562 M -3.101563 13.101562 L -3.101562 0.101562 M -3.101562 0.101562 C -3.101562 0.046875 -3.058594 0 -3 0 M -3 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0.000000000000000245,0.000000000000000245,-1,3.851562,9999.148438)\"/>\n",
"<path d=\"M -0.101562 151.601562 L -0.101562 1.601562 M -0.101562 1.601562 L -0.101562 -4.398438 C -0.101562 -4.453125 -0.0585938 -4.5 0 -4.5 M 0 -4.5 L 0 -4.5 M 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,-1,-1,-0.000000000000000061,158.453125,9941.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,1,1,-0.000000000000000061,159.851562,9933.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,1,1,-0.000000000000000061,159.851562,9918.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,1,1,-0.000000000000000061,159.851562,9903.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,1,1,-0.000000000000000061,159.851562,9888.347656)\"/>\n",
"<path d=\"M 70 157.703125 L 0 157.703125 M 0 157.703125 C -0.0546875 157.703125 -0.101562 157.660156 -0.101562 157.601562 M -0.101562 157.601562 L -0.101562 151.601562 M -0.101562 151.601562 L -0.101562 141.101562 M -0.101562 141.101562 C -0.101562 141.15625 -0.0585938 141.203125 0 141.203125 M 0 141.203125 L -3 141.203125 C -3.054688 141.203125 -3.101562 141.160156 -3.101562 141.101562 M -3.101562 141.101562 L -3.101562 132.101562 C -3.101562 132.046875 -3.058594 132 -3 132 M -3 132 L 0 132 C -0.0546875 132 -0.101562 132.042969 -0.101562 132.101562 M -0.101562 132.101562 L -0.101562 126.101562 M -0.101562 126.101562 C -0.101562 126.15625 -0.0585938 126.203125 0 126.203125 M 0 126.203125 L -3 126.203125 C -3.054688 126.203125 -3.101562 126.160156 -3.101562 126.101562 M -3.101562 126.101562 L -3.101562 117.101562 C -3.101562 117.046875 -3.058594 117 -3 117 M -3 117 L 0 117 C -0.0546875 117 -0.101562 117.042969 -0.101562 117.101562 M -0.101562 117.101562 L -0.101562 111.101562 M -0.101562 111.101562 C -0.101562 111.15625 -0.0585938 111.203125 0 111.203125 M 0 111.203125 L -3 111.203125 C -3.054688 111.203125 -3.101562 111.160156 -3.101562 111.101562 M -3.101562 111.101562 L -3.101562 102.101562 C -3.101562 102.046875 -3.058594 102 -3 102 M -3 102 L 0 102 C -0.0546875 102 -0.101562 102.042969 -0.101562 102.101562 M -0.101562 102.101562 L -0.101562 96.101562 M -0.101562 96.101562 C -0.101562 96.15625 -0.0585938 96.203125 0 96.203125 M 0 96.203125 L -3 96.203125 C -3.054688 96.203125 -3.101562 96.160156 -3.101562 96.101562 M -3.101562 96.101562 L -3.101562 87.101562 C -3.101562 87.046875 -3.058594 87 -3 87 M -3 87 L 0 87 C -0.0546875 87 -0.101562 87.042969 -0.101562 87.101562 M -0.101562 87.101562 L -0.101562 81.101562 M -0.101562 81.101562 C -0.101562 81.15625 -0.0585938 81.203125 0 81.203125 M 0 81.203125 L -3 81.203125 C -3.054688 81.203125 -3.101562 81.160156 -3.101562 81.101562 M -3.101562 81.101562 L -3.101562 72.101562 C -3.101562 72.046875 -3.058594 72 -3 72 M -3 72 L 0 72 C -0.0546875 72 -0.101562 72.042969 -0.101562 72.101562 M -0.101562 72.101562 L -0.101562 66.101562 M -0.101562 66.101562 C -0.101562 66.15625 -0.0585938 66.203125 0 66.203125 M 0 66.203125 L -3 66.203125 C -3.054688 66.203125 -3.101562 66.160156 -3.101562 66.101562 M -3.101562 66.101562 L -3.101562 57.101562 C -3.101562 57.046875 -3.058594 57 -3 57 M -3 57 L 0 57 C -0.0546875 57 -0.101562 57.042969 -0.101562 57.101562 M -0.101562 57.101562 L -0.101562 51.101562 M -0.101562 51.101562 C -0.101562 51.15625 -0.0585938 51.203125 0 51.203125 M 0 51.203125 L -3 51.203125 C -3.054688 51.203125 -3.101562 51.160156 -3.101562 51.101562 M -3.101562 51.101562 L -3.101562 42.101562 C -3.101562 42.046875 -3.058594 42 -3 42 M -3 42 L 0 42 C -0.0546875 42 -0.101562 42.042969 -0.101562 42.101562 M -0.101562 42.101562 L -0.101562 36.101562 M -0.101562 36.101562 C -0.101562 36.15625 -0.0585938 36.203125 0 36.203125 M 0 36.203125 L -3 36.203125 C -3.054688 36.203125 -3.101562 36.160156 -3.101562 36.101562 M -3.101562 36.101562 L -3.101562 27.101562 C -3.101562 27.046875 -3.058594 27 -3 27 M -3 27 L 0 27 C -0.0546875 27 -0.101562 27.042969 -0.101562 27.101562 M -0.101562 27.101562 L -0.101562 21.101562 M -0.101562 21.101562 C -0.101562 21.15625 -0.0585938 21.203125 0 21.203125 M 0 21.203125 L -3 21.203125 C -3.054688 21.203125 -3.101562 21.160156 -3.101562 21.101562 M -3.101562 21.101562 L -3.101562 12.101562 C -3.101562 12.046875 -3.058594 12 -3 12 M -3 12 L 0 12 C -0.0546875 12 -0.101562 12.042969 -0.101562 12.101562 M -0.101562 12.101562 L -0.101562 1.601562 M -0.101562 1.601562 L -0.101562 -4.398438 C -0.101562 -4.453125 -0.0585938 -4.5 0 -4.5 M 0 -4.5 L 0 -4.5 M 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-0.000000000000000184,1,1,0.000000000000000184,5.25,9871.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 -0.000000000000000444 -9 -0.000000000000000444 M -9 -0.000000000000000444 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,-1,-1,-0.000000000000000061,3.851563,9879.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 -0.000000000000000444 -9 -0.000000000000000888 M -9 -0.000000000000000888 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,-1,-1,-0.000000000000000061,3.851563,9894.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 -0.000000000000000888 -9 -0.000000000000000888 M -9 -0.000000000000000888 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,-1,-1,-0.000000000000000061,3.851563,9909.347656)\"/>\n",
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 -0.000000000000000888 -9 -0.000000000000000888 M -9 -0.000000000000000888 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(0.000000000000000061,-1,-1,-0.000000000000000061,3.851563,9924.347656)\"/>\n",
"<path d=\"M -6.101563 70.101562 L -6.101562 0.101562 M -6.101562 0.101562 C -6.101562 0.046875 -6.058594 0 -6 0 M -6 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0.000000000000000245,0.000000000000000245,-1,6.851563,9941.449219)\"/>\n",
"<path d=\"M 0.000000000000000888 0 L 8 0 M 8 0 C 7.945312 0 7.898438 0.0429688 7.898438 0.101562 M 7.898438 0.101562 L 7.898438 -2.898438 C 7.898438 -2.953125 7.941406 -3 8 -3 M 8 -3 L 17 -3 C 17.054688 -3 17.101562 -2.957031 17.101562 -2.898438 M 17.101562 -2.898438 L 17.101562 0.101562 C 17.101562 0.046875 17.058594 0 17 0 M 17 0 L 23 0 M 23 0 C 22.945312 0 22.898438 0.0429688 22.898438 0.101562 M 22.898438 0.101562 L 22.898438 -2.898438 C 22.898438 -2.953125 22.941406 -3 23 -3 M 23 -3 L 32 -3 C 32.054688 -3 32.101562 -2.957031 32.101562 -2.898438 M 32.101562 -2.898438 L 32.101562 0.101562 C 32.101562 0.046875 32.058594 0 32 0 M 32 0 L 38 0 M 38 0 C 37.945312 0 37.898438 0.0429688 37.898438 0.101562 M 37.898438 0.101562 L 37.898438 -2.898438 C 37.898438 -2.953125 37.941406 -3 38 -3 M 38 -3 L 47 -3 C 47.054688 -3 47.101562 -2.957031 47.101562 -2.898438 M 47.101562 -2.898438 L 47.101562 0.101562 C 47.101562 0.046875 47.058594 0 47 0 M 47 0 L 53 0 M 53 0 C 52.945312 0 52.898438 0.0429688 52.898438 0.101562 M 52.898438 0.101562 L 52.898438 -2.898438 C 52.898438 -2.953125 52.941406 -3 53 -3 M 53 -3 L 62 -3 C 62.054688 -3 62.101562 -2.957031 62.101562 -2.898438 M 62.101562 -2.898438 L 62.101562 0.101562 C 62.101562 0.046875 62.058594 0 62 0 M 62 0 L 70 0 M 70 0 C 70.054688 0 70.101562 0.0429688 70.101562 0.101562 M 70.101562 0.101562 L 70.101562 0.101562 M 70.101562 0.101562 L 70.101562 13.101562 M 70.101562 13.101562 C 70.101562 13.046875 70.058594 13 70 13 M 70 13 L 73 13 C 73.054688 13 73.101562 13.042969 73.101562 13.101562 M 73.101562 13.101562 L 73.101562 22.101562 C 73.101562 22.15625 73.058594 22.203125 73 22.203125 M 73 22.203125 L 70 22.203125 C 70.054688 22.203125 70.101562 22.160156 70.101562 22.101562 M 70.101562 22.101562 L 70.101562 28.101562 M 70.101562 28.101562 C 70.101562 28.046875 70.058594 28 70 28 M 70 28 L 73 28 C 73.054688 28 73.101562 28.042969 73.101562 28.101562 M 73.101562 28.101562 L 73.101562 37.101562 C 73.101562 37.15625 73.058594 37.203125 73 37.203125 M 73 37.203125 L 70 37.203125 C 70.054688 37.203125 70.101562 37.160156 70.101562 37.101562 M 70.101562 37.101562 L 70.101562 50.101562 M 70.101562 50.101562 C 70.101562 50.15625 70.058594 50.203125 70 50.203125 M 70 50.203125 C 69.980469 50.203125 69.957031 50.195312 69.941406 50.183594 M 69.941406 50.183594 L -0.0585938 0.183594 C -0.0859375 0.164062 -0.101562 0.132812 -0.101562 0.101562 C -0.101562 0.046875 -0.0585937 0 0.000000000000000888 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,0.000000000000000117,0.000000000000000117,-1,7.25,9863.75)\"/>\n",
"<path d=\"M 0 0 L 8 0 M 8 0 C 7.945312 0 7.898438 0.0429688 7.898438 0.101562 M 7.898438 0.101562 L 7.898438 -2.898438 C 7.898438 -2.953125 7.941406 -3 8 -3 M 8 -3 L 17 -3 C 17.054688 -3 17.101562 -2.957031 17.101562 -2.898438 M 17.101562 -2.898438 L 17.101562 0.101562 C 17.101562 0.046875 17.058594 0 17 0 M 17 0 L 23 0 M 23 0 C 22.945312 0 22.898438 0.0429688 22.898437 0.101562 M 22.898437 0.101562 L 22.898438 -2.898438 C 22.898438 -2.953125 22.941406 -3 23 -3 M 23 -3 L 32 -3 C 32.054688 -3 32.101562 -2.957031 32.101562 -2.898438 M 32.101562 -2.898438 L 32.101562 0.101562 C 32.101562 0.046875 32.058594 0 32 0 M 32 0 L 38 0 M 38 0 C 37.945312 0 37.898438 0.0429688 37.898437 0.101562 M 37.898437 0.101562 L 37.898438 -2.898438 C 37.898438 -2.953125 37.941406 -3 38 -3 M 38 -3 L 47 -3 C 47.054688 -3 47.101562 -2.957031 47.101562 -2.898438 M 47.101562 -2.898438 L 47.101562 0.101562 C 47.101562 0.046875 47.058594 0 47 0 M 47 0 L 53 0 M 53 0 C 52.945312 0 52.898438 0.0429688 52.898438 0.101562 M 52.898438 0.101562 L 52.898438 -2.898438 C 52.898438 -2.953125 52.941406 -3 53 -3 M 53 -3 L 62 -3 C 62.054688 -3 62.101562 -2.957031 62.101562 -2.898438 M 62.101562 -2.898438 L 62.101562 0.101562 C 62.101562 0.046875 62.058594 0 62 0 M 62 0 L 70 0 M 70 0 C 70.054688 0 70.101562 0.0429688 70.101562 0.101562 M 70.101562 0.101562 L 70.101562 0.101562 M 70.101562 0.101562 L 70.101562 13.101562 M 70.101562 13.101562 C 70.101562 13.046875 70.058594 13 70 13 M 70 13 L 73 13 C 73.054687 13 73.101562 13.042969 73.101562 13.101562 M 73.101562 13.101562 L 73.101562 22.101562 C 73.101562 22.15625 73.058594 22.203125 73 22.203125 M 73 22.203125 L 70 22.203125 C 70.054687 22.203125 70.101562 22.160156 70.101562 22.101562 M 70.101562 22.101562 L 70.101562 28.101562 M 70.101562 28.101562 C 70.101562 28.046875 70.058594 28 70 28 M 70 28 L 73 28 C 73.054687 28 73.101562 28.042969 73.101562 28.101562 M 73.101562 28.101562 L 73.101562 37.101562 C 73.101562 37.15625 73.058594 37.203125 73 37.203125 M 73 37.203125 L 70 37.203125 C 70.054687 37.203125 70.101562 37.160156 70.101562 37.101562 M 70.101562 37.101562 L 70.101562 50.101562 M 70.101562 50.101562 C 70.101562 50.15625 70.058594 50.203125 70 50.203125 M 70 50.203125 C 69.980469 50.203125 69.957031 50.195312 69.941406 50.183594 M 69.941406 50.183594 L -0.0585938 0.183594 C -0.0859375 0.164062 -0.101562 0.132812 -0.101562 0.101562 C -0.101562 0.046875 -0.0585938 0 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-1,-0.000000000000000394,-0.000000000000000394,1,75.550781,9812.050781)\"/>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"class Example(Boxes): # Adjust class name and call below\n",
" \"\"\"Example: Single Shelve to screw to the wall\"\"\"\n",
"\n",
" ui_group = \"Shelves\" # change for generators belonging in another group\n",
" \n",
" def __init__(self):\n",
" Boxes.__init__(self)\n",
" # arguments\n",
" self.addSettingsArgs(edges.FingerJointSettings, finger=3.0) # arguments for finger joints\n",
" self.buildArgParser(x=150, y=70, h=50)\n",
" self.argparser.add_argument(\n",
" \"--hole_dist\", action=\"store\", type=float, default=10.,\n",
" help=\"distance of the mounting holes to the boards\")\n",
" self.argparser.add_argument(\n",
" \"--hole_dia\", action=\"store\", type=float, default=3., # can't use \"hole\" as param name as it is a method\n",
" help=\"diameter of the mounting holes\")\n",
" \n",
" def render(self):\n",
" x, y, h = self.x, self.y, self.h\n",
" t = self.thickness\n",
" \n",
" # render-magic goes here\n",
" \n",
" hole = lambda: self.hole(self.hole_dist, self.hole_dist, d=self.hole_dia) # use lambda as a callback\n",
" # holes are placed relative to the inner rectangle of the back wall. The top part with the finger holes and \n",
" # the finges at the sides do not count.\n",
" # Callbacks start in the bottom left corner. Place holes in the third and forth corners only. \n",
" self.rectangularWall(x, h, \"eFhF\", move=\"up\", callback=[None, None, hole, hole]) # back board\n",
"\n",
" self.rectangularWall(x, y, \"ehfh\", move=\"up\") # top board\n",
" self.rectangularTriangle(y, h, \"ff\", num=2) # braces \n",
" \n",
"\n",
"b = Example()\n",
"fd, fn = tempfile.mkstemp()\n",
"b.parseArgs(['--reference=0', '--debug=0', '--output=' + fn])\n",
"b.open()\n",
"b.render()\n",
"b.close()\n",
"\n",
"display(SVG(fn))\n",
"os.close(fd)\n",
"os.remove(fn)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}