I’m trying to dynamically add components at run-time. It seems working, but the components generated are not clickable and the document becomes heavy. Is there any magic word I’m missing?
Thanks!
var doc = Grasshopper.Instances.ActiveCanvas.Document;
for(int i = 0;i < 20;i++)
{
var newcomponent = new Grasshopper.Kernel.Components.GH_ExplodeTreeComponent();
newcomponent.CreateAttributes();
newcomponent.Attributes.Pivot = new System.Drawing.PointF((float) (i * 10 * Math.Cos(i / 2d)), (float) (i * 10 * Math.Sin(i / 2d)));
doc.Objects.Add(newcomponent);
newcomponent.ExpireSolution(true);
}
this.Component.ExpireSolution(true);