• CAMAPI
  • API Documentation
Show / Hide Table of Contents
  • Supported programming languages
    • C#
    • Delphi
    • C++
  • Tutorial lessons
    • Lesson 1 - general introduction to the extension ideology using the example of a C# project
    • Lesson 2 - connecting the SDK to a Delphi project using the build system
    • Lesson 3 - connecting the SDK to a C++ project using the build system
    • Lesson 4 - demonstration of methods for unloading an extension during main application is running
    • Lesson 5 - Creating a custom operation
    • Lesson 6 - Creating a C# application to interact with geometry in main application
    • Lesson 7 - Creating a C# application to connect to main application for managing it
  • System extensions
    • Extension.Util.Common.Dll
    • Extension.Util.Common.Exe
  • Debugging of extensions
    • Debugging a .NET extension using Visual Studio Code
    • Debugging a Delphi extension using RAD Studio
    • Debugging a C++ extension using Visual Studio
  • Entry points
    • Utilitiy in main form
    • Executor for utility in main form
    • New item to the operation's context menu
  • Machining Tools Import
    • Preparing the environment
    • Working with the tool library
    • Working with cutting tools
      • Milling Tools
      • Turning Tools
      • Custom Axial Shaped Tools
    • Working with the tool holder
  • API Documentation
  • External applications
    • Connecting in a C# application
    • Connecting in a Delphi application
    • Connecting in a C++ application

C++ support in CAMAPI

Support export function

You native DLL should have export function, which will be entry point:

extern "C" __declspec(dllexport) void* __stdcall CreateInstanceOfExtension(const wchar_t* PluginID) {
  // create instance of your class
  IExtensionPtr resultPtr = new ExtensionUtilityExample();

  // modify as pointer
  resultPtr.AddRef();
  void* res = resultPtr.GetInterfacePtr();
  return (res);
}

Its logic can be more complex, but it is important that the result of the function is a pointer with an incremented reference count.

Connecting the SDK

The SDK is stored as package SprutTechnology.CAMAPI.SDK.tlb on nuget.org. In the BuildSystem, you can configure it to download and extract this package to a specific directory before compilation. Then, this directory needs to be connected in the Delphi project settings.

In build.cs:

  • Add in list of ManagerProps:
new RestorerNugetProps
{
    Name = "RestorerNuget",
    DepsProp = new List<RestorerDepProp>
    {
        new()
        {
            PackageId = "SprutTechnology.CAMAPI.SDK.tlb",
            Version = "18.2.0", 
            OutDir = Path.Combine(RootDirectory.Parent, "SDK")
        }
    }
}
  • Specify accordance:
settings.ManagerNames.Add("restorer", "Debug", "RestorerNuget");
settings.ManagerNames.Add("restorer", "Release", "RestorerNuget");
  • Add restore before compile in target:
private Target Compile => _ => _
    .Executes(() =>
    {
        _buildSpace.Projects.Restore(Variant);
        _buildSpace.Projects.Compile(Variant, true);
    });

In this way, any other package can be connected - similar to PackageReference in C# projects.

In this article
Back to top Generated by DocFX