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


         

Словарь имен объектов - часть 2


return;

// Get the "from" and "to" databases.

//

AcDbDatabase *pFrom, *pTo;

idMap.origDb(pFrom);

idMap.destDb(pTo);

// See if the "from" database has our dictionary, and

// open it. If it doesn’t have one, we are done.

//

AcDbDictionary *pSrcNamedObjDict;

pFrom->getNamedObjectsDictionary(pSrcNamedObjDict, AcDb::kForRead);

es = pSrcNamedObjDict->getAt(kpDictionary, dictId);

pSrcNamedObjDict->close();

if (es == Acad::eKeyNotFound)

return;

AcDbDictionary *pSrcDict;

acdbOpenObject(pSrcDict, dictId, AcDb::kForRead);

AcDbObject *pClone;

switch (idMap.deepCloneContext()) {

case AcDb::kDcWblock:

// WBLOCK clones all or part of a drawing into a

// newly created drawing. This means that the

// named object dictionary is always cloned, and

// its AcDbObjectIds are in flux. Therefore, you

// cannot use getAt() or setAt() on the dictionary

// in the new database. This is because the

// cloned dictionary references all refer to the

// original objects. During deep clone translation,

// all cloned entries will be translated to the

// new objects, and entries not cloned will be

// "removed" by getting "translated" to NULL.

//

// The cloning of entries in our own dictionary are

// not handled here. If all are to be cloned, then

// call setTreatElementsAsHard(Adesk::kTrue) on the

// dictionary. Otherwise, only those entries that

// are referred to by hard references in other

// wblocked objects will have been cloned via

// those references.

// In this example, we will always write out all of

// the records. Since TreatElementsAsHard is not

// currently persistent, we reset it here each time.

//

pSrcDict->upgradeOpen();

pSrcDict->setTreatElementsAsHard(Adesk::kTrue);

pClone = NULL;

pSrcDict->wblockClone(pTo, pClone, idMap,

Adesk::kFalse);

if (pClone != NULL)

pClone->close();

break;

case AcDb::kDcInsert:

// In INSERT, an entire drawing is cloned, and

// "merged" into a pre-existing drawing. This




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