Code Monkey home page Code Monkey logo

octahedroflake's Introduction

Octahedroflake: A 3D Fractal Sculpture Inspired by the Sierpinski Triangle

This repository contains the CadQuery code and an accompanying Bash script to generate a 3D octahedron fractal called the "Octahedroflake." The Octahedroflake is a higher-dimensional analog of the Sierpinski Triangle.

Social Preview

Table of Contents

Pre-generated Models

Download pre-generated Octahedroflake models using the following link:

Pre-generated Octahedroflake Models

This link also provides slicing and printing instructions, as well as photos of printed models created by users.

Prerequisites

To utilize this repository, ensure you have CadQuery 2.0 or a later version installed on your system. Follow the installation instructions from the official CadQuery documentation:

CadQuery Installation Instructions

Usage

Generate an Octahedroflake by running the `run.sh` script in your terminal:

./run.sh

You can also customize the parameters of the generated fractal using optional command-line arguments. For example:

./run.sh -i 4 -l 0.2 -n 0.4 -m 150

To view a full list of command-line options, run:

./run.sh -h

Running directly

python3 /home/octahedroflake.py --iterations 6 --layer-height 0.2 --nozzle-diameter 0.4 --size-multiplier 1.377628

File Descriptions

This Python script generates the Octahedroflake using CadQuery. It defines the parameters and functions necessary to create the fractal and exports the result as an STL file.

This Bash script streamlines running the `octahedroflake.py` script by offering a user-friendly interface. Specify various parameters, such as the number of iterations, layer height, nozzle diameter, and model height, through command-line arguments or interactive prompts. The script also provides a summary of the resulting model's dimensions and other characteristics.

Restrictions on Selling the Model

The Octahedroflake model is for personal use only. Please refrain from selling this model or claiming it as your own work.

Feedback and Contributions

As my first CadQuery project, I welcome any input or feedback. Please feel free to open an issue or submit a pull request if you have suggestions for improvements.

Docker

BUILD

docker build -t cadquery:fractal .

RUN

docker run -v $(pwd)/output:/home/output -it cadquery:fractal

License

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

octahedroflake's People

Contributors

nat-a-cyborg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

phaiax

octahedroflake's Issues

ValueError: STEP File could not be loaded

I seem to be having issues getting this script to generate a model, even when using the default values. I've tried using both Windows and Ubuntu (through WSL), however I receive the same result either way.

I believe I've installed CadQuery correctly as the following successfully generates raw SVG output:

$ python
$ import cadquery
$ cadquery.Workplane('XY').box(1,2,3).toSvg()

Here's the output I receive when I try running run.sh:

(cq) <USER>@PC:~/octohedroflake$ ./run.sh
Enter the number of iterations (default: 4): 4
Enter the layer height in mm (default: 0.2): 0.2
Enter the nozzle diameter in mm (default: 0.4): 0.4
Enter the model height in mm (default: 200.0): 200.0
***********
Parameters
***********
Iterations: 4
Layer height: 0.2 mm
Nozzle diameter: 0.4 mm
Model height: 200.0 mm
Gap size: 0.01 mm
Edge size: 8.8168208 mm
Rib width: .8 mm
Height factor: 0.7071
Full size: 141.0691328 mm
Size multiplier: 5.510513
python3 ./octahedroflake.py --iterations 4 --layer-height 0.2 --nozzle-diameter 0.4 --size-multiplier 5.510513
Do you want to continue? [Y/n] y
Running the Python script...

