Table of Contents

Class CadPluginContext

Namespace
OpenCAD2D.Plugins
Assembly
OpenCAD2D.Core.dll

What a callback of a plugin is given when the window runs it: a ribbon button's, a DRAWINGS button's, a menu item's, a button's CanRun or a contextual tab's ShowWhen. A callback edits the drawing through ApplyEdit(string, IReadOnlyList<CadEditRecord>, Action<CadEditScope>) (one undo step each), or the editors commands use, as a command does.

public sealed class CadPluginContext
Inheritance
CadPluginContext
Inherited Members

Properties

Document

Gets the drawing the window shows; null where none is open.

Documents

Gets the drawings open in the app, as AutoCAD's DocumentManager holds them: the list, the active one, and the calls that open a file, add a new drawing, show one and close one. A callback of a button, a menu item or a DRAWINGS row, where no command runs, may call them all. A plugin that uses it states [assembly: CadPluginApi("1.4")].

Editor

Gets the editor of the drawing the window shows (Editor): its view, the selection by area, the system variables and the named views; null where no drawing is open. A plugin that uses it states [assembly: CadPluginApi("1.3")].

IsCommandRunning

Gets whether a command is running on the command line.

Selected

Gets the handles of the objects selected, in ordinal order; empty for none.

Methods

RunCommand(string)

Starts a command as the presenter's ribbon buttons do, a command running cancelled first, as AutoCAD's ^C^C is: "NUMCIRCLES", "_NUMCIRCLES" and ".NUMCIRCLES" start the same command.

Write(string)

Writes a line on the command line, as a command's message is.