C ++ and ObjectARX
//-----------------------------------------
// Development Environment
// Vs2008 + ObjectArx2010 + AutoCAD2010
// Create a win32 project or an mfc dll project in vs2008
// Vs2008 set project properties-> Configure properties-> C/C ++-> General-> additional inclusion directory = E: \ AutoCad Development \ ObjectARX2010 \ inc
// Vs2008 set project properties-> Configure properties-> connector-> General-> output file =$ (OutDir) \ $ (ProjectName). arx
// Vs2008 set project properties-> Configure properties-> connector-> General-> additional library directory = "E: \ AutoCad Development \ ObjectARX2010 \ lib-win32"
// Vs2008 set project properties-> Configure properties-> connector-> input-> additional dependency = rxapi. lib acdb18.lib acge18.lib acad. lib acedapi. lib
//-----------------------------------------
// MyArxFirst. def File Content
LIBRARY "MyArxFirst"
EXPORTS
AcrxEntryPoint PRIVATE
AcrxGetApiVersion PRIVATE
//-----------------------------------------
// MyArxFirst. cpp: defines the export function of the DLL application.
//
# Include "stdafx. h"
# Include <aced. h>
# Include <rxregsvc. h>
// Define two functions
Void initApp ();
Void unloadApp ();
// Print "Hello world! "On AutoCAD Command
Void helloWorld ();
Void initApp ()
{
// Register a command with the AutoCAD command mechanic
AcedRegCmds-> addCommand (ACRX_T ("HELLOWORLD_COMMANDS "),
ACRX_T ("Hello "),
ACRX_T ("Bonjour "),
Acrx_pai_transparent,
HelloWorld );
}
Void unloadApp ()
{
AcedRegCmds-> removeGroup (ACRX_T ("HELLOWORLD_COMMANDS "));
}
Void helloWorld ()
{
AcutPrintf (ACRX_T ("\ nHello World! "));
}
Extern "C"
AcRx: AppRetCode
AcrxEntryPoint (AcRx: AppMsgCode msg, void * pkt)
// Void acrxEntryPoint (void * pkt)
{
Switch (msg)
{
Case AcRx: kInitAppMsg:
AcrxDynamicLinker-> unlockApplication (pkt );
AcrxRegisterAppMDIAware (pkt );
InitApp ();
Break;
Case AcRx: kUnloadAppMsg:
UnloadApp ();
Break;
Default:
Break;
}
Return AcRx: kRetOK;
}
Extern "C"
Void acrxGetApiVersion (void )//??
{
}
// ObjectARX offers the following input functions. Refer to the ObjectARX Online Help for a complete description of how to use these functions.
// AcedGetInt used to get an integer value
// AcedGetReal used to get a real value
// AcedGetString used to get a string
// AcedGetAngle used to get a angle value
// AcedGetKword used to get a key word
// AcedInitGet used to initialize acedGetXXXX functions
// AcedGetFileD used to retrieve file selection from a file dialog
// AcedGetPoint used to pick a point
// AcedGetDist used to get the distance between two points
// AcedGetCorner see Online Help for a complete description
//
// ObjectARX offers the following funwing for selection of AutoCAD entities. (Again refer to the ObjectARX Online Help for a complete description of how to use these functions ).
//
// AcedEntSel used to select a single entity
// AcedNEntSel used to select a single, nested entity
// AcedNEntSelP used to select a single, nested entity
// AcutSSGet used to select multiple entities
// --- The end ----
From the hsg77 Column