Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are two types of ActiveX/COM plugins:

...

  1. Create a new C#  or VB.NET project using Visual Studio project Wizard( **minimum requirement .NET Framework v4.5)

  2. From Solution Explorer, add references of OdaX_x.xx_xx*.dllARESC.exe and TD_Mgd_x.xx_xx.dll from ARES Commander installation folder.

  3. You can see the available NameSpaces, Class Methods, and Properties in each assembly using Object Browser.

  4. Rename Program.cs to PluginCommands. This will change class Program to class PluginCommands as in the following example:

    Code Block
    languagec#
    themeRDark
    firstline1
    linenumberstrue
    namespace ActiveXCOMSample
    {
    	public class PluginCommands
    	{
    	}
    }

    Defining a command uses Runtime namespace to access CommandMethod attribute and add a method with this attribute. See AnyFunctionName() in the following example.
    The following example defines the MySampleCommand command.

    Code Block
    languagec#
    themeRDark
    firstline1
    linenumberstrue
    using Teigha.Runtime;
    
    namespace ActiveXCOMSample
    {
    	public class PluginCommands
    	{
    		[CommandMethod("MySampleCommand")]
    		public void AnyFunctionName()
    		{
    		}
    	}
    }

    Using a similar procedure you can create all types of in-process plugin.

  5. Building the sample project generates dll or <YourProjectName.dll>

Running the NETLOAD Command

  1. Start ARES Commander.
  2. Type NETLOAD at the command prompt and press Enter. Navigate to PluginCommands.dll and load it.
    The command window displays a confirmation message.
  3. Run MySampleCommand which

...

  1. executes the AnyFunctionName method.

...

  1. Because Ares is already running, use GetActiveObject method instead of creating instance of AcadApplication

...

  1. .
  2. For Marshal, use System.Runtime.InteropServices

Use the same procedure for accessing various ActiveX/COM objects and collections.

Code Block
languagec#
themeRDark
firstline1
linenumberstrue
using Teigha.Runtime;
using PCAD_AC_X;
using System.Runtime.InteropServices;

namespace ActiveXCOMSample
{
	public class PluginCommands
	{
		[CommandMethods("MySampleCommand")]
		public void AnyFunctionName()
		{
			IAcadApplication app = (IAcadApplication)Marshal.GetActiveObject("PCAD_AC_X.AcadApplication");
		}
	}
}
  • Rest procedure for accessing various ActiveX/COM objects and collections is same.

...

Migrating AutoCAD® ActiveX PlugIn Application to ARES Commander

The ActiveXYou can easily migrate ActiveX/COM applications running on AutoCAD® platform can be easily migrated platform to ARES Commander by making minimal changes..

The following changes are necessary:

  • Replace AutoCAD® ActiveX/COM assemblies by ARES ActiveX/COM (OdaX_x.xx_xx and ARESC.exe) assemblies.
  • Replace Autodesk.AutoCAD namespace by Teigha namespace in source code.
  • Replace AutoCAD to PCAD_AC_X and AXDBLiB to PCAD_DB_X in source code.

...