Hello szabo.robert,
If you wish to make a script that saves the shapes for all the chunks in the active project, you can do the following:
import Metashape
shapepath=Metashape.app.getExistingDirectory()
kmlformat=Metashape.ShapesFormatKML
dxfformat=Metashape.ShapesFormatDXF
kmlprojection=Metashape.CoordinateSystem("EPSG::4326")
dxfprojection=Metashape.CoordinateSystem("EPSG::23700")
labels = set()
for chunk in Metashape.app.document.chunks:
if chunk.shapes:
label = chunk.label
num = chunk.key
while label in labels:
label = chunk.label + "_" + str(num)
num += 1
labels.add(label)
chunk.exportShapes(path=shapepath+"\\" + label + ".kml", format=kmlformat, projection=kmlprojection, polygons_as_polylines=True, export_labels=False, export_attributes=True)
chunk.exportShapes(path=shapepath+"\\" + label + ".dxf", format=dxfformat, projection=dxfprojection, polygons_as_polylines=True, export_labels=False, export_attributes=True)
This code should export the shapes for all the available chunks to the same directory, but using individual filenames according to the chunk label.