Author Topic: Iterate through xref question  (Read 181 times)

0 Members and 1 Guest are viewing this topic.

nobody

  • Swamp Rat
  • Posts: 816
  • .net stuff
Iterate through xref question
« on: February 24, 2020, 02:24:16 AM »
I'm using .GetXrefDatabase(false) to iterate through xref, starting a transaction with that database and committing it when I'm done iterating through. Is there anything wrong with this? Generally I try avoiding digging through xrefs if I can.

Code: [Select]
var xdb = bd.GetXrefDatabase(false);

                                if (xdb != null)

                                {
                                    using (Transaction xrt = xdb.TransactionManager.StartTransaction())
                                    {
                                        BlockTableRecord btRecord = (BlockTableRecord)xrt.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(xdb), OpenMode.ForRead);

T.Willey

  • Needs a day job
  • Posts: 5237
Re: Iterate through xref question
« Reply #1 on: March 20, 2020, 03:38:14 PM »
It's been awhile since I looked at .Net, but this looks like you will only change the definition within the current drawing not the actual xref drawing.  You would need to get the path to the external drawing, open that and change the information, close and reload the xref.  Hope that helps.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.