Here is one I wrote with the help of Glenn R. over at theswamp.org
using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly: CommandClass (typeof(Test.Xref))]
namespace Test
{
///
/// Description of Xref.
///
public class Xref
{
[CommandMethod("XrGraphTest")]
static public void GraphTest()
{
Document ActDoc = acadApp.DocumentManager.MdiActiveDocument;
Database DocDb = ActDoc.Database;
Editor DocEd = ActDoc.Editor;
using (Transaction DocDbTrans = DocDb.TransactionManager.StartTransaction())
{
BlockTable DocDbBlkTbl =
(BlockTable)DocDbTrans.GetObject(DocDb.BlockTableId, OpenMode.ForRead);
XrefGraph DocDbXrGraph = DocDb.GetHostDwgXrefGraph(false);
for (int i = 0; i
{
XrefGraphNode XrGraphNode = DocDbXrGraph.GetXrefNode(i);
if (DocDbXrGraph.HostDrawing.Name == XrGraphNode.Name)
{
DocEd.WriteMessage("Drawing Name: {0}, In: {1}, Out: {2}", XrGraphNode.Name,
XrGraphNode.NumIn, XrGraphNode.NumOut);
}
else
{
DocEd.WriteMessage("Name: {0}, In: {1}, Out: {2}", XrGraphNode.Name,
XrGraphNode.NumIn, XrGraphNode.NumOut);
}
if (XrGraphNode.NumOut > 0)
{
OutNodePrint1(XrGraphNode);
}
}
}
}
static public void OutNodePrint1(XrefGraphNode XrGraphNode)
{
Document ActDoc = acadApp.DocumentManager.MdiActiveDocument;
Editor DocEd = ActDoc.Editor;
for (int i = 0; i < XrGraphNode.NumOut; ++i)
{
XrefGraphNode tmpNode = XrGraphNode.Out(i) as XrefGraphNode;
if (tmpNode != null)
{
DocEd.WriteMessage(" {0}", tmpNode.Name);
}
else
{
DocEd.WriteMessage(" Not found as an "XrefGraphNode"!");
}
}
}
}
}
--
Tim
"A blind man lets nothing block his vision."
wrote in message news:5303614@discussion.autodesk.com...
Thanks Willey!
But I didn't find any example on XrefGraph. Please can you help me?
Thanks