ARES commander provide Commander provides .NET API to that lets you author third party Plugin Software for ARES Commander.
Supported API Sets
ARES Supports 3 Commander supports three API sets which that you can be used use independently.
- .NET Classic API
- ARES COM API
- CFx .NET (SWIG generated .NET API version of ARES C++ SDK)
API | Assembly Names | Nature of Plugin | Loading Mechanism |
---|---|---|---|
NET Classic API | TD_Mgd_x.xx_xx.dll FxCoreMgd_x.xx_xx.dll | In-process | Use the NETLOAD command |
ARES COM API | ARESC.exe OdaX_x.xx_xx.dll TD_Mgd_x.xx_xx.dll(For In-process plugin only) | In-process Out-process |
| |||
CFx .NET | ArgonMGD.dll TD_SwigCoreMgd.dll TD_SwigDbMgd.dll TG_SwigDbMgd.dll TD_Mgd_x.xx_xx.dll | In-process | Use the NETLOAD command |
Creating a .NET Classic Plugin:
- Create a new
...
- C# or VB.NET
...
- project using the Visual Studio project creation Wizard( **minimum requirement .NET Framework v4.5)
...
- From Solution Explore
...
- , add references of TD_Mgd_x.xx_xx*.dll
...
- and FxCoreMgd_x.xx_xx.dll
...
- from the ARES Commander installation folder.
...
You can
...
- see all available NameSpaces, Classes, Methods, and Properties in each assembly
...
- in the Object Browser.
...
- Rename Class1.cs
...
- to PluginCommands.cs
...
- . This changes the class Class1 to class PluginCommands
...
- , as in the following example.
- Defining a command
...
- uses Teigha.Runtime namespace to access CommandMethod method
...
- attribute and
...
- adds a method
...
- , such as AnyFunctionName that has this attribute.
...
- The following example defines the MySampleCommand command which
...
- you can run later in ARES Commander, from the command prompt.
You can define all types of in-process
...
- plugin using a similar procedure.
- Build the sample project
...
- to generate PluginCommans.dll or <YourProjectName.dll>.
...
- Start ARES Commander and type NETLOAD
...
- at the command
...
- prompt. Next, browse and load the plugin dll
...
- (PluginCommands.dll
...
- ).
The coommand window displays a confirmation message. - Run
...
- MySampleCommand, which executes the AnyFunctionName method
...
- .
Accessing Application Object
...
Accessing Documents and ActiveDocument
From application object one can access document manager, Document Manager has peroperties and Methods by which one can access active document and also can add new document or open You can access the Document Manager from the application object.
The Document Manager provides properties and methods that let you perform the following:
- Access the active document
- Add a new document
- Open existing drawings.
...
Prompting for User
...
Input
For user IO Editor class is responsible, one can get it from Document and all related class for UserIO are available in The Editor class controls the user input and prints the output into command window. All related classes for prompting on the command window are available in Teigha.EditorInput namespace.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Document activeDocument = docManager.MdiActiveDocument; Editor ed = activeDocument.Editor; PromptIntegerOptions op = new PromptIntegerOptions("Input a positive integer"); op.AllowNegative = false; PromptIntegerResult res =(PromptIntegerResult) ed.DoPrompt(op); if( res.Status == PromptStatus.OK) { int retVal = res.Value; } |
...
.NETExtension Application allow user to run their lets you run your code while loading the plugin. i.e when plugin is loaded it want to add some entries in Ribbon or want to show some UI palatte in ARES Commander then creating the extension application is the right choice. But it is optional and totally depend upon the requirement.To make Plugin as Extension Application one has add a class into project and this class has to implement IExtensionApplication interface and each For example, you can create the Plugin as an Extension Application to display tabs on the Ribbon or palettes while the plugin is loading in the software.
To create the Plugin as an Extension Application, add a class that implements IExtensionApplication interface. Each plugin can have only one class of such this type.
When you load the plugin using the NETLOAD command, the software automatically calls public void Initialize() get called when this plugin loaded via NETLOAD command and Terminate one this plugin unloaded by the System. When the System unloads the plugin, it calls Terminate.
Defining .NET LispFunction
Third party can define .NET methods which is usable that you can use later in LISP, below example defining . The following example defines the lisptest function using the LispFunction Method attribute this funcion is callable by LISP script as .
To call the lisptest function, use the following LISP script:
(setq x (lisptest "Text created by .NET lisp function" 1.0 '(10 10 0)))
...