Versions Compared

Key

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

There are two types of ActiveX/COM plugins:

...

  • Utility functions that allow you to request input from the user or perform geometric calculations.
  • Utility can be accessed through ActiveDocument object. There are various functions in utility that prompts user to input. for example to input integer there is GetInteger(). Like this for prompting Angle, Distance, AngleFromAxis, Keyword, etc there is a corresponding method.
  • See For reference, see the following code for the reference.
Code Block
languagec#
themeRDark
firstline1
linenumberstrue
int promptInteger;
//With prompting to user
promptInteger = app.ActiveDocument.Utility.GetInteger("Enter an integer")

//Without prompting to user
promptInteger = app.ActiveDocument.Utility.GetInteger();

In-Process

  1. Create a new C#  or VB.NET

...

  1. project using Visual Studio project Wizard( **minimum requirement .NET Framework v4.5)

    Image Modified

...

  1. From Solution Explorer, add references of OdaX_x.xx_xx*.dllARESC.exe and TD_Mgd_x.xx_xx.dll

...

  1. from ARES Commander installation folder.

    Image Modified

...

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

    Image Modified
  2. Rename Program.cs to PluginCommands

...

  1. . This will change class Program to class PluginCommands

...

  1. as in the following example:

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

    Defining a command

...

  1. uses Runtime namespace to access CommandMethod

...

  1. attribute

...

  1. and add a method

...

  1. with this attribute.

...

  1. 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()
    		{
    		}
    	}
    }

...

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

...

  1. plugin.

...

  1. Building the sample project

...

  1. generates dll or <YourProjectName.dll>




  • Run ARES and type NETLOAD on command line it will prompt to load the plug-in dll, browse PluginCommands.dll and Load, message of successful loading will appear on command line.
  • Run MySampleCommand AnyFunctionName method will be executedStart ARES Commander.
  • Type NETLOAD at the command prompt and press Enter. Navigate to PluginCommands.dll and load it. The command window displays a confirmation message.
  • Run MySampleCommand which will execute the AnyFunctionName method.
  • Now instead of creating instance of AcadApplication, we will use GetActiveObject method, because in this case Ares will already be running.
  • For Marshal use System.Runtime.InteropServices

...

  • Rest procedure for accessing various ActiveX/COM objects and collections is same.

Migration of AutoCAD® ActiveX PlugIn Application to ARES Commander

...