Forum

Author Topic: how to set the viewpoint by python script  (Read 2263 times)

chq

  • Newbie
  • *
  • Posts: 3
    • View Profile
how to set the viewpoint by python script
« on: December 16, 2021, 06:46:47 AM »
I want to captureView  in the camera position
this is my script
Code: [Select]
import Metashape as ms
chunk = ms.app.document.chunk
camera = chunk .cameras[0]
mv = ms.app.model_view
vp = mv.viewpoint
vp.fov = 90
vp.rot = chunk.transform.matrix.rotation() * camera.transform.rotation() * ms.Matrix.Diag([1, -1, -1])
center = (chunk.transform.matrix * camera.transform).translation()
vp.coo = ?
vp.mag = ?
mv.captureView(1024, 1024, True, True).save(r'd:\t.jpg')

I want the viewpoint is the same with "look though" on the camera.
but i do not know how to set vp.coo and vp.mag  parameter.   it seems that the vp.coo is a little different with vp.center.

can anyone help me.

« Last Edit: December 16, 2021, 11:31:31 AM by chq »