[CommandMethod("NewDwg")]
public void NewDwg()
{
Application.DocumentManager.Add("fhfhf.dwt", "New Title");
}
}
}
namespace Autodesk.AutoCAD.ApplicationServices
{
public static class DocumentCollectionExtions
{
public static Document Add(this DocumentCollection docs, string filePath, string titleText)
{
Document doc = docs.Add(filePath);
docs.MdiActiveDocument = doc;
SetWindowText(GetActiveWindow(), titleText);
return doc;
}
[DllImport("user32.dll")]
static extern IntPtr GetActiveWindow();
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool SetWindowText(IntPtr hwnd, String lpString);
}
}