Forum

Author Topic: Scale Bars Between Cameras  (Read 7542 times)

jedfrechette

  • Full Member
  • ***
  • Posts: 132
  • Lidar Guys
    • View Profile
    • www.lidarguys.com
Re: Scale Bars Between Cameras
« Reply #15 on: May 24, 2018, 07:24:04 PM »
Hello Jed,

I've used the source code:
Code: [Select]
scalebar = chunk.addScalebar(chunk.cameras[0],chunk.cameras[1])
scalebar.reference.distance = 0.2
and it worked find on a random project, so it seems that there might be some issues with your script. Are you using latest PhotoScan Pro version?

I'm using Pro verion 1.4.2.

If I create a new project and add photos from the UI then run this snippet it works fine.

My production script, however, creates the project from scratch imports images, sets the cameras up etc before attempting to create scale bars. That script fails when assigning to little 'r' reference with the assertion I gave in my first post. Except for the failure to create scale bars that script is working as expected.

I'll continue debugging and see if I can come up with a minimal example that reproduces the behavior.
Jed

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14971
    • View Profile
Re: Scale Bars Between Cameras
« Reply #16 on: May 24, 2018, 07:36:51 PM »
Hello Jed,

If I run the following script on a random project it works as expected (both from Console and from external script):

Code: [Select]
chunk = PhotoScan.app.document.chunk
scalebar = chunk.addScalebar(chunk.cameras[0],chunk.cameras[1])
scalebar.reference.distance = 0.2

The error that you have mentioned may appear only if in the same PhotoScan Pro window I've used scalebar.Reference.distance assignment (also doesn't matter via external script or from the Console). It already breaks the code.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jedfrechette

  • Full Member
  • ***
  • Posts: 132
  • Lidar Guys
    • View Profile
    • www.lidarguys.com
Re: Scale Bars Between Cameras
« Reply #17 on: May 25, 2018, 12:54:54 AM »
Interesting, I just tried running the script that yesterday was throwing an exception when assigning to little 'r' reference in a newly opened PhotoScan instance and it worked perfectly.

The script and data set had not changed at all. The only thing that changed was that my dev machine had been rebooted and the PhotoScan instance was newly launched. The PhotoScan instance I was testing in yesterday was 'dirty' in the sense that it had been used to test several other things by running scripts and executing commands at the console. Each time I ran the test script though I was creating a new project from the File menu to run it in. So, as James observed, some intermittent interaction seems to have been happening. I'll keep an eye on it and see if I can reproduce inorder to narrow down the cause further.

As an aside, just going by this discussion, it seems like having both Scalebar.reference and Scalebar.Reference is a bit dangerous.
Jed