public static IEnumerable<ViewTableRecord> GetViewTableRecords(this ViewTable symbolTbl,
 OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
     {
         return
             symbolTbl.GetSymbolTableRecords<ViewTableRecord>(symbolTbl.Database.TransactionManager.TopTransaction,
                 mode, filter, false);
     }
 /// <summary>
 /// Gets all text style table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="filter">The filter.</param>
 /// <returns></returns>
 public static IEnumerable<TextStyleTableRecord> GetAllTextStyleTableRecords(this TextStyleTable symbolTbl,
     OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return
         symbolTbl.GetSymbolTableRecords<TextStyleTableRecord>(
             symbolTbl.Database.TransactionManager.TopTransaction, mode, filter, true);
 }
 /// <summary>
 /// Gets the shape file table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="trx">The TRX.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="filter">The filter.</param>
 /// <returns></returns>
 public static IEnumerable<TextStyleTableRecord> GetShapeFileTableRecords(this TextStyleTable symbolTbl,
     Transaction trx, OpenMode mode = OpenMode.ForRead,
     SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return
         symbolTbl.GetSymbolTableRecords<TextStyleTableRecord>(trx, mode, filter, true)
             .Where(txt => txt.IsShapeFile);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Determines whether the specified test flag is set.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <param name="testFlag">The test flag.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentNullException">testFlag</exception>
 public static bool IsSet(this SymbolTableRecordFilter filter, SymbolTableRecordFilter testFlag)
 {
     if (testFlag == 0)
     {
         throw new ArgumentNullException("testFlag");
     }
     return((filter & testFlag) == testFlag);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the shape file table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="trx">The TRX.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="filter">The filter.</param>
 /// <returns></returns>
 public static IEnumerable <TextStyleTableRecord> GetShapeFileTableRecords(this TextStyleTable symbolTbl,
                                                                           Transaction trx, OpenMode mode = OpenMode.ForRead,
                                                                           SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return
         (symbolTbl.GetSymbolTableRecords <TextStyleTableRecord>(trx, mode, filter, true)
          .Where(txt => txt.IsShapeFile));
 }
        ///<overloads>
        /// <summmary>
        /// You can not edit a dependent block(a block that is inside from xref) from the referenced drawing. 
        /// The default is not to include dependent blocks since typically you will work on blocks that are contained 
        /// inside the drawing, and it saves time by not opening the DbObject and comparing 
        /// BlockTableRecord.ObjectId.OriginalDatabase.UnmanagedObject to the BlockTable.Database.UnmanagedObject property.
        /// </summmary>
        /// </overloads>
        /// <summary>
        /// Gets the block table records.
        /// </summary>
        /// <param name="symbolTbl">The symbol table.</param>
        /// <param name="trx">The TRX.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="filter"><see cref="SymbolTableRecordFilter"/>.</param>
        /// <returns>IEnumerable{BlockTableRecord}</returns>

        public static IEnumerable<BlockTableRecord> GetBlockTableRecords(this BlockTable symbolTbl, Transaction trx,
            OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
        {
            if (filter.IsSet(SymbolTableRecordFilter.IncludeDependent))
            {
                return symbolTbl.GetSymbolTableRecords<BlockTableRecord>(trx, mode, filter, true);
            }
            return symbolTbl.GetSymbolTableRecords<BlockTableRecord>(trx, mode, filter, true).NonDependent();
        }
        /// <summary>
        /// Gets the symbol table records.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="symbolTbl">The symbol table.</param>
        /// <param name="trx">The TRX.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="filterDependecyById">if set to <c>true</c> [filter dependecy by identifier].</param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        internal static IEnumerable<T> GetSymbolTableRecords<T>(this SymbolTable symbolTbl, Transaction trx,
            OpenMode mode, SymbolTableRecordFilter filter, bool filterDependecyById) where T : SymbolTableRecord
        {
            if (trx == null)
            {
                throw new Exception(ErrorStatus.NoActiveTransactions);
            }

            bool includingErased = filter.IsSet(SymbolTableRecordFilter.IncludedErased);

            if (filter.IsSet(SymbolTableRecordFilter.IncludeDependent))
            {
                foreach (ObjectId id in includingErased ? symbolTbl.IncludingErased : symbolTbl)
                {
                    yield return (T)trx.GetObject(id, mode, includingErased, false);
                }
            }
            else
            {
                if (filterDependecyById)
                {
                    IntPtr dbIntPtr = symbolTbl.Database.UnmanagedObject;
                    foreach (ObjectId id in includingErased ? symbolTbl.IncludingErased : symbolTbl)
                    {
                        if (id.OriginalDatabase.UnmanagedObject == dbIntPtr)
                        {
                            yield return (T)trx.GetObject(id, mode, includingErased, false);
                        }
                    }
                }
                else
                {
                    foreach (ObjectId id in includingErased ? symbolTbl.IncludingErased : symbolTbl)
                    {
                        T current = (T)trx.GetObject(id, mode, includingErased, false);
                        if (!current.IsDependent)
                        {
                            yield return current;
                        }
                    }
                }
            }
        }
 public static IEnumerable<ViewTableRecord> GetViewTableRecords(this ViewTable symbolTbl, Transaction trx,
 OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return symbolTbl.GetSymbolTableRecords<ViewTableRecord>(trx, mode, filter, false);
 }
 public static IEnumerable <ViewTableRecord> GetViewTableRecords(this ViewTable symbolTbl, Transaction trx,
                                                                 OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return(symbolTbl.GetSymbolTableRecords <ViewTableRecord>(trx, mode, filter, false));
 }
 public static IEnumerable <ViewTableRecord> GetViewTableRecords(this ViewTable symbolTbl,
                                                                 OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return
         (symbolTbl.GetSymbolTableRecords <ViewTableRecord>(symbolTbl.Database.TransactionManager.TopTransaction,
                                                            mode, filter, false));
 }
Exemplo n.º 11
0
 public SymbolTableWrapper(SymbolTable symbolTable, OpenMode mode, SymbolTableRecordFilter filter)
     : this(symbolTable.Database.TransactionManager.TopTransaction, symbolTable, mode, filter)
 {
 }
        ///<overloads>
        /// <summmary>
        /// You can not edit a dependent block(a block that is inside from xref) from the referenced drawing.
        /// The default is not to include dependent blocks since typically you will work on blocks that are contained
        /// inside the drawing, and it saves time by not opening the DbObject and comparing
        /// BlockTableRecord.ObjectId.OriginalDatabase.UnmanagedObject to the BlockTable.Database.UnmanagedObject property.
        /// </summmary>
        /// </overloads>
        /// <summary>
        /// Gets the block table records.
        /// </summary>
        /// <param name="symbolTbl">The symbol table.</param>
        /// <param name="trx">The TRX.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="filter"><see cref="SymbolTableRecordFilter"/>.</param>
        /// <returns>IEnumerable{BlockTableRecord}</returns>

        public static IEnumerable <BlockTableRecord> GetBlockTableRecords(this BlockTable symbolTbl, Transaction trx,
                                                                          OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
        {
            if (filter.IsSet(SymbolTableRecordFilter.IncludeDependent))
            {
                return(symbolTbl.GetSymbolTableRecords <BlockTableRecord>(trx, mode, filter, true));
            }
            return(symbolTbl.GetSymbolTableRecords <BlockTableRecord>(trx, mode, filter, true).NonDependent());
        }
 /// <summary>
 /// Gets the dim style table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="trx">The TRX.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="filter">The filter.</param>
 /// <returns></returns>
 public static IEnumerable <DimStyleTableRecord> GetDimStyleTableRecords(this DimStyleTable symbolTbl,
                                                                         Transaction trx, OpenMode mode = OpenMode.ForRead,
                                                                         SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return(symbolTbl.GetSymbolTableRecords <DimStyleTableRecord>(trx, mode, filter, true));
 }
 /// <summary>
 /// Gets the dim style table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="trx">The TRX.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="filter">The filter.</param>
 /// <returns></returns>
 public static IEnumerable<DimStyleTableRecord> GetDimStyleTableRecords(this DimStyleTable symbolTbl,
     Transaction trx, OpenMode mode = OpenMode.ForRead,
     SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return symbolTbl.GetSymbolTableRecords<DimStyleTableRecord>(trx, mode, filter, true);
 }
 /// <summary>
 /// Gets the block table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="mode">OpenMode</param>
 /// <param name="filter"><see cref="SymbolTableRecordFilter"/>.</param>
 /// <returns>IEnumerable{BlockTableRecord}</returns>
 /// <example>
 /// <code source=".\Content\Samples\Samplescsharp\AcDbMgdExtensions\DatabaseServices\BlockTableExtensionsCommands.cs" language="cs" region="GetBlockTableRecords" />
 /// <code source=".\Content\Samples\Samplesvb\AcDbMgdExtensions\DatabaseServices\BlockTableExtensionsCommands.vb" language="VB" region="GetBlockTableRecords" />
 /// </example>
 public static IEnumerable<BlockTableRecord> GetBlockTableRecords(this BlockTable symbolTbl,
     OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return symbolTbl.GetBlockTableRecords(symbolTbl.Database.TransactionManager.TopTransaction, mode, filter);
 }
Exemplo n.º 16
0
 public SymbolTableWrapper(Transaction trx, SymbolTable symbolTable, OpenMode mode, SymbolTableRecordFilter filter)
 {
     this.trx       = trx;
     this.symbolTbl = symbolTbl;
     this.filter    = filter;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Gets the shape file table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="filter">The filter.</param>
 /// <returns></returns>
 public static IEnumerable <TextStyleTableRecord> GetShapeFileTableRecords(this TextStyleTable symbolTbl,
                                                                           OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return(symbolTbl.GetShapeFileTableRecords(symbolTbl.Database.TransactionManager.TopTransaction, mode, filter));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Determines whether the specified test flag is set.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <param name="testFlag">The test flag.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentNullException">testFlag</exception>
 public static bool IsSet(this SymbolTableRecordFilter filter, SymbolTableRecordFilter testFlag)
 {
     if (testFlag == 0)
     {
         throw new ArgumentNullException("testFlag");
     }
     return (filter & testFlag) == testFlag;
 }