Example #1
0
 public static void PurgeDb(Database db, Transaction tr, bool clearDGN = false)
 {
     try
     {
         ObjectIdCollection objectIdCollection = new ObjectIdCollection();
         objectIdCollection.Add(db.LayerTableId);
         objectIdCollection.Add(db.LinetypeTableId);
         objectIdCollection.Add(db.TextStyleTableId);
         objectIdCollection.Add(db.BlockTableId);
         objectIdCollection.Add(db.DimStyleTableId);
         if (tr == null)
         {
             Transaction transaction = db.TransactionManager.StartTransaction();
             tr = transaction;
             using (transaction)
             {
                 if (clearDGN)
                 {
                     SBGJ.PurgeDGN(db, tr);
                 }
                 SBGJ.PurgeItems(db, tr, objectIdCollection);
                 goto IL_97;
             }
         }
         if (clearDGN)
         {
             SBGJ.PurgeDGN(db, tr);
         }
         SBGJ.PurgeItems(db, tr, objectIdCollection);
         IL_97:;
     }
     catch (Exception ex)
     {
     }
 }
Example #2
0
 public static void TcMoveTextInBlock()
 {
     checked
     {
         try
         {
             Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
             Interaction.MsgBox(mdiActiveDocument.Window.DeviceIndependentSize.Width, MsgBoxStyle.OkOnly, null);
             Interaction.MsgBox(mdiActiveDocument.Window.DeviceIndependentSize.Height, MsgBoxStyle.OkOnly, null);
             SBGJ.ScreenShotToFile(mdiActiveDocument.Window, "C:\\temp.bmp", 0, (int)Math.Round(mdiActiveDocument.Window.DeviceIndependentSize.Height), 0, (int)Math.Round(mdiActiveDocument.Window.DeviceIndependentSize.Width));
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Example #3
0
 public static void TcPu()
 {
     try
     {
         Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
         if (mdiActiveDocument != null)
         {
             Database database = mdiActiveDocument.Database;
             using (Transaction transaction = database.TransactionManager.StartTransaction())
             {
                 SBGJ.PurgeDb(database, transaction, true);
                 SBGJ.smethod_0(database, transaction);
                 transaction.Commit();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #4
0
        public static void GetEntityDxf()
        {
            Document           mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
            Editor             editor            = mdiActiveDocument.Editor;
            PromptEntityResult entity            = editor.GetEntity("\nSelect an Entity: ");

            if (entity.Status == 5100)
            {
                long[] array = new long[]
                {
                    0L,
                    0L
                };
                SBGJ.?acdbGetAdsName@@YA?AW4ErrorStatus@Acad@@AEAY01_JVAcDbObjectId@@@Z(array, entity.ObjectId);
                ResultBuffer             resultBuffer = new ResultBuffer();
                Interop.AttachUnmanagedObject(resultBuffer, SBGJ.acdbEntGet(array), true);
                foreach (TypedValue typedValue in resultBuffer)
                {
                    string str = (typedValue.Value != null) ? typedValue.Value.ToString() : "*Nothing*";
                    editor.WriteMessage("\n - Code: " + typedValue.TypeCode.ToString() + " = " + str);
                }
            }
        }