Forum

Author Topic: Image capture model view  (Read 3753 times)

Abe Whaanga

  • Newbie
  • *
  • Posts: 15
    • View Profile
Image capture model view
« on: September 05, 2023, 02:45:58 AM »
Hello, I have an old script that works with 1.6.1 but need to update now.  What do I need to change to get the capture.modelView to work again?  I get this error Error: 'Metashape.Application' object has no attribute 'viewpoint' 
Here is my script.
Code: [Select]
def image_capture():

    ###export image capture to FSDBTesting/FaceSketches as a jpg
    import Metashape
    import shutil
    current_document = Metashape.app.document
    file_path = Path(Metashape.app.document.path)
    doc = Metashape.app.document
    chunk = doc.chunk
   
    for shape in chunk.shapes:
        if not shape.label:
            shape.label = shape.group.label
    viewpoint = Metashape.app.viewpoint
    cx = viewpoint.width
    cy = viewpoint.height
    cx = 1214
    cy = 912

    shape_name = chunk.label

    shape_name = shape_name[shape_name.find("_")+1:]

    save_shape_folder = "G:/Mining/Geology/Favona/FSDBTesting/FaceSketches"
    chunk_name = Metashape.app.getString("Enter location name?", shape_name)

    capture = Metashape.app.captureModelView( width = cx, height = cy, transparent = (False), hide_items = (False))
    #source = Metashape.DataSource.ModelData, mode = Metashape.ModelViewMode.ShadedModelView)
    print(capture.height)
    capture.save(save_shape_folder + "/" + chunk_name + ".jpg")

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15120
    • View Profile
Re: Image capture model view
« Reply #1 on: September 05, 2023, 05:51:33 PM »
Hello Abe Whaanga,

Please check, if the following changes in your script resolve the problem:
Metashape.app.captureModelView -> Metashape.app.model_view.captureView
Metashape.app.viewpoint -> Metashape.app.model_view.viewpoint

Best regards,
Alexey Pasumansky,
Agisoft LLC

Abe Whaanga

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Image capture model view
« Reply #2 on: September 06, 2023, 02:00:01 AM »
Thank you Alexy that works perfectly!