2024-04-06 07:49:02.755732: 4 *START*
2024-04-06 07:49:02.755773: full_size: 141.0691328
2024-04-06 07:49:02.755781: full height: 200
2024-04-06 07:49:02.755786: edge size: 8.8168208
2024-04-06 07:49:02.755849: 4    โŒ make_octahedron_fractal- not found in cache
2024-04-06 07:49:02.755874: 4 ๐Ÿ’   make it!
2024-04-06 07:49:02.755884: 4 ๐Ÿ‘ท๐Ÿปโ€โ™€๏ธ About to make a branded pyramid
2024-04-06 07:49:02.755909: 4    โŒ make_branded_pyramid not found in cache
2024-04-06 07:49:02.755952: 4    โŒ make_fractal_pyramid not found in cache
2024-04-06 07:49:02.756032: 3    โŒ make_fractal_pyramid not found in cache
2024-04-06 07:49:02.756073: 2    โŒ make_fractal_pyramid not found in cache
2024-04-06 07:49:02.756096: 1    โŒ make_fractal_pyramid not found in cache
2024-04-06 07:49:02.756173: 0    โŒ make_fractal_pyramid not found in cache
2024-04-06 07:49:02.756239: 0    โŒ make_single_pyramid not found in cache
2024-04-06 07:49:02.756263: 0 ๐Ÿ”บ make a single pyramid
2024-04-06 07:49:02.777673: 0    ๐Ÿ“ฅ make_single_pyramid
2024-04-06 07:49:02.777726: 0    ๐Ÿ“ฅ make_fractal_pyramid
2024-04-06 07:49:02.777868: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_single_pyramid[0].STEP
2024-04-06 07:49:02.782579: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_fractal_pyramid[0].STEP
2024-04-06 07:49:02.784569: 1 ๐Ÿ‘ฏ make clones
2024-04-06 07:49:02.788465: 1    โŒ make_ribs not found in cache
2024-04-06 07:49:02.788495: 1 ๐Ÿฉป  make some ribs
2024-04-06 07:49:02.804676: 1    โŒ make_single_pyramid not found in cache
2024-04-06 07:49:02.804712: 1 ๐Ÿ”บ make a single pyramid
2024-04-06 07:49:02.822124: 1    ๐Ÿ“ฅ make_single_pyramid
2024-04-06 07:49:02.867883: 1    ๐Ÿ“ฅ make_ribs
2024-04-06 07:49:02.868464: 1    โŒ make_gaps not found in cache
2024-04-06 07:49:02.868492: 1 โš”๏ธ  make the gaps
2024-04-06 07:49:02.883578: 1    ๐Ÿ“ฅ make_gaps
2024-04-06 07:49:02.883618: 1 ๐Ÿ’Ž combine clones and parts
2024-04-06 07:49:03.003852: 1    ๐Ÿ“ฅ make_fractal_pyramid
2024-04-06 07:49:03.003916: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_single_pyramid[1].STEP
2024-04-06 07:49:03.006239: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_ribs[1].STEP
2024-04-06 07:49:03.013423: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_gaps[1].STEP
2024-04-06 07:49:03.017460: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_fractal_pyramid[1].STEP
2024-04-06 07:49:03.031788: 2 ๐Ÿ‘ฏ make clones
2024-04-06 07:49:03.039711: 2    โŒ make_ribs not found in cache
2024-04-06 07:49:03.039748: 2 ๐Ÿฉป  make some ribs
2024-04-06 07:49:03.055696: 2    โŒ make_single_pyramid not found in cache
2024-04-06 07:49:03.055733: 2 ๐Ÿ”บ make a single pyramid
2024-04-06 07:49:03.072540: 2    ๐Ÿ“ฅ make_single_pyramid
2024-04-06 07:49:03.117310: 2    ๐Ÿ“ฅ make_ribs
2024-04-06 07:49:03.117963: 2    โŒ make_gaps not found in cache
2024-04-06 07:49:03.117995: 2 โš”๏ธ  make the gaps
2024-04-06 07:49:03.132968: 2    ๐Ÿ“ฅ make_gaps
2024-04-06 07:49:03.133012: 2 ๐Ÿ’Ž combine clones and parts
2024-04-06 07:49:03.527021: 2    ๐Ÿ“ฅ make_fractal_pyramid
2024-04-06 07:49:03.527086: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_single_pyramid[2].STEP
2024-04-06 07:49:03.529523: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_ribs[2].STEP
2024-04-06 07:49:03.536841: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_gaps[2].STEP
2024-04-06 07:49:03.541237: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_fractal_pyramid[2].STEP
2024-04-06 07:49:03.635534: 3 ๐Ÿ‘ฏ make clones
2024-04-06 07:49:03.662875: 3    โŒ make_ribs not found in cache
2024-04-06 07:49:03.662914: 3 ๐Ÿฉป  make some ribs
2024-04-06 07:49:03.680032: 3    โŒ make_single_pyramid not found in cache
2024-04-06 07:49:03.680070: 3 ๐Ÿ”บ make a single pyramid
2024-04-06 07:49:03.698871: 3    ๐Ÿ“ฅ make_single_pyramid
2024-04-06 07:49:03.750179: 3    ๐Ÿ“ฅ make_ribs
2024-04-06 07:49:03.750852: 3    โŒ make_gaps not found in cache
2024-04-06 07:49:03.750881: 3 โš”๏ธ  make the gaps
2024-04-06 07:49:03.767845: 3    ๐Ÿ“ฅ make_gaps
2024-04-06 07:49:03.767896: 3 ๐Ÿ’Ž combine clones and parts
2024-04-06 07:49:05.748185: 3    ๐Ÿ“ฅ make_fractal_pyramid
2024-04-06 07:49:05.748254: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_single_pyramid[3].STEP
2024-04-06 07:49:05.751010: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_ribs[3].STEP
2024-04-06 07:49:05.759472: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_gaps[3].STEP
2024-04-06 07:49:05.764672: ๐Ÿ’พ part_cache/8.82-0.2-0.01-0.7071-0.4-make_fractal_pyramid[3].STEP
2024-04-06 07:49:06.558473: 4 ๐Ÿ‘ฏ make clones
2024-04-06 07:49:06.738410: 4    โŒ make_ribs not found in cache
2024-04-06 07:49:06.738452: 4 ๐Ÿฉป  make some ribs
2024-04-06 07:49:06.757369: 4    โŒ make_single_pyramid not found in cache
2024-04-06 07:49:06.757408: 4 ๐Ÿ”บ make a single pyramid
2024-04-06 07:49:06.780025: 4    ๐Ÿ“ฅ make_single_pyramid
2024-04-06 07:49:06.831983: 4    ๐Ÿ“ฅ make_ribs
2024-04-06 07:49:06.832870: 4    โŒ make_gaps not found in cache
2024-04-06 07:49:06.832899: 4 โš”๏ธ  make the gaps
2024-04-06 07:49:06.850762: 4    ๐Ÿ“ฅ make_gaps
2024-04-06 07:49:06.850802: 4 ๐Ÿ’Ž combine clones and parts
2024-04-06 07:49:19.682576: 4    ๐Ÿ“ฅ make_fractal_pyramid
2024-04-06 07:49:19.687034: 4    โŒ make_logo[2] not found in cache
2024-04-06 07:49:19.687076: 4 ๐Ÿง  make the logo
Traceback (most recent call last):
  File "/home/<USER>/octohedroflake/./octahedroflake.py", line 494, in <module>
    run()
  File "/home/<USER>/octohedroflake/./octahedroflake.py", line 474, in run
    flake = make_octahedron_fractal()  # .rotateAboutCenter((0, 0, 1), 45)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<USER>/octohedroflake/./octahedroflake.py", line 453, in make_octahedron_fractal
    pyramid = make_branded_pyramid() if branded else make_unbranded_pyramid()
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<USER>/octohedroflake/./octahedroflake.py", line 418, in make_branded_pyramid
    branded_pyramid = make_fractal_pyramid(order=FINAL_ORDER).union(make_logo())
                                                                    ^^^^^^^^^^^
  File "/home/<USER>/octohedroflake/./octahedroflake.py", line 279, in make_logo
    logo = cq.importers.importStep("logo_stamp.step").val().scale(scale_multiplier * 0.35)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<USER>/mambaforge/envs/cq/lib/python3.12/site-packages/cadquery/occ_impl/importers/__init__.py", line 55, in importStep
    raise ValueError("STEP File could not be loaded")
ValueError: STEP File could not be loaded
Done.
Press 'r' to run again, or any other key to exit...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.