RealityScan allows you to execute commands without directly using the command line. You can simply drag and drop a text file containing a sequence of supported commands—saved with the .rscmd extension—into the application.
Example Explained
The following example shows a command sequence that loads images from C:\MyFolder\Images\, aligns them, creates a normal-detail model, and saves the project to C:\MyFolder\MyProject.rsproj:
-addFolder C:\MyFolder\Images\ -align -setReconstructionRegionAuto -calculateNormalModel -save C:\MyFolder\MyProject.rsprojYou can also place each command on a new line for better readability:
-addFolder C:\MyFolder\Images\
-align
-setReconstructionRegionAuto
-calculateNormalModel
-save C:\MyFolder\MyProject.rsprojOr break lines using the ^ character (with or without a space before it):
-addFolder C:\MyFolder\Images\^
-align^
-setReconstructionRegionAuto^
-calculateNormalModel^
-save C:\MyFolder\MyProject.rsprojIn batch scripting, use the ^ symbol to continue a command sequence on the next line so that it is processed as a single command.
Lines starting with #, //, REM, or rem are treated as comments and ignored. For example: // I am a comment
Executing Commands Listed in a .rscmd File
You can execute all commands listed in a .rscmd file using the -execrscmd command. The required parameter is the full path to the .rscmd file.
This command can be used:
In the Windows Command Prompt
In a .bat script
Inside another .rscmd file
Passing Arguments into a .rscmd File
When using -execRSCMD, you can pass up to 10 arguments in addition to the required file path. To reference these arguments inside the .rscmd file, use $(arg0) through $(arg9).
Example:
Run sample.bat to open RealityScan and call addFolder.rscmd, which adds images from D:\MyFolder\Images to the project.
"C:\Program Files\Epic Games\RealityScan\RealityScan.exe" -execRSCMD D:\MyFolder\addFolder.rscmd "D:\MyFolder\Images"
-addFolder $(arg1)Using RealityScan Functions and Variables
You can use predefined RealityScan functions and variables within commands or .rscmd files. These functions and variables are also available in the Reports – Basic Functions section.
The example below demonstrates a loop that creates three projects in sequence by loading, aligning, and saving data from separate folders:
$For( "i", 1, 1, 3,
-newScene
-addFolder D:\MyFolder\$(i)
-align
-setReconstructionRegionAuto
-calculatePreviewModel
-save D:\MyFolder\project_$(i).rsproj
)The variable i iterates over the right-open interval [1, 3) with a step of 1.
Global Variables
You can also use these global variables inside your .rscmd scripts:
$(appRootDir) – Path to the RealityScan installation folder (commonly C:\Program Files\Epic Games\RealityScan).
$(appStartDir) – Path to the folder from which RealityScan.exe was launched (for example, the path to a .bat file that started it).
$(cmdStartDir) – Path to the folder containing the executed .rscmd file.
$(arg1) … $(arg9) – Variables passed to the - execRSCMD command.
Always enclose these variables in quotes when using them as arguments. If a path contains spaces, it may otherwise be treated as multiple parameters (example: -addFolder $(cmdStartDir)).