2 人赞同了该文章<br><h2>问题</h2><br>在Rhino7中GH占位电池选择不了,该如何删除?<br><img><br>这段代码要正常运行,需要using System.Linq;<br>if(delete) { var doc = this.Component.OnPingDocument(); if(doc == null)return; var objs = doc.Objects; var deleteComs = objs.Where(o => o.GetType().ToString() == "Grasshopper.Kernel.Components.GH_PlaceholderComponent").ToList(); if(deleteComs == null || deleteComs.Count == 0)return; doc.ScheduleSolution(20, (d) => doc.RemoveObjects(deleteComs, false)); }<br><img><br>下面是Python的版本<br>if(delete): doc = ghenv.Component.OnPingDocument() if(doc != None): objs = doc.Objects deleteComs = [obj for obj in objs if(str(type(obj))== "")] if(deleteComs!=None): func = lambda d:doc.RemoveObjects(deleteComs, False) doc.ScheduleSolution(20, func )<br><img><br>源文件获取<br>赞同 2<br>添加评论<br>分享