C ++ and ObjectARX

Source: Internet
Author: User

 

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.