Exemple #1
0
        public static void UnfreezeAll()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;

            using (doc.LockDocument())
            {
                Database db = doc.Database;
                RegAppIsoline(db);
                using (var t = db.TransactionManager.StartTransaction())
                {
                    var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable;
                    foreach (var idBtr in bt)
                    {
                        var         btr        = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord;
                        List <Line> linesInBtr = new List <Line>();
                        foreach (var idEnt in btr)
                        {
                            if (idEnt.ObjectClass.Name == "AcDbLine")
                            {
                                var     line    = idEnt.GetObject(OpenMode.ForRead, false, true) as Line;
                                Isoline isoline = new Isoline(line);
                                // Если это штрих, то удвляем ее, она автоматом построится при overrule
                                if (isoline.IsDash)
                                {
                                    line.UpgradeOpen();
                                    line.Erase();
                                }
                            }
                        }
                    }
                    t.Commit();
                }
            }
        }
Exemple #2
0
        public static void ReverseIsolines()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;

            using (doc.LockDocument())
            {
                Editor ed = doc.Editor;
                RegAppIsoline(doc.Database);
                PromptSelectionResult result = ed.SelectImplied();
                if (result.Status == PromptStatus.OK)
                {
                    var selIds = result.Value.GetObjectIds();
                    if (selIds.Count() > 0)
                    {
                        using (var t = doc.Database.TransactionManager.StartTransaction())
                        {
                            foreach (var item in selIds)
                            {
                                if (item.ObjectClass.IsDerivedFrom(Isoline.RxCurve))
                                {
                                    Isoline isoline = new Isoline(item);
                                    if (isoline.IsIsoline)
                                    {
                                        isoline.ReverseIsoline();
                                    }
                                }
                            }
                            t.Commit();
                        }
                    }
                }
            }
        }
Exemple #3
0
        public override void Explode(Entity entity, DBObjectCollection entitySet)
        {
            Curve curve = entity as Curve;

            if (curve != null)
            {
                Isoline isoline = new Isoline(curve);
                if (isoline.IsIsoline)
                {
                    var lines = isoline.GetLines(curve);
                    foreach (var line in lines)
                    {
                        entitySet.Add(line);
                    }
                    //isoline.Activate(false); fatal
                    Isoline.RemoveXData(entity);
                }
            }
            if (entity is Line)
            {
                entitySet.Add((DBObject)entity.Clone());
                return;
            }
            base.Explode(entity, entitySet);
        }
Exemple #4
0
        /// <summary>
        /// Превратить все штрихи в отдельные линии
        /// </summary>
        public static void FreezeAll()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;

            using (doc.LockDocument())
            {
                Database db = doc.Database;
                RegAppIsoline(db);
                using (var t = db.TransactionManager.StartTransaction())
                {
                    var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable;
                    foreach (var idBtr in bt)
                    {
                        var btr = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord;

                        List <Line> linesInBtr = new List <Line>();
                        foreach (var idEnt in btr)
                        {
                            if (idEnt.ObjectClass.IsDerivedFrom(RxCurve))
                            {
                                var     curve   = idEnt.GetObject(OpenMode.ForRead, false, true) as Curve;
                                Isoline isoline = new Isoline(curve);
                                if (isoline.IsIsoline)
                                {
                                    var lines = isoline.GetLines(curve);
                                    linesInBtr.AddRange(lines);
                                }
                            }
                        }
                        if (linesInBtr.Count > 0)
                        {
                            btr.UpgradeOpen();
                            foreach (var line in linesInBtr)
                            {
                                // Пометить линию как бергштрих
                                SetDashXData(line);
                                btr.AppendEntity(line);
                                t.AddNewlyCreatedDBObject(line, true);
                            }
                        }
                    }
                    t.Commit();
                }
            }
        }
Exemple #5
0
        public static void ActivateIsolines(bool activate)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;

            using (doc.LockDocument())
            {
                RegAppIsoline(doc.Database);
                Editor ed = doc.Editor;
                PromptSelectionResult result = ed.SelectImplied();
                if (result.Status == PromptStatus.OK)
                {
                    var selIds = result.Value.GetObjectIds();
                    if (selIds.Count() > 0)
                    {
                        using (var t = doc.Database.TransactionManager.StartTransaction())
                        {
                            foreach (var item in selIds)
                            {
                                if (item.ObjectClass.IsDerivedFrom(Isoline.RxCurve))
                                {
                                    Isoline isoline = new Isoline(item);
                                    // Активация изолинии
                                    if (activate)
                                    {
                                        if (!isoline.IsIsoline)
                                        {
                                            isoline.Activate(true);
                                        }
                                    }
                                    // Отключение изолинии
                                    else
                                    {
                                        if (isoline.IsIsoline)
                                        {
                                            isoline.Activate(false);
                                        }
                                    }
                                }
                            }
                            t.Commit();
                        }
                    }
                }
            }
        }
