Modify Wires after instantiate component

Hi, this is my first post !
Im trying to write a script that instantiate a component and then connect the created component to another component.

parentObject.Params.Output[0].AddSource(createdObject.Params.Input[0]); do the job in the debugger but when I see the canvas there’s no wire or connection.

I have tried to suscribe to Grasshopper.Kernel.GH_Document.SolutionStartEventHandler() and call .addSource from there, but doesn’t seem to create the connection.

Also tried using ScheduleSolution and call .addSource from there, but I got the same result.

I will be happy for any comments or suggestions how to solve this issue. Thanks!

private void RunScript(bool run, ref object A)
  if(!run) return;  
  var parent = new MathComponents.FunctionComponents.Component_Series();
  parent.Attributes.Pivot = new System.Drawing.PointF(100, 100);
  GrasshopperDocument.AddObject(parent, false);
  var created = new VectorComponents.PointComponents.Component_ConstructPoint();
  created.Attributes.Pivot = new System.Drawing.PointF(200, 100);
  GrasshopperDocument.AddObject(created, false);
} (2.1 KB)

1 Like

Thank you !! It works perfectly :smiley: