Valued Contributor
Posts: 85
Registered: ‎02-28-2012
Message 1 of 3 (133 Views)
Accepted Solution

Getting the Attach Images file details

133 Views, 2 Replies
08-27-2012 03:12 AM




Please guide me


For retrieving information about attach DWG file there is a API call "db.GetHostDwgXrefGraph(true)"


Similarly is there any API call for Attach Image files







ADN Support Specialist
Posts: 467
Registered: ‎06-02-2009
Message 2 of 3 (112 Views)

Re: Getting the Attach Images file details

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

Hi There,


You can use the static API "RasterImageDef.GetImageDictionary".


This will return the id of the RasterImage dictionary. Iterating through its record will give you access to the "RasterImageDef" objects.




Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

*Expert Elite*
Posts: 1,557
Registered: ‎10-08-2008
Message 3 of 3 (106 Views)

Re: Getting the Attach Images file details

08-28-2012 04:58 AM in reply to: RamanSBV

Here is a code I've found in my code library,

change it to your needs:



        public void GetImageFileName()
            Document doc=Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed= doc.Editor;
            ErrorStatus es = new ErrorStatus();
                    using (Transaction tr = db.TransactionManager.StartTransaction())

                        ObjectId imageDictId = RasterImageDef.GetImageDictionary(db);
                        DBDictionary imageDict = tr.GetObject(imageDictId, OpenMode.ForRead) as DBDictionary;
                        ObjectId rasterId = ed.GetEntity("\nSelect an image: ").ObjectId;
                        RasterImage image = tr.GetObject(rasterId, OpenMode.ForRead) as RasterImage;
                        ObjectId imageDefId = imageDict.GetAt(image.Name);
                        RasterImageDef imageDef = tr.GetObject(imageDefId, OpenMode.ForWrite) as RasterImageDef;
                        string filename = imageDef.ActiveFileName;


            catch (Autodesk.AutoCAD.Runtime.Exception ex)
                    (ex.Message + "\n" + ex.StackTrace);
                ed.WriteMessage("\n{0}", es.ToString());




You are not logged in.

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

Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

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

Ask the Community