This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give Python access to Blender's functionality | |
import bpy | |
# extend Python functionality to generate random numbers | |
import random | |
# add ico spheres into the scene | |
object_count = 10 | |
for _ in range(object_count): | |
x = random.uniform(-5, 5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give Python access to Blender's functionality | |
import bpy | |
# extend Python functionality to generate random numbers | |
import random | |
# create a list of cubes | |
cube_objects = [] | |
# collect all cubes into a list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give Python access to Blender's functionality | |
import bpy | |
# extend Python functionality to generate random numbers | |
import random | |
# create a list of colors | |
colors = [ | |
[0.888, 0.515, 0.016, 1.0], | |
[0.03, 0.376, 0.521, 1.0], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Creating a phyllotaxis pattern based on formula 4.1 from | |
http://algorithmicbotany.org/papers/abop/abop-ch4.pdf | |
""" | |
# give Python access to Blender's functionality | |
import bpy | |
# extend Python functionality to generate random numbers | |
import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
verts = [ | |
(-1.0, -1.0, -1.0), | |
(-1.0, 1.0, -1.0), | |
(1.0, 1.0, -1.0), | |
(1.0, -1.0, -1.0), | |
(-1.0, -1.0, 1.0), | |
(-1.0, 1.0, 1.0), | |
(1.0, 1.0, 1.0), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give Python access to Blender's functionality | |
import bpy | |
# extend Python functionality to generate random numbers | |
import random | |
def create_plane_with_color(color, location): | |
# add a plane | |
bpy.ops.mesh.primitive_plane_add() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give Python access to Blender's functionality | |
import bpy | |
# extend Python functionality to generate random numbers | |
import random | |
# add ico spheres into the scene | |
object_count = 10 | |
for _ in range(object_count): | |
x = random.uniform(-5, 5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give Python access to Blender's functionality | |
import bpy | |
cube_key = "cubes" | |
ico_key = "spheres" | |
cone_key = "cones" | |
# create a dict of mesh lists | |
mesh_objects = { | |
cube_key: list(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
####################################################################### | |
# create a cube with square faces | |
####################################################################### | |
# define the coordinates of each vertex | |
verts = [ | |
(-1.0, -1.0, -1.0), | |
(-1.0, 1.0, -1.0), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def create_mesh_data(verts, edges, faces): | |
""" | |
create a mesh from the vert, edge, and face data | |
""" | |
mesh_data = bpy.data.meshes.new("cube_data") | |
mesh_data.from_pydata(verts, edges, faces) |