Forum

Author Topic: How to merge two .psx files  (Read 3940 times)

awilson

  • Newbie
  • *
  • Posts: 18
    • View Profile
How to merge two .psx files
« on: June 15, 2017, 04:02:36 AM »
I'm trying to do the equivalent of File->Append... to merge two files. I thought it would be something like:

Code: [Select]
doc = PhotoScan.app.document
doc.open(filepath1)
doc2 = PhotoScan.Document()
doc2.open(filepath2)
doc.append( doc2 )

but that gives me the error:

TypeError: object is not a sequence

Can someone point out what I'm doing wrong? Thank you!

awilson

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: How to merge two .psx files
« Reply #1 on: June 15, 2017, 07:25:56 PM »
I figured it out - the documentation shows the chunks parameter as optional, but then it's trying to parse None as a list, I believe. Regardless, this code works:

Code: [Select]
doc = PhotoScan.app.document
doc.open(filepath1)
doc2 = PhotoScan.Document()
doc2.open(filepath2)
doc.append( doc2, doc2.chunks )

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14943
    • View Profile
Re: How to merge two .psx files
« Reply #2 on: June 15, 2017, 07:59:55 PM »
Hello awilson,

Thank you for reporting.

We'll fix that.
Best regards,
Alexey Pasumansky,
Agisoft LLC

ArchArch

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: How to merge two .psx files
« Reply #3 on: November 29, 2018, 05:25:09 AM »
Can anyone tell me how to properly fill in this code to merge two .psx files? I'm a newby at code, but have done some scripting and just need an example of the code filled in so I can emulate it. Thanks.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14943
    • View Profile
Re: How to merge two .psx files
« Reply #4 on: November 29, 2018, 05:21:59 PM »
Hello ArchArch,

The code below should merge all the contents of the "target" project to the "source" project and re-save "source" project under the same name.
Code: [Select]
import PhotoScan
source = PhotoScan.Document()
source.open("D:/projects/original_proj.psx")
target  = PhotoScan.Document()
target.open("D:/projects/to_merge_proj.psx")
source.append(target)
source.save()
Best regards,
Alexey Pasumansky,
Agisoft LLC