Hello LRP,
Can you please try to check, if the following script gives you the desired result for the mesh model export in FBX format?
You need to have one 3D marker selected before running the script. The model should be exported in local space Euclidean coordinate system that has its origin in the point of the selected marker and has its axes parallel to the real world coordinate system axis in the given point:
import Metashape
def export_topocentric_by_marker():
doc = Metashape.app.document
chunk = doc.chunk
T = chunk.transform.matrix
crs = chunk.crs
if chunk.marker_crs:
crs = chunk.marker_crs
if not chunk:
print("Empty project, script aborted")
return 0
if not len(chunk.markers):
print("No markers, script aborted")
return 0
markers = [marker for marker in chunk.markers if marker.selected]
if len(markers) != 1:
print("Only one marker should be selected, script aborted")
return 0
marker = markers[0]
if not marker.position:
print("No 3D location for selected marker, script aborted")
return 0
if not chunk.model:
print("No active mesh model, script aborted")
return 0
path = Metashape.app.getSaveFileName("Specify export path for mesh", filter = "*.FBX")
if not path:
print("Empty path, script aborted")
return 0
WGS84 = Metashape.CoordinateSystem("EPSG::4326")
marker_wgs84 = WGS84.project(T.mulp(marker.position))
long, lat, alt = marker_wgs84
wkt2 = 'PROJCRS["EPSG topocentric example A", BASEGEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",4979]], CONVERSION["EPSG topocentric example A", METHOD["Geographic/topocentric conversions", ID["EPSG",9837]], PARAMETER["Latitude of topocentric origin",{:.9f}, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8834]], PARAMETER["Longitude of topocentric origin",{:.9f}, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8835]], PARAMETER["Ellipsoidal height of topocentric origin",{:.3f}, LENGTHUNIT["metre",1], ID["EPSG",8836]]], CS[Cartesian,3], AXIS["topocentric East (U)",east, ORDER[1], LENGTHUNIT["metre",1]], AXIS["topocentric North (V)",north, ORDER[2], LENGTHUNIT["metre",1]], AXIS["topocentric height (W)",up, ORDER[3], LENGTHUNIT["metre",1]], USAGE[ SCOPE["unknown"], AREA["To be specified"], BBOX[-90,-180,90,180]]]'.format(lat, long, 0)
export_crs = Metashape.CoordinateSystem(wkt2)
chunk.exportModel(path, format = Metashape.ModelFormatFBX, crs = export_crs, save_metadata_xml = True, binary = False)
print("Script finished")
return 1
export_topocentric_by_marker()