Forum

Author Topic: Automating some steps  (Read 10069 times)

maddin

  • Full Member
  • ***
  • Posts: 161
    • View Profile
Automating some steps
« on: February 01, 2017, 10:08:50 PM »
What's the recommended way to automate certain processing steps in PhotoScan Pro?

I would like to always to these steps:
1.) Import mesh from a file
2.) Build Texture
3.) Export texture

I can probably find all the required Python code for this, but wow would I easily access that code within the UI?
Can I, for example, create a new button that runs the code? Or how would I best do this many times over and over again?

In addition to this: Is there a way to "remote control" PhotoScan Pro from outside, e.g. through OLE calls or similar things? Such that I can trigger the above steps from another software?

Thanks!
« Last Edit: February 02, 2017, 03:28:09 PM by maddin »

mwittnebel

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: Automating some steps
« Reply #1 on: February 02, 2017, 03:35:45 PM »
  • You could add a button with the api
  • a button could trigger a function
  • you can import all required libaries to automate you script

Remote Control: i would propose Teamviewer

maddin

  • Full Member
  • ***
  • Posts: 161
    • View Profile
Re: Automating some steps
« Reply #2 on: February 02, 2017, 04:06:59 PM »
  • You could add a button with the api
  • a button could trigger a function
  • you can import all required libaries to automate you script

Is there any example how to add a button?

Remote Control: i would propose Teamviewer

Remote control maybe was not the best term to use.
Let me try again: I would like to trigger a function (or maybe just a Python call) inside of PhotoScan Pro from a second software (on the same computer). This is to automate certain processing steps that I need to do over and over again (e.g. 1.) edit a 3D mesh in 3ds Max, 2.) export the mesh, 3.) import into PS, 4.) build texture, 5.) export texture -- steps 1 and 2 are in 3ds Max but 3-5 are in PS, so I am wondering whether there is some command line call, OLE function, dotNet function or similar thing to make PS do steps 3-5 without clicking on something in the PS GUI).

autohotkey or similar would be a potential solution but that is way more hacky than I would like to go if there is any built-in solution in PS for such things.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15407
    • View Profile
Re: Automating some steps
« Reply #3 on: February 02, 2017, 04:11:32 PM »
Hello maddin,

In the version 1.3 you would be able to run Python scripts from command-line without running PhotoScan Pro interface, just by passing the path to the script as a command-line argument.
Best regards,
Alexey Pasumansky,
Agisoft LLC

mwittnebel

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: Automating some steps
« Reply #4 on: February 02, 2017, 04:16:52 PM »
Button: PhotoScan.Application.addMenuItem on page 6

source: http://www.agisoft.com/pdf/photoscan_python_api_1_2_5.pdf

maddin

  • Full Member
  • ***
  • Posts: 161
    • View Profile
Re: Automating some steps
« Reply #5 on: February 02, 2017, 04:19:11 PM »
Hello maddin,

In the version 1.3 you would be able to run Python scripts from command-line without running PhotoScan Pro interface, just by passing the path to the script as a command-line argument.

Right. That would mean to start PS and load the corresponding scene each time, which would probably be very slow.
Is there some way to "connect" to an already open PS session and have it do some calculations?

maddin

  • Full Member
  • ***
  • Posts: 161
    • View Profile
Re: Automating some steps
« Reply #6 on: February 02, 2017, 04:20:21 PM »
Button: PhotoScan.Application.addMenuItem on page 6

source: http://www.agisoft.com/pdf/photoscan_python_api_1_2_5.pdf

Great, thank you. Initially, you said 'button' but the command is for adding a menu item?

mwittnebel

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: Automating some steps
« Reply #7 on: February 02, 2017, 04:47:25 PM »
@maddin sorry for me is it a button in the top bar ;)

maddin

  • Full Member
  • ***
  • Posts: 161
    • View Profile
Re: Automating some steps
« Reply #8 on: February 02, 2017, 05:24:17 PM »
@maddin sorry for me is it a button in the top bar ;)

Certainly better than manually navigating to the right .py file each time.
Thanks!