0

在 Eyeshot 中,EntityModelthat is a中删除 an 的最佳方法是BlockReference什么?
有没有方法可以帮助清理所有Blocks基于的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);
}
4

1 回答 1

1

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

于 2021-12-23T07:29:20.640 回答