Forum

Author Topic: Duplicate a given chunk multiple times  (Read 2721 times)

Benny

  • Newbie
  • *
  • Posts: 13
    • View Profile
Duplicate a given chunk multiple times
« on: March 24, 2018, 06:01:38 PM »
Hi,

I am kind of a newbie in python scripting and I need help for a simple request.

I would like to make a script to duplicate a chunk multiple times, knowing that I would like to be able to select the chunk to duplicate and the number of times this chunk has to be duplicated.

I work on Photoscan Pro 1.4.1. So, I played with Duplicate.Chunk, but I did not succeed to get something working.

Thanks in advance for your help!

BenoƮt

Benny

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Duplicate a given chunk multiple times
« Reply #1 on: March 27, 2018, 06:49:02 PM »
More simple: if someone is able to explain to me how to use Duplicate.Chunk, I will find the solution by myself. This function asks for an "object" as input, but everything I write as an object doesn't work. So, I don't understand what is this object. A simple example could probably help me.

Many thanks in advance!

Benny

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Duplicate a given chunk multiple times
« Reply #2 on: March 27, 2018, 06:51:15 PM »
Hello Benny.

to copy the active chunk in the current document multiple times use the following code:

Code: [Select]
chunk = PhotoScan.app.document.chunk
N = 10 #times to duplicate
for i in range(N):
    chunk.copy()
Best regards,
Alexey Pasumansky,
Agisoft LLC

Benny

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Duplicate a given chunk multiple times
« Reply #3 on: March 28, 2018, 09:09:22 PM »
Thank you very much!

I knew it was that simple! I followed a bas lead with Duplicate.Chunk.

Thanks again for your help!

Benny