using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
[assembly: ExtensionApplication(typeof(Rivilis.RefEditSubst))]
[assembly: CommandClass(typeof(Rivilis.RefEditSubst))]
namespace Rivilis
{
public class RefEditSubst : IExtensionApplication
{
void IExtensionApplication.Initialize()
{
// Preloading AutoCAD RefEdit command arx-file
SystemObjects.DynamicLinker.LoadModule("AcRefEd.arx", false, false);
}
void IExtensionApplication.Terminate()
{
// Do plug-in application clean up here
}
//------------------------------------------------
// Command group MUST be "ACAD_MAIN"
//------------------------------------------------
[CommandMethod("ACAD_MAIN", "RefEdit", CommandFlags.UsePickSet)]
public void RefEdit() // This method can have any name
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
ed.WriteMessage("MyRefEdit..");
if (doc.Name.Contains("Test"))
{
ed.WriteMessage("selected ref..");
}
else
{
doc.SendStringToExecute("_ACAD_REFEDIT.REFEDIT ", true, false, false);
}
}
}
}