Error-handling Commands

With the following commands and settings you can handle potential errors occurring during the application command-line processing.

Command Name Required Parameter Optional Parameter Description
silent crashReportPath Suppress warning dialogs and crash reports uploads. The application will store reports to the specified location instead of showing the upload wizard.
set "key=value" Set an application state variable.
preset "key=value" Change an application setting during the setup phase. Ideal for changes that require a reset of the application. Learn more about how to use this command here.
reset ui | cfg | cfgui | all Reset the user interface, settings, or both. It is also possible to make RealityCapture like a clean install. This command works only when used in a batch file, and it won't work with delegation commands. What is going to be reset is determined by the chosen parameter: ui - reset user interface, cfg - reset application settings, cfgui - reset both interface and settings, all - make it like a clean install.
writeProgress fileName timeout Write a progress change into a specified file (fileName including the path) during a defined period of time (timeout in seconds). The file structure in the examples below.
printProgress timeout Print a progress change into the Windows Command Prompt for any new change. Optional timeout parameter will also output during a defined period of time (timeout in seconds).
tag Writes out a tag into the Windows Command Prompt. It respects the order of the used commands. That means that it will be shown only after the process that was run with the command used before is finished.
stdConsole Enables console redirection to the application standard output. When used, you will see the application console content mirrored also in the standard Windows console. This also enables further redirections for CLI purposes.

Setting Name Key Value Default value
Quit on error appQuitOnError bool false
Quit on required restart appQuitOnReset bool false
Suppress error messages suppressErrors bool false
Minimal process duration appProcessActionTime int 15
Action appProcessAction None None
PlaySound
ExecuteProgram
Command-line process*
*relevant for: "appProcessAction=ExecuteProgram"
appProcessExecCmd string

Examples and More Info

Silent Crash Report

RealityCapture.exe -silent c:\\CrashReportFolder ^
-set "appQuitOnError=true" ^
-set "appProcessActionTime=0" ^
-set "appProcessAction=ExecuteProgram" ^
-set "appProcessExecCmd=c:\\MyScripts\\ErrorWriter.bat $(processResult) $(processId) $(processDuration:d) c:\\ErrorReportFolder\\ErrorReport.txt"

The -silent command with the parameter c:\\CrashReportFolder redirects crash reporting minidumps to the target folder CrashReportFolder.

Setting appQuitOnError to True causes the application to quit if any error occurs.

appProcessActionTime set to 0 means that we are interested in all processes whose duration is at least 0 seconds - so we are actually interested in every single process.
Setting appProcessAction to 2 stands for setting it to Execute a program.
appProcessExecCmd is set to a specific command (batch script) ErrorWriter.bat with its full path c:\\MyScripts\\ErrorWriter.bat and necessary input parameters $(processResult) $(processId) $(processDuration:d) c:\\ErrorReportFolder\\ErrorReport.txt.
These three settings can be interpreted together in such a way that if process duration has taken more than the minimum specified time (0 seconds), then the application executes the program ErrorWriter.bat.

You can use values from the application as input parameters for the executed program, e.g.:
processResult - a number which represents a result of the process (the process has finished correctly if its processResult is 0),
processId - an ID of the process,
processDuration:d - a number which says how long it has taken to finish the process.
You can also use your own input parameters (e.g. c:\\ErrorReportFolder\\ErrorReport.txt) to send some necessary data into the script, like a name and full path to a text file where a report of discovered errors is written.

Here is a simple example of a short batch script ErrorWriter.bat:

if /i "%1" NEQ "0" ( 
                if /i "%1" NEQ "1" ( 
                    echo An error occured by process %2 which finished with result code %1 in %3 seconds. > %4 
                ) 
)

where %1, %2, %3, %4 are input parameters $(processResult), $(processId), $(processDuration:d), c:\\ErrorReportFolder\\ErrorReport.txt. This script checks the value of the input parameter processResult. If the value is not 0, the process has finished with an error and the script writes a short report to the output ErrorReport text file:

An error occurred by process 20599 which finished with result code 2181038335 in 0 seconds.

Exit code

In case RealityCapture process finished successfully, the application returns exit code equal to 0 (you can see the result in Windows command prompt).

If the RealityCapture process finishes with error, the application returns decimal code of that specific error (in case of using a command -set "appQuitOnError=true").

If the RealityCapture process crashes with minidump, the application returns exit code equal to 3.

Example of the code:

RealityCapture.exe -silent c:\\CrashReportFolder ^
-set "appQuitOnError=true"

echo RealityCapture.exe returned with %errorlevel%.

Example of the result in case of red error:

commandline_5_red_error

Example of the result in case of crash with minidump:

commandline_5_crash

Quit on Restart

There are some application settings that require application restart after changing them. In such cases, you can use the -set command with the key appQuitOnReset set to True to suppress the dialog. Please note that the application quits after using this key and changing the respective setting. Below you can find an example on how to change the cache directory to a custom location, and then open a new scene:

RealityCapture.exe -set "appQuitOnReset=true" ^
-set "appCacheLocation=Custom"
RealityCapture.exe -set "appQuitOnReset=true" ^
-set "appCacheCustomLocation=D:\cr-tmp"
RealityCapture.exe -newScene

Progress Monitoring

With the -writeProgress command, you are able to write a progress information into a specified file (fileName) during a defined period of time (timeout). The created file consists of these 5 columns:

algId – process ID,
progress – number from this interval <0,1> indicating a stage of a process,
duration – elapsed time in seconds,
estimation – estimated remaining time in seconds,
eventType – {started, progress, timeout, completed}, an event that produced a specific record.

20561 0.00 0.04 404.08 #started
20561 0.45 0.10 0.22 #progress
20561 0.85 14.76 3.26 #progress
20561 0.90 15.04 1.70 #progress
20561 0.91 16.18 1.76 #progress
20561 0.94 16.72 1.82 #progress
20561 0.96 16.78 1.42 #progress
20561 0.97 17.06 0.55 #progress
20561 1.00 17.10 0.10 #progress
20561 1.00 17.13 0.00 #completed

Project and Image Commands

Manage the current project, the application itself and add images via CLI

Commands Outside Command Prompt

Using CLI with an .rccmd file

Delegation of Commands

On delegating commands into an opened instance of RealityCapture

Alignment Commands

Commands for alignment and component handling

Reconstruction Commands

Model calculation via the command line

Model Tools' Commands

Further model processing via the command line

Settings' Commands

Application settings and behaviour

See also: