1. using ZWCAD;
    2. using CApp = ZwSoft.ZwCAD.ApplicationServices.Application;
    3. using ZwSoft.ZwCAD.ApplicationServices;
    4. using ZwSoft.ZwCAD.DatabaseServices;
    5. using ZwSoft.ZwCAD.EditorInput;
    6. using ZwSoft.ZwCAD.Geometry;
    7. using ZwSoft.ZwCAD.GraphicsInterface;
    8. public static ZcadApplication cadApp = (ZcadApplication)CApp.ZcadApplication;
    9. public static ZcadDocument doc = ((ZcadApplication)CApp.ZcadApplication).ActiveDocument;
    10. /// <summary>
    11. /// 命令动作编组
    12. /// </summary>
    13. /// <param name="flag"><see langword="true"/>开始编组|<see langword="false"/>结束编组</param>
    14. public static void Undo(bool flag)
    15. {
    16. try
    17. {
    18. string undoCtl = doc.GetVariable("UNDOCTL");
    19. if (flag)
    20. {
    21. if (undoCtl == "8")//存在活动编组
    22. {
    23. doc.EndUndoMark();//结束编组
    24. }
    25. doc.StartUndoMark();//再开始编组
    26. }
    27. else
    28. {
    29. doc.EndUndoMark();//结束编组
    30. }
    31. }
    32. catch (Exception ex)
    33. {
    34. throw new Exception($"undo出错::参数{flag}::信息::" + ex.Message);
    35. }
    36. }