Skip to content

Instantly share code, notes, and snippets.

import bpy
import random
# base_color = (0.0, 1.0, 0.0, 1.0)
base_color = (.928, .693, .423, 1.0)
rod_colors = [
(173/255, 117/255, 96/255, 1.0),
(104/255, 81/255, 82/255, 1.0),
(162/255, 139/255, 107/255, 1.0),
(50/255, 28/255, 29/255, 1.0),
import bpy
obj_B = bpy.data.objects.get("Sphere")
for obj in bpy.data.objects:
if 'Cube' in obj.name:
# print(obj.name)
bpy.context.view_layer.objects.active = obj
bool_mod = obj.modifiers.new(name="MyBoolean", type='BOOLEAN')
bool_mod.operation = 'INTERSECT' # Options: 'DIFFERENCE', 'UNION', 'INTERSECT'