I need create a smartcomponent with “system name” and “system function” as input property. The smart component can make the IOConnection inside itself with the input system name. I wonder if it’s possible to do this? Is any one have experience with this?
I saw there are class “IOConnection” in robotstuido SDK,
public IOConnection(
ProjectObject sourceObject,
string sourceSignal,
ProjectObject targetObject,
string targetSignal
)
I don't know how to define sourceObject. Do you have some experience?
Thanks a lot
I have add a function to create connection of signals between two objects. As the following example, the signal will be connected from a.dotest1 to b.ditest1. But I have tested the code, it’s not work. I have check the code have been executed. What’s the reason the signal can’t be connected with each other.
public void ConnectIO(SmartComponent component)
{
ProjectObject a = (ProjectObject)component.Properties[“ObjectA”].Value;
ProjectObject b = (ProjectObject)component.Properties[“ObjectB”].Value;
IOConnection IOConn1 = new IOConnection(a, “dotest1”, b, “ditest1”);
IOConn1.Update();
In Update() method, you get this remark too:
There is normally no need to call this method since the connection is updated automatically whenever the source signal changes.
We have simulation station with many robot controllers. Their have many communication between them. Normally we manually map the connection with station logic “IO Connection” page. The robot IO signals is standard. To make simulation easier, I want make a smart component to do this job. You just need define the system name and the smart component can map the connection automatically. I have tried with and without Update() method, both doesn’t work. I don’t know what’s the problem actually.
public void ConnectIO(SmartComponent component)
{
ProjectObject a = (ProjectObject)component.Properties[“ObjectA”].Value;
ProjectObject b = (ProjectObject)component.Properties[“ObjectB”].Value;
IOConnection ioConn1 = new IOConnection(a, “dotest1”, b, “ditest1”);
Station station = component.ContainingProject as Station;
station.Connections.Add(ioConn1);
station.Connections.Clear();
}
Thanks your support, now the connection auto map is OK. I also test the connections.Clear(), but found the clear can’t clear the connection. Any mistake I made?