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


If this object is in

if (pspace == AcDbObjectId::kNull) {

AcDbBlockTable *pTable;

database()->getSymbolTable(pTable, AcDb::kForRead);

pTable->getAt(ACDB_PAPER_SPACE, pspace);



if ( idMap.deepCloneContext() == AcDb::kDcXrefBind && ownerId() == pspace)

return Acad::eOk;

// If this object is in the idMap and is already

// cloned, then return.


bool isPrim = false;

if (isPrimary)

isPrim = true;

AcDbIdPair idPair(objectId(), (AcDbObjectId)NULL, false, isPrim);

if (idMap.compute(idPair) && (idPair.value() != NULL))

return Acad::eOk;

// The owner object can be either an AcDbObject or an

// AcDbDatabase. AcDbDatabase is used if the caller is

// not the owner of the object being cloned (because it

// is being cloned as part of an AcDbHardPointerId

// reference). In this case, the correct ownership

// will be set during reference translation. If

// the owner is an AcDbDatabase, then pOwn will be left

// NULL here, and is used as a "flag" later.


AcDbObject *pOwn = AcDbObject::cast(pOwner);

AcDbDatabase *pDb = AcDbDatabase::cast(pOwner);

if (pDb == NULL)

pDb = pOwn->database();

// Step 1: Create the clone.


AsdkPoly *pClone = (AsdkPoly*)isA()->create();

if (pClone != NULL)

pClonedObject = pClone; // Set the return value.


return Acad::eOutOfMemory;

// Step 2: If the owner is an AcDbBlockTableRecord, go ahead

// and append the clone. If not, but we know who the

// owner is, set the clone’s ownerId to it. Otherwise,

// we set the clone’s ownerId to our own ownerId (in

// other words, the original ownerId). This ID will

// then be used later, in reference translation, as

// a key to finding who the new owner should be. This

// means that the original owner must also be cloned at

// some point during the wblock operation.

// EndDeepClone’s reference translation aborts if the

// owner is not found in the ID map.


// The most common situation where this happens is

// AcDbEntity references to symbol table records, such

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