TransWikia.com

How to write a python script to execute a .blend file and modify it

Blender Asked by BetterEnglish on November 13, 2021

I am doing a complicated 3D scene model. Actually, I am using the blender GUI (not python script) to do it. Once I designed the scene, I need to move randomly an object in the scene for many times. So, I am wondering, if possible to write a python script that execute the *.blend file and then in the same script, I write lines to move randomly the object. Any suggestion?

One Answer

import bpy 
from random import randint 

# Generate 50 cubes in random locations for i in range(50):
bpy.ops.mesh.primitive_cube_add(location = [ randint( -10, 10 ) for axis in 'xyz' ])

Replace cube with your model and this should work.

Answered by H S Srihari on November 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP