foreach ( var obj in dlg.GetChildren() )
{
if ( obj.ObjectType == ObjectType.Connection )
{
var srcPin = obj[ObjectPropertyNames.SourcePin] as ObjectProxy;
if ( srcPin != null && srcPin.Id == myPin.Id )
{
// found a connection at the given pin, get the target pin and target object
var tgtPin = obj[ObjectPropertyNames.TargetPin] as ObjectProxy;
var tgtObj = obj[ObjectPropertyNames.Target] as ObjectProxy;
}
}
}
[Nevigo] Peter Sabath wrote:Hi doday,
The linking elements in the Flow are the "Connection" objects. This Objects are Children of the container object.
For example if your context object is a dialog whose object proxy is in the variable "dlg" you can collect all connections:
- Code: Select all
foreach ( var obj in dlg.GetChildren() )
{
if ( obj.ObjectType == ObjectType.Connection )
{
var srcPin = obj[ObjectPropertyNames.SourcePin] as ObjectProxy;
if ( srcPin != null && srcPin.Id == myPin.Id )
{
// found a connection at the given pin, get the target pin and target object
var tgtPin = obj[ObjectPropertyNames.TargetPin] as ObjectProxy;
var tgtObj = obj[ObjectPropertyNames.Target] as ObjectProxy;
}
}
}
depending on you use case you might first collect all connections of a context object if you need to check them multiple times.
objectproxyA.GetOutputPins[position] == connection["SourcePin"]
//And
objectproxyB.GetInputPins[position] == connection["TargetPin"]
//Implying position gave an existing escenario
//If those two conditions are met there exist a connection between objectproxyA & objectproxyB
connection["Source"] == ObjectProxyA && connection["Target"] == ObjectProxyB
if ( (int)connection[TargetPin][PinIndex] == 0 )
{
// pin is connected to the topmost pin
}
Return to articy:draft Macro Devkit
Users browsing this forum: No registered users and 2 guests