Active Member
Posts: 6
Registered: ‎07-18-2012
Message 1 of 2 (321 Views)

How to fetch xREF "Found At" Path when using No Path while Attaching

321 Views, 1 Replies
03-01-2013 02:53 AM



I am attaching a File as a xRef. At the time of Attachment, I select attach as attachment, and No Path in Path.

Now if I try to fetch detail of this file using MdiActiveDocument.Database and BlockTableRecord, I gets only file name not the path. However, In AutoCAD we can see the file path under "Found At". Can we read / fetch this using C#.


In cas of Full Path or relative Path, I gets full path in btr.PathName


Kindly reply back ASAP. here is my code  and  I am using AutoCAD 2013


           Database db = acadApp.DocumentManager.MdiActiveDocument.Database;


            using (Transaction Trans = db.TransactionManager.StartTransaction())
                BlockTable BlkTbl = (BlockTable)Trans.GetObject(db.BlockTableId, OpenMode.ForRead,false,true);
                db.ResolveXrefs(false, false);
                XrefGraph XrGph = db.GetHostDwgXrefGraph(true);
                XrefArray = new MyXrefInfo[XrGph.NumNodes - 1]; //A Strucuture Array for all xRef;

                for (int i = 1; i < XrGph.NumNodes; i++)
                    XrefGraphNode XrNode = XrGph.GetXrefNode(i);
                    BlockTableRecord btr = (BlockTableRecord)Trans.GetObject(XrNode.BlockTableRecordId,     OpenMode.ForRead);
                    MyXrefInfo  XrInfo = new MyXrefInfo();  //A Strucuture object for each xRef;
                    XrInfo.Name = XrNode.Name;
                    XrInfo.Path = btr.PathName;
                    XrInfo.DrawingPath = db.Filename;

                    XrefArray[i - 1] = XrInfo;





Valued Mentor
Posts: 370
Registered: ‎05-06-2012
Message 2 of 2 (302 Views)

Re: How to fetch xREF "Found At" Path when using No Path while Attachi

03-01-2013 06:01 AM in reply to: hbjadeja

If you don't provide a path, the library path is searched. You can search the library path using HostApplicationServices.Current.FindFile().

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.