Versions Compared

Key

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

These plug-ins There are of two types of ActiveX/COM plugins:

  • Out-Process: Runs as a separate .exe file.
  • In-Process:Using Runs using the NETLOAD command.

Out-Process Active/COM Plugins

  1. Create a new C#  or VB.NET

...

  1. project using the Visual Studio project Wizard( **minimum requirement .NET Framework v4.5).
    One can either create Windows Form Application, Console Application or Class Library.

    Image Modified

...

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

...

  1. from ARES Commander installation folder.

    Image Modified

...

  1. You can add references by searching PCAD_AC_X and PCAD_DB_X from COM Assemblies.

...



  1. 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 SamplePlugins
    {
    	class PluginCommands
    	{
    		static void Main(string[] args)
    		{
    		}
    	}
    }


  2. There two ways to work with out process

...

  1. :
    • Create a new Instance

...

    • Attach with already running application

...




  • Creating an Instance of AcadApplication. Use PCAD_AC_X .

...

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

namespace SamplePlugins
{
	class PluginCommands
	{
		static void Main(string[] args)
		{
			AcadApplication app = (PCAD_AC_X.AcadApplication)Marshal.GetActiveObject("PCAD_AC_X.AcadApplication");
		}
	}
}

Accessing  Documents and Active Documents

  • From application object one can access collection of documents or active documents and Preferences.
  • Following Code iterates through the document collection.

...

Code Block
languagec#
themeRDark
firstline1
linenumberstrue
IAcadPreferencesDisplay AcadPref;
AcadPref = app.Preferences.Display;
int Size = AcadPref.CursorSize;


Prompting For User

  • 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 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

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

...

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

Migration of AutoCAD® ActiveX PlugIn Application to ARES Commander

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

...