# About Undo Processing

**URL:** <https://discourse.mcneel.com/t/about-undo-processing/160153>\
**Category:** Rhino Developer\
**Tags:** windows, rhinocommon, rhino7\
**Created:** [May 19, 2023, 2:00am UTC](https://discourse.mcneel.com/t/about-undo-processing/160153 "2023-05-19T02:00:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack3](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jack3/32/770827_2.png) [@jack3](https://discourse.mcneel.com/u/jack3)\
**Post date:** [May 19, 2023, 2:00am UTC](https://discourse.mcneel.com/t/about-undo-processing/160153/1 "2023-05-19T02:00:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/772741_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [May 24, 2023, 12:32am UTC](https://discourse.mcneel.com/t/about-undo-processing/160153/2 "2023-05-24T00:32:44Z")

</div>

> [@jack3](#):
>
> what I have displayed in the plugin does not disappear

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

---

<div class="post-metadata">

**Author:** ![jack3](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jack3/32/770827_2.png) [@jack3](https://discourse.mcneel.com/u/jack3)\
**Post date:** [May 24, 2023, 12:52am UTC](https://discourse.mcneel.com/t/about-undo-processing/160153/3 "2023-05-24T00:52:00Z")

</div>

Hi @dale

> [@dale](#):
>
> Are you coding in C++, C#, or Python?

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.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/772741_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [May 24, 2023, 4:44pm UTC](https://discourse.mcneel.com/t/about-undo-processing/160153/4 "2023-05-24T16:44:05Z")

</div>

Hi @jack3,

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

```auto
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
