using ZWCAD;
using CApp = ZwSoft.ZwCAD.ApplicationServices.Application;
using ZwSoft.ZwCAD.ApplicationServices;
using ZwSoft.ZwCAD.DatabaseServices;
using ZwSoft.ZwCAD.EditorInput;
using ZwSoft.ZwCAD.Geometry;
using ZwSoft.ZwCAD.GraphicsInterface;
public static ZcadApplication cadApp = (ZcadApplication)CApp.ZcadApplication;
public static ZcadDocument doc = ((ZcadApplication)CApp.ZcadApplication).ActiveDocument;
/// <summary>
/// 命令动作编组
/// </summary>
/// <param name="flag"><see langword="true"/>开始编组|<see langword="false"/>结束编组</param>
public static void Undo(bool flag)
{
try
{
string undoCtl = doc.GetVariable("UNDOCTL");
if (flag)
{
if (undoCtl == "8")//存在活动编组
{
doc.EndUndoMark();//结束编组
}
doc.StartUndoMark();//再开始编组
}
else
{
doc.EndUndoMark();//结束编组
}
}
catch (Exception ex)
{
throw new Exception($"undo出错::参数{flag}::信息::" + ex.Message);
}
}