Hide menu
Loading...
Searching...
No Matches
Licensing and Activation

Introduction

Before Manufacturing Toolkit APIs can be used, a license activation is necessary. The MTK has one mechanisms for license activation.

Source file license key

This mechanism is the default and is used for the majority of the licensing models. In this case you are provided with a license key in the form of a source file (*.cxx for C++, *.cs for C#, *.java for Java and *.py for Python). This source file contains a function that returns a string value with the license key inside. To activate the license, include the source file in your project. For compiled languages that means that the license key is compiled into your application. For non-compiled languages the key should be accessible to the interpreter during the run time.

Usage

After the license key is included into the project, the activation function should be called. Here is how that looks:

  • ะก++
    #include <cadex/LicenseManager_Activate.h>
    #include "mtk_license.cxx"
    using namespace cadex;
    ...
    // Activate the license (aKey must be defined in mtk_license.cxx)
    auto aKey = MTKLicenseKey::Value();
    if (!CADExLicense_Activate (aKey)) {
    std::cerr << "Failed to activate CAD Exchanger license." << std::endl;
    exit (1);
    }
    Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
    Definition LicenseManager_LicenseError.hxx:30
  • Python
    import manufacturingtoolkit.CadExMTK as mtk
    import mtk_license as license
    ...
    # Activate the license (aKey must be defined in mtk_license.py)
    aKey = license.Value()
    if not mtk.LicenseManager.Activate(aKey):
    print("Failed to activate Manufacturing Toolkit license.")
    return 1
  • C#
    using cadex;
    ...
    // Activate the license (the key should be defined in mtk_license.cs)
    string aKey = MTKLicenseKey.Value();
    if (!LicenseManager.Activate(aKey))
    {
    Console.WriteLine("Failed to activate CAD Exchanger license.");
    return 1;
    }
  • Java
    import cadex.*;
    ...
    // Activate the license (the key must be defined in MTKLicenseKey.java)
    String aKey = MTKLicenseKey.Value();
    if (!LicenseManager.Activate(aKey)) {
    System.out.println("Failed to activate Manufacturing Toolkit license.");
    System.exit(1);
    }

When license is not activated

If an API from MTK is used and no license has been activated, then MTK will throw an exception LicenseManager_LicenseError. You can catch exceptions of this type specifically to distinguish them from any other exceptions:

#include <cadex/LicenseManager_LicenseError.hxx>
try {
// using API to read a STP model
aReader.Read ("cylinder.stp", aModel);
cerr << "Could not acquire valid MTK license" << endl;
} catch (...) {
cerr << "Unprocessed exception caught" << endl;
}
Defines an exception thrown by a license manager when a valid license could not be acquired.
Definition LicenseManager_LicenseError.hxx:36
Provides MTK data model.
Definition Model.hxx:40
Reads STEP and native format.
Definition ModelReader.hxx:33
bool Read(const UTF16String &theFilePath, ModelData::Model &theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cxx:276

See also: