Historical · current compatibility unverified Original context: PME version not stated; Blender version not stated; 2020.
Outcome
Create a modifier and immediately configure the specific instance that was just added, rather than calling a similarly named mesh operation or assuming a generated modifier name.
Historical sequence
The answer split the task into three operations:
bpy.ops.object.modifier_add(True, type="DECIMATE")
modifier = C.object.modifiers[len(C.object.modifiers) - 1]
modifier.decimate_type = "DISSOLVE"
modifier.angle_limit = 0.349066
modifier.use_dissolve_boundaries = TrueThis 2020 command used the Blender and PME call syntax of its time. Its logic was:
- add the modifier;
- take the last entry from the active object’s modifier collection;
- set properties on that retained entry.
The follow-up explains the index: collection positions begin at zero, so a collection with len(...) entries has its final entry at len(...) - 1.
Why the original attempt failed
The attempted bpy.ops.object.decimate(...) call does not add a modifier. Add one with bpy.ops.object.modifier_add(...), retain a reference to the newly created modifier, then set its properties. This is more reliable than looking it up by a display name that Blender may suffix or localize.