Hi arjungk96,

You would need to place 3 markers (m1, m2, m3) on model representing the desired horizontal plane X, Y axii for your DEM creation. with m1 to m2 defining X and m1 to m3 defining Y as in:

`def cross(a, b):`

result = Metashape.Vector([a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y *b.x])

return result.normalized()

chunk = Metashape.app.document.chunk

X = (m2.position - m1.position).normalized()

Y = (m3.position - m1.position).normalized()

Z = cross(X,Y)

Y1 = -cross(X,Z)

T = Metashape.Matrix( [[X.x,Y1.x,Z.x,0],[X.y,Y1.y,Z.y,0],[X.z,Y1.z,Z.z,0],[0,0,0,1]] ).t()

chunk.transform.matrix = T

as you can see in following screen capture, the X, Y axii are now practically parallel with church back wall as defined by marhers 1, 2, 3

PS. I corrected code to use transpose of T and 0,0,0 translation....