.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

setting USERS1-5 while in CommandFlags.Session

1 REPLY 1
Reply
Message 1 of 2
trevor_templeton
520 Views, 1 Reply

setting USERS1-5 while in CommandFlags.Session

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");
}

1 REPLY 1
Message 2 of 2

 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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost