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


as the layer an entity

// as the layer an entity is on. This is when you will

// have to pass in the destination database as the owner

// of the layer table record. Since all symbol tables

// are always cloned in wblock, you do not need to make

// sure that symbol table record owners are cloned.


// However, if the owner is one of your own classes,

// then it is up to you to make sure that it gets

// cloned. This is probably easiest to do at the end

// of this function. Otherwise you may have problems

// with recursion when the owner, in turn, attempts

// to clone this object as one of its subobjects.


AcDbBlockTableRecord *pBTR = NULL;

if (pOwn != NULL)

pBTR = AcDbBlockTableRecord::cast(pOwn);

if (pBTR != NULL) {


} else {


pClone->setOwnerId( (pOwn != NULL) ? pOwn->objectId() : ownerId());


// Step 3: The AcDbWblockCloneFiler makes a list of

// AcDbHardOwnershipIds and AcDbHardPointerIds. These

// are the references that must be cloned during a

// wblock operation.


AcDbWblockCloneFiler filer;


// Step 4: Rewind the filer and read the data into the clone.


filer.seek(0L, AcDb::kSeekFromStart);


// Step 5:

// This must be called for all newly created objects

// in wblockClone. It is turned off by endDeepClone()

// after it has translated the references to their

// new values.



// Step 6: Add the new information to the ID map. We can use

// the ID pair started above. We must also let the

// idMap entry know whether the clone’s owner is

// correct, or needs to be translated later.


idPair.setIsOwnerXlated((Adesk::Boolean)(pOwn != NULL));




// Step 7: Using the filer list created above, find and clone

// any hard references.


AcDbObjectId id;

while (filer.getNextHardObject(id)) {

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