/// <summary> /// Toggle rule on/off. /// </summary> /// <param name="RuleName">Name of rule to toggle</param> public void ToggleDesignRule(string RuleName) { try { IPCB_Rule Rule; IPCB_Board Board = Util.GetCurrentPCB(); if (Board == null) { return; } Rule = GetRule(RuleName); if (Rule == null) { MessageBox.Show("No rule found that matches '" + RuleName + "'."); return; } PCBServer.PreProcess(); Rule.BeginModify(); // {Rule has to be prepared for modification} Rule.SetState_DRCEnabled(!Rule.GetState_DRCEnabled()); // Toggle rule state. Rule.EndModify(); // {Let script know we are done modifying the rule} Rule = null; PCBServer.PostProcess(); //{Dispatch message to system now that processing is complete} Board.DispatchMessage(SCH.SCHConstant.FromSystem, SCH.SCHConstant.BroadCast, SCH.SCHConstant.SCHMYieldToRobots, SCH.SCHConstant.NoEventData); } catch (Exception ex) { ErrorMail.LogError("Error in " + System.Reflection.MethodBase.GetCurrentMethod().Name + ".", ex); } }