By Virupaksha Aithal
You can use API “Autodesk.AutoCAD.ApplicationServices. Application.GetWhoHasInfo” API to identify the user who has opened the specified drawing file. The WhoHasInfo object returned contains the same information that is displayed by the WHOHAS command.
[CommandMethod("WhoHasInfoTest")]
public static void WhoHasInfoTest()
{
WhoHasInfo info = Application.GetWhoHasInfo("c:\dwg\test.dwg");
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
if (info.IsFileLocked)
{
ed.WriteMessage(info.ComputerName + " "
+ info.UserName + "n");
}
else
{
ed.WriteMessage("File is not locked for editn");
}
}

Leave a Reply