If you have your LEGO
collection in Rebrickable, and you locally store your bricks per type in labelled boxes,
then you can use this piece of software to keep track of the location of each brick type and to generate bills of materials with
not only the list of bricks you need to build each set you own, but also with the location of the bricks in your local storage system.
As an example, the image below displays one of the html pages generated by the application with the bill of materials for set 30310. The box ids where each brick type is stored in my local storage system are printed in green.
The application is written in Python 3
and uses the Rebrickable API and the
Python packages shelves
, pandas
and jinja2
. At the bottom of the page you can find a static diagram of the Python classes and their relationship.
- Download the project from GitHub and copy it to your base directory
- Create the following directory structure from your base directory:
- html
- boxes
- sets
- templates
- img
- elements
- sets
- instructions
- README
- shelves
- html
- Modify
part_box.cvs
to match your local storage system.part_box.cvs
contains comma separated pairs of lego element IDs and your local storage box IDs. - Create a file named
rebrickable_credentials.py
with the following three lines:
api_key = 'your_rebrickable_api_key'
user_token = 'your_rebrickable_user_token'
list_id = 'your_rebrickable_list_id'
- Run
lego_collection.py
. A menu will appear with the following four options. Go through all of them in order.
1 - Fetch your data from Rebrickable and build your local database
2 - Build html pages for all the sets you own
3 - Build html pages for all your storage boxes
x - Exit
If everything went as expected, the bills of materials of all your sets and the content of your local storage boxes will be
accessible through html\sets\sets.html
and html\boxes\boxes.html
, respectively. Drop me a line if you have any problems running
this procedure.