How to add your knowledge

Required Development Tools

    Table of contents
    No headers

    ObjectARX Mac Development Demo (Video)

    Simple Cocoa Example with ObjectARX (Video)

    BEGIN
    <<
    Before get started, there are some points we should know:
    - DBX module should be .dylib type;
    - ARX module should be .bundle/.framework type, while extension name should be ".bundle";
    - ARX module only works on 64bit;
    ***** Steps to create a Hello World ARX from Autodesk template *****

    1. Start XCode, create a new "Arx with Cocoa" project in Autodesk template.
    2. Build project.
    3. Start AutoCAD, "Appload", find the ARX bundle and load.
    4. Input command: "mycmd", check the commandline tell you "hello world".

    ***** Steps to create a Hello World ARX from Cocoa template *****

    1. Start XCode, create a Cocoa bundle project.
    2. Setup configurations:
      1. Open configuration, clean up the following items: ARCHS, SDKROOT, ONLY_ACTIVE_ARCH;
      2. Create a debug xcconfig file;
        #include sdk/inc/prj_arx.xcconfig and prj_debug.xcconfig;
        Set correct GCC_PREPROCESSOR_DEFINITIONS and OTHER_LDFLAGS;
        Add it to project and set it as the debug configuration;
      3. Create a release xcconfig file;
        #include sdk/inc/prj_arx.xcconfig and prj_release.xcconfig;
        Set correct GCC_PREPROCESSOR_DEFINITIONS and OTHER_LDFLAGS;
        Add it to project and set it as the release configuration;
    3. Add c++ file
      1. Include the winstubs.h, aced.h, and rxregsvc.h headers.
      2. Implement your command:

        void mycmd()
        {
            acutPrintf(L"Hello world.");
        }

      3. Create the entrypoint, and register command:

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

    4. Build project.
    5. Start AutoCAD, input command: "arx", select "Load", find the ARX bundle and load.
    6. Input command: "mycmd", check the command line tell you "hello world"

    >>
    END

    Discussion of programming model differences here:

    LP64
    wchar_t
    Use the Adesk types.