Exemple #6
0
 public static void ActivateIsolines(bool activate)
 {
    Document doc = Application.DocumentManager.MdiActiveDocument;
    using (doc.LockDocument())
    {
       RegAppIsoline(doc.Database);
       Editor ed = doc.Editor;
       PromptSelectionResult result = ed.SelectImplied();
       if (result.Status == PromptStatus.OK)
       {
          var selIds = result.Value.GetObjectIds();
          if (selIds.Count() > 0)
          {
             using (var t = doc.Database.TransactionManager.StartTransaction())
             {
                foreach (var item in selIds)
                {
                   if (item.ObjectClass.IsDerivedFrom(Isoline.RxCurve))
                   {
                      Isoline isoline = new Isoline(item);
                      // Активация изолинии
                      if (activate)
                      {
                         if (!isoline.IsIsoline)
                         {
                            isoline.Activate(true);
                         }
                      }
                      // Отключение изолинии
                      else
                      {
                         if (isoline.IsIsoline)
                         {
                            isoline.Activate(false);
                         }
                      }
                   }
                }
                t.Commit();
             }
          }
       }
    }
 }
      public override bool WorldDraw(Drawable drawable, WorldDraw wd)
      {
         // draw the base class
         bool ret = base.WorldDraw(drawable, wd);

         DB.Curve curve = drawable as DB.Curve;
         if (curve != null)
         {
            Isoline isoline = new Isoline(curve);
            if (isoline.IsIsoline)
            {
               var lines = isoline.GetLines(curve);
               foreach (var line in lines)
               {
                  wd.Geometry.Draw(line);
               }
            }
         }

         // return the base
         return true;
      }
Exemple #8
0
        public override bool WorldDraw(Drawable drawable, WorldDraw wd)
        {
            // draw the base class
            bool ret = base.WorldDraw(drawable, wd);

            DB.Curve curve = drawable as DB.Curve;
            if (curve != null)
            {
                Isoline isoline = new Isoline(curve);
                if (isoline.IsIsoline)
                {
                    var lines = isoline.GetLines(curve);
                    foreach (var line in lines)
                    {
                        wd.Geometry.Draw(line);
                    }
                }
            }

            // return the base
            return(true);
        }
 public override void Explode(Entity entity, DBObjectCollection entitySet)
 {
    Curve curve = entity as Curve;
    if (curve != null)
    {
       Isoline isoline = new Isoline(curve);
       if (isoline.IsIsoline)
       {
          var lines = isoline.GetLines(curve);
          foreach (var line in lines)
          {
             entitySet.Add(line);
          }
          //isoline.Activate(false); fatal
          Isoline.RemoveXData(entity);
       }
    }
    if (entity is Line)
    {
       entitySet.Add((DBObject)entity.Clone());
       return;
    }
    base.Explode(entity, entitySet);
 }
Exemple #10
0
      /// <summary>
      /// Превратить все штрихи в отдельные линии
      /// </summary>
      public static void FreezeAll()
      {
         Document doc = Application.DocumentManager.MdiActiveDocument;
         using (doc.LockDocument())
         {
            Database db = doc.Database;
            RegAppIsoline(db);
            using (var t = db.TransactionManager.StartTransaction())
            {
               var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable;
               foreach (var idBtr in bt)
               {
                  var btr = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord;

                  List<Line> linesInBtr = new List<Line>();
                  foreach (var idEnt in btr)
                  {
                     if (idEnt.ObjectClass.IsDerivedFrom(RxCurve))
                     {
                        var curve = idEnt.GetObject(OpenMode.ForRead, false, true) as Curve;
                        Isoline isoline = new Isoline(curve);
                        if (isoline.IsIsoline)
                        {
                           var lines = isoline.GetLines(curve);
                           linesInBtr.AddRange(lines);
                        }
                     }
                  }
                  if (linesInBtr.Count > 0)
                  {
                     btr.UpgradeOpen();
                     foreach (var line in linesInBtr)
                     {
                        // Пометить линию как бергштрих
                        SetDashXData(line);
                        btr.AppendEntity(line);
                        t.AddNewlyCreatedDBObject(line, true);
                     }
                  }
               }
               t.Commit();
            }
         }
      }
Exemple #11
0
 public static void ReverseIsolines()
 {
    Document doc = Application.DocumentManager.MdiActiveDocument;
    using (doc.LockDocument())
    {
       Editor ed = doc.Editor;
       RegAppIsoline(doc.Database);
       PromptSelectionResult result = ed.SelectImplied();
       if (result.Status == PromptStatus.OK)
       {
          var selIds = result.Value.GetObjectIds();
          if (selIds.Count() > 0)
          {
             using (var t = doc.Database.TransactionManager.StartTransaction())
             {
                foreach (var item in selIds)
                {
                   if (item.ObjectClass.IsDerivedFrom(Isoline.RxCurve))
                   {
                      Isoline isoline = new Isoline(item);
                      if (isoline.IsIsoline)
                      {
                         isoline.ReverseIsoline();
                      }
                   }
                }
                t.Commit();
             }
          }
       }
    }
 }
Exemple #12
0
 public static void UnfreezeAll()
 {
    Document doc = Application.DocumentManager.MdiActiveDocument;
    using (doc.LockDocument())
    {
       Database db = doc.Database;
       RegAppIsoline(db);
       using (var t = db.TransactionManager.StartTransaction())
       {
          var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable;
          foreach (var idBtr in bt)
          {
             var btr = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord;
             List<Line> linesInBtr = new List<Line>();
             foreach (var idEnt in btr)
             {
                if (idEnt.ObjectClass.Name == "AcDbLine")
                {
                   var line = idEnt.GetObject(OpenMode.ForRead, false, true) as Line;
                   Isoline isoline = new Isoline(line);
                   // Если это штрих, то удвляем ее, она автоматом построится при overrule
                   if (isoline.IsDash)
                   {
                      line.UpgradeOpen();
                      line.Erase();
                   }
                }
             }
          }
          t.Commit();
       }
    }
 }
Exemple #13
0
 private static void UnActivateIsolines(object sender, EventArgs e)
 {
     Isoline.ActivateIsolines(false);
 }
Exemple #14
0
 private static void ReverseIsolines(object sender, EventArgs e)
 {
     Isoline.ReverseIsolines();
 }
Exemple #15
0
 private static void ActivateIsolines(object sender, EventArgs e)
 {
     Isoline.ActivateIsolines(true);
 }