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 | |
# give Python access to Blender's mesh editing functionality | |
import bmesh | |
# extend Python functionality to generate random numbers | |
import random | |
# add an ico sphere |
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 | |
# give Python access to Blender's mesh editing functionality | |
import bmesh | |
# 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 | |
import blf | |
from bpy_extras.view3d_utils import location_3d_to_region_2d | |
def draw_text_on_verts(): | |
font_id = 0 | |
region = bpy.context.region | |
rv3d = bpy.context.space_data.region_3d |
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
""" | |
Copy location animation on the Z axis from one cube to another. | |
This script expects that there are two cubes in the scene. | |
The first one named 'Cube' that has an location animation on the Z axis. | |
The second one named 'Cube.001'. We will be copying the animation from 'Cube' to 'Cube.001'. | |
""" | |
# give Python access to Blender's functionality | |
import bpy |
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 | |
# create a variable to set the spacing between object origins | |
location_offset = 3 | |
# create a row of cubes along the X-axis | |
for i in range(10): | |
bpy.ops.mesh.primitive_cube_add(location=(i * location_offset, 0, 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 | |
# Note: make sure to run this script start_scene_collection_exercises.py https://gist.github.com/CGArtPython/8adc0c15813684db465a359313060164 | |
# before executing the rest of this script | |
col_name = "monkeys" | |
collection = bpy.data.collections.new(name=col_name) | |
# if you didn't create a variable |
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
""" | |
https://stackoverflow.com/a/42879185 | |
https://en.wikipedia.org/wiki/Parametric_equation#Circle | |
https://sinestesia.co/blog/tutorials/python-tubes-cilinders/ | |
https://blog.wolfram.com/2015/06/28/2-pi-or-not-2-pi/ | |
Great explanation of the math behind this |
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 coordinates | |
coordinates = [] | |
coordinate_count = 10 |
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 coordinates | |
coordinates = [] | |
coordinate_count = 10 |