#### 11.5.2 Ports and Directions

When an arrow or line starts or ends in a block, you can add a port after the block name and the ’at’ symbol (’`@`’).71 This will make the arrow or line start or and at the part of the block denoted by the port. Boxes have eight ports defined (`topleft`, `top`, `topright`, `bottomleft`, `bottom`, `bottomright`), whereas each shape can define its own ports. See Defining Shapes.

In addition to the above ports, you can apply a compass point to any block as a port. These can be `n`, `ne`, `e`, `se`, `s`, `sw` or `w` and will make the arrow start/end at the countour of the block seen in the specified compass point from its center. You can also specify a number in degrees, which is interpreted as clockwise from the north (top) direction.

In addition to ports you can also specify a direction, which govern, what the arrow or line leaves the block. This can be any of the above compass points (or degree numbers), or `perp`, which is a direction perpendicular to the contour of the block.

Ports usually have a default direction. This equals the direction of the compass point or degree number if that is used as a port. If you omit the direction after specifying a port then the default direction of the port is used. If the port has no default direction or there is no port specified (like, for example, with the simple `a->b;`), the direction will point towards the other end of the arrow or line.

When you specify a direction (via a port default or explicitly), Msc-generator starts the arrow in the given direction, before gradually turning to where the arrow must go. This is done by setting a waypoint 10 pixels from the contour of the block in the direction you specify. If you want a larger or smaller distance (leading to a wider or tighter arc) you can use the `distance` attribute for the starting or ending blocks. That is the line below will result in a tight arc at the block a, but a wider arc at block b.

    a@ne -> b@nw [distance=a@5, distance=b@20];

Setting the `distance` for all blocks also impacts the waypoint distance, but only if set to a value larger than 10. If you want to reduce the waypoint below 10, use the `distance` attribute specifically for the starting or ending block as in the above example.

#### Footnotes

##### (71)

Ports and directions work similar to graphviz, with the exception of using the ’at’ symbol (’`@`’) instead of the colon (’`:`’) to separate the block, the port and the direction. In graphviz the direction is called a compass point, because one can only use a compass point to specify a direction.