Ok, there are two ways to sendcommand
via .NET.
The first thing you need to understand is that ThisDocument
doesn't exist in .NET.
ThisDocument
is the document where the VBA code is written, but since your addin is document undependant, it stands alone and you must take the documents from the Application
object.
You access the application with:
Autodesk.AutoCAD.ApplicationServices.Application
If you want to transform it to the same Application object as in VBA, with same methods and functions
using Autodesk.Autocad.Interop;
using Autodesk.Autocad.Interop.Common;
AcadApplication App = (AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
The first application has MdiActiveDocument
, from where you can call the Editor
and send written commands, or call the SendStringToExecute
as said in other answer.
The AcadApplication
has ActiveDocument
(an AcadDocument object that behaves exactly as in VBA).
This document will have the same SendCommand
your VBA has, use it the same way it's done in VBA.
If you can explain better the autoexecute part, I can help with that too.