Forum

Author Topic: Re-opening project with chunk  (Read 1686 times)

PierreB

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re-opening project with chunk
« on: June 03, 2022, 06:34:48 PM »
Hi. My workflow is the following:
- python script #1: create project, create chunk, add photos, photo matching and save
- open the project in the GUI and manually add GCP points and save
- python script #2: re-open the project and build the dense cloud
How do I re-open the project with the chunk already created?
Thanks

3DWinter

  • Full Member
  • ***
  • Posts: 103
    • View Profile
Re: Re-opening project with chunk
« Reply #1 on: June 05, 2022, 09:01:18 AM »
I would like to support my interest PierreB's question!
What I have tried to do:

Code: [Select]
doc = Metashape.Document()
doc.open(project_name)
chunk=doc.findChunk(0)

I know the project has four control points, but when I run the following I get nothing.
Code: [Select]
for point in chunk.markers:
    print(point.read)

It is pretty clear I am not reading/loading the chunk correctly.
Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Re-opening project with chunk
« Reply #2 on: June 06, 2022, 03:20:52 PM »
Hello!

If you need to open the existing project in the currently opened Metashape instance, you should do the following:

Code: [Select]
doc = Metashape.app.document #currently opened document in actual Metashape window
doc.open(project_name)
Best regards,
Alexey Pasumansky,
Agisoft LLC

PierreB

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Re-opening project with chunk
« Reply #3 on: June 06, 2022, 06:03:52 PM »
And what about the chunk? How do I open the existing chunk in the project?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Re-opening project with chunk
« Reply #4 on: June 06, 2022, 07:18:04 PM »
Hello Pierre,

Each project always has an active chunk (if there is at least one chunk), which is opened by default, when you load the project.

If you need to change the active chunk, call:
Code: [Select]
doc.chunk = doc.chunks[N] #N - chunk's index in the Workspace pane, starting from 0
Best regards,
Alexey Pasumansky,
Agisoft LLC

PierreB

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Re-opening project with chunk
« Reply #5 on: June 06, 2022, 07:43:30 PM »
Thank you Alexey.