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
        public static bool HasXrefsInMSpace(this Document doc)
        {
            // retrieve a list of external references in entire document
            var xreflist = ProjectSetup.Xref_List(doc);

            // retrieve a list of the layouts in the document
            List <ObjectId> listoflayids = ProjectSetup.Project_ListOfLayoutIds(doc);

            // the first layout is apparently ALWAYS Model Space??
            var mspace = listoflayids[0];

            // if there are external references in the list
            if (xreflist.Count() > 0)
            {
                // cycle through each
                foreach (BlockTableRecord x in xreflist)
                {
                    // find out which Layout they have Block References in
                    ObjectId[] xref_layids = ProjectSetup.Xref_LayoutFinder(x);
                    if (xref_layids.Any().Equals(mspace))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }