public void ClearSize() { Sizes.Clear(); EquationMgr emgr = (EquationMgr)swDoc.GetEquationMgr(); while (emgr.GetCount() > 0) { emgr.Delete(0); } }
public static void DeleteEquation(EquationMgr equationManager, int index) { equationManager.Delete(index); if (equationManager.GetCount() != 0) { logger.Debug("\n ERROR: Could not delete equations"); } logger.Debug("\n Equation Deleted"); }
/// <summary> /// delete equation for model, by index /// </summary> /// <param name="index"></param> /// <param name="swModel"></param> private void DeleteEquation(int index, IModelDoc2 swModel) { try { EquationMgr myEqu = swModel.GetEquationMgr(); myEqu.Delete(index); swModel.EditRebuild3(); } catch (Exception exception) { MessageObserver.Instance.SetMessage("Exeption at delete equations " + exception.ToString()); } }
public static void DeleteEquation(EquationMgr equationManager, int index) { equationManager.Delete(index); if (equationManager.GetCount() == 0) { Console.WriteLine(" - Delete Equation - Success"); } else { Console.WriteLine(" - WARNING - Delete Equation - Failed"); } }
public void Commit() { #region 00. 提交尺寸 EquationMgr emgr = (EquationMgr)swDoc.GetEquationMgr(); int ic = emgr.GetCount(); for (int i = 0; i < ic; i++) { //在这里想办法只获取全局变量 string s = emgr.get_Equation(i); if (s.Contains("@")) { continue; } s = s.Replace("\"", ""); s = s.Remove(s.IndexOf('=')); s = s.Trim(); s = s.ToUpper(); if (Sizes.ContainsKey(s)) { if (Sizes[s] != _Sizes[s]) { string Equation = JswFunc.FormatEquation(s, Sizes[s].ToString()); emgr.set_Equation(i, Equation); } } else { if (_Sizes.ContainsKey(s)) { emgr.Delete(i); i--; ic--; } } } //foreach (string key in Sizes.Keys) //{ // if (Sizes[key] != _Sizes[key]) // { // JswFunc.SetEquationValueByName(swDoc, key, Sizes[key]); // } //} _Sizes = new Dictionary <string, object>(Sizes); #endregion #region 10. 提交属性 string cfgname2 = swDoc.ConfigurationManager.ActiveConfiguration.Name; CustomPropertyManager cpmMdl = swDoc.Extension.get_CustomPropertyManager(cfgname2); //修改属性 foreach (string key in Attrs.Keys) { if (_Attrs.ContainsKey(key)) { if (Attrs[key] != _Attrs[key]) { cpmMdl.Set(key, Attrs[key]); } } else { //如果该Key在_Attrs中找不到,表示为新增的属性 int outval = 30; string sovVal = ""; // cpmMdl.Set(AtrName, Value); cpmMdl.Add2(key, outval, Attrs[key]); } } //清理已经删除的属性 foreach (string key in _Attrs.Keys) { if (!Attrs.ContainsKey(key)) { //旧属性不在新列表中,表示该属性已被删除。 cpmMdl.Delete(key); } } _Attrs = new Dictionary <string, string>(Attrs); #endregion }