Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

ARES commander provides C++ plugin which lets you author third party Plugin Software for ARES Commander.


The CFx examples can be found in the folder \ARES Commander 20** SDK\Samples\CFx\. Open the solution file CFxSamples.sln and

follow the steps “How to Create a Sample C++ plugin and build,load the plugin ”.


  • Add a new C++ project(Empty project) using visual studio 2015 

         


as SampleCommand in ‘\ARES Commander 20** SDK\Samples\CFx’ 


  • Header Section: Create the following header files:                

                        1. SampleCommand.h - Create SampleCommand class with global and local command names 

                             

              #include "FxCommand.h"
#include "FxCommandContext.h"
#include "FxUserIO.h"

class SampleCommand
{
public:
/** Description:
Sets non-localized version of the command name.
*/
virtual const OdString globalName() const;
/** Description:
Sets localized version of the command name.
*/
virtual const OdString localName() const;

~SampleCommand(void);

protected:
SampleCommand(void);
};


2. SampleCommandModule.h - Create a new module for SampleCommand with InitApp, uninitapp and object to represent the command 

    
              #include <RxModule.h>
#include <StaticRxObject.h>
#include "SampleCommand.h"
/** Description:
Creates a new module for Sample command.
*/
class CHelloCommandModule : public OdRxModule
{
public:
~CHelloCommandModule() {}

protected:
CHelloCommandModule() {}

/** Description:
Adds new command to the current module.
*/
virtual void initApp();
/** Description:
Removes command from the current module.
*/
virtual void uninitApp();

private:
/** Description:
Object from type sampleCommand is created. It represents the new command.
*/
OdStaticRxObject<SampleCommand> m_SampleCommand;
};


3. stdafx.h -  File to include all the standard system include files/project specific include files that are frequently used


              #include <windows.h>
#include "OdaCommon.h"


  • Source Files : Create the following C++ files : 

          

1.SampleCommand.cpp - C++ file to create commands that can be called from ARES commander

   

              #include "stdafx.h"
#include "SampleCommand.h"
#include "FxSystemServices.h"

SampleCommand::SampleCommand(void)
{
GetFxSystemServices()->WriteLine(L"HI, This is a Sample command.");
}

SampleCommand::~SampleCommand(void)
{
}

const OdString SampleCommand::globalName() const
{
// global command name to be called
return("MYSAMPLE");
}

const OdString SampleCommand::localName() const
{
// local command name to be called
return("MYSAMPLE");
}


2. SampleCommandModule.cpp - Defines entry and end point for the DLL application

    

              #include "stdafx.h"
#include "SampleCommandModule.h"
#include <RxDynamicModule.h>
#include "FxSystemServices.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

ODRX_DEFINE_DYNAMIC_MODULE(CHelloCommandModule);

void CHelloCommandModule::initApp()
{
GetFxSystemServices()->WriteLine(L"SampleCommandModule initApp");
}

void CHelloCommandModule::uninitApp()
{
GetFxSystemServices()->WriteLine(L"SampleCommandModule uninitApp");
}


4. stdafx.cpp -  Source file that includes just the standard includes files

              #include "stdafx.h"


Now for the C++ sample plugin to work certain configurations has to be done.

  • Open SampleCommand property page and set Configuration → Release and Platform→ choose appropriate platform (in this example it is x64)
  • Additional Include and Library Directories - Need to include Libraries and Include files from ARES SDK folder.

          


          


  • Additional Dependencies: Linking appropriate libraries that implement ARES Commander plugin API. Libraries are located on your drive, 

   in \Program Files\Graebert GmbH\ARES Commander 20** SDK\Libraries\dd_lib

          


  • Change extension of output and other properties as shown in the below image

           The shared library containing the subclass of OdRxModule, should be named < application name >.tx.

           


  • Define _TOOLKIT_IN_DLL macro

          


  • Open SampleCommand property page and set C/C++ → Language → Treat WChar_t As Built in Type to No (/Zc:wchar_t-)


  • Go to C:\Program Files\Graebert GmbH\ARES Commander 20**\BIN and find the files named TD_Db_*.dll;

    In our example, it is named TD_Db_4.03_14.dll. You must add the suffix _4.03_14 to your output .dll name to make it load normally.

          


  • Build SampleCommand project and Open ARES Commander and use the APPLOAD command to load your application:

    In our example, we have SampleCommand_4.03_14.tx as result.

         


If there are no errors, a confirmation message displays as successfully loaded with the output of the project




  • No labels