Hi,
Yes, with a transaction group but there are counter indications.
- Layers must exists before you can cast entities on them.
- An entity or a Block must have an id before you can re-query it.
- …
Sometimes there is no way around.
For example: Adding a layer requires 2 steps to undo.
- Undo set current
- Undo creation
2, 3 … or much more steps to Undo (OO) the last GUI action is not at all strange. ![]()
If it is an option …
It is probably more interesting to complete all actions on the virtual objects before casting them.
The same advice as in this topic
// Start a new transaction group
doc.startTransactionGroup();
// First operation
var op = new RAddObjectsOperation();
op.setTransactionGroup(doc.getTransactionGroup());
...
op.addObject(...);
op.addObject(...);
di.applyOperation(op);
// Second operation
op = new RAddObjectsOperation();
op.setTransactionGroup(doc.getTransactionGroup());
...
op.addObject(...);
di.applyOperation(op);
Or automatically within a limited section:
doc.startTransactionGroup();
// Add all operations to the current transaction group:
doc.setAutoTransactionGroup(true);
....
..
.
doc.setAutoTransactionGroup(false);
Regards,
CVH