繁体   English   中英

删除实体及其所有集合数据的正确方法是什么?

[英]What is the correct way to remove an entity and all of its collection data?

在 Eyeshot 中,从作为BlockReferenceModel中删除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);
}

Model.Purge()方法:从Environment master collections(层、块、材料等)中删除未使用的项目

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM