Forum

Author Topic: Saving multiple chunks to separate psx files  (Read 2202 times)

danderson4

  • Newbie
  • *
  • Posts: 14
    • View Profile
Saving multiple chunks to separate psx files
« on: June 09, 2019, 01:31:40 AM »
Hello,
I often times will create multiple chunks in a single document in order to run batch processing on all the chunks over night. However once the processing is completed I'd like to be able to save out each chunk as its own .psx file with the file name the same as the chunk name using a script. Does anyone have a script already that can do this, or suggest how to create such a script.
I'm fairly new to the Metashape api but have done some programming in Python, visual basic, lisp, and c++
Any help greatly appreciated

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Saving multiple chunks to separate psx files
« Reply #1 on: June 20, 2019, 08:27:23 PM »
Hello danderson4,

Document class element has optional chunks parameter that allows to path the list of chunks to be saved, for example:

Code: [Select]
doc = Metashape.app.document
#... some processing
doc.save(path_complete)

for i in range(len(doc.chunks)):
      doc.save("D\chunks\" + doc.chunks[i].label + ".psx", chunks = [doc.chunk[i]])
      doc.open(path_complete
As you see the original project is re-opened, since the doc variable is re-assigned, if the project is saved in PSX format.
Best regards,
Alexey Pasumansky,
Agisoft LLC