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


Перегрузка deepClone () Функция - часть 4

// any owned objects.


AcDbObjectId id;

while (filer.getNextOwnedObject(id)) {

AcDbObject *pSubObject;

AcDbObject *pClonedSubObject;

// Some object’s references may be set to NULL,

// so don’t try to clone them.


if (id == NULL)


// Open the object and clone it. Note that "isPrimary" is

// set to kFalse here because the object is being cloned,

// not as part of the primary set, but because it is owned

// by something in the primary set.


acdbOpenAcDbObject(pSubObject, id, AcDb::kForRead);

pClonedSubObject = NULL;



idMap, Adesk::kFalse);

// If this is a kDcInsert context, the objects

// may be "cheap" cloned. In this case, they are

// "moved" instead of cloned. The result is that

// pSubObject and pClonedSubObject will point to

// the same object. Therefore, we only want to close

// pSubObject if it really is a different object

// than its clone.


if (pSubObject != pClonedSubObject)


// The pSubObject may either already have been

// cloned, or for some reason has chosen not to be

// cloned. In that case, the returned pointer will

// be NULL. Otherwise, since we have no immediate

// use for it now, we can close the clone.


if (pClonedSubObject != NULL)



// Leave pClonedObject open for the caller.


return Acad::eOk;


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