Software application, written in Python to generate 3D printable design files (STL) of a marble obstacle track. Inspired by puzzle balls from Perplexus, Playtastic, Intrism, Magical Intellect and Sharper Image.
For practicality, the application can be run in separate parts. A puzzle generation with paths and plot visualization and a 3D solid modeller that generates a puzzle and then creates and visualizes the 3D model for export. Both rely on the parameters set in the config.py file
The config.py file contains parameters that can be adjusted for type, size and shape of enclosure, path types, theme colors and more.
Puzzle generation
The puzzle route, for paths, curve types and node grid can be generated and visualized separately. To generate a puzzle, based on settings in the config.py file and open a visualization (Plotly-generated HTML file) in your browser, run:
generate_puzzle.pyResults in an HTML file which opens in the browser to showcase the enclosure shape, node grid, paths and path curve types divided by segments:
Model assembly
The 3D shape objects and physical enclosure are generated and visualized through the model assembly script. A puzzle is generated from which the printable shapes are created by running:
python -m model_assemblyResults in a 3D model made out of separate solid bodies for the enclosure, path, path accent, support material and a marble path indicator:
Path Profile Overview
For quick visualization and debugging, all the path profiles, also called path cross sections can be 3D modelled by running:
path_profiles_overview.pyThis results in an overview with all path profiles, including their path accent color and support material swept along a straight line. A red color color is used to indicate the path does not have any adjustments yet in the configuration:
Obstacles
Obstacled can be randomly or manually selected and placed (xyz and orientation) in the puzzle. The obstacles feature as start and end node that can be connected with paths. Through the usage of a node grid, collisions and occupancy can be handled.
For quick visualization and debugging, all the obstacles currently in the obstacle catalogue can be 3D modelled by running:
obstacle_overview.pyThis results in the following overview:
Individual obstacles can be both plotted and 3D modelled by running their individual obstacle files in /obstacles/catalogue for example, spiral.py can be run by:
python -m obstacles.catalogue.spiralThis results in a 3D model, including the occupied and overlap nodes:
This also results in a plot, with a sampled path, occupied and overlap nodes:
A puzzle can be created in the browser and previewed. Allows for quick iteration through different seed values, amount of waypoints and enclosures.
Can be run and opens in the browser automatically with:
streamlit run .\designer_app.pyPython 3.11 requirements.txt is availible for dependencies
For the 3D model visualization, the Visual Studio Code extension OCP CAD Viewer or it's standalone mode is required.
- For 3D modelling, this project relies heavily on Build123: Build123D a python CAD library
- OCP CAD Viewer extension for Visual Studio Code to visualize 3D models: OCP CAD Viewer for VS Code
- Plotly for graph visualization: Plotly Python Graphing Library
- Streamlit for browser based configurator: Streamlit












