Hi everyone !
I created a grasshopper programm which will be used by a customer, and i wanted to automate the publish to remote panel of every button.
But i didnt find a way to do it, even with a python script.
I think i dont have enough competencies by using the tool, so i try to find an answer here !
using Grasshopper.GUI.RemotePanel;
RcpGroup rcpg = new RcpGroup();
GrasshopperDocument.RemotePanelLayout.Add(rcpg);
rcpg.Expand();
var objs = Component.Params.Input[0].Sources;
foreach (var o in objs){
if (o is IRcpAwareObject){
IRcpAwareObject rcpo = (IRcpAwareObject) o;
var proxy = rcpo.PublishRcpItem();
if (proxy != null)
rcpg.AddItem(proxy);
}
}
GrasshopperDocument.RemotePanelLayout.OnLayoutChanged();
Be ware that this snippet keeps adding the same controls repeatedly when the c# recomputes. You can use component Guids to manage a look-up to avoid it.