【问题标题】:What is the correct way to remove an entity and all of its collection data?删除实体及其所有集合数据的正确方法是什么?
【发布时间】:2021-12-22 16:11:54
【问题描述】:

在 Eyeshot 中,从 Model(即 BlockReference)中删除 Entity 的最佳方法是什么?
是否有方法可以帮助清理基于BlockReference 的所有Blocks

// 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);
}

【问题讨论】:

    标签: c# eyeshot


    【解决方案1】:

    Model.Purge() 方法:从Environment 主集合(层、块、材质等)中删除未使用的项目

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-16
      • 2020-06-26
      • 2014-11-08
      • 1970-01-01
      相关资源
      最近更新 更多