Forum

Author Topic: Get number of model faces  (Read 4066 times)

james.herbst

  • Newbie
  • *
  • Posts: 12
    • View Profile
Get number of model faces
« on: January 28, 2022, 10:51:53 AM »
Hi All,
I'm trying to get the number of faces of the model in the active chunk. I have done it by accessing the model statistics as in this thread (https://www.agisoft.com/forum/index.php?topic=11026.0) but this code analyses the mesh each time taking 60 seconds or so.  However, the 'faces' value is already calculated and displayed in the workplace/3D Model sidebar, in the properties pane, and in "Show Info..."

 Is there a way to access the metadata of the model to get the number of faces without having to reanalyse the mesh each time?
Thanks so much!
James

Paulo

  • Hero Member
  • *****
  • Posts: 1529
    • View Profile
Re: Get number of model faces
« Reply #1 on: January 28, 2022, 11:50:00 AM »
james,

I think an easy way to get number of faces is:
Code: [Select]
chunk = Metashape.app.document.chunk
len(chunk.model.faces) # no. of faces in model
Best Regards,
Paul Pelletier,
Surveyor

james.herbst

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Get number of model faces
« Reply #2 on: January 28, 2022, 02:41:04 PM »
yes, easy and fast! Exactly what I'm looking for.
Thanks, Paulo!
James