# Finding the python command for an addon (and using it for “Sapling: Add Tree”)

I'm very new to blender and so of course apologies if the question has been asked before (I searched best I could but am not entirely 100% on the nomenclature). Also fairly new to python but have some experience in other languages.

I'm trying to use blender to generate trees which vary defined axes. For the sake of the question, lets say I want to generate trees using the Sapling add-on (it seems like the easiest way?) which have random base splits and levels (to take two obvious parameters).

I understand how to add objects and manipulate the camera etc. using python but don't get how to work out the command for an addon.

For instance I get how

bpy.ops.mesh.primitive_cube_add(radius=1, location = (0,0,0))


adds a cube of radius 1 at that location, but don't know how to find primitive_cube_add from hitting SPACE and then Cube.

Ideally I'd like to do the same for the sapling addon, e.g. something like:

bpy.ops.mesh.add_sapling(levels = randint1, base_splits = randint2)


Hope this is clear enough, I can clarify anything I've left confusing.

Thanks,

• I think you are looking for 'bpy.ops.curve.tree_add(...' – lemon Mar 17 '17 at 11:55
• – batFINGER Mar 18 '17 at 14:15