Esempio n. 1
0
        public static bool HasXrefsInPSpace(this Document doc)
        {
            bool value = false;

            var btrlist  = ProjectSetup.GetAllBtrs();
            var xreflist = ProjectSetup.Xref_List(doc);

            List <ObjectId> listoflayids = ProjectSetup.Project_ListOfLayoutIds(doc);
            var             pspaces      = listoflayids.GetRange(1, (listoflayids.Count() - 1));

            if (xreflist.Count() > 0)
            {
                foreach (BlockTableRecord x in xreflist)
                {
                    ObjectId[] xref_layids = ProjectSetup.Xref_LayoutFinder(x);
                    if (xref_layids.Any().Equals(pspaces.Any()))
                    {
                        value = true;
                        return(value);
                    }
                }
            }

            return(value);
        }
Esempio n. 2
0
        ///Gets a List of BlockTableRecords that are External References
        ///</summary>
        ///<param name="database"> The database you want to query </param>
        ///<param name="doc"> The document you want to retrieve a list of Xrefs from </param>
        public static List <BlockTableRecord> Xref_List(Document doc)
        {
            //Create a list of all xrefs in the file
            List <BlockTableRecord> tempxrlist;
            List <BlockTableRecord> XList = new List <BlockTableRecord>();

            //Check the drawing to see if there are any xrefs
            using (Transaction Tran = doc.TransactionManager.StartTransaction())
            {
                //Get the Block table record for the entire file
                tempxrlist = ProjectSetup.GetAllBtrs();

                //Make a list of all the Xrefs in the file
                foreach (BlockTableRecord a in tempxrlist)
                {
                    if (a.IsFromExternalReference)
                    {
                        XList.Add(a);
                    }
                }
                //Complete the command
                Tran.Commit();
            }
            return(XList);
        }