The com.dassault_systemes.modeler.foundation.editing.Editing API is the recommended way to perform model modifications. It provides built-in support for command tracking and undo/redo.
All changes executed through this API are:
- Recorded as a command
Each execution is captured as a named command - Stored in command history
Enables undo and redo of model changes
This ensures that model modifications are safe, consistent, and traceable.
Getting an Editing Instance
Obtain an Editing instance from the current project:
import com.dassault_systemes.modeler.foundation.editing.Editing;
Editing editing = Editing.getInstance(project);
JAVA
Executing Model Changes
Use the execute method to perform model modifications.
- The provided name identifies the command in the undo/redo history
- All changes inside the lambda are executed within a single transaction
import com.dassault_systemes.modeler.foundation.editing.Editing;
Editing editing = Editing.getInstance(project);
editing.execute("Create element", () -> {
// model changes here
});
JAVA
Best Practices
- Prefer
Editing.execute(...) for all model changes - Use meaningful command names (they appear in undo/redo history)
- Group related changes into a single execution block
- Avoid modifying the model outside of an execution context
When to Use This API
Use the Editing API for:
- Creating, updating, or deleting model elements
- Batch modifications that should be treated as one operation
- Any changes that must support undo/redo
For lower-level control over sessions, see: (2026x Refresh1) SessionManager API