Change default in PolyDrawing Sample

This might be very basic thing to ask but how to change the default mouse down tool to select instead of free hand drawing in the Div.? Initially it is set to free hand and then you click on Select button to switch.
How to keep the default value to Select ?

The FreehandDrawing.html sample installs the FreehandDrawingTool as a mode-less mouse-move tool (in ToolManager.mouseMoveTools). That means that whenever its canStart predicate returns true, it will run.

So don’t install it as a mode-less tool, but when you want the user to draw just one such part, instead set Diagram.currentTool to an instance of FreehandDrawingTool.

Note how in the definition of FreehandDrawingTool.doMouseUp it always calls Tool.stopTool, so it won’t continue by itself.

Can you help me with a snippet for PolyDrawing as I am still trying to figure out how it works?
I am unable to get some of the parts.
Thank You!

Oops, now I see you clearly said/meant PolygonDrawingTool, not FreehandDrawingTool. Still, my recommendation is exactly the same. Don’t install a PolygonDrawingTool in the ToolManager.mouseDownTools list. When you want to run the tool, set Diagram.currentTool.

function mode(draw, polygon) {
    // assume PolygonDrawingTool is the first tool in the mouse-down-tools list
    var tool = myDiagram.currentTool;
    if(draw && tool instanceof PolygonDrawingTool)
    {
      tool.isEnabled=draw;
            tool.isPolygon = polygon;
              myDiagram.toolManager.mouseDownTools.insertAt(0,tool);
  }
  else {
    {
      tool.doCancel();
        }
  }
}

Is it something like this? I know this contains errors… Can you help figuring out where am I wrong?

If I’m understanding what you want correctly, just set tool.isEnabled = false before adding the PolygonDrawingTool to the mouseDownTools list.

// create polygon drawing tool for myDiagram, defined in PolygonDrawingTool.js
var tool = new PolygonDrawingTool();
// provide the default JavaScript object for a new polygon in the model
tool.archetypePartData =
  { fill: "yellow", stroke: "blue", strokeWidth: 3, category: "PolygonDrawing" };
tool.isPolygon = true;  // for a polyline drawing tool set this property to false
tool.isEnabled = false;  // start the tool as disabled
// install as first mouse-down-tool
myDiagram.toolManager.mouseDownTools.insertAt(0, tool);