Launching a TerraExplorer Executable Tool
This sample uses the IApplication80 OpenFileDialog method to open a dialog in which the user designates a specific file or directory. This path is then passed as a parameter to SLMeshConverter.exe launched using ICreator80.CreateCommandLineProcessAsync.
function Init() {
// Get input file and output folder from user
var in3DMLFile = sgworld.Application.OpenFileDialog(false, "3dml files (*.3dml)|*.3dml");
var out3DTilesFolder = sgworld.Application.OpenFileDialog(true);
// Extract the value of the "key" parameter
var in3DMLFileJsonObject = JSON.parse(in3DMLFile);
varout3DTilesFolderJsonObject = JSON.parse(out3DTilesFolder);
var in3DMLFileKey = in3DMLFileJsonObject["key"].toString();
var out3DTilesFolderKey = out3DTilesFolderJsonObject["key"].toString();
// Execute command line
var command = 'SLMeshConverter.exe -cmd convert -in "' + in3DMLFileKey + '" -out "' + out3DTilesFolderKey + '" -f b3dm';
var clpa = sgworld.Creator.CreateCommandLineProcessAsync(command);
clpa.OnExit(function(a) { alert("OnExit" + a.toString()); });
clpa.OnStderr(function (a) { alert("OnStderr" + a.toString()); });
clpa.OnStdout(function (a) { sgworld.Window.ShowMessageBarText("OnStdout" + a.toString()); });
}