C# - set system variable

How do I set a value to the system variables USERR1 - 5 in C#. Can't get object.SetVariable Name, Value implemented.

Comments

  • It's OK. Found it: Application.SetSystemVariable("USERR1", pt.Y);

  • If you are creating an application and want to store a 'real' in a dwg I advise you to use a different method.

  • @Roy Klein Gebbinck said:
    If you are creating an application and want to store a 'real' in a dwg I advise you to use a different method.

    That's indead what I wanted to do. Wich method would you advise?

  • Use a dictionary.

  • FYI, there's nifty place for storing temporary data, its per document.

    Hashtable Document.UserData

    example:
    Document doc = Application.DocumentManager.MdiActiveDocument;
    doc.UserData.Add(KEY, VALUE);

  • Thanks Daniel. Didn' know this possibility. They aren't lost when you close the file?

  • Hi,
    sorry, yes they are lost, as Roy mentioned a dictionary might be your best bet.

This discussion has been closed.