Currently this code creates an empty at a defined position and have used parent to get an object, in this case a cube to be in that position. However the newly created cube states its position as the origin rather than its actual position. How would I get the cube to display its actual position which would be the same as the empty?
import bpy
from mathutils import Matrix, Vector
context = bpy.context
scale = 0.01
x, y, z, l, m, n, p, q, r = -500, 200, 1000, 1, 0, 0, 0, 0, -1
y_axis = Vector((l, m, n))
z_axis = Vector((p, q, r))
x_axis = y_axis.cross(z_axis).normalized()
M = Matrix((x_axis, y_axis, z_axis)).transposed()
M = M.to_4x4()
M.translation = scale * Vector((x, y, z))
print(M)
print(x_axis, y_axis, z_axis)
bpy.ops.object.empty_add()
mt = context.object
mt.empty_display_type = 'ARROWS'
empty = bpy.context.object
mt.matrix_world = M
bpy.ops.mesh.primitive_cube_add()
cube = bpy.context.object
cube.parent = empty
my_cube.matrix_world.translation
? Don't get your question... $\endgroup$