Closes the cumulative undo stack for drawing object management operations.

syntaxSyntax:
DlxPage.CloseUndo()

Return Value

If the operation ends correctly, it returns true otherwise it returns false.

Remarks

Use the OpenUndo and CloseUndo function pair only to allow you to undo multiple object management operations using a single Undo command. Object management operations must be specified after OpenUndo and before CloseUndo.

Example

  Copy codeCopy code
var prj = DlxApp.GetJob().GetProject("Example Sch");
if (!prj.IsValid())
  prj = DlxApp.GetJob().NewProject("Example Sch");
var doc = prj.GetDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
if (!doc.IsValid())
{
  doc = prj.NewDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
  doc.SetPageFormat("A4", false);
}
if (doc.IsValid() && doc.Activate())
{
  var page = doc.GetActivePage();
  if (page.IsValid())
  {
    var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
    if (layer.IsValid())
    {
      // cumulative undo
      page.OpenUndo("drawing of 6 lines");
      layer.DrawLine(new DlxPoint(50,50), new DlxPoint(50,70));
      layer.DrawLine(new DlxPoint(50,70), new DlxPoint(75,80));
      layer.DrawLine(new DlxPoint(75,80), new DlxPoint(100,70));
      layer.DrawLine(new DlxPoint(100,70), new DlxPoint(100,50));
      layer.DrawLine(new DlxPoint(100,50), new DlxPoint(50,50));
      layer.DrawLine(new DlxPoint(50,50), new DlxPoint(50,50));
      page.CloseUndo();
      
      // single undo
      layer.DrawLine(new DlxPoint(50,70), new Point(100,70));
    }
  }
}

See also