Allocate target in addin

Hello.
I am dealing with the creation of a big number of targets in an ABB robotstudio addin.
I was wondering if there is a method to pre allocate the target in order to save time during the creation.
I noticed that almost the 95% of the execution time is due to the target creation, anyone knows how to increase efficency?
Thanks

Hi,
A possible cause is that there is no open undo step. In that case each API call will create a new undo step which causes a lot of overhead.
Wrap the target creation in an undo step like this:

try
{
	Project.UndoContext.BeginUndoStep("Create targets");

	// Do many things
}
finally
{
	Project.UndoContext.EndUndoStep();
}

If that doesn’t help, please post some of your code here so we can take a look.

Regards,
Johannes

That worked thanks.