Forum

Author Topic: Python API - Make Selection for Crop?  (Read 5194 times)

Majestic12

  • Newbie
  • *
  • Posts: 2
    • View Profile
Python API - Make Selection for Crop?
« on: December 15, 2014, 11:09:09 AM »
Hi All,

I'm currently using Photoscan Pro and I am trying to write a script that automatically from scratch builds a height field, scales it, crops it, closes holes and finally calculates volume.

I am stuck on the cropping part where I am able to do a 'cropSelection' call but I can't seem to find how to make a selection automatically (through coordinate or otherwise). (I need to tell it which selection to crop)

I would like to know if it is possible to make a selection through scripting at all? I tried to see the Python API but I can't find any function for it.

Love,
M12.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15159
    • View Profile
Re: Python API - Make Selection for Crop?
« Reply #1 on: December 15, 2014, 11:20:47 AM »
Hello Majestic12,

If you are planning to crop polygonal model, then you need to loop through all the chunk.model.faces, perform your own fit-criterion (for example, if all vertices of the given face lay in some global polyline) and apply .selected = True to the face you wish to remove later.

But please note that in case of big face count the script will work rather slow.
Best regards,
Alexey Pasumansky,
Agisoft LLC