Exemple #1
0
        explode(this ObjectId[] ids)
        {
            ObjectIdCollection idsEx = new ObjectIdCollection();

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                for (int i = 0; i < ids.Length; i++)
                {
                    try
                    {
                        Entity             ent    = (Entity)tr.GetObject(ids[i], OpenMode.ForWrite);
                        DBObjectCollection dbObjs = new DBObjectCollection();
                        ent.Explode(dbObjs);
                        ent.Erase();
                        BlockTableRecord ms = (BlockTableRecord)tr.GetObject(BaseObjs._db.CurrentSpaceId, OpenMode.ForWrite);
                        foreach (DBObject dbObj in dbObjs)
                        {
                            Entity entX = (Entity)dbObj;
                            idsEx.Add(ms.AppendEntity(entX));
                            tr.AddNewlyCreatedDBObject(entX, true);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " Mod.cs: line: 390");
                    }
                }

                tr.Commit();
            }
            return(idsEx);
        }
        public static void Explode(Autodesk.AutoCAD.DatabaseServices.Entity ent, List <Autodesk.AutoCAD.DatabaseServices.DBObject> entities)
        {
            var objs = new DBObjectCollection();

            if (ent != null)
            {
                entities.Add(ent);

                try
                {
                    ent.Explode(objs);
                }
                catch
                {
                }

                if (objs.Count == 0)
                {
                    return;
                }
                else
                {
                    foreach (Autodesk.AutoCAD.DatabaseServices.Entity obj in objs)
                    {
                        Explode(obj, entities);
                    }
                }
            }
        }
        public static void ExplodeProfile(Autodesk.AutoCAD.DatabaseServices.Entity ent, List <Autodesk.AutoCAD.DatabaseServices.DBObject> entities)
        {
            var objs = new DBObjectCollection();

            if (ent != null)
            {
                ent.Explode(objs);
                var block = objs[0] as Autodesk.AutoCAD.DatabaseServices.Entity;
                objs.Clear();
                block.Explode(objs);

                foreach (Autodesk.AutoCAD.DatabaseServices.Entity obj in objs)
                {
                    entities.Add(obj);
                }
            }
        }
Exemple #4
0
        explode(this ObjectId id)
        {
            ObjectIdCollection ids = new ObjectIdCollection();

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                Entity             ent    = (Entity)tr.GetObject(id, OpenMode.ForWrite);
                DBObjectCollection dbObjs = new DBObjectCollection();
                ent.Explode(dbObjs);
                ent.Erase();
                BlockTable       bt = (BlockTable)tr.GetObject(BaseObjs._db.BlockTableId, OpenMode.ForRead);
                BlockTableRecord ms = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                foreach (DBObject dbObj in dbObjs)
                {
                    Entity entX = (Entity)dbObj;
                    ids.Add(ms.AppendEntity(entX));
                    tr.AddNewlyCreatedDBObject(entX, true);
                }
                tr.Commit();
            }
            return(ids);
        }