Modify OSMODE mode in .NET

By Virupaksha Aithal

GetsystemVariable and SetSystemVariable of the Application object can be used to access the OSMODE setting. Refer below .NET code

[CommandMethod("testOsnap")]
public static void testOsnap()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Editor ed = doc.Editor;
 
    Object obj = Application.GetSystemVariable("osmode");
    ed.WriteMessage("Current OSNAP : " + obj.ToString() + "n");
    Application.SetSystemVariable("OSMODE", 2);
 
    //get the new OSNAP value..
    obj = Application.GetSystemVariable("osmode");
    ed.WriteMessage("OSNAP : " + obj.ToString() + "n");
}

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading