Align Two Mesh with same origin point I have two meshes  in my file found here: 

I want my upper mesh m2 to have the same location, origin point and bounding box positions as the lower mesh m1. I have the below script which adjusts the size of the bounding box on y and z axis to match the lower mesh but how I can make it have the same position with the exact same origin point of the lower mesh so that they are exactly on top of each other. Any advice please?

So as shown below, using python I want the uppermesh m2 be positioned exactly on top of lower mesh m1 and after that set it's origin to be the exact place as the origin of m1. 



import bpy

scene= bpy.context.scene
m1 = bpy.data.objects['m1']
m2 = bpy.data.objects['m2']


m1Bound = m1.matrix_world.to_quaternion() * m1.dimensions
m2Bound = m2.matrix_world.to_quaternion() * m2.dimensions
ratio = abs(m1Bound.y) / abs(m2Bound.y)
m2.scale *= ratio

bpy.ops.object.select_all(action='DESELECT')
m2.select = True
scene.objects.active = m2
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)


m1Bound = m1.matrix_world.to_quaternion() * m1.dimensions
m2Bound = m2.matrix_world.to_quaternion() * m2.dimensions
ratio = abs(m1Bound.z) / abs(m2Bound.z)
m2.scale.z *= ratio
I was able to fix it by setting the origin to the centre of bounding box then copying location from m1 to m2 then applying location as shown below.

bpy.ops.object.select_all(action='DESELECT')
m2.select = True
scene.objects.active = m2
m1.select = True
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='BOUNDS')
m2.location = m1.location
bpy.ops.object.transform_apply(location=True, rotation=False, scale=False)