Temporary document are not saved, while variant copy is meant to be preserved. The SubShapeBinder supports variant binding as well, and it does indeed use a temporary document for that purpose, because the binder does not need to preserve the variant copies, only the combined shape.Zolko wrote: ↑Sat Sep 11, 2021 11:38 am Why not use a hidden temporary Document to contain the deep copy : with a new hidden temporary document, you are sure that it's empty, thus all copied names will be preserved.? If you copy into the current document, existing names will be changed to keep the unique name principle of FreeCAD, so how do you track the changed (variant) variables ?
The naming conflict is a common problem that must be solved in order for normal copy to work. You know, when you copy a body and paste it into the same document, FreeCAD must change the reference according to name changes. Similar things happen here. In addition, since this is actually a replace operation, it will also change reference in existing objects. Similar logic has already been implemented in 'Link replace' action in upstream.
It is implemented in Link using C++.Also, is this variant link a C++ construct or a Python object ?