Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

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

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

New Project

Add a new C++

...

Empty project

...

         Image Removed

...

using Visual Studio 2017 as SampleCommand in ‘\ARES Commander

...

20XX SDK\Samples\

...

CFx’.

          Image Removed Image Added

Header Section

...

Create the following header files

...

.       

...

  

          Image Removed

...

SampleCommand.h

Creates the SampleCommand class with global and local command

...

    Image Removed

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

    Image Removed

3. SampleCommandTracker.h - Create a SampleCommandTracker class

    Image Removed

...

name.  

Code Block
#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);
};

SampleCommandModule.h

Creates a new module for the SampleCommand class with initApp, uninitApp, and object that represents the command.

Code Block
#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;
};

stdafx.h

Includes all the standard system include files/project specific include files that are frequently used

...

    Image Removed

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

          Image Removed

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

   Image Removed

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

    Image Removed

3. SampleCommandTracker.cpp 

    Image Removed

4. stdafx.cpp -  source file that includes just the standard includes

Image Removed

...

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

Source File Section

Create the following CPP files.

SampleCommand.cpp

CPP file for creating commands that you can call from ARES commander.

Code Block
#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");
}

SampleCommandModule.cpp

Defines entry points for the dynamic library (TX = DLL).    

Code Block
#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");
}

stdafx.cpp

Source file that includes just the standard include files.

Code Block
#include "stdafx.h"

Project Settings

Do the following settings to make the C++ sample plugin to work

...

.

  1. Open SampleCommand

...

  1. Property Page and do the following settings:

    1. In Configuration: Release

    2. In Platform: Choose the appropriate platform (in this example, it is x64).

Image Removed

  1. Specify Additional Include and Library Directories

...

  1. : Include libraries and include files from ARES Commander SDK folder

...

          Image Removed

          Image Removed

...

  1. .
    Include files can be found in C:\Program Files\Graebert GmbH\ARES Commander 20XX SDK\Include\*.
    Image Added Image Added

  2. Specify Additional Dependencies: Link appropriate libraries that implement ARES Commander plugin API.

...

  1. Libraries can be found in \Program Files\Graebert GmbH\ARES Commander

...

  1. 20XX SDK\Libraries\

...

  1. *.
    Image Modified

  2. Change extension of output and other properties as

...

  1. in the image below

...

  1. :
    The name of the shared library containing the subclass of OdRxModule

...

  1. should be

...

  1. according to the rule: <application name>.tx.

...

  1. Image Added

  2. Define _TOOLKIT_IN_DLL macro:

          Image Removed

...

  1. Image Added

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

  3. Navigate to the C:\Program Files\Graebert GmbH\ARES Commander

...

  1. 20XX\BIN and find the files named TD_Db_*.dll

...

  1. :
    In our example,

...

  1. the file name is

...

  1. TD_Db_4.03_

...

  1. 15.dll.

...

  1. Add the

...

  1. _4.03_

...

  1. 15 suffix to your output .dll name to

...

  1. load it

...

  1. normally.

...


  1. Image Added

Building  

Build the SampleCommand project

...

, then Open ARES Commander and use

...

the APPLOAD

...

 command to load your application:

In our example, we have SampleCommand_4.03_

...

15.tx as result.

         Image Modified

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

...