Forum

Author Topic: Re-run Script from GUI but the executable seems does not change?  (Read 4279 times)

linshuh

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re-run Script from GUI but the executable seems does not change?
« on: September 29, 2020, 08:07:21 PM »
Hi all,
I try to run the following script from GUI -> Tools -> Run Script
However, when I try to open the project, I got error message
Quote
"Can't open file: No such file or directory (2): test_screenshot_solid.psz"

Then I add the full path of the ".psz" file, still got the same error

Then I change to
Code: [Select]
change
doc.open('/Users/linshu/Documents/3d_dense_recon/test_screenshot_solid.psz')
to
chunk = doc.addChunk()
chunk.importModel('test_out/qc/20190204_MD943168_cv2.ply')
and I still get the same error saying "can't open .psz"
(script is in the same directory as .psz)
From the other post, seems like need a .files file, however, I cannot find this file.

  • Script I am running: screenshot_meta.py
Code: [Select]
import Metashape

def main():
    app = Metashape.app
    app.model_view.model_view_mode = Metashape.Application.ModelView.ModelViewSolid  #<--- change view mode. Don't want default colored model
    doc = app.document
    chunk = doc.addChunk()
    chunk.importModel('test_out/qc/20190204_MD943168_cv2.ply')
    #doc.open('/Users/linshu/Documents/test_screenshot_solid.psz')
    image = Metashape.app.model_view.captureView(width = 300, height = 150, transparent = False, hide_items = True)
    #cap =  Metashape.Image(image.width, image.height, "RGBA", "U8")
    image.save('cameratest.png')
if __name__ == "__main__":
    main()


I wonder:
(1) Is there any mistake in the code to open the project/import model?
(2) How to clear the cache (if any) after run script?

Thanks Advanced