Hi,
If you open xref manager you can edit the reference name for xref. I want to do the same thing programatically using ObjectARX. Can anyone tell me how to do this?
Thanks,
Abhilash
|
Hi,
If you open xref manager you can edit the reference name for xref. I want to do the same thing programatically using ObjectARX. Can anyone tell me how to do this?
Thanks,
Abhilash
You might want to ask in the Autodesk ObjectARX discussion group:
NNTP: news://discussion.autodesk.com/autod...ocad.objectarx
HTTP: http://discussion.autodesk.com/forum.jspa?forumID=34
R.K. McSwain | CAD Panacea |
Hi Abhilash
Please note I have *moved* this thread from the AutoCAD 2007 General forum to this one, as I feel this particular forum is a more appropriate place for such a topic.
Thanks, Mike
Forum Manager
Hi Abhilash
I think I have solution to your question. Recently I had to change Xrefs in a dwg using objectARX. I will post some code below, and hopefully that will help you.
Database db = new Database();
XrefGraph Xref = null;
XrefGraphNode XrefNode = null;
Transaction trans=null;
BlockTable Btable = null;
BlockTableRecord BTrecord = null;
try
{
db.ReadDwgFile(file.FullName, FileShare.Read, false, "");
Xref = db.GetHostDwgXrefGraph(true);
for (int k = 1; k < Xref.NumNodes; k++)//i starts from 1 because the drawing is always counted as the first reference
{
XrefNode = Xref.GetXrefNode(k);
trans = db.TransactionManager.StartTransaction();
Btable = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
BTrecord = (BlockTableRecord)trans.GetObject(Btable[XrefNode.Name], OpenMode.ForWrite);
BTrecord.Name="Assign the new name for the Xref here";
//or if you want to look for a specific reference to update
//you can you can use an if statement around the previous assignment.
trans.Commit();
trans.Dispose();
}
db.SaveAs("file destination to save",null);
}
finally
{
db.CloseInput(true);
}