ARES Commander supports three .NET API sets that you can use independently. Now here we’ll going to discuss about
This document describes CFx. NET(.NET ARES) and listed it’s lists the differences with .NET Classic API's coding.
.NET Classic API
ARES COM API
CFx .NET (SWIG generated .NET API version of ARES C++ SDK)
Here We differentiate Differences between .NET Classic and .NET ARES.
...
Create a new .NET ARES project using the Visual Studio project creation Wizard( **minimum requirement .NET Framework v4.5)
From Solution Explore, add references of of the following .dll:
ArgonMGD.dll
TD_SwigCoreMgd.dllTD_SwigDbMgd.dll
TG_SwigDbMgd.dll
TD_Mgd_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 an AnyFunctionName method 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.There is another way to You can also define a command , Directly inherit directly inheriting from CFxCommand and add . Use the Setup method to add an instance of this class to command stack by using Setup method it adds the command into the stack.
Code Block namespace SamplePlugin { public class PluginCommands : CFxCommand { public bool m_bExecuted; public PluginCommands() { m_bExecuted = false; } public override string globalName() { return "SampleCMD"; } public override int Execute(CFxCommandContext pFxCmdCtx) { m_bExecuted = true; CFxDocument pFxDoc = PCADGlobals.FXAPI().GetFxDocument(); if (pFxDoc == null) return PCADGlobals.RTCAN; CFxCommandContext ctx = pFxDoc.GetFxCommandContext(); if (ctx == null) return PCADGlobals.RTCAN; PCADGlobals.GetFxSystemServices().WriteLine(new CFxString("\n SampleCMD Command Executed")); return PCADGlobals.RTNORM; } class CFxCommandTest : IExtensionApplication { DocumentReactor docReactor; PluginCommands m_test; public CFxCommandTest() { docReactor = new DocumentReactor(); } public void Initialize() { m_test = new PluginCommands(); Globals.odedRegCmds().addCommand(m_test); PCADGlobals.GetFxSystemServices().GetFxDocumentManager().AddReactor(docReactor); } public void Terminate() { Globals.odedRegCmds().removeCmd(m_test.groupName(), m_test.globalName()); PCADGlobals.GetFxSystemServices().GetFxDocumentManager().RemoveReactor(docReactor); } } } }
Build the sample project to generate PluginCommands.dll or <YourProjectName.dll>.
Start ARES Commander and type NETLOAD at the command prompt. Next, browse and load the plugin dll (PluginCommands.dll).
The command window displays a confirmation message.
...