Please enable JavaScript to view this site.

TerraPhoto User Guide

Navigation: Programming Interface

Scripting interface

Scroll Prev Top Next More

Scripting interface

TerraPhoto implements a scripting interface which you can use to send key-in commands to the CAD system. Any programming method provided by the CAD system is applicable, such as MDL, Bentley CAD Visual Basic or simply function key definition. In your own code, you may launch any action available in TerraPhoto as toolbox icon, pulldown menu command or dialog push button, and set values of any dialog variable. Actions and dialog variables are only available when the corresponding dialog is created. This ensures that the application state is ready for the action or for setting a variable.

Scripting key-in commands

TerraScan, TerraPhoto, TerraMatch and TerraModeler implement the same scripting interface and thus, work with the same key-in command logic. The key-in commands below show the syntax for TerraPhoto commands while examples are given from TerraScan. The syntax for the other applications follow logical rules:

Application

Set logging

launch action

set variable

TerraScan

scan log

scan action

scan set

TerraPhoto

photo log

photo action

photo set

TerraMatch

match log

match action

match set

TerraModeler

model log

model action

model set

Photo Log Dialogs logfile

Photo Log Dialogs logfile starts to write actions and dialog variables to a text file at a given location on the hard disc. E.g., "scan log dialogs d:\logs\dialogs.txt" writes the logfile "dialogs.txt" in directory d:\logs\ on the hard disc. If the file does not exist, it is created when the first action to log is performed.

The command is most useful to find out action, dialog and variable names. Start the logfile creation by using the key-in command in the Key-in lineBentley CAD or Spaccels windowSpatix. Call the tool or command in the software and define settings in the dialog. Close the dialog with OK or Cancel. The application writes the dialog name, variable names and setting values into the logfile.

Use the key-in command without the logfile variable in order to stop writing actions to the logfile.

Photo Action action

Photo action action starts the given action. E.g. "scan action trajectviewfields" launches the command View fields in the Trajectory window which means it opens the View Trajectory Fields dialog. Actions are linked to dialog push buttons or dialog pulldown menus in the software. An action can be started only when the dialog is open.

Photo Action HideDialog

Photo action hidedialog instructs the software to keep the next modal dialog hidden and close it with OK.

Photo Set variable = value

Photo set variable = value assigns the given value to the given variable. E.g. "scan set VtfNumber=1" sets the Number attribute to be visible in the View Trajectory Fields dialog. If there is no matching variable in an open dialog, the application stores the variable-value-assignment in a buffer. When the next dialog is created, it will apply the assignment and clear the buffer.

Photo Close Dialog dialog

Photo close dialog dialog closes a modeless dialog with the given name. E.g. "scan close dialog ManageTrajectories" closes the Trajectories window.

Scripting examples (Bentley CAD VBA)

TerraPhoto setup provides an example script that includes Bentley CAD VBA modules. The script is stored in the \example folder of the Terra installation directory, e.g. c:/terra64/example/scripting_example.mvba. The example script can be loaded in the VBA Manager of Bentley CAD and used, for example, as starting point for own scripts.

TerraPhoto User Guide   01.01.2024   © 2024 Terrasolid Ltd