Beispiel #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="blockRef"></param>
 public AttriBlock(BlockReference blockRef, string space)
 {
     //
     BlockRef = blockRef;
     Space    = space;
     Handle   = blockRef.Handle;
     X        = blockRef.Position.X;
     Y        = blockRef.Position.Y;
     AttRefs  = blockRef.GetAttributeReferences();
 }
        /// <summary>
        /// Gets the attribute reference dictionary.
        /// </summary>
        /// <param name="bref">The bref.</param>
        /// <param name="trx">The TRX.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="includingErased">if set to <c>true</c> [including erased].</param>
        /// <param name="openObjectsOnLockedLayers">if set to <c>true</c> [open objects on locked layers].</param>
        /// <returns></returns>
        /// <exception cref="Autodesk.AutoCAD.Runtime.Exception"></exception>
        public static Dictionary <string, AttributeReference> GetAttributeReferenceDictionary(this BlockReference bref,
                                                                                              Transaction trx, OpenMode mode = OpenMode.ForRead, bool includingErased = false,
                                                                                              bool openObjectsOnLockedLayers = false)
        {
            if (trx == null)
            {
                throw new Exception(ErrorStatus.NoActiveTransactions);
            }

            return
                (bref.GetAttributeReferences(trx, mode, includingErased, openObjectsOnLockedLayers)
                 .ToDictionary(a => a.Tag));
        }
 /// <summary>
 /// Gets the attribute references.
 /// </summary>
 /// <param name="bref">The bref.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="includingErased">if set to <c>true</c> [including erased].</param>
 /// <param name="openObjectsOnLockedLayers">if set to <c>true</c> [open objects on locked layers].</param>
 /// <returns></returns>
 public static IEnumerable <AttributeReference> GetAttributeReferences(this BlockReference bref,
                                                                       OpenMode mode = OpenMode.ForRead, bool includingErased = false, bool openObjectsOnLockedLayers = false)
 {
     return(bref.GetAttributeReferences(bref.Database.TransactionManager.TopTransaction, mode, includingErased,
                                        openObjectsOnLockedLayers));
 }