Skip to main content
Tweeted twitter.com/StackBlender/status/1361737138568593408
Improve tags
Link
Source Link
Craig D Jones
  • 8.8k
  • 2
  • 20
  • 44

Add modifier to selected and another to active object

I am trying to set up an operator to use the BoolTool after I set a position and modifier on Selected object and a different one on the Active object. I basically need to move the selected object up in Z and add a solidify modifier at .3 thickness, and to the Active I need to add a solidify at .1 thickness and remain in original position.

I thought I understood how to get this to work, but all I get is both modifiers on the Active object. Any hint as to where to go from here?

class SolidfyDifference(bpy.types.Operator):
"""Solidify and Difference Mask"""
bl_idname = "object.solidfy_difference"
bl_label = "Add Solidy and Difference Bool"
bl_options = { 'REGISTER','UNDO' }

def execute(self, context):
    scene = context.scene
    
    sel = bpy.context.selected_objects
    act = bpy.context.active_object
    
    
    
    for obj in sel:
        if obj != act:
            bpy.ops.object.modifier_add(type='SOLIDIFY')
            bpy.context.object.modifiers["Solidify"].thickness = 0.1
        
            
            
    return {'FINISHED'}