I'm new to the Blender API, so I've been doing a lot of playing around with it. I'm having some issues trying to do something that should be simple.
My goal: make a copy of a "base" object, enter edit mode, rotate it by 90 degrees on the Y
axis (so it's on its side), and then put the new edited object into the "base shape" collection.
My problem: When I get the object and try to rotate it, it affects all of the other objects in the "base shape" collection.
My function:
def make_side_arch():
base = C.collection.children['Base Shapes'].objects['Semi_Arch']
ob = base.copy()
ob.data = base.data.copy()
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.transform.rotate(value=radians(90), orient_axis='Y')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')
ob.name = 'Side_Arch'
ob.data.name = 'Side_Arch'
ob.data = ob.data.copy()
C.collection.children['Base Shapes'].objects.link(ob)
return ob
In the screenshot below, I am trying to apply it to the objects called Semi_Arch. (I'll attach the blend file at the end). It seems to be affecting all the other shapes in the file though, and I'm struggling to understand why. I know I'm probably in the wrong context or something, but it's been really, really confusing wrapping my head around it. Any help is greatly appreciated!
I know people say to avoid bpy.ops, but I don't know how to do most things without it.