Create a modeless dialog box object problem

Why use a modeless dialog box to add the Rhino object with Ctrl+Z cannot undo

Undo is command based. That is, anything that happens to the current document within a command’s RunCommand() member is undo-able.

A modeless dialog does not run within the context of a command. A command might create a modeless dialog. But the dialog remains visible after the command finishes.

To make “stuff” you do in a modeless dialog undo-able, you have two options:

1.) Have your modeless dialog run a command using Rhino.RhinoApp.RunScript.
2.) Have your modeless dialog create it’s own Undo record. For example:

var undo_record = doc.BeginUndoRecord("My Undo-able Stuff...");

// TODO: modify document here

if (undo_record > 0)
  doc.EndUndoRecord(undo_record);

Does this help?

Thank you very much