Use the Autodesk template or the Cocoa template to build your first ObjectARX application.
Before you start building your ARX application, consider these essential requirements:
- DBX module should be .framework type and have the .dbx file extension.
- ARX module should be .bundle/.framework type and have the .bundle file extension.
- ARX module works on 64-bit only.
You would require the following in your development environment:
- AutoCAD for Mac: link symbols, debug and test your application
- ObjectARX SDK: header files, configurations, samples, and templates
After installing the ObjectARX SDK, open the arxsdk/inc/prj_env.xcconfig file and check the paths of for the ObjectARX SDK and AutoCAD.
Creating "Hello World" From a Cocoa Bundle Project
- Start Xcode, create a Cocoa bundle project.
- Do the following setup configurations:
- Open the configuration, clean up the these items:
- ARCHS
- SDKROOT
- ONLY_ACTIVE_ARCH
- Create a debug
xconfig file.
#include sdk/inc/prj_arx.xcconfig and prj_debug.xcconfig;
- Set the correct values for
GCC_PREPROCESSOR_DEFINITIONS and
OTHER_LDFLAGS.
Add it to the project and set it as the debug configuration.
- Create a release
xcconfig file.
#include sdk/inc/prj_arx.xcconfig and prj_release.xcconfig;
- Set the correct values for
GCC_PREPROCESSOR_DEFINITIONS and
OTHER_LDFLAGS.
Add it to the project and set it as the release configuration.
- Open the configuration, clean up the these items:
- Add the C++ source file. Follow these steps:
- Include these headers:winstubs.h,aced.h, and rxregsvc.h.
- Implement your command as shown:
void mycmd() { acutPrintf(L"Hello world."); }
- Create the entry point and register your commands, as shown:
#define COMMAND_GROUPNAME L"MYARX_COMMANDS" #define COMMAND_NAME L"mycmd" // All ARX apps must define this entry point extern "C" AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt) { switch (msg) { case AcRx::kInitAppMsg: acrxDynamicLinker->unlockApplication(pkt); acrxRegisterAppMDIAware(pkt); acedRegCmds->addCommand(COMMAND_GROUPNAME, COMMAND_NAME, COMMAND_NAME, ACRX_CMD_TRANSPARENT, &mycmd); break; case AcRx::kUnloadAppMsg: acedRegCmds->removeGroup(COMMAND_GROUPNAME); break; default: break; } return AcRx::kRetOK; }
- Build the project.
- Start AutoCAD and enter APPLOAD at the Command prompt. Browse to the ARX bundle and load it.
- At the Command prompt, enter mycmd and press Enter. The text "hello world" is displayed in the Command Line window.
Creating "Hello World" From a Cocoa Template
- Start Xcode, create a new "Arx with Cocoa" project using the Autodesk template.
- Build the project.
- Start AutoCAD and enter APPLOAD at the Command prompt. Browse to the ARX bundle and load it.
- At the Command prompt, enter mycmd and press Enter. The text "hello world" is displayed in the Command Line window.