Ejemplo n.º 1
0
        public static ObjectId ImportMissedTextStyle(string name, string srcDwgFile)
        {
            using (var dwgDb = AcDwgDb.OpenReadonly(srcDwgFile))
                using (var dwgTrans = dwgDb.TransactionManager.StartTransaction())
                    using (var acTrans = Ac.Db.TransactionManager.StartTransaction())
                    {
                        var dwgTable = (SymbolTable)dwgTrans.GetObject(dwgDb.TextStyleTableId, OpenMode.ForRead);
                        var acTable  = (SymbolTable)acTrans.GetObject(Ac.Db.TextStyleTableId, OpenMode.ForWrite);

                        var res = ImportMissedRecord(dwgTable, name, acTable);
                        acTrans.Commit();
                        return(res);
                    }
        }
Ejemplo n.º 2
0
        public static ObjectId ImportMissedBlockDef(string blockName, string srcDwgFile)
        {
            using (var dwgDb = AcDwgDb.OpenReadonly(srcDwgFile))
                using (var dwgTrans = dwgDb.TransactionManager.StartTransaction())
                    using (var acTrans = Ac.Db.TransactionManager.StartTransaction())
                    {
                        var dwgTable = (SymbolTable)dwgTrans.GetObject(dwgDb.BlockTableId, OpenMode.ForRead);
                        var acTable  = (SymbolTable)acTrans.GetObject(Ac.Db.BlockTableId, OpenMode.ForWrite);

                        var blockId = ImportMissedRecord(dwgTable, blockName, acTable);
                        using (var blockTableRec = (BlockTableRecord)acTrans.GetObject(blockId, OpenMode.ForWrite))
                        {
                            SendHatchesToBack(acTrans, blockTableRec);
                        }

                        acTrans.Commit();
                        return(blockId);
                    }
        }