Example #1
0
        public static List <AttributeRefInfo> GetAttrDefs(ObjectId idBtr)
        {
            var resVal = new List <AttributeRefInfo>();

            if (idBtr.IsNull)
            {
                return(resVal);
            }
            using (var btr = (BlockTableRecord)idBtr.Open(OpenMode.ForRead))
            {
                foreach (var idEnt in btr)
                {
                    using (var attrDef = (AttributeDefinition)idEnt.Open(OpenMode.ForRead, false, true))
                    {
                        if (attrDef == null)
                        {
                            continue;
                        }
                        var attrDefInfo = new AttributeRefInfo(attrDef);
                        resVal.Add(attrDefInfo);
                    }
                }
            }

            return(resVal);
        }
Example #2
0
        public static List <AttributeRefInfo> GetAttrRefs([CanBeNull] BlockReference blRef)
        {
            var resVal = new List <AttributeRefInfo>();

            if (blRef?.AttributeCollection != null)
            {
                foreach (ObjectId idAttrRef in blRef.AttributeCollection)
                {
                    using var atrRef = (AttributeReference)idAttrRef.Open(OpenMode.ForRead, false, true);
                    var ai = new AttributeRefInfo(atrRef);
                    resVal.Add(ai);
                }
            }

            return(resVal);
        }
Example #3
0
        public static List<AttributeRefInfo> GetAttrDefs(ObjectId idBtr)
        {
            List<AttributeRefInfo> resVal = new List<AttributeRefInfo>();

             if (!idBtr.IsNull)
             {
            using (var btr = idBtr.Open(OpenMode.ForRead) as BlockTableRecord)
            {
               foreach (var idEnt in btr)
               {
                  using (var attrDef = idEnt.Open(OpenMode.ForRead, false, true) as AttributeDefinition)
                  {
                     if (attrDef != null)
                     {
                        var attrDefInfo = new AttributeRefInfo((DBText)attrDef);
                        resVal.Add(attrDefInfo);
                     }
                  }
               }
            }
             }
             return resVal;
        }
Example #4
0
 public static List<AttributeRefInfo> GetAttrRefs(BlockReference blRef)
 {
     List<AttributeRefInfo> resVal = new List<AttributeRefInfo>();
      if (blRef?.AttributeCollection != null)
      {
     foreach (ObjectId idAttrRef in blRef.AttributeCollection)
     {
        using (var atrRef = idAttrRef.Open( OpenMode.ForRead, false, true)as AttributeReference)
        {
           AttributeRefInfo ai = new AttributeRefInfo(atrRef);
           resVal.Add(ai);
        }
     }
      }
      return resVal;
 }