Forum

Author Topic: Merging dense clouds with python  (Read 1831 times)

Major Domo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Merging dense clouds with python
« on: April 05, 2019, 10:37:07 PM »
Hi,

I have lidar loaded several lidar scans into Metashape via python.
All the dense cloud sit under the same chunk, but now I want to merge the dense clouds to mesh.
I can do this via the UI, but wanted to do this programmatically, but haven't found what command to use yet.
Is there a command for this?

Many thanks in advance!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Merging dense clouds with python
« Reply #1 on: April 07, 2019, 07:28:41 PM »
Hello Major Domo,

I suggest the following code to merge all the available dense clouds in the active chunk into new dense cloud instance:
Code: [Select]
import Metashape
chunk = Metashape.app.document.chunk
chunk.dense_cloud = None #making no active dense cloud
task  = Metashape.Tasks.MergeAssets()
task.assets = [cloud.key for cloud in chunk.dense_clouds]
tasks.apply(chunk)
« Last Edit: April 10, 2019, 03:45:30 PM by Alexey Pasumansky »
Best regards,
Alexey Pasumansky,
Agisoft LLC

Major Domo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Merging dense clouds with python
« Reply #2 on: April 07, 2019, 11:27:05 PM »
Many thanks Alexey!

Worked a treat, I just changed a couple of typos below and runs like a treat.
And it also shows me just how well implemented Python is into Metashape...really exciting times ahead!

Code: [Select]
import Metashape
chunk = Metashape.app.document.chunk
chunk.dense_cloud = None #making no active dense cloud
task  = Metashape.Tasks.MergeAssets()
task.assets = [cloud.key for cloud in chunk.dense_clouds]
task.apply(chunk)

Thanks!