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

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

1 REPLY 1
Reply
Message 1 of 2
hbjadeja
568 Views, 1 Reply

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

Hi,

 

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;

                }

       }

 

 

1 REPLY 1
Message 2 of 2

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

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