TheSwamp

Code Red => .NET => Topic started by: latour_g on August 28, 2017, 04:01:29 PM

Title: Explode block with annotative state
Post by: latour_g on August 28, 2017, 04:01:29 PM
Hi,

I need to explode a block that contains annotative objects.   The problem I have is the annotative state get loose after the explode.  Here is what I have :

Code - C#: [Select]
  1. DBObjectCollection coll = new DBObjectCollection();
  2. br.Explode(coll);
  3. System.Collections.IEnumerator iter = coll.GetEnumerator();
  4.  
  5. while (iter.MoveNext())
  6. {
  7.        Entity ent = (Entity)iter.Current;
  8.        ent.SetDatabaseDefaults();
  9.        btr.AppendEntity(ent);
  10.        tr.AddNewlyCreatedDBObject(ent, true);
  11. }
  12.  
  13. br.Erase();
  14. coll.Dispose();

When debugging, I see that "ent" has AnnotativeState at true.
Title: Re: Explode block with annotative state
Post by: Bryco on August 29, 2017, 12:06:20 AM
That may involve deep clone. I clone objects and they do not copy the xdata so you may have the same problem.
basically you deep clone the objects from the block and transform them using the blockref.BlockTransform
Title: Re: Explode block with annotative state
Post by: latour_g on August 30, 2017, 03:05:55 PM
Thanks Bryco I'm gonna check this out