0

In Eyeshot, what is the best way to remove an Entity from the Model that is a BlockReference?
Are there methods to help clean up all the Blocks based on BlockReference?

// assume "model1" is the Eyeshot control 

List<Entity> entities = GetEntitiesToRemove();
foreach (var entity in entities)
{
   if (entity is BlockReference reference)
   {
       // What to do here to clean up the associated blocks?  This code will only find the
       // parent block for the entity
       var block = model1.Blocks.FirstOrDefault(b => b.Name == reference.BlockName);
       if (block != null)
       {
           model1.Blocks.Remove(block);  //This is only removing the parent block 
       }
   }
   model1.Entities.Remove(entity);
}
Progman
  • 16,827
  • 6
  • 33
  • 48
Dan Liebster
  • 455
  • 5
  • 22

1 Answers1

1

Model.Purge() method: Removes unused items from the Environment master collections (Layers, Blocks, Materials, etc.)

abenci
  • 8,422
  • 19
  • 69
  • 134