public class progress_bar {
static {
try {
System.loadLibrary("MTKCore");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: " + " <input_file>, where:");
System.out.println(" <input_file> is a name of the file to be read");
System.exit(1);
}
String aKey = MTKLicenseKey.Value();
if (!LicenseHelper.SetupRuntimeKey()) {
System.exit(1);
}
try {
LicenseManager.Activate(aKey);
} catch (LicenseError theException) {
LicenseManager.Deactivate();
System.out.println("Failed to activate Manufacturing Toolkit license: " + theException.what());
System.exit(1);
}
String aSource = args[0];
Model aModel = new Model();
ProgressBarObserver anObserver = new ProgressBarObserver();
anObserver.SetAllNotifyingThreads();
try (ProgressStatus aStatus = new ProgressStatus()) {
aStatus.Register(anObserver);
try (ProgressScope aTopScope = new ProgressScope(aStatus))
{
try (ProgressScope aReaderScope = new ProgressScope(aTopScope, 50))
{
ModelReader aReader = new ModelReader();
aReader.SetProgressStatus(aStatus);
aReader.Read(new UTF16String(aSource), aModel);
}
if (!aModel.IsEmpty() && !aStatus.WasCanceled()) {
try (ProgressScope aMesherScope = new ProgressScope(aTopScope, -1))
{
MeshGenerator aMesher = new MeshGenerator();
aMesher.SetProgressStatus(aStatus);
aMesher.Generate(aModel);
}
}
}
}
LicenseManager.Deactivate();
}
}
class ProgressBarObserver extends ProgressStatus.Observer {
@Override
public void ChangedValue(ProgressStatus theInfo) {
System.out.println(theInfo.Value());
}
@Override
public void Completed(ProgressStatus theInfo) {
System.out.println(theInfo.Value() + ": complete!");
}
}
Contains classes and functions related to model processing.
Defines classes, types, enums, and functions related to topological entities and scene graph elements...
The mtk namespace is intended to become the primary namespace for MTK and replace direct use of the c...
Definition LicenseError.hxx:27
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseError.hxx:27