I have a function that requires the use if the session context. I also need to store something in the users# variables. The problem I have is that if you are in the session context the SetSystemVariable does not work. I have added 2 code samples the first one is an example of it not working. The second is in the document context which works as expected.
Any help would be great.
[Autodesk.AutoCAD.Runtime.CommandMethod("TEST", CommandFlags.Session)]
public static void FS_T1()
{
AcadApp.SetSystemVariable("USERS4", "SESSION");
}
[Autodesk.AutoCAD.Runtime.CommandMethod("TEST1")]
public static void FS_T2()
{
AcadApp.SetSystemVariable("USERS4", "DOCUMENT");
}
Lock the document and try it
<CommandMethod("TEST", CommandFlags.Session)> _ Public Shared Sub FS_T1() Using dLock As DocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument Application.SetSystemVariable("USERS4", "SESSION") End Using End Sub