Using the copy method of the CopyHelper, it is possible to copy instances within a project or in a non-project-specific manner. For this, the following parameters are required:
CopyHelper.copy(IUnitOfWork, String sourceName, String targetName, String newName) | ||
---|---|---|
Argument | IUnitOfWork uow | The UnitOfWork of the script |
String sourceName | Absolute name of the source object | |
String targetName | Absolute name of the superordinate target component, i.e., of the object to which the copy is mounted. This may be a project, a mechatronic component or a placeholder. | |
String newName | The name to be assigned to the copy at the target location. If the name is already taken, a number is added at the end and incremented until a free name has been found. |
import com.mind8.copying.helper.CopyHelper;
import org.foederal.eobroker.core.IUnitOfWork;
uow = self.getUnitOfWork();
source = "Feeder.Mechatronic.Feeder.Insert"; // Absolute name of object
target = "Feeder.Mechatronic.Feeder";
newName = "Insert2";
CopyHelper.copy(uow, source, target, newName);
uow.saveChanges();