Пример #1
0
 public void Init()
 {
     if (singleRules != null)
     {
         defaultRules = singleRules;
     }
     //this.Open();
 }
Пример #2
0
 /// <summary>
 /// 替换审核者、设计者、日期等属性
 /// </summary>
 /// <param name="entity"></param>
 public static void ReplaceProperty(AcadEntity entity, AcadBlocks blocks, Bussiness.Rules rules)
 {
     if (entity.ObjectName == "AcDbBlockReference")
     {
         var s    = ((AcadBlockReference)entity);
         var name = blocks.Item(s.Name).Name;
         blocks.Item(s.Name).Name = rand.Next().ToString();
         if (s.HasAttributes)
         {
             AcadAttributeReference bb;
             object[] aa = (object[])s.GetAttributes();
             for (int i = 0; i < aa.Length; i++)
             {
                 bb = aa[i] as AcadAttributeReference;
                 if (bb != null)
                 {
                     if (bb.TagString != "---------" && bb.TagString != "------" && !bb.TagString.Contains("GEN-TITLE-MAT") && !bb.TagString.Contains("GEN-TITLE-DES") && bb.TagString != "01" && !bb.TagString.Contains("GEN-TITLE-SCA{6.14,1}"))
                     {
                         bb.TextString = "";
                     }
                     if (bb.TagString == "---------")
                     {
                         oldCode = bb.TextString;
                         oldCode = ReplaceStr(oldCode);
                         var       startCode = oldCode.Substring(0, RegexCode());
                         var       endCode   = oldCode.Substring(RegexCode(), oldCode.Length - RegexCode());
                         Hashtable hash      = rules.GetRules();
                         foreach (DictionaryEntry de in hash)
                         {
                             if (startCode == de.Key.ToString())
                             {
                                 startCode = de.Value.ToString();
                             }
                         }
                         newCode = startCode + "0" + Rand();
                         if (!string.IsNullOrEmpty(newCode))
                         {
                             bb.TextString = newCode;
                         }
                     }
                 }
             }
         }
     }
     else if (entity.ObjectName == "AcDbMText")
     {
         AcadMText mtext = entity as AcadMText;
         if (mtext != null)
         {
             if (mtext.TextString.Contains("FAX") || mtext.TextString.Contains("TEL") || mtext.TextString.Contains("TOMITA"))
             {
                 mtext.TextString = "";
             }
         }
     }
 }
Пример #3
0
 private Rules GetRules()
 {
     //TODO
     Rules rules = new Rules();
     DataSet ds = Util.InitializeWorkbook(ConfigurationManager.AppSettings["xls"].ToString());
     int count = ds.Tables[0].Rows.Count;
     for (int i = 1; i < count; i++)//从第二行开始读取数据
     {
         rules.SetRules(ds.Tables[0].Rows[i][0].ToString(), ds.Tables[0].Rows[i][1].ToString());
         CreateDir(ds.Tables[0].Rows[i][1].ToString());
     }
     CreateDir("失败的图纸文件");
     return rules;
 }
Пример #4
0
 private void InitRules()
 {
     rules = GetRules();
 }
Пример #5
0
 private void InitRules()
 {
     rules = GetRules();
 }
Пример #6
0
 public void SetDefaultRules(Rules rules)
 {
     defaultRules = rules;
 }