Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: excalibur on May 18, 2015, 01:08:44 PM
-
Hi guys,
Is it possible to save (script) all chunks into separate photoscan files.
example: from 1 file with 10 chunks -> 10 files including only 1 chunk?
thank you
-
Hello exalibrur,
You can make a copy of each chunk to the temporary variable, for example, temp_chunk = active_chunk.copy(), then create new document: doc2 = PhotoScan.Document() and then add the chunk:
doc2.addChunk(temp_chunk)
doc2.save(path)
-
Hi,
The command doc.addChunk does not accept a chunk anymore into its parameters.
Is it another way to save all chunks into separate projects without reloading the full project each time?
-
Hello Pierre,
you can use optional chunks argument in doc.save() function, in case you need to save a new project using only a few chunks from original project.
The following example should save each chunk from the source project under a different name:
doc = Metashape.app.document
for i in range(len(doc.chunks)):
doc.save(path = "project_chunk_" + str(i) + ".psx", chunks = [doc.chunks[i]])
-
A very clean method. thanks! :)