Share

AcAxCopy

C++

HRESULT AXAUTOEXP AcAxCopy(
    const AcDbObjectId& objId, 
    LPDISPATCH pAppDisp, 
    LPDISPATCH* pCopyObj, 
    AcDbObjectId ownerId = AcDbObjectId::kNull
);

File

axboiler.h

Description

Creates a copy of the object using the object identified by objId as the source object.

Note

The IDispatch pAppDisp is used to set the Application property of the new objects created. The objects must support IRetrieveApplication or their Application property will not be set.

ownerId allows you to specify which block table record the new object will be appended to. If omitted (AcDbObjectId::kNull), then the block table record of the object being copied is used.

Returns HRESULT. The macros SUCCEEDED() and FAILED() can be used to determine whether the function succeeded. The return value should be forwarded to the COM client; nothing else needs to be done. The function cleans up after itself in case of an error and also sets up the Error Info object that can be queried from the COM client to get specific information about what caused any given failure.

Parameters

Parameters Description
objId Input object ID of object to copy
pAppDisp IDispatch of the Application object being used
pCopyObj Pointer to IDispatch that will be populated with the IDispatch* representing the new object created and appended to the database
ownerId Optional block table record to which to append the new object

Was this information helpful?