Esempio n. 1
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 = "";
             }
         }
     }
 }
Esempio n. 2
0
        private void InternListSection(ref int rlngIdx)
        {
            AcadBlock dobjAcadBlock4 = (AcadBlock)mobjAcadBlocks.Item("*Model_Space");

            InternListBlockBegin(dobjAcadBlock4.BlockBegin, ref rlngIdx);
            InternListBlockData(dobjAcadBlock4, ref rlngIdx);
            InternListBlockEnd(dobjAcadBlock4.BlockEnd, ref rlngIdx);
            IEnumerator enumerator = default(IEnumerator);

            try
            {
                enumerator = mobjAcadBlocks.GetValues().GetEnumerator();
                while (enumerator.MoveNext())
                {
                    dobjAcadBlock4 = (AcadBlock)enumerator.Current;
                    if (LikeOperator.LikeString(dobjAcadBlock4.Name, "[*]Paper_Space*", CompareMethod.Binary))
                    {
                        InternListBlockBegin(dobjAcadBlock4.BlockBegin, ref rlngIdx);
                        InternListBlockData(dobjAcadBlock4, ref rlngIdx);
                        hwpDxf_List.BkDXFList_AcadBlockEntities(mstrAcadVer, dobjAcadBlock4, ref rlngIdx, ref mobjDictReadCodes, ref mobjDictReadValues);
                        InternListBlockEnd(dobjAcadBlock4.BlockEnd, ref rlngIdx);
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            IEnumerator enumerator2 = default(IEnumerator);

            try
            {
                enumerator2 = mobjAcadBlocks.GetValues().GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    dobjAcadBlock4 = (AcadBlock)enumerator2.Current;
                    if (!LikeOperator.LikeString(dobjAcadBlock4.Name, "[*]Model_Space", CompareMethod.Binary) & !LikeOperator.LikeString(dobjAcadBlock4.Name, "[*]Paper_Space*", CompareMethod.Binary))
                    {
                        InternListBlockBegin(dobjAcadBlock4.BlockBegin, ref rlngIdx);
                        InternListBlockData(dobjAcadBlock4, ref rlngIdx);
                        hwpDxf_List.BkDXFList_AcadBlockEntities(mstrAcadVer, dobjAcadBlock4, ref rlngIdx, ref mobjDictReadCodes, ref mobjDictReadValues);
                        InternListBlockEnd(dobjAcadBlock4.BlockEnd, ref rlngIdx);
                    }
                }
            }
            finally
            {
                if (enumerator2 is IDisposable)
                {
                    (enumerator2 as IDisposable).Dispose();
                }
            }
            dobjAcadBlock4 = null;
        }
Esempio n. 3
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 = "";
             }
         }
     }
 }