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



         

Формирование Иерархии Монопольных использований - часть 5


AcDbObjectId DictId;

pNamedobj->setAt("ASDK_DICT", pDict, DictId);

}

pNamedobj->close();

// Add object A to the ASDK_DICT dictionary.

//

pDict->setAt("OBJA", pObjA, objIdA);

pDict->close();

// Now set up ownership for object B.

//

pObjA->setIdData(objIdB);

pObjA->close();

}

// The list tree function runs through all objects in the

// ASDK_DICT dictionary, follows their ownership trees, and

// lists out information on all objects in the tree.

//

void

listTree()

{

AcDbDictionary *pNamedobj;

AcDbDictionary *pDict;

acdbHostApplicationServices()->workingDatabase()

->getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite);

// Get a pointer to the ASDK_DICT dictionary.

//

pNamedobj->getAt("ASDK_DICT",(AcDbObject*&)pDict,

AcDb::kForRead);

pNamedobj->close();

// Run through the entries and list their backpointers.

//

AcDbDictionaryIterator *pDictItr = pDict->newIterator();

for (; !pDictItr->done(); pDictItr->next()) {

printOut(pDictItr->objectId());

}

pDict->close();

}

// Recursively walks down an ownership tree of AsdkOwnerDemo

// class objects, printing out information on each one.

//

void

printOut(AcDbObjectId id)

{

AsdkOwnerDemo *pDemo;

acdbOpenObject((AcDbObject*&)pDemo, id, AcDb::kForRead);

acutPrintf("\nIntdata: %d ObjId: %ld Backpointer:"

" %ld OwnedObj: %ld", pDemo->intData(),

(pDemo->objectId()).asOldId(),

(pDemo->ownerId()).asOldId(),

(pDemo->idData()).asOldId());

// Recursive tree walk

//

if ((pDemo->idData()).asOldId() != 0L) {

printOut(pDemo->idData());

}

pDemo->close();

}

// The initialization function is called from acrxEntryPoint()

// during kInitAppMsg case. This function is used to add commands

// to the command stack and to add classes to the ACRX class

// hierarchy.

//

void

initApp()

{

acedRegCmds->addCommand("ASDK_OWNERSHIP_COMMANDS",

"ASDK_CREATE", "CREATE",ACRX_CMD_MODAL, createObjs);




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