Doug Broad said:
Yes. Copyobjects preserves the links between copied objects.
Actually, I'm afraid the answer is "Yes and No",
or just a classic case of catch 22.
You can deal with inter-object references using
Copyobjects in cases where the referenced and the
referencing objects are both involved in the same
operation, but on the other hand, you would also
be breaking any other reference to any object that
is copied, if the referencing object(s) are not
involved in the same deep clone operation.
I'm afraid this is simply not an operation you can
do in LISP or ActiveX, in a way that addresses all
of the issues.
For anyone that's interested, AcadX has a method that
can solve the problem. The AcadXApplication object's
SwapIds method exchanges the objectid/handle and
extension dictionaries of two database-resident objects, and provides a way to preserve inter-object references when copying objects for this kind of purpose. With it, you can use CopyObjects to clone a set of entities, then swap the objectids/handles and extension dictionaries of the original source objects with the copies, before deleting the source objects.
IAcadXApplication.SwapIds(First as IAcadObject,
Second as IAcadObject
[, SwapXData as Boolean = False]
[, SwapXDict as Boolean = False] )
First and Second are two objects whose data is to be
exchanged. If SwapXData is true, then the Xdata of
the two objects is also exchanged. If SwapXDict is true, then the extension dictionaries of both objects are swapped.