Skip to content

FlaviaR/Procedural-Trees

Repository files navigation

Procedural-Trees

There are a number of packages that have to be installed before using this code:

  • On Fedora:
    -# sudo dnf install openscad-MCAD
  • On Ubuntu:
    -# sudo apt-get install openscad-mcad
  • On MacOS (using macports):
    -# sudo port install OpenSCAD
  • sudo pip install solidpython
    or for python3:
  • sudo pip3 install solidpython

Note: The GUI has to be run with python3:


To run the example models found in the turtle class:

  • python turtle.py <example_number>
  • <example_number> can be any number from 0 to 11
  • openscad turtle.scad 5 &

To use the pregenerated rules in the GUI, simply run:

  • python3 interface.py
    -> python3 should be able to open the generated scad file automatically,
    however if there are problems when opening the subprocess, the generated file can be manually opened by typing:
  • openscad lSystemModel[n].scad, where [n] is the number of the file you want to open.
    E.g. openscad lSystemModel5.scad

Information regarding the GUI:
  • Pre-made Rules - a number of pre-written rules that can be selected to generate models

  • Options -

    • Stochastic L-Systems - select this option to generate non-deterministic trees
    • Display multiple - display three models side by side
    • Orientation - select which axis the model should be drawn along
    • Add spheres - select this to add spheres in between the cylinder connections. (Use this if generating a model to be printed)
    • Add base to model - select this to add a base to the tree model
    • Base Diameter - select a diameter for the base
    • No L-System - Recursive Tree - select this to generate a recursive tree that does not use L-Systems

  • Make your own rules:

    • Ang - rotation angle in degrees
    • Depth - recursion depth to generate the L-System rules
    • Base Phrase - base sentence to initialize the L-System rules
    • Prod. Rules - Production rules separated by a comma- Ex: A, FF^A, B, F&&FB
      Which will generate the following rules: <A:FF^A, B:F&&B>

      One possible entry would be:
      35
      5
      FFFA
      A, >”[&FFFA]////[&FFFA]////[&FFFA]

OpenSCAD is a computationally heavy software used to extract models for 3D printing.
As such, even though the preview of the models are quick to open, actually rendering them to extract their STL file is time consuming.
For example, when using the "skeletal tree" rule in the interface, the following times are generated:

  • Open preview:
    • ~20s on a linux machine with intel CORE i7 with 8GB
    • ~5s on a mac book air with intel CORE i7 with 8GB
  • Rendering the file:
    • 9 hours and 27 minutes on the mac
    • 5 hours and 9 minutes on a windows machine with NVIDIA GEFORCE 1080 and 16GB of RAM

@see http://www.openscad.org/
@see https://github.com/SolidCode/SolidPython


This project uses L-Systems to generate Trees and other models procedurally.

About

Uses openSCAD. Generates physical tree objects that can be 3D printed. Generation can be stochastic or non-stochastic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published