The method you want to use is Grasshopper.Instances.ActiveCanvas.InstantiateNewObject
create GH component from name.gh (3.6 KB)
code:
private void RunScript(string name, bool go)
{
if(wasgo & !go){
id = Rhino.NodeInCode.Components.FindComponent(name).ComponentGuid;
wasgo = false;
GrasshopperDocument.ScheduleSolution(5, CreateComponent);
}else{
if(go)wasgo = true;
}
}
// <Custom additional code>
bool wasgo;
System.Guid id;
private void CreateComponent(GH_Document doc){
Grasshopper.Instances.ActiveCanvas.InstantiateNewObject(id, new System.Drawing.PointF(0, 0), true);
}
Also:
create GH component from guid.gh (7.1 KB)