Cell fracture in python script

Hi, I am new in Blender and appreciate if you advice me with your experience and knowledge in this software. I need to automate cell fracture, but I have difficulty in activating the add on in python script and calling the function. Is there any script developed for this purpose and how I can activate the add on and call it in script?

Thanks a lot for your time :slight_smile:

If you just want to activate the addon and apply the default cell fracture to the selected object you can use the following:

# All Blender scripts start by importing bpy - the Blender Python library
import bpy

# Next we activate the addon we want
bpy.ops.preferences.addon_enable(module="object_fracture_cell")

# Then apply the cell fracture operation to the active (selected) object
bpy.ops.object.add_fracture_cell_objects()

If you need to make any changes to the cell fracture operation, you can change some of the arguments, as follows:

import bpy

bpy.ops.preferences.addon_enable(module="object_fracture_cell")
bpy.ops.object.add_fracture_cell_objects(

# Alter any of the values below to your needs, if you are not sure what you can enter,
# you can always check the bpy API: https://docs.blender.org/api/current/

    source={'PARTICLE_OWN'}, 
    source_limit=100, 
    source_noise=0, 
    cell_scale=(1, 1, 1), 
    recursion=0, 
    recursion_source_limit=8, 
    recursion_clamp=250, 
    recursion_chance=0.25, 
    recursion_chance_select='SIZE_MIN', 
    use_smooth_faces=False, 
    use_sharp_edges=True, 
    use_sharp_edges_apply=True, 
    use_data_match=True, 
    use_island_split=True, 
    margin=0.001, 
    material_index=0, 
    use_interior_vgroup=False, 
    mass_mode='VOLUME', 
    mass=1, 
    use_recenter=True, 
    use_remove_original=True, 
    collection_name="", 
    use_debug_points=False, 
    use_debug_redraw=True, 
    use_debug_bool=False
)