TheSwamp

Code Red => .NET => Topic started by: nobody on February 24, 2020, 02:24:16 AM

Title: Iterate through xref question
Post by: nobody 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);
Title: Re: Iterate through xref question
Post by: T.Willey 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.