2 人赞同了该文章

问题

在Rhino7中GH占位电池选择不了,该如何删除?
这段代码要正常运行,需要using System.Linq;
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)); }
下面是Python的版本
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 )
源文件获取
赞同 2
添加评论
分享