ObjectARX, AutoCAD. Среда программирования библиотеки C++



              

Пример заказного режима объектной привязки - часть 4


/* ================ ObjectARX application interface ============ */

AcRx::AppRetCode

acrxEntryPoint(AcRx::AppMsgCode msg, void*)

{

switch(msg) {

case AcRx::kInitAppMsg:

// Register the class.

//

AcmeSocketInfo::rxInit();

acrxBuildClassHierarchy();

pDefaultSocketInfo = new AcmeSocketInfo;

AcDbEntity::desc()->addX(AcmeSocketInfo::desc(),

pDefaultSocketInfo);

pSocketForLine = new AcmeSocketForLine;

AcDbLine::desc()->addX(AcmeSocketInfo::desc(), pSocketForLine);

//-- };

// Create the glyph object to be returned by the socket

// mode object.

//

pSocketGlyph = new AcmeSocketGlyph;

// Create and register the custom Osnap Mode

pSocketMode = new AcmeSocketMode;

acdbCustomOsnapManager->addCustomOsnapMode(pSocketMode);

// The SOCket Osnap mode is now plugged in and ready to use.

//

break;

case AcRx::kUnloadAppMsg:

// Clean up.

acdbCustomOsnapManager->removeCustomOsnapMode(pSocketMode);

delete pSocketMode;

// Unregister, then delete the protocol extension object.

//

AcDbEntity::desc()->delX(AcmeSocketInfo::desc());

delete pDefaultSocketInfo;

AcDbLine::desc()->delX(AcmeSocketInfo::desc());

delete pSocketForLine;

// Remove the protocol extension class definition.

//

acrxClassDictionary->remove("AcmeSocketInfo");

break;

default:

// Between the initialization and termination of the

// application, all registered objects will be directly

// invoked as needed. No commands or AutoLISP

// expressions are necessary.

//

break;

}

return AcRx::kRetOK;

}




Содержание  Назад  Вперед