.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting attached file details in Drawing file

1 REPLY 1
SOLVED
Reply
Message 1 of 2
RamanSBV
494 Views, 1 Reply

Getting attached file details in Drawing file

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

1 REPLY 1
Message 2 of 2
philippe.leefsma
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost