Table of Contents

Method StartTool

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

StartTool(CadTool, GeoPoint2?)

Runs a tool of a tool palette, as clicking it does in AutoCAD. A command tool starts the command of its line, with the answers the line gives to its first prompts fed in; a hatch tool starts HATCH with the tool's pattern, angle and scale; a block tool starts INSERT with its block, scale and rotation, asking the insertion point on the command line (and the scale and rotation, where the tool prompts for them). The tool's layer, colour, linetype and lineweight are the current ones while the command runs, and the drawing's are put back when it ends or is cancelled. A command running is ended first, as Esc would.

public bool StartTool(CadTool tool, GeoPoint2? at = null)

Parameters

tool CadTool

The tool.

at GeoPoint2?

Where the tool is dropped on the drawing, as dragging it from the palette does: a block is put there, scale and rotation as the tool has them, and a hatch fills the area round it; null to ask on the command line. A command tool ignores it.

Returns

bool

False, with the reason written to the history, where the tool cannot run: a text or separator tool, a command tool with no command or one that is unknown, a block tool whose block is not in the drawing and whose drawing cannot be found.

Exceptions

ArgumentNullException

Thrown when the tool is null.