Multiple links on a port


#1

I found that it is possible to link multiple links(from several nodes) to a port on a specific node. so I overrode the CanLinkFrom and CanLinkTo method. but, I couldn’t connect two node at a specific port which is already linked by other node. from a port making serveral links is possible, but to a port making several links is impossible. why is this problem raised?


#2

I’m not sure I understand your situation.
Note that CanLinkFrom and CanLinkTo just operate on individual GoPorts–they aren’t predicates on pairs of ports. Override IsValidLink on either GoPort or GoToolLinkingNew to customize that behavior.
Perhaps your situation is trying to draw multiple links between the same pair of ports? That’s controlled by GoPort.IsValidDuplicateLinks, which defaults to false. You might want to check out the other IsValid… properties on GoPort, to see if they are relevant in this case.


#3

for a example, What I want to do is figure 1, currently I couldn’t link two 2 links from different node(aa1,aa3) to a single port on a node(aa2)


#4

You don’t say whether there is only a single relevant port on “aa2” and what its properties are or if any relevant port methods have been overridden. Are you using a GoBoxPort or just a GoPort?
Certainly the default behavior that GoDiagram provides supports users drawing links as shown in your figure 1. If you run any of the sample applications such as ProtoApp or Demo1, you should see what you want.


#5

hmm, I’m currently programming from ProtoApp, and using MultiPortNode inherited from GoIconicNode.- with MultiNodePort as you provided in the product.-
I couldn’t capture up what’s happening here-


#6

Could you let me know what I have to resolve this problem?
Basically, I couldn’t connect two links from two diffrent nodes to a port in a node which has totally 4 ports on that node if that port is linked by other node(which is not of the above two nodes).
is there a method to override to handle this problem?


#7

That’s very odd. If you run the ProtoApp.exe that is installed with the kit, are you saying you can’t create three nodes and have two of the nodes linked to the third one?
Processor is a sample application that has a subclass of GoPort that supports a MaxLinks property, to let you specify a maximum number of links that may be connected to that port. But by default, there is no limit.
How did you override GoPort’s CanLinkFrom and CanLinkTo?