function portFigure(pid) {
      if (pid === null || pid === '') return 'XLine';
      if (pid[0] === 'F') return 'CircleLine';
      if (pid[0] === 'M') return 'PlusLine';
      return 'XLine'; // including when the first character is 'U'
    }

    myDiagram.nodeTemplate.contextMenu = go.GraphObject.build('ContextMenu')
      .add(
        makeButton('Rotate +45', (e, obj) => rotate(obj.part.adornedPart, 45)),
        makeButton('Rotate -45', (e, obj) => rotate(obj.part.adornedPart, -45)),
        makeBut