1
Python and Java API / Auto process on start
« on: February 24, 2014, 04:51:38 PM »
Hi,
I wrote script what I placed in "Agisoft\PhotoScan Pro\scripts\" for it run on start.
When I launch PhotoScan I have an error on this script but when I launch this script in consol it's run normaly.
This is because access to PhotoScan.app.document is blocked for autorun scripts...
The support suggest me to use custom menu item and bind all functionality to this custom option but I need to execute (Align / Optimization / Build mesh) automaticly when I open PhotoScan.
I wrote script what I placed in "Agisoft\PhotoScan Pro\scripts\" for it run on start.
When I launch PhotoScan I have an error on this script but when I launch this script in consol it's run normaly.
Code: [Select]
def import_photos() :
global repertoire_de_travail
global document
repertoire_photos = repertoire_de_travail+'/Photos/'
liste_photos = os.listdir(repertoire_photos)
# Creation du chunk
my_chunk = PhotoScan.Chunk()
my_chunk.label = "Guigui_Chunk"
for nom_photo in liste_photos :
if my_chunk.cameras.add(repertoire_photos + nom_photo) :
my_chunk.cameras.remove((len(my_chunk.cameras)) - 1)
print(nom_photo, " - imported")
else :
print(nom_photo, " - erreur")
PhotoScan.app.update()
# Creation du document et ajout du chunk
document = PhotoScan.app.document
my_chunk.enabled = True
document.chunks.add(my_chunk) # ERROR ON THIS LINE
return
This is because access to PhotoScan.app.document is blocked for autorun scripts...
The support suggest me to use custom menu item and bind all functionality to this custom option but I need to execute (Align / Optimization / Build mesh) automaticly when I open PhotoScan.