Forum

Author Topic: Access to Document class is blocked in auto-run script  (Read 3062 times)

Vbarrete

  • Newbie
  • *
  • Posts: 1
    • View Profile
Access to Document class is blocked in auto-run script
« on: October 04, 2016, 01:30:51 PM »
Hello,
 
I’m Victor Barreteau, currently working In Robert Bosch company in Mondeville( France).
Sorry for my English.
 
Our company has bought this software in order to build a fully automated process, since we cannot use auto-run script in demo version, and since nothing say otherwise, we thought that there was no difference between an automatic script and a script started manually... But we were wrong.
 
When I run a auto-run script, I can't access “Document class”, I know this is not a bug, but a choice made by Agisoft.
Some users have already asked this, but the best answers they received is "Starting automatic processing chain by the use of auto-run script is blocked by the reason."... and this isn't a clear answer.
 
 
As we invest more than 3600€ in the pro version of the software, we would really appreciate some further help from your side to get the results we’re awaiting.
Thanks in advance.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14854
    • View Profile
Re: Access to Document class is blocked in auto-run script
« Reply #1 on: October 04, 2016, 02:54:39 PM »
Hello Vbarrete,

I think that you can use the following workaround: instead of accessing to PhotoScan.app.document you can create new document instance and work with it, like:
Code: [Select]
import PhotoScan
doc = PhotoScan.Document()
chunk = doc.addChunk()
...
...
chunk.buildDenseCloud()
...
...
doc.save("D:/project.psx")
Best regards,
Alexey Pasumansky,
Agisoft LLC

real3d

  • Newbie
  • *
  • Posts: 1
    • View Profile
Auto-start script does not work on Ubuntu?
« Reply #2 on: January 19, 2017, 01:44:47 AM »
Hi,

I put a simple python script in home/usr/.local/share/data/Agisoft/PhotoScan Pro/scripts/:

import PhotoScan
doc = PhotoScan.app.document
chunk = doc.addChunk

And then I ran ./photoscan.sh to start the software (1.2.6). However, it shows:

2017-01-18 14:41:02 Traceback (most recent call last):
2017-01-18 14:41:02   File "/home/usr/.local/share/data/Agisoft/PhotoScan Pro/scripts/test.py", line 3, in <module>
2017-01-18 14:41:02     chunk = doc.addChunk
2017-01-18 14:41:02 AttributeError: 'NoneType' object has no attribute 'addChunk'

Direct typing the three lines in the Photoscan GUI console works. I was wondering if there is a special step for setting up the python path in Ubuntu to import Photoscan (e.g. export PYTHONPATH or sys.path.insert(0,'/photoscan-pro/modules'))?

Thank you!

« Last Edit: January 19, 2017, 04:42:24 AM by real3d »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14854
    • View Profile
Re: Access to Document class is blocked in auto-run script
« Reply #3 on: January 19, 2017, 11:56:00 AM »
Hello real3d,

I've merged your thread with the similar one. Please check the solution described above.
Best regards,
Alexey Pasumansky,
Agisoft LLC