Results 1 to 4 of 4

Thread: Edit the reference name for a Xref via ObjectARX

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2006-08
    Posts
    1
    Login to Give a bone
    0

    Question Edit the reference name for a Xref via ObjectARX

    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

  2. #2
    Super Moderator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,671
    Login to Give a bone
    0

    Default Re: Edit the reference name for a Xref via ObjectARX

    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 |

  3. #3
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,653
    Login to Give a bone
    0

    Default Re: Edit the reference name for a Xref via ObjectARX

    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

  4. #4
    Member
    Join Date
    2007-06
    Posts
    15
    Login to Give a bone
    0

    Default Re: Edit the reference name for a Xref via ObjectARX

    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);
    }

Similar Threads

  1. editing xref without changing reference
    By mbrandt5 in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2015-04-15, 09:55 PM
  2. 2013: Block reference turns into xref
    By jgrande26 in forum AutoCAD General
    Replies: 1
    Last Post: 2013-01-16, 09:08 AM
  3. identify the circular reference in an Xref
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2011-11-18, 08:33 PM
  4. Can you edit reference planes?
    By bnelson.188587 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2008-07-22, 06:25 PM
  5. Xref "circular reference
    By alan.rackham in forum AutoCAD General
    Replies: 7
    Last Post: 2007-07-10, 05:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •