Controlling link length

I would like to implement a short length link that from one side connects to a regular node and on the other side connects to a dummy node with the width=height=Zero. This way the link that will be shown as if it has only one end.
But how can i control the length of the link ?
If i don’t set the nodes position values, the link goes very long.
Is there any way to control the link length without setting the nodes position ?

If the link is going to be connecting two nodes, then the link’s route depends on the locations of those two nodes.

Did you know that you can have links that are only partly connected or are fully disconnected? I.e. with Link.fromNode and/or Link.toNode being null? See the Draggable Link sample. Draggable Link

In fact i tried NOT setting the “to” attribute but it didn’t work.
I will try to set the toNode to null;
Still, how do i “say” the link its length ?

If you look at that Draggable Link sample, you can see a completely disconnected Link in the Palette. It is initialized with its route – the Link.points property.

If you try it out, you can drop a node into the main diagram and then draw a link from one of the node’s ports. It will be only connected at one end. If you drag the node, the disconnected end point of the link will remain stationary. This is the behavior you will find in drawing applications such as Visio.

However if you select both the Node and its connected Links, the links will be dragged along.

If you really don’t want to have to select the connected LInks in order to drag them along, you can customize the DraggingTool by overriding DraggingTool.computeEffectiveCollection to automatically include all partly connected Links that are connected to selected Nodes.

I tried creating a new link data with to:"" and some points :

and this is what i got :

Actually, i need to a create a shot length link like in the following pic :

Actually, the link is a dummy link.
It was created to show the port name (‘XXXXX’) by the node .
I would like to use the simple node/link data model, and not use Adornment OR ports model.

Is there a node whose key is “”? Try not setting to.

Is there a new go.Binding("points") on the link template? Otherwise there is no way to make use of that data property.

There is no node with key “”.
Should i NOT set the ‘to’ attribute at all ?
Yes, there is binding to “points”.

At what location is that node that you are showing? I’m thinking that perhaps one end of the route is at (0,0) and the other is connected with the node. Thus you need to specify a route that actually connects with the one node, not (0,0),(30,0). Remember that the route’s points are in document coordinates.

Doesn’t the Draggable Link sample demonstrate what you are asking for and that I described in my earlier reply? If not, how is it different?

I have tested the draggable link sample.
It looks like it will not meet my requirements. I noticed that as soon as a link is connected to a node and the node is dragged around, the unconnected end is “stucked” in one place.
I need the link to be dragged along with the node as if it was a label/port on the node.
Maybe i’m using the wrong data model.
Maybe i should go back to Adornment/itemArray/ports model.

Above, my talking about the Draggable Link sample:

I see,
I just wanted to emphasize that the current solution uses the itemArray to hold the node ports and links are connected between the ports.
Now that we decided to discard the ports objects and to put only the ports label on the link end, i was left with one use case, when a user is creating a node with one “port” which is not connected to any link.
I thought of creating as dummy link with one end, in order to stick to the node/link native model, but i’m not sure the dummy link solution will be the smartest solution.
So, i’m thinking of just setting a label (go.Textbox) at some Spot of the node.
Any other thoughts ?

Although I’ve seen that “XXXXXX” label in your screenshots, it isn’t clear to me what the semantics are for what you want to implement.

I have implemented a network diagram editor for telecom networks.
Namely, the user drag&drop nodes (router,switch), links and ports onto the diagram, arrange the network elements and save the diagram as JSON in an oracle database.
Links are connected between ports.
The current solution, uses node’s itemArray as its ports data model.
Even-though, we will have to maintain the ports at the node’s level (in[]), we no longer need to create links between ports, but between the nodes and specify the port name on the links ends (‘XXXX’ that you saw, is a link label).
I manage to port my code and discard the port object as a connection point, but i still left with a use case where a user drags a single port to the diagram. As this stage, we usually create a node and put the port on some spot(), but now I don’t need the port object, as an itemArray connection object, but only as an object in my[].
Yet, i need to show the port on the node.
So i thought of creating a dummy link with one end, or just add go.TextBox at the node’s spot.
Any other ideas ?

Sure, just use a different node template, and you can make it look however you like without having to worry about data compatibility with the kinds of node (data) that support multiple "port"s.

Will try,