Forum

Author Topic: Print Rotation angles of Viewpoint  (Read 3231 times)

Paulo

  • Hero Member
  • *****
  • Posts: 1529
    • View Profile
Print Rotation angles of Viewpoint
« on: March 02, 2020, 06:59:47 PM »
Hi all,

I have a script in version 1.5 that prints out the rotation angles of model viewpoint for this I used following code:

Code: [Select]
    chunk = doc.chunk
    T = chunk.transform.matrix
    vp = PhotoScan.app.viewpoint
    R = vp.rot
    m = chunk.crs.localframe(vp.center).rotation()
    X, Y, Z = chunk.crs.project(vp.center)


    opk =  PhotoScan.utils.mat2opk(m*R)
    ypr =  PhotoScan.utils.mat2ypr(m*R)

Since in 1.6.2 viewpoint has changed I modified script as follows:
   
   
Code: [Select]
    chunk = doc.chunk
    T = chunk.transform.matrix
    vp = PhotoScan.app.ModelView.viewpoint
    R = vp.rot
    m = chunk.crs.localframe(vp.center).rotation()
    X, Y, Z = chunk.crs.project(vp.center)


    opk =  PhotoScan.utils.mat2opk(m*R)
    ypr =  PhotoScan.utils.mat2ypr(m*R)

But now I get following error when running script:
 Error: 'getset_descriptor' object has no attribute 'rot'

Any help will be appreciated...

Found solution, correct line of code is

vp = PhotoScan.app.model_view.viewpoint 

instead of
vp = PhotoScan.app.ModelView.viewpoint
 
« Last Edit: March 02, 2020, 07:20:45 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor