# Use location and rotation 0,0,0 for all exported meshes

I would like to know how can I modify the location of the 3d model that I'm exporting without modifying the original one, I'm using this code:

if SceneObj.type == 'MESH':
if hasattr(SceneObj, 'data'):
#Clone Object
depsgraph = bpy.context.evaluated_depsgraph_get()
ob_for_convert = SceneObj.evaluated_get(depsgraph)

try:
MeshObject = ob_for_convert.to_mesh()
except RuntimeError:
MeshObject = None
if MeshObject is None:
continue

#Apply Rotation Matrix
MeshObject.transform(EXPORT_GLOBAL_MATRIX @ SceneObj.matrix_world)
if EXPORT_FLIP_POLYGONS:
MeshObject.flip_normals()



The idea would be that independently of the location and rotation of the original object, the exported one has the location (0,0,0) and the rotation (0,0,0), but I don't know how to do it.

This exporter I'm working on is for an external program, so all of those things must be done in the exporter.

Im not entirely sure on what youre trying to do but I'm assuming you want to import a 3d file and move it to a specific location and rotate it?

I think your problem may be:

MeshObject = ob_for_convert.to_mesh()


What I usually use is:

block = bpy.context.selected_objects[0]


Then we can move the location and rotation:

block.location = (1,1,1)
block.rotation_euler = (0,45,0)


Some code I wrote that does what I think you want it to do (or similar):

import bpy

file_loc = 'file/dir/object.obj'
imported_object = bpy.ops.import_scene.obj(filepath=file_loc)

bpy.ops.object.duplicate()

block = bpy.context.selected_objects[0]

block.location = (1,1,1)
block.rotation_euler = (0,45,0)

• Thanks, but the idea is to move the clone that will be exported, the exporter I'm working on is for an external software, the idea is to move the cloned object that I want to export to the center, but the problem is that I can't move that clone to the center because I use .to_mesh() – jms2505 Feb 25 at 8:44
• I've modified a bit the code and worked very well, thanks! – jms2505 Feb 25 at 17:39
• blender.stackexchange.com/questions/176104/… – batFINGER Feb 26 at 9:03