New to Analytica 5.0
Creates copies of all the objects in «objects» and returns handles to the cloned objects. «Objects» can be a handle, a list of handles, or an array of handles. The result has the same dimensionality as «objects».
When a handle to a module appears in «objects» all the objects within that module are recursively cloned as well.
When to use
Few users will have a reason to use this function. It does the same thing that the Duplicate Node(s) option on the Edit menu does, so when you want to duplicate or clone objects from within Analytica, just select the objects and use Duplicate Node(s).
This function would be of use if the duplication of nodes needs to be automated for some reason, or when a program using the Analytica Decision Engine (ADE) needs to duplicate nodes.
The function can only be used in a context where global side-effects are allowed. The essentially means that it must be used from the Typescript window, from a button OnClick event, or from CAEngine::SendCommand. It cannot be evaluated from within the Definition of a variable object.
You cannot clone objects into a locked + browse-only module, which means this cannot be used on objects in a browse-only module since the clone is placed into the same module as the original. An exception is when you call this from a button that is also in that browse-only module, in which case it is allowed. With these restrictions, the function cannot be used to clone a node with a hidden definition in order to gain access to the definition, for example.
Location of clones
The clones for all objects listed in «Objects» are placed in the same module as the original. When you clone a module, the clones for all the objects within that module are placed in the cloned module.
Identifier of clones
Because each clone needs a unique identifier, the identifier of the original is munged slightly to obtain a unique identifier. This usually occurs by appending a number to the end, so that
Price1, or incrementing a number at the end of the identifier, so that
Updating of attributes and inputs
When any object,
A in «objects» references another object,
B, that is also in objects, the relevant attributes of the cloned
A are updated to use the clone of
B. For example, if the Definition of
F(B, C, B+C), the Definition of the clone
A1 would be
F(B1, C, B1+C), assuming that
C was not among the objects cloned.
When there are alias objects that are not among the objects cloned, the aliases will remain with the original object, and the clone will not have those alias objects. If the alias is among the objects cloned, then the cloned alias will be for the cloned object.
When a linked library or linked module is cloned, the clone becomes an embedded module or library, so that the same file isn't linked twice.