Versions Compared

Key

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

ARES Commander provides .NET API which lets you author third party Plugin Software for ARES Commander.

...

  1. .NET Classic API
  2. ARES COM API
  3. CFx .NET (SWIG generated .NET API version of ARES C++ SDK)
API Assembly NamesNature of PluginLoading Mechanism
NET Classic API

TD_Mgd_x.xx_xx.dll

FxCoreMgd_x.xx_xx.dll

In-processUse 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

  •  In-process-Use NETLOAD command
  • Out-rocess-  Runs as a separated EXE
CFx .NET

ArgonMGD.dll

TD_SwigCoreMgd.dll

TD_SwigDbMgd.dll

TG_SwigDbMgd.dll

TD_Mgd_x.xx_xx.dll

In-processUse NETLOAD command


.NET Classic Plugin:

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

...

Code Block
languagec#
themeFadeToGrey
linenumberstrue
        //Method attribute to define lisp callable function 'LispTest' 
        //i.e (setq x (lisptest "Text created by .NET lisp function" 1.0 '(10 10 0)))
        [LispFunction("lisptest")]
        public ResultBuffer DoIt(ResultBuffer args)
        {
            // Get the database of the active document.
            Database db = HostApplicationServices.WorkingDatabase;
            TypedValue[] argsVal = new TypedValue[3];
            if (args != null)
            {
                argsVal = args.AsArray();
            }
            else
            {
                argsVal[0] = new TypedValue((int)LispDataType.Text, "Default Text");
                argsVal[1] = new TypedValue((int)LispDataType.Double, .2);
                argsVal[1] = new TypedValue((int)LispDataType.Point3d, new Point3d(0, 0, 0));
            }
            // Set up transaction manager.
            Teigha.DatabaseServices.TransactionManager tm = db.TransactionManager;
            using (Transaction tr = tm.StartTransaction())
            {
                try
                {
                    Point3d pPosition = new Point3d(0, 0, 0);

                    // Create a new MText object and set properties.
                    DBText pText = new DBText();
                    pText.TextString = (String)argsVal[0].Value;
                    pText.Height = Convert.ToDouble(argsVal[1].Value);
                    pText.Position = (Point3d)argsVal[2].Value;

                    // Get model space to add the MText object.
                    BlockTable pBlockTable = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite);
                    BlockTableRecord pModelSpace = (BlockTableRecord)tr.GetObject(pBlockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

                    // Add the object to the model space.
                    ObjectId id = pModelSpace.AppendEntity(pText);
                    tr.AddNewlyCreatedDBObject(pText, true);

                    // Commit changes to database.
                    tr.Commit();
                    //return created text entity to lisp
                    return new ResultBuffer(new TypedValue((int)LispDataType.ObjectId, id));
                }
                finally
                {
                    // delete tr , managed by c# with garbage collection
                }

            }
        }



Migration of AutoCAD® .NET Classic Application to ARES Commander

...