Monthly Archives: May 2014

Porting an ObjectARX application to nanoCAD

In this post we describe how to migrate an existing ObjectARX application to nanoCAD.

This post is part of nanoCAD SDK Documentation that can be downloaded from the nanoCAD Developers’ Club.

To migrate an existing ObjectARX project to NRX:

  1. ObjectARX projects typically contain two project configurations: Debug and Release. Open the project in Visual Studio and create additional configurations that will be used for compiling the application  for nanoCAD. For example, Debug NCAD:
    Start_NrxG_Migr_1

  2. In the General section of the project Configuration Properties set the property Character Set to the value Use Unicode Character Set and the property Use of MFC to the value Use MFC in a Shared DLL:
    Start_NrxG_Migr_2

  3. Go the C/C++ > General section and specify nanoCAD SDK header files directories in the following order:
    [nanoCAD SDK path]\include
    [nanoCAD SDK path]\include\TD
    [nanoCAD SDK path]\include\MAPI
    [nanoCAD SDK path]\include\arxgate

    Start_NrxG_Migr_3
    Note, the directories must be added in the right order to avoid compiling errors.

  4. In the C/C++ > Code Generation section choose the Multi-threaded DLL option for the Runtime Library property.
    Start_NrxG_Migr_5

  5. In the Linker > General section add paths to the nanoCAD SDK libraries:
    [nanoCAD SDK path]\lib
    [nanoCAD SDK path]\lib\TD

    Start_NrxG_Migr_6

Now it is possible to build the project, load the generated application DLL into nanoCAD with APPLOAD command and launch the application by running one of its commands.

For a complete sample project please look at the samples\NRX\CrossCircle SDK folder. This sample contains a custom entity, its managed wrapper, and commands written with both C++ and .NET.

The nanoCAD SDK is available in the nanoCAD Developers’ Club.

Creating a new project for NRX application

In this post we describe how to create a new project for NRX (nanoCAD runtime extension) applications.  NRX is a classical C++ API, compatible with ObjectARX, that allows the user to extend nanoCAD functionality.

This post is part of nanoCAD SDK Documentation that can be downloaded from the nanoCAD Developers’ Club.

To create a new NRX project:

  1. Create a new C++ project in Microsoft Visual Studio 2008 (Win32 Project):Start_NrxG_NewPrj_1
  2. Set the project name and its location:
    Start_NrxG_NewPrj_2

  3. Choose DLL as an application type and add common header files for MFC:Start_NrxG_NewPrj_21
  4. In the General section of the project Configuration Properties set the property Character Set to the value Use Unicode Character Set and the property Use of MFC to the value Use MFC in a Shared DLL:
    Start_NrxG_NewPrj_3

  5. Go to the C/C++ > General section and specify nanoCAD SDK header file directories in the following order:
    [nanoCAD SDK path]\include
    [nanoCAD SDK path]\include\TD
    [nanoCAD SDK path]\include\MAPI
    [nanoCAD SDK path]\include\nrxgate

    Start_NrxG_NewPrj_4Note, the directories must be added in the right order to avoid compiling errors.

  6. In the C/C++ > Codegeneration section choose the Multi-threaded DLL option for the Runtime Library property.
    Start_NrxG_NewPrj_5

  7. In the Linker > General section add paths to the nanoCAD SDK libraries:
    [nanoCAD SDK path]\lib
    [nanoCAD SDK path]\lib\TD

    Start_NrxG_NewPrj_6

  8. Add the following line to include the essential NRX header files:
  9. Add the following code to define an entry point:
  10. Implement the initApp() function that register all commands for the application:
  11. Implement the uninitApp() function that unloads application commands. In practice, a whole command group is unloaded, not only a separate command: