WOOOOOOOOHHHHHOOOOOOOOO .Net kicks butt!!!!
Ok, I made some progress. I was able to bind 1 xref fairly simply. Please critique what you can, and see if I could do it better. Thanks to Glenn R for the idea, and TW for pointing me in the direction of Glenn's code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
namespace XrefBind
{
public class DSHClass
{
[CommandMethod("BindTep")]
static public void BindTitleBlocks()
{
Document Doc = AcadApp.DocumentManager.MdiActiveDocument;
Database Db = Doc.Database;
Editor Ed = Doc.Editor;
XrefGraph XG = Db.GetHostDwgXrefGraph(true);
if (XG.IsEmpty || XG.NumNodes == 1)
{
return;
}
using (Transaction Trans = Doc.TransactionManager.StartTransaction())
{
BlockTable BT = Trans.GetObject(Db.BlockTableId, OpenMode.ForRead) as BlockTable;
for (int i = 0; i < XG.NumNodes; i++)
{
XrefGraphNode XGN = XG.GetXrefNode(i) as XrefGraphNode;
if (XGN.Name.ToUpper() == "TEP")
{
BlockTableRecord BTR = Trans.GetObject(XGN.BlockTableRecordId, OpenMode.ForRead, false) as BlockTableRecord;
ObjectIdCollection OIC = new ObjectIdCollection();
OIC.Add(BTR.Id);
Db.BindXrefs(OIC, true);
}
}
Trans.Commit();
}
}
}
}