Beispiel #1
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);
        }
Beispiel #2
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();
                }
            }
        }
        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);
        }