Hi,
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
Regards,
Raman
Solved! Go to Solution.
Solved by Hallex. Go to Solution.
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.
Regards,
Philippe.
Here is a code I've found in my code library,
change it to your needs:
[CommandMethod("ImageName")] public void GetImageFileName() { Document doc=Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed= doc.Editor; ErrorStatus es = new ErrorStatus(); try { 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; Application.ShowAlertDialog(filename); tr.Commit(); } } catch (Autodesk.AutoCAD.Runtime.Exception ex) { Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage (ex.Message + "\n" + ex.StackTrace); } finally { ed.WriteMessage("\n{0}", es.ToString()); } }
~'J'~