About Undo Processing

Hello

When I run Undo after I have displayed certain things in the original plugin, what I have displayed in the plugin does not disappear (no Undo process).
Do you have a source for reference?

best

Hi @jack3,

We’ll need more details to be helpful.

Are you coding in C++, C#, or Python?

Is what you want to undo created in a command and added to the document?

Is what you want to undo created in some modeless user interface, such as a panel, and added to the document?

– Dale

Hi @dale

I am coding in C#.

After executing the command, when the command is successfully processed and I type the Undo command, what is displayed in the View by the command is not erased.
I would like to see if there is a reference on this.

Hi @jack3,

If your dialog box is modeless, then you should do this when adding objects to the document:

var undo_record_sn = doc.BeginUndoRecord("Placing gemstones");
foreach (var gem in gemArray)
  doc.Objects.AddBrep(gem);
if (undo_record_sn > 0)
  doc.EndUndoRecord(undo_record_sn);
doc.Views.Redraw();

– Dale