Adding a part into a diagram on button click

Using this as an example:

Instead of having to drag the parts from my palette

, is it possible to remove “
” completely from my code, and add the parts into the centre of myDiagram by the click of a button?

For e.g., if I have the following HTML code

So if I click on START, it will add the START part into the centre of the diagram.

If you want to locate a new node to be at the center of the viewport, and if there is a Binding of Node.location to node data (as there is in the FlowChart sample), you want to do something like: function addCenteredNode() { myDiagram.startTransaction("add node"); myDiagram.model.addNodeData({ text: "new node", loc: go.Point.stringify(myDiagram.viewportBounds.center) }); myDiagram.commitTransaction("add node"); }
Of course you can generalize this to set the text and category properties of the node data.