using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
// This line is not mandatory, but improves loading performances
[assembly: CommandClass(typeof(TestModify.MyCommands))]
namespace TestModify
{
public class MyCommands
{
[CommandMethod("TestMod", CommandFlags.Modal)]
public void MyCommand()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
if (doc == null) return;
Editor ed = doc.Editor;
PromptEntityResult rs = ed.GetEntity("\nВыберите примитив");
if (rs.Status != PromptStatus.OK) return;
using (DBObject obj = rs.ObjectId.Open(OpenMode.ForWrite))
{
obj.DowngradeToNotify(true);
}
}
}
}