p2or
4/13/2015 - 7:37 AM

blender-add-and-apply-subsurf.py

import bpy

obj = bpy.context.object

bpy.ops.object.modifier_add(type='SUBSURF')

for mod in obj.modifiers:
    if mod.type == "SUBSURF":
        obj.modifiers[mod.name].levels = 1
        bpy.ops.object.modifier_apply(apply_as='DATA', modifier=mod.name)