コード例 #1
0
        References(string label, AcDb.ObjectId val)
            :   base(label)
        {
            m_val = val;

            if (m_val.IsNull == false)
            {
                using (TransactionHelper trHlp = new TransactionHelper(m_val.Database)) {
                    trHlp.Start();

                    AcDb.DBObject dbObj = trHlp.Transaction.GetObject(m_val, AcDb.OpenMode.ForRead);

                    MgdDbg.Utils.ReferenceFiler filer = new MgdDbg.Utils.ReferenceFiler();
                    dbObj.DwgOut(filer);

                    trHlp.Commit();

                    m_hardPointerIds   = filer.m_hardPointerIds;
                    m_softPointerIds   = filer.m_softPointerIds;
                    m_hardOwnershipIds = filer.m_hardOwnershipIds;
                    m_softOwnershipIds = filer.m_softOwnershipIds;
                }

                if ((m_hardPointerIds.Count == 0) && (m_softPointerIds.Count == 0) && (m_hardOwnershipIds.Count == 0) && (m_softOwnershipIds.Count == 0))
                {
                    m_hasRefs = false;
                }
                else
                {
                    m_hasRefs = true;
                }
            }
        }
コード例 #2
0
ファイル: ReferencedBy.cs プロジェクト: zhengjian211/MgdDbg
        ProcessObject(TransactionHelper trHelp, AcDb.ObjectId lookForObjId, AcDb.ObjectId curObjId)
        {
            AcDb.DBObject tmpObj = trHelp.Transaction.GetObject(curObjId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead);
            if (tmpObj != null)
            {
                m_count++;
                MgdDbg.Utils.ReferenceFiler filer = new MgdDbg.Utils.ReferenceFiler();
                tmpObj.DwgOut(filer);                          // find out who this object owns

                RecordReferences(lookForObjId, tmpObj, filer); // record references for this object

                // now recursively visit all the objects this one owns
                for (int i = 0; i < filer.m_hardOwnershipIds.Count; i++)
                {
                    ProcessObject(trHelp, lookForObjId, filer.m_hardOwnershipIds[i]);
                }

                for (int i = 0; i < filer.m_softOwnershipIds.Count; i++)
                {
                    ProcessObject(trHelp, lookForObjId, filer.m_softOwnershipIds[i]);
                }
            }
            else
            {
                m_skipped++;
            }
        }
コード例 #3
0
ファイル: ReferencedBy.cs プロジェクト: zhengjian211/MgdDbg
        RecordReferences(AcDb.ObjectId lookForObjId, AcDb.DBObject objToCheck, MgdDbg.Utils.ReferenceFiler filer)
        {
            // now see if we showed up in any of the lists
            if (filer.m_hardPointerIds.Contains(lookForObjId))
            {
                m_hardPointerIds.Add(objToCheck.ObjectId);
            }

            if (filer.m_softPointerIds.Contains(lookForObjId))
            {
                m_softPointerIds.Add(objToCheck.ObjectId);
            }

            if (filer.m_hardOwnershipIds.Contains(lookForObjId))
            {
                m_hardOwnershipIds.Add(objToCheck.ObjectId);
            }

            if (filer.m_softOwnershipIds.Contains(lookForObjId))
            {
                m_softOwnershipIds.Add(objToCheck.ObjectId);
            }
        }