Add port in code

Is it possible to add a port to a gobasicNode object. If yes, how can i do this.

Kind regards, michi

Chapter 6 of the User Guide describes all of the built-in node classes and how they are intended to be used.

GoBasicNode, GoIconicNode, and GoBoxNode all are designed to have just one port. The actual points at which links connect to the port are dynamically computed.
So the answer to your question is "you probably wouldn't want to", but that brings us to "what are you trying to do?".

Hallo i want to draw a rectangle, and add ports dynamical from code. I want to position this nodes on the border of the rectangle. How can i achieve this.

kind regards

Look at GoGeneralNode then. This will give you any number of ports on the left and right sides (or top/bottom).

There's also MultiPortNode in Demo1, which shows how to stick ports anywhere.

Just create them, initialize them to have the appearance you want including their Size, position them relative to the Shape where you want, and then Add them to the node.

If you expect the size of the Shape to change for any reason, such as when the GoBasicNode.LabelSpot is GoObject.Middle and you change the Text string, you need to override LayoutChildren to adjust the positions of the ports appropriately.
The MultiPortNode example class in Demo1 does something similar. It uses a GoIconicNode instead of GoBasicNode as the base node class.