.NET

Reply
Valued Contributor
RamanSBV
Posts: 86
Registered: ‎02-28-2012
Message 1 of 2 (165 Views)
Accepted Solution

Getting attached file details in Drawing file

165 Views, 1 Replies
08-27-2012 03:52 AM

Hi,

 

 

Please guide me In retrieving  attached file details of drawing file

 

 

1. Attach DWG -- db.GetHostDwgXrefGraph(true);

2. Attach Image -- 

3. Attach DWF --   

4. Arttach DGN --

5. Attach PDF --

 

Regards,

Raman

ADN Support Specialist
philippe.leefsma
Posts: 562
Registered: ‎06-02-2009
Message 2 of 2 (141 Views)

Re: Getting attached file details in Drawing file

08-28-2012 01:41 AM in reply to: RamanSBV

You have to access the corresponding dictionary from the NOD and iterate through its content.

 

For example here is how to access the attached PDF dictionary and reload the pdfs:

 

 [CommandMethod("PdfNetReload")]
        static public void PdfNetReload()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            using (Transaction Tx = db.TransactionManager.StartTransaction())
            {
                DBDictionary nod = Tx.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) as DBDictionary;

                string defDictKey = UnderlayDefinition.GetDictionaryKey(typeof(PdfDefinition));

                if (!nod.Contains(defDictKey))
                    return;

                DBDictionary pdfDict = Tx.GetObject(nod.GetAt(defDictKey), OpenMode.ForWrite) as DBDictionary;

                foreach (DBDictionaryEntry entry in pdfDict)
                {
                    PdfDefinition entryObj = Tx.GetObject(entry.Value, OpenMode.ForWrite) as PdfDefinition;
                    entryObj.Load(null);

                    ObjectIdCollection collection = entryObj.GetPersistentReactorIds();

                    foreach (ObjectId id in collection)
                    {
                        DBObject temObject = Tx.GetObject(id, OpenMode.ForRead);

                        if (temObject is PdfReference)
                        {
                            PdfReference pdfref = temObject as PdfReference;
                            pdfref.UpgradeOpen();
                            pdfref.RecordGraphicsModified(true);
                        }
                    }
                }

                Tx.Commit();
            }
        }

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community