Post #1358: : post_01359
🏷️ Tags
macro scripting intermediate solved
⚙️ Related PME Features
- Stack Key Editor
- Python Scripting
- Macro Editor
💬 Content
Leafar:
Hi, I forgot something or I don´t know… how can I add a modifier with the settings that I want?? We could do this, couldn´t we?? Feeling a bit lost… I want to add a stack key for adding wireframe modifier and then bevel modifier.
I would just do it this way:
import bpy
# loop through selected objects
for obj in bpy.context.selected_objects:
bpy.context.scene.objects.active = obj
# add wireframe and bevel modifiers
obj.modifiers.new("MyWireframe", type = "WIREFRAME")
obj.modifiers.new("MyBevel", type = "BEVEL")
# change parameters
bpy.context.object.modifiers["MyBevel"].segments = 4
It works for a whole selection then and you can just add as many parameter changes as you want 
Just run it in PME as an external script and you are good to